UNPKG

splunk-sdk

Version:

SDK for usage with the Splunk REST API

1 lines 141 kB
!function n(s,r,a){function o(e,t){if(!r[e]){if(!s[e]){var i="function"==typeof require&&require;if(!t&&i)return i(e,!0);if(h)return h(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}i=r[e]={exports:{}},s[e][0].call(i.exports,function(t){return o(s[e][1][t]||t)},i,i.exports,n,s,r,a)}return r[e].exports}for(var h="function"==typeof require&&require,t=0;t<a.length;t++)o(a[t]);return o}({1:[function(t,e,i){var n;n="splunkjs",window[n]||(window[n]={}),window[n].UI||(window[n].UI={}),window[n].UI.Timeline=t("../ui/timeline.js")},{"../ui/timeline.js":3}],2:[function(t,e,i){!function(){var t=i||this,r=!1,a=/xyz/.test(function(){return xyz})?/\b_super\b/:/.*/;t.Class=function(){},t.Class.extend=function(t){var e,s=this.prototype,i=(r=!0,new this);for(e in r=!1,t)i[e]="function"==typeof t[e]&&"function"==typeof s[e]&&a.test(t[e])?function(i,n){return function(){var t=this._super,e=(this._super=s[i],n.apply(this,arguments));return this._super=t,e}}(e,t[e]):t[e];function n(){!r&&this.init&&this.init.apply(this,arguments)}return n.prototype=i,(n.constructor=n).extend=arguments.callee,n}}()},{}],3:[function(u,t,l){!function(){u("./timeline/jg_global.js");var t=u("./timeline/splunk_time.js"),e=u("./timeline/splunk_timeline.js"),i=u("./timeline/format.js"),n=u("../jquery.class").Class,s=u("../utils"),r=l||this,a=e.splunk.Timeline,o=t.splunk.time.DateTime,h=t.splunk.time.SimpleTimeZone;r.DateTime=o,r.SimpleTimeZone=h,r.Timeline=n.extend({init:function(t){this.timeline=new a,this.timeline.setSeriesColor(7578960),$(this.timeline.element).addClass("Timeline"),this.timeline.appendTo($(t).get(0)),this.timeline.externalInterface.formatNumericString=i.formatNumericString,this.timeline.externalInterface.formatNumber=i.formatNumber,this.timeline.externalInterface.formatDate=i.formatDate,this.timeline.externalInterface.formatTime=i.formatTime,this.timeline.externalInterface.formatDateTime=i.formatDateTime,this.timeline.externalInterface.formatTooltip=i.formatTooltip,this.updateWithJSON=s.bind(this,this.updateWithJSON),this.updateWithXML=s.bind(this,this.updateWithXML),this.updateWithData=s.bind(this,this.updateWithData)},updateWithJSON:function(t){var e={buckets:[],cursorTime:new o(t.cursor_time),eventCount:t.event_count,earliestOffset:t.earliestOffset||0};e.cursorTime&&(e.cursorTime=e.cursorTime.toTimeZone(new h(e.earliestOffset)));for(var i=0;i<t.buckets.length;i++){var n=t.buckets[i],s={earliestTime:new o(n.earliest_time),duration:n.duration,eventCount:n.total_count,eventAvailableCount:n.available_count,isComplete:n.is_finalized};isNaN(s.duration)&&(s.duration=0),isNaN(s.earliestOffset)&&(s.earliestOffset=0),isNaN(s.latestOffset)&&(s.latestOffset=0),s.earliestTime&&(s.latestTime=new o(s.earliestTime.getTime()+s.duration)),s.earliestTime&&(s.earliestTime=s.earliestTime.toTimeZone(new h(n.earliest_time_offset))),s.latestTime&&(s.latestTime=s.latestTime.toTimeZone(new h(n.latest_time_offset))),e.buckets.push(s)}this.timeline._updateTimelineData(e)},updateWithXML:function(t){this.timeline._parseTimelineData(t)},updateWithData:function(t){this.timeline._updateTimelineData(t)}})}()},{"../jquery.class":2,"../utils":8,"./timeline/format.js":4,"./timeline/jg_global.js":5,"./timeline/splunk_time.js":6,"./timeline/splunk_timeline.js":7}],4:[function(t,e,i){var h,u,n,r,s,a,o;t=t("./splunk_time.js"),h=t.splunk.time.DateTime,u=t.splunk.time.SimpleTimeZone,n=i.formatNumber=function(t){var e=Math.abs(t);if(0<e&&(e<.001||1e9<=e))return t.toExponential(2).replace(/e/g,"E").replace(/\+/g,"");for(var i=String(Number(t.toFixed(3))),e=i.indexOf("."),n=(e<0&&(e=i.length),i.substring(e,i.length)),s=e-3;0<s;s-=3)n=","+i.substring(s,s+3)+n;return n=i.substring(0,s+3)+n},r=i.formatNumericString=function(t,e,i){return(1===Math.abs(i)?t:e).split("%s").join(n(i))},s=i.formatDate=function(t,e,i){var n=(n=new h(t)).toTimeZone(new u(e)),s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];switch(i){case"EEE MMM d":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][n.getWeekday()]+" "+s[n.getMonth()-1]+" "+n.getDay();case"MMMM":return["January","February","March","April","May","June","July","August","September","October","November","December"][n.getMonth()-1];case"yyyy":return String(n.getYear());default:return s[n.getMonth()-1]+" "+n.getDay()+", "+n.getYear()}},a=i.formatTime=function(t,e,i){var t=new h(t),n=(t=t.toTimeZone(new u(e))).getHours(),s=t.getMinutes(),r=Math.floor(t.getSeconds()),a=Math.floor(1e3*(t.getSeconds()-r)),o=n<12?"AM":"PM";switch(12<=n&&(n-=12),n=""+(n=0===n?12:n),s=s<10?"0"+s:""+s,r=r<10?"0"+r:""+r,a=a<100?a<10?"00"+a:"0"+a:""+a,i){case"short":return n+":"+s+" "+o;case"medium":return n+":"+s+":"+r+" "+o;case"long":case"full":return n+":"+s+":"+r+"."+a+" "+o;default:return"000"!==a?n+":"+s+":"+r+"."+a+" "+o:"00"!==r?n+":"+s+":"+r+" "+o:n+":"+s+" "+o}},o=i.formatDateTime=function(t,e,i,n){return s(t,e,i)+" "+a(t,e,n)},i.formatTooltip=function(t,e,i,n,s){return r("%s event","%s events",s)+" from "+o(t,i)+" to "+o(e,n)}},{"./splunk_time.js":6}],5:[function(t,e,i){function g(t,e){return function(){t.apply(this,arguments),e.call(this)}}var o,h,u,s,l,m,f,d,c,_,p;o={},h={},u={},s={},l={},m=[],f=0,d=null,_=(i=c=i).jg_namespace=function(t,e){if(null==t)throw new Error("Parameter path must be non-null.");if("string"!=typeof t)throw new Error("Parameter path must be a string.");if(null!=e&&"function"!=typeof e)throw new Error("Parameter closure must be a function.");if(!(s=o[t])){for(var i,n=t?t.split("."):[],s=c,r=0,a=n.length;r<a;r++)s=s[i=n[r]]||(s[i]={});o[t]=s}return e&&e.call(s,s),s},(p=i.jg_import=function(t){if(null==t)throw new Error("Parameter path must be non-null.");if("string"!=typeof t)throw new Error("Parameter path must be a string.");if(!t)throw new Error("Parameter path must be non-empty.");if(!(e=h[t])){if(u[t])throw new Error("Recursive dependency on class "+t+".");var e,i={},n=t.lastIndexOf("."),s=n<0?"":t.substring(0,n),n=n<0?t:t.substring(n+1),s=_(s);if(!(e=s[n]))try{u[t]=!0;var r=p.getClassPath(t)+".js",a=null;try{var o=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest;o.open("GET",r,!1),o.send(null),200!=o.status&&0!=o.status||(a=o.responseText)}catch(t){}if(null==a)throw new Error("Failed to load class "+t+".");if(!function(t){arguments=void 0,eval.call(window,t)}(a),!(e=s[n]))throw new Error("Failed to initialize class "+t+".");i.src=r,i.script=a}finally{delete u[t]}i.path=t,i.reference=e,l[t]=i,m.push(t),h[t]=e}return e}).setClassPath=function(t,e){if(null==t)throw new Error("Parameter path must be non-null.");if("string"!=typeof t)throw new Error("Parameter path must be a string.");if(null==e)throw new Error("Parameter dir must be non-null.");if("string"!=typeof e)throw new Error("Parameter dir must be a string.");s[t]=e},p.getClassPath=function(t){if(null==t)throw new Error("Parameter path must be non-null.");if("string"!=typeof t)throw new Error("Parameter path must be a string.");var e,i=[];for(e in s)s.hasOwnProperty(e)&&i.push(e);i.sort();for(var n=i.length-1;0<=n;n--)if(e=i[n],t.substring(0,e.length)===e)return s[e]+t.substring(e.length).replace(/\./g,"/");return t.replace(/\./g,"/")},p.getClassInfo=function(t){if(null!=t&&"string"!=typeof t)throw new Error("Parameter path must be a string.");if(!t){for(var e=[],i=0,n=m.length;i<n;i++)e.push(p.getClassInfo(m[i]));return e}t=l[t];if(!t)return null;var s={};return s.path=t.path,s.reference=t.reference,null!=t.src&&(s.src=t.src),null!=t.script&&(s.script=t.script),s},i.jg_extend=function(t,e){if(null==t)throw new Error("Parameter baseClass must be non-null.");if("function"!=typeof t)throw new Error("Parameter baseClass must be a class.");if(null!=e&&"function"!=typeof e)throw new Error("Parameter closure must be a function.");function i(){n.apply(this,arguments)}var n=t,s=t.prototype,t=((t=function(){}).prototype=s,i.prototype=new t);if(t.constructor=i,e){if(e.call(t,i,s,t),i.prototype!==t)throw new Error('Class member "prototype" cannot be overridden.');if(t.constructor!==i){if("function"!=typeof t.constructor)throw new Error('Instance member "constructor" must be a function.');n=t.constructor,t.constructor=i}}return i},i.jg_static=function(t){if(null!=t&&"function"!=typeof t)throw new Error("Parameter closure must be a function.");var e={};return t&&t.call(e,e),e},i.jg_mixin=function(t,e,i){if(null==t)throw new Error("Parameter target must be non-null.");if(null==e)throw new Error("Parameter source must be non-null.");var n=e.__jg_mixin_id;if(t[n="__jg_mixin_has_"+(n=n||(e.__jg_mixin_id="#"+ ++f))])return i;function s(){}var r,a=null!=i&&i.hasOwnProperty("constructor")&&"function"==typeof i.constructor?i.constructor:function(){},o=(s.prototype=t.__proto__||Object.prototype,(i=new s).constructor=a,e.mixin);if(null!=o&&"function"==typeof o){var h=new s;for(r in t)t.hasOwnProperty(r)&&(h[r]=t[r]);h.constructor=a;try{(d=d||[]).push(i);var u=t.constructor;if(o.call(t,h,t),t.constructor!==u)throw new Error('Target member "constructor" cannot be overridden.')}finally{d.pop(),0==d.length&&(d=null)}}for(r in e)e.hasOwnProperty(r)&&"mixin"!==r&&"constructor"!==r&&"__"!==r.substring(0,2)&&(t[r]=e[r]);for(r in t)t.hasOwnProperty(r)&&"constructor"!==r&&(i[r]=t[r]);var l=e.hasOwnProperty("constructor")&&"function"==typeof e.constructor?e.constructor:null;if(l&&(i.constructor=g(i.constructor,l),d))for(var m,c=d.length-1;0<=c;c--)(m=d[c]).constructor=g(m.constructor,l);return t[n]=!0,i},i.jg_has_mixin=function(t,e){if(null==t)throw new Error("Parameter target must be non-null.");if(null==e)throw new Error("Parameter source must be non-null.");e=e.__jg_mixin_id;return!!e&&1==t["__jg_mixin_has_"+e]},i.jg_delegate=function(e,i){if(null==i)throw new Error("Parameter method must be non-null.");var n="string"==typeof i;if(n){if(null==e)throw new Error("Parameter scope must be non-null.")}else if("function"!=typeof i)throw new Error("Parameter method must be a string or a function.");return function(){if(!n)return i.apply(e,arguments);var t=e[i];return"function"==typeof t?t.apply(e,arguments):void 0}}},{}],6:[function(t,e,i){var t=t("./jg_global"),n=t.jg_namespace,s=t.jg_import,a=t.jg_extend,r=t.jg_static;t.jg_mixin,t.jg_has_mixin,t.jg_jg_delegate,e.exports=t,n("splunk.time",function(){this.ITimeZone=a(Object,function(t,e){this.getStandardOffset=function(){},this.getOffset=function(t){}})}),n("splunk.time",function(){var t=s("splunk.time.ITimeZone");this.SimpleTimeZone=a(t,function(t,e){this._offset=0,this.constructor=function(t){this._offset=void 0!==t?t:0},this.getStandardOffset=function(){return this._offset},this.getOffset=function(t){return this._offset}})}),n("splunk.time",function(){var t=s("splunk.time.ITimeZone");this.LocalTimeZone=a(t,function(t,e){this.getStandardOffset=function(){return 60*-new Date(0).getTimezoneOffset()},this.getOffset=function(t){return 60*-new Date(1e3*t).getTimezoneOffset()}})}),n("splunk.time",function(){var e=s("splunk.time.LocalTimeZone"),i=s("splunk.time.SimpleTimeZone");this.TimeZones=r(function(t){t.LOCAL=new e,t.UTC=new i(0)})}),n("splunk.time",function(){var f=s("splunk.time.ITimeZone"),d=s("splunk.time.SimpleTimeZone"),_=s("splunk.time.TimeZones");this.DateTime=a(Object,function(i,t){function s(t){return Number(t.toFixed(6))}function n(t,e,i){if(t!=t)return"NaN";if(t==1/0)return"Infinity";if(t==-1/0)return"-Infinity";e=void 0!==e?e:0,i=void 0!==i?i:0;var n=t.toFixed(20);(t=n.indexOf("."))<0?t=n.length:n=i<1?n.substring(0,t):n.substring(0,t)+"."+n.substring(t+1,t+i+1);for(var s=t;s<e;s++)n="0"+n;return n}var g=/([\+\-])?(\d{4,})(?:(?:\-(\d{2}))(?:(?:\-(\d{2}))(?:(?:[T ](\d{2}))(?:(?:\:(\d{2}))(?:(?:\:(\d{2}(?:\.\d+)?)))?)?(?:(Z)|([\+\-])(\d{2})(?:\:(\d{2}))?)?)?)?)?/;this._year=0,this._month=1,this._day=1,this._weekday=0,this._hours=0,this._minutes=0,this._seconds=0,this._timeZone=_.LOCAL,this._timeZoneOffset=0,this._time=0,this._isValid=!0,this.constructor=function(t,e,i,n,s,r,a){switch(arguments.length){case 0:var o=new Date;this._time=o.getTime()/1e3,this._updateProperties();break;case 1:var h,u,l,m,c;"number"==typeof t?(this._time=t,this._updateProperties()):"string"==typeof t?(u="-"==(h=1<(c=(o=g.exec(t))?o.length:0)?o[1]:null)?-1:1,h=2<c?o[2]:null,this._year=h?u*Number(h):0,h=3<c?o[3]:null,this._month=h?Number(h):1,h=4<c?o[4]:null,this._day=h?Number(h):1,h=5<c?o[5]:null,this._hours=h?Number(h):0,h=6<c?o[6]:null,this._minutes=h?Number(h):0,h=7<c?o[7]:null,this._seconds=h?Number(h):0,u="Z"==(h=8<c?o[8]:null),l="-"==(h=9<c?o[9]:null)?-1:1,m=(h=10<c?o[10]:null)?Number(h):NaN,c=(h=11<c?o[11]:null)?Number(h):NaN,u?this._timeZone=_.UTC:isNaN(m)||isNaN(c)?this._timeZone=_.LOCAL:this._timeZone=new d(l*(60*m+c)*60),this._updateTime()):(this._time=NaN,this._updateProperties());break;default:"number"==typeof t?(this._year=t,this._month=void 0!==e?e:1,this._day=void 0!==i?i:1,this._hours=void 0!==n?n:0,this._minutes=void 0!==s?s:0,this._seconds=void 0!==r?r:0,this._timeZone=a instanceof f?a:_.LOCAL,this._updateTime()):(this._time=NaN,this._updateProperties())}},this.getYear=function(){return this._year},this.setYear=function(t){this._year=t,this._updateTime()},this.getMonth=function(){return this._month},this.setMonth=function(t){this._month=t,this._updateTime()},this.getDay=function(){return this._day},this.setDay=function(t){this._day=t,this._updateTime()},this.getWeekday=function(){return this._weekday},this.getHours=function(){return this._hours},this.setHours=function(t){this._hours=t,this._updateTime()},this.getMinutes=function(){return this._minutes},this.setMinutes=function(t){this._minutes=t,this._updateTime()},this.getSeconds=function(){return this._seconds},this.setSeconds=function(t){this._seconds=t,this._updateTime()},this.getTimeZone=function(){return this._timeZone},this.setTimeZone=function(t){this._timeZone=t instanceof f?t:_.LOCAL,this._updateTime()},this.getTimeZoneOffset=function(){return this._timeZoneOffset},this.getTime=function(){return this._time},this.setTime=function(t){this._time=t,this._updateProperties()},this.toUTC=function(){return this.toTimeZone(_.UTC)},this.toLocal=function(){return this.toTimeZone(_.LOCAL)},this.toTimeZone=function(t){var e=new i;return e.setTimeZone(t),e.setTime(this._time),e},this.clone=function(){var t=new i;return t.setTimeZone(this._timeZone),t.setTime(this._time),t},this.equals=function(t){return this._time===t._time&&this._timeZoneOffset===t._timeZoneOffset},this.toString=function(){if(!this._isValid)return"Invalid Date";var t,e="",i=(this._year<0?e+="-"+n(-this._year,4):e+=n(this._year,4),e=(e+="-"+n(this._month,2)+"-"+n(this._day,2))+("T"+n(this._hours,2)+":"+n(this._minutes,2)+":"+n(this._seconds,2,3)),this._timeZoneOffset/60);return 0==i?e+="Z":(e+=i<0?"-":"+",i<0&&(i=-i),t=Math.floor(i/60),i=Math.floor(i%60),e+=n(t,2)+":"+n(i,2)),e},this.valueOf=function(){return this._time},this._updateTime=function(){var t,e,i,n,s,r;this._validate()&&(n=this._year,s=this._month-1,i=this._day-1,e=this._hours,t=this._minutes,r=this._seconds,s=(s=s+12*n)-(n=Math.floor(s)),e=(r=r+60*t+3600*e+86400*i)-(t=Math.floor(r)),(i=new Date(0)).setUTCFullYear(0),i.setUTCMonth(n),0!=s&&(i.setUTCMonth(i.getUTCMonth()+1),i.setUTCDate(0),r=i.getUTCDate()*s*86400,t+=n=Math.floor(r),1<=(e+=r-n)&&(e--,t++),i.setUTCDate(1)),i.setUTCSeconds(t),s=i.getTime()/1e3+e,r=this._timeZone,this._time=s-r.getOffset(s-r.getStandardOffset()),this._updateProperties())},this._updateProperties=function(){var t,e,i,n;this._validate()&&(i=(t=s(this._time))+(e=s(this._timeZone.getOffset(t))),n=Math.floor(i),1<=(i=s(i-n))&&(i=0,n++),n=new Date(1e3*n),this._year=n.getUTCFullYear(),this._month=n.getUTCMonth()+1,this._day=n.getUTCDate(),this._weekday=n.getUTCDay(),this._hours=n.getUTCHours(),this._minutes=n.getUTCMinutes(),this._seconds=n.getUTCSeconds()+i,this._time=t,this._timeZoneOffset=e,this._validate())},this._validate=function(){var t;return this._isValid?(this._year*=1,this._month*=1,this._day*=1,this._weekday*=1,this._hours*=1,this._minutes*=1,this._seconds*=1,this._timeZoneOffset*=1,this._time*=1,t=this._year+this._month+this._day+this._weekday+this._hours+this._minutes+this._seconds+this._timeZoneOffset+this._time,!isNaN(t)&&t!=1/0&&t!=-1/0&&this._timeZone||(this._isValid=!1)):(this._year*=1,this._time*=1,this._year>-1/0&&this._year<1/0?(this._month=1,this._day=1,this._hours=0,this._minutes=0,this._seconds=0,this._isValid=!0):this._time>-1/0&&this._time<1/0&&(this._isValid=!0)),this._isValid||(this._year=NaN,this._month=NaN,this._day=NaN,this._weekday=NaN,this._hours=NaN,this._minutes=NaN,this._seconds=NaN,this._timeZoneOffset=NaN,this._time=NaN),this._isValid}})}),n("splunk.time",function(){this.Duration=a(Object,function(t,e){var u=/P(?:(\-?\d+(?:\.\d+)?)Y)?(?:(\-?\d+(?:\.\d+)?)M)?(?:(\-?\d+(?:\.\d+)?)D)?(?:T(?:(\-?\d+(?:\.\d+)?)H)?(?:(\-?\d+(?:\.\d+)?)M)?(?:(\-?\d+(?:\.\d+)?)S)?)?/;this.years=0,this.months=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0,this.constructor=function(t,e,i,n,s,r){var a,o,h;1==arguments.length&&"string"==typeof t?(h=1<(o=(a=u.exec(t))?a.length:0)?a[1]:null,this.years=h?Number(h):0,h=2<o?a[2]:null,this.months=h?Number(h):0,h=3<o?a[3]:null,this.days=h?Number(h):0,h=4<o?a[4]:null,this.hours=h?Number(h):0,h=5<o?a[5]:null,this.minutes=h?Number(h):0,h=6<o?a[6]:null,this.seconds=h?Number(h):0):(this.years="number"==typeof t?t:0,this.months=void 0!==e?e:0,this.days=void 0!==i?i:0,this.hours=void 0!==n?n:0,this.minutes=void 0!==s?s:0,this.seconds=void 0!==r?r:0)},this.clone=function(){return new t(this.years,this.months,this.days,this.hours,this.minutes,this.seconds)},this.equals=function(t){return this.years==t.years&&this.months==t.months&&this.days==t.days&&this.hours==t.hours&&this.minutes==t.minutes&&this.seconds==t.seconds},this.toString=function(){var t="";return(t+="P"+this.years+"Y"+this.months+"M"+this.days+"D")+("T"+this.hours+"H"+this.minutes+"M"+this.seconds+"S")}})}),n("jgatt.utils",function(){this.IComparator=a(Object,function(t,e){this.compare=function(t,e){}})}),n("jgatt.utils",function(){var t=s("jgatt.utils.IComparator");this.NaturalComparator=a(t,function(t,e){this.compare=function(t,e){return t<e?-1:e<t?1:0}})}),n("jgatt.utils",function(){var h=s("jgatt.utils.IComparator"),e=s("jgatt.utils.NaturalComparator");this.ArrayUtils=r(function(t){var o=new e;t.indexOf=function(t,e){if(null==t)throw new Error("Parameter a must be non-null.");if(!(t instanceof Array))throw new Error("Parameter a must be an array.");for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i;return-1},t.lastIndexOf=function(t,e){if(null==t)throw new Error("Parameter a must be non-null.");if(!(t instanceof Array))throw new Error("Parameter a must be an array.");for(var i=t.length-1;0<=i;i--)if(t[i]===e)return i;return-1},t.sort=function(t,i){if(null==t)throw new Error("Parameter a must be non-null.");if(!(t instanceof Array))throw new Error("Parameter a must be an array.");if(null!=i&&!(i instanceof h))throw new Error("Parameter comparator must be an instance of jgatt.utils.IComparator.");i=i||o;t.sort(function(t,e){return i.compare(t,e)})},t.binarySearch=function(t,e,i){if(null==t)throw new Error("Parameter a must be non-null.");if(!(t instanceof Array))throw new Error("Parameter a must be an array.");if(null!=i&&!(i instanceof h))throw new Error("Parameter comparator must be an instance of jgatt.utils.IComparator.");var n=t.length-1;if(n<0)return-1;i=i||o;for(var s,r,a=0;a<=n;)if(s=a+Math.floor((n-a)/2),(r=i.compare(e,t[s]))<0)n=s-1;else{if(!(0<r))return s;a=s+1}return-a-1}})}),n("splunk.time",function(){var r=s("jgatt.utils.ArrayUtils"),t=s("splunk.time.ITimeZone");this.SplunkTimeZone=a(t,function(t,e){this._standardOffset=0,this._serializedTimeZone=null,this._isConstant=!1,this._offsetList=null,this._timeList=null,this._indexList=null,this.constructor=function(t){if(null==t)throw new Error("Parameter serializedTimeZone must be non-null.");if("string"!=typeof t)throw new Error("Parameter serializedTimeZone must be a string.");this._serializedTimeZone=t,this._offsetList=[],this._timeList=[],this._indexList=[],this._parseSerializedTimeZone(t)},this.getSerializedTimeZone=function(){return this._serializedTimeZone},this.getStandardOffset=function(){return this._standardOffset},this.getOffset=function(t){if(this._isConstant)return this._standardOffset;var e=this._offsetList,i=e.length;if(0==i)return 0;if(1==i)return e[0];var n,i=this._timeList,s=i.length;return 0==s?0:(1==s?n=0:(n=r.binarySearch(i,t))<-1?n=-n-2:-1==n&&(n=0),e[this._indexList[n]])},this._parseSerializedTimeZone=function(t){if(t){for(var e,i=t.split(";"),n=0,s=i.length;n<s;n++)if(e=i[n])switch(e.charAt(0)){case"C":if(this._parseC(e.substring(1,e.length)))return;break;case"Y":this._parseY(e.substring(1,e.length));break;case"@":this._parseAt(e.substring(1,e.length))}this._standardOffset=this.getOffset(0)}},this._parseC=function(t){if(!t)return!1;t=Number(t);return!isNaN(t)&&(this._standardOffset=t,this._isConstant=!0)},this._parseY=function(t){!t||(t=t.split(" ")).length<1||(t=t[0])&&(t=Number(t),isNaN(t)||this._offsetList.push(t))},this._parseAt=function(t){var e,i;!t||(t=t.split(" ")).length<2||(i=t[0])&&(e=Number(i),isNaN(e)||(i=t[1])&&(t=Number(i),isNaN(t)||(t=Math.floor(t))<0||t>=this._offsetList.length||(this._timeList.push(e),this._indexList.push(t))))}})}),n("splunk.time",function(){var g=s("splunk.time.DateTime"),f=s("splunk.time.Duration"),d=s("splunk.time.SimpleTimeZone"),_=s("splunk.time.TimeZones");this.TimeUtils=r(function(u){u.EPOCH=new g(0).toUTC(),u.daysInMonth=function(t){return(t=new g(t.getYear(),t.getMonth()+1,0,0,0,0,_.UTC)).getDay()},u.addDurations=function(t,e){return new f(t.years+e.years,t.months+e.months,t.days+e.days,t.hours+e.hours,t.minutes+e.minutes,t.seconds+e.seconds)},u.addDateDuration=function(t,e){return(t=0==e.years&&0==e.months&&0==e.days?t.clone():new g(t.getYear()+e.years,t.getMonth()+e.months,t.getDay()+e.days,t.getHours(),t.getMinutes(),t.getSeconds(),t.getTimeZone())).setTime(t.getTime()+(3600*e.hours+60*e.minutes+e.seconds)),t},u.subtractDates=function(t,e){e=e.toTimeZone(t.getTimeZone());var i,n,s,r,a,o,h,u=t.getTime()<e.getTime(),l=(u&&(l=t,t=e,e=l),t.getTimeZoneOffset()==e.getTimeZoneOffset());return l?o=t:(t.getYear()==e.getYear()&&t.getMonth()==e.getMonth()&&t.getDay()==e.getDay()||(o=new g(t.getYear(),t.getMonth(),t.getDay(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getTimeZone())).getTime()>t.getTime()&&((o=new g(t.getYear(),t.getMonth(),t.getDay()-1,e.getHours(),e.getMinutes(),e.getSeconds(),e.getTimeZone())).getTime()<e.getTime()||o.getYear()==e.getYear()&&o.getMonth()==e.getMonth()&&o.getDay()==e.getDay()))&&(o=e),i=o.getYear()-e.getYear(),n=o.getMonth()-e.getMonth(),s=o.getDay()-e.getDay(),l?(r=o.getHours()-e.getHours(),a=o.getMinutes()-e.getMinutes(),(h=o.getSeconds()-e.getSeconds())<0&&(h+=60,a--),a<0&&(a+=60,r--),r<0&&(r+=24,s--),h=c(h)):(h=t.getTime()-o.getTime(),l=Math.floor(h),1<=(t=c(h-l))&&(t=0,l++),a=Math.floor(l/60),h=l%60+t,r=Math.floor(a/60),a%=60),s<0&&(s+=(o=new g(e.getYear(),e.getMonth()+1,0,0,0,0,_.UTC)).getDay(),n--),n<0&&(n+=12,i--),u&&(i=-i,n=-n,s=-s,r=-r,a=-a,h=-h),new f(i,n,s,r,a,h)},u.subtractDurations=function(t,e){return new f(t.years-e.years,t.months-e.months,t.days-e.days,t.hours-e.hours,t.minutes-e.minutes,t.seconds-e.seconds)},u.subtractDateDuration=function(t,e){return(t=0==e.years&&0==e.months&&0==e.days?t.clone():new g(t.getYear()-e.years,t.getMonth()-e.months,t.getDay()-e.days,t.getHours(),t.getMinutes(),t.getSeconds(),t.getTimeZone())).setTime(t.getTime()-(3600*e.hours+60*e.minutes+e.seconds)),t},u.multiplyDuration=function(t,e){return new f(t.years*e,t.months*e,t.days*e,t.hours*e,t.minutes*e,t.seconds*e)},u.divideDuration=function(t,e){return new f(t.years/e,t.months/e,t.days/e,t.hours/e,t.minutes/e,t.seconds/e)},u.ceilDate=function(t,e){var i=t.toTimeZone(new d(t.getTimeZoneOffset()));return n(i,e),l(i,t.getTimeZone())},u.ceilDuration=function(t,e,i){i=i||u.EPOCH;var n=u.addDateDuration(i,t),s=n.getTime()<i.getTime();return t=s?u.subtractDates(i,n):u.subtractDates(n,i),e||(e=new f,0<t.years?e.years=1:0<t.months?e.months=1:0<t.days?e.days=1:0<t.hours?e.hours=1:0<t.minutes?e.minutes=1:0<t.seconds&&(e.seconds=1)),s?(a(t,e,n),u.multiplyDuration(t,-1)):(r(t,e,i),t)},u.floorDate=function(t,e){var i=t.toTimeZone(new d(t.getTimeZoneOffset()));return s(i,e),l(i,t.getTimeZone())},u.floorDuration=function(t,e,i){i=i||u.EPOCH;var n=u.addDateDuration(i,t),s=n.getTime()<i.getTime();return t=s?u.subtractDates(i,n):u.subtractDates(n,i),e||(e=new f,0<t.years?e.years=1:0<t.months?e.months=1:0<t.days?e.days=1:0<t.hours?e.hours=1:0<t.minutes?e.minutes=1:0<t.seconds&&(e.seconds=1)),s?(r(t,e,n),u.multiplyDuration(t,-1)):(a(t,e,i),t)},u.roundDate=function(t,e){var i=t.toTimeZone(new d(t.getTimeZoneOffset()));return o(i,e),l(i,t.getTimeZone())},u.roundDuration=function(t,e,i){i=i||u.EPOCH;var n=u.addDateDuration(i,t),s=n.getTime()<i.getTime();return t=s?u.subtractDates(i,n):u.subtractDates(n,i),e||(e=new f,0<t.years?e.years=1:0<t.months?e.months=1:0<t.days?e.days=1:0<t.hours?e.hours=1:0<t.minutes?e.minutes=1:0<t.seconds&&(e.seconds=1)),s?(h(t,e,n),u.multiplyDuration(t,-1)):(h(t,e,i),t)},u.normalizeDuration=function(t,e){e=e||u.EPOCH;t=u.addDateDuration(e,t);return u.subtractDates(t,e)},u.durationToSeconds=function(t,e){e=e||u.EPOCH;t=u.addDateDuration(e,t);return c(t.getTime()-e.getTime())},u.secondsToDuration=function(t,e){e=e||u.EPOCH;t=new g(e.getTime()+t).toTimeZone(e.getTimeZone());return u.subtractDates(t,e)};var n=function(t,e){var i=0<e.years,n=i||0<e.months,s=n||0<e.days,r=s||0<e.hours,a=r||0<e.minutes;(a||0<e.seconds)&&(0<t.getSeconds()&&(0<e.seconds?t.setSeconds(Math.min(Math.ceil(t.getSeconds()/e.seconds)*e.seconds,60)):t.setSeconds(60)),a&&(0<t.getMinutes()&&(0<e.minutes?t.setMinutes(Math.min(Math.ceil(t.getMinutes()/e.minutes)*e.minutes,60)):t.setMinutes(60)),r&&(0<t.getHours()&&(0<e.hours?t.setHours(Math.min(Math.ceil(t.getHours()/e.hours)*e.hours,24)):t.setHours(24)),s&&(1<t.getDay()&&(a=u.daysInMonth(t),0<e.days?t.setDay(Math.min(Math.ceil((t.getDay()-1)/e.days)*e.days,a)+1):t.setDay(a+1)),n&&(1<t.getMonth()&&(0<e.months?t.setMonth(Math.min(Math.ceil((t.getMonth()-1)/e.months)*e.months,12)+1):t.setMonth(13)),i&&0<e.years&&t.setYear(Math.ceil(t.getYear()/e.years)*e.years))))))},r=function(t,e,i){var n=0<e.years,s=n||0<e.months,r=s||0<e.days,a=r||0<e.hours,o=a||0<e.minutes,h=o||0<e.seconds,i=u.daysInMonth(i);h&&(0<t.seconds&&(0<e.seconds?t.seconds=Math.min(Math.ceil(t.seconds/e.seconds)*e.seconds,60):t.seconds=60,m(t,i)),o&&(0<t.minutes&&(0<e.minutes?t.minutes=Math.min(Math.ceil(t.minutes/e.minutes)*e.minutes,60):t.minutes=60,m(t,i)),a&&(0<t.hours&&(0<e.hours?t.hours=Math.min(Math.ceil(t.hours/e.hours)*e.hours,24):t.hours=24,m(t,i)),r&&(0<t.days&&(0<e.days?t.days=Math.min(Math.ceil(t.days/e.days)*e.days,i):t.days=i,m(t,i)),s&&(0<t.months&&(0<e.months?t.months=Math.min(Math.ceil(t.months/e.months)*e.months,12):t.months=12,m(t,i)),n&&0<e.years&&(t.years=Math.ceil(t.years/e.years)*e.years,m(t,i)))))))},s=function(t,e){var i=0<e.years,n=i||0<e.months,s=n||0<e.days,r=s||0<e.hours,a=r||0<e.minutes;(a||0<e.seconds)&&(0<t.getSeconds()&&(0<e.seconds?t.setSeconds(Math.floor(t.getSeconds()/e.seconds)*e.seconds):t.setSeconds(0)),a&&(0<t.getMinutes()&&(0<e.minutes?t.setMinutes(Math.floor(t.getMinutes()/e.minutes)*e.minutes):t.setMinutes(0)),r&&(0<t.getHours()&&(0<e.hours?t.setHours(Math.floor(t.getHours()/e.hours)*e.hours):t.setHours(0)),s&&(1<t.getDay()&&(0<e.days?t.setDay(Math.floor((t.getDay()-1)/e.days)*e.days+1):t.setDay(1)),n&&(1<t.getMonth()&&(0<e.months?t.setMonth(Math.floor((t.getMonth()-1)/e.months)*e.months+1):t.setMonth(1)),i&&0<e.years&&t.setYear(Math.floor(t.getYear()/e.years)*e.years))))))},a=function(t,e,i){var n=0<e.years,s=n||0<e.months,r=s||0<e.days,a=r||0<e.hours,o=a||0<e.minutes,h=o||0<e.seconds,i=u.daysInMonth(i);h&&(0<t.seconds&&(0<e.seconds?t.seconds=Math.floor(t.seconds/e.seconds)*e.seconds:t.seconds=0,m(t,i)),o&&(0<t.minutes&&(0<e.minutes?t.minutes=Math.floor(t.minutes/e.minutes)*e.minutes:t.minutes=0,m(t,i)),a&&(0<t.hours&&(0<e.hours?t.hours=Math.floor(t.hours/e.hours)*e.hours:t.hours=0,m(t,i)),r&&(0<t.days&&(0<e.days?t.days=Math.floor(t.days/e.days)*e.days:t.days=0,m(t,i)),s&&(0<t.months&&(0<e.months?t.months=Math.floor(t.months/e.months)*e.months:t.months=0,m(t,i)),n&&0<e.years&&(t.years=Math.floor(t.years/e.years)*e.years,m(t,i)))))))},o=function(t,e){var i=0<e.years,n=i||0<e.months,s=n||0<e.days,r=s||0<e.hours,a=r||0<e.minutes;(a||0<e.seconds)&&(0<t.getSeconds()&&(0<e.seconds?t.setSeconds(Math.min(Math.round(t.getSeconds()/e.seconds)*e.seconds,60)):30<=t.getSeconds()?t.setSeconds(60):t.setSeconds(0)),a&&(0<t.getMinutes()&&(0<e.minutes?t.setMinutes(Math.min(Math.round(t.getMinutes()/e.minutes)*e.minutes,60)):30<=t.getMinutes()?t.setMinutes(60):t.setMinutes(0)),r&&(0<t.getHours()&&(0<e.hours?t.setHours(Math.min(Math.round(t.getHours()/e.hours)*e.hours,24)):12<=t.getHours()?t.setHours(24):t.setHours(0)),s&&(1<t.getDay()&&(a=u.daysInMonth(t),0<e.days?t.setDay(Math.min(Math.round((t.getDay()-1)/e.days)*e.days,a)+1):t.getDay()>=Math.floor(a/2+1)?t.setDay(a+1):t.setDay(1)),n&&(1<t.getMonth()&&(0<e.months?t.setMonth(Math.min(Math.round((t.getMonth()-1)/e.months)*e.months,12)+1):7<=t.getMonth()?t.setMonth(13):t.setMonth(1)),i&&0<e.years&&t.setYear(Math.round(t.getYear()/e.years)*e.years))))))},h=function(t,e,i){var n=0<e.years,s=n||0<e.months,r=s||0<e.days,a=r||0<e.hours,o=a||0<e.minutes,h=o||0<e.seconds,i=u.daysInMonth(i);h&&(0<t.seconds&&(0<e.seconds?t.seconds=Math.min(Math.round(t.seconds/e.seconds)*e.seconds,60):30<=t.seconds?t.seconds=60:t.seconds=0,m(t,i)),o&&(0<t.minutes&&(0<e.minutes?t.minutes=Math.min(Math.round(t.minutes/e.minutes)*e.minutes,60):30<=t.minutes?t.minutes=60:t.minutes=0,m(t,i)),a&&(0<t.hours&&(0<e.hours?t.hours=Math.min(Math.round(t.hours/e.hours)*e.hours,24):12<=t.hours?t.hours=24:t.hours=0,m(t,i)),r&&(0<t.days&&(0<e.days?t.days=Math.min(Math.round(t.days/e.days)*e.days,i):t.days>=Math.floor(i/2)?t.days=i:t.days=0,m(t,i)),s&&(0<t.months&&(0<e.months?t.months=Math.min(Math.round(t.months/e.months)*e.months,12):6<=t.months?t.months=12:t.months=0,m(t,i)),n&&0<e.years&&(t.years=Math.round(t.years/e.years)*e.years,m(t,i)))))))},l=function(t,e){var i=t.toTimeZone(e);if(i.getYear()==t.getYear()&&i.getMonth()==t.getMonth()&&i.getDay()==t.getDay()&&i.getHours()==t.getHours()&&i.getMinutes()==t.getMinutes()&&i.getSeconds()==t.getSeconds())return i;var n=t.clone();return n.setTimeZone(e),n.getYear()==t.getYear()&&n.getMonth()==t.getMonth()&&n.getDay()==t.getDay()&&n.getHours()==t.getHours()&&n.getMinutes()==t.getMinutes()&&n.getSeconds()==t.getSeconds()?n:i},m=function(t,e){var i=t.years,n=Math.floor(i),i=t.months+12*(i-n),s=Math.floor(i),i=t.days+(i-s)*e,r=Math.floor(i),i=t.hours+24*(i-r),a=Math.floor(i),i=t.minutes+60*(i-a),o=Math.floor(i),i=t.seconds+60*(i-o),h=Math.floor(i),i=c(i-h);1<=i&&(i=0,h++),o+=Math.floor(h/60),h%=60,a+=Math.floor(o/60),o%=60,r+=Math.floor(a/24),a%=24,s+=Math.floor(r/e),r%=e,n+=Math.floor(s/12),s%=12,t.years=n,t.months=s,t.days=r,t.hours=a,t.minutes=o,t.seconds=h+i},c=function(t){return Number(t.toFixed(6))}})})},{"./jg_global":5}],7:[function(t,e,i){var s,k,S,r,a,N;t=t("./jg_global"),s=t.jg_namespace,k=t.jg_import,S=t.jg_extend,r=t.jg_static,a=t.jg_mixin,t.jg_has_mixin,N=t.jg_delegate,e.exports=t,s("jgatt.geom",function(){this.Point=S(Object,function(t,e){this.x=0,this.y=0,this.constructor=function(t,e){this.x=void 0!==t?t:0,this.y=void 0!==e?e:0},this.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},this.hasNaN=function(){return isNaN(this.x)||isNaN(this.y)},this.hasInfinity=function(){return this.x==1/0||this.x==-1/0||this.y==1/0||this.y==-1/0},this.hasPositiveInfinity=function(){return this.x==1/0||this.y==1/0},this.hasNegativeInfinity=function(){return this.x==-1/0||this.y==-1/0},this.isFinite=function(){return this.x-this.x==0&&this.y-this.y==0},this.clone=function(){return new t(this.x,this.y)},this.equals=function(t){return this.x===t.x&&this.y===t.y},this.toString=function(){return"(x="+this.x+", y="+this.y+")"}})}),s("jgatt.geom",function(){var i=k("jgatt.geom.Point");this.Matrix=S(Object,function(t,e){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this.constructor=function(t,e,i,n,s,r){this.a=void 0!==t?t:1,this.b=void 0!==e?e:0,this.c=void 0!==i?i:0,this.d=void 0!==n?n:1,this.tx=void 0!==s?s:0,this.ty=void 0!==r?r:0},this.transformPoint=function(t){var e=this.a*t.x+this.c*t.y+this.tx,t=this.b*t.x+this.d*t.y+this.ty;return new i(e,t)},this.translate=function(t,e){this.tx+=t,this.ty+=e},this.scale=function(t,e){this.a*=t,this.b*=e,this.c*=t,this.d*=e,this.tx*=t,this.ty*=e},this.rotate=function(t){var e=Math.cos(t),t=Math.sin(t),i=this.a,n=this.b,s=this.c,r=this.d,a=this.tx,o=this.ty;this.a=i*e-n*t,this.b=n*e+i*t,this.c=s*e-r*t,this.d=r*e+s*t,this.tx=a*e-o*t,this.ty=o*e+a*t},this.concat=function(t){var e=t.a,i=t.b,n=t.c,s=t.d,r=t.tx,t=t.ty,a=this.a,o=this.b,h=this.c,u=this.d,l=this.tx,m=this.ty;this.a=e*a+n*o,this.b=i*a+s*o,this.c=e*h+n*u,this.d=i*h+s*u,this.tx=e*l+n*m+r,this.ty=i*l+s*m+t},this.invert=function(){var t=this.determinant(),e=this.a/t,i=this.b/t,n=this.c/t,t=this.d/t,s=this.tx,r=this.ty;this.a=t,this.b=-i,this.c=-n,this.d=e,this.tx=n*r-t*s,this.ty=i*s-e*r},this.identity=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},this.determinant=function(){return this.a*this.d-this.b*this.c},this.hasInverse=function(){var t=Math.abs(this.determinant());return 0<t&&t<1/0},this.hasNaN=function(){return isNaN(this.a)||isNaN(this.b)||isNaN(this.c)||isNaN(this.d)||isNaN(this.tx)||isNaN(this.ty)},this.hasInfinity=function(){return this.a==1/0||this.a==-1/0||this.b==1/0||this.b==-1/0||this.c==1/0||this.c==-1/0||this.d==1/0||this.d==-1/0||this.tx==1/0||this.tx==-1/0||this.ty==1/0||this.ty==-1/0},this.hasPositiveInfinity=function(){return this.a==1/0||this.b==1/0||this.c==1/0||this.d==1/0||this.tx==1/0||this.ty==1/0},this.hasNegativeInfinity=function(){return this.a==-1/0||this.b==-1/0||this.c==-1/0||this.d==-1/0||this.tx==-1/0||this.ty==-1/0},this.isFinite=function(){return this.a-this.a==0&&this.b-this.b==0&&this.c-this.c==0&&this.d-this.d==0&&this.tx-this.tx==0&&this.ty-this.ty==0},this.isIdentity=function(){return 1==this.a&&0==this.b&&0==this.c&&1==this.d&&0==this.tx&&0==this.ty},this.clone=function(){return new t(this.a,this.b,this.c,this.d,this.tx,this.ty)},this.equals=function(t){return this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.tx===t.tx&&this.ty===t.ty},this.toString=function(){return"(a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"}})}),s("jgatt.geom",function(){this.Rectangle=S(Object,function(t,e){this.x=0,this.y=0,this.width=0,this.height=0,this.constructor=function(t,e,i,n){this.x=void 0!==t?t:0,this.y=void 0!==e?e:0,this.width=void 0!==i?i:0,this.height=void 0!==n?n:0},this.hasNaN=function(){return isNaN(this.x)||isNaN(this.y)||isNaN(this.width)||isNaN(this.height)},this.hasInfinity=function(){return this.x==1/0||this.x==-1/0||this.y==1/0||this.y==-1/0||this.width==1/0||this.width==-1/0||this.height==1/0||this.height==-1/0},this.hasPositiveInfinity=function(){return this.x==1/0||this.y==1/0||this.width==1/0||this.height==1/0},this.hasNegativeInfinity=function(){return this.x==-1/0||this.y==-1/0||this.width==-1/0||this.height==-1/0},this.isFinite=function(){return this.x-this.x==0&&this.y-this.y==0&&this.width-this.width==0&&this.height-this.height==0},this.clone=function(){return new t(this.x,this.y,this.width,this.height)},this.equals=function(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height},this.toString=function(){return"(x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}})}),s("jgatt.graphics",function(){this.ColorUtils=r(function(n){n.toRGB=function(t){var e={};return e.r=t>>16&255,e.g=t>>8&255,e.b=255&t,e},n.fromRGB=function(t){return t.r<<16|t.g<<8|t.b},n.brightness=function(t,e){var t=n.toRGB(t),i=e<0?(e=-e,0):255;return 1<e&&(e=1),t.r+=Math.round((i-t.r)*e),t.g+=Math.round((i-t.g)*e),t.b+=Math.round((i-t.b)*e),n.fromRGB(t)}})}),s("jgatt.graphics",function(){var l=k("jgatt.geom.Matrix");k("jgatt.geom.Point");this.Graphics=S(Object,function(t,e){this._width=1,this._height=1,this._strokeStyle=null,this._strokeCommands=null,this._fillCommands=null,this._drawingStack=null,this._drawingStackIndex=0,this._penX=0,this._penY=0,this._element=null,this._canvas=null,this._context=null,this.constructor=function(t,e){this._width=1<t&&t<1/0?Math.floor(t):1,this._height=1<e&&e<1/0?Math.floor(e):1,this._strokeStyle={thickness:1,caps:"none",joints:"miter",miterLimit:10,pixelHinting:!0},this._drawingStack=[]},this.appendTo=function(t){if(!t)throw new Error("Parameter element must be non-null.");if(t===this._element)return!0;this.remove();var e=document.createElement("canvas");if(!e)return!1;if("function"!=typeof e.getContext)return!1;var i=e.getContext("2d");return!!i&&(e.style.position="absolute",e.width=this._width,e.height=this._height,t.appendChild(e),this._element=t,this._canvas=e,this._context=i,this._draw(!0),!0)},this.remove=function(){if(!this._element)return!1;var t=this._context,t=(t.clearRect(0,0,t.canvas.width,t.canvas.height),t.beginPath(),this._canvas),e=t.parentNode;return e&&e.removeChild(t),this._element=null,this._canvas=null,!(this._context=null)},this.setSize=function(t,e){var i;t=1<t&&t<1/0?Math.floor(t):1,e=1<e&&e<1/0?Math.floor(e):1,t===this._width&&e===this._height||(this._width=t,this._height=e,(i=this._canvas)&&(i.width=t,i.height=e,this._draw(!0)))},this.setStrokeStyle=function(t,e,i,n,s){if(null!=e&&"none"!==e&&"round"!==e&&"square"!==e)throw new Error('Parameter caps must be one of "none", "round", or "square".');if(null!=i&&"miter"!==i&&"round"!==i&&"bevel"!==i)throw new Error('Parameter joints must be one of "miter", "round", or "bevel".');this._strokeStyle={thickness:t=0<(t*=1)&&t<1/0?t:1,caps:e=e||"none",joints:i=i||"miter",miterLimit:n=0<(n*=1)&&n<1/0?n:10,pixelHinting:s=0!=s}},this.beginSolidStroke=function(t,e){this.endStroke(),t=isNaN(t)?0:Math.min(Math.max(Math.floor(t),0),16777215),e=isNaN(e)?1:Math.min(Math.max(e,0),1);var i=this._strokeCommands=[];i.push({name:"solidStroke",strokeStyle:this._strokeStyle,color:t,alpha:e}),i.push({name:"moveTo",x:this._penX,y:this._penY})},this.beginGradientStroke=function(t,e,i,n,s,r){if(null==t)throw new Error("Parameter type must be non-null.");if("linear"!==t&&"radial"!==t)throw new Error('Parameter type must be one of "linear" or "radial".');if(null==e)throw new Error("Parameter colors must be non-null.");if(!(e instanceof Array))throw new Error("Parameter colors must be an array.");if(null==i)throw new Error("Parameter alphas must be non-null.");if(!(i instanceof Array))throw new Error("Parameter alphas must be an array.");if(null==n)throw new Error("Parameter ratios must be non-null.");if(!(n instanceof Array))throw new Error("Parameter ratios must be an array.");if(null!=s&&!(s instanceof l))throw new Error("Parameter matrix must be an instance of jgatt.geom.Matrix.");this.endStroke();var a,o=Math.min(e.length,i.length,n.length);e=e.slice(0,o),i=i.slice(0,o),n=n.slice(0,o);for(var h=0;h<o;h++)a=e[h],e[h]=isNaN(a)?0:Math.min(Math.max(Math.floor(a),0),16777215),a=i[h],i[h]=isNaN(a)?1:Math.min(Math.max(a,0),1),a=n[h],n[h]=isNaN(a)?0:Math.min(Math.max(a,0),1);s&&((s=new l(+s.a,+s.b,+s.c,+s.d,+s.tx,+s.ty)).tx-s.tx!=0&&(s.tx=0),s.ty-s.ty!=0&&(s.ty=0),s.hasInverse()||(s=null)),r=isNaN(r)?0:Math.min(Math.max(r,-1),1);var u=this._strokeCommands=[];u.push({name:"gradientStroke",strokeStyle:this._strokeStyle,type:t,colors:e,alphas:i,ratios:n,matrix:s,focalPointRatio:r}),u.push({name:"moveTo",x:this._penX,y:this._penY})},this.beginImageStroke=function(t,e,i){},this.endStroke=function(){this._strokeCommands&&(this._drawingStack.push(this._strokeCommands),this._strokeCommands=null,this._draw())},this.beginSolidFill=function(t,e){this.endFill(),t=isNaN(t)?0:Math.min(Math.max(Math.floor(t),0),16777215),e=isNaN(e)?1:Math.min(Math.max(e,0),1);var i=this._fillCommands=[];i.push({name:"solidFill",color:t,alpha:e}),i.push({name:"moveTo",x:this._penX,y:this._penY})},this.beginGradientFill=function(t,e,i,n,s,r){if(null==t)throw new Error("Parameter type must be non-null.");if("linear"!==t&&"radial"!==t)throw new Error('Parameter type must be one of "linear" or "radial".');if(null==e)throw new Error("Parameter colors must be non-null.");if(!(e instanceof Array))throw new Error("Parameter colors must be an array.");if(null==i)throw new Error("Parameter alphas must be non-null.");if(!(i instanceof Array))throw new Error("Parameter alphas must be an array.");if(null==n)throw new Error("Parameter ratios must be non-null.");if(!(n instanceof Array))throw new Error("Parameter ratios must be an array.");if(null!=s&&!(s instanceof l))throw new Error("Parameter matrix must be an instance of jgatt.geom.Matrix.");this.endFill();var a,o=Math.min(e.length,i.length,n.length);e=e.slice(0,o),i=i.slice(0,o),n=n.slice(0,o);for(var h=0;h<o;h++)a=e[h],e[h]=isNaN(a)?0:Math.min(Math.max(Math.floor(a),0),16777215),a=i[h],i[h]=isNaN(a)?1:Math.min(Math.max(a,0),1),a=n[h],n[h]=isNaN(a)?0:Math.min(Math.max(a,0),1);s&&((s=new l(+s.a,+s.b,+s.c,+s.d,+s.tx,+s.ty)).tx-s.tx!=0&&(s.tx=0),s.ty-s.ty!=0&&(s.ty=0),s.hasInverse()||(s=null)),r=isNaN(r)?0:Math.min(Math.max(r,-1),1);var u=this._fillCommands=[];u.push({name:"gradientFill",type:t,colors:e,alphas:i,ratios:n,matrix:s,focalPointRatio:r}),u.push({name:"moveTo",x:this._penX,y:this._penY})},this.beginImageFill=function(t,e,i){},this.endFill=function(){this._fillCommands&&(this._drawingStack.push(this._fillCommands),this._fillCommands=null,this._draw())},this.moveTo=function(t,e){(e*=1)-e!=0&&(e=0);t={name:"moveTo",x:this._penX=t=(t*=1)-t!=0?0:t,y:this._penY=e};this._strokeCommands&&this._strokeCommands.push(t),this._fillCommands&&this._fillCommands.push(t)},this.lineTo=function(t,e){(e*=1)-e!=0&&(e=0);t={name:"lineTo",x:this._penX=t=(t*=1)-t!=0?0:t,y:this._penY=e};this._strokeCommands&&this._strokeCommands.push(t),this._fillCommands&&this._fillCommands.push(t)},this.curveTo=function(t,e,i,n){(n*=1)-n!=0&&(n=0);t={name:"curveTo",controlX:t=(t*=1)-t!=0?0:t,controlY:e=(e*=1)-e!=0?0:e,anchorX:this._penX=i=(i*=1)-i!=0?0:i,anchorY:this._penY=n};this._strokeCommands&&this._strokeCommands.push(t),this._fillCommands&&this._fillCommands.push(t)},this.clear=function(){this._strokeCommands=null,this._fillCommands=null,this._drawingStack=[],this._draw(!0)},this._draw=function(t){var e=this._context;if(e){1==t&&(this._drawingStackIndex=0,e.clearRect(0,0,e.canvas.width,e.canvas.height),e.beginPath());for(var i,n=this._drawingStack,s=n.length,r=this._drawingStackIndex;r<s;r++)switch((i=n[r])[0].name){case"solidStroke":case"gradientStroke":this._drawStroke(i);break;case"solidFill":case"gradientFill":this._drawFill(i)}this._drawingStackIndex=r}},this._drawStroke=function(t){var e=this._context;if(e){var i,n,s,r,a,o,h,u,l,m,c,g,f,d=t.length,_=t[0],p=_.strokeStyle,v=p.pixelHinting?p.thickness%2/2:0,b=!1;for(e.beginPath(),f=1;f<d;f++)"moveTo"===(_=t[f]).name?(b&&i===s&&n===r&&e.closePath(),b=!1,i=_.x,n=_.y,e.moveTo(i+v,n+v)):"lineTo"===_.name?(b=!0,s=_.x,r=_.y,e.lineTo(s+v,r+v)):"curveTo"===_.name&&(b=!0,s=_.anchorX,r=_.anchorY,e.quadraticCurveTo(_.controlX+v,_.controlY+v,s+v,r+v));if(b&&i===s&&n===r&&e.closePath(),e.save(),e.lineWidth=p.thickness,e.lineCap="none"===p.caps?"butt":p.caps,e.lineJoin=p.joints,e.miterLimit=p.miterLimit,"solidStroke"===(_=t[0]).name)m=_.color,c=_.alpha,e.strokeStyle="rgba("+(m>>16&255)+", "+(m>>8&255)+", "+(255&m)+", "+c+")";else if("gradientStroke"===_.name){for(a="radial"===_.type?e.createRadialGradient(.5+.49*_.focalPointRatio,.5,0,.5,.5,.5):e.createLinearGradient(0,0,1,0),h=_.colors,u=_.alphas,l=_.ratios,o=h.length,f=0;f<o;f++)m=h[f],c=u[f],g=l[f],a.addColorStop(g,"rgba("+(m>>16&255)+", "+(m>>8&255)+", "+(255&m)+", "+c+")");(p=_.matrix)&&e.setTransform(p.a,p.b,p.c,p.d,p.tx,p.ty),e.strokeStyle=a}e.stroke(),e.restore(),e.beginPath()}},this._drawFill=function(t){var e=this._context;if(e){var i,n,s,r,a,o,h,u,l,m,c,g=t.length;for(e.beginPath(),c=1;c<g;c++)"moveTo"===(i=t[c]).name?e.moveTo(i.x,i.y):"lineTo"===i.name?e.lineTo(i.x,i.y):"curveTo"===i.name&&e.quadraticCurveTo(i.controlX,i.controlY,i.anchorX,i.anchorY);if(e.save(),"solidFill"===(i=t[0]).name)h=i.color,u=i.alpha,e.fillStyle="rgba("+(h>>16&255)+", "+(h>>8&255)+", "+(255&h)+", "+u+")";else if("gradientFill"===i.name){for(n="radial"===i.type?e.createRadialGradient(.5+.49*i.focalPointRatio,.5,0,.5,.5,.5):e.createLinearGradient(0,0,1,0),r=i.colors,a=i.alphas,o=i.ratios,s=r.length,c=0;c<s;c++)h=r[c],u=a[c],l=o[c],n.addColorStop(l,"rgba("+(h>>16&255)+", "+(h>>8&255)+", "+(255&h)+", "+u+")");(m=i.matrix)&&e.setTransform(m.a,m.b,m.c,m.d,m.tx,m.ty),e.fillStyle=n}e.fill(),e.restore(),e.beginPath()}}})}),s("jgatt.graphics",function(){this.IBrush=S(Object,function(t,e){this.beginBrush=function(t,e,i){},this.endBrush=function(){},this.moveTo=function(t,e){},this.lineTo=function(t,e){},this.curveTo=function(t,e,i,n){}})}),s("jgatt.graphics",function(){var o=k("jgatt.geom.Matrix"),h=k("jgatt.geom.Point"),u=k("jgatt.graphics.Graphics"),t=k("jgatt.graphics.IBrush");this.AbstractBrush=S(t,function(t,e){this._commands=null,this._graphics=null,this._matrix=null,this._bounds=null,this.beginBrush=function(t,e,i){if(!t)throw new Error("Parameter graphics must be non-null.");if(!(t instanceof u))throw new Error("Parameter graphics must be an instance of jgatt.graphics.Graphics.");if(null!=e&&!(e instanceof o))throw new Error("Parameter matrix must be an instance of jgatt.geom.Matrix.");if(null!=i&&!(i instanceof Array))throw new Error("Parameter bounds must be an array.");if(this.endBrush(),this._commands=[],this._graphics=t,this._matrix=e?e.clone():null,i)for(var n,s=this._bounds=[],r=i.length,a=0;a<r;a++)(n=i[a])instanceof h&&s.push(n.clone())},this.endBrush=function(){this._graphics&&(this.draw(this._commands,this._graphics,this._matrix,this._bounds),this._commands=null,this._graphics=null,this._matrix=null,this._bounds=null)},this.moveTo=function(t,e){this._graphics&&this._commands.push({name:"moveTo",x:t,y:e})},this.lineTo=function(t,e){this._graphics&&this._commands.push({name:"lineTo",x:t,y:e})},this.curveTo=function(t,e,i,n){this._graphics&&this._commands.push({name:"curveTo",controlX:t,controlY:e,anchorX:i,anchorY:n})},this.draw=function(t,e,i,n){}})}),s("jgatt.graphics",function(){var D=k("jgatt.geom.Matrix"),L=k("jgatt.geom.Point"),t=k("jgatt.graphics.AbstractBrush");this.AbstractTileBrush=S(t,function(t,a){this._stretchMode="fill",this._alignmentX=.5,this._alignmentY=.5,this._tileTransform=null,this._renderTransform=null,this._fitToDrawing=!1,this.constructor=function(t,e,i,n,s,r){switch(a.constructor.call(this),t){case"none":case"fill":case"uniform":case"uniformToFill":case"uniformToWidth":case"uniformToHeight":t+="";break;default:t="fill"}this._stretchMode=t,this._alignmentX=null==e||isNaN(e)?.5:+e,this._alignmentY=null==i||isNaN(i)?.5:+i,this._tileTransform=n instanceof D?n.clone():null,this._renderTransform=s instanceof D?s.clone():null,this._fitToDrawing=1==r},this.getStretchMode=function(){return this._stretchMode},this.setStretchMode=function(t){switch(t){case"none":case"fill":case"uniform":case"uniformToFill":case"uniformToWidth":case"uniformToHeight":t+="";break;default:t="fill"}this._stretchMode=t},this.getAlignmentX=function(){return this._alignmentX},this.setAlignmentX=function(t){this._alignmentX=null==t||isNaN(t)?this._alignmentX:+t},this.getAlignmentY=function(){return this._alignmentY},this.setAlignmentY=function(t){this._alignmentY=null==t||isNaN(t)?this._alignmentY:+t},this.getTileTransform=function(){return this._tileTransform?this._tileTransform.clone():null},this.setTileTransform=function(t){this._tileTransform=t instanceof D?t.clone():null},this.getRenderTransform=function(){return this._renderTransform?this._renderTransform.clone():null},this.setRenderTransform=function(t){this._renderTransform=t instanceof D?t.clone():null},this.getFitToDrawing=function(){return this._fitToDrawing},this.setFitToDrawing=function(t){this._fitToDrawing=1==t},this.computeTileMatrix=function(t,e,i,n,s){var r,a,o,h,u,l,m,c,g=this._tileTransform,f=(g?(r=g.clone(),g=new L(0,0),a=new L(t,0),o=new L(t,e),h=new L(0,e),g=r.transformPoint(g),a=r.transformPoint(a),o=r.transformPoint(o),h=r.transformPoint(h),u=Math.min(g.x,a.x,o.x,h.x),S=Math.max(g.x,a.x,o.x,h.x),l=Math.min(g.y,a.y,o.y,h.y),t=S-u,e=Math.max(g.y,a.y,o.y,h.y)-l,r.translate(-u,-l)):r=new D,i&&i.hasInverse()&&(m=i.clone()).invert(),1/0),d=1/0,_=-1/0,p=-1/0;if(n&&!this._fitToDrawing)for(var v=n.length,b=0;b<v;b++)c=n[b],m&&(c=m.transformPoint(c)),f=Math.min(c.x,f),d=Math.min(c.y,d),_=Math.max(c.x,_),p=Math.max(c.y,p);else{var w,y=s.length;for(b=0;b<y;b++){if("moveTo"==(w=s[b]).name)c=new L(w.x,w.y);else if("lineTo"==w.name)c=new L(w.x,w.y);else{if("curveTo"!=w.name)continue;c=new L(w.anchorX,w.anchorY)}m&&(c=m.transformPoint(c)),f=Math.min(c.x,f),d=Math.min(c.y,d),_=Math.max(c.x,_),p=Math.max(c.y,p)}}f==1/0&&(f=d=_=p=0);var M,x,T,C,N=_-f,k=p-d;switch(this._stretchMode){case"none":T=(N-t)*this._alignmentX,C=(k-e)*this._alignmentY,r.translate(T,C);break;case"uniform":M=0<t?N/t:1,x=0<e?k/e:1,T=(N-t*(M=x=Math.min(M,x)))*this._alignmentX,C=(k-e*x)*this._alignmentY,r.scale(M,x),r.translate(T,C);break;case"uniformToFill":M=0<t?N/t:1,x=0<e?k/e:1,T=(N-t*(M=x=Math.max(M,x)))*this._alignmentX,C=(k-e*x)*this._alignmentY,r.scale(M,x),r.translate(T,C);break;case"uniformToWidth":T=(N-t*(M=x=0<t?N/t:1))*this._alignmentX,C=(k-e*x)*this._alignmentY,r.scale(M,x),r.translate(T,C);break;case"uniformToHeight":T=(N-t*(M=x=0<e?k/e:1))*this._alignmentX,C=(k-e*x)*this._alignmentY,r.scale(M,x),r.translate(T,C);break;default:r.scale(M=0<t?N/t:1,x=0<e?k/e:1)}var S=this._renderTransform;return S&&r.concat(S),r.translate(f,d),i&&r.concat(i),r}}