/*! Widget: Build Table - updated 4/2/2017 (v2.28.6) */
!function(e){"use strict";var t=e.tablesorter=e.tablesorter||{},r=t.buildTable=function(o,l){e.extend(!0,t.defaults.widgetOptions,r.defaults);var n="TABLE"===o.nodeName?e(o):e("
").appendTo(o),i=n[0],a=l.widgetOptions=e.extend(!0,{},r.defaults,l.widgetOptions),d=a.build_processing,s=a.build_type,u=a.build_source||l.data,c=function(t){var o=e.type(t),n=t instanceof jQuery;if("function"==typeof d&&(t=d(t,a)),l.data=t,n||"string"===o){if(n||/<\s*\/tr\s*>/.test(t))return r.html(i,t,a);try{if(t=e.parseJSON(t||"null"))return r.object(i,t,a)}catch(e){}}return"array"===o||"string"===o||"array"===s||"csv"===s?r.csv(i,t,a):r.object(i,t,a)};if(i.config=l,!t.buildTable.hasOwnProperty(s)&&""!==s)return l.debug&&console.error("aborting build table widget, incorrect build type"),!1;u instanceof jQuery?c(e.trim(u.html())):u&&(u.hasOwnProperty("url")||"json"===s)?e.ajax(a.build_source).done(function(e){c(e)}).fail(function(e,t,r){l.debug&&console.error("aborting build table widget, failed ajax load"),n.html(''+e.status+" "+t+" |
")}):c(u)};t.defaults.data="",r.defaults={build_type:"",build_source:"",build_processing:null,build_complete:"tablesorter-build-complete",build_headers:{rows:1,classes:[],text:[],widths:[]},build_footers:{rows:1,classes:[],text:[]},build_numbers:{addColumn:!1,sortable:!1},build_csvStartLine:0,build_csvSeparator:",",build_objectRowKey:"rows",build_objectCellKey:"cells",build_objectHeaderKey:"headers",build_objectFooterKey:"footers"},r.build={colgroup:function(t){var r="";return t&&t.length&&(r+="",e.each(t,function(e,t){r+=""}),r+=""),r},cell:function(t,r,o,l,n){var i,a,d=n?e(""):"",s=r.build_headers.classes,u=r.build_headers.widths;if(/string|number/.test(typeof t))a=e("<"+o+(s&&s[l]?' class="'+s[l]+'"':"")+">"+t+""+o+">"),n&&u&&u[l]&&d.width(u[l]||"");else{a=e("<"+o+">");for(i in t)t.hasOwnProperty(i)&&("text"===i||"html"===i?a[i](t[i]):n&&"width"===i?d.width(t[i]||""):a.attr(i,t[i]))}return[a,d]},header:function(t,r){var o=r.build_headers.text,l=r.build_headers.classes,n=""+(r.build_numbers.addColumn?""+r.build_numbers.addColumn+" | ":"");return e.each(t,function(e,t){/<\s*\/t(d|h)\s*>/.test(t)?n+=t:n+=""+(o&&o[e]?o[e]:t)+" | "}),n+"
"},rows:function(t,r,o,l,n,i){var a=i?"th":"td",d=""+(l.build_numbers.addColumn?"<"+a+">"+(i?"":n)+""+a+">":"");return e.each(t,function(e,t){/<\s*\/t(d|h)\s*>/.test(t)?d+=t:d+="<"+(i?a+(o&&o[e]?' class="'+o[e]+'"':""):a)+">"+(i&&r&&r.length&&r[e]?r[e]:t)+""+a+">"}),d+"
"}},r.buildComplete=function(r,o){e(r).triggerHandler(o.build_complete),t.setup(r,r.config)},r.array=function(e,t,o){return r.csv(e,t,o)},r.csv=function(t,o,l){var n,i,a,d="csv"===l.build_type||"string"==typeof o,s=e(t),u=d?o.replace("\r","").split("\n"):o,c=u.length,b=0,h=!1,p=l.build_headers.rows+(d?l.build_csvStartLine:0),f=l.build_footers.rows,g=0,y="",_=r.build.colgroup(l.build_headers.widths)+"";e.each(u,function(e,t){e>=c-f&&(h=!0),(!d||e>=l.build_csvStartLine)&&e=p&&(e===p&&(_+="
"),a=d?r.splitCSV(t,l.build_csvSeparator):t,h&&f>0&&(_+=(e===c-f?"":"")+(e===c?"":"")),a.length>1&&(b++,a.length!==g&&(y+="error on line "+e+": Item count ("+a.length+") does not match header count ("+g+") \n"),n=h?l.build_footers.classes:"",_+=r.build.rows(a,l.build_footers.text,n,l,b,h)))}),_+=f>0?"":"",y?s.html(y):(s.html(_),r.buildComplete(t,l))},r.splitCSV=function(t,r){var o,l,n=e.trim(t).split(r=r||",");for(o=n.length-1;o>=0;o--)'"'===n[o].replace(/\"\s+$/,'"').charAt(n[o].length-1)?(l=n[o].replace(/^\s+\"/,'"')).length>1&&'"'===l.charAt(0)?n[o]=n[o].replace(/^\s*"|"\s*$/g,"").replace(/""/g,'"'):o?n.splice(o-1,2,[n[o-1],n[o]].join(r)):n=n.shift().split(r).concat(n):n[o].replace(/""/g,'"');return n},r.html=function(t,o,l){var n=e(t);o instanceof jQuery?n.empty().append(o):n.html(o),r.buildComplete(t,l)},r.object=function(t,o,l){var n,i,a,d,s,u,c,b=t.config,h=l.build_objectHeaderKey,p=l.build_objectRowKey,f=o.hasOwnProperty(h)&&!e.isEmptyObject(o.kh)?o.kh:!!o.hasOwnProperty("headers")&&o.headers,g=o.hasOwnProperty(p)&&!e.isEmptyObject(o.kr)?o.kr:!!o.hasOwnProperty("rows")&&o.rows;if(!f||!g||0===f.length||0===g.length)return b.debug&&console.error("aborting build table widget, missing data for object build"),!1;d=e(""),s=e(""),e.each(f,function(t,o){for(c=e("").appendTo(s.find("thead")),i=o.length,n=0;n"),e.each(g,function(t,o){var n;if((a="object"===e.type(o))&&o.newTbody){u=e("").appendTo(s);for(n in o)o.hasOwnProperty(n)&&"newTbody"!==n&&u.attr(n,o[n])}else{if(0===t&&u.appendTo(s),c=e("").appendTo(u),a){for(n in o)o.hasOwnProperty(n)&&n!==l.build_objectCellKey&&c.attr(n,o[n]);o.hasOwnProperty(l.build_objectCellKey)&&(o=o.cells)}for(i=o.length,n=0;n"+d+"")):(d=e("").appendTo(s),e.each(a,function(t,o){for(c=e("").appendTo(d),i=o.length,n=0;n