function reloadCharts(){return-1===navigator.userAgent.toLowerCase().indexOf("firefox")?!1:($('.ui-widget-content [aria-expanded="false"]').find("iframe").each(function(){var e=$(this).attr("src");-1!==e.indexOf("charts")&&($(this).hide(),$(this).attr("src",e),$(this).show())}),void 0)}function openDialogCenter(e){e.dialog("open");var t=getDimensions(e.parent());e.dialog({position:[t[0],t[1]]})}function getDimensions(e){var t=new Array(2);return t[0]=$(window).width()/2-e.width()/2,t[1]=$(window).height()/2-e.height()/2,t}function updateChart(e,t,n,r,a,i){var n=n,r=r,s=$("#iframe"+e).attr("default_src");s||(s=$("#iframe"+e).attr("src")),src=s.split("?")[0],("bar"===$("#type_"+e).val()||"column"===$("#type_"+e).val())&&0==$("#timescale_"+e).val().length&&0==$("#average_"+e).val().length&&0==$("#median_"+e).val().length&&0==$("#sum_"+e).val().length&&$("#timescale_"+e).val(30);var o=[];$(".chart_options"+e).each(function(){var e=$(this).val(),t=$(this).attr("id"),n=t.split("_")[0];e.length>0&&o.push([n,e])});for(var l="";o.length>0;){var c=o.pop();"width"==c[0]&&(n=parseInt(c[1])),"height"==c[0]&&(r=parseInt(c[1])),("type"!=c[0]||"line"!=c[1])&&(l+="&"+c[0]+"="+encodeURIComponent(c[1]))}l.length>0&&(src+="?"+l.substring(1)),t&&e>0&&i?$.update("/channels/"+a+"/charts/"+e,{newOptions:{options:l}}):t&&e>0&&$.update("/channels/"+a+"/charts/"+e,{options:l}),$("#embed"+e).val(''),$("#iframe"+e).attr("src",src),$("#iframe"+e).attr("width",n),$("#iframe"+e).attr("height",r)}function updateSelectValues(){selectedValue=$(this).val(),$(".mutuallyexclusive"+index).each(function(){$(this).val("")}),$(this).val(selectedValue)}function setupChartForm(e){return function(t,n){n.length>0&&$("#"+n.split("=")[0]+"_"+e).val(decodeURIComponent(n.split("=")[1]))}}function setupColumns(e,t){$(sortColumnSetup(e,t)),$(".column").disableSelection()}function createWindowsWithData(e,t,n,r){for(var a in e){for(var i in e[a])var s=i;if(e[a].window&&(o=e[a].window),"undefined"==o)var o=e[a].window;colId=o.col,title=o.title;var l=o.html;"chart"===o.window_type&&$("body").append("
'+i+"
"),$("#portlet_"+n).length>1)throw"Portlet count doesn't match what's expected";return $("#portlet_"+n)}function sortColumnSetup(e,t){$(".column").sortable({opacity:.6,helper:function(){return $("")},connectWith:".column",update:updatePortletPositions(e,t)})}function getPortletArray(e){var t=new Array,n=e.split("&");for(i in n)val=n[i].split("=")[1],t.push(val);return t}function uiToggleClick(){$(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"),$(this).parents(".portlet:first").find(".portlet-content").toggle()}!function(e,t){e.rails!==t&&e.error("jquery-ujs has already been loaded!");var n,r=e(document);e.rails=n={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",buttonClickSelector:"button[data-remote]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input[type=file]",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(t){var n=e('meta[name="csrf-token"]').attr("content");n&&t.setRequestHeader("X-CSRF-Token",n)},fire:function(t,n,r){var a=e.Event(n);return t.trigger(a,r),a.result!==!1},confirm:function(e){return confirm(e)},ajax:function(t){return e.ajax(t)},href:function(e){return e.attr("href")},handleRemote:function(r){var a,i,s,o,l,c,d,u;if(n.fire(r,"ajax:before")){if(o=r.data("cross-domain"),l=o===t?null:o,c=r.data("with-credentials")||null,d=r.data("type")||e.ajaxSettings&&e.ajaxSettings.dataType,r.is("form")){a=r.attr("method"),i=r.attr("action"),s=r.serializeArray();var f=r.data("ujs:submit-button");f&&(s.push(f),r.data("ujs:submit-button",null))}else r.is(n.inputChangeSelector)?(a=r.data("method"),i=r.data("url"),s=r.serialize(),r.data("params")&&(s=s+"&"+r.data("params"))):r.is(n.buttonClickSelector)?(a=r.data("method")||"get",i=r.data("url"),s=r.serialize(),r.data("params")&&(s=s+"&"+r.data("params"))):(a=r.data("method"),i=n.href(r),s=r.data("params")||null);u={type:a||"GET",data:s,dataType:d,beforeSend:function(e,a){return a.dataType===t&&e.setRequestHeader("accept","*/*;q=0.5, "+a.accepts.script),n.fire(r,"ajax:beforeSend",[e,a])},success:function(e,t,n){r.trigger("ajax:success",[e,t,n])},complete:function(e,t){r.trigger("ajax:complete",[e,t])},error:function(e,t,n){r.trigger("ajax:error",[e,t,n])},crossDomain:l},c&&(u.xhrFields={withCredentials:c}),i&&(u.url=i);var h=n.ajax(u);return r.trigger("ajax:send",h),h}return!1},handleMethod:function(r){var a=n.href(r),i=r.data("method"),s=r.attr("target"),o=e("meta[name=csrf-token]").attr("content"),l=e("meta[name=csrf-param]").attr("content"),c=e('
'),d='
';l!==t&&o!==t&&(d+='
'),s&&c.attr("target",s),c.hide().append(d).appendTo("body"),c.submit()},disableFormElements:function(t){t.find(n.disableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with",t[n]()),t[n](t.data("disable-with")),t.prop("disabled",!0)})},enableFormElements:function(t){t.find(n.enableSelector).each(function(){var t=e(this),n=t.is("button")?"html":"val";t.data("ujs:enable-with")&&t[n](t.data("ujs:enable-with")),t.prop("disabled",!1)})},allowAction:function(e){var t,r=e.data("confirm"),a=!1;return r?(n.fire(e,"confirm")&&(a=n.confirm(r),t=n.fire(e,"confirm:complete",[a])),a&&t):!0},blankInputs:function(t,n,r){var a,i,s=e(),o=n||"input,textarea",l=t.find(o);return l.each(function(){if(a=e(this),i=a.is("input[type=checkbox],input[type=radio]")?a.is(":checked"):a.val(),!i==!r){if(a.is("input[type=radio]")&&l.filter('input[type=radio]:checked[name="'+a.attr("name")+'"]').length)return!0;s=s.add(a)}}),s.length?s:!1},nonBlankInputs:function(e,t){return n.blankInputs(e,t,!0)},stopEverything:function(t){return e(t.target).trigger("ujs:everythingStopped"),t.stopImmediatePropagation(),!1},disableElement:function(e){e.data("ujs:enable-with",e.html()),e.html(e.data("disable-with")),e.bind("click.railsDisable",function(e){return n.stopEverything(e)})},enableElement:function(e){e.data("ujs:enable-with")!==t&&(e.html(e.data("ujs:enable-with")),e.removeData("ujs:enable-with")),e.unbind("click.railsDisable")}},n.fire(r,"rails:attachBindings")&&(e.ajaxPrefilter(function(e,t,r){e.crossDomain||n.CSRFProtection(r)}),r.delegate(n.linkDisableSelector,"ajax:complete",function(){n.enableElement(e(this))}),r.delegate(n.linkClickSelector,"click.rails",function(r){var a=e(this),i=a.data("method"),s=a.data("params");if(!n.allowAction(a))return n.stopEverything(r);if(a.is(n.linkDisableSelector)&&n.disableElement(a),a.data("remote")!==t){if(!(!r.metaKey&&!r.ctrlKey||i&&"GET"!==i||s))return!0;var o=n.handleRemote(a);return o===!1?n.enableElement(a):o.error(function(){n.enableElement(a)}),!1}return a.data("method")?(n.handleMethod(a),!1):void 0}),r.delegate(n.buttonClickSelector,"click.rails",function(t){var r=e(this);return n.allowAction(r)?(n.handleRemote(r),!1):n.stopEverything(t)}),r.delegate(n.inputChangeSelector,"change.rails",function(t){var r=e(this);return n.allowAction(r)?(n.handleRemote(r),!1):n.stopEverything(t)}),r.delegate(n.formSubmitSelector,"submit.rails",function(r){var a=e(this),i=a.data("remote")!==t,s=n.blankInputs(a,n.requiredInputSelector),o=n.nonBlankInputs(a,n.fileInputSelector);if(!n.allowAction(a))return n.stopEverything(r);if(s&&a.attr("novalidate")==t&&n.fire(a,"ajax:aborted:required",[s]))return n.stopEverything(r);if(i){if(o){setTimeout(function(){n.disableFormElements(a)},13);var l=n.fire(a,"ajax:aborted:file",[o]);return l||setTimeout(function(){n.enableFormElements(a)},13),l}return n.handleRemote(a),!1}setTimeout(function(){n.disableFormElements(a)},13)}),r.delegate(n.formInputClickSelector,"click.rails",function(t){var r=e(this);if(!n.allowAction(r))return n.stopEverything(t);var a=r.attr("name"),i=a?{name:a,value:r.val()}:null;r.closest("form").data("ujs:submit-button",i)}),r.delegate(n.formSubmitSelector,"ajax:beforeSend.rails",function(t){this==t.target&&n.disableFormElements(e(this))}),r.delegate(n.formSubmitSelector,"ajax:complete.rails",function(t){this==t.target&&n.enableFormElements(e(this))}),e(function(){var t=e("meta[name=csrf-token]").attr("content"),n=e("meta[name=csrf-param]").attr("content");e('form input[name="'+n+'"]').val(t)}))}(jQuery),function(e){e.cookie=function(t,n,r){if(arguments.length>1&&(!/Object/.test(Object.prototype.toString.call(n))||null===n||void 0===n)){if(r=e.extend({},r),(null===n||void 0===n)&&(r.expires=-1),"number"==typeof r.expires){var a=r.expires,i=r.expires=new Date;i.setDate(i.getDate()+a)}return n=String(n),document.cookie=[encodeURIComponent(t),"=",r.raw?n:encodeURIComponent(n),r.expires?"; expires="+r.expires.toUTCString():"",r.path?"; path="+r.path:"",r.domain?"; domain="+r.domain:"",r.secure?"; secure":""].join("")}r=n||{};for(var s,o=r.raw?function(e){return e}:decodeURIComponent,l=document.cookie.split("; "),c=0;s=l[c]&&l[c].split("=");c++)if(o(s[0])===t)return o(s[1]||"");return null}}(jQuery);var createWindows=function(e,t,n){return function(r){createWindowsWithData(r,e,t,n)}},updatePortletPositions=function(e,t){return function(){if(e){var n=$(this).sortable("serialize");colId=$(this).attr("id").charAt($(this).attr("id").length-1),portletArray=getPortletArray(n),jsonResult={col:colId,positions:portletArray},portletArray.length>0&&$.ajax({type:"PUT",url:"../channels/"+t+"/windows",data:{_method:"PUT",page:JSON.stringify(jsonResult)},dataType:"json"})}}},decoratePortlet=function(e){return function(){var t=$(this).find(".portlet-header");return t.append(""),thisObject=$(this),"true"==e?(thisObject.find(".window_type").prepend("
"),thisObject.find(".window_type-chart_window").append("
"),thisObject.find(".window_type").append("
"),thisObject.find(".portlet-header").css("cursor","move")):$(".column").sortable({disabled:!0}),$(this).attr("id")}},uiEditClick=function(e){return function(){var t=$(this).parents(".portlet:first").attr("id").substring(8),n="";$("#chartConfig"+t).load("/channels/"+e+"/charts/"+t+"/edit",function(){n=$("#chartOptions"+t).html(),"undefined"!=n&&n.length>2&&$.each(n.split("&"),setupChartForm(t)),$("#button"+t).click(function(){updateChart(t,!0,450,250,e,!0),$("#chartConfig"+t).dialog("close")})}).dialog({title:"Chart Options",modal:!0,resizable:!1,width:500,dialogClass:"dev-info-dialog"})}},uiViewClick=function(e){return function(){var t=$(this).parents(".portlet:first").find(".portlet-content").offset().left,n=$(this).parents(".portlet:first").find(".portlet-content").offset().top,r=$(this).parents(".portlet:first").attr("id").substring(8);$("body").append(''),$.get("/channels/"+e+"/windows/"+r+"/iframe",function(e){var t=e.replace(/id=\"iframe[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\"/,"");$("#iframeinner"+r).text(t)}),$("#iframepopup"+r).dialog({resizable:!1,width:"300px",position:[t+200,n-200],title:"Chart Iframe",dialogClass:"dev-info-dialog"})}},uiCloseClick=function(e){return function(){var t=$(this).parents(".portlet:first").attr("id").substring(8),n=$(this).parents(".portlet:first");$.update("/channels/"+e+"/windows/"+t+"/hide",function(){n.hide("drop",function(){n.remove()})})}};!function(e){function t(){var t=n(this);return isNaN(t.datetime)||e(this).text(r(t.datetime)),this}function n(t){if(t=e(t),!t.data("timeago")){t.data("timeago",{datetime:i.datetime(t)});var n=e.trim(t.text());n.length>0&&t.attr("title",n)}return t.data("timeago")}function r(e){return i.inWords(a(e))}function a(e){return(new Date).getTime()-e.getTime()}e.timeago=function(t){return t instanceof Date?r(t):"string"==typeof t?r(e.timeago.parse(t)):r(e.timeago.datetime(t))};var i=e.timeago;e.extend(e.timeago,{settings:{refreshMillis:6e4,allowFuture:!1,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",numbers:[]}},inWords:function(t){function n(n,a){var i=e.isFunction(n)?n(a,t):n,s=r.numbers&&r.numbers[a]||a;return i.replace(/%d/i,s)}var r=this.settings.strings,a=r.prefixAgo,i=r.suffixAgo;this.settings.allowFuture&&(0>t&&(a=r.prefixFromNow,i=r.suffixFromNow),t=Math.abs(t));var s=t/1e3,o=s/60,l=o/60,c=l/24,d=c/365,u=45>s&&n(r.seconds,Math.round(s))||90>s&&n(r.minute,1)||45>o&&n(r.minutes,Math.round(o))||90>o&&n(r.hour,1)||24>l&&n(r.hours,Math.round(l))||48>l&&n(r.day,1)||30>c&&n(r.days,Math.floor(c))||60>c&&n(r.month,1)||365>c&&n(r.months,Math.floor(c/30))||2>d&&n(r.year,1)||n(r.years,Math.floor(d));return e.trim([a,u,i].join(" "))},parse:function(t){var n=e.trim(t);return n=n.replace(/\.\d\d\d+/,""),n=n.replace(/-/,"/").replace(/-/,"/"),n=n.replace(/T/," ").replace(/Z/," UTC"),n=n.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"),new Date(n)},datetime:function(t){var n="time"===e(t).get(0).tagName.toLowerCase(),r=n?e(t).attr("datetime"):e(t).attr("title");return i.parse(r)}}),e.fn.timeago=function(){var e=this;e.each(t);var n=i.settings;return n.refreshMillis>0&&setInterval(function(){e.each(t)},n.refreshMillis),e},document.createElement("abbr"),document.createElement("time")}(jQuery),function($){$.extend({tablesorter:new function(){function benchmark(e,t){log(e+","+((new Date).getTime()-t.getTime())+"ms")}function log(e){"undefined"!=typeof console&&"undefined"!=typeof console.debug?console.log(e):alert(e)}function buildParserCache(e,t){if(e.config.debug)var n="";if(0!=e.tBodies.length){var r=e.tBodies[0].rows;if(r[0])for(var a=[],i=r[0].cells,s=i.length,o=0;s>o;o++){var l=!1;$.metadata&&$(t[o]).metadata()&&$(t[o]).metadata().sorter?l=getParserById($(t[o]).metadata().sorter):e.config.headers[o]&&e.config.headers[o].sorter&&(l=getParserById(e.config.headers[o].sorter)),l||(l=detectParserForColumn(e,r,-1,o)),e.config.debug&&(n+="column:"+o+" parser:"+l.id+"\n"),a.push(l)}return e.config.debug&&log(n),a}}function detectParserForColumn(e,t,n,r){for(var a=parsers.length,i=!1,s=!1,o=!0;""==s&&o;)n++,t[n]?(i=getNodeFromRowAndCellIndex(t,n,r),s=trimAndGetNodeText(e.config,i),e.config.debug&&log("Checking if value was empty on row:"+n)):o=!1;for(var l=1;a>l;l++)if(parsers[l].is(s,e,i))return parsers[l];return parsers[0]}function getNodeFromRowAndCellIndex(e,t,n){return e[t].cells[n]}function trimAndGetNodeText(e,t){return $.trim(getElementText(e,t))}function getParserById(e){for(var t=parsers.length,n=0;t>n;n++)if(parsers[n].id.toLowerCase()==e.toLowerCase())return parsers[n];return!1}function buildCache(e){if(e.config.debug)var t=new Date;for(var n=e.tBodies[0]&&e.tBodies[0].rows.length||0,r=e.tBodies[0].rows[0]&&e.tBodies[0].rows[0].cells.length||0,a=e.config.parsers,i={row:[],normalized:[]},s=0;n>s;++s){var o=$(e.tBodies[0].rows[s]),l=[];if(o.hasClass(e.config.cssChildRow))i.row[i.row.length-1]=i.row[i.row.length-1].add(o);else{i.row.push(o);for(var c=0;r>c;++c)l.push(a[c].format(getElementText(e.config,o[0].cells[c]),e,o[0].cells[c]));l.push(i.normalized.length),i.normalized.push(l),l=null}}return e.config.debug&&benchmark("Building cache for "+n+" rows:",t),i}function getElementText(e,t){var n="";return t?(e.supportsTextContent||(e.supportsTextContent=t.textContent||!1),n="simple"==e.textExtraction?e.supportsTextContent?t.textContent:t.childNodes[0]&&t.childNodes[0].hasChildNodes()?t.childNodes[0].innerHTML:t.innerHTML:"function"==typeof e.textExtraction?e.textExtraction(t):$(t).text()):""}function appendToTable(e,t){if(e.config.debug)var n=new Date;for(var r=t,a=r.row,i=r.normalized,s=i.length,o=i[0].length-1,l=$(e.tBodies[0]),c=[],d=0;s>d;d++){var u=i[d][o];if(c.push(a[u]),!e.config.appender)for(var f=a[u].length,h=0;f>h;h++)l[0].appendChild(a[u][h])}e.config.appender&&e.config.appender(e,c),c=null,e.config.debug&&benchmark("Rebuilt table:",n),applyWidget(e),setTimeout(function(){$(e).trigger("sortEnd")},0)}function buildHeaders(e){if(e.config.debug)var t=new Date;var n=($.metadata?!0:!1,computeTableHeaderCellIndexes(e));return $tableHeaders=$(e.config.selectorHeaders,e).each(function(t){if(this.column=n[this.parentNode.rowIndex+"-"+this.cellIndex],this.order=formatSortingOrder(e.config.sortInitialOrder),this.count=this.order,(checkHeaderMetadata(this)||checkHeaderOptions(e,t))&&(this.sortDisabled=!0),checkHeaderOptionsSortingLocked(e,t)&&(this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(e,t)),!this.sortDisabled){var r=$(this).addClass(e.config.cssHeader);e.config.onRenderHeader&&e.config.onRenderHeader.apply(r)}e.config.headerList[t]=this}),e.config.debug&&(benchmark("Built headers:",t),log($tableHeaders)),$tableHeaders}function computeTableHeaderCellIndexes(e){for(var t=[],n={},r=e.getElementsByTagName("THEAD")[0],a=r.getElementsByTagName("TR"),i=0;i
p;p++){"undefined"==typeof t[p]&&(t[p]=[]);for(var m=t[p],g=l;l+h>g;g++)m[g]="x"}}return n}function checkCellColSpan(e,t,n){for(var r=[],a=e.tHead.rows,i=a[n].cells,s=0;s1?r=r.concat(checkCellColSpan(e,headerArr,n++)):(1==e.tHead.length||o.rowSpan>1||!a[n+1])&&r.push(o)}return r}function checkHeaderMetadata(e){return $.metadata&&$(e).metadata().sorter===!1?!0:!1}function checkHeaderOptions(e,t){return e.config.headers[t]&&e.config.headers[t].sorter===!1?!0:!1}function checkHeaderOptionsSortingLocked(e,t){return e.config.headers[t]&&e.config.headers[t].lockedOrder?e.config.headers[t].lockedOrder:!1}function applyWidget(e){for(var t=e.config.widgets,n=t.length,r=0;n>r;r++)getWidgetById(t[r]).format(e)}function getWidgetById(e){for(var t=widgets.length,n=0;t>n;n++)if(widgets[n].id.toLowerCase()==e.toLowerCase())return widgets[n]}function formatSortingOrder(e){return"Number"!=typeof e?"desc"==e.toLowerCase()?1:0:1==e?1:0}function isValueInArray(e,t){for(var n=t.length,r=0;n>r;r++)if(t[r][0]==e)return!0;return!1}function setHeadersCss(e,t,n,r){t.removeClass(r[0]).removeClass(r[1]);var a=[];t.each(function(){this.sortDisabled||(a[this.column]=$(this))});for(var i=n.length,s=0;i>s;s++)a[n[s][0]].addClass(r[n[s][1]])}function fixColumnWidth(e){var t=e.config;if(t.widthFixed){var n=$("");$("tr:first td",e.tBodies[0]).each(function(){n.append($("").css("width",$(this).width()))}),$(e).prepend(n)}}function updateHeaderSortCount(e,t){for(var n=e.config,r=t.length,a=0;r>a;a++){var i=t[a],s=n.headerList[i[0]];s.count=i[1],s.count++}}function multisort(table,sortList,cache){if(table.config.debug)var sortTime=new Date;for(var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length,i=0;l>i;i++){var c=sortList[i][0],order=sortList[i][1],s="text"==table.config.parsers[c].type?0==order?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c):0==order?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c),e="e"+i;dynamicExp+="var "+e+" = "+s,dynamicExp+="if("+e+") { return "+e+"; } ",dynamicExp+="else { "}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;l>i;i++)dynamicExp+="}; ";return dynamicExp+="return 0; ",dynamicExp+="}; ",table.config.debug&&benchmark("Evaling expression:"+dynamicExp,new Date),eval(dynamicExp),cache.normalized.sort(sortWrapper),table.config.debug&&benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime),cache}function makeSortFunction(e,t,n){var r="a["+n+"]",a="b["+n+"]";return"text"==e&&"asc"==t?"("+r+" == "+a+" ? 0 : ("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : ("+r+" < "+a+") ? -1 : 1 )));":"text"==e&&"desc"==t?"("+r+" == "+a+" ? 0 : ("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+r+") ? -1 : 1 )));":"numeric"==e&&"asc"==t?"("+r+" === null && "+a+" === null) ? 0 :("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : "+r+" - "+a+"));":"numeric"==e&&"desc"==t?"("+r+" === null && "+a+" === null) ? 0 :("+r+" === null ? Number.POSITIVE_INFINITY : ("+a+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+r+"));":void 0}function makeSortText(e){return"((a["+e+"] < b["+e+"]) ? -1 : ((a["+e+"] > b["+e+"]) ? 1 : 0));"}function makeSortTextDesc(e){return"((b["+e+"] < a["+e+"]) ? -1 : ((b["+e+"] > a["+e+"]) ? 1 : 0));"}function makeSortNumeric(e){return"a["+e+"]-b["+e+"];"}function makeSortNumericDesc(e){return"b["+e+"]-a["+e+"];"}function sortText(e,t){return table.config.sortLocaleCompare?e.localeCompare(t):t>e?-1:e>t?1:0}function sortTextDesc(e,t){return table.config.sortLocaleCompare?t.localeCompare(e):e>t?-1:t>e?1:0}function sortNumeric(e,t){return e-t}function sortNumericDesc(e,t){return t-e}function getCachedSortType(e,t){return e[t].type}var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:!0,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:!1,cancelSelection:!0,sortList:[],headerList:[],dateFormat:"us",decimal:"/.|,/g",onRenderHeader:null,selectorHeaders:"thead th",debug:!1},this.benchmark=benchmark,this.construct=function(e){return this.each(function(){if(this.tHead&&this.tBodies){var t,n,r,a;this.config={},a=$.extend(this.config,$.tablesorter.defaults,e),t=$(this),$.data(this,"tablesorter",a),n=buildHeaders(this),this.config.parsers=buildParserCache(this,n),r=buildCache(this);var i=[a.cssDesc,a.cssAsc];fixColumnWidth(this),n.click(function(e){var s=t[0].tBodies[0]&&t[0].tBodies[0].rows.length||0;if(!this.sortDisabled&&s>0){t.trigger("sortStart");var o=($(this),this.column);if(this.order=this.count++%2,this.lockedOrder&&(this.order=this.lockedOrder),e[a.sortMultiSortKey])if(isValueInArray(o,a.sortList))for(var l=0;l0&&t.trigger("sorton",[a.sortList]),applyWidget(this)}})},this.addParser=function(e){for(var t=parsers.length,n=!0,r=0;t>r;r++)parsers[r].id.toLowerCase()==e.id.toLowerCase()&&(n=!1);n&&parsers.push(e)},this.addWidget=function(e){widgets.push(e)},this.formatFloat=function(e){var t=parseFloat(e);return isNaN(t)?0:t},this.formatInt=function(e){var t=parseInt(e);return isNaN(t)?0:t},this.isDigit=function(e){return/^[-+]?\d*$/.test($.trim(e.replace(/[,.']/g,"")))},this.clearTableBody=function(e){function t(){for(;this.firstChild;)this.removeChild(this.firstChild)}$.browser.msie?t.apply(e.tBodies[0]):e.tBodies[0].innerHTML=""}}}),$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(){return!0},format:function(e){return $.trim(e.toLocaleLowerCase())},type:"text"}),ts.addParser({id:"digit",is:function(e,t){var n=t.config;return $.tablesorter.isDigit(e,n)},format:function(e){return $.tablesorter.formatFloat(e)},type:"numeric"}),ts.addParser({id:"currency",is:function(e){return/^[£$€?.]/.test(e)},format:function(e){return $.tablesorter.formatFloat(e.replace(new RegExp(/[£$€]/g),""))},type:"numeric"}),ts.addParser({id:"ipAddress",is:function(e){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(e)},format:function(e){for(var t=e.split("."),n="",r=t.length,a=0;r>a;a++){var i=t[a];n+=2==i.length?"0"+i:i}return $.tablesorter.formatFloat(n)},type:"numeric"}),ts.addParser({id:"url",is:function(e){return/^(https?|ftp|file):\/\/$/.test(e)},format:function(e){return jQuery.trim(e.replace(new RegExp(/(https?|ftp|file):\/\//),""))},type:"text"}),ts.addParser({id:"isoDate",is:function(e){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(e)},format:function(e){return $.tablesorter.formatFloat(""!=e?new Date(e.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"}),ts.addParser({id:"percent",is:function(e){return/\%$/.test($.trim(e))},format:function(e){return $.tablesorter.formatFloat(e.replace(new RegExp(/%/g),""))},type:"numeric"}),ts.addParser({id:"usLongDate",is:function(e){return e.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(e){return $.tablesorter.formatFloat(new Date(e).getTime())},type:"numeric"}),ts.addParser({id:"shortDate",is:function(e){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(e)},format:function(e,t){var n=t.config;return e=e.replace(/\-/g,"/"),"us"==n.dateFormat?e=e.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2"):"uk"==n.dateFormat?e=e.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1"):("dd/mm/yy"==n.dateFormat||"dd-mm-yy"==n.dateFormat)&&(e=e.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3")),$.tablesorter.formatFloat(new Date(e).getTime())},type:"numeric"}),ts.addParser({id:"time",is:function(e){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(e)},format:function(e){return $.tablesorter.formatFloat(new Date("2000/01/01 "+e).getTime())},type:"numeric"}),ts.addParser({id:"metadata",is:function(){return!1},format:function(e,t,n){var r=t.config,a=r.parserMetadataName?r.parserMetadataName:"sortValue";return $(n).metadata()[a]},type:"numeric"}),ts.addWidget({id:"zebra",format:function(e){if(e.config.debug)var t=new Date;var n,r,a=-1;$("tr:visible",e.tBodies[0]).each(function(){n=$(this),n.hasClass(e.config.cssChildRow)||a++,r=a%2==0,n.removeClass(e.config.widgetZebra.css[r?0:1]).addClass(e.config.widgetZebra.css[r?1:0])}),e.config.debug&&$.tablesorter.benchmark("Applying Zebra widget",t)}})}(jQuery),function(e){window.NestedFormEvents=function(){this.addFields=e.proxy(this.addFields,this),this.removeFields=e.proxy(this.removeFields,this)},NestedFormEvents.prototype={addFields:function(t){var n=t.currentTarget,r=e(n).data("association"),a=e("#"+e(n).data("blueprint-id")),i=a.data("blueprint"),s=(e(n).closest(".fields").closestChild("input, textarea, select").eq(0).attr("name")||"").replace(new RegExp("[[a-z_]+]$"),"");if(s)for(var o=s.match(/[a-z_]+_attributes(?=\]\[(new_)?\d+\])/g)||[],l=s.match(/[0-9]+/g)||[],c=0;c0;)for(var r=n.shift(),a=r.children(),i=0;i=o&&l>r||l>=a&&a>o||o>r&&a>l}),o=l+1;
var d=0;for(var c in s)if(s[c].selected){var u=s[c].start+d;t&&n.tabString==e.value.substring(u,u+n.tabString.length)?(e.value=e.value.substring(0,u)+e.value.substring(u+n.tabString.length),d-=n.tabString.length):t||(e.value=e.value.substring(0,u)+n.tabString+e.value.substring(u),d+=n.tabString.length)}e.focus();var f=r+(d>0?n.tabString.length:0>d?-n.tabString.length:0),h=a+d;e.setSelectionRange(f,h)}}function r(t,n,r){var a=document.selection.createRange();if(t==a.parentElement())if(""==a.text)if(n){var i=a.getBookmark();a.moveStart("character",-r.tabString.length),r.tabString==a.text?a.text="":(a.moveToBookmark(i),a.moveEnd("character",r.tabString.length),r.tabString==a.text&&(a.text="")),a.collapse(!0),a.select()}else a.text=r.tabString,a.collapse(!1),a.select();else{var s=a.text,o=s.length,l=s.split("\r\n"),c=document.body.createTextRange();c.moveToElementText(t),c.setEndPoint("EndToStart",a);var d=c.text,u=d.split("\r\n"),f=d.length,h=document.body.createTextRange();h.moveToElementText(t),h.setEndPoint("StartToEnd",a);var p=h.text,m=document.body.createTextRange();m.moveToElementText(t),m.setEndPoint("StartToEnd",c);var g=m.text,b=e(t).html();e("#r3").text(f+" + "+o+" + "+p.length+" = "+b.length),f+g.length0?y.setEndPoint("StartToEnd",c):y.setEndPoint("StartToStart",c),y.setEndPoint("EndToEnd",a),y.select()}}e.fn.tabby=function(n){var r=e.extend({},e.fn.tabby.defaults,n),a=e.fn.tabby.pressed;return this.each(function(){$this=e(this);var n=e.meta?e.extend({},r,$this.data()):r;$this.bind("keydown",function(r){var i=e.fn.tabby.catch_kc(r);return 16==i&&(a.shft=!0),17==i&&(a.ctrl=!0,setTimeout("$.fn.tabby.pressed.ctrl = false;",1e3)),18==i&&(a.alt=!0,setTimeout("$.fn.tabby.pressed.alt = false;",1e3)),9!=i||a.ctrl||a.alt?void 0:(r.preventDefault,a.last=i,setTimeout("$.fn.tabby.pressed.last = null;",0),t(e(r.target).get(0),a.shft,n),!1)}).bind("keyup",function(t){16==e.fn.tabby.catch_kc(t)&&(a.shft=!1)}).bind("blur",function(t){9==a.last&&e(t.target).one("focus",function(){a.last=null}).get(0).focus()})})},e.fn.tabby.catch_kc=function(e){return e.keyCode?e.keyCode:e.charCode?e.charCode:e.which},e.fn.tabby.pressed={shft:!1,ctrl:!1,alt:!1,last:null},e.fn.tabby.defaults={tabString:String.fromCharCode(9)}}(jQuery),function(e,t,n){var r={required:"The %s field is required.",matches:"The %s field does not match the %s field.",valid_email:"The %s field must contain a valid email address.",min_length:"The %s field must be at least %s characters in length.",max_length:"The %s field must not exceed %s characters in length.",exact_length:"The %s field must be exactly %s characters in length.",greater_than:"The %s field must contain a number greater than %s.",less_than:"The %s field must contain a number less than %s.",alpha:"The %s field must only contain alphabetical characters.",alpha_numeric:"The %s field must only contain alpha-numeric characters.",alpha_dash:"The %s field must only contain alpha-numeric characters, underscores, and dashes.",numeric:"The %s field must contain only numbers.",integer:"The %s field must contain an integer."},a=function(){},i=/^(.+)\[(.+)\]$/,s=/^[0-9]+$/,o=/^\-?[0-9]+$/,l=/^\-?[0-9]*\.?[0-9]+$/,c=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i,d=/^[a-z]+$/i,u=/^[a-z0-9]+$/i,f=/^[a-z0-9_-]+$/i,h=function(e,n,r){for(this.callback=r||a,this.errors=[],this.fields={},this.form=t.forms[e]||{},this.messages={},this.handlers={},e=0,r=n.length;r>e;e++){var i=n[e];i.name&&i.rules&&(this.fields[i.name]={name:i.name,display:i.display||i.name,rules:i.rules,type:null,value:null,checked:null})}this.form.onsubmit=function(e){return function(t){try{return e._validateForm(t)}catch(n){}}}(this)};h.prototype.setMessage=function(e,t){return this.messages[e]=t,this},h.prototype.registerCallback=function(e,t){return e&&"string"==typeof e&&t&&"function"==typeof t&&(this.handlers[e]=t),this},h.prototype._validateForm=function(e){this.errors=[];for(var t in this.fields)if(this.fields.hasOwnProperty(t)){var r=this.fields[t]||{},a=this.form[r.name];a&&a!==n&&(r.type=a.type,r.value=a.value,r.checked=a.checked),this._validateField(r)}if("function"==typeof this.callback&&this.callback(this.errors,e),this.errors.length>0){if(!e||!e.preventDefault)return!1;e.preventDefault()}return!0},h.prototype._validateField=function(e){var t=e.rules.split("|");if(-1!==e.rules.indexOf("required")||e.value&&""!==e.value&&e.value!==n)for(var a=0,s=t.length;s>a;a++){var o=t[a],l=null,c=!1;if((parts=i.exec(o))&&(o=parts[1],l=parts[2]),"function"==typeof this._hooks[o]?this._hooks[o].apply(this,[e,l])||(c=!0):"callback_"===o.substring(0,9)&&(o=o.substring(9,o.length),"function"==typeof this.handlers[o]&&this.handlers[o].apply(this,[e.value])===!1&&(c=!0)),c){(t=this.messages[o]||r[o])?(e=t.replace("%s",e.display),l&&(e=e.replace("%s",this.fields[l]?this.fields[l].display:l)),this.errors.push(e)):this.errors.push("An error has occurred with the "+e.display+" field.");break}}},h.prototype._hooks={required:function(e){var t=e.value;return"checkbox"===e.type?e.checked===!0:null!==t&&""!==t},matches:function(e,t){return(el=this.form[t])?e.value===el.value:!1},valid_email:function(e){return c.test(e.value)},min_length:function(e,t){return s.test(t)?e.value.length>=t:!1},max_length:function(e,t){return s.test(t)?e.value.length<=t:!1},exact_length:function(e,t){return s.test(t)?e.value.length==t:!1},greater_than:function(e,t){return l.test(e.value)?parseFloat(e.value)>parseFloat(t):!1},less_than:function(e,t){return l.test(e.value)?parseFloat(e.value)="0"&&"7">=n?parseInt(e.substring(1),8):"u"===n||"x"===n?parseInt(e.substring(2),16):e.charCodeAt(1)}function n(e){return 32>e?(16>e?"\\x0":"\\x")+e.toString(16):(e=String.fromCharCode(e),("\\"===e||"-"===e||"["===e||"]"===e)&&(e="\\"+e),e)}function r(e){for(var r=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=[],i="^"===r[0],s=i?1:0,o=r.length;o>s;++s){var l=r[s];if(/\\[bdsw]/i.test(l))e.push(l);else{var c,l=t(l);o>s+2&&"-"===r[s+1]?(c=t(r[s+2]),s+=2):c=l,a.push([l,c]),65>c||l>122||(65>c||l>90||a.push([32|Math.max(65,l),32|Math.min(c,90)]),97>c||l>122||a.push([-33&Math.max(97,l),-33&Math.min(c,122)]))}}for(a.sort(function(e,t){return e[0]-t[0]||t[1]-e[1]}),r=[],l=[0/0,0/0],s=0;so[0]&&(o[1]+1>o[0]&&a.push("-"),a.push(n(o[1])));return a.push("]"),a.join("")}function a(e){for(var t=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),n=t.length,a=[],o=0,l=0;n>o;++o){var c=t[o];"("===c?++l:"\\"===c.charAt(0)&&(c=+c.substring(1))&&l>=c&&(a[c]=-1)}for(o=1;oo;++o)c=t[o],"("===c?(++l,void 0===a[l]&&(t[o]="(?:")):"\\"===c.charAt(0)&&(c=+c.substring(1))&&l>=c&&(t[o]="\\"+a[l]);for(l=o=0;n>o;++o)"^"===t[o]&&"^"!==t[o+1]&&(t[o]="");if(e.ignoreCase&&s)for(o=0;n>o;++o)c=t[o],e=c.charAt(0),c.length>=2&&"["===e?t[o]=r(c):"\\"!==e&&(t[o]=c.replace(/[A-Za-z]/g,function(e){return e=e.charCodeAt(0),"["+String.fromCharCode(-33&e,32|e)+"]"}));return t.join("")}for(var i=0,s=!1,o=!1,l=0,c=e.length;c>l;++l){var d=e[l];if(d.ignoreCase)o=!0;else if(/[a-z]/i.test(d.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0,o=!1;break}}for(var u={b:8,t:9,n:10,v:11,f:12,r:13},f=[],l=0,c=e.length;c>l;++l){if(d=e[l],d.global||d.multiline)throw Error(""+d);f.push("(?:"+a(d)+")")}return RegExp(f.join("|"),o?"gi":"g")}function t(e){function t(e){switch(e.nodeType){case 1:if(r.test(e.className))break;for(var n=e.firstChild;n;n=n.nextSibling)t(n);n=e.nodeName,("BR"===n||"LI"===n)&&(a[o]="\n",s[o<<1]=i++,s[o++<<1|1]=e);break;case 3:case 4:n=e.nodeValue,n.length&&(n=l?n.replace(/\r\n?/g,"\n"):n.replace(/[\t\n\r ]+/g," "),a[o]=n,s[o<<1]=i,i+=n.length,s[o++<<1|1]=e)}}var n,r=/(?:^|\s)nocode(?:\s|$)/,a=[],i=0,s=[],o=0;e.currentStyle?n=e.currentStyle.whiteSpace:window.getComputedStyle&&(n=document.defaultView.getComputedStyle(e,q).getPropertyValue("white-space"));var l=n&&"pre"===n.substring(0,3);return t(e),{a:a.join("").replace(/\n$/,""),c:s}}function n(e,t,n,r){t&&(e={a:t,d:e},n(e),r.push.apply(r,e.e))}function r(t,r){function a(e){for(var t=e.d,c=[t,"pln"],d=0,u=e.a.match(i)||[],f={},h=0,p=u.length;p>h;++h){var m,g=u[h],b=f[g],v=void 0;if("string"==typeof b)m=!1;else{var y=s[g.charAt(0)];if(y)v=g.match(y[1]),b=y[0];else{for(m=0;l>m;++m)if(y=r[m],v=g.match(y[1])){b=y[0];break}v||(b="pln")}!(m=b.length>=5&&"lang-"===b.substring(0,5))||v&&"string"==typeof v[1]||(m=!1,b="src"),m||(f[g]=b)}if(y=d,d+=g.length,m){m=v[1];var w=g.indexOf(m),x=w+m.length;v[2]&&(x=g.length-v[2].length,w=x-m.length),b=b.substring(5),n(t+y,g.substring(0,w),a,c),n(t+y+w,m,o(b,m),c),n(t+y+x,g.substring(x),a,c)}else c.push(t+y,b)}e.e=c}var i,s={};!function(){for(var n=t.concat(r),a=[],o={},l=0,c=n.length;c>l;++l){var d=n[l],u=d[3];if(u)for(var f=u.length;--f>=0;)s[u.charAt(f)]=d;d=d[1],u=""+d,o.hasOwnProperty(u)||(a.push(d),o[u]=q)}a.push(/[\S\s]/),i=e(a)}();var l=r.length;return a}function a(e){var t=[],n=[];e.tripleQuotedStrings?t.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):e.multiLineStrings?t.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,q,"'\"`"]):t.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]),e.verbatimStrings&&n.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var a=e.hashComments;return a&&(e.cStyleComments?(a>1?t.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):t.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),n.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):t.push(["com",/^#[^\n\r]*/,q,"#"])),e.cStyleComments&&(n.push(["com",/^\/\/[^\n\r]*/,q]),n.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q])),e.regexLiterals&&n.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]),(a=e.types)&&n.push(["typ",a]),e=(""+e.keywords).replace(/^ | $/g,""),e.length&&n.push(["kwd",RegExp("^(?:"+e.replace(/[\s,]+/g,"|")+")\\b"),q]),t.push(["pln",/^\s+/,q," \r\n "]),n.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]),r(t,n)}function i(e,t){function n(e){switch(e.nodeType){case 1:if(i.test(e.className))break;if("BR"===e.nodeName)r(e),e.parentNode&&e.parentNode.removeChild(e);else for(e=e.firstChild;e;e=e.nextSibling)n(e);break;case 3:case 4:if(l){var t=e.nodeValue,a=t.match(s);if(a){var c=t.substring(0,a.index);e.nodeValue=c,(t=t.substring(a.index+a[0].length))&&e.parentNode.insertBefore(o.createTextNode(t),e.nextSibling),r(e),c||e.parentNode.removeChild(e)}}}}function r(e){function t(e,n){var r=n?e.cloneNode(!1):e,a=e.parentNode;if(a){var a=t(a,1),i=e.nextSibling;a.appendChild(r);for(var s=i;s;s=i)i=s.nextSibling,a.appendChild(s)}return r}for(;!e.nextSibling;)if(e=e.parentNode,!e)return;for(var n,e=t(e.nextSibling,0);(n=e.parentNode)&&1===n.nodeType;)e=n;c.push(e)}var a,i=/(?:^|\s)nocode(?:\s|$)/,s=/\r\n?|\n/,o=e.ownerDocument;e.currentStyle?a=e.currentStyle.whiteSpace:window.getComputedStyle&&(a=o.defaultView.getComputedStyle(e,q).getPropertyValue("white-space"));var l=a&&"pre"===a.substring(0,3);for(a=o.createElement("LI");e.firstChild;)a.appendChild(e.firstChild);for(var c=[a],d=0;dd;++d)a=c[d],a.className="L"+(d+f)%10,a.firstChild||a.appendChild(o.createTextNode(" ")),u.appendChild(a);e.appendChild(u)}function s(e,t){for(var n=t.length;--n>=0;){var r=t[n];y.hasOwnProperty(r)?window.console&&console.warn("cannot override language handler %s",r):y[r]=e}}function o(e,t){return e&&y.hasOwnProperty(e)||(e=/^\s*p;)u[p]!==u[p+2]?(u[h++]=u[p++],u[h++]=u[p++]):p+=2;for(f=h,p=h=0;f>p;){for(var m=u[p],g=u[p+1],b=p+2;f>=b+2&&u[b+1]===g;)b+=2;u[h++]=m,u[h++]=g,p=b}for(u.length=h;d>a;){var v,y=c[a+2]||l,w=u[e+2]||l,b=Math.min(y,w),x=c[a+1];if(1!==x.nodeType&&(v=s.substring(r,b))){i&&(v=v.replace(n,"\r")),x.nodeValue=v;var S=x.ownerDocument,$=S.createElement("SPAN");$.className=u[e+1];var C=x.parentNode;C.replaceChild($,x),$.appendChild(x),y>r&&(c[a+1]=x=S.createTextNode(s.substring(b,y)),C.insertBefore(x,$.nextSibling))}r=b,r>=y&&(a+=2),r>=w&&(e+=2)}}catch(k){"console"in window&&console.log(k&&k.stack?k.stack:k)}}var c=["break,continue,do,else,for,if,return,while"],d=[[c,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],u=[d,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[d,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],h=[f,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],d=[d,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],p=[c,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],m=[c,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],c=[c,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],g=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,b=/\S/,v=a({keywords:[u,h,d,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+p,m,c],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),y={};s(v,["default-code"]),s(r([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^