text: Array.prototype.map||(Array.prototype.map=function(e){var t,n,i,s,o,a,r;if(null==this)throw new TypeError("this is null or not defined");if(s=Object(this),o=s.length>>>0,"function"!==typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(t=arguments[1]),n=new Array(o),i=0;o>i;)i in s&&(a=s[i],r=e.call(t,a,i,s),n[i]=r),i++;return n});window.console||(window.console={log:function(){}});(function(){"use strict";var e={version:"0.3.4",config:{}};e.log=function(e,t,n){this.config.debug&&console.log("%c"+(t||"info")+" ","color:"+(n||"")+";",e)};e.typeName=function(e){var a =(typeof e);return a.slice(0,1).toUpperCase()+a.slice(1)};e.loadJs=function(e,t){var n=document.getElementsByTagName("head")[0],i=document.createElement("script");i.onload=i.onreadystatechange=i.onerror=function(){i&&i.readyState&&/^(?!(?:loaded|complete)$)/.test(i.readyState)||(i.onload=i.onreadystatechange=i.onerror=null,i.src="",i.parentNode.removeChild(i),i=null,t&&t())},i.src=e;try{n.appendChild(i)}catch(s){}};e.loadCss=function(e,t){var n=document.getElementsByTagName("head")[0],i=document.createElement("link"),s=document.getElementById(t);i.onload=i.onreadystatechange=i.onerror=null,i.rel="stylesheet",i.href=e;try{s?i=null:(t&&(i.id=t),n.appendChild(i))}catch(o){}};e.init=function(t){e.is=function(){var e={},t=navigator.userAgent;return e.ios=!!t.match(/(iphone|ipod|ipad)/i),e.android=!!t.match(/android/i),e.wechat=!!t.match(/micromessenger/i),t=t.match(/msie \d+?/i),e.ie=function(){var e=navigator.userAgent.toLowerCase();return window.ActiveXObject||"ActiveXObject"in window?(e.match(/msie\s(\d+)/)||[])[1]||"11":!1}(),e}();e.get={query:function(e){var t=new RegExp("(\\?|#|&)"+e+"=([^&#]*)(&|#|$)"),n=location.href.match(t);return decodeURIComponent(!n?"":n[2])},index:0,path:function(){var e=document.scripts,t=e[e.length-1],n=t.src;return n.substring(0,n.lastIndexOf("/")+1)}(),genId:function(e){return(e|0)+ ++this.index},_className:{open:"nui-open"},check:{phone:function(e){return/^1\d{10}$/g.test(e)?void 0:"手机格式不合法"},pass:function(e){return/[a-z0-9]{6,}/g.test(e)?void 0:"密码太过简单"},repass:function(e,t){return t===e?void 0:"两次密码不一致"},email:function(e){return/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e)?void 0:"邮箱格式不正确"},url:function(e){return/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/.test(e)?void 0:"链接格式不正确"},date:function(e){return/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/.test((e||"").slice(0,10))?void 0:"日期格式不正确"},number:function(e){return/^\d+$/.test(e)?void 0:"只能填写数字"},identity:function(e){return/(^\d{15}$)|(^\d{17}(x|X|\d)$)/.test(e)?void 0:"请输入正确的身份证号"},checked:function(e){return this.checked?void 0:e||""},required:function(e,t){return""!==e.replace(/\s/g,"")?void 0:t||"此项不能为空"}}};e.get.param=e.get.query;e.util={stop:function(e){e=e||window.event,e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},randomSize:function(e,t,n){return e=e||0,t=t||10,(e+Math.random()*(t-e)).toFixed(n||0)},drop:function(e,n){var i=t(document),s=t(window),o=e,a=o.find(n),r={};a.on("mousedown",function(e){e.preventDefault(),r.start=!0,r.offset=[e.clientX-parseFloat(o.css("left")),e.clientY-parseFloat(o.css("top"))]}),i.on("mousemove",function(e){if(r.start){var t=e.clientX-r.offset[0],n=e.clientY-r.offset[1],i="fixed"===o.css("position");e.preventDefault(),r.stX=i?0:s.scrollLeft(),r.stY=i?0:s.scrollTop();var a=s.width()-o.outerWidth()+r.stX,c=s.height()-o.outerHeight()+r.stY;t<r.stX&&(t=r.stX),t>a&&(t=a),n<r.stY&&(n=r.stY),n>c&&(n=c),o.css({left:t,top:n})}}).on("mouseup",function(){r.start&&(r.start=null)})},date:{n2s:function(e){return 10>e?"0"+(e|0):e},format:function(e,t){var n;typeof e!=="object"&&(e=new Date(e));n=e.getFullYear();var i=this.n2s(e.getMonth()+1),s=this.n2s(e.getDate()),o=this.n2s(e.getHours()),a=this.n2s(e.getMinutes()),r=this.n2s(e.getSeconds());switch(t){case"yyyy-MM-dd HH:mm:ss":n=n+"-"+i+"-"+s+" "+o+":"+a+":"+r;break;case"yyyy-MM-dd HH:mm":n=n+"-"+i+"-"+s+" "+o+":"+a;break;case"yyyy-MM":n=n+"-"+i;break;case"yyyy":break;default:n=n+"-"+i+"-"+s}return n},toDate:function(e){if(e){var t,n,i,s,o,a;if(19===e.length)return t=e.substring(0,4),n=e.substring(5,7),i=e.substring(8,10),s=e.substring(11,13),o=e.substring(14,16),a=e.substring(17,19),new Date(t,n-1,i,s,o,a);if(16===e.length)return t=e.substring(0,4),n=e.substring(5,7),i=e.substring(8,10),s=e.substring(11,13),o=e.substring(14,16),a=e.substring(17,19),new Date(t,n-1,i,s,o);if(10===e.length)return t=e.substring(0,4),n=e.substring(5,7),i=e.substring(8,10),new Date(t,n-1,i);if(7===e.length)return t=e.substring(0,4),n=e.substring(5,7),new Date(t,n-1);if(4===e.length)return t=e.substring(0,4),new Date(t)}},countDown:function(e){var t=(this.toDate(e)-this.toDate(this.now("yyyy-MM-dd HH:mm:ss")))/1e3,n,i;0<t?(e=Math.floor(t/86400),n=Math.floor(t/3600)-24*e,i=Math.floor(t/60)-60*n-1440*e,t=Math.floor(t%60)):e=n=i=t=0;return{dd:this.n2s(e),d:e,HH:this.n2s(n),H:n,mm:this.n2s(i),m:i,ss:this.n2s(t),s:t}},now:function(e,t){typeof e==="string"&&(t=e);var n=Date,i;e|0?(i=parseInt(e),i=864e5>i?+new Date+864e5*i:i):i=+new Date;n=new n(i);return t?this.format(n,t):this.format(n)},history:function(e,t){"string"===typeof e&&(e=this.toDate(e));var n=(new Date).getTime()-e;return 2592e6<n?this.format(e,t):864e5<=n?(n/1e3/60/60/24|0)+"天前":36e5<=n?(n/1e3/60/60|0)+"小时前":3e5<=n?(n/1e3/60|0)+"分钟前":"刚刚"}},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")},copy:function(t){try{var n=document.createElement("textarea");n.value=t;n.readOnly=!0;document.body.appendChild(n);n.select();if(n.setSelectionRange)n.setSelectionRange(0,n.value.length);document.execCommand("copy")?e.showSuccess("已复制"):e.toast("复制失败");document.body.removeChild(n)}catch(i){e.toast("当前浏览器不支持，请手动复制")}},extend:function(e,t){if(typeof e==="object")for(var n in t)e[n]=typeof t[n]==="undefined"||t[n]===null?e[n]:t[n];return e}};e.http=function(n,i,s,o){if(n){if("function"===typeof i){o=s,s=i}var a=this.config;o=o||{};i=i||{};if(n.toLowerCase().slice(0,4)!=="http"){if(a.baseUrl)n=a.baseUrl+n}return t.ajax({type:o.type||"post",dataType:o.dataType||"json",data:i,url:n,timeout:o.timeout||1e4,success:function(e){s&&s(e);o.complete&&o.complete(e)},error:function(t){o.error?o.error(t):e.toast("网络超时");e.log(t,"http-error: "+n,"red");o.complete&&o.complete(t)}})}};e.cookie=function(e,t,n){e=e||"";var i,s,o;if("undefined"===typeof t){if(t=null,document.cookie&&""!==document.cookie)for(n=document.cookie.split(";"),s=0;s<n.length;s++)if(i=n[s].replace(/^\s\s*/,"").replace(/\s\s*$/,""),i.substring(0,e.length+1)===e+"="){t=decodeURIComponent(i.substring(e.length+1));break}return t}n=n||{};null===t&&(t="",n.expires=-1);i="";n.expires&&("number"===typeof n.expires||n.expires.toUTCString)&&("number"===typeof n.expires?(s=new Date,s.setTime(s.getTime()+864e5*n.expires)):s=n.expires,i="; expires="+s.toUTCString());s=n.path?"; path="+n.path:"; path=/";o=n.domain?"; domain="+n.domain:"";n=n.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),i,s,o,n].join("")};e.store=function(e,t){return window.localStorage&&typeof JSON?function(){if(typeof e==="string"){if(typeof t==="undefined"){t=window.localStorage.getItem(e);return JSON.parse(t)||t}else{t=typeof t==="object"?JSON.stringify(t):t;return window.localStorage.setItem(e,t)}}else{return window.localStorage.clear()}}():void 0};e.tpl=function(e,t,n){var i={open:"{{",close:"}}"},s={exp:function(e){return new RegExp(e,"g")},query:function(e,t,n){return o((t||"")+i.open+["#([\\s\\S])+?","([^{#}])*?"][e||0]+i.close+(n||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&quot;")},error:function(e,t){return"object"===typeof console&&console.error("tpl Error："+e+"\n"+(t||"")),"tpl Error："+e}},o=s.exp,a=function(e){this.tpl=e};a.pt=a.prototype,window.errors=0,a.pt.parse=function(e,t){var n=e,a=o("^"+i.open+"#",""),r=o(i.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(o(i.open+"#"),i.open+"# ").replace(o(i.close+"}"),"} "+i.close).replace(/\\/g,"\\\\").replace(/(?="|')/g,"\\").replace(s.query(),function(e){return e=e.replace(a,"").replace(r,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(s.query(1),function(e){var t='"+(';return e.replace(/\s/g,"")===i.open+i.close?"":(e=e.replace(o(i.open+"|"+i.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),t='"+_escape_('),t+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return this.cache=e=new Function("d, _escape_",e),e(t,s.escape)}catch(c){return delete this.cache,s.error(c,n)}},a.pt.render=function(e,t){var n;return e?(n=this.cache?this.cache(e,s.escape):this.parse(this.tpl,e),t?void t(n):n):s.error("no data")};var r=function(e){return"string"!==typeof e?s.error("Template not found"):new a(e)};return r.config=function(e){e=e||{};for(var t in e)i[t]=e[t]},n?(r(e).render(t,n),this):r(e).render(t)};e.upload=function(e){var n=function(e){this.options=e},i="nui-iframe-uploader";n.prototype.init=function(){var e=this,n=e.options,s=t("body"),o=t(n.elem),a=t('<iframe id="'+i+'" height="0" width="0" frameborder="0" style="position: absolute; visibility: hidden" class="'+i+'" name="'+i+'"></iframe>');return document.getElementById(i)||s.append(a),o.each(function(s,o){o=t(o);var a='<form target="'+i+'" method="'+(n.method||"post")+'"  enctype="multipart/form-data" action="'+(n.url||"")+'"></form>';a=t(a),o.wrap(a),o.off("change").on("change",function(){e.action(this)})})},n.prototype.error=function(e){var t=this,n=t.options;"function"===typeof n.error?n.error(e):console.error(e)},n.prototype.action=function(e,n){var s=this,o=s.options,a=e.value,r=t(e),c=o.ext||"";if(a){if(c&&c.split(",").toString().indexOf(/\.[^\.]+$/.exec(a)[0].slice(1))===-1)return s.error("不支持该文件格式"),e.value="";o.before&&o.before(e),r.parent().submit();var l=t("#"+i),f=setInterval(function(){var e;try{e=l.contents().find("body").text()}catch(t){s.error("上传接口存在跨域"),clearInterval(f)}if(e){clearInterval(f),l.contents().find("body").html("");try{e=JSON.parse(e)}catch(t){return e={},s.error("数据异常")}"function"===typeof o.success&&o.success(e,t)}},30);e.value=""}},new n(e=e||{}).init()};e.form=function(n,i,s){n=typeof n==="object"?n:{};i=typeof i==="function"?i:n.success;typeof n.scroll==="undefined"&&(n.scroll=true);var o={},a={check:e.get.check,times:0,submit:function(i){var s=i.find("[name]"),o=n.data||{},r=!0,c="";return s.each(function(){try{var i=t(this),s=i.attr("data-check")||i.attr("check"),l=i.attr("name"),f=i.val(),u;if(s){switch(n.check&&typeof n.check[s]||typeof a.check[s]){case"function":switch(s){case"pass":c=i.val();u=a.check[s](f);break;case"repass":u=a.check[s](f,c);break;case"checked":var d=this.getAttribute("title");d&&(u=a.check.checked.call(this,d));break;default:u=a.check[s](f);break}break;default:u=a.check.required(f,s);break}if(u){r=!1;n.scroll?e.anchor(i,function(){i.focus()}):i.focus();typeof n.message==="function"?n.message.call(this,l,i):e.toast(u);return r}}if(!a.check.required(f)&&l){var p=this.tagName.toLowerCase(),h=this.type;if(h==="radio"){this.checked&&(o[l]=f)}else if(h==="checkbox"){o[l]=o[l]||[],this.checked&&o[l].push(f)}else o[l]=f}}catch(m){e.log(m,"error")}}),r&&a.action.call(this,o),!1},action:function(o){var a=t(this),r=a.attr("action")||n.url,c="is-disabled",l=o||{};if(a.hasClass(c)){nui.toast("加载中")}else{for(var f in l)typeof l[f].map==="function"&&(l[f]=l[f].toString());if(r){a.addClass(c);s=s||{};s.error=function(e){s.error&&s.error(e);a.removeClass(c)};e.http(r,l,function(e){a.removeClass(c);i(e)},s)}else{console.error("data-form,URL is empty!")}}}},r={checkbox:function(e){var n=this,i=e||"checkbox",s=t(n).find("input[type="+i+"]");return s.each(function(){var e=t(this),n={id:e.attr("id")||"",css:"nui-form-"+(this.getAttribute("role")||i)+"-label",checked:function(e){i!=="radio"?this.checked?e.addClass("checked"):e.removeClass("checked"):s.each(function(){var e=t(this),i=e.next("."+n.css);this.checked?i.addClass("checked"):i.removeClass("checked")})},event:function(e,t,i){var s=this;e.on("click",function(){i||(s.checked=!s.checked),t.trigger("change")}),t.on("change",function(){n.checked.call(s,e)})}};e.css({position:"absolute",clip:"rect(0,0,0,0)"}),e.after(t("<label class="+n.css+' for="'+n.id+'"></label>')),n.label=e.next("."+n.css),n.checked.call(this,n.label),n.event.call(this,n.label,e,n.id);e.attr("disabled")&&e.next().addClass("is-disabled")})},select:function(){var e,n=t("select",this),i=".nui-form-select-text",s=".nui-form-select-list",o="nui-form-select";return e=function(e,n){var a=t(i,e);a.on("click",function(n){var i=t(s,e),a=t(s,"."+o);n.stopPropagation(),function(e){a.hide().parent().removeClass(e),i.show().parent().addClass(e)}(o+"ed"),function(e){t(document).one("click",function(){i.hide().parent().removeClass(e)})}(o+"ed")}),e.find("a").on("click",function(){var e=t(this),i=e.attr("data-value");e.addClass("this").siblings().removeClass("this");a.find("span").html(e.html()),n.val(i).trigger("change")})},n.each(function(){var n=t(this),i=n.val(),o=this.selectedIndex,a=t(this.options[o]),r=t(function(){for(var e='<div class="nui-form-select-list"><div class="nui-dropdown">',t=n.find("option"),i=0;i<t.length;i++)e+='<a class="nui-dropdown-item" data-value="'+t.eq(i).val()+'">'+(t.eq(i).html()||t.eq(i).val())+"</a>";return e+"</div></div>"}()),c=t('<div class="nui-form-select"><div class="nui-form-select-text nui-input"><span>'+(a.html()||i)+"</span><i></i></div>"+r.prop("outerHTML")+"</div>");c.find(s).find("a").eq(o).addClass("this"),n.hide(),n.after(c),e(n.next(),n)}),this}};return o.form=n.form,o.btn=n.btn,n.form&&t(o.form).each(function(){var e=t(this);t("[data-form]",this)[0]||this.getAttribute("data-form")||(r.checkbox.call(this),r.checkbox.call(this,"radio"),r.select.call(this),this.setAttribute("data-form",!0));typeof i==="function"&&"form"===this.tagName.toLowerCase()?function(n){o.btn&&t(o.btn,e).on("click",function(){return"a"===n.tagName.toLowerCase()&&e.trigger("submit"),!1});e.off("submit").on("submit",function(){return a.submit.call(this,e),!1})}(this):o.btn&&e.on("click",o.btn,function(){return a.submit.call(this,e),!1})}),this};e.debounce=function(e,t){var n;return function(){var i=this,s=arguments;clearTimeout(n);n=setTimeout(function(){e.apply(i,s)},t)}};e.throttle=function(e,t){var n=0;return function(){var i=+new Date;if(i-n>t){e.apply(this,arguments);n=i}}};e.close=function(n){var i=e.get._className.open,s;var o=function(e,n){e.each(function(){var e=t(this);if(!e.hasClass("is-extend")||n){if(!e.hasClass("is-remove")){e.addClass("is-remove");setTimeout(function(){e.remove()},350)}}})};if(typeof n==="number"){s=n?i+n:i;var a=n?i+"-shade"+n:i+"-shade";o(t("#"+a),true);o(t("#"+s),true)}else{if(typeof n==="string"){s=i+"-"+n;o(t("."+s));o(t("."+i+"-shade"))}else{o(t("."+i));o(t("."+i+"-shade"))}}return this};e.open=function(n){if(typeof n!=="object")return;var i={query:t,type:["dialog","toast","iframe","notice","dropdown"],doms:[],index:e.get.genId(),className:e.get._className.open,tpl:e.tpl},s=i.query(window);i.config={type:n.type|0,content:n.content||"",shade:n.shadow,shadeClose:n.shadeClose,skin:n.skin||"",fixed:typeof n.fixed!=="undefined"?n.fixed:true,title:n.title,move:n.move,offset:n.offset||"auto",area:n.width||n.area||"auto",time:n.time,zIndex:n.zIndex||20170513,full:n.full,close:n.close,extend:n.extend,success:typeof n.success==="function"?n.success:false,cancel:typeof n.cancel==="function"?n.cancel:false};i.setConfig=function(t){if(this.query("#"+i.className+i.index)[0])return;var s=this,o=0,a=i.config,r=["shade","title","close","content","hd","bd","btnfull"];for(o in r){i.doms[r[o]]=i.className+"-"+r[o]||""}if(a.type>4)return;if(typeof a.area==="string"){a.area=a.area==="auto"?["",""]:[a.area,""]}if(typeof c)var c=a.content,l=typeof a.content==="object";if(l)return;var f=function(e,t){return typeof e==="undefined"?t:e};switch(a.type){case 0:a.title=f(a.title,"信息");a.move=f(a.move,true);a.shade=f(a.shade,.3);break;case 1:s.close("toast");a.time=f(a.time,2);break;case 2:e.close();a.title=f(a.title,"窗体");a.move=f(a.move,true);a.shade=f(a.shade,.3);a.content=l?a.content:[a.content,"auto"];a.content='<iframe scrolling="'+(a.content[1]||"auto")+'" allowtransparency="true" onload="this.className=\'\';" class="" frameborder="0" src="'+a.content[0]+'"></iframe>';break;case 3:s.close("notice");a.title=f(a.title,false);a.time=f(a.time,10);a.offset=f(a.time,["20px"]);break;case 4:if(!n.elem)return;a.fixed=false;a.close=false;s.close("dropdown");break}if(a.full)a.fixed=true;a.close=f(a.close,true);a.time=a.time|0;t&&t.call(this)};i.createElement=function(){var e=i;var t=e.config.title?i.tpl('<div class="{{d.doms.title}}">{{ d.config.title}}</div>',e):"";var n='<div class="'+e.doms.hd+(e.config.move?" is-move":"")+'" >'+t+(e.config.full?"<i class='"+e.doms.btnfull+"'>"+"</i>":"")+(e.config.close?"<i class='"+e.doms.close+"'>"+"</i>":"")+"</div>";var s='<div  class="'+e.doms.bd+'">'+e.config.content+"</div>";e.html=n+s;e.shade=e.className+"-shade"+e.index;var o=i.tpl('{{# var extend=d.config.extend?"is-extend":""; if(typeof d.config.shade === "number"){var color="#000",opacity=d.config.shade+";filter:alpha(opacity="+d.config.shade*100+")";}}<div class="{{d.doms.shade}} {{extend}}" id="{{d.shade}}" style="z-index:{{d.config.zIndex-1}}; background-color:{{color}};opacity:{{opacity}};"></div>{{# } }}{{# var type=d.type[d.config.type],classType=d.className+"-"+type,classBorder=(d.config.type==0||d.config.type==2)&&!d.config.shade?d.doms.border:"",classSkin=d.config.skin,classStyle="z-index:"+d.config.zIndex+";width:"+d.config.area[0]+";height:"+d.config.area[1]+(d.config.fixed?"":";position:absolute;");}}<div class="{{d.className}} {{classType}} {{classSkin}} {{extend}}" id="{{d.className+d.index}}" style="{{classStyle}}">{{d.html}}</div>',e);e=null;return o};i.auto=function(e){var t=this,n=t.config,o=t.that=t.query("#"+i.className+e);var a=[o.innerWidth(),o.innerHeight()];var r=o.find("."+i.doms.hd,o).outerHeight()||0;var c=o.find("."+i.doms.fd).outerHeight()||0;function l(e){e=o.find(e);e.height(a[1]-r-c-2*(parseFloat(e.css("padding"))|0))}switch(n.type){case 2:l("iframe");break;default:if(n.area[1]===""){if(n.fixed&&a[1]>=s.height()){a[1]=s.height();l("."+i.doms.bd)}}else{l("."+i.doms.bd)}break}return t};i.offset=function(){var e=this,i=e.config,o=e.that;var a=[o.outerWidth(),o.outerHeight()];var r=typeof i.offset==="object";e.offsetTop=(s.height()-a[1])/2;e.offsetLeft=(s.width()-a[0])/2;if(r){e.offsetTop=i.offset[0];e.offsetLeft=i.offset[1]||e.offsetLeft}else if(i.offset!=="auto"){if(i.offset==="t"){e.offsetTop=0}else if(i.offset==="r"){e.offsetLeft=s.width()-a[0]}else if(i.offset==="b"){e.offsetTop=s.height()-a[1]}else if(i.offset==="l"){e.offsetLeft=0}else if(i.offset==="lt"){e.offsetTop=0;e.offsetLeft=0}else if(i.offset==="lb"){e.offsetTop=s.height()-a[1];e.offsetLeft=0}else if(i.offset==="rt"){e.offsetTop=0;e.offsetLeft=s.width()-a[0]}else if(i.offset==="rb"){e.offsetTop=s.height()-a[1];e.offsetLeft=s.width()-a[0]}else{e.offsetTop=i.offset}}if(!i.fixed){e.offsetTop=/%$/.test(e.offsetTop)?s.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop);e.offsetLeft=/%$/.test(e.offsetLeft)?s.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft);e.offsetTop+=s.scrollTop();e.offsetLeft+=s.scrollLeft()}o.css({top:e.offsetTop,left:e.offsetLeft});if(i.type===4){var c=this.query(n.elem);i.area[0]||o.css({width:c.outerWidth()});var l=window.innerWidth;var f=document.body.scrollHeight||window.innerHeight;var u=function(){if(c){var e=c.offset().left;var t=c.offset().top+c.outerHeight()+4>f?c.offset().top-o.outerHeight()-4:c.offset().top+c.outerHeight()+4;o.css({top:t,left:e<l/2?c.offset().left:c.offset().left+(c.outerWidth()-a[0])})}};u();t(window).on("resize",u)}return e};i.move=function(){var t=e.util.drop;return this.config.move&&this.config.title&&t(this.that,"."+this.doms.title),this};i.append=function(e){this.query(document.body).append(i.createElement());e&&e.call(this)};i.callback=function(){var n=this.that,s=this.config,o=this.doms,a=this.index,r=this.query("body");if(s.success){if(s.type===2){n.find("iframe").on("load",function(){s.success.call(n.find("iframe").contents()[0],n,a)})}else{if(s.type===4){n.on("click",function(t){e.util.stop(t)});setTimeout(function(){r.on("click",function(){i.close(a)})},300)}s.success.call(n[0],n,a)}}var c=function(){var t="nui-open-full";if(n.hasClass(t)){n.removeClass(t);r.css({overflow:"visible"})}return s.cancel?s.cancel(a,n):e.close(a)};n.find("."+o.close).on("click",c);n.find("."+o.btnfull).on("click",function(){var e="nui-open-full";if(n.hasClass(e)){n.removeClass(e);r.css({overflow:"visible"});i.auto(a)}else{n.addClass(e);r.css({overflow:"hidden"});i.auto(a)}});if(s.shadeClose){t("#nui-open-shade"+a).on("click",function(){e.close(a)})}return this};i.close=function(t){var n=this.index;if(t){e.close(t)}else{if(i.config.time>0){setTimeout(function(){e.close(n)},i.config.time*1e3)}}return this};i.init=function(){var e=this.index;this.setConfig(function(){this.append(function(){this.auto(e).offset().move().callback().close()})});return e};return i.init()};e.alert=function(n,i){if(e.typeName(n)==="String"){n={content:n}}else if(e.typeName(n)==="Undefined"){return this}if(e.typeName(i)==="Function"){i={success:i}}else if(e.typeName(i)!=="Object"){i={}}var s={text:i.text||["确定","取消"],className:i.className||["nui-btn-blue","nui-btn-default"],align:i.align||"right",cancel:i.cancel,success:i.success};n.content=n.content+'<div class="nui-open-fd '+s.align+'"><span class="nui-btn '+s.className[0]+'">'+s.text[0]+'</span> <span class="nui-btn '+s.className[1]+'">'+s.text[1]+"</span></div>";var o=n.success;n.success=function(n,i){n.find(".nui-btn").on("click",function(){if(t(this).index()){s.cancel?s.cancel(i,n):e.close(i)}else{s.success?s.success(i,n):e.close(i)}});o&&o(n,i)};e.open(n);return this};e.notice=function(t){if(e.typeName(t)==="Undefined"){return this}else if(e.typeName(t)==="String"){t={content:t}}t.type=3;e.open(t);return this};e.toast=function(t,n){t!==""&&e.open({content:t,type:1,fixed:!0,time:typeof n==="number"?n:2})};e.showLoading=function(t,n){return e.open({content:'<i class="nui-open-toast__loading"></i><div>'+(t||"")+"</div>",shadow:.2,type:1,fixed:!0,time:typeof n==="number"?n:0})};e.showSuccess=function(t,n){return e.open({content:'<i class="nui-open-toast__success"></i><div>'+(t||"")+"</div>",type:1,fixed:!0,time:typeof n==="number"?n:2})};e.hideToast=function(t){e.close(t||"toast")};e.page=function(e,n){var i=t,s=function(){};s.prototype.success=function(e,t){return this.render(),e&&e(this.conf,t),this};s.prototype.view=function(){var e=this.conf,t=[],n={};e.pages=e.pages||1;e.curr=e.curr|0||1;e.groups="groups"in e?e.groups|0:5;e.first="first"in e?e.first:"首页";e.last="last"in e?e.last:"尾页";e.prev="prev"in e?e.prev:"上一页";e.next="next"in e?e.next:"下一页";if(e.groups>e.pages){e.groups=e.pages}n.index=Math.ceil((e.curr+(e.groups>1&&e.groups!==e.pages?1:0))/(e.groups===0?1:e.groups));if(e.curr>1&&e.prev){t.push('<a href="javascript:;" class="nui-page_prev" data-page="'+(e.curr-1)+'">'+e.prev+"</a>")}else{t.push("<cite>"+e.prev+"</cite>")}if(n.index>1&&e.first&&e.groups!==0){t.push('<a href="javascript:;" class="nui-page_first" data-page="1"">'+e.first+"</a><span>…</span>")}n.poor=Math.floor((e.groups-1)/2);n.start=n.index>1?e.curr-n.poor:1;n.end=n.index>1?function(){var t=e.curr+(e.groups-n.poor-1);return t>e.pages?e.pages:t}():e.groups;if(n.end-n.start<e.groups-1){n.start=n.end-e.groups+1}for(;n.start<=n.end;n.start++){if(n.start===e.curr){t.push('<span class="this" '+(/^#/.test(e.skin)?'style="background-color:'+e.skin+";border-color:"+e.skin+'"':"")+">"+n.start+"</span>")}else{t.push('<a href="javascript:;" data-page="'+n.start+'">'+n.start+"</a>")}}if(e.pages>e.groups&&n.end<e.pages&&e.last&&e.groups!==0){t.push('<span>…</span><a href="javascript:;" class="nui-page_last"  data-page="'+e.pages+'">'+e.last+"</a>")}n.flow=!e.prev&&e.groups===0;if(e.curr!==e.pages&&e.next||n.flow){t.push(function(){return n.flow&&e.curr===e.pages?'<span class="nui-page_next">'+e.next+"</span>":'<a href="javascript:;" class="nui-page_next" data-page="'+(e.curr+1)+'">'+e.next+"</a>"}())}else{t.push("<cite>"+e.next+"</cite>")}return'<div class="nui-pages">'+t.join("")+"</div>"};s.prototype.render=function(e){this.that.html(this.view(this.conf));e&&e.call(this)};s.prototype.event=function(){var e=this;e.that.on("click","[data-page]",function(){e.conf.curr=parseInt(this.getAttribute("data-page"))||1;e.success(n);e.that.trigger("nui(page)",e.conf)});return e};s.prototype.init=function(e){var t=this.conf=e||{};this.that=i(t.elem);delete t.elem;this.render(function(){this.event()});return this};return(new s).init(e).success(n,true)};e.date=function(){var n={query:t,date:e.util.date,isYear:function(e){return e%4===0&&e%100!==0||e%400===0},months:[31,null,31,30,31,30,31,31,30,31,30,31],className:{table:"nui-dropdown-date",curr:"nui-dropdown-date__curr",toDay:"nui-dropdown-date__today",next:"nui-dropdown-date__next",prev:"nui-dropdown-date__prev",_void:"nui-dropdown-date__void",tools:"nui-dropdown-date__tools"}};n.table=function(){var e,t=[],i=["日","一","二","三","四","五","六"];var s={},o=document.createElement("table"),a=document.createElement("thead");a.appendChild(document.createElement("tr"));s.creath=function(e){var t=document.createElement("th");t.innerHTML=i[e];a.getElementsByTagName("tr")[0].appendChild(t);t=null};for(var r=0,c=6;r<c;r++){t.push([]);e=o.insertRow(0);for(var l=0,f=7;l<f;l++){t[r][l]=0;r===0&&s.creath(l);e.insertCell(l)}}o.insertBefore(a,o.children[0]);o.className=n.className.table;e=t=null;return o.outerHTML.toLowerCase()}();n.checkVoid=function(e,t,n,i){var s=[];e=e|0;t=t|0;n=n|0;if(e<i.min[0]){s=["y"]}else if(e>i.max[0]){s=["y",1]}else if(e>=i.min[0]&&e<=i.max[0]){if(e===+i.min[0]){if(t<i.min[1]){s=["m"]}else if(t===+i.min[1]){if(n<i.min[2]){s=["d"]}}}if(e===+i.max[0]){if(t>i.max[1]){s=["m",1]}else if(t===+i.max[1]){if(n>i.max[2]){s=["d",1]}}}}return s};n.viewDate=function(e,t,i,s){var o={},a=new Date;o.today=a.getDate();a.setFullYear(e,t,i);o.ymd=[a.getFullYear(),a.getMonth(),o.today];n.months[1]=n.isYear(o.ymd[0])?29:28;a.setFullYear(o.ymd[0],o.ymd[1],1);o.FDay=a.getDay();o.PDay=n.months[t===0?11:t-1]-o.FDay+1;o.NDay=1;var r=function(e,t){this.innerHTML=e;t&&(this.className=t)};n.query("td",this).each(function(e){var t=o.ymd[0],i=o.ymd[1]+1,a;if(e<o.FDay){a=e+o.PDay;r.call(this,a,n.className.prev);i===1&&(t-=1);i=i===1?12:i-1}else if(e>=o.FDay&&e<o.FDay+n.months[o.ymd[1]]){a=e-o.FDay+1;r.call(this,a);if(e-o.FDay+1===o.ymd[2]){o.thisDay=this}}else{a=o.NDay++;r.call(this,a,n.className.next);i===12&&(t+=1);i=i===12?1:i+1}o.today===a&&(this.className+=" "+n.className.toDay);if(n.checkVoid(t,i,a,s).length)this.className+=" "+n.className._void;this.setAttribute("y",t);this.setAttribute("m",i);this.setAttribute("d",a)})};n.$hms=function(i,s,o){var a=function(e){return(+e>9?e:"0"+e).toString()};var r=function(t,n){var i=Array.apply(null,Array(t)).map(function(e,t){return a(t)});return e.createDropdown(i,n)};var c=s.hms.split(":");var l=s.format==="yyyy-MM-dd HH:mm:ss";var f=n.query('<div class="nui-dropdown-time">'+'<div class="nui-open-title">请选择时间</div>'+'<div class="nui-dropdown-time__hd"><ul class="nui-flex"><li>时</li><li>分</li>'+(l?"<li>秒</li>":"")+"</ul></div>"+'<div class="nui-dropdown-time__bd"><ul class="nui-flex"><li>'+r(24,c[0])+"</li><li>"+r(60,c[1])+"</li>"+(l?"<li>"+r(60,c[2])+"</li>":"")+"</ul></div>"+'<div class="nui-dropdown-time__fd"><small class="nui-inline nui-fc1">时间：'+s.curr.split(":")+"</small>"+'<span class="nui-inline nui-btn-group fr">'+'<a class="nui-btn nui-btn-default nui-btn-min" href="javascript:;">确定</a>'+'<a class="nui-btn nui-btn-default nui-btn-min" href="javascript:;">取消</a>'+"</span></div></div>");f.find(".nui-dropdown-time__bd li").each(function(e){n.query(".nui-dropdown-item",this).on("click",function(){var t=n.query(this),i=t.index();t.addClass("this").siblings().removeClass("this");c[e]=this.innerText.replace(/\s/g,"");var s=t.outerHeight();var o=t.parent(),a=o.scrollTop();a=a-a%s;var r=Math.round((this.offsetTop-a)/s);if(r===0){o.scrollTop(a-s)}else if(r===3){o.scrollTop(a+s)}else{o.scrollTop(a)}})});f.find(".nui-btn").on("click",function(){if(!t(this).index()){o&&o(c,l?c.join(":"):c.join(":").slice(0,5))}else{e.close(i)}});return f};return function(t){var i=n.query(t.elem);var s="input"===i[0].tagName.toLowerCase()?"focus":"click";i.on(s,function(){var s=n.date.toDate(t.min);var o=n.date.toDate(t.max);var a=n.date.toDate(t.curr);t.min=s?n.date.format(s):"1970-01-01";t.max=o?n.date.format(o):"2099-12-31";t.format=t.format||"yyyy-MM-dd";var r=(a?n.date.format(a):n.date.now()).split("-");t.hms=t.hms&&t.hms.length===8?t.hms:"00:00:00";e.open({content:n.table,title:"<span><i></i><cite>"+r[0]+"</cite><em></em></span>"+"<span><i></i><cite>"+r[1]+"</cite><em></em></span>",type:4,time:0,width:"240px",elem:i,success:function(s,o){var a=this;var c=n.query("."+e.get._className.open+"-hd",a);c.addClass(n.className.tools);var l=n.query("."+e.get._className.open+"-bd",a);var f={min:t.min.split("-"),max:t.max.split("-")};var u=function(e,t,i){l.html(n.table);n.viewDate.call(a,e,--t,i,f)};n.query("span",c).each(function(){var e=n.query(this),i=n.query("i",this),s=n.query("cite",this),o=n.query("em",this),a=e.index(),c=parseInt(s.html());var l=function(e){c+=e;if(a){c>12&&(c=12);c<1&&(c=1);r[1]=c}else{if(t.max!=="2099-12-31"){var i=parseInt(f.min[0]);c<i&&(c=i)}r[0]=c}s.html(n.date.n2s(c));u.apply(null,r)};e.on("click","i",function(){l(-1)}).on("click","em",function(){l(+1)})});u.apply(null,r);n.query(this).on("click","td",function(){if(this.className.indexOf(n.className.next)!==-1||this.className.indexOf(n.className.prev)!==-1||this.className.indexOf(n.className._void)!==-1){}else{t.curr=n.date.format(new Date(this.getAttribute("y"),parseInt(this.getAttribute("m"))-1,this.getAttribute("d")));if(t.format==="yyyy-MM-dd"){i.val(t.curr);t.callback&&t.callback(t);e.close(o)}else{n.$hms(o,t,function(n,s){t.hms=n;i.val(t.curr+" "+s);t.callback&&t.callback(t);e.close(o)}).appendTo(c)}}})}})})}}();e.tab=function(){var e=t,n="#!",i=location.hash.split(n)[1],s=document.getElementById(i);if(s){var o=s.className.split(" ");e("[data-tab]").each(function(){var t=e(this),n=t.attr("data-tab");for(var s in o){if(o[s].indexOf(n)){n=n.split("|");if(n[3]){e(n[3],e(n[2])).each(function(s){if(this.id===i){e(n[0],t).eq(s).addClass(n[1]).siblings().removeClass(n[1]);e(this).show().siblings(n[3]).hide()}})}break}}})}return function(){var t=e(this),i=t.attr("data-tab").split("|");typeof i===typeof[]||(i=["a","this"]);e(i[0],t).on("click",function(){var s=e(this),o=s.index(),a=i[3];s.addClass(i[1]).siblings().removeClass(i[1]);a&&e(a,i[2]).eq(o).show().each(function(){if(this.id)location.hash=n+this.id}).siblings(a).hide();t.trigger("nui(tab)",{el:s,tab:e(a,i[2]),index:o})})}}();e.animate=function(e,t,n,i,s){if(typeof e==="number"&&typeof t==="number"&&typeof n==="function"){if(!window.requestAnimationFrame){requestAnimationFrame=function(e){setTimeout(e,17)}}typeof s==="number"||(s=1e3);var o={Linear:function(e,t,n,i){return n*e/i+t},easeIn:function(e,t,n,i){return n*(e/=i)*e+t},easeOut:function(e,t,n,i){return-n*(e/=i)*(e-2)+t},easeInOut:function(e,t,n,i){if((e/=i/2)<1)return n/2*e*e+t;return-n/2*(--e*(e-2)-1)+t}};var a=0;var r=Math.ceil(s/17);var c=i in o?o[i]:o.Linear;var l=function(){var i=c(a,e,t-e,r);a++;if(a<=r){n(i);requestAnimationFrame(l)}else{n(t,true)}};l()}};e.touch=function(e,t){if(!("ontouchend"in document)){e.addEventListener("click",t,false)}else{var n=0;e.addEventListener("touchstart",function(e){n=+new Date},false);e.addEventListener("touchend",function(e){if(new Date-n<300){t.call(this,e)}},false)}return this};e.anchor=function(n,i){var s=function(t,n){
  var i=document.documentElement.scrollTop||document.body.scrollTop;var s=t.length?t.offset().top-80:0;var o=(i-o)/9>300?(i-o)/9:300;e.animate(i,s,function(e,i){window.scrollTo(0,e);if(i){n&&n(t)}},"easeOut",o)};if(typeof i==="function"){s(n,i)}else{var o=t(this),a=this.getAttribute("data-anchor");o.on("click",function(){s(t(a))})}};e.createDropdown=function(e,t){var n="";if(typeof e.map==="function"){var i=function(e){return e===t?" this":""};n='<div class="nui-dropdown">';e.map(function(e){if(typeof e.map==="function"){n+='<a class="nui-dropdown-item '+i(e[1])+'" data-value="'+e[1]||""+'"> '+e[0]+" </a>"}else{n+='<a class="nui-dropdown-item '+i(e)+'"> '+e+" </a>"}});return n}return n};e.renderData=function(n,i,s){i=i||document.body;s=(s||"data")+"-"+n;switch(n){case"tab":case"anchor":t("["+s+"]",i).each(function(){e[n].call(this)});break;case"date":t("["+s+"]",i).each(function(){e.date({elem:this,format:this.getAttribute(s)})});break}return e};e.renderData("tab").renderData("anchor").renderData("date");e.form({form:".nui-form"});return e};"function"===typeof define?define(function(t){var n=t("jquery");return e.init(n)}):window.nui=e.init($)})();