diff --git a/dist/vis-graph3d.min.js b/dist/vis-graph3d.min.js index 8ad18422..8c9bec8b 100644 --- a/dist/vis-graph3d.min.js +++ b/dist/vis-graph3d.min.js @@ -4,8 +4,8 @@ * * A dynamic, browser-based visualization library. * - * @version 4.20.1 - * @date 2017-07-02 + * @version 4.21.0 + * @date 2017-10-12 * * @license * Copyright (C) 2011-2017 Almende B.V, http://almende.com @@ -22,13 +22,9 @@ * * Vis.js may be distributed under either license. */ -"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vis=e():t.vis=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){e.util=n(1),e.DOMutil=n(87),e.DataSet=n(88),e.DataView=n(92),e.Queue=n(91),e.Graph3d=n(93),e.graph3d={Camera:n(101),Filter:n(106),Point2d:n(100),Point3d:n(99),Slider:n(107),StepNumber:n(108)},e.moment=n(82),e.Hammer=n(112),e.keycharm=n(115)},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}var r=n(2),o=i(r),s=n(55),a=i(s),h=n(58),u=i(h),l=n(62),c=i(l),f=n(82),d=n(86);e.isNumber=function(t){return t instanceof Number||"number"==typeof t},e.recursiveDOMDelete=function(t){if(t)for(;t.hasChildNodes()===!0;)e.recursiveDOMDelete(t.firstChild),t.removeChild(t.firstChild)},e.giveRange=function(t,e,n,i){if(e==t)return.5;var r=1/(e-t);return Math.max(0,(i-t)*r)},e.isString=function(t){return t instanceof String||"string"==typeof t},e.isDate=function(t){if(t instanceof Date)return!0;if(e.isString(t)){var n=p.exec(t);if(n)return!0;if(!isNaN(Date.parse(t)))return!0}return!1},e.randomUUID=function(){return d.v4()},e.assignAllKeys=function(t,e){for(var n in t)t.hasOwnProperty(n)&&"object"!==(0,c.default)(t[n])&&(t[n]=e)},e.fillIfDefined=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var r in t)void 0!==n[r]&&("object"!==(0,c.default)(n[r])?void 0!==n[r]&&null!==n[r]||void 0===t[r]||i!==!0?t[r]=n[r]:delete t[r]:"object"===(0,c.default)(t[r])&&e.fillIfDefined(t[r],n[r],i))},e.protoExtend=function(t,e){for(var n=1;n3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(i))throw new TypeError("Arrays are not supported by deepExtend");for(var o=2;o3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(i))throw new TypeError("Arrays are not supported by deepExtend");for(var o in i)if(i.hasOwnProperty(o)&&t.indexOf(o)==-1)if(i[o]&&i[o].constructor===Object)void 0===n[o]&&(n[o]={}),n[o].constructor===Object?e.deepExtend(n[o],i[o]):null===i[o]&&void 0!==n[o]&&r===!0?delete n[o]:n[o]=i[o];else if(Array.isArray(i[o])){n[o]=[];for(var s=0;s=0&&(e="DOMMouseScroll"),t.addEventListener(e,n,i)):t.attachEvent("on"+e,n)},e.removeEventListener=function(t,e,n,i){t.removeEventListener?(void 0===i&&(i=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,n,i)):t.detachEvent("on"+e,n)},e.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},e.hasParent=function(t,e){for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1},e.option={},e.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},e.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},e.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},e.option.asSize=function(t,n){return"function"==typeof t&&(t=t()),e.isString(t)?t:e.isNumber(t)?t+"px":n||null},e.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},e.hexToRGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,n,i){return e+e+n+n+i+i});var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null},e.overrideOpacity=function(t,n){if(t.indexOf("rgba")!=-1)return t;if(t.indexOf("rgb")!=-1){var i=t.substr(t.indexOf("(")+1).replace(")","").split(",");return"rgba("+i[0]+","+i[1]+","+i[2]+","+n+")"}var i=e.hexToRGB(t);return null==i?t:"rgba("+i.r+","+i.g+","+i.b+","+n+")"},e.RGBToHex=function(t,e,n){return"#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},e.parseColor=function(t){var n;if(e.isString(t)===!0){if(e.isValidRGB(t)===!0){var i=t.substr(4).substr(0,t.length-5).split(",").map(function(t){return parseInt(t)});t=e.RGBToHex(i[0],i[1],i[2])}if(e.isValidHex(t)===!0){var r=e.hexToHSV(t),o={h:r.h,s:.8*r.s,v:Math.min(1,1.02*r.v)},s={h:r.h,s:Math.min(1,1.25*r.s),v:.8*r.v},a=e.HSVToHex(s.h,s.s,s.v),h=e.HSVToHex(o.h,o.s,o.v);n={background:t,border:a,highlight:{background:h,border:a},hover:{background:h,border:a}}}else n={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else n={},n.background=t.background||void 0,n.border=t.border||void 0,e.isString(t.highlight)?n.highlight={border:t.highlight,background:t.highlight}:(n.highlight={},n.highlight.background=t.highlight&&t.highlight.background||void 0,n.highlight.border=t.highlight&&t.highlight.border||void 0),e.isString(t.hover)?n.hover={border:t.hover,background:t.hover}:(n.hover={},n.hover.background=t.hover&&t.hover.background||void 0,n.hover.border=t.hover&&t.hover.border||void 0);return n},e.RGBToHSV=function(t,e,n){t/=255,e/=255,n/=255;var i=Math.min(t,Math.min(e,n)),r=Math.max(t,Math.max(e,n));if(i==r)return{h:0,s:0,v:i};var o=t==i?e-n:n==i?t-e:n-t,s=t==i?3:n==i?1:5,a=60*(s-o/(r-i))/360,h=(r-i)/r,u=r;return{h:a,s:h,v:u}};var m={split:function(t){var e={};return t.split(";").forEach(function(t){if(""!=t.trim()){var n=t.split(":"),i=n[0].trim(),r=n[1].trim();e[i]=r}}),e},join:function(t){return(0,u.default)(t).map(function(e){return e+": "+t[e]}).join("; ")}};e.addCssText=function(t,n){var i=m.split(t.style.cssText),r=m.split(n),o=e.extend(i,r);t.style.cssText=m.join(o)},e.removeCssText=function(t,e){var n=m.split(t.style.cssText),i=m.split(e);for(var r in i)i.hasOwnProperty(r)&&delete n[r];t.style.cssText=m.join(n)},e.HSVToRGB=function(t,e,n){var i,r,o,s=Math.floor(6*t),a=6*t-s,h=n*(1-e),u=n*(1-a*e),l=n*(1-(1-a)*e);switch(s%6){case 0:i=n,r=l,o=h;break;case 1:i=u,r=n,o=h;break;case 2:i=h,r=n,o=l;break;case 3:i=h,r=u,o=n;break;case 4:i=l,r=h,o=n;break;case 5:i=n,r=h,o=u}return{r:Math.floor(255*i),g:Math.floor(255*r),b:Math.floor(255*o)}},e.HSVToHex=function(t,n,i){var r=e.HSVToRGB(t,n,i);return e.RGBToHex(r.r,r.g,r.b)},e.hexToHSV=function(t){var n=e.hexToRGB(t);return e.RGBToHSV(n.r,n.g,n.b)},e.isValidHex=function(t){var e=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);return e},e.isValidRGB=function(t){t=t.replace(" ","");var e=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t);return e},e.isValidRGBA=function(t){t=t.replace(" ","");var e=/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(t);return e},e.selectiveBridgeObject=function(t,n){if("object"==("undefined"==typeof n?"undefined":(0,c.default)(n))){for(var i=(0,a.default)(n),r=0;r0&&e(i,t[r-1])<0;r--)t[r]=t[r-1];t[r]=i}return t},e.mergeOptions=function(t,e,n){var i=(arguments.length>3&&void 0!==arguments[3]&&arguments[3],arguments.length>4&&void 0!==arguments[4]?arguments[4]:{});if(null===e[n])t[n]=(0,a.default)(i[n]);else if(void 0!==e[n])if("boolean"==typeof e[n])t[n].enabled=e[n];else{void 0===e[n].enabled&&(t[n].enabled=!0);for(var r in e[n])e[n].hasOwnProperty(r)&&(t[n][r]=e[n][r])}},e.binarySearchCustom=function(t,e,n,i){for(var r=1e4,o=0,s=0,a=t.length-1;s<=a&&o0)return"before"==i?Math.max(0,h-1):h;if(r(s,e)<0&&r(a,e)>0)return"before"==i?h:Math.min(t.length-1,h+1);r(s,e)<0?c=h+1:f=h-1,l++}return-1},e.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},e.getScrollBarWidth=function(){var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var n=t.offsetWidth;e.style.overflow="scroll";var i=t.offsetWidth;return n==i&&(i=e.clientWidth),document.body.removeChild(e),n-i},e.topMost=function(t,e){var n=void 0;Array.isArray(e)||(e=[e]);var i=!0,r=!1,s=void 0;try{for(var a,h=(0,o.default)(t);!(i=(a=h.next()).done);i=!0){var u=a.value;if(u){n=u[e[0]];for(var l=1;l=t.length?(this._t=void 0,r(1)):"keys"==e?r(0,n):"values"==e?r(0,t[n]):r(0,[n,t[n]])},"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports={}},function(t,e,n){var i=n(10),r=n(12);t.exports=function(t){return i(r(t))}},function(t,e,n){var i=n(11);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){var i=n(14),r=n(15),o=n(30),s=n(20),a=n(31),h=n(8),u=n(32),l=n(46),c=n(48),f=n(47)("iterator"),d=!([].keys&&"next"in[].keys()),p="@@iterator",m="keys",v="values",y=function(){return this};t.exports=function(t,e,n,g,_,w,x){u(n,e,g);var b,S,T,D=function(t){if(!d&&t in E)return E[t];switch(t){case m:return function(){return new n(this,t)};case v:return function(){return new n(this,t)}}return function(){return new n(this,t)}},M=e+" Iterator",k=_==v,O=!1,E=t.prototype,C=E[f]||E[p]||_&&E[_],P=C||D(_),L=_?k?D("entries"):P:void 0,Y="Array"==e?E.entries||C:C;if(Y&&(T=c(Y.call(new t)),T!==Object.prototype&&(l(T,M,!0),i||a(T,f)||s(T,f,y))),k&&C&&C.name!==v&&(O=!0,P=function(){return C.call(this)}),i&&!x||!d&&!O&&E[f]||s(E,f,P),h[e]=P,h[M]=y,_)if(b={values:k?P:D(v),keys:w?P:D(m),entries:L},x)for(S in b)S in E||o(E,S,b[S]);else r(r.P+r.F*(d||O),e,b);return b}},function(t,e){t.exports=!0},function(t,e,n){var i=n(16),r=n(17),o=n(18),s=n(20),a="prototype",h=function(t,e,n){var u,l,c,f=t&h.F,d=t&h.G,p=t&h.S,m=t&h.P,v=t&h.B,y=t&h.W,g=d?r:r[e]||(r[e]={}),_=g[a],w=d?i:p?i[e]:(i[e]||{})[a];d&&(n=e);for(u in n)l=!f&&w&&void 0!==w[u],l&&u in g||(c=l?w[u]:n[u],g[u]=d&&"function"!=typeof w[u]?n[u]:v&&l?o(c,i):y&&w[u]==c?function(t){var e=function(e,n,i){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,i)}return t.apply(this,arguments)};return e[a]=t[a],e}(c):m&&"function"==typeof c?o(Function.call,c):c,m&&((g.virtual||(g.virtual={}))[u]=c,t&h.R&&_&&!_[u]&&s(_,u,c)))};h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,t.exports=h},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){var i=n(19);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var i=n(21),r=n(29);t.exports=n(25)?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e,n){var i=n(22),r=n(24),o=n(28),s=Object.defineProperty;e.f=n(25)?Object.defineProperty:function(t,e,n){if(i(t),e=o(e,!0),i(n),r)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var i=n(23);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){t.exports=!n(25)&&!n(26)(function(){return 7!=Object.defineProperty(n(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,n){t.exports=!n(26)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){var i=n(23),r=n(16).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.createElement(t):{}}},function(t,e,n){var i=n(23);t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){t.exports=n(20)},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(33),r=n(29),o=n(46),s={};n(20)(s,n(47)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=i(s,{next:r(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var i=n(22),r=n(34),o=n(44),s=n(41)("IE_PROTO"),a=function(){},h="prototype",u=function(){var t,e=n(27)("iframe"),i=o.length,r="<",s=">";for(e.style.display="none",n(45).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(r+"script"+s+"document.F=Object"+r+"/script"+s),t.close(),u=t.F;i--;)delete u[h][o[i]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(a[h]=i(t),n=new a,a[h]=null,n[s]=t):n=u(),void 0===e?n:r(n,e)}},function(t,e,n){var i=n(21),r=n(22),o=n(35);t.exports=n(25)?Object.defineProperties:function(t,e){r(t);for(var n,s=o(e),a=s.length,h=0;a>h;)i.f(t,n=s[h++],e[n]);return t}},function(t,e,n){var i=n(36),r=n(44);t.exports=Object.keys||function(t){return i(t,r)}},function(t,e,n){var i=n(31),r=n(9),o=n(37)(!1),s=n(41)("IE_PROTO");t.exports=function(t,e){var n,a=r(t),h=0,u=[];for(n in a)n!=s&&i(a,n)&&u.push(n);for(;e.length>h;)i(a,n=e[h++])&&(~o(u,n)||u.push(n));return u}},function(t,e,n){var i=n(9),r=n(38),o=n(40);t.exports=function(t){return function(e,n,s){var a,h=i(e),u=r(h.length),l=o(s,u);if(t&&n!=n){for(;u>l;)if(a=h[l++],a!=a)return!0}else for(;u>l;l++)if((t||l in h)&&h[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var i=n(39),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e,n){var i=n(39),r=Math.max,o=Math.min;t.exports=function(t,e){return t=i(t),t<0?r(t+e,0):o(t,e)}},function(t,e,n){var i=n(42)("keys"),r=n(43);t.exports=function(t){return i[t]||(i[t]=r(t))}},function(t,e,n){var i=n(16),r="__core-js_shared__",o=i[r]||(i[r]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){t.exports=n(16).document&&document.documentElement},function(t,e,n){var i=n(21).f,r=n(31),o=n(47)("toStringTag");t.exports=function(t,e,n){t&&!r(t=n?t:t.prototype,o)&&i(t,o,{configurable:!0,value:e})}},function(t,e,n){var i=n(42)("wks"),r=n(43),o=n(16).Symbol,s="function"==typeof o,a=t.exports=function(t){return i[t]||(i[t]=s&&o[t]||(s?o:r)("Symbol."+t))};a.store=i},function(t,e,n){var i=n(31),r=n(49),o=n(41)("IE_PROTO"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),i(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},function(t,e,n){var i=n(12);t.exports=function(t){return Object(i(t))}},function(t,e,n){var i=n(51)(!0);n(13)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var i=n(39),r=n(12);t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),h=i(n),u=a.length;return h<0||h>=u?t?"":void 0:(o=a.charCodeAt(h),o<55296||o>56319||h+1===u||(s=a.charCodeAt(h+1))<56320||s>57343?t?a.charAt(h):o:t?a.slice(h,h+2):(o-55296<<10)+(s-56320)+65536)}}},function(t,e,n){var i=n(22),r=n(53);t.exports=n(17).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){var i=n(54),r=n(47)("iterator"),o=n(8);t.exports=n(17).getIteratorMethod=function(t){if(void 0!=t)return t[r]||t["@@iterator"]||o[i(t)]}},function(t,e,n){var i=n(11),r=n(47)("toStringTag"),o="Arguments"==i(function(){return arguments}()),s=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=s(e=Object(t),r))?n:o?i(e):"Object"==(a=i(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){t.exports={default:n(56),__esModule:!0}},function(t,e,n){n(57);var i=n(17).Object;t.exports=function(t,e){return i.create(t,e)}},function(t,e,n){var i=n(15);i(i.S,"Object",{create:n(33)})},function(t,e,n){t.exports={default:n(59),__esModule:!0}},function(t,e,n){n(60),t.exports=n(17).Object.keys},function(t,e,n){var i=n(49),r=n(35);n(61)("keys",function(){return function(t){return r(i(t))}})},function(t,e,n){var i=n(15),r=n(17),o=n(26);t.exports=function(t,e){var n=(r.Object||{})[t]||Object[t],s={};s[t]=e(n),i(i.S+i.F*o(function(){n(1)}),"Object",s)}},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var r=n(63),o=i(r),s=n(66),a=i(s),h="function"==typeof a.default&&"symbol"==typeof o.default?function(t){return typeof t}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":typeof t};e.default="function"==typeof a.default&&"symbol"===h(o.default)?function(t){return"undefined"==typeof t?"undefined":h(t)}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":"undefined"==typeof t?"undefined":h(t)}},function(t,e,n){t.exports={default:n(64),__esModule:!0}},function(t,e,n){n(50),n(4),t.exports=n(65).f("iterator")},function(t,e,n){e.f=n(47)},function(t,e,n){t.exports={default:n(67),__esModule:!0}},function(t,e,n){n(68),n(79),n(80),n(81),t.exports=n(17).Symbol},function(t,e,n){var i=n(16),r=n(31),o=n(25),s=n(15),a=n(30),h=n(69).KEY,u=n(26),l=n(42),c=n(46),f=n(43),d=n(47),p=n(65),m=n(70),v=n(71),y=n(72),g=n(75),_=n(22),w=n(9),x=n(28),b=n(29),S=n(33),T=n(76),D=n(78),M=n(21),k=n(35),O=D.f,E=M.f,C=T.f,P=i.Symbol,L=i.JSON,Y=L&&L.stringify,R="prototype",A=d("_hidden"),I=d("toPrimitive"),z={}.propertyIsEnumerable,N=l("symbol-registry"),W=l("symbols"),F=l("op-symbols"),j=Object[R],G="function"==typeof P,V=i.QObject,B=!V||!V[R]||!V[R].findChild,U=o&&u(function(){return 7!=S(E({},"a",{get:function(){return E(this,"a",{value:7}).a}})).a})?function(t,e,n){var i=O(j,e);i&&delete j[e],E(t,e,n),i&&t!==j&&E(j,e,i)}:E,H=function(t){var e=W[t]=S(P[R]);return e._k=t,e},X=G&&"symbol"==typeof P.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof P},Z=function(t,e,n){return t===j&&Z(F,e,n),_(t),e=x(e,!0),_(n),r(W,e)?(n.enumerable?(r(t,A)&&t[A][e]&&(t[A][e]=!1),n=S(n,{enumerable:b(0,!1)})):(r(t,A)||E(t,A,b(1,{})),t[A][e]=!0),U(t,e,n)):E(t,e,n)},q=function(t,e){_(t);for(var n,i=y(e=w(e)),r=0,o=i.length;o>r;)Z(t,n=i[r++],e[n]);return t},$=function(t,e){return void 0===e?S(t):q(S(t),e)},J=function(t){var e=z.call(this,t=x(t,!0));return!(this===j&&r(W,t)&&!r(F,t))&&(!(e||!r(this,t)||!r(W,t)||r(this,A)&&this[A][t])||e)},Q=function(t,e){if(t=w(t),e=x(e,!0),t!==j||!r(W,e)||r(F,e)){var n=O(t,e);return!n||!r(W,e)||r(t,A)&&t[A][e]||(n.enumerable=!0),n}},K=function(t){for(var e,n=C(w(t)),i=[],o=0;n.length>o;)r(W,e=n[o++])||e==A||e==h||i.push(e);return i},tt=function(t){for(var e,n=t===j,i=C(n?F:w(t)),o=[],s=0;i.length>s;)!r(W,e=i[s++])||n&&!r(j,e)||o.push(W[e]);return o};G||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var t=f(arguments.length>0?arguments[0]:void 0),e=function(n){this===j&&e.call(F,n),r(this,A)&&r(this[A],t)&&(this[A][t]=!1),U(this,t,b(1,n))};return o&&B&&U(j,t,{configurable:!0,set:e}),H(t)},a(P[R],"toString",function(){return this._k}),D.f=Q,M.f=Z,n(77).f=T.f=K,n(74).f=J,n(73).f=tt,o&&!n(14)&&a(j,"propertyIsEnumerable",J,!0),p.f=function(t){return H(d(t))}),s(s.G+s.W+s.F*!G,{Symbol:P});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)d(et[nt++]);for(var et=k(d.store),nt=0;et.length>nt;)m(et[nt++]);s(s.S+s.F*!G,"Symbol",{for:function(t){return r(N,t+="")?N[t]:N[t]=P(t)},keyFor:function(t){if(X(t))return v(N,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){B=!0},useSimple:function(){B=!1}}),s(s.S+s.F*!G,"Object",{create:$,defineProperty:Z,defineProperties:q,getOwnPropertyDescriptor:Q,getOwnPropertyNames:K,getOwnPropertySymbols:tt}),L&&s(s.S+s.F*(!G||u(function(){var t=P();return"[null]"!=Y([t])||"{}"!=Y({a:t})||"{}"!=Y(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!X(t)){for(var e,n,i=[t],r=1;arguments.length>r;)i.push(arguments[r++]);return e=i[1],"function"==typeof e&&(n=e),!n&&g(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!X(e))return e}),i[1]=e,Y.apply(L,i)}}}),P[R][I]||n(20)(P[R],I,P[R].valueOf),c(P,"Symbol"),c(Math,"Math",!0),c(i.JSON,"JSON",!0)},function(t,e,n){var i=n(43)("meta"),r=n(23),o=n(31),s=n(21).f,a=0,h=Object.isExtensible||function(){return!0},u=!n(26)(function(){return h(Object.preventExtensions({}))}),l=function(t){s(t,i,{value:{i:"O"+ ++a,w:{}}})},c=function(t,e){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,i)){if(!h(t))return"F";if(!e)return"E";l(t)}return t[i].i},f=function(t,e){if(!o(t,i)){if(!h(t))return!0;if(!e)return!1;l(t)}return t[i].w},d=function(t){return u&&p.NEED&&h(t)&&!o(t,i)&&l(t),t},p=t.exports={KEY:i,NEED:!1,fastKey:c,getWeak:f,onFreeze:d}},function(t,e,n){var i=n(16),r=n(17),o=n(14),s=n(65),a=n(21).f;t.exports=function(t){var e=r.Symbol||(r.Symbol=o?{}:i.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:s.f(t)})}},function(t,e,n){var i=n(35),r=n(9);t.exports=function(t,e){for(var n,o=r(t),s=i(o),a=s.length,h=0;a>h;)if(o[n=s[h++]]===e)return n}},function(t,e,n){var i=n(35),r=n(73),o=n(74);t.exports=function(t){var e=i(t),n=r.f;if(n)for(var s,a=n(t),h=o.f,u=0;a.length>u;)h.call(t,s=a[u++])&&e.push(s);return e}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,n){var i=n(11);t.exports=Array.isArray||function(t){return"Array"==i(t)}},function(t,e,n){var i=n(9),r=n(77).f,o={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return r(t)}catch(t){return s.slice()}};t.exports.f=function(t){return s&&"[object Window]"==o.call(t)?a(t):r(i(t))}},function(t,e,n){var i=n(36),r=n(44).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,r)}},function(t,e,n){var i=n(74),r=n(29),o=n(9),s=n(28),a=n(31),h=n(24),u=Object.getOwnPropertyDescriptor;e.f=n(25)?u:function(t,e){if(t=o(t),e=s(e,!0),h)try{return u(t,e)}catch(t){}if(a(t,e))return r(!i.f.call(t,e),t[e])}},function(t,e){},function(t,e,n){n(70)("asyncIterator")},function(t,e,n){n(70)("observable")},function(t,e,n){t.exports="undefined"!=typeof window&&window.moment||n(83)},function(t,e,n){(function(t){!function(e,n){t.exports=n()}(this,function(){function e(){return wi.apply(null,arguments)}function n(t){wi=t}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function r(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function o(t){var e;for(e in t)return!1;return!0}function s(t){return void 0===t}function a(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function h(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function u(t,e){var n,i=[];for(n=0;n0)for(n=0;n0?"future":"past"];return M(n)?n(e):n.replace(/%s/i,e)}function I(t,e){var n=t.toLowerCase();Ai[n]=Ai[n+"s"]=Ai[e]=t}function z(t){return"string"==typeof t?Ai[t]||Ai[t.toLowerCase()]:void 0}function N(t){var e,n,i={};for(n in t)l(t,n)&&(e=z(n),e&&(i[e]=t[n]));return i}function W(t,e){Ii[t]=e}function F(t){var e=[];for(var n in t)e.push({unit:n,priority:Ii[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function j(t,n){return function(i){return null!=i?(V(this,t,i),e.updateOffset(this,n),this):G(this,t)}}function G(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function V(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function B(t){return t=z(t),M(this[t])?this[t]():this}function U(t,e){if("object"==typeof t){t=N(t);for(var n=F(t),i=0;i=0;return(o?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}function X(t,e,n,i){var r=i;"string"==typeof i&&(r=function(){return this[i]()}),t&&(Fi[t]=r),e&&(Fi[e[0]]=function(){return H(r.apply(this,arguments),e[1],e[2])}),n&&(Fi[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function Z(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function q(t){var e,n,i=t.match(zi);for(e=0,n=i.length;e=0&&Ni.test(t);)t=t.replace(Ni,n),Ni.lastIndex=0,i-=1;return t}function Q(t,e,n){rr[t]=M(e)?e:function(t,i){return t&&n?n:e}}function K(t,e){return l(rr,t)?rr[t](e._strict,e._locale):new RegExp(tt(t))}function tt(t){return et(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,r){return e||n||i||r}))}function et(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function nt(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),a(e)&&(i=function(t,n){n[e]=x(t)}),n=0;n=0&&isFinite(a.getFullYear())&&a.setFullYear(t),a}function wt(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function xt(t,e,n){var i=7+e-n,r=(7+wt(t,0,i).getUTCDay()-e)%7;return-r+i-1}function bt(t,e,n,i,r){var o,s,a=(7+n-i)%7,h=xt(t,i,r),u=1+7*(e-1)+a+h;return u<=0?(o=t-1,s=vt(o)+u):u>vt(t)?(o=t+1,s=u-vt(t)):(o=t,s=u),{year:o,dayOfYear:s}}function St(t,e,n){var i,r,o=xt(t.year(),e,n),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return s<1?(r=t.year()-1,i=s+Tt(r,e,n)):s>Tt(t.year(),e,n)?(i=s-Tt(t.year(),e,n),r=t.year()+1):(r=t.year(),i=s),{week:i,year:r}}function Tt(t,e,n){var i=xt(t,e,n),r=xt(t+1,e,n);return(vt(t)-i+r)/7}function Dt(t){return St(t,this._week.dow,this._week.doy).week}function Mt(){return this._week.dow}function kt(){return this._week.doy}function Ot(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Et(t){var e=St(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Ct(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Pt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Lt(t,e){return t?i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:i(this._weekdays)?this._weekdays:this._weekdays.standalone}function Yt(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort}function Rt(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin}function At(t,e,n){var i,r,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)o=f([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===e?(r=mr.call(this._weekdaysParse,s),r!==-1?r:null):"ddd"===e?(r=mr.call(this._shortWeekdaysParse,s),r!==-1?r:null):(r=mr.call(this._minWeekdaysParse,s),r!==-1?r:null):"dddd"===e?(r=mr.call(this._weekdaysParse,s),r!==-1?r:(r=mr.call(this._shortWeekdaysParse,s),r!==-1?r:(r=mr.call(this._minWeekdaysParse,s),r!==-1?r:null))):"ddd"===e?(r=mr.call(this._shortWeekdaysParse,s),r!==-1?r:(r=mr.call(this._weekdaysParse,s),r!==-1?r:(r=mr.call(this._minWeekdaysParse,s),r!==-1?r:null))):(r=mr.call(this._minWeekdaysParse,s),r!==-1?r:(r=mr.call(this._weekdaysParse,s),r!==-1?r:(r=mr.call(this._shortWeekdaysParse,s),r!==-1?r:null)))}function It(t,e,n){var i,r,o;if(this._weekdaysParseExact)return At.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(r=f([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function zt(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Ct(t,this.localeData()),this.add(t-e,"d")):e}function Nt(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Wt(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Pt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function Ft(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Vt.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Mr),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function jt(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Vt.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=kr),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Gt(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Vt.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Or),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Vt(){function t(t,e){return e.length-t.length}var e,n,i,r,o,s=[],a=[],h=[],u=[];for(e=0;e<7;e++)n=f([2e3,1]).day(e),i=this.weekdaysMin(n,""),r=this.weekdaysShort(n,""),o=this.weekdays(n,""),s.push(i),a.push(r),h.push(o),u.push(i),u.push(r),u.push(o);for(s.sort(t),a.sort(t),h.sort(t),u.sort(t),e=0;e<7;e++)a[e]=et(a[e]),h[e]=et(h[e]),u[e]=et(u[e]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Bt(){return this.hours()%12||12}function Ut(){return this.hours()||24}function Ht(t,e){X(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function Xt(t,e){return e._meridiemParse}function Zt(t){return"p"===(t+"").toLowerCase().charAt(0)}function qt(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function $t(t){return t?t.toLowerCase().replace("_","-"):t}function Jt(t){for(var e,n,i,r,o=0;o0;){if(i=Qt(r.slice(0,e).join("-")))return i;if(n&&n.length>=e&&b(r,n,!0)>=e-1)break;e--}o++}return null}function Qt(e){var n=null;if(!Yr[e]&&"undefined"!=typeof t&&t&&t.exports)try{n=Er._abbr,!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),Kt(n)}catch(t){}return Yr[e]}function Kt(t,e){var n;return t&&(n=s(e)?ne(t):te(t,e),n&&(Er=n)),Er._abbr}function te(t,e){if(null!==e){var n=Lr;if(e.abbr=t,null!=Yr[t])D("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Yr[t]._config;else if(null!=e.parentLocale){if(null==Yr[e.parentLocale])return Rr[e.parentLocale]||(Rr[e.parentLocale]=[]),Rr[e.parentLocale].push({name:t,config:e}),null;n=Yr[e.parentLocale]._config}return Yr[t]=new E(O(n,e)),Rr[t]&&Rr[t].forEach(function(t){te(t.name,t.config)}),Kt(t),Yr[t]}return delete Yr[t],null}function ee(t,e){if(null!=e){var n,i=Lr;null!=Yr[t]&&(i=Yr[t]._config),e=O(i,e),n=new E(e),n.parentLocale=Yr[t],Yr[t]=n,Kt(t)}else null!=Yr[t]&&(null!=Yr[t].parentLocale?Yr[t]=Yr[t].parentLocale:null!=Yr[t]&&delete Yr[t]);return Yr[t]}function ne(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Er;if(!i(t)){if(e=Qt(t))return e;t=[t]}return Jt(t)}function ie(){return Oi(Yr)}function re(t){var e,n=t._a;return n&&p(t).overflow===-2&&(e=n[ar]<0||n[ar]>11?ar:n[hr]<1||n[hr]>ot(n[sr],n[ar])?hr:n[ur]<0||n[ur]>24||24===n[ur]&&(0!==n[lr]||0!==n[cr]||0!==n[fr])?ur:n[lr]<0||n[lr]>59?lr:n[cr]<0||n[cr]>59?cr:n[fr]<0||n[fr]>999?fr:-1,p(t)._overflowDayOfYear&&(ehr)&&(e=hr),p(t)._overflowWeeks&&e===-1&&(e=dr),p(t)._overflowWeekday&&e===-1&&(e=pr),p(t).overflow=e),t}function oe(t){var e,n,i,r,o,s,a=t._i,h=Ar.exec(a)||Ir.exec(a);if(h){for(p(t).iso=!0,e=0,n=Nr.length;e10?"YYYY ":"YY "),o="HH:mm"+(n[4]?":ss":""),n[1]){var c=new Date(n[2]),f=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][c.getDay()];if(n[1].substr(0,3)!==f)return p(t).weekdayMismatch=!0,void(t._isValid=!1)}switch(n[5].length){case 2:0===h?a=" +0000":(h=l.indexOf(n[5][1].toUpperCase())-12,a=(h<0?" -":" +")+(""+h).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:a=u[n[5]];break;default:a=u[" GMT"]}n[5]=a,t._i=n.splice(1).join(""),s=" ZZ",t._f=i+r+o+s,fe(t),p(t).rfc2822=!0}else t._isValid=!1}function ae(t){var n=Fr.exec(t._i);return null!==n?void(t._d=new Date(+n[1])):(oe(t),void(t._isValid===!1&&(delete t._isValid,se(t),t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t)))))}function he(t,e,n){return null!=t?t:null!=e?e:n}function ue(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function le(t){var e,n,i,r,o=[];if(!t._d){for(i=ue(t),t._w&&null==t._a[hr]&&null==t._a[ar]&&ce(t),null!=t._dayOfYear&&(r=he(t._a[sr],i[sr]),(t._dayOfYear>vt(r)||0===t._dayOfYear)&&(p(t)._overflowDayOfYear=!0),n=wt(r,0,t._dayOfYear),t._a[ar]=n.getUTCMonth(),t._a[hr]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=o[e]=i[e];for(;e<7;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[ur]&&0===t._a[lr]&&0===t._a[cr]&&0===t._a[fr]&&(t._nextDay=!0,t._a[ur]=0),t._d=(t._useUTC?wt:_t).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[ur]=24)}}function ce(t){var e,n,i,r,o,s,a,h;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)o=1,s=4,n=he(e.GG,t._a[sr],St(we(),1,4).year),i=he(e.W,1),r=he(e.E,1),(r<1||r>7)&&(h=!0);else{o=t._locale._week.dow,s=t._locale._week.doy;var u=St(we(),o,s);n=he(e.gg,t._a[sr],u.year),i=he(e.w,u.week),null!=e.d?(r=e.d,(r<0||r>6)&&(h=!0)):null!=e.e?(r=e.e+o,(e.e<0||e.e>6)&&(h=!0)):r=o}i<1||i>Tt(n,o,s)?p(t)._overflowWeeks=!0:null!=h?p(t)._overflowWeekday=!0:(a=bt(n,i,r,o,s),t._a[sr]=a.year,t._dayOfYear=a.dayOfYear)}function fe(t){if(t._f===e.ISO_8601)return void oe(t);if(t._f===e.RFC_2822)return void se(t);t._a=[],p(t).empty=!0;var n,i,r,o,s,a=""+t._i,h=a.length,u=0;for(r=J(t._f,t._locale).match(zi)||[],n=0;n0&&p(t).unusedInput.push(s),a=a.slice(a.indexOf(i)+i.length),u+=i.length),Fi[o]?(i?p(t).empty=!1:p(t).unusedTokens.push(o),rt(o,i,t)):t._strict&&!i&&p(t).unusedTokens.push(o);p(t).charsLeftOver=h-u,a.length>0&&p(t).unusedInput.push(a),t._a[ur]<=12&&p(t).bigHour===!0&&t._a[ur]>0&&(p(t).bigHour=void 0),p(t).parsedDateParts=t._a.slice(0),p(t).meridiem=t._meridiem,t._a[ur]=de(t._locale,t._a[ur],t._meridiem),le(t),re(t)}function de(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(i=t.isPM(n),i&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function pe(t){var e,n,i,r,o;if(0===t._f.length)return p(t).invalidFormat=!0,void(t._d=new Date(NaN));for(r=0;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function je(){if(!s(this._isDSTShifted))return this._isDSTShifted;var t={};if(y(t,this),t=ye(t),t._a){var e=t._isUTC?f(t._a):we(t._a);this._isDSTShifted=this.isValid()&&b(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Ge(){return!!this.isValid()&&!this._isUTC}function Ve(){return!!this.isValid()&&this._isUTC}function Be(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ue(t,e){var n,i,r,o=t,s=null;return Oe(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:a(t)?(o={},e?o[e]=t:o.milliseconds=t):(s=Xr.exec(t))?(n="-"===s[1]?-1:1,o={y:0,d:x(s[hr])*n,h:x(s[ur])*n,m:x(s[lr])*n,s:x(s[cr])*n,ms:x(Ee(1e3*s[fr]))*n}):(s=Zr.exec(t))?(n="-"===s[1]?-1:1,o={y:He(s[2],n),M:He(s[3],n),w:He(s[4],n),d:He(s[5],n),h:He(s[6],n),m:He(s[7],n),s:He(s[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(r=Ze(we(o.from),we(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),i=new ke(o),Oe(t)&&l(t,"_locale")&&(i._locale=t._locale),i}function He(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Xe(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Ze(t,e){var n;return t.isValid()&&e.isValid()?(e=Le(e,t),t.isBefore(e)?n=Xe(t,e):(n=Xe(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function qe(t,e){return function(n,i){var r,o;return null===i||isNaN(+i)||(D(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=i,i=o),n="string"==typeof n?+n:n,r=Ue(n,i),$e(this,r,t),this}}function $e(t,n,i,r){var o=n._milliseconds,s=Ee(n._days),a=Ee(n._months);t.isValid()&&(r=null==r||r,o&&t._d.setTime(t._d.valueOf()+o*i),s&&V(t,"Date",G(t,"Date")+s*i),a&<(t,G(t,"Month")+a*i),r&&e.updateOffset(t,s||a))}function Je(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Qe(t,n){var i=t||we(),r=Le(i,this).startOf("day"),o=e.calendarFormat(this,r)||"sameElse",s=n&&(M(n[o])?n[o].call(this,i):n[o]);return this.format(s||this.localeData().calendar(o,this,we(i)))}function Ke(){return new g(this)}function tn(t,e){var n=_(t)?t:we(t);return!(!this.isValid()||!n.isValid())&&(e=z(s(e)?"millisecond":e),"millisecond"===e?this.valueOf()>n.valueOf():n.valueOf()9999?$(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):M(Date.prototype.toISOString)?this.toDate().toISOString():$(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function cn(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var n="["+t+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r="-MM-DD[T]HH:mm:ss.SSS",o=e+'[")]';return this.format(n+i+r+o)}function fn(t){t||(t=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var n=$(this,t);return this.localeData().postformat(n)}function dn(t,e){return this.isValid()&&(_(t)&&t.isValid()||we(t).isValid())?Ue({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function pn(t){return this.from(we(),t)}function mn(t,e){return this.isValid()&&(_(t)&&t.isValid()||we(t).isValid())?Ue({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function vn(t){return this.to(we(),t)}function yn(t){var e;return void 0===t?this._locale._abbr:(e=ne(t),null!=e&&(this._locale=e),this)}function gn(){return this._locale}function _n(t){switch(t=z(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function wn(t){return t=z(t),void 0===t||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function xn(){return this._d.valueOf()-6e4*(this._offset||0)}function bn(){return Math.floor(this.valueOf()/1e3)}function Sn(){return new Date(this.valueOf())}function Tn(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function Dn(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function Mn(){return this.isValid()?this.toISOString():null}function kn(){return m(this)}function On(){return c({},p(this))}function En(){return p(this).overflow}function Cn(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Pn(t,e){X(0,[t,t.length],0,e)}function Ln(t){return In.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Yn(t){return In.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function Rn(){return Tt(this.year(),1,4)}function An(){var t=this.localeData()._week;return Tt(this.year(),t.dow,t.doy)}function In(t,e,n,i,r){var o;return null==t?St(this,i,r).year:(o=Tt(t,i,r),e>o&&(e=o),zn.call(this,t,e,n,i,r))}function zn(t,e,n,i,r){var o=bt(t,e,n,i,r),s=wt(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Nn(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Wn(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Fn(t,e){e[fr]=x(1e3*("0."+t))}function jn(){return this._isUTC?"UTC":""}function Gn(){return this._isUTC?"Coordinated Universal Time":""}function Vn(t){return we(1e3*t)}function Bn(){return we.apply(null,arguments).parseZone()}function Un(t){return t}function Hn(t,e,n,i){var r=ne(),o=f().set(i,e);return r[n](o,t)}function Xn(t,e,n){if(a(t)&&(e=t,t=void 0),t=t||"",null!=e)return Hn(t,e,n,"month");var i,r=[];for(i=0;i<12;i++)r[i]=Hn(t,i,n,"month");return r}function Zn(t,e,n,i){"boolean"==typeof t?(a(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,a(e)&&(n=e,e=void 0),e=e||"");var r=ne(),o=t?r._week.dow:0; -if(null!=n)return Hn(e,(n+o)%7,i,"day");var s,h=[];for(s=0;s<7;s++)h[s]=Hn(e,(s+o)%7,i,"day");return h}function qn(t,e){return Xn(t,e,"months")}function $n(t,e){return Xn(t,e,"monthsShort")}function Jn(t,e,n){return Zn(t,e,n,"weekdays")}function Qn(t,e,n){return Zn(t,e,n,"weekdaysShort")}function Kn(t,e,n){return Zn(t,e,n,"weekdaysMin")}function ti(){var t=this._data;return this._milliseconds=oo(this._milliseconds),this._days=oo(this._days),this._months=oo(this._months),t.milliseconds=oo(t.milliseconds),t.seconds=oo(t.seconds),t.minutes=oo(t.minutes),t.hours=oo(t.hours),t.months=oo(t.months),t.years=oo(t.years),this}function ei(t,e,n,i){var r=Ue(e,n);return t._milliseconds+=i*r._milliseconds,t._days+=i*r._days,t._months+=i*r._months,t._bubble()}function ni(t,e){return ei(this,t,e,1)}function ii(t,e){return ei(this,t,e,-1)}function ri(t){return t<0?Math.floor(t):Math.ceil(t)}function oi(){var t,e,n,i,r,o=this._milliseconds,s=this._days,a=this._months,h=this._data;return o>=0&&s>=0&&a>=0||o<=0&&s<=0&&a<=0||(o+=864e5*ri(ai(a)+s),s=0,a=0),h.milliseconds=o%1e3,t=w(o/1e3),h.seconds=t%60,e=w(t/60),h.minutes=e%60,n=w(e/60),h.hours=n%24,s+=w(n/24),r=w(si(s)),a+=r,s-=ri(ai(r)),i=w(a/12),a%=12,h.days=s,h.months=a,h.years=i,this}function si(t){return 4800*t/146097}function ai(t){return 146097*t/4800}function hi(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if(t=z(t),"month"===t||"year"===t)return e=this._days+i/864e5,n=this._months+si(e),"month"===t?n:n/12;switch(e=this._days+Math.round(ai(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}}function ui(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*x(this._months/12):NaN}function li(t){return function(){return this.as(t)}}function ci(t){return t=z(t),this.isValid()?this[t+"s"]():NaN}function fi(t){return function(){return this.isValid()?this._data[t]:NaN}}function di(){return w(this.days()/7)}function pi(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function mi(t,e,n){var i=Ue(t).abs(),r=bo(i.as("s")),o=bo(i.as("m")),s=bo(i.as("h")),a=bo(i.as("d")),h=bo(i.as("M")),u=bo(i.as("y")),l=r<=So.ss&&["s",r]||r0,l[4]=n,pi.apply(null,l)}function vi(t){return void 0===t?bo:"function"==typeof t&&(bo=t,!0)}function yi(t,e){return void 0!==So[t]&&(void 0===e?So[t]:(So[t]=e,"s"===t&&(So.ss=e-1),!0))}function gi(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),n=mi(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function _i(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,i=To(this._milliseconds)/1e3,r=To(this._days),o=To(this._months);t=w(i/60),e=w(t/60),i%=60,t%=60,n=w(o/12),o%=12;var s=n,a=o,h=r,u=e,l=t,c=i,f=this.asSeconds();return f?(f<0?"-":"")+"P"+(s?s+"Y":"")+(a?a+"M":"")+(h?h+"D":"")+(u||l||c?"T":"")+(u?u+"H":"")+(l?l+"M":"")+(c?c+"S":""):"P0D"}var wi,xi;xi=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),n=e.length>>>0,i=0;i68?1900:2e3)};var xr=j("FullYear",!0);X("w",["ww",2],"wo","week"),X("W",["WW",2],"Wo","isoWeek"),I("week","w"),I("isoWeek","W"),W("week",5),W("isoWeek",5),Q("w",Hi),Q("ww",Hi,Gi),Q("W",Hi),Q("WW",Hi,Gi),it(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=x(t)});var br={dow:0,doy:6};X("d",0,"do","day"),X("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),X("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),X("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),X("e",0,0,"weekday"),X("E",0,0,"isoWeekday"),I("day","d"),I("weekday","e"),I("isoWeekday","E"),W("day",11),W("weekday",11),W("isoWeekday",11),Q("d",Hi),Q("e",Hi),Q("E",Hi),Q("dd",function(t,e){return e.weekdaysMinRegex(t)}),Q("ddd",function(t,e){return e.weekdaysShortRegex(t)}),Q("dddd",function(t,e){return e.weekdaysRegex(t)}),it(["dd","ddd","dddd"],function(t,e,n,i){var r=n._locale.weekdaysParse(t,i,n._strict);null!=r?e.d=r:p(n).invalidWeekday=t}),it(["d","e","E"],function(t,e,n,i){e[i]=x(t)});var Sr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Tr="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Dr="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Mr=ir,kr=ir,Or=ir;X("H",["HH",2],0,"hour"),X("h",["hh",2],0,Bt),X("k",["kk",2],0,Ut),X("hmm",0,0,function(){return""+Bt.apply(this)+H(this.minutes(),2)}),X("hmmss",0,0,function(){return""+Bt.apply(this)+H(this.minutes(),2)+H(this.seconds(),2)}),X("Hmm",0,0,function(){return""+this.hours()+H(this.minutes(),2)}),X("Hmmss",0,0,function(){return""+this.hours()+H(this.minutes(),2)+H(this.seconds(),2)}),Ht("a",!0),Ht("A",!1),I("hour","h"),W("hour",13),Q("a",Xt),Q("A",Xt),Q("H",Hi),Q("h",Hi),Q("k",Hi),Q("HH",Hi,Gi),Q("hh",Hi,Gi),Q("kk",Hi,Gi),Q("hmm",Xi),Q("hmmss",Zi),Q("Hmm",Xi),Q("Hmmss",Zi),nt(["H","HH"],ur),nt(["k","kk"],function(t,e,n){var i=x(t);e[ur]=24===i?0:i}),nt(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),nt(["h","hh"],function(t,e,n){e[ur]=x(t),p(n).bigHour=!0}),nt("hmm",function(t,e,n){var i=t.length-2;e[ur]=x(t.substr(0,i)),e[lr]=x(t.substr(i)),p(n).bigHour=!0}),nt("hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[ur]=x(t.substr(0,i)),e[lr]=x(t.substr(i,2)),e[cr]=x(t.substr(r)),p(n).bigHour=!0}),nt("Hmm",function(t,e,n){var i=t.length-2;e[ur]=x(t.substr(0,i)),e[lr]=x(t.substr(i))}),nt("Hmmss",function(t,e,n){var i=t.length-4,r=t.length-2;e[ur]=x(t.substr(0,i)),e[lr]=x(t.substr(i,2)),e[cr]=x(t.substr(r))});var Er,Cr=/[ap]\.?m?\.?/i,Pr=j("Hours",!0),Lr={calendar:Ei,longDateFormat:Ci,invalidDate:Pi,ordinal:Li,dayOfMonthOrdinalParse:Yi,relativeTime:Ri,months:yr,monthsShort:gr,week:br,weekdays:Sr,weekdaysMin:Dr,weekdaysShort:Tr,meridiemParse:Cr},Yr={},Rr={},Ar=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ir=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,zr=/Z|[+-]\d\d(?::?\d\d)?/,Nr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Wr=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Fr=/^\/?Date\((\-?\d+)/i,jr=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;e.createFromInputFallback=T("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),e.ISO_8601=function(){},e.RFC_2822=function(){};var Gr=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=we.apply(null,arguments);return this.isValid()&&t.isValid()?tthis?this:t:v()}),Br=function(){return Date.now?Date.now():+new Date},Ur=["year","quarter","month","week","day","hour","minute","second","millisecond"];Ce("Z",":"),Ce("ZZ",""),Q("Z",er),Q("ZZ",er),nt(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Pe(er,t)});var Hr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Xr=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Zr=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ue.fn=ke.prototype,Ue.invalid=Me;var qr=qe(1,"add"),$r=qe(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Jr=T("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});X(0,["gg",2],0,function(){return this.weekYear()%100}),X(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Pn("gggg","weekYear"),Pn("ggggg","weekYear"),Pn("GGGG","isoWeekYear"),Pn("GGGGG","isoWeekYear"),I("weekYear","gg"),I("isoWeekYear","GG"),W("weekYear",1),W("isoWeekYear",1),Q("G",Ki),Q("g",Ki),Q("GG",Hi,Gi),Q("gg",Hi,Gi),Q("GGGG",$i,Bi),Q("gggg",$i,Bi),Q("GGGGG",Ji,Ui),Q("ggggg",Ji,Ui),it(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=x(t)}),it(["gg","GG"],function(t,n,i,r){n[r]=e.parseTwoDigitYear(t)}),X("Q",0,"Qo","quarter"),I("quarter","Q"),W("quarter",7),Q("Q",ji),nt("Q",function(t,e){e[ar]=3*(x(t)-1)}),X("D",["DD",2],"Do","date"),I("date","D"),W("date",9),Q("D",Hi),Q("DD",Hi,Gi),Q("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),nt(["D","DD"],hr),nt("Do",function(t,e){e[hr]=x(t.match(Hi)[0],10)});var Qr=j("Date",!0);X("DDD",["DDDD",3],"DDDo","dayOfYear"),I("dayOfYear","DDD"),W("dayOfYear",4),Q("DDD",qi),Q("DDDD",Vi),nt(["DDD","DDDD"],function(t,e,n){n._dayOfYear=x(t)}),X("m",["mm",2],0,"minute"),I("minute","m"),W("minute",14),Q("m",Hi),Q("mm",Hi,Gi),nt(["m","mm"],lr);var Kr=j("Minutes",!1);X("s",["ss",2],0,"second"),I("second","s"),W("second",15),Q("s",Hi),Q("ss",Hi,Gi),nt(["s","ss"],cr);var to=j("Seconds",!1);X("S",0,0,function(){return~~(this.millisecond()/100)}),X(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),X(0,["SSS",3],0,"millisecond"),X(0,["SSSS",4],0,function(){return 10*this.millisecond()}),X(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),X(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),X(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),X(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),X(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),I("millisecond","ms"),W("millisecond",16),Q("S",qi,ji),Q("SS",qi,Gi),Q("SSS",qi,Vi);var eo;for(eo="SSSS";eo.length<=9;eo+="S")Q(eo,Qi);for(eo="S";eo.length<=9;eo+="S")nt(eo,Fn);var no=j("Milliseconds",!1);X("z",0,0,"zoneAbbr"),X("zz",0,0,"zoneName");var io=g.prototype;io.add=qr,io.calendar=Qe,io.clone=Ke,io.diff=an,io.endOf=wn,io.format=fn,io.from=dn,io.fromNow=pn,io.to=mn,io.toNow=vn,io.get=B,io.invalidAt=En,io.isAfter=tn,io.isBefore=en,io.isBetween=nn,io.isSame=rn,io.isSameOrAfter=on,io.isSameOrBefore=sn,io.isValid=kn,io.lang=Jr,io.locale=yn,io.localeData=gn,io.max=Vr,io.min=Gr,io.parsingFlags=On,io.set=U,io.startOf=_n,io.subtract=$r,io.toArray=Tn,io.toObject=Dn,io.toDate=Sn,io.toISOString=ln,io.inspect=cn,io.toJSON=Mn,io.toString=un,io.unix=bn,io.valueOf=xn,io.creationData=Cn,io.year=xr,io.isLeapYear=gt,io.weekYear=Ln,io.isoWeekYear=Yn,io.quarter=io.quarters=Nn,io.month=ct,io.daysInMonth=ft,io.week=io.weeks=Ot,io.isoWeek=io.isoWeeks=Et,io.weeksInYear=An,io.isoWeeksInYear=Rn,io.date=Qr,io.day=io.days=zt,io.weekday=Nt,io.isoWeekday=Wt,io.dayOfYear=Wn,io.hour=io.hours=Pr,io.minute=io.minutes=Kr,io.second=io.seconds=to,io.millisecond=io.milliseconds=no,io.utcOffset=Re,io.utc=Ie,io.local=ze,io.parseZone=Ne,io.hasAlignedHourOffset=We,io.isDST=Fe,io.isLocal=Ge,io.isUtcOffset=Ve,io.isUtc=Be,io.isUTC=Be,io.zoneAbbr=jn,io.zoneName=Gn,io.dates=T("dates accessor is deprecated. Use date instead.",Qr),io.months=T("months accessor is deprecated. Use month instead",ct),io.years=T("years accessor is deprecated. Use year instead",xr),io.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Ae),io.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",je);var ro=E.prototype;ro.calendar=C,ro.longDateFormat=P,ro.invalidDate=L,ro.ordinal=Y,ro.preparse=Un,ro.postformat=Un,ro.relativeTime=R,ro.pastFuture=A,ro.set=k,ro.months=st,ro.monthsShort=at,ro.monthsParse=ut,ro.monthsRegex=pt,ro.monthsShortRegex=dt,ro.week=Dt,ro.firstDayOfYear=kt,ro.firstDayOfWeek=Mt,ro.weekdays=Lt,ro.weekdaysMin=Rt,ro.weekdaysShort=Yt,ro.weekdaysParse=It,ro.weekdaysRegex=Ft,ro.weekdaysShortRegex=jt,ro.weekdaysMinRegex=Gt,ro.isPM=Zt,ro.meridiem=qt,Kt("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===x(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),e.lang=T("moment.lang is deprecated. Use moment.locale instead.",Kt),e.langData=T("moment.langData is deprecated. Use moment.localeData instead.",ne);var oo=Math.abs,so=li("ms"),ao=li("s"),ho=li("m"),uo=li("h"),lo=li("d"),co=li("w"),fo=li("M"),po=li("y"),mo=fi("milliseconds"),vo=fi("seconds"),yo=fi("minutes"),go=fi("hours"),_o=fi("days"),wo=fi("months"),xo=fi("years"),bo=Math.round,So={ss:44,s:45,m:45,h:22,d:26,M:11},To=Math.abs,Do=ke.prototype;return Do.isValid=De,Do.abs=ti,Do.add=ni,Do.subtract=ii,Do.as=hi,Do.asMilliseconds=so,Do.asSeconds=ao,Do.asMinutes=ho,Do.asHours=uo,Do.asDays=lo,Do.asWeeks=co,Do.asMonths=fo,Do.asYears=po,Do.valueOf=ui,Do._bubble=oi,Do.get=ci,Do.milliseconds=mo,Do.seconds=vo,Do.minutes=yo,Do.hours=go,Do.days=_o,Do.weeks=di,Do.months=wo,Do.years=xo,Do.humanize=gi,Do.toISOString=_i,Do.toString=_i,Do.toJSON=_i,Do.locale=yn,Do.localeData=gn,Do.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",_i),Do.lang=Jr,X("X",0,0,"unix"),X("x",0,0,"valueOf"),Q("x",Ki),Q("X",nr),nt("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),nt("x",function(t,e,n){n._d=new Date(x(t))}),e.version="2.18.1",n(we),e.fn=io,e.min=be,e.max=Se,e.now=Br,e.utc=f,e.unix=Vn,e.months=qn,e.isDate=h,e.locale=Kt,e.invalid=v,e.duration=Ue,e.isMoment=_,e.weekdays=Jn,e.parseZone=Bn,e.localeData=ne,e.isDuration=Oe,e.monthsShort=$n,e.weekdaysMin=Kn,e.defineLocale=te,e.updateLocale=ee,e.locales=ie,e.weekdaysShort=Qn,e.normalizeUnits=z,e.relativeTimeRounding=vi,e.relativeTimeThreshold=yi,e.calendarFormat=Je,e.prototype=io,e})}).call(e,n(84)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){function n(t){throw new Error("Cannot find module '"+t+"'.")}n.keys=function(){return[]},n.resolve=n,t.exports=n,n.id=85},function(t,e){(function(e){function n(t,e,n){var i=e&&n||0,r=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){r<16&&(e[i+r++]=c[t])});r<16;)e[i+r++]=0;return e}function i(t,e){var n=e||0,i=l;return i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]}function r(t,e,n){var r=e&&n||0,o=e||[];t=t||{};var s=void 0!==t.clockseq?t.clockseq:m,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),h=void 0!==t.nsecs?t.nsecs:y+1,u=a-v+(h-y)/1e4;if(u<0&&void 0===t.clockseq&&(s=s+1&16383),(u<0||a>v)&&void 0===t.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");v=a,y=h,m=s,a+=122192928e5;var l=(1e4*(268435455&a)+h)%4294967296;o[r++]=l>>>24&255,o[r++]=l>>>16&255,o[r++]=l>>>8&255,o[r++]=255&l;var c=a/4294967296*1e4&268435455;o[r++]=c>>>8&255,o[r++]=255&c,o[r++]=c>>>24&15|16,o[r++]=c>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var f=t.node||p,d=0;d<6;d++)o[r+d]=f[d];return e?e:i(o)}function o(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var o=t.random||(t.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;a++)e[r+a]=o[a];return e||i(o)}var s,a="undefined"!=typeof window?window:"undefined"!=typeof e?e:null;if(a&&a.crypto&&crypto.getRandomValues){var h=new Uint8Array(16);s=function(){return crypto.getRandomValues(h),h}}if(!s){var u=new Array(16);s=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),u[e]=t>>>((3&e)<<3)&255;return u}}for(var l=[],c={},f=0;f<256;f++)l[f]=(f+256).toString(16).substr(1),c[l[f]]=f;var d=s(),p=[1|d[0],d[1],d[2],d[3],d[4],d[5]],m=16383&(d[6]<<8|d[7]),v=0,y=0,g=o;g.v1=r,g.v4=o,g.parse=n,g.unparse=i,t.exports=g}).call(e,function(){return this}())},function(t,e){e.prepareElements=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e].redundant=t[e].used,t[e].used=[])},e.cleanupElements=function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e].redundant){for(var n=0;n0?(i=e[t].redundant[0],e[t].redundant.shift()):(i=document.createElementNS("http://www.w3.org/2000/svg",t),n.appendChild(i)):(i=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},n.appendChild(i)),e[t].used.push(i),i},e.getDOMElement=function(t,e,n,i){var r;return e.hasOwnProperty(t)?e[t].redundant.length>0?(r=e[t].redundant[0],e[t].redundant.shift()):(r=document.createElement(t),void 0!==i?n.insertBefore(r,i):n.appendChild(r)):(r=document.createElement(t),e[t]={used:[],redundant:[]},void 0!==i?n.insertBefore(r,i):n.appendChild(r)),e[t].used.push(r),r},e.drawPoint=function(t,n,i,r,o,s){var a;if("circle"==i.style?(a=e.getSVGElement("circle",r,o),a.setAttributeNS(null,"cx",t),a.setAttributeNS(null,"cy",n),a.setAttributeNS(null,"r",.5*i.size)):(a=e.getSVGElement("rect",r,o),a.setAttributeNS(null,"x",t-.5*i.size),a.setAttributeNS(null,"y",n-.5*i.size),a.setAttributeNS(null,"width",i.size),a.setAttributeNS(null,"height",i.size)),void 0!==i.styles&&a.setAttributeNS(null,"style",i.styles),a.setAttributeNS(null,"class",i.className+" vis-point"),s){var h=e.getSVGElement("text",r,o);s.xOffset&&(t+=s.xOffset),s.yOffset&&(n+=s.yOffset),s.content&&(h.textContent=s.content),s.className&&h.setAttributeNS(null,"class",s.className+" vis-label"),h.setAttributeNS(null,"x",t),h.setAttributeNS(null,"y",n)}return a},e.drawBar=function(t,n,i,r,o,s,a,h){if(0!=r){r<0&&(r*=-1,n-=r);var u=e.getSVGElement("rect",s,a);u.setAttributeNS(null,"x",t-.5*i),u.setAttributeNS(null,"y",n),u.setAttributeNS(null,"width",i),u.setAttributeNS(null,"height",r),u.setAttributeNS(null,"class",o),h&&u.setAttributeNS(null,"style",h)}}},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(t&&!Array.isArray(t)&&(e=t,t=null),this._options=e||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var n=(0,l.default)(this._options.type),i=0,r=n.length;ir?1:is)&&(o=h,s=u)}return o},r.prototype.min=function(t){var e,n,i=this._data,r=(0,l.default)(i),o=null,s=null;for(e=0,n=r.length;ethis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var t=this;this._timeout=setTimeout(function(){t.flush()},this.delay)}},n.prototype.flush=function(){for(;this._queue.length>0;){var t=this._queue.shift();t.fn.apply(t.context||t.fn,t.args||[])}},t.exports=n},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){this._data=null,this._ids={},this.length=0,this._options=e||{},this._fieldId="id",this._subscribers={};var n=this;this.listener=function(){n._onEvent.apply(n,arguments)},this.setData(t)}var o=n(58),s=i(o),a=n(1),h=n(88);r.prototype.setData=function(t){var e,n,i,r,o;if(this._data){for(this._data.off&&this._data.off("*",this.listener),e=this._data.getIds({filter:this._options&&this._options.filter}),o=[],i=0,r=e.length;i0&&(s[i-1].pointNext=s[i]);return s},r.prototype.create=function(){for(;this.containerElement.hasChildNodes();)this.containerElement.removeChild(this.containerElement.firstChild);this.frame=document.createElement("div"),this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas);var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(t),this.frame.filter=document.createElement("div"),this.frame.filter.style.position="absolute",this.frame.filter.style.bottom="0px",this.frame.filter.style.left="0px",this.frame.filter.style.width="100%",this.frame.appendChild(this.frame.filter);var e=this,n=function(t){e._onMouseDown(t)},i=function(t){e._onTouchStart(t)},r=function(t){e._onWheel(t)},o=function(t){e._onTooltip(t)},s=function(t){e._onClick(t)};l.addEventListener(this.frame.canvas,"mousedown",n),l.addEventListener(this.frame.canvas,"touchstart",i),l.addEventListener(this.frame.canvas,"mousewheel",r),l.addEventListener(this.frame.canvas,"mousemove",o),l.addEventListener(this.frame.canvas,"click",s),this.containerElement.appendChild(this.frame)},r.prototype._setSize=function(t,e){this.frame.style.width=t,this.frame.style.height=e,this._resizeCanvas()},r.prototype._resizeCanvas=function(){this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=this.frame.canvas.clientWidth,this.frame.canvas.height=this.frame.canvas.clientHeight,this.frame.filter.style.width=this.frame.canvas.clientWidth-20+"px"},r.prototype.animationStart=function(){if(!this.frame.filter||!this.frame.filter.slider)throw new Error("No animation available");this.frame.filter.slider.play()},r.prototype.animationStop=function(){this.frame.filter&&this.frame.filter.slider&&this.frame.filter.slider.stop()},r.prototype._resizeCenter=function(){"%"===this.xCenter.charAt(this.xCenter.length-1)?this.currentXCenter=parseFloat(this.xCenter)/100*this.frame.canvas.clientWidth:this.currentXCenter=parseFloat(this.xCenter),"%"===this.yCenter.charAt(this.yCenter.length-1)?this.currentYCenter=parseFloat(this.yCenter)/100*(this.frame.canvas.clientHeight-this.frame.filter.clientHeight):this.currentYCenter=parseFloat(this.yCenter)},r.prototype.getCameraPosition=function(){var t=this.camera.getArmRotation();return t.distance=this.camera.getArmLength(),t},r.prototype._readData=function(t){this._initializeData(t,this.style),this.dataFilter?this.dataPoints=this.dataFilter._getDataPoints():this.dataPoints=this._getDataPoints(this.dataGroup.getDataTable()),this._redrawFilter()},r.prototype.setData=function(t){this._readData(t),this.redraw(),this.animationAutoStart&&this.dataFilter&&this.animationStart()},r.prototype.setOptions=function(t){this.animationStop(),v.setOptions(t,this),this.setPointDrawingMethod(),this._setSize(this.width,this.height),this.dataGroup.reload(),this.animationAutoStart&&this.dataFilter&&this.animationStart()},r.prototype.setPointDrawingMethod=function(){var t=void 0;switch(this.style){case r.STYLE.BAR:t=r.prototype._redrawBarGraphPoint;break;case r.STYLE.BARCOLOR:t=r.prototype._redrawBarColorGraphPoint;break;case r.STYLE.BARSIZE:t=r.prototype._redrawBarSizeGraphPoint;break;case r.STYLE.DOT:t=r.prototype._redrawDotGraphPoint;break;case r.STYLE.DOTLINE:t=r.prototype._redrawDotLineGraphPoint;break;case r.STYLE.DOTCOLOR:t=r.prototype._redrawDotColorGraphPoint;break;case r.STYLE.DOTSIZE:t=r.prototype._redrawDotSizeGraphPoint;break;case r.STYLE.SURFACE:t=r.prototype._redrawSurfaceGraphPoint;break;case r.STYLE.GRID:t=r.prototype._redrawGridGraphPoint;break;case r.STYLE.LINE:t=r.prototype._redrawLineGraphPoint;break;default:throw new Error("Can not determine point drawing method for graph style '"+this.style+"'")}this._pointDrawingMethod=t},r.prototype.redraw=function(){if(void 0===this.dataPoints)throw new Error("Graph data not initialized");this._resizeCanvas(),this._resizeCenter(),this._redrawSlider(),this._redrawClear(),this._redrawAxis(),this._redrawDataGraph(),this._redrawInfo(),this._redrawLegend()},r.prototype._getContext=function(){var t=this.frame.canvas,e=t.getContext("2d");return e.lineJoin="round",e.lineCap="round",e},r.prototype._redrawClear=function(){var t=this.frame.canvas,e=t.getContext("2d");e.clearRect(0,0,t.width,t.height)},r.prototype._dotSize=function(){return this.frame.clientWidth*this.dotSizeRatio},r.prototype._getLegendWidth=function(){var t;if(this.style===r.STYLE.DOTSIZE){var e=this._dotSize();t=e*this.dotSizeMaxFraction}else t=this.style===r.STYLE.BARSIZE?this.xBarWidth:20;return t},r.prototype._redrawLegend=function(){if(this.showLegend===!0&&this.style!==r.STYLE.LINE&&this.style!==r.STYLE.BARSIZE){var t=this.style===r.STYLE.BARSIZE||this.style===r.STYLE.DOTSIZE,e=this.style===r.STYLE.DOTSIZE||this.style===r.STYLE.DOTCOLOR||this.style===r.STYLE.BARCOLOR,n=Math.max(.25*this.frame.clientHeight,100),i=this.margin,o=this._getLegendWidth(),s=this.frame.clientWidth-this.margin,a=s-o,h=i+n,u=this._getContext();if(u.lineWidth=1,u.font="14px arial",t===!1){var l,c=0,d=n;for(l=c;l0?(t.textAlign="center",t.textBaseline="top",o.y+=r):Math.sin(2*i)<0?(t.textAlign="right",t.textBaseline="middle"):(t.textAlign="left",t.textBaseline="middle"),t.fillStyle=this.axisColor,t.fillText(n,o.x,o.y)},r.prototype.drawAxisLabelY=function(t,e,n,i,r){void 0===r&&(r=0);var o=this._convert3Dto2D(e);Math.cos(2*i)<0?(t.textAlign="center",t.textBaseline="top",o.y+=r):Math.sin(2*i)>0?(t.textAlign="right",t.textBaseline="middle"):(t.textAlign="left",t.textBaseline="middle"),t.fillStyle=this.axisColor,t.fillText(n,o.x,o.y)},r.prototype.drawAxisLabelZ=function(t,e,n,i){void 0===i&&(i=0);var r=this._convert3Dto2D(e);t.textAlign="right",t.textBaseline="middle",t.fillStyle=this.axisColor,t.fillText(n,r.x-i,r.y)},r.prototype._line3d=function(t,e,n,i){var r=this._convert3Dto2D(e),o=this._convert3Dto2D(n);this._line(t,r,o,i)},r.prototype._redrawAxis=function(){var t,e,n,i,r,o,s,a,h,u,l,d=this._getContext();d.font=24/this.camera.getArmLength()+"px arial";var p=.025/this.scale.x,v=.025/this.scale.y,y=5/this.camera.getArmLength(),g=this.camera.getArmRotation().horizontal,_=new f(Math.cos(g),Math.sin(g)),w=this.xRange,x=this.yRange,b=this.zRange;for(d.lineWidth=1,i=void 0===this.defaultXStep,n=new m(w.min,w.max,this.xStep,i),n.start(!0);!n.end();){var S=n.getCurrent();if(this.showGrid?(t=new c(S,x.min,b.min),e=new c(S,x.max,b.min),this._line3d(d,t,e,this.gridColor)):this.showXAxis&&(t=new c(S,x.min,b.min),e=new c(S,x.min+p,b.min),this._line3d(d,t,e,this.axisColor),t=new c(S,x.max,b.min),e=new c(S,x.max-p,b.min),this._line3d(d,t,e,this.axisColor)),this.showXAxis){s=_.x>0?x.min:x.max;var T=new c(S,s,b.min),D=" "+this.xValueLabel(S)+" ";this.drawAxisLabelX(d,T,D,g,y)}n.next()}for(d.lineWidth=1,i=void 0===this.defaultYStep,n=new m(x.min,x.max,this.yStep,i),n.start(!0);!n.end();){var M=n.getCurrent();if(this.showGrid?(t=new c(w.min,M,b.min),e=new c(w.max,M,b.min),this._line3d(d,t,e,this.gridColor)):this.showYAxis&&(t=new c(w.min,M,b.min),e=new c(w.min+v,M,b.min),this._line3d(d,t,e,this.axisColor),t=new c(w.max,M,b.min),e=new c(w.max-v,M,b.min),this._line3d(d,t,e,this.axisColor)),this.showYAxis){o=_.y>0?w.min:w.max,T=new c(o,M,b.min);var D=" "+this.yValueLabel(M)+" ";this.drawAxisLabelY(d,T,D,g,y)}n.next()}if(this.showZAxis){for(d.lineWidth=1,i=void 0===this.defaultZStep,n=new m(b.min,b.max,this.zStep,i),n.start(!0),o=_.x>0?w.min:w.max,s=_.y<0?x.min:x.max;!n.end();){var k=n.getCurrent(),O=new c(o,s,k),E=this._convert3Dto2D(O);e=new f(E.x-y,E.y),this._line(d,E,e,this.axisColor);var D=this.zValueLabel(k)+" ";this.drawAxisLabelZ(d,O,D,5),n.next()}d.lineWidth=1,t=new c(o,s,b.min),e=new c(o,s,b.max),this._line3d(d,t,e,this.axisColor)}if(this.showXAxis){var C,P;d.lineWidth=1,C=new c(w.min,x.min,b.min),P=new c(w.max,x.min,b.min),this._line3d(d,C,P,this.axisColor),C=new c(w.min,x.max,b.min),P=new c(w.max,x.max,b.min),this._line3d(d,C,P,this.axisColor)}this.showYAxis&&(d.lineWidth=1,t=new c(w.min,x.min,b.min),e=new c(w.min,x.max,b.min),this._line3d(d,t,e,this.axisColor),t=new c(w.max,x.min,b.min),e=new c(w.max,x.max,b.min),this._line3d(d,t,e,this.axisColor));var L=this.xLabel;L.length>0&&this.showXAxis&&(l=.1/this.scale.y,o=(w.max+3*w.min)/4,s=_.x>0?x.min-l:x.max+l,r=new c(o,s,b.min),this.drawAxisLabelX(d,r,L,g));var Y=this.yLabel;Y.length>0&&this.showYAxis&&(u=.1/this.scale.x,o=_.y>0?w.min-u:w.max+u,s=(x.max+3*x.min)/4,r=new c(o,s,b.min),this.drawAxisLabelY(d,r,Y,g));var R=this.zLabel;R.length>0&&this.showZAxis&&(h=30,o=_.x>0?w.min:w.max,s=_.y<0?x.min:x.max,a=(b.max+3*b.min)/4,r=new c(o,s,a),this.drawAxisLabelZ(d,r,R,h))},r.prototype._hsv2rgb=function(t,e,n){var i,r,o,s,a,h;switch(s=n*e,a=Math.floor(t/60),h=s*(1-Math.abs(t/60%2-1)),a){case 0:i=s,r=h,o=0;break;case 1:i=h,r=s,o=0;break;case 2:i=0,r=s,o=h;break;case 3:i=0,r=h,o=s;break;case 4:i=h,r=0,o=s;break;case 5:i=s,r=0,o=h;break;default:i=0,r=0,o=0}return"RGB("+parseInt(255*i)+","+parseInt(255*r)+","+parseInt(255*o)+")"},r.prototype._getStrokeWidth=function(t){return void 0!==t?this.showPerspective?1/-t.trans.z*this.dataColor.strokeWidth:-(this.eye.z/this.camera.getArmLength())*this.dataColor.strokeWidth:this.dataColor.strokeWidth},r.prototype._redrawBar=function(t,e,n,i,r,o){var s,a,h=this,u=e.point,l=this.zRange.min,f=[{point:new c(u.x-n,u.y-i,u.z)},{point:new c(u.x+n,u.y-i,u.z)},{point:new c(u.x+n,u.y+i,u.z)},{point:new c(u.x-n,u.y+i,u.z)}],d=[{point:new c(u.x-n,u.y-i,l)},{point:new c(u.x+n,u.y-i,l)},{point:new c(u.x+n,u.y+i,l)},{point:new c(u.x-n,u.y+i,l)}];f.forEach(function(t){t.screen=h._convert3Dto2D(t.point)}),d.forEach(function(t){t.screen=h._convert3Dto2D(t.point)});var p=[{corners:f,center:c.avg(d[0].point,d[2].point)},{corners:[f[0],f[1],d[1],d[0]],center:c.avg(d[1].point,d[0].point)},{corners:[f[1],f[2],d[2],d[1]],center:c.avg(d[2].point,d[1].point)},{corners:[f[2],f[3],d[3],d[2]],center:c.avg(d[3].point,d[2].point)},{corners:[f[3],f[0],d[0],d[3]],center:c.avg(d[0].point,d[3].point)}];for(e.surfaces=p,s=0;s0}if(a){var d,p=(e.point.z+n.point.z+i.point.z+r.point.z)/4,m=240*(1-(p-this.zRange.min)*this.scale.z/this.verticalRatio),v=1;this.showShadow?(d=Math.min(1+l.x/f/2,1),o=this._hsv2rgb(m,v,d),s=o):(d=1,o=this._hsv2rgb(m,v,d),s=this.axisColor)}else o="gray",s=this.axisColor;t.lineWidth=this._getStrokeWidth(e);var y=[e,n,r,i];this._polygon(t,y,o,s)}},r.prototype._drawGridLine=function(t,e,n){if(void 0!==e&&void 0!==n){var i=(e.point.z+n.point.z)/2,r=240*(1-(i-this.zRange.min)*this.scale.z/this.verticalRatio);t.lineWidth=2*this._getStrokeWidth(e),t.strokeStyle=this._hsv2rgb(r,1,1),this._line(t,e.screen,n.screen)}},r.prototype._redrawGridGraphPoint=function(t,e){this._drawGridLine(t,e,e.pointRight),this._drawGridLine(t,e,e.pointTop)},r.prototype._redrawLineGraphPoint=function(t,e){void 0!==e.pointNext&&(t.lineWidth=this._getStrokeWidth(e),t.strokeStyle=this.dataColor.stroke,this._line(t,e.screen,e.pointNext.screen))},r.prototype._redrawDataGraph=function(){var t,e=this._getContext();if(!(void 0===this.dataPoints||this.dataPoints.length<=0))for(this._calcTranslations(this.dataPoints),t=0;t0?1:t<0?-1:0}var i=e[0],r=e[1],o=e[2],s=n((r.x-i.x)*(t.y-i.y)-(r.y-i.y)*(t.x-i.x)),a=n((o.x-r.x)*(t.y-r.y)-(o.y-r.y)*(t.x-r.x)),h=n((i.x-o.x)*(t.y-o.y)-(i.y-o.y)*(t.x-o.x));return!(0!=s&&0!=a&&s!=a||0!=a&&0!=h&&a!=h||0!=s&&0!=h&&s!=h)},r.prototype._dataPointFromXY=function(t,e){var n,i=100,o=null,s=null,a=null,h=new f(t,e);if(this.style===r.STYLE.BAR||this.style===r.STYLE.BARCOLOR||this.style===r.STYLE.BARSIZE)for(n=this.dataPoints.length-1;n>=0;n--){o=this.dataPoints[n];var u=o.surfaces;if(u)for(var l=u.length-1;l>=0;l--){var c=u[l],d=c.corners,p=[d[0].screen,d[1].screen,d[2].screen],m=[d[2].screen,d[3].screen,d[0].screen];if(this._insideTriangle(h,p)||this._insideTriangle(h,m))return o}}else for(n=0;n"+this.xLabel+":"+t.point.x+""+this.yLabel+":"+t.point.y+""+this.zLabel+":"+t.point.z+"",e.style.left="0",e.style.top="0",this.frame.appendChild(e),this.frame.appendChild(n),this.frame.appendChild(i);var r=e.offsetWidth,o=e.offsetHeight,s=n.offsetHeight,a=i.offsetWidth,u=i.offsetHeight,l=t.screen.x-r/2;l=Math.min(Math.max(l,10),this.frame.clientWidth-10-r),n.style.left=t.screen.x+"px",n.style.top=t.screen.y-s+"px",e.style.left=l+"px",e.style.top=t.screen.y-s-o+"px",i.style.left=t.screen.x-a/2+"px",i.style.top=t.screen.y-u/2+"px"},r.prototype._hideTooltip=function(){if(this.tooltip){this.tooltip.dataPoint=null;for(var t in this.tooltip.dom)if(this.tooltip.dom.hasOwnProperty(t)){var e=this.tooltip.dom[t];e&&e.parentNode&&e.parentNode.removeChild(e)}}},r.prototype.setCameraPosition=function(t){v.setCameraPosition(t,this),this.redraw()},r.prototype.setSize=function(t,e){this._setSize(t,e),this.redraw()},t.exports=r},function(t,e,n){t.exports={default:n(95),__esModule:!0}},function(t,e,n){n(96),t.exports=n(17).Object.assign},function(t,e,n){var i=n(15);i(i.S+i.F,"Object",{assign:n(97)})},function(t,e,n){var i=n(35),r=n(73),o=n(74),s=n(49),a=n(10),h=Object.assign;t.exports=!h||n(26)(function(){var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(t){e[t]=t}),7!=h({},t)[n]||Object.keys(h({},e)).join("")!=i})?function(t,e){for(var n=s(t),h=arguments.length,u=1,l=r.f,c=o.f;h>u;)for(var f,d=a(arguments[u++]),p=l?i(d).concat(l(d)):i(d),m=p.length,v=0;m>v;)c.call(d,f=p[v++])&&(n[f]=d[f]);return n}:h},function(t,e){function n(t){if(t)return i(t)}function i(t){for(var e in n.prototype)t[e]=n.prototype[e]; -return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){i.off(t,n),e.apply(this,arguments)}var i=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var i,r=0;ro&&(t=i(t)*o),n(e)>o&&(e=i(e)*o),this.cameraOffset.x=t,this.cameraOffset.y=e,this.calculateCameraOrientation()},r.prototype.getOffset=function(t,e){return this.cameraOffset},r.prototype.setArmLocation=function(t,e,n){this.armLocation.x=t,this.armLocation.y=e,this.armLocation.z=n,this.calculateCameraOrientation()},r.prototype.setArmRotation=function(t,e){void 0!==t&&(this.armRotation.horizontal=t),void 0!==e&&(this.armRotation.vertical=e,this.armRotation.vertical<0&&(this.armRotation.vertical=0),this.armRotation.vertical>.5*Math.PI&&(this.armRotation.vertical=.5*Math.PI)),void 0===t&&void 0===e||this.calculateCameraOrientation()},r.prototype.getArmRotation=function(){var t={};return t.horizontal=this.armRotation.horizontal,t.vertical=this.armRotation.vertical,t},r.prototype.setArmLength=function(t){void 0!==t&&(this.armLength=t,this.armLength<.71&&(this.armLength=.71),this.armLength>5&&(this.armLength=5),this.setOffset(this.cameraOffset.x,this.cameraOffset.y),this.calculateCameraOrientation())},r.prototype.getArmLength=function(){return this.armLength},r.prototype.getCameraLocation=function(){return this.cameraLocation},r.prototype.getCameraRotation=function(){return this.cameraRotation},r.prototype.calculateCameraOrientation=function(){this.cameraLocation.x=this.armLocation.x-this.armLength*Math.sin(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.y=this.armLocation.y-this.armLength*Math.cos(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.z=this.armLocation.z+this.armLength*Math.sin(this.armRotation.vertical),this.cameraRotation.x=Math.PI/2-this.armRotation.vertical,this.cameraRotation.y=0,this.cameraRotation.z=-this.armRotation.horizontal;var t=this.cameraRotation.x,e=(this.cameraRotation.y,this.cameraRotation.z),n=this.cameraOffset.x,i=this.cameraOffset.y,r=Math.sin,o=Math.cos;this.cameraLocation.x=this.cameraLocation.x+n*o(e)+i*-r(e)*o(t),this.cameraLocation.y=this.cameraLocation.y+n*r(e)+i*o(e)*o(t),this.cameraLocation.z=this.cameraLocation.z+i*r(t)},t.exports=r},function(t,e,n){t.exports={default:n(103),__esModule:!0}},function(t,e,n){n(104),t.exports=n(17).Math.sign},function(t,e,n){var i=n(15);i(i.S,"Math",{sign:n(105)})},function(t,e){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,e,n){function i(t,e,n){this.data=t.getDataSet(),this.column=e,this.graph=n,this.index=void 0,this.value=void 0,this.values=t.getDistinctValues(this.column),this.values.length>0&&this.selectValue(0),this.dataPoints=[],this.loaded=!1,this.onLoadCallback=void 0,n.animationPreload?(this.loaded=!1,this.loadInBackground()):this.loaded=!0}var r=n(92);i.prototype.isLoaded=function(){return this.loaded},i.prototype.getLoadedProgress=function(){for(var t=this.values.length,e=0;this.dataPoints[e];)e++;return Math.round(e/t*100)},i.prototype.getLabel=function(){return this.graph.filterLabel},i.prototype.getColumn=function(){return this.column},i.prototype.getSelectedValue=function(){if(void 0!==this.index)return this.values[this.index]},i.prototype.getValues=function(){return this.values},i.prototype.getValue=function(t){if(t>=this.values.length)throw new Error("Index out of range");return this.values[t]},i.prototype._getDataPoints=function(t){if(void 0===t&&(t=this.index),void 0===t)return[];var e;if(this.dataPoints[t])e=this.dataPoints[t];else{var n={};n.column=this.column,n.value=this.values[t];var i=new r(this.data,{filter:function(t){return t[n.column]==n.value}}).get();e=this.graph._getDataPoints(i),this.dataPoints[t]=e}return e},i.prototype.setOnLoadCallback=function(t){this.onLoadCallback=t},i.prototype.selectValue=function(t){if(t>=this.values.length)throw new Error("Index out of range");this.index=t,this.value=this.values[t]},i.prototype.loadInBackground=function(t){void 0===t&&(t=0);var e=this.graph.frame;if(t0&&(t--,this.setIndex(t))},i.prototype.next=function(){var t=this.getIndex();t0?this.setIndex(0):this.index=void 0},i.prototype.setIndex=function(t){if(!(tthis.values.length-1&&(i=this.values.length-1),i},i.prototype.indexToLeft=function(t){var e=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10,n=t/(this.values.length-1)*e,i=n+3;return i},i.prototype._onMouseMove=function(t){var e=t.clientX-this.startClientX,n=this.startSlideX+e,i=this.leftToIndex(n);this.setIndex(i),r.preventDefault()},i.prototype._onMouseUp=function(t){this.frame.style.cursor="auto",r.removeEventListener(document,"mousemove",this.onmousemove),r.removeEventListener(document,"mouseup",this.onmouseup),r.preventDefault()},t.exports=i},function(t,e){function n(t,e,n,i){this._start=0,this._end=0,this._step=1,this.prettyStep=!0,this.precision=5,this._current=0,this.setRange(t,e,n,i)}n.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},n.prototype.setRange=function(t,e,n,i){if(!this.isNumeric(t))throw new Error("Parameter 'start' is not numeric; value: "+t);if(!this.isNumeric(e))throw new Error("Parameter 'end' is not numeric; value: "+t);if(!this.isNumeric(n))throw new Error("Parameter 'step' is not numeric; value: "+t);this._start=t?t:0,this._end=e?e:0,this.setStep(n,i)},n.prototype.setStep=function(t,e){void 0===t||t<=0||(void 0!==e&&(this.prettyStep=e),this.prettyStep===!0?this._step=n.calculatePrettyStep(t):this._step=t)},n.calculatePrettyStep=function(t){var e=function(t){return Math.log(t)/Math.LN10},n=Math.pow(10,Math.round(e(t))),i=2*Math.pow(10,Math.round(e(t/2))),r=5*Math.pow(10,Math.round(e(t/5))),o=n;return Math.abs(i-t)<=Math.abs(o-t)&&(o=i),Math.abs(r-t)<=Math.abs(o-t)&&(o=r),o<=0&&(o=1),o},n.prototype.getCurrent=function(){return parseFloat(this._current.toPrecision(this.precision))},n.prototype.getStep=function(){return this._step},n.prototype.start=function(t){void 0===t&&(t=!1),this._current=this._start-this._start%this._step,t&&this.getCurrent()this._end},t.exports=n},function(t,e){function n(){this.min=void 0,this.max=void 0}n.prototype.adjust=function(t){void 0!==t&&((void 0===this.min||this.min>t)&&(this.min=t),(void 0===this.max||this.maxn)throw new Error("Passed expansion value makes range invalid");this.min=e,this.max=n}},n.prototype.range=function(){return this.max-this.min},n.prototype.center=function(){return(this.min+this.max)/2},t.exports=n},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}function r(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function o(t){return void 0===t||""===t||"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function s(t,e){return void 0===t||""===t?e:t+o(e)}function a(t,e,n,i){var r,o;for(var a in n)r=n[a],o=s(i,r),e[o]=t[r]}function h(t,e,n,i){var r,o;for(var a in n)r=n[a],void 0!==t[r]&&(o=s(i,r),e[o]=t[r])}function u(t,e){if(void 0===t||r(t))throw new Error("No DEFAULTS passed");if(void 0===e)throw new Error("No dst passed");O=t,a(t,e,M),a(t,e,k,"default"),c(t,e),e.margin=10,e.showGrayBottom=!1,e.showTooltip=!1,e.onclick_callback=null,e.eye=new S(0,0,-1)}function l(t,e){if(void 0!==t){if(void 0===e)throw new Error("No dst passed");if(void 0===O||r(O))throw new Error("DEFAULTS not set for module Settings");h(t,e,M),h(t,e,k,"default"),c(t,e)}}function c(t,e){void 0!==t.backgroundColor&&v(t.backgroundColor,e),y(t.dataColor,e),m(t.style,e),f(t.showLegend,e),g(t.cameraPosition,e),void 0!==t.tooltip&&(e.showTooltip=t.tooltip),void 0!=t.onclick&&(e.onclick_callback=t.onclick),void 0!==t.tooltipStyle&&x.selectiveDeepExtend(["tooltipStyle"],e,t)}function f(t,e){if(void 0===t){var n=void 0===O.showLegend;if(n){var i=e.style===T.DOTCOLOR||e.style===T.DOTSIZE;e.showLegend=i}}else e.showLegend=t}function d(t){var e=D[t];return void 0===e?-1:e}function p(t){var e=!1;for(var n in T)if(T[n]===t){e=!0;break}return e}function m(t,e){if(void 0!==t){var n;if("string"==typeof t){if(n=d(t),n===-1)throw new Error("Style '"+t+"' is invalid")}else{if(!p(t))throw new Error("Style '"+t+"' is invalid");n=t}e.style=n}}function v(t,e){var n="white",i="gray",r=1;if("string"==typeof t)n=t,i="none",r=0;else{if("object"!==("undefined"==typeof t?"undefined":(0,w.default)(t)))throw new Error("Unsupported type of backgroundColor");void 0!==t.fill&&(n=t.fill),void 0!==t.stroke&&(i=t.stroke),void 0!==t.strokeWidth&&(r=t.strokeWidth)}e.frame.style.backgroundColor=n,e.frame.style.borderColor=i,e.frame.style.borderWidth=r+"px",e.frame.style.borderStyle="solid"}function y(t,e){void 0!==t&&(void 0===e.dataColor&&(e.dataColor={}),"string"==typeof t?(e.dataColor.fill=t,e.dataColor.stroke=t):(t.fill&&(e.dataColor.fill=t.fill),t.stroke&&(e.dataColor.stroke=t.stroke),void 0!==t.strokeWidth&&(e.dataColor.strokeWidth=t.strokeWidth)))}function g(t,e){var n=t;void 0!==n&&(void 0===e.camera&&(e.camera=new b),e.camera.setArmRotation(n.horizontal,n.vertical),e.camera.setArmLength(n.distance))}var _=n(62),w=i(_),x=n(1),b=n(101),S=n(99),T={BAR:0,BARCOLOR:1,BARSIZE:2,DOT:3,DOTLINE:4,DOTCOLOR:5,DOTSIZE:6,GRID:7,LINE:8,SURFACE:9},D={dot:T.DOT,"dot-line":T.DOTLINE,"dot-color":T.DOTCOLOR,"dot-size":T.DOTSIZE,line:T.LINE,grid:T.GRID,surface:T.SURFACE,bar:T.BAR,"bar-color":T.BARCOLOR,"bar-size":T.BARSIZE},M=["width","height","filterLabel","legendLabel","xLabel","yLabel","zLabel","xValueLabel","yValueLabel","zValueLabel","showXAxis","showYAxis","showZAxis","showGrid","showPerspective","showShadow","keepAspectRatio","verticalRatio","dotSizeRatio","dotSizeMinFraction","dotSizeMaxFraction","showAnimationControls","animationInterval","animationPreload","animationAutoStart","axisColor","gridColor","xCenter","yCenter"],k=["xBarWidth","yBarWidth","valueMin","valueMax","xMin","xMax","xStep","yMin","yMax","yStep","zMin","zMax","zStep"],O=void 0;t.exports.STYLE=T,t.exports.setDefaults=u,t.exports.setOptions=l,t.exports.setCameraPosition=g},function(t,e,n){function i(){this.dataTable=null}var r=n(88),o=n(92),s=(n(99),n(109));i.prototype.initializeData=function(t,e,n){if(this.dataSet&&this.dataSet.off("*",this._onChange),void 0!==e){Array.isArray(e)&&(e=new r(e));var i;if(!(e instanceof r||e instanceof o))throw new Error("Array, DataSet, or DataView expected");if(i=e.get(),0!=i.length){this.dataSet=e,this.dataTable=i;var s=this;this._onChange=function(){t.setData(s.dataSet)},this.dataSet.on("*",this._onChange),this.colX="x",this.colY="y",this.colZ="z";var a=t.hasBars(n);if(a&&(void 0!==t.defaultXBarWidth?this.xBarWidth=t.defaultXBarWidth:this.xBarWidth=this.getSmallestDifference(i,this.colX)||1,void 0!==t.defaultYBarWidth?this.yBarWidth=t.defaultYBarWidth:this.yBarWidth=this.getSmallestDifference(i,this.colY)||1),this._initializeRange(i,this.colX,t,a),this._initializeRange(i,this.colY,t,a),this._initializeRange(i,this.colZ,t,!1),i[0].hasOwnProperty("style")){this.colValue="style";var h=this.getColumnRange(i,this.colValue);this._setRangeDefaults(h,t.defaultValueMin,t.defaultValueMax),this.valueRange=h}}}},i.prototype._collectRangeSettings=function(t,e){var n=["x","y","z"].indexOf(t);if(n==-1)throw new Error("Column '"+t+"' invalid");var i=t.toUpperCase();return{barWidth:this[t+"BarWidth"],min:e["default"+i+"Min"],max:e["default"+i+"Max"],step:e["default"+i+"Step"],range_label:t+"Range",step_label:t+"Step"}},i.prototype._initializeRange=function(t,e,n,i){var r=5,o=this._collectRangeSettings(e,n),s=this.getColumnRange(t,e);i&&"z"!=e&&s.expand(o.barWidth/2),this._setRangeDefaults(s,o.min,o.max),this[o.range_label]=s,this[o.step_label]=void 0!==o.step?o.step:s.range()/r},i.prototype.getDistinctValues=function(t,e){void 0===e&&(e=this.dataTable);for(var n=[],i=0;io)&&(i=o)}return i},i.prototype.getColumnRange=function(t,e){for(var n=new s,i=0;i0?u._handlers[t]=i:(n.off(t,o),delete u._handlers[t]))}),u},u.emit=function(e,i){t=i.target,n.emit(e,i)},u.destroy=function(){var t=n.element.hammer,e=t.indexOf(u);e!==-1&&t.splice(e,1),t.length||delete n.element.hammer,u._handlers={},n.destroy()},u}})},function(t,e,n){var i;/*! Hammer.JS - v2.0.7 - 2016-04-22 - * http://hammerjs.github.io/ - * - * Copyright (c) 2016 Jorik Tangelder; - * Licensed under the MIT license */ -!function(r,o,s,a){function h(t,e,n){return setTimeout(d(t,n),e)}function u(t,e,n){return!!Array.isArray(t)&&(l(t,n[e],n),!0)}function l(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==a)for(i=0;i\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),t.apply(this,arguments)}}function f(t,e,n){var i,r=e.prototype;i=t.prototype=Object.create(r),i.constructor=t,i._super=r,n&&mt(i,n)}function d(t,e){return function(){return t.apply(e,arguments)}}function p(t,e){return typeof t==gt?t.apply(e?e[0]||a:a,e):t}function m(t,e){return t===a?e:t}function v(t,e,n){l(w(e),function(e){t.addEventListener(e,n,!1)})}function y(t,e,n){l(w(e),function(e){t.removeEventListener(e,n,!1)})}function g(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function _(t,e){return t.indexOf(e)>-1}function w(t){return t.trim().split(/\s+/g)}function x(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;in[e]}):i.sort()),i}function T(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o1&&!n.firstMultiple?n.firstMultiple=Y(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,h=e.center=R(i);e.timeStamp=xt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=N(a,h),e.distance=z(a,h),P(n,e),e.offsetDirection=I(e.deltaX,e.deltaY);var u=A(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=u.x,e.overallVelocityY=u.y,e.overallVelocity=wt(u.x)>wt(u.y)?u.x:u.y,e.scale=s?F(s.pointers,i):1,e.rotation=s?W(s.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,L(n,e);var l=t.element;g(e.srcEvent.target,l)&&(l=e.srcEvent.target),e.target=l}function P(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==Rt&&o.eventType!==It||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function L(t,e){var n,i,r,o,s=t.lastInterval||e,h=e.timeStamp-s.timeStamp;if(e.eventType!=zt&&(h>Yt||s.velocity===a)){var u=e.deltaX-s.deltaX,l=e.deltaY-s.deltaY,c=A(h,u,l);i=c.x,r=c.y,n=wt(c.x)>wt(c.y)?c.x:c.y,o=I(u,l),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}function Y(t){for(var e=[],n=0;n=wt(e)?t<0?Wt:Ft:e<0?jt:Gt}function z(t,e,n){n||(n=Ht);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function N(t,e,n){n||(n=Ht);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function W(t,e){return N(e[1],e[0],Xt)+N(t[1],t[0],Xt)}function F(t,e){return z(e[0],e[1],Xt)/z(t[0],t[1],Xt)}function j(){this.evEl=qt,this.evWin=$t,this.pressed=!1,k.apply(this,arguments)}function G(){this.evEl=Kt,this.evWin=te,k.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function V(){this.evTarget=ne,this.evWin=ie,this.started=!1,k.apply(this,arguments)}function B(t,e){var n=b(t.touches),i=b(t.changedTouches);return e&(It|zt)&&(n=S(n.concat(i),"identifier",!0)),[n,i]}function U(){this.evTarget=oe,this.targetIds={},k.apply(this,arguments)}function H(t,e){var n=b(t.touches),i=this.targetIds;if(e&(Rt|At)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=b(t.changedTouches),a=[],h=this.target;if(o=n.filter(function(t){return g(t.target,h)}),e===Rt)for(r=0;r-1&&i.splice(t,1)};setTimeout(r,se)}}function $(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){n.manager.emit(e,t)}var n=this,i=this.state;i=we&&e(n.options.event+et(i))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=Se)},canEmit:function(){for(var t=0;te.threshold&&r&e.direction},attrTest:function(t){return rt.prototype.attrTest.call(this,t)&&(this.state&ge||!(this.state&ge)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=nt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),f(st,rt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[de]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ge)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),f(at,tt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ce]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distancee.time;if(this._input=t,!i||!n||t.eventType&(It|zt)&&!r)this.reset();else if(t.eventType&Rt)this.reset(),this._timer=h(function(){this.state=xe,this.tryEmit()},e.time,this);else if(t.eventType&It)return xe;return Se},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===xe&&(t&&t.eventType&It?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=xt(),this.manager.emit(this.options.event,this._input)))}}),f(ht,rt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[de]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ge)}}),f(ut,rt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Vt|Bt,pointers:1},getTouchAction:function(){return ot.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(Vt|Bt)?e=t.overallVelocity:n&Vt?e=t.overallVelocityX:n&Bt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&wt(e)>this.options.velocity&&t.eventType&It},emit:function(t){var e=nt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),f(lt,tt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[fe]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance2&&void 0!==arguments[2]&&arguments[2];for(var o in t)void 0!==n[o]&&(null===n[o]||"object"!==(0,d.default)(n[o])?r(t,n,o,i):"object"===(0,d.default)(t[o])&&e.fillIfDefined(t[o],n[o],i))},e.extend=function(t,e){for(var n=1;n3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(i))throw new TypeError("Arrays are not supported by deepExtend");for(var s=0;s3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(i))throw new TypeError("Arrays are not supported by deepExtend");for(var s in i)if(i.hasOwnProperty(s)&&-1===t.indexOf(s))if(i[s]&&i[s].constructor===Object)void 0===n[s]&&(n[s]={}),n[s].constructor===Object?e.deepExtend(n[s],i[s]):r(n,i,s,o);else if(Array.isArray(i[s])){n[s]=[];for(var a=0;a2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var s in n)if(n.hasOwnProperty(s)||!0===i)if(n[s]&&n[s].constructor===Object)void 0===t[s]&&(t[s]={}),t[s].constructor===Object?e.deepExtend(t[s],n[s],i):r(t,n,s,o);else if(Array.isArray(n[s])){t[s]=[];for(var a=0;a=0&&(e="DOMMouseScroll"),t.addEventListener(e,n,i)):t.attachEvent("on"+e,n)},e.removeEventListener=function(t,e,n,i){t.removeEventListener?(void 0===i&&(i=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,n,i)):t.detachEvent("on"+e,n)},e.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},e.hasParent=function(t,e){for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1},e.option={},e.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},e.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},e.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},e.option.asSize=function(t,n){return"function"==typeof t&&(t=t()),e.isString(t)?t:e.isNumber(t)?t+"px":n||null},e.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},e.hexToRGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,n,i){return e+e+n+n+i+i});var n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null},e.overrideOpacity=function(t,n){var i;return-1!=t.indexOf("rgba")?t:-1!=t.indexOf("rgb")?(i=t.substr(t.indexOf("(")+1).replace(")","").split(","),"rgba("+i[0]+","+i[1]+","+i[2]+","+n+")"):(i=e.hexToRGB(t),null==i?t:"rgba("+i.r+","+i.g+","+i.b+","+n+")")},e.RGBToHex=function(t,e,n){return"#"+((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},e.parseColor=function(t){var n;if(!0===e.isString(t)){if(!0===e.isValidRGB(t)){var i=t.substr(4).substr(0,t.length-5).split(",").map(function(t){return parseInt(t)});t=e.RGBToHex(i[0],i[1],i[2])}if(!0===e.isValidHex(t)){var r=e.hexToHSV(t),o={h:r.h,s:.8*r.s,v:Math.min(1,1.02*r.v)},s={h:r.h,s:Math.min(1,1.25*r.s),v:.8*r.v},a=e.HSVToHex(s.h,s.s,s.v),u=e.HSVToHex(o.h,o.s,o.v);n={background:t,border:a,highlight:{background:u,border:a},hover:{background:u,border:a}}}else n={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else n={},n.background=t.background||void 0,n.border=t.border||void 0,e.isString(t.highlight)?n.highlight={border:t.highlight,background:t.highlight}:(n.highlight={},n.highlight.background=t.highlight&&t.highlight.background||void 0,n.highlight.border=t.highlight&&t.highlight.border||void 0),e.isString(t.hover)?n.hover={border:t.hover,background:t.hover}:(n.hover={},n.hover.background=t.hover&&t.hover.background||void 0,n.hover.border=t.hover&&t.hover.border||void 0);return n},e.RGBToHSV=function(t,e,n){t/=255,e/=255,n/=255;var i=Math.min(t,Math.min(e,n)),r=Math.max(t,Math.max(e,n));if(i==r)return{h:0,s:0,v:i};var o=t==i?e-n:n==i?t-e:n-t;return{h:60*((t==i?3:n==i?1:5)-o/(r-i))/360,s:(r-i)/r,v:r}};var v={split:function(t){var e={};return t.split(";").forEach(function(t){if(""!=t.trim()){var n=t.split(":"),i=n[0].trim(),r=n[1].trim();e[i]=r}}),e},join:function(t){return(0,l.default)(t).map(function(e){return e+": "+t[e]}).join("; ")}};e.addCssText=function(t,n){var i=v.split(t.style.cssText),r=v.split(n),o=e.extend(i,r);t.style.cssText=v.join(o)},e.removeCssText=function(t,e){var n=v.split(t.style.cssText),i=v.split(e);for(var r in i)i.hasOwnProperty(r)&&delete n[r];t.style.cssText=v.join(n)},e.HSVToRGB=function(t,e,n){var i,r,o,s=Math.floor(6*t),a=6*t-s,u=n*(1-e),h=n*(1-a*e),l=n*(1-(1-a)*e);switch(s%6){case 0:i=n,r=l,o=u;break;case 1:i=h,r=n,o=u;break;case 2:i=u,r=n,o=l;break;case 3:i=u,r=h,o=n;break;case 4:i=l,r=u,o=n;break;case 5:i=n,r=u,o=h}return{r:Math.floor(255*i),g:Math.floor(255*r),b:Math.floor(255*o)}},e.HSVToHex=function(t,n,i){var r=e.HSVToRGB(t,n,i);return e.RGBToHex(r.r,r.g,r.b)},e.hexToHSV=function(t){var n=e.hexToRGB(t);return e.RGBToHSV(n.r,n.g,n.b)},e.isValidHex=function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},e.isValidRGB=function(t){return t=t.replace(" ",""),/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t)},e.isValidRGBA=function(t){return t=t.replace(" ",""),/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(t)},e.selectiveBridgeObject=function(t,n){if(null!==n&&"object"===(void 0===n?"undefined":(0,d.default)(n))){for(var i=(0,u.default)(n),r=0;r0&&e(i,t[r-1])<0;r--)t[r]=t[r-1];t[r]=i}return t},e.mergeOptions=function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=function(t){return null!==t&&void 0!==t},o=function(t){return null!==t&&"object"===(void 0===t?"undefined":(0,d.default)(t))};if(!o(t))throw new Error("Parameter mergeTarget must be an object");if(!o(e))throw new Error("Parameter options must be an object");if(!r(n))throw new Error("Parameter option must have a value");if(!o(i))throw new Error("Parameter globalOptions must be an object");var s=e[n],a=o(i)&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(i),h=a?i[n]:void 0,l=h?h.enabled:void 0;if(void 0!==s){if("boolean"==typeof s)return o(t[n])||(t[n]={}),void(t[n].enabled=s);if(null===s&&!o(t[n])){if(!r(h))return;t[n]=(0,u.default)(h)}if(o(s)){var c=!0;void 0!==s.enabled?c=s.enabled:void 0!==l&&(c=h.enabled),function(t,e,n){o(t[n])||(t[n]={});var i=e[n],r=t[n];for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])}(t,e,n),t[n].enabled=c}}},e.binarySearchCustom=function(t,e,n,i){for(var r=0,o=0,s=t.length-1;o<=s&&r<1e4;){var a=Math.floor((o+s)/2),u=t[a],h=void 0===i?u[n]:u[n][i],l=e(h);if(0==l)return a;-1==l?o=a+1:s=a-1,r++}return-1},e.binarySearchValue=function(t,e,n,i,r){var o,s,a,u,h=0,l=0,c=t.length-1;for(r=void 0!=r?r:function(t,e){return t==e?0:t0)return"before"==i?Math.max(0,u-1):u;if(r(s,e)<0&&r(a,e)>0)return"before"==i?u:Math.min(t.length-1,u+1);r(s,e)<0?l=u+1:c=u-1,h++}return-1},e.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},e.getScrollBarWidth=function(){var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var n=t.offsetWidth;e.style.overflow="scroll";var i=t.offsetWidth;return n==i&&(i=e.clientWidth),document.body.removeChild(e),n-i},e.topMost=function(t,e){var n=void 0;Array.isArray(e)||(e=[e]);var i=!0,r=!1,o=void 0;try{for(var a,u=(0,s.default)(t);!(i=(a=u.next()).done);i=!0){var h=a.value;if(h){n=h[e[0]];for(var l=1;ldocument.F=Object<\/script>"),t.close(),u=t.F;i--;)delete u.prototype[o[i]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=i(t),n=new a,a.prototype=null,n[s]=t):n=u(),void 0===e?n:r(n,e)}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e,n){var i=n(28)("keys"),r=n(17);t.exports=function(t){return i[t]||(i[t]=r(t))}},function(t,e,n){var i=n(1),r=i["__core-js_shared__"]||(i["__core-js_shared__"]={});t.exports=function(t){return r[t]||(r[t]={})}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,n){var i=n(5).f,r=n(7),o=n(2)("toStringTag");t.exports=function(t,e,n){t&&!r(t=n?t:t.prototype,o)&&i(t,o,{configurable:!0,value:e})}},function(t,e,n){var i=n(22);t.exports=function(t){return Object(i(t))}},function(t,e,n){e.f=n(2)},function(t,e,n){var i=n(1),r=n(0),o=n(23),s=n(32),a=n(5).f;t.exports=function(t){var e=r.Symbol||(r.Symbol=o?{}:i.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:s.f(t)})}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(t&&!Array.isArray(t)&&(e=t,t=null),this._options=e||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var n=(0,l.default)(this._options.type),i=0,r=n.length;ir?1:is)&&(o=u,s=h)}return o},r.prototype.min=function(t){var e,n,i=this._data,r=(0,l.default)(i),o=null,s=null;for(e=0,n=r.length;eu;)i(a,n=e[u++])&&(~o(h,n)||h.push(n));return h}},function(t,e,n){var i=n(71)(!0);n(39)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})})},function(t,e,n){var i=n(43),r=n(29).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,r)}},function(t,e,n){t.exports="undefined"!=typeof window&&window.moment||n(94)},function(t,e,n){t.exports={default:n(100),__esModule:!0}},function(t,e,n){function i(t){this.delay=null,this.max=1/0,this._queue=[],this._timeout=null,this._extended=null,this.setOptions(t)}i.prototype.setOptions=function(t){t&&void 0!==t.delay&&(this.delay=t.delay),t&&void 0!==t.max&&(this.max=t.max),this._flushIfNeeded()},i.extend=function(t,e){var n=new i(e);if(void 0!==t.flush)throw new Error("Target object already has a property flush");t.flush=function(){n.flush()};var r=[{name:"flush",original:void 0}];if(e&&e.replace)for(var o=0;othis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var t=this;this._timeout=setTimeout(function(){t.flush()},this.delay)}},i.prototype.flush=function(){for(;this._queue.length>0;){var t=this._queue.shift();t.fn.apply(t.context||t.fn,t.args||[])}},t.exports=i},function(t,e,n){function i(t,e){this.x=void 0!==t?t:0,this.y=void 0!==e?e:0}t.exports=i},function(t,e,n){function i(t,e){if(void 0===t)throw new Error("No container element defined");if(this.container=t,this.visible=!e||void 0==e.visible||e.visible,this.visible){this.frame=document.createElement("DIV"),this.frame.style.width="100%",this.frame.style.position="relative",this.container.appendChild(this.frame),this.frame.prev=document.createElement("INPUT"),this.frame.prev.type="BUTTON",this.frame.prev.value="Prev",this.frame.appendChild(this.frame.prev),this.frame.play=document.createElement("INPUT"),this.frame.play.type="BUTTON",this.frame.play.value="Play",this.frame.appendChild(this.frame.play),this.frame.next=document.createElement("INPUT"),this.frame.next.type="BUTTON",this.frame.next.value="Next",this.frame.appendChild(this.frame.next),this.frame.bar=document.createElement("INPUT"),this.frame.bar.type="BUTTON",this.frame.bar.style.position="absolute",this.frame.bar.style.border="1px solid red",this.frame.bar.style.width="100px",this.frame.bar.style.height="6px",this.frame.bar.style.borderRadius="2px",this.frame.bar.style.MozBorderRadius="2px",this.frame.bar.style.border="1px solid #7F7F7F",this.frame.bar.style.backgroundColor="#E5E5E5",this.frame.appendChild(this.frame.bar),this.frame.slide=document.createElement("INPUT"),this.frame.slide.type="BUTTON",this.frame.slide.style.margin="0px",this.frame.slide.value=" ",this.frame.slide.style.position="relative",this.frame.slide.style.left="-100px",this.frame.appendChild(this.frame.slide);var n=this;this.frame.slide.onmousedown=function(t){n._onMouseDown(t)},this.frame.prev.onclick=function(t){n.prev(t)},this.frame.play.onclick=function(t){n.togglePlay(t)},this.frame.next.onclick=function(t){n.next(t)}}this.onChangeCallback=void 0,this.values=[],this.index=void 0,this.playTimeout=void 0,this.playInterval=1e3,this.playLoop=!0}var r=n(3);i.prototype.prev=function(){var t=this.getIndex();t>0&&(t--,this.setIndex(t))},i.prototype.next=function(){var t=this.getIndex();t0?this.setIndex(0):this.index=void 0},i.prototype.setIndex=function(t){if(!(tthis.values.length-1&&(i=this.values.length-1),i},i.prototype.indexToLeft=function(t){var e=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10;return t/(this.values.length-1)*e+3},i.prototype._onMouseMove=function(t){var e=t.clientX-this.startClientX,n=this.startSlideX+e,i=this.leftToIndex(n);this.setIndex(i),r.preventDefault()},i.prototype._onMouseUp=function(t){this.frame.style.cursor="auto",r.removeEventListener(document,"mousemove",this.onmousemove),r.removeEventListener(document,"mouseup",this.onmouseup),r.preventDefault()},t.exports=i},function(t,e,n){function i(t,e,n,i){this._start=0,this._end=0,this._step=1,this.prettyStep=!0,this.precision=5,this._current=0,this.setRange(t,e,n,i)}i.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},i.prototype.setRange=function(t,e,n,i){if(!this.isNumeric(t))throw new Error("Parameter 'start' is not numeric; value: "+t);if(!this.isNumeric(e))throw new Error("Parameter 'end' is not numeric; value: "+t);if(!this.isNumeric(n))throw new Error("Parameter 'step' is not numeric; value: "+t);this._start=t||0,this._end=e||0,this.setStep(n,i)},i.prototype.setStep=function(t,e){void 0===t||t<=0||(void 0!==e&&(this.prettyStep=e),!0===this.prettyStep?this._step=i.calculatePrettyStep(t):this._step=t)},i.calculatePrettyStep=function(t){var e=function(t){return Math.log(t)/Math.LN10},n=Math.pow(10,Math.round(e(t))),i=2*Math.pow(10,Math.round(e(t/2))),r=5*Math.pow(10,Math.round(e(t/5))),o=n;return Math.abs(i-t)<=Math.abs(o-t)&&(o=i),Math.abs(r-t)<=Math.abs(o-t)&&(o=r),o<=0&&(o=1),o},i.prototype.getCurrent=function(){return parseFloat(this._current.toPrecision(this.precision))},i.prototype.getStep=function(){return this._step},i.prototype.start=function(t){void 0===t&&(t=!1),this._current=this._start-this._start%this._step,t&&this.getCurrent()this._end},t.exports=i},function(t,e,n){function i(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function r(t){return void 0===t||""===t||"string"!=typeof t?t:t.charAt(0).toUpperCase()+t.slice(1)}function o(t,e){return void 0===t||""===t?e:t+r(e)}function s(t,e,n,i){for(var r,s,a=0;as&&(t=i(t)*s),n(e)>s&&(e=i(e)*s),this.cameraOffset.x=t,this.cameraOffset.y=e,this.calculateCameraOrientation()},i.prototype.getOffset=function(){return this.cameraOffset},i.prototype.setArmLocation=function(t,e,n){this.armLocation.x=t,this.armLocation.y=e,this.armLocation.z=n,this.calculateCameraOrientation()},i.prototype.setArmRotation=function(t,e){void 0!==t&&(this.armRotation.horizontal=t),void 0!==e&&(this.armRotation.vertical=e,this.armRotation.vertical<0&&(this.armRotation.vertical=0),this.armRotation.vertical>.5*Math.PI&&(this.armRotation.vertical=.5*Math.PI)),void 0===t&&void 0===e||this.calculateCameraOrientation()},i.prototype.getArmRotation=function(){var t={};return t.horizontal=this.armRotation.horizontal,t.vertical=this.armRotation.vertical,t},i.prototype.setArmLength=function(t){void 0!==t&&(this.armLength=t,this.armLength<.71&&(this.armLength=.71),this.armLength>5&&(this.armLength=5),this.setOffset(this.cameraOffset.x,this.cameraOffset.y),this.calculateCameraOrientation())},i.prototype.getArmLength=function(){return this.armLength},i.prototype.getCameraLocation=function(){return this.cameraLocation},i.prototype.getCameraRotation=function(){return this.cameraRotation},i.prototype.calculateCameraOrientation=function(){this.cameraLocation.x=this.armLocation.x-this.armLength*Math.sin(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.y=this.armLocation.y-this.armLength*Math.cos(this.armRotation.horizontal)*Math.cos(this.armRotation.vertical),this.cameraLocation.z=this.armLocation.z+this.armLength*Math.sin(this.armRotation.vertical),this.cameraRotation.x=Math.PI/2-this.armRotation.vertical,this.cameraRotation.y=0,this.cameraRotation.z=-this.armRotation.horizontal;var t=this.cameraRotation.x,e=this.cameraRotation.z,n=this.cameraOffset.x,i=this.cameraOffset.y,r=Math.sin,o=Math.cos;this.cameraLocation.x=this.cameraLocation.x+n*o(e)+i*-r(e)*o(t),this.cameraLocation.y=this.cameraLocation.y+n*r(e)+i*o(e)*o(t),this.cameraLocation.z=this.cameraLocation.z+i*r(t)},t.exports=i},function(t,e,n){function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.printStyle=void 0;var r=n(47),o=i(r),s=n(19),a=i(s),u=n(18),h=i(u),l=n(111),c=i(l),d=n(112),f=i(d),p=n(3),m=!1,v=void 0,y="background: #FFeeee; color: #dd0000",g=function(){function t(){(0,c.default)(this,t)}return(0,f.default)(t,null,[{key:"validate",value:function(e,n,i){m=!1,v=n;var r=n;return void 0!==i&&(r=n[i]),t.parse(e,r,[]),m}},{key:"parse",value:function(e,n,i){for(var r in e)e.hasOwnProperty(r)&&t.check(r,e,n,i)}},{key:"check",value:function(e,n,i,r){if(void 0===i[e]&&void 0===i.__any__)return void t.getSuggestion(e,i,r);var o=e,s=!0;void 0===i[e]&&void 0!==i.__any__&&(o="__any__",s="object"===t.getType(n[e]));var a=i[o];s&&void 0!==a.__type__&&(a=a.__type__),t.checkFields(e,n,i,o,a,r)}},{key:"checkFields",value:function(e,n,i,r,o,s){var a=function(n){console.log("%c"+n+t.printLocation(s,e),y)},u=t.getType(n[e]),l=o[u];void 0!==l?"array"===t.getType(l)&&-1===l.indexOf(n[e])?(a('Invalid option detected in "'+e+'". Allowed values are:'+t.print(l)+' not "'+n[e]+'". '),m=!0):"object"===u&&"__any__"!==r&&(s=p.copyAndExtendArray(s,e),t.parse(n[e],i[r],s)):void 0===o.any&&(a('Invalid type received for "'+e+'". Expected: '+t.print((0,h.default)(o))+". Received ["+u+'] "'+n[e]+'"'),m=!0)}},{key:"getType",value:function(t){var e=void 0===t?"undefined":(0,a.default)(t);return"object"===e?null===t?"null":t instanceof Boolean?"boolean":t instanceof Number?"number":t instanceof String?"string":Array.isArray(t)?"array":t instanceof Date?"date":void 0!==t.nodeType?"dom":!0===t._isAMomentObject?"moment":"object":"number"===e?"number":"boolean"===e?"boolean":"string"===e?"string":void 0===e?"undefined":e}},{key:"getSuggestion",value:function(e,n,i){var r=t.findInOptions(e,n,i,!1),o=t.findInOptions(e,v,[],!0),s=void 0;s=void 0!==r.indexMatch?" in "+t.printLocation(r.path,e,"")+'Perhaps it was incomplete? Did you mean: "'+r.indexMatch+'"?\n\n':o.distance<=4&&r.distance>o.distance?" in "+t.printLocation(r.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+t.printLocation(o.path,o.closestMatch,""):r.distance<=8?'. Did you mean "'+r.closestMatch+'"?'+t.printLocation(r.path,e):". Did you mean one of these: "+t.print((0,h.default)(n))+t.printLocation(i,e),console.log('%cUnknown option detected: "'+e+'"'+s,y),m=!0}},{key:"findInOptions",value:function(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=1e9,s="",a=[],u=e.toLowerCase(),h=void 0;for(var l in n){var c=void 0;if(void 0!==n[l].__type__&&!0===r){var d=t.findInOptions(e,n[l],p.copyAndExtendArray(i,l));o>d.distance&&(s=d.closestMatch,a=d.path,o=d.distance,h=d.indexMatch)}else-1!==l.toLowerCase().indexOf(u)&&(h=l),c=t.levenshteinDistance(e,l),o>c&&(s=l,a=p.copyArray(i),o=c)}return{closestMatch:s,path:a,distance:o,indexMatch:h}}},{key:"printLocation",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",i="\n\n"+n+"options = {\n",r=0;r0&&this.selectValue(0),this.dataPoints=[],this.loaded=!1,this.onLoadCallback=void 0,n.animationPreload?(this.loaded=!1,this.loadInBackground()):this.loaded=!0}var r=n(36);i.prototype.isLoaded=function(){return this.loaded},i.prototype.getLoadedProgress=function(){for(var t=this.values.length,e=0;this.dataPoints[e];)e++;return Math.round(e/t*100)},i.prototype.getLabel=function(){return this.graph.filterLabel},i.prototype.getColumn=function(){return this.column},i.prototype.getSelectedValue=function(){if(void 0!==this.index)return this.values[this.index]},i.prototype.getValues=function(){return this.values},i.prototype.getValue=function(t){if(t>=this.values.length)throw new Error("Index out of range");return this.values[t]},i.prototype._getDataPoints=function(t){if(void 0===t&&(t=this.index),void 0===t)return[];var e;if(this.dataPoints[t])e=this.dataPoints[t];else{var n={};n.column=this.column,n.value=this.values[t];var i=new r(this.dataGroup.getDataSet(),{filter:function(t){return t[n.column]==n.value}}).get();e=this.dataGroup._getDataPoints(i),this.dataPoints[t]=e}return e},i.prototype.setOnLoadCallback=function(t){this.onLoadCallback=t},i.prototype.selectValue=function(t){if(t>=this.values.length)throw new Error("Index out of range");this.index=t,this.value=this.values[t]},i.prototype.loadInBackground=function(t){void 0===t&&(t=0);var e=this.graph.frame;if(t=t.length?(this._t=void 0,r(1)):"keys"==e?r(0,n):"values"==e?r(0,t[n]):r(0,[n,t[n]])},"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var i=n(63);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var i=n(25),r=n(16),o=n(30),s={};n(9)(s,n(2)("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=i(s,{next:r(1,n)}),o(t,e+" Iterator")}},function(t,e,n){var i=n(5),r=n(11),o=n(12);t.exports=n(6)?Object.defineProperties:function(t,e){r(t);for(var n,s=o(e),a=s.length,u=0;a>u;)i.f(t,n=s[u++],e[n]);return t}},function(t,e,n){var i=n(8),r=n(67),o=n(68);t.exports=function(t){return function(e,n,s){var a,u=i(e),h=r(u.length),l=o(s,h);if(t&&n!=n){for(;h>l;)if((a=u[l++])!=a)return!0}else for(;h>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},function(t,e,n){var i=n(26),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(26),r=Math.max,o=Math.min;t.exports=function(t,e){return t=i(t),t<0?r(t+e,0):o(t,e)}},function(t,e,n){var i=n(1).document;t.exports=i&&i.documentElement},function(t,e,n){var i=n(7),r=n(31),o=n(27)("IE_PROTO"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),i(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},function(t,e,n){var i=n(26),r=n(22);t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),u=i(n),h=a.length;return u<0||u>=h?t?"":void 0:(o=a.charCodeAt(u),o<55296||o>56319||u+1===h||(s=a.charCodeAt(u+1))<56320||s>57343?t?a.charAt(u):o:t?a.slice(u,u+2):s-56320+(o-55296<<10)+65536)}}},function(t,e,n){var i=n(11),r=n(73);t.exports=n(0).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){var i=n(74),r=n(2)("iterator"),o=n(14);t.exports=n(0).getIteratorMethod=function(t){if(void 0!=t)return t[r]||t["@@iterator"]||o[i(t)]}},function(t,e,n){var i=n(21),r=n(2)("toStringTag"),o="Arguments"==i(function(){return arguments}()),s=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=s(e=Object(t),r))?n:o?i(e):"Object"==(a=i(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,n){t.exports={default:n(76),__esModule:!0}},function(t,e,n){n(77);var i=n(0).Object;t.exports=function(t,e){return i.create(t,e)}},function(t,e,n){var i=n(4);i(i.S,"Object",{create:n(25)})},function(t,e,n){n(79),t.exports=n(0).Object.keys},function(t,e,n){var i=n(31),r=n(12);n(80)("keys",function(){return function(t){return r(i(t))}})},function(t,e,n){var i=n(4),r=n(0),o=n(10);t.exports=function(t,e){var n=(r.Object||{})[t]||Object[t],s={};s[t]=e(n),i(i.S+i.F*o(function(){n(1)}),"Object",s)}},function(t,e,n){t.exports={default:n(82),__esModule:!0}},function(t,e,n){n(44),n(37),t.exports=n(32).f("iterator")},function(t,e,n){t.exports={default:n(84),__esModule:!0}},function(t,e,n){n(85),n(91),n(92),n(93),t.exports=n(0).Symbol},function(t,e,n){var i=n(1),r=n(7),o=n(6),s=n(4),a=n(42),u=n(86).KEY,h=n(10),l=n(28),c=n(30),d=n(17),f=n(2),p=n(32),m=n(33),v=n(87),y=n(88),g=n(11),_=n(8),w=n(24),b=n(16),x=n(25),S=n(89),M=n(90),T=n(5),D=n(12),k=M.f,O=T.f,E=S.f,C=i.Symbol,P=i.JSON,L=P&&P.stringify,R=f("_hidden"),A=f("toPrimitive"),Y={}.propertyIsEnumerable,I=l("symbol-registry"),z=l("symbols"),N=l("op-symbols"),W=Object.prototype,j="function"==typeof C,F=i.QObject,V=!F||!F.prototype||!F.prototype.findChild,G=o&&h(function(){return 7!=x(O({},"a",{get:function(){return O(this,"a",{value:7}).a}})).a})?function(t,e,n){var i=k(W,e);i&&delete W[e],O(t,e,n),i&&t!==W&&O(W,e,i)}:O,B=function(t){var e=z[t]=x(C.prototype);return e._k=t,e},U=j&&"symbol"==typeof C.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof C},H=function(t,e,n){return t===W&&H(N,e,n),g(t),e=w(e,!0),g(n),r(z,e)?(n.enumerable?(r(t,R)&&t[R][e]&&(t[R][e]=!1),n=x(n,{enumerable:b(0,!1)})):(r(t,R)||O(t,R,b(1,{})),t[R][e]=!0),G(t,e,n)):O(t,e,n)},X=function(t,e){g(t);for(var n,i=v(e=_(e)),r=0,o=i.length;o>r;)H(t,n=i[r++],e[n]);return t},Z=function(t,e){return void 0===e?x(t):X(x(t),e)},q=function(t){var e=Y.call(this,t=w(t,!0));return!(this===W&&r(z,t)&&!r(N,t))&&(!(e||!r(this,t)||!r(z,t)||r(this,R)&&this[R][t])||e)},$=function(t,e){if(t=_(t),e=w(e,!0),t!==W||!r(z,e)||r(N,e)){var n=k(t,e);return!n||!r(z,e)||r(t,R)&&t[R][e]||(n.enumerable=!0),n}},J=function(t){for(var e,n=E(_(t)),i=[],o=0;n.length>o;)r(z,e=n[o++])||e==R||e==u||i.push(e);return i},Q=function(t){for(var e,n=t===W,i=E(n?N:_(t)),o=[],s=0;i.length>s;)!r(z,e=i[s++])||n&&!r(W,e)||o.push(z[e]);return o};j||(C=function(){if(this instanceof C)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(n){this===W&&e.call(N,n),r(this,R)&&r(this[R],t)&&(this[R][t]=!1),G(this,t,b(1,n))};return o&&V&&G(W,t,{configurable:!0,set:e}),B(t)},a(C.prototype,"toString",function(){return this._k}),M.f=$,T.f=H,n(45).f=S.f=J,n(20).f=q,n(34).f=Q,o&&!n(23)&&a(W,"propertyIsEnumerable",q,!0),p.f=function(t){return B(f(t))}),s(s.G+s.W+s.F*!j,{Symbol:C});for(var K="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;K.length>tt;)f(K[tt++]);for(var et=D(f.store),nt=0;et.length>nt;)m(et[nt++]);s(s.S+s.F*!j,"Symbol",{for:function(t){return r(I,t+="")?I[t]:I[t]=C(t)},keyFor:function(t){if(!U(t))throw TypeError(t+" is not a symbol!");for(var e in I)if(I[e]===t)return e},useSetter:function(){V=!0},useSimple:function(){V=!1}}),s(s.S+s.F*!j,"Object",{create:Z,defineProperty:H,defineProperties:X,getOwnPropertyDescriptor:$,getOwnPropertyNames:J,getOwnPropertySymbols:Q}),P&&s(s.S+s.F*(!j||h(function(){var t=C();return"[null]"!=L([t])||"{}"!=L({a:t})||"{}"!=L(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!U(t)){for(var e,n,i=[t],r=1;arguments.length>r;)i.push(arguments[r++]);return e=i[1],"function"==typeof e&&(n=e),!n&&y(e)||(e=function(t,e){if(n&&(e=n.call(this,t,e)),!U(e))return e}),i[1]=e,L.apply(P,i)}}}),C.prototype[A]||n(9)(C.prototype,A,C.prototype.valueOf),c(C,"Symbol"),c(Math,"Math",!0),c(i.JSON,"JSON",!0)},function(t,e,n){var i=n(17)("meta"),r=n(15),o=n(7),s=n(5).f,a=0,u=Object.isExtensible||function(){return!0},h=!n(10)(function(){return u(Object.preventExtensions({}))}),l=function(t){s(t,i,{value:{i:"O"+ ++a,w:{}}})},c=function(t,e){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,i)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[i].i},d=function(t,e){if(!o(t,i)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[i].w},f=function(t){return h&&p.NEED&&u(t)&&!o(t,i)&&l(t),t},p=t.exports={KEY:i,NEED:!1,fastKey:c,getWeak:d,onFreeze:f}},function(t,e,n){var i=n(12),r=n(34),o=n(20);t.exports=function(t){var e=i(t),n=r.f;if(n)for(var s,a=n(t),u=o.f,h=0;a.length>h;)u.call(t,s=a[h++])&&e.push(s);return e}},function(t,e,n){var i=n(21);t.exports=Array.isArray||function(t){return"Array"==i(t)}},function(t,e,n){var i=n(8),r=n(45).f,o={}.toString,s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return r(t)}catch(t){return s.slice()}};t.exports.f=function(t){return s&&"[object Window]"==o.call(t)?a(t):r(i(t))}},function(t,e,n){var i=n(20),r=n(16),o=n(8),s=n(24),a=n(7),u=n(40),h=Object.getOwnPropertyDescriptor;e.f=n(6)?h:function(t,e){if(t=o(t),e=s(e,!0),u)try{return h(t,e)}catch(t){}if(a(t,e))return r(!i.f.call(t,e),t[e])}},function(t,e){},function(t,e,n){n(33)("asyncIterator")},function(t,e,n){n(33)("observable")},function(t,e,n){(function(t){!function(e,n){t.exports=n()}(0,function(){function e(){return ki.apply(null,arguments)}function n(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function i(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function r(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0}function o(t){return void 0===t}function s(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function a(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function u(t,e){var n,i=[];for(n=0;n0)for(n=0;n0?"future":"past"];return T(n)?n(e):n.replace(/%s/i,e)}function Y(t,e){var n=t.toLowerCase();zi[n]=zi[n+"s"]=zi[e]=t}function I(t){return"string"==typeof t?zi[t]||zi[t.toLowerCase()]:void 0}function z(t){var e,n,i={};for(n in t)h(t,n)&&(e=I(n))&&(i[e]=t[n]);return i}function N(t,e){Ni[t]=e}function W(t){var e=[];for(var n in t)e.push({unit:n,priority:Ni[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function j(t,e,n){var i=""+Math.abs(t),r=e-i.length;return(t>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+i}function F(t,e,n,i){var r=i;"string"==typeof i&&(r=function(){return this[i]()}),t&&(Vi[t]=r),e&&(Vi[e[0]]=function(){return j(r.apply(this,arguments),e[1],e[2])}),n&&(Vi[n]=function(){return this.localeData().ordinal(r.apply(this,arguments),t)})}function V(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function G(t){var e,n,i=t.match(Wi);for(e=0,n=i.length;e=0&&ji.test(t);)t=t.replace(ji,n),ji.lastIndex=0,i-=1;return t}function H(t,e,n){sr[t]=T(e)?e:function(t,i){return t&&n?n:e}}function X(t,e){return h(sr,t)?sr[t](e._strict,e._locale):new RegExp(Z(t))}function Z(t){return q(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,r){return e||n||i||r}))}function q(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function $(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),s(e)&&(i=function(t,n){n[e]=w(t)}),n=0;n=0&&isFinite(a.getFullYear())&&a.setFullYear(t),a}function wt(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function bt(t,e,n){var i=7+e-n;return-(7+wt(t,0,i).getUTCDay()-e)%7+i-1}function xt(t,e,n,i,r){var o,s,a=(7+n-i)%7,u=bt(t,i,r),h=1+7*(e-1)+a+u;return h<=0?(o=t-1,s=K(o)+h):h>K(t)?(o=t+1,s=h-K(t)):(o=t,s=h),{year:o,dayOfYear:s}}function St(t,e,n){var i,r,o=bt(t.year(),e,n),s=Math.floor((t.dayOfYear()-o-1)/7)+1;return s<1?(r=t.year()-1,i=s+Mt(r,e,n)):s>Mt(t.year(),e,n)?(i=s-Mt(t.year(),e,n),r=t.year()+1):(r=t.year(),i=s),{week:i,year:r}}function Mt(t,e,n){var i=bt(t,e,n),r=bt(t+1,e,n);return(K(t)-i+r)/7}function Tt(t){return St(t,this._week.dow,this._week.doy).week}function Dt(){return this._week.dow}function kt(){return this._week.doy}function Ot(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Et(t){var e=St(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Ct(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Pt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Lt(t,e){return t?n(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:n(this._weekdays)?this._weekdays:this._weekdays.standalone}function Rt(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort}function At(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Yt(t,e,n){var i,r,o,s=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)o=c([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===e?(r=yr.call(this._weekdaysParse,s),-1!==r?r:null):"ddd"===e?(r=yr.call(this._shortWeekdaysParse,s),-1!==r?r:null):(r=yr.call(this._minWeekdaysParse,s),-1!==r?r:null):"dddd"===e?-1!==(r=yr.call(this._weekdaysParse,s))?r:-1!==(r=yr.call(this._shortWeekdaysParse,s))?r:(r=yr.call(this._minWeekdaysParse,s),-1!==r?r:null):"ddd"===e?-1!==(r=yr.call(this._shortWeekdaysParse,s))?r:-1!==(r=yr.call(this._weekdaysParse,s))?r:(r=yr.call(this._minWeekdaysParse,s),-1!==r?r:null):-1!==(r=yr.call(this._minWeekdaysParse,s))?r:-1!==(r=yr.call(this._weekdaysParse,s))?r:(r=yr.call(this._shortWeekdaysParse,s),-1!==r?r:null)}function It(t,e,n){var i,r,o;if(this._weekdaysParseExact)return Yt.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(r=c([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(r,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(r,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(r,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(o="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function zt(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Ct(t,this.localeData()),this.add(t-e,"d")):e}function Nt(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Wt(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Pt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function jt(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Gt.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(h(this,"_weekdaysRegex")||(this._weekdaysRegex=Or),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ft(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Gt.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(h(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Er),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Vt(t){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Gt.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(h(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Cr),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Gt(){function t(t,e){return e.length-t.length}var e,n,i,r,o,s=[],a=[],u=[],h=[];for(e=0;e<7;e++)n=c([2e3,1]).day(e),i=this.weekdaysMin(n,""),r=this.weekdaysShort(n,""),o=this.weekdays(n,""),s.push(i),a.push(r),u.push(o),h.push(i),h.push(r),h.push(o);for(s.sort(t),a.sort(t),u.sort(t),h.sort(t),e=0;e<7;e++)a[e]=q(a[e]),u[e]=q(u[e]),h[e]=q(h[e]);this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Bt(){return this.hours()%12||12}function Ut(){return this.hours()||24}function Ht(t,e){F(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function Xt(t,e){return e._meridiemParse}function Zt(t){return"p"===(t+"").toLowerCase().charAt(0)}function qt(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function $t(t){return t?t.toLowerCase().replace("_","-"):t}function Jt(t){for(var e,n,i,r,o=0;o0;){if(i=Qt(r.slice(0,e).join("-")))return i;if(n&&n.length>=e&&b(r,n,!0)>=e-1)break;e--}o++}return null}function Qt(e){var n=null;if(!Yr[e]&&void 0!==t&&t&&t.exports)try{n=Pr._abbr;!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),Kt(n)}catch(t){}return Yr[e]}function Kt(t,e){var n;return t&&(n=o(e)?ne(t):te(t,e))&&(Pr=n),Pr._abbr}function te(t,e){if(null!==e){var n=Ar;if(e.abbr=t,null!=Yr[t])M("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Yr[t]._config;else if(null!=e.parentLocale){if(null==Yr[e.parentLocale])return Ir[e.parentLocale]||(Ir[e.parentLocale]=[]),Ir[e.parentLocale].push({name:t,config:e}),null;n=Yr[e.parentLocale]._config}return Yr[t]=new O(k(n,e)),Ir[t]&&Ir[t].forEach(function(t){te(t.name,t.config)}),Kt(t),Yr[t]}return delete Yr[t],null}function ee(t,e){if(null!=e){var n,i=Ar;null!=Yr[t]&&(i=Yr[t]._config),e=k(i,e),n=new O(e),n.parentLocale=Yr[t],Yr[t]=n,Kt(t)}else null!=Yr[t]&&(null!=Yr[t].parentLocale?Yr[t]=Yr[t].parentLocale:null!=Yr[t]&&delete Yr[t]);return Yr[t]}function ne(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Pr;if(!n(t)){if(e=Qt(t))return e;t=[t]}return Jt(t)}function ie(){return Li(Yr)}function re(t){var e,n=t._a;return n&&-2===f(t).overflow&&(e=n[hr]<0||n[hr]>11?hr:n[lr]<1||n[lr]>ut(n[ur],n[hr])?lr:n[cr]<0||n[cr]>24||24===n[cr]&&(0!==n[dr]||0!==n[fr]||0!==n[pr])?cr:n[dr]<0||n[dr]>59?dr:n[fr]<0||n[fr]>59?fr:n[pr]<0||n[pr]>999?pr:-1,f(t)._overflowDayOfYear&&(elr)&&(e=lr),f(t)._overflowWeeks&&-1===e&&(e=mr),f(t)._overflowWeekday&&-1===e&&(e=vr),f(t).overflow=e),t}function oe(t,e,n){return null!=t?t:null!=e?e:n}function se(t){var n=new Date(e.now());return t._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function ae(t){var e,n,i,r,o=[];if(!t._d){for(i=se(t),t._w&&null==t._a[lr]&&null==t._a[hr]&&ue(t),null!=t._dayOfYear&&(r=oe(t._a[ur],i[ur]),(t._dayOfYear>K(r)||0===t._dayOfYear)&&(f(t)._overflowDayOfYear=!0),n=wt(r,0,t._dayOfYear),t._a[hr]=n.getUTCMonth(),t._a[lr]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=o[e]=i[e];for(;e<7;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[cr]&&0===t._a[dr]&&0===t._a[fr]&&0===t._a[pr]&&(t._nextDay=!0,t._a[cr]=0),t._d=(t._useUTC?wt:_t).apply(null,o),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[cr]=24),t._w&&void 0!==t._w.d&&t._w.d!==t._d.getDay()&&(f(t).weekdayMismatch=!0)}}function ue(t){var e,n,i,r,o,s,a,u;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)o=1,s=4,n=oe(e.GG,t._a[ur],St(Te(),1,4).year),i=oe(e.W,1),((r=oe(e.E,1))<1||r>7)&&(u=!0);else{o=t._locale._week.dow,s=t._locale._week.doy;var h=St(Te(),o,s);n=oe(e.gg,t._a[ur],h.year),i=oe(e.w,h.week),null!=e.d?((r=e.d)<0||r>6)&&(u=!0):null!=e.e?(r=e.e+o,(e.e<0||e.e>6)&&(u=!0)):r=o}i<1||i>Mt(n,o,s)?f(t)._overflowWeeks=!0:null!=u?f(t)._overflowWeekday=!0:(a=xt(n,i,r,o,s),t._a[ur]=a.year,t._dayOfYear=a.dayOfYear)}function he(t){var e,n,i,r,o,s,a=t._i,u=zr.exec(a)||Nr.exec(a);if(u){for(f(t).iso=!0,e=0,n=jr.length;e0&&f(t).unusedInput.push(s),a=a.slice(a.indexOf(i)+i.length),h+=i.length),Vi[o]?(i?f(t).empty=!1:f(t).unusedTokens.push(o),Q(o,i,t)):t._strict&&!i&&f(t).unusedTokens.push(o);f(t).charsLeftOver=u-h,a.length>0&&f(t).unusedInput.push(a),t._a[cr]<=12&&!0===f(t).bigHour&&t._a[cr]>0&&(f(t).bigHour=void 0),f(t).parsedDateParts=t._a.slice(0),f(t).meridiem=t._meridiem,t._a[cr]=ge(t._locale,t._a[cr],t._meridiem),ae(t),re(t)}function ge(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(i=t.isPM(n),i&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function _e(t){var e,n,i,r,o;if(0===t._f.length)return f(t).invalidFormat=!0,void(t._d=new Date(NaN));for(r=0;rthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function He(){if(!o(this._isDSTShifted))return this._isDSTShifted;var t={};if(v(t,this),t=xe(t),t._a){var e=t._isUTC?c(t._a):Te(t._a);this._isDSTShifted=this.isValid()&&b(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Xe(){return!!this.isValid()&&!this._isUTC}function Ze(){return!!this.isValid()&&this._isUTC}function qe(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function $e(t,e){var n,i,r,o=t,a=null;return Re(t)?o={ms:t._milliseconds,d:t._days,M:t._months}:s(t)?(o={},e?o[e]=t:o.milliseconds=t):(a=$r.exec(t))?(n="-"===a[1]?-1:1,o={y:0,d:w(a[lr])*n,h:w(a[cr])*n,m:w(a[dr])*n,s:w(a[fr])*n,ms:w(Ae(1e3*a[pr]))*n}):(a=Jr.exec(t))?(n="-"===a[1]?-1:(a[1],1),o={y:Je(a[2],n),M:Je(a[3],n),w:Je(a[4],n),d:Je(a[5],n),h:Je(a[6],n),m:Je(a[7],n),s:Je(a[8],n)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(r=Ke(Te(o.from),Te(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),i=new Le(o),Re(t)&&h(t,"_locale")&&(i._locale=t._locale),i}function Je(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Qe(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function Ke(t,e){var n;return t.isValid()&&e.isValid()?(e=ze(e,t),t.isBefore(e)?n=Qe(t,e):(n=Qe(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function tn(t,e){return function(n,i){var r,o;return null===i||isNaN(+i)||(M(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),o=n,n=i,i=o),n="string"==typeof n?+n:n,r=$e(n,i),en(this,r,t),this}}function en(t,n,i,r){var o=n._milliseconds,s=Ae(n._days),a=Ae(n._months);t.isValid()&&(r=null==r||r,a&&ft(t,it(t,"Month")+a*i),s&&rt(t,"Date",it(t,"Date")+s*i),o&&t._d.setTime(t._d.valueOf()+o*i),r&&e.updateOffset(t,s||a))}function nn(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function rn(t,n){var i=t||Te(),r=ze(i,this).startOf("day"),o=e.calendarFormat(this,r)||"sameElse",s=n&&(T(n[o])?n[o].call(this,i):n[o]);return this.format(s||this.localeData().calendar(o,this,Te(i)))}function on(){return new y(this)}function sn(t,e){var n=g(t)?t:Te(t);return!(!this.isValid()||!n.isValid())&&(e=I(o(e)?"millisecond":e),"millisecond"===e?this.valueOf()>n.valueOf():n.valueOf()9999?B(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):T(Date.prototype.toISOString)?this.toDate().toISOString():B(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function vn(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var n="["+t+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",r=e+'[")]';return this.format(n+i+"-MM-DD[T]HH:mm:ss.SSS"+r)}function yn(t){t||(t=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var n=B(this,t);return this.localeData().postformat(n)}function gn(t,e){return this.isValid()&&(g(t)&&t.isValid()||Te(t).isValid())?$e({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function _n(t){return this.from(Te(),t)}function wn(t,e){return this.isValid()&&(g(t)&&t.isValid()||Te(t).isValid())?$e({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function bn(t){return this.to(Te(),t)}function xn(t){var e;return void 0===t?this._locale._abbr:(e=ne(t),null!=e&&(this._locale=e),this)}function Sn(){return this._locale}function Mn(t){switch(t=I(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function Tn(t){return void 0===(t=I(t))||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function Dn(){return this._d.valueOf()-6e4*(this._offset||0)}function kn(){return Math.floor(this.valueOf()/1e3)}function On(){return new Date(this.valueOf())}function En(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function Cn(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function Pn(){return this.isValid()?this.toISOString():null}function Ln(){return p(this)}function Rn(){return l({},f(this))}function An(){return f(this).overflow}function Yn(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function In(t,e){F(0,[t,t.length],0,e)}function zn(t){return Fn.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Nn(t){return Fn.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function Wn(){return Mt(this.year(),1,4)}function jn(){var t=this.localeData()._week;return Mt(this.year(),t.dow,t.doy)}function Fn(t,e,n,i,r){var o;return null==t?St(this,i,r).year:(o=Mt(t,i,r),e>o&&(e=o),Vn.call(this,t,e,n,i,r))}function Vn(t,e,n,i,r){var o=xt(t,e,n,i,r),s=wt(o.year,0,o.dayOfYear);return this.year(s.getUTCFullYear()),this.month(s.getUTCMonth()),this.date(s.getUTCDate()),this}function Gn(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Bn(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Un(t,e){e[pr]=w(1e3*("0."+t))}function Hn(){return this._isUTC?"UTC":""}function Xn(){return this._isUTC?"Coordinated Universal Time":""}function Zn(t){return Te(1e3*t)}function qn(){return Te.apply(null,arguments).parseZone()}function $n(t){return t}function Jn(t,e,n,i){var r=ne(),o=c().set(i,e);return r[n](o,t)}function Qn(t,e,n){if(s(t)&&(e=t,t=void 0),t=t||"",null!=e)return Jn(t,e,n,"month");var i,r=[];for(i=0;i<12;i++)r[i]=Jn(t,i,n,"month");return r}function Kn(t,e,n,i){"boolean"==typeof t?(s(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,s(e)&&(n=e,e=void 0),e=e||"");var r=ne(),o=t?r._week.dow:0;if(null!=n)return Jn(e,(n+o)%7,i,"day");var a,u=[];for(a=0;a<7;a++)u[a]=Jn(e,(a+o)%7,i,"day");return u}function ti(t,e){return Qn(t,e,"months")}function ei(t,e){return Qn(t,e,"monthsShort")}function ni(t,e,n){return Kn(t,e,n,"weekdays")}function ii(t,e,n){return Kn(t,e,n,"weekdaysShort")}function ri(t,e,n){return Kn(t,e,n,"weekdaysMin")}function oi(){var t=this._data;return this._milliseconds=uo(this._milliseconds),this._days=uo(this._days),this._months=uo(this._months),t.milliseconds=uo(t.milliseconds),t.seconds=uo(t.seconds),t.minutes=uo(t.minutes),t.hours=uo(t.hours),t.months=uo(t.months),t.years=uo(t.years),this}function si(t,e,n,i){var r=$e(e,n);return t._milliseconds+=i*r._milliseconds,t._days+=i*r._days,t._months+=i*r._months,t._bubble()}function ai(t,e){return si(this,t,e,1)}function ui(t,e){return si(this,t,e,-1)}function hi(t){return t<0?Math.floor(t):Math.ceil(t)}function li(){var t,e,n,i,r,o=this._milliseconds,s=this._days,a=this._months,u=this._data;return o>=0&&s>=0&&a>=0||o<=0&&s<=0&&a<=0||(o+=864e5*hi(di(a)+s),s=0,a=0),u.milliseconds=o%1e3,t=_(o/1e3),u.seconds=t%60,e=_(t/60),u.minutes=e%60,n=_(e/60),u.hours=n%24,s+=_(n/24),r=_(ci(s)),a+=r,s-=hi(di(r)),i=_(a/12),a%=12,u.days=s,u.months=a,u.years=i,this}function ci(t){return 4800*t/146097}function di(t){return 146097*t/4800}function fi(t){if(!this.isValid())return NaN;var e,n,i=this._milliseconds;if("month"===(t=I(t))||"year"===t)return e=this._days+i/864e5,n=this._months+ci(e),"month"===t?n:n/12;switch(e=this._days+Math.round(di(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}}function pi(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*w(this._months/12):NaN}function mi(t){return function(){return this.as(t)}}function vi(){return $e(this)}function yi(t){return t=I(t),this.isValid()?this[t+"s"]():NaN}function gi(t){return function(){return this.isValid()?this._data[t]:NaN}}function _i(){return _(this.days()/7)}function wi(t,e,n,i,r){return r.relativeTime(e||1,!!n,t,i)}function bi(t,e,n){var i=$e(t).abs(),r=To(i.as("s")),o=To(i.as("m")),s=To(i.as("h")),a=To(i.as("d")),u=To(i.as("M")),h=To(i.as("y")),l=r<=Do.ss&&["s",r]||r0,l[4]=n,wi.apply(null,l)}function xi(t){return void 0===t?To:"function"==typeof t&&(To=t,!0)}function Si(t,e){return void 0!==Do[t]&&(void 0===e?Do[t]:(Do[t]=e,"s"===t&&(Do.ss=e-1),!0))}function Mi(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),n=bi(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function Ti(t){return(t>0)-(t<0)||+t}function Di(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,i=ko(this._milliseconds)/1e3,r=ko(this._days),o=ko(this._months);t=_(i/60),e=_(t/60),i%=60,t%=60,n=_(o/12),o%=12;var s=n,a=o,u=r,h=e,l=t,c=i?i.toFixed(3).replace(/\.?0+$/,""):"",d=this.asSeconds();if(!d)return"P0D";var f=d<0?"-":"",p=Ti(this._months)!==Ti(d)?"-":"",m=Ti(this._days)!==Ti(d)?"-":"",v=Ti(this._milliseconds)!==Ti(d)?"-":"";return f+"P"+(s?p+s+"Y":"")+(a?p+a+"M":"")+(u?m+u+"D":"")+(h||l||c?"T":"")+(h?v+h+"H":"")+(l?v+l+"M":"")+(c?v+c+"S":"")}var ki,Oi;Oi=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),n=e.length>>>0,i=0;i68?1900:2e3)};var yr,gr=nt("FullYear",!0);yr=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;ethis?this:t:m()}),Xr=function(){return Date.now?Date.now():+new Date},Zr=["year","quarter","month","week","day","hour","minute","second","millisecond"];Ye("Z",":"),Ye("ZZ",""),H("Z",ir),H("ZZ",ir),$(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Ie(ir,t)});var qr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var $r=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Jr=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;$e.fn=Le.prototype,$e.invalid=Pe;var Qr=tn(1,"add"),Kr=tn(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var to=S("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});F(0,["gg",2],0,function(){return this.weekYear()%100}),F(0,["GG",2],0,function(){return this.isoWeekYear()%100}),In("gggg","weekYear"),In("ggggg","weekYear"),In("GGGG","isoWeekYear"),In("GGGGG","isoWeekYear"),Y("weekYear","gg"),Y("isoWeekYear","GG"),N("weekYear",1),N("isoWeekYear",1),H("G",er),H("g",er),H("GG",Zi,Bi),H("gg",Zi,Bi),H("GGGG",Qi,Hi),H("gggg",Qi,Hi),H("GGGGG",Ki,Xi),H("ggggg",Ki,Xi),J(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=w(t)}),J(["gg","GG"],function(t,n,i,r){n[r]=e.parseTwoDigitYear(t)}),F("Q",0,"Qo","quarter"),Y("quarter","Q"),N("quarter",7),H("Q",Gi),$("Q",function(t,e){e[hr]=3*(w(t)-1)}),F("D",["DD",2],"Do","date"),Y("date","D"),N("date",9),H("D",Zi),H("DD",Zi,Bi),H("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),$(["D","DD"],lr),$("Do",function(t,e){e[lr]=w(t.match(Zi)[0],10)});var eo=nt("Date",!0);F("DDD",["DDDD",3],"DDDo","dayOfYear"),Y("dayOfYear","DDD"),N("dayOfYear",4),H("DDD",Ji),H("DDDD",Ui),$(["DDD","DDDD"],function(t,e,n){n._dayOfYear=w(t)}),F("m",["mm",2],0,"minute"),Y("minute","m"),N("minute",14),H("m",Zi),H("mm",Zi,Bi),$(["m","mm"],dr);var no=nt("Minutes",!1);F("s",["ss",2],0,"second"),Y("second","s"),N("second",15),H("s",Zi),H("ss",Zi,Bi),$(["s","ss"],fr);var io=nt("Seconds",!1);F("S",0,0,function(){return~~(this.millisecond()/100)}),F(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),F(0,["SSS",3],0,"millisecond"),F(0,["SSSS",4],0,function(){return 10*this.millisecond()}),F(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),F(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),F(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),F(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),F(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),Y("millisecond","ms"),N("millisecond",16),H("S",Ji,Gi),H("SS",Ji,Bi),H("SSS",Ji,Ui);var ro;for(ro="SSSS";ro.length<=9;ro+="S")H(ro,tr);for(ro="S";ro.length<=9;ro+="S")$(ro,Un);var oo=nt("Milliseconds",!1);F("z",0,0,"zoneAbbr"),F("zz",0,0,"zoneName");var so=y.prototype;so.add=Qr,so.calendar=rn,so.clone=on,so.diff=dn,so.endOf=Tn,so.format=yn,so.from=gn,so.fromNow=_n,so.to=wn,so.toNow=bn,so.get=ot,so.invalidAt=An,so.isAfter=sn,so.isBefore=an,so.isBetween=un,so.isSame=hn,so.isSameOrAfter=ln,so.isSameOrBefore=cn,so.isValid=Ln,so.lang=to,so.locale=xn,so.localeData=Sn,so.max=Hr,so.min=Ur,so.parsingFlags=Rn,so.set=st,so.startOf=Mn,so.subtract=Kr,so.toArray=En,so.toObject=Cn,so.toDate=On,so.toISOString=mn,so.inspect=vn,so.toJSON=Pn,so.toString=pn,so.unix=kn,so.valueOf=Dn,so.creationData=Yn,so.year=gr,so.isLeapYear=et,so.weekYear=zn,so.isoWeekYear=Nn,so.quarter=so.quarters=Gn,so.month=pt,so.daysInMonth=mt,so.week=so.weeks=Ot,so.isoWeek=so.isoWeeks=Et,so.weeksInYear=jn,so.isoWeeksInYear=Wn,so.date=eo,so.day=so.days=zt,so.weekday=Nt,so.isoWeekday=Wt,so.dayOfYear=Bn,so.hour=so.hours=Rr,so.minute=so.minutes=no,so.second=so.seconds=io,so.millisecond=so.milliseconds=oo,so.utcOffset=We,so.utc=Fe,so.local=Ve,so.parseZone=Ge,so.hasAlignedHourOffset=Be,so.isDST=Ue,so.isLocal=Xe,so.isUtcOffset=Ze,so.isUtc=qe,so.isUTC=qe,so.zoneAbbr=Hn,so.zoneName=Xn,so.dates=S("dates accessor is deprecated. Use date instead.",eo),so.months=S("months accessor is deprecated. Use month instead",pt),so.years=S("years accessor is deprecated. Use year instead",gr),so.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",je),so.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",He);var ao=O.prototype;ao.calendar=E,ao.longDateFormat=C,ao.invalidDate=P,ao.ordinal=L,ao.preparse=$n,ao.postformat=$n,ao.relativeTime=R,ao.pastFuture=A,ao.set=D,ao.months=ht,ao.monthsShort=lt,ao.monthsParse=dt,ao.monthsRegex=yt,ao.monthsShortRegex=vt,ao.week=Tt,ao.firstDayOfYear=kt,ao.firstDayOfWeek=Dt,ao.weekdays=Lt,ao.weekdaysMin=At,ao.weekdaysShort=Rt,ao.weekdaysParse=It,ao.weekdaysRegex=jt,ao.weekdaysShortRegex=Ft,ao.weekdaysMinRegex=Vt,ao.isPM=Zt,ao.meridiem=qt,Kt("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===w(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),e.lang=S("moment.lang is deprecated. Use moment.locale instead.",Kt),e.langData=S("moment.langData is deprecated. Use moment.localeData instead.",ne);var uo=Math.abs,ho=mi("ms"),lo=mi("s"),co=mi("m"),fo=mi("h"),po=mi("d"),mo=mi("w"),vo=mi("M"),yo=mi("y"),go=gi("milliseconds"),_o=gi("seconds"),wo=gi("minutes"),bo=gi("hours"),xo=gi("days"),So=gi("months"),Mo=gi("years"),To=Math.round,Do={ss:44,s:45,m:45,h:22,d:26,M:11},ko=Math.abs,Oo=Le.prototype;return Oo.isValid=Ce,Oo.abs=oi,Oo.add=ai,Oo.subtract=ui,Oo.as=fi,Oo.asMilliseconds=ho,Oo.asSeconds=lo,Oo.asMinutes=co,Oo.asHours=fo,Oo.asDays=po,Oo.asWeeks=mo,Oo.asMonths=vo,Oo.asYears=yo,Oo.valueOf=pi,Oo._bubble=li,Oo.clone=vi,Oo.get=yi,Oo.milliseconds=go,Oo.seconds=_o,Oo.minutes=wo,Oo.hours=bo,Oo.days=xo,Oo.weeks=_i,Oo.months=So,Oo.years=Mo,Oo.humanize=Mi,Oo.toISOString=Di,Oo.toString=Di,Oo.toJSON=Di,Oo.locale=xn,Oo.localeData=Sn,Oo.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Di),Oo.lang=to,F("X",0,0,"unix"),F("x",0,0,"valueOf"),H("x",er),H("X",rr),$("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),$("x",function(t,e,n){n._d=new Date(w(t))}),e.version="2.19.1",function(t){ki=t}(Te),e.fn=so,e.min=ke,e.max=Oe,e.now=Xr,e.utc=c,e.unix=Zn,e.months=ti,e.isDate=a,e.locale=Kt,e.invalid=m,e.duration=$e,e.isMoment=g,e.weekdays=ni,e.parseZone=qn,e.localeData=ne,e.isDuration=Re,e.monthsShort=ei,e.weekdaysMin=ri,e.defineLocale=te,e.updateLocale=ee,e.locales=ie,e.weekdaysShort=ii,e.normalizeUnits=I,e.relativeTimeRounding=xi,e.relativeTimeThreshold=Si,e.calendarFormat=nn,e.prototype=so,e})}).call(e,n(95)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function n(t){throw new Error("Cannot find module '"+t+"'.")}n.keys=function(){return[]},n.resolve=n,t.exports=n,n.id=96},function(t,e,n){(function(e){function n(t,e,n){var i=e&&n||0,r=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){r<16&&(e[i+r++]=c[t])});r<16;)e[i+r++]=0;return e}function i(t,e){var n=e||0,i=l;return i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+"-"+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]+i[t[n++]]}function r(t,e,n){var r=e&&n||0,o=e||[];t=t||{};var s=void 0!==t.clockseq?t.clockseq:m,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),u=void 0!==t.nsecs?t.nsecs:y+1,h=a-v+(u-y)/1e4;if(h<0&&void 0===t.clockseq&&(s=s+1&16383),(h<0||a>v)&&void 0===t.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");v=a,y=u,m=s,a+=122192928e5;var l=(1e4*(268435455&a)+u)%4294967296;o[r++]=l>>>24&255,o[r++]=l>>>16&255,o[r++]=l>>>8&255,o[r++]=255&l;var c=a/4294967296*1e4&268435455;o[r++]=c>>>8&255,o[r++]=255&c,o[r++]=c>>>24&15|16,o[r++]=c>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var d=t.node||p,f=0;f<6;f++)o[r+f]=d[f];return e||i(o)}function o(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var o=t.random||(t.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;a++)e[r+a]=o[a];return e||i(o)}var s,a="undefined"!=typeof window?window:void 0!==e?e:null;if(a&&a.crypto&&crypto.getRandomValues){var u=new Uint8Array(16);s=function(){return crypto.getRandomValues(u),u}}if(!s){var h=new Array(16);s=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),h[e]=t>>>((3&e)<<3)&255;return h}}for(var l=[],c={},d=0;d<256;d++)l[d]=(d+256).toString(16).substr(1),c[l[d]]=d;var f=s(),p=[1|f[0],f[1],f[2],f[3],f[4],f[5]],m=16383&(f[6]<<8|f[7]),v=0,y=0,g=o;g.v1=r,g.v4=o,g.parse=n,g.unparse=i,t.exports=g}).call(e,n(98))},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){e.prepareElements=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e].redundant=t[e].used,t[e].used=[])},e.cleanupElements=function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e].redundant){for(var n=0;n0?(i=e[t].redundant[0],e[t].redundant.shift()):(i=document.createElementNS("http://www.w3.org/2000/svg",t),n.appendChild(i)):(i=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},n.appendChild(i)),e[t].used.push(i),i},e.getDOMElement=function(t,e,n,i){var r;return e.hasOwnProperty(t)?e[t].redundant.length>0?(r=e[t].redundant[0],e[t].redundant.shift()):(r=document.createElement(t),void 0!==i?n.insertBefore(r,i):n.appendChild(r)):(r=document.createElement(t),e[t]={used:[],redundant:[]},void 0!==i?n.insertBefore(r,i):n.appendChild(r)),e[t].used.push(r),r},e.drawPoint=function(t,n,i,r,o,s){var a;if("circle"==i.style?(a=e.getSVGElement("circle",r,o),a.setAttributeNS(null,"cx",t),a.setAttributeNS(null,"cy",n),a.setAttributeNS(null,"r",.5*i.size)):(a=e.getSVGElement("rect",r,o),a.setAttributeNS(null,"x",t-.5*i.size),a.setAttributeNS(null,"y",n-.5*i.size),a.setAttributeNS(null,"width",i.size),a.setAttributeNS(null,"height",i.size)),void 0!==i.styles&&a.setAttributeNS(null,"style",i.styles),a.setAttributeNS(null,"class",i.className+" vis-point"),s){var u=e.getSVGElement("text",r,o);s.xOffset&&(t+=s.xOffset),s.yOffset&&(n+=s.yOffset),s.content&&(u.textContent=s.content),s.className&&u.setAttributeNS(null,"class",s.className+" vis-label"),u.setAttributeNS(null,"x",t),u.setAttributeNS(null,"y",n)}return a},e.drawBar=function(t,n,i,r,o,s,a,u){if(0!=r){r<0&&(r*=-1,n-=r);var h=e.getSVGElement("rect",s,a);h.setAttributeNS(null,"x",t-.5*i),h.setAttributeNS(null,"y",n),h.setAttributeNS(null,"width",i),h.setAttributeNS(null,"height",r),h.setAttributeNS(null,"class",o),u&&h.setAttributeNS(null,"style",u)}}},function(t,e,n){var i=n(0),r=i.JSON||(i.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},function(t,e,n){function i(t,e,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this.containerElement=t,this.dataGroup=new w,this.dataPoints=null,this.create(),p.setDefaults(i.DEFAULTS,this),this.colX=void 0,this.colY=void 0,this.colZ=void 0,this.colValue=void 0,this.setOptions(n),this.setData(e)}function r(t){return"clientX"in t?t.clientX:t.targetTouches[0]&&t.targetTouches[0].clientX||0}function o(t){return"clientY"in t?t.clientY:t.targetTouches[0]&&t.targetTouches[0].clientY||0}var s=n(102),a=function(t){return t&&t.__esModule?t:{default:t}}(s),u=n(106),h=n(3),l=n(13),c=n(49),d=n(50),f=n(51),p=n(52),m=n(54).default,v=n(54),y=v.printStyle,g=n(116),_=g.allOptions,w=n(117);i.STYLE=p.STYLE;i.DEFAULTS={width:"400px",height:"400px",filterLabel:"time",legendLabel:"value",xLabel:"x",yLabel:"y",zLabel:"z",xValueLabel:function(t){return t},yValueLabel:function(t){return t},zValueLabel:function(t){return t},showXAxis:!0,showYAxis:!0,showZAxis:!0,showGrid:!0,showPerspective:!0,showShadow:!1,keepAspectRatio:!0,verticalRatio:.5,dotSizeRatio:.02,dotSizeMinFraction:.5,dotSizeMaxFraction:2.5,showAnimationControls:void 0,animationInterval:1e3,animationPreload:!1,animationAutoStart:void 0,axisColor:"#4D4D4D",gridColor:"#D3D3D3",xCenter:"55%",yCenter:"50%",style:i.STYLE.DOT,tooltip:!1,tooltipStyle:{content:{padding:"10px",border:"1px solid #4d4d4d",color:"#1a1a1a",background:"rgba(255,255,255,0.7)",borderRadius:"2px",boxShadow:"5px 5px 10px rgba(128,128,128,0.5)"},line:{height:"40px",width:"0",borderLeft:"1px solid #4d4d4d"},dot:{height:"0",width:"0",border:"5px solid #4d4d4d",borderRadius:"5px"}},dataColor:{fill:"#7DC1FF",stroke:"#3267D2",strokeWidth:1},cameraPosition:{horizontal:1,vertical:.5,distance:1.7},showLegend:void 0,backgroundColor:void 0,xBarWidth:void 0,yBarWidth:void 0,valueMin:void 0,valueMax:void 0,xMin:void 0,xMax:void 0,xStep:void 0,yMin:void 0,yMax:void 0,yStep:void 0,zMin:void 0,zMax:void 0,zStep:void 0},u(i.prototype),i.prototype._setScale=function(){this.scale=new l(1/this.xRange.range(),1/this.yRange.range(),1/this.zRange.range()),this.keepAspectRatio&&(this.scale.x0&&(s[r-1].pointNext=s[r]);return s},i.prototype.create=function(){for(;this.containerElement.hasChildNodes();)this.containerElement.removeChild(this.containerElement.firstChild);this.frame=document.createElement("div"),this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas);var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(t),this.frame.filter=document.createElement("div"),this.frame.filter.style.position="absolute",this.frame.filter.style.bottom="0px",this.frame.filter.style.left="0px",this.frame.filter.style.width="100%",this.frame.appendChild(this.frame.filter);var e=this,n=function(t){e._onMouseDown(t)},i=function(t){e._onTouchStart(t)},r=function(t){e._onWheel(t)},o=function(t){e._onTooltip(t)},s=function(t){e._onClick(t)};h.addEventListener(this.frame.canvas,"mousedown",n),h.addEventListener(this.frame.canvas,"touchstart",i),h.addEventListener(this.frame.canvas,"mousewheel",r),h.addEventListener(this.frame.canvas,"mousemove",o),h.addEventListener(this.frame.canvas,"click",s),this.containerElement.appendChild(this.frame)},i.prototype._setSize=function(t,e){this.frame.style.width=t,this.frame.style.height=e,this._resizeCanvas()},i.prototype._resizeCanvas=function(){this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=this.frame.canvas.clientWidth,this.frame.canvas.height=this.frame.canvas.clientHeight,this.frame.filter.style.width=this.frame.canvas.clientWidth-20+"px"},i.prototype.animationStart=function(){if(this.animationAutoStart&&this.dataGroup.dataFilter){if(!this.frame.filter||!this.frame.filter.slider)throw new Error("No animation available");this.frame.filter.slider.play()}},i.prototype.animationStop=function(){this.frame.filter&&this.frame.filter.slider&&this.frame.filter.slider.stop()},i.prototype._resizeCenter=function(){"%"===this.xCenter.charAt(this.xCenter.length-1)?this.currentXCenter=parseFloat(this.xCenter)/100*this.frame.canvas.clientWidth:this.currentXCenter=parseFloat(this.xCenter),"%"===this.yCenter.charAt(this.yCenter.length-1)?this.currentYCenter=parseFloat(this.yCenter)/100*(this.frame.canvas.clientHeight-this.frame.filter.clientHeight):this.currentYCenter=parseFloat(this.yCenter)},i.prototype.getCameraPosition=function(){var t=this.camera.getArmRotation();return t.distance=this.camera.getArmLength(),t},i.prototype._readData=function(t){this.dataPoints=this.dataGroup.initializeData(this,t,this.style),this._initializeRanges(),this._redrawFilter()},i.prototype.setData=function(t){void 0!==t&&null!==t&&(this._readData(t),this.redraw(),this.animationStart())},i.prototype.setOptions=function(t){if(void 0!==t){!0===m.validate(t,_)&&console.log("%cErrors have been found in the supplied options object.",y),this.animationStop(),p.setOptions(t,this),this.setPointDrawingMethod(),this._setSize(this.width,this.height),this.setData(this.dataGroup.getDataTable()),this.animationStart()}},i.prototype.setPointDrawingMethod=function(){var t=void 0;switch(this.style){case i.STYLE.BAR:t=i.prototype._redrawBarGraphPoint;break;case i.STYLE.BARCOLOR:t=i.prototype._redrawBarColorGraphPoint;break;case i.STYLE.BARSIZE:t=i.prototype._redrawBarSizeGraphPoint;break;case i.STYLE.DOT:t=i.prototype._redrawDotGraphPoint;break;case i.STYLE.DOTLINE:t=i.prototype._redrawDotLineGraphPoint;break;case i.STYLE.DOTCOLOR:t=i.prototype._redrawDotColorGraphPoint;break;case i.STYLE.DOTSIZE:t=i.prototype._redrawDotSizeGraphPoint;break;case i.STYLE.SURFACE:t=i.prototype._redrawSurfaceGraphPoint;break;case i.STYLE.GRID:t=i.prototype._redrawGridGraphPoint;break;case i.STYLE.LINE:t=i.prototype._redrawLineGraphPoint;break;default:throw new Error("Can not determine point drawing method for graph style '"+this.style+"'")}this._pointDrawingMethod=t},i.prototype.redraw=function(){if(void 0===this.dataPoints)throw new Error("Graph data not initialized");this._resizeCanvas(),this._resizeCenter(),this._redrawSlider(),this._redrawClear(),this._redrawAxis(),this._redrawDataGraph(),this._redrawInfo(),this._redrawLegend()},i.prototype._getContext=function(){var t=this.frame.canvas,e=t.getContext("2d");return e.lineJoin="round",e.lineCap="round",e},i.prototype._redrawClear=function(){var t=this.frame.canvas;t.getContext("2d").clearRect(0,0,t.width,t.height)},i.prototype._dotSize=function(){return this.frame.clientWidth*this.dotSizeRatio},i.prototype._getLegendWidth=function(){var t;if(this.style===i.STYLE.DOTSIZE){t=this._dotSize()*this.dotSizeMaxFraction}else t=this.style===i.STYLE.BARSIZE?this.xBarWidth:20;return t},i.prototype._redrawLegend=function(){if(!0===this.showLegend&&this.style!==i.STYLE.LINE&&this.style!==i.STYLE.BARSIZE){var t=this.style===i.STYLE.BARSIZE||this.style===i.STYLE.DOTSIZE,e=this.style===i.STYLE.DOTSIZE||this.style===i.STYLE.DOTCOLOR||this.style===i.STYLE.BARCOLOR,n=Math.max(.25*this.frame.clientHeight,100),r=this.margin,o=this._getLegendWidth(),s=this.frame.clientWidth-this.margin,a=s-o,u=r+n,h=this._getContext();if(h.lineWidth=1,h.font="14px arial",!1===t){var l,d=n;for(l=0;l0?(t.textAlign="center",t.textBaseline="top",o.y+=r):Math.sin(2*i)<0?(t.textAlign="right",t.textBaseline="middle"):(t.textAlign="left",t.textBaseline="middle"),t.fillStyle=this.axisColor,t.fillText(n,o.x,o.y)},i.prototype.drawAxisLabelY=function(t,e,n,i,r){void 0===r&&(r=0);var o=this._convert3Dto2D(e);Math.cos(2*i)<0?(t.textAlign="center",t.textBaseline="top",o.y+=r):Math.sin(2*i)>0?(t.textAlign="right",t.textBaseline="middle"):(t.textAlign="left",t.textBaseline="middle"),t.fillStyle=this.axisColor,t.fillText(n,o.x,o.y)},i.prototype.drawAxisLabelZ=function(t,e,n,i){void 0===i&&(i=0);var r=this._convert3Dto2D(e);t.textAlign="right",t.textBaseline="middle",t.fillStyle=this.axisColor,t.fillText(n,r.x-i,r.y)},i.prototype._line3d=function(t,e,n,i){var r=this._convert3Dto2D(e),o=this._convert3Dto2D(n);this._line(t,r,o,i)},i.prototype._redrawAxis=function(){var t,e,n,i,r,o,s,a,u,h,d,p=this._getContext();p.font=24/this.camera.getArmLength()+"px arial";var m,v=.025/this.scale.x,y=.025/this.scale.y,g=5/this.camera.getArmLength(),_=this.camera.getArmRotation().horizontal,w=new c(Math.cos(_),Math.sin(_)),b=this.xRange,x=this.yRange,S=this.zRange;for(p.lineWidth=1,i=void 0===this.defaultXStep,n=new f(b.min,b.max,this.xStep,i),n.start(!0);!n.end();){var M=n.getCurrent();if(this.showGrid?(t=new l(M,x.min,S.min),e=new l(M,x.max,S.min),this._line3d(p,t,e,this.gridColor)):this.showXAxis&&(t=new l(M,x.min,S.min),e=new l(M,x.min+v,S.min),this._line3d(p,t,e,this.axisColor),t=new l(M,x.max,S.min),e=new l(M,x.max-v,S.min),this._line3d(p,t,e,this.axisColor)),this.showXAxis){s=w.x>0?x.min:x.max,m=new l(M,s,S.min);var T=" "+this.xValueLabel(M)+" ";this.drawAxisLabelX(p,m,T,_,g)}n.next()}for(p.lineWidth=1,i=void 0===this.defaultYStep,n=new f(x.min,x.max,this.yStep,i),n.start(!0);!n.end();){var D=n.getCurrent();if(this.showGrid?(t=new l(b.min,D,S.min),e=new l(b.max,D,S.min),this._line3d(p,t,e,this.gridColor)):this.showYAxis&&(t=new l(b.min,D,S.min),e=new l(b.min+y,D,S.min),this._line3d(p,t,e,this.axisColor),t=new l(b.max,D,S.min),e=new l(b.max-y,D,S.min),this._line3d(p,t,e,this.axisColor)),this.showYAxis){o=w.y>0?b.min:b.max,m=new l(o,D,S.min);var k=" "+this.yValueLabel(D)+" ";this.drawAxisLabelY(p,m,k,_,g)}n.next()}if(this.showZAxis){for(p.lineWidth=1,i=void 0===this.defaultZStep,n=new f(S.min,S.max,this.zStep,i),n.start(!0),o=w.x>0?b.min:b.max,s=w.y<0?x.min:x.max;!n.end();){var O=n.getCurrent(),E=new l(o,s,O),C=this._convert3Dto2D(E);e=new c(C.x-g,C.y),this._line(p,C,e,this.axisColor);var P=this.zValueLabel(O)+" ";this.drawAxisLabelZ(p,E,P,5),n.next()}p.lineWidth=1,t=new l(o,s,S.min),e=new l(o,s,S.max),this._line3d(p,t,e,this.axisColor)}if(this.showXAxis){var L,R;p.lineWidth=1,L=new l(b.min,x.min,S.min),R=new l(b.max,x.min,S.min),this._line3d(p,L,R,this.axisColor),L=new l(b.min,x.max,S.min),R=new l(b.max,x.max,S.min),this._line3d(p,L,R,this.axisColor)}this.showYAxis&&(p.lineWidth=1,t=new l(b.min,x.min,S.min),e=new l(b.min,x.max,S.min),this._line3d(p,t,e,this.axisColor),t=new l(b.max,x.min,S.min),e=new l(b.max,x.max,S.min),this._line3d(p,t,e,this.axisColor));var A=this.xLabel;A.length>0&&this.showXAxis&&(d=.1/this.scale.y,o=(b.max+3*b.min)/4,s=w.x>0?x.min-d:x.max+d,r=new l(o,s,S.min),this.drawAxisLabelX(p,r,A,_));var Y=this.yLabel;Y.length>0&&this.showYAxis&&(h=.1/this.scale.x,o=w.y>0?b.min-h:b.max+h,s=(x.max+3*x.min)/4,r=new l(o,s,S.min),this.drawAxisLabelY(p,r,Y,_));var I=this.zLabel;I.length>0&&this.showZAxis&&(u=30,o=w.x>0?b.min:b.max,s=w.y<0?x.min:x.max,a=(S.max+3*S.min)/4,r=new l(o,s,a),this.drawAxisLabelZ(p,r,I,u))},i.prototype._hsv2rgb=function(t,e,n){var i,r,o,s,a,u;switch(s=n*e,a=Math.floor(t/60),u=s*(1-Math.abs(t/60%2-1)),a){case 0:i=s,r=u,o=0;break;case 1:i=u,r=s,o=0;break;case 2:i=0,r=s,o=u;break;case 3:i=0,r=u,o=s;break;case 4:i=u,r=0,o=s;break;case 5:i=s,r=0,o=u;break;default:i=0,r=0,o=0}return"RGB("+parseInt(255*i)+","+parseInt(255*r)+","+parseInt(255*o)+")"},i.prototype._getStrokeWidth=function(t){return void 0!==t?this.showPerspective?1/-t.trans.z*this.dataColor.strokeWidth:-this.eye.z/this.camera.getArmLength()*this.dataColor.strokeWidth:this.dataColor.strokeWidth},i.prototype._redrawBar=function(t,e,n,i,r,o){var s,a=this,u=e.point,h=this.zRange.min,c=[{point:new l(u.x-n,u.y-i,u.z)},{point:new l(u.x+n,u.y-i,u.z)},{point:new l(u.x+n,u.y+i,u.z)},{point:new l(u.x-n,u.y+i,u.z)}],d=[{point:new l(u.x-n,u.y-i,h)},{point:new l(u.x+n,u.y-i,h)},{point:new l(u.x+n,u.y+i,h)},{point:new l(u.x-n,u.y+i,h)}];c.forEach(function(t){t.screen=a._convert3Dto2D(t.point)}),d.forEach(function(t){t.screen=a._convert3Dto2D(t.point)});var f=[{corners:c,center:l.avg(d[0].point,d[2].point)},{corners:[c[0],c[1],d[1],d[0]],center:l.avg(d[1].point,d[0].point)},{corners:[c[1],c[2],d[2],d[1]],center:l.avg(d[2].point,d[1].point)},{corners:[c[2],c[3],d[3],d[2]],center:l.avg(d[3].point,d[2].point)},{corners:[c[3],c[0],d[0],d[3]],center:l.avg(d[0].point,d[3].point)}];e.surfaces=f;for(var p=0;p0}if(a){var f,p=(e.point.z+n.point.z+i.point.z+r.point.z)/4,m=240*(1-(p-this.zRange.min)*this.scale.z/this.verticalRatio);this.showShadow?(f=Math.min(1+c.x/d/2,1),o=this._hsv2rgb(m,1,f),s=o):(f=1,o=this._hsv2rgb(m,1,f),s=this.axisColor)}else o="gray",s=this.axisColor;t.lineWidth=this._getStrokeWidth(e);var v=[e,n,r,i];this._polygon(t,v,o,s)}},i.prototype._drawGridLine=function(t,e,n){if(void 0!==e&&void 0!==n){var i=(e.point.z+n.point.z)/2,r=240*(1-(i-this.zRange.min)*this.scale.z/this.verticalRatio);t.lineWidth=2*this._getStrokeWidth(e),t.strokeStyle=this._hsv2rgb(r,1,1),this._line(t,e.screen,n.screen)}},i.prototype._redrawGridGraphPoint=function(t,e){this._drawGridLine(t,e,e.pointRight),this._drawGridLine(t,e,e.pointTop)},i.prototype._redrawLineGraphPoint=function(t,e){void 0!==e.pointNext&&(t.lineWidth=this._getStrokeWidth(e),t.strokeStyle=this.dataColor.stroke,this._line(t,e.screen,e.pointNext.screen))},i.prototype._redrawDataGraph=function(){var t,e=this._getContext();if(!(void 0===this.dataPoints||this.dataPoints.length<=0))for(this._calcTranslations(this.dataPoints),t=0;t0?1:t<0?-1:0}var i=e[0],r=e[1],o=e[2],s=n((r.x-i.x)*(t.y-i.y)-(r.y-i.y)*(t.x-i.x)),a=n((o.x-r.x)*(t.y-r.y)-(o.y-r.y)*(t.x-r.x)),u=n((i.x-o.x)*(t.y-o.y)-(i.y-o.y)*(t.x-o.x));return!(0!=s&&0!=a&&s!=a||0!=a&&0!=u&&a!=u||0!=s&&0!=u&&s!=u)},i.prototype._dataPointFromXY=function(t,e){var n,r=null,o=null,s=null,a=new c(t,e);if(this.style===i.STYLE.BAR||this.style===i.STYLE.BARCOLOR||this.style===i.STYLE.BARSIZE)for(n=this.dataPoints.length-1;n>=0;n--){r=this.dataPoints[n];var u=r.surfaces;if(u)for(var h=u.length-1;h>=0;h--){var l=u[h],d=l.corners,f=[d[0].screen,d[1].screen,d[2].screen],p=[d[2].screen,d[3].screen,d[0].screen];if(this._insideTriangle(a,f)||this._insideTriangle(a,p))return r}}else for(n=0;n"+this.xLabel+":"+t.point.x+""+this.yLabel+":"+t.point.y+""+this.zLabel+":"+t.point.z+"",e.style.left="0",e.style.top="0",this.frame.appendChild(e),this.frame.appendChild(n),this.frame.appendChild(i);var r=e.offsetWidth,o=e.offsetHeight,s=n.offsetHeight,u=i.offsetWidth,h=i.offsetHeight,l=t.screen.x-r/2;l=Math.min(Math.max(l,10),this.frame.clientWidth-10-r),n.style.left=t.screen.x+"px",n.style.top=t.screen.y-s+"px",e.style.left=l+"px",e.style.top=t.screen.y-s-o+"px",i.style.left=t.screen.x-u/2+"px",i.style.top=t.screen.y-h/2+"px"},i.prototype._hideTooltip=function(){if(this.tooltip){this.tooltip.dataPoint=null;for(var t in this.tooltip.dom)if(this.tooltip.dom.hasOwnProperty(t)){var e=this.tooltip.dom[t];e&&e.parentNode&&e.parentNode.removeChild(e)}}},i.prototype.setCameraPosition=function(t){p.setCameraPosition(t,this),this.redraw()},i.prototype.setSize=function(t,e){this._setSize(t,e),this.redraw()},t.exports=i},function(t,e,n){t.exports={default:n(103),__esModule:!0}},function(t,e,n){n(104),t.exports=n(0).Object.assign},function(t,e,n){var i=n(4);i(i.S+i.F,"Object",{assign:n(105)})},function(t,e,n){var i=n(12),r=n(34),o=n(20),s=n(31),a=n(38),u=Object.assign;t.exports=!u||n(10)(function(){var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=i})?function(t,e){for(var n=s(t),u=arguments.length,h=1,l=r.f,c=o.f;u>h;)for(var d,f=a(arguments[h++]),p=l?i(f).concat(l(f)):i(f),m=p.length,v=0;m>v;)c.call(f,d=p[v++])&&(n[d]=f[d]);return n}:u},function(t,e){function n(t){if(t)return i(t)}function i(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){i.off(t,n),e.apply(this,arguments)}var i=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var i,r=0;ro)&&(i=o)}return i},i.prototype.getColumnRange=function(t,e){for(var n=new s,i=0;i0&&(e[n-1].pointNext=e[n]);return e},i.prototype._checkValueField=function(t){if(this.style===u.STYLE.BARCOLOR||this.style===u.STYLE.BARSIZE||this.style===u.STYLE.DOTCOLOR||this.style===u.STYLE.DOTSIZE){if(void 0===this.colValue)throw new Error("Expected data to have field 'style' for graph style '"+this.style+"'");if(void 0===t[0][this.colValue])throw new Error("Expected data to have field '"+this.colValue+"' for graph style '"+this.style+"'")}},t.exports=i},function(t,e,n){function i(){this.min=void 0,this.max=void 0}i.prototype.adjust=function(t){void 0!==t&&((void 0===this.min||this.min>t)&&(this.min=t),(void 0===this.max||this.maxn)throw new Error("Passed expansion value makes range invalid");this.min=e,this.max=n}},i.prototype.range=function(){return this.max-this.min},i.prototype.center=function(){return(this.min+this.max)/2},t.exports=i},function(t,e,n){function i(){var t=function(){};return{on:t,off:t,destroy:t,emit:t,get:function(e){return{set:t}}}}if("undefined"!=typeof window){var r=n(120),o=window.Hammer||n(121);t.exports=r(o,{preventDefault:"mouse"})}else t.exports=function(){return i()}},function(t,e,n){var i,r,o;!function(n){r=[],i=n,void 0!==(o="function"==typeof i?i.apply(e,r):i)&&(t.exports=o)}(function(){var t=null;return function e(n,i){function r(t){return t.match(/[^ ]+/g)}function o(e){if("hammer.input"!==e.type){if(e.srcEvent._handled||(e.srcEvent._handled={}),e.srcEvent._handled[e.type])return;e.srcEvent._handled[e.type]=!0}var n=!1;e.stopPropagation=function(){n=!0};var i=e.srcEvent.stopPropagation.bind(e.srcEvent);"function"==typeof i&&(e.srcEvent.stopPropagation=function(){i(),e.stopPropagation()}),e.firstTarget=t;for(var r=t;r&&!n;){var o=r.hammer;if(o)for(var s,a=0;a0?h._handlers[t]=i:(n.off(t,o),delete h._handlers[t]))}),h},h.emit=function(e,i){t=i.target,n.emit(e,i)},h.destroy=function(){var t=n.element.hammer,e=t.indexOf(h);-1!==e&&t.splice(e,1),t.length||delete n.element.hammer,h._handlers={},n.destroy()},h}})},function(t,e,n){var i;/*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license */ +!function(r,o,s,a){function u(t,e,n){return setTimeout(f(t,n),e)}function h(t,e,n){return!!Array.isArray(t)&&(l(t,n[e],n),!0)}function l(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==a)for(i=0;i\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),t.apply(this,arguments)}}function d(t,e,n){var i,r=e.prototype;i=t.prototype=Object.create(r),i.constructor=t,i._super=r,n&&pt(i,n)}function f(t,e){return function(){return t.apply(e,arguments)}}function p(t,e){return typeof t==yt?t.apply(e?e[0]||a:a,e):t}function m(t,e){return t===a?e:t}function v(t,e,n){l(w(e),function(e){t.addEventListener(e,n,!1)})}function y(t,e,n){l(w(e),function(e){t.removeEventListener(e,n,!1)})}function g(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function _(t,e){return t.indexOf(e)>-1}function w(t){return t.trim().split(/\s+/g)}function b(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;in[e]}):i.sort()),i}function M(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o1&&!n.firstMultiple?n.firstMultiple=R(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,u=e.center=A(i);e.timeStamp=wt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=N(a,u),e.distance=z(a,u),P(n,e),e.offsetDirection=I(e.deltaX,e.deltaY);var h=Y(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=h.x,e.overallVelocityY=h.y,e.overallVelocity=_t(h.x)>_t(h.y)?h.x:h.y,e.scale=s?j(s.pointers,i):1,e.rotation=s?W(s.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,L(n,e);var l=t.element;g(e.srcEvent.target,l)&&(l=e.srcEvent.target),e.target=l}function P(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==Et&&o.eventType!==Pt||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function L(t,e){var n,i,r,o,s=t.lastInterval||e,u=e.timeStamp-s.timeStamp;if(e.eventType!=Lt&&(u>Ot||s.velocity===a)){var h=e.deltaX-s.deltaX,l=e.deltaY-s.deltaY,c=Y(u,h,l);i=c.x,r=c.y,n=_t(c.x)>_t(c.y)?c.x:c.y,o=I(h,l),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}function R(t){for(var e=[],n=0;n=_t(e)?t<0?At:Yt:e<0?It:zt}function z(t,e,n){n||(n=Ft);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function N(t,e,n){n||(n=Ft);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function W(t,e){return N(e[1],e[0],Vt)+N(t[1],t[0],Vt)}function j(t,e){return z(e[0],e[1],Vt)/z(t[0],t[1],Vt)}function F(){this.evEl=Bt,this.evWin=Ut,this.pressed=!1,k.apply(this,arguments)}function V(){this.evEl=Zt,this.evWin=qt,k.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function G(){this.evTarget=Jt,this.evWin=Qt,this.started=!1,k.apply(this,arguments)}function B(t,e){var n=x(t.touches),i=x(t.changedTouches);return e&(Pt|Lt)&&(n=S(n.concat(i),"identifier",!0)),[n,i]}function U(){this.evTarget=te,this.targetIds={},k.apply(this,arguments)}function H(t,e){var n=x(t.touches),i=this.targetIds;if(e&(Et|Ct)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=x(t.changedTouches),a=[],u=this.target;if(o=n.filter(function(t){return g(t.target,u)}),e===Et)for(r=0;r-1&&i.splice(t,1)};setTimeout(r,ee)}}function $(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){n.manager.emit(e,t)}var n=this,i=this.state;i=pe&&e(n.options.event+tt(i))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&r&e.direction},attrTest:function(t){return it.prototype.attrTest.call(this,t)&&(this.state&de||!(this.state&de)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=et(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),d(ot,it,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ae]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&de)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),d(st,K,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[oe]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distancee.time;if(this._input=t,!i||!n||t.eventType&(Pt|Lt)&&!r)this.reset();else if(t.eventType&Et)this.reset(),this._timer=u(function(){this.state=me,this.tryEmit()},e.time,this);else if(t.eventType&Pt)return me;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===me&&(t&&t.eventType&Pt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=wt(),this.manager.emit(this.options.event,this._input)))}}),d(at,it,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ae]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&de)}}),d(ut,it,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Nt|Wt,pointers:1},getTouchAction:function(){return rt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(Nt|Wt)?e=t.overallVelocity:n&Nt?e=t.overallVelocityX:n&Wt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&_t(e)>this.options.velocity&&t.eventType&Pt},emit:function(t){var e=et(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),d(ht,K,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[se]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance2&&void 0!==arguments[2]&&arguments[2];for(var n in e)void 0!==i[n]&&("object"!==(0,u.default)(i[n])?void 0!==i[n]&&null!==i[n]||void 0===e[n]||o!==!0?e[n]=i[n]:delete e[n]:"object"===(0,u.default)(e[n])&&t.fillIfDefined(e[n],i[n],o))},t.protoExtend=function(e,t){for(var i=1;i3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s=2;s3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s in o)if(o.hasOwnProperty(s)&&e.indexOf(s)==-1)if(o[s]&&o[s].constructor===Object)void 0===i[s]&&(i[s]={}),i[s].constructor===Object?t.deepExtend(i[s],o[s]):null===o[s]&&void 0!==i[s]&&n===!0?delete i[s]:i[s]=o[s];else if(Array.isArray(o[s])){i[s]=[];for(var r=0;r=0&&(t="DOMMouseScroll"),e.addEventListener(t,i,o)):e.attachEvent("on"+t,i)},t.removeEventListener=function(e,t,i,o){e.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===t&&navigator.userAgent.indexOf("Firefox")>=0&&(t="DOMMouseScroll"),e.removeEventListener(t,i,o)):e.detachEvent("on"+t,i)},t.preventDefault=function(e){e||(e=window.event),e.preventDefault?e.preventDefault():e.returnValue=!1},t.getTarget=function(e){e||(e=window.event);var t;return e.target?t=e.target:e.srcElement&&(t=e.srcElement),void 0!=t.nodeType&&3==t.nodeType&&(t=t.parentNode),t},t.hasParent=function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parentNode}return!1},t.option={},t.option.asBoolean=function(e,t){return"function"==typeof e&&(e=e()),null!=e?0!=e:t||null},t.option.asNumber=function(e,t){return"function"==typeof e&&(e=e()),null!=e?Number(e)||t||null:t||null},t.option.asString=function(e,t){return"function"==typeof e&&(e=e()),null!=e?String(e):t||null},t.option.asSize=function(e,i){return"function"==typeof e&&(e=e()),t.isString(e)?e:t.isNumber(e)?e+"px":i||null},t.option.asElement=function(e,t){return"function"==typeof e&&(e=e()),e||t||null},t.hexToRGB=function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(t,function(e,t,i,o){return t+t+i+i+o+o});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},t.overrideOpacity=function(e,i){if(e.indexOf("rgba")!=-1)return e;if(e.indexOf("rgb")!=-1){var o=e.substr(e.indexOf("(")+1).replace(")","").split(",");return"rgba("+o[0]+","+o[1]+","+o[2]+","+i+")"}var o=t.hexToRGB(e);return null==o?e:"rgba("+o.r+","+o.g+","+o.b+","+i+")"},t.RGBToHex=function(e,t,i){return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)},t.parseColor=function(e){var i;if(t.isString(e)===!0){if(t.isValidRGB(e)===!0){var o=e.substr(4).substr(0,e.length-5).split(",").map(function(e){return parseInt(e)});e=t.RGBToHex(o[0],o[1],o[2])}if(t.isValidHex(e)===!0){var n=t.hexToHSV(e),s={h:n.h,s:.8*n.s,v:Math.min(1,1.02*n.v)},r={h:n.h,s:Math.min(1,1.25*n.s),v:.8*n.v},a=t.HSVToHex(r.h,r.s,r.v),d=t.HSVToHex(s.h,s.s,s.v);i={background:e,border:a,highlight:{background:d,border:a},hover:{background:d,border:a}}}else i={background:e,border:e,highlight:{background:e,border:e},hover:{background:e,border:e}}}else i={},i.background=e.background||void 0,i.border=e.border||void 0,t.isString(e.highlight)?i.highlight={border:e.highlight,background:e.highlight}:(i.highlight={},i.highlight.background=e.highlight&&e.highlight.background||void 0,i.highlight.border=e.highlight&&e.highlight.border||void 0),t.isString(e.hover)?i.hover={border:e.hover,background:e.hover}:(i.hover={},i.hover.background=e.hover&&e.hover.background||void 0,i.hover.border=e.hover&&e.hover.border||void 0);return i},t.RGBToHSV=function(e,t,i){e/=255,t/=255,i/=255;var o=Math.min(e,Math.min(t,i)),n=Math.max(e,Math.max(t,i));if(o==n)return{h:0,s:0,v:o};var s=e==o?t-i:i==o?e-t:i-e,r=e==o?3:i==o?1:5,a=60*(r-s/(n-o))/360,d=(n-o)/n,h=n;return{h:a,s:d,v:h}};var v={split:function(e){var t={};return e.split(";").forEach(function(e){if(""!=e.trim()){var i=e.split(":"),o=i[0].trim(),n=i[1].trim();t[o]=n}}),t},join:function(e){return(0,h.default)(e).map(function(t){return t+": "+e[t]}).join("; ")}};t.addCssText=function(e,i){var o=v.split(e.style.cssText),n=v.split(i),s=t.extend(o,n);e.style.cssText=v.join(s)},t.removeCssText=function(e,t){var i=v.split(e.style.cssText),o=v.split(t);for(var n in o)o.hasOwnProperty(n)&&delete i[n];e.style.cssText=v.join(i)},t.HSVToRGB=function(e,t,i){var o,n,s,r=Math.floor(6*e),a=6*e-r,d=i*(1-t),h=i*(1-a*t),l=i*(1-(1-a)*t);switch(r%6){case 0:o=i,n=l,s=d;break;case 1:o=h,n=i,s=d;break;case 2:o=d,n=i,s=l;break;case 3:o=d,n=h,s=i;break;case 4:o=l,n=d,s=i;break;case 5:o=i,n=d,s=h}return{r:Math.floor(255*o),g:Math.floor(255*n),b:Math.floor(255*s)}},t.HSVToHex=function(e,i,o){var n=t.HSVToRGB(e,i,o);return t.RGBToHex(n.r,n.g,n.b)},t.hexToHSV=function(e){var i=t.hexToRGB(e);return t.RGBToHSV(i.r,i.g,i.b)},t.isValidHex=function(e){var t=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e);return t},t.isValidRGB=function(e){e=e.replace(" ","");var t=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(e);return t},t.isValidRGBA=function(e){e=e.replace(" ","");var t=/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(e);return t},t.selectiveBridgeObject=function(e,i){if("object"==("undefined"==typeof i?"undefined":(0,u.default)(i))){for(var o=(0,a.default)(i),n=0;n0&&t(o,e[n-1])<0;n--)e[n]=e[n-1];e[n]=o}return e},t.mergeOptions=function(e,t,i){var o=(arguments.length>3&&void 0!==arguments[3]&&arguments[3],arguments.length>4&&void 0!==arguments[4]?arguments[4]:{});if(null===t[i])e[i]=(0,a.default)(o[i]);else if(void 0!==t[i])if("boolean"==typeof t[i])e[i].enabled=t[i];else{void 0===t[i].enabled&&(e[i].enabled=!0);for(var n in t[i])t[i].hasOwnProperty(n)&&(e[i][n]=t[i][n])}},t.binarySearchCustom=function(e,t,i,o){for(var n=1e4,s=0,r=0,a=e.length-1;r<=a&&s0)return"before"==o?Math.max(0,d-1):d;if(n(r,t)<0&&n(a,t)>0)return"before"==o?d:Math.min(e.length-1,d+1);n(r,t)<0?u=d+1:c=d-1,l++}return-1},t.easingFunctions={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:-1+(4-2*e)*e},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},t.getScrollBarWidth=function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var i=e.offsetWidth;t.style.overflow="scroll";var o=e.offsetWidth;return i==o&&(o=t.clientWidth),document.body.removeChild(t),i-o},t.topMost=function(e,t){var i=void 0;Array.isArray(t)||(t=[t]);var o=!0,n=!1,r=void 0;try{for(var a,d=(0,s.default)(e);!(o=(a=d.next()).done);o=!0){var h=a.value;if(h){i=h[t[0]];for(var l=1;l=e.length?(this._t=void 0,n(1)):"keys"==t?n(0,i):"values"==t?n(0,e[i]):n(0,[i,e[i]])},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports={}},function(e,t,i){var o=i(10),n=i(12);e.exports=function(e){return o(n(e))}},function(e,t,i){var o=i(11);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==o(e)?e.split(""):Object(e)}},function(e,t){var i={}.toString;e.exports=function(e){return i.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,i){var o=i(14),n=i(15),s=i(30),r=i(20),a=i(31),d=i(8),h=i(32),l=i(46),u=i(48),c=i(47)("iterator"),f=!([].keys&&"next"in[].keys()),p="@@iterator",v="keys",g="values",y=function(){return this};e.exports=function(e,t,i,m,b,_,w){h(i,t,m);var k,x,O,M=function(e){if(!f&&e in C)return C[e];switch(e){case v:return function(){return new i(this,e)};case g:return function(){return new i(this,e)}}return function(){return new i(this,e)}},E=t+" Iterator",S=b==g,D=!1,C=e.prototype,T=C[c]||C[p]||b&&C[b],P=T||M(b),F=b?S?M("entries"):P:void 0,I="Array"==t?C.entries||T:T;if(I&&(O=u(I.call(new e)),O!==Object.prototype&&(l(O,E,!0),o||a(O,c)||r(O,c,y))),S&&T&&T.name!==g&&(D=!0,P=function(){return T.call(this)}),o&&!w||!f&&!D&&C[c]||r(C,c,P),d[t]=P,d[E]=y,b)if(k={values:S?P:M(g),keys:_?P:M(v),entries:F},w)for(x in k)x in C||s(C,x,k[x]);else n(n.P+n.F*(f||D),t,k);return k}},function(e,t){e.exports=!0},function(e,t,i){var o=i(16),n=i(17),s=i(18),r=i(20),a="prototype",d=function(e,t,i){var h,l,u,c=e&d.F,f=e&d.G,p=e&d.S,v=e&d.P,g=e&d.B,y=e&d.W,m=f?n:n[t]||(n[t]={}),b=m[a],_=f?o:p?o[t]:(o[t]||{})[a];f&&(i=t);for(h in i)l=!c&&_&&void 0!==_[h],l&&h in m||(u=l?_[h]:i[h],m[h]=f&&"function"!=typeof _[h]?i[h]:g&&l?s(u,o):y&&_[h]==u?function(e){var t=function(t,i,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,i)}return new e(t,i,o)}return e.apply(this,arguments)};return t[a]=e[a],t}(u):v&&"function"==typeof u?s(Function.call,u):u,v&&((m.virtual||(m.virtual={}))[h]=u,e&d.R&&b&&!b[h]&&r(b,h,u)))};d.F=1,d.G=2,d.S=4,d.P=8,d.B=16,d.W=32,d.U=64,d.R=128,e.exports=d},function(e,t){var i=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(e,t){var i=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)},function(e,t,i){var o=i(19);e.exports=function(e,t,i){if(o(e),void 0===t)return e;switch(i){case 1:return function(i){return e.call(t,i)};case 2:return function(i,o){return e.call(t,i,o)};case 3:return function(i,o,n){return e.call(t,i,o,n)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,i){var o=i(21),n=i(29);e.exports=i(25)?function(e,t,i){return o.f(e,t,n(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){var o=i(22),n=i(24),s=i(28),r=Object.defineProperty;t.f=i(25)?Object.defineProperty:function(e,t,i){if(o(e),t=s(t,!0),o(i),n)try{return r(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(e[t]=i.value),e}},function(e,t,i){var o=i(23);e.exports=function(e){if(!o(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,i){e.exports=!i(25)&&!i(26)(function(){return 7!=Object.defineProperty(i(27)("div"),"a",{get:function(){return 7}}).a})},function(e,t,i){e.exports=!i(26)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,i){var o=i(23),n=i(16).document,s=o(n)&&o(n.createElement);e.exports=function(e){return s?n.createElement(e):{}}},function(e,t,i){var o=i(23);e.exports=function(e,t){if(!o(e))return e;var i,n;if(t&&"function"==typeof(i=e.toString)&&!o(n=i.call(e)))return n;if("function"==typeof(i=e.valueOf)&&!o(n=i.call(e)))return n;if(!t&&"function"==typeof(i=e.toString)&&!o(n=i.call(e)))return n;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,i){e.exports=i(20)},function(e,t){var i={}.hasOwnProperty;e.exports=function(e,t){return i.call(e,t)}},function(e,t,i){var o=i(33),n=i(29),s=i(46),r={};i(20)(r,i(47)("iterator"),function(){return this}),e.exports=function(e,t,i){e.prototype=o(r,{next:n(1,i)}),s(e,t+" Iterator")}},function(e,t,i){var o=i(22),n=i(34),s=i(44),r=i(41)("IE_PROTO"),a=function(){},d="prototype",h=function(){var e,t=i(27)("iframe"),o=s.length,n="<",r=">";for(t.style.display="none",i(45).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(n+"script"+r+"document.F=Object"+n+"/script"+r),e.close(),h=e.F;o--;)delete h[d][s[o]];return h()};e.exports=Object.create||function(e,t){var i;return null!==e?(a[d]=o(e),i=new a,a[d]=null,i[r]=e):i=h(),void 0===t?i:n(i,t)}},function(e,t,i){var o=i(21),n=i(22),s=i(35);e.exports=i(25)?Object.defineProperties:function(e,t){n(e);for(var i,r=s(t),a=r.length,d=0;a>d;)o.f(e,i=r[d++],t[i]);return e}},function(e,t,i){var o=i(36),n=i(44);e.exports=Object.keys||function(e){return o(e,n)}},function(e,t,i){var o=i(31),n=i(9),s=i(37)(!1),r=i(41)("IE_PROTO");e.exports=function(e,t){var i,a=n(e),d=0,h=[];for(i in a)i!=r&&o(a,i)&&h.push(i);for(;t.length>d;)o(a,i=t[d++])&&(~s(h,i)||h.push(i));return h}},function(e,t,i){var o=i(9),n=i(38),s=i(40);e.exports=function(e){return function(t,i,r){var a,d=o(t),h=n(d.length),l=s(r,h);if(e&&i!=i){for(;h>l;)if(a=d[l++],a!=a)return!0}else for(;h>l;l++)if((e||l in d)&&d[l]===i)return e||l||0;return!e&&-1}}},function(e,t,i){var o=i(39),n=Math.min;e.exports=function(e){return e>0?n(o(e),9007199254740991):0}},function(e,t){var i=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:i)(e)}},function(e,t,i){var o=i(39),n=Math.max,s=Math.min;e.exports=function(e,t){return e=o(e),e<0?n(e+t,0):s(e,t)}},function(e,t,i){var o=i(42)("keys"),n=i(43);e.exports=function(e){return o[e]||(o[e]=n(e))}},function(e,t,i){var o=i(16),n="__core-js_shared__",s=o[n]||(o[n]={});e.exports=function(e){return s[e]||(s[e]={})}},function(e,t){var i=0,o=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++i+o).toString(36))}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,i){e.exports=i(16).document&&document.documentElement},function(e,t,i){var o=i(21).f,n=i(31),s=i(47)("toStringTag");e.exports=function(e,t,i){e&&!n(e=i?e:e.prototype,s)&&o(e,s,{configurable:!0,value:t})}},function(e,t,i){var o=i(42)("wks"),n=i(43),s=i(16).Symbol,r="function"==typeof s,a=e.exports=function(e){return o[e]||(o[e]=r&&s[e]||(r?s:n)("Symbol."+e))};a.store=o},function(e,t,i){var o=i(31),n=i(49),s=i(41)("IE_PROTO"),r=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=n(e),o(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?r:null}},function(e,t,i){var o=i(12);e.exports=function(e){return Object(o(e))}},function(e,t,i){var o=i(51)(!0);i(13)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,i=this._i;return i>=t.length?{value:void 0,done:!0}:(e=o(t,i),this._i+=e.length,{value:e,done:!1})})},function(e,t,i){var o=i(39),n=i(12);e.exports=function(e){return function(t,i){var s,r,a=String(n(t)),d=o(i),h=a.length;return d<0||d>=h?e?"":void 0:(s=a.charCodeAt(d),s<55296||s>56319||d+1===h||(r=a.charCodeAt(d+1))<56320||r>57343?e?a.charAt(d):s:e?a.slice(d,d+2):(s-55296<<10)+(r-56320)+65536)}}},function(e,t,i){var o=i(22),n=i(53);e.exports=i(17).getIterator=function(e){var t=n(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return o(t.call(e))}},function(e,t,i){var o=i(54),n=i(47)("iterator"),s=i(8);e.exports=i(17).getIteratorMethod=function(e){if(void 0!=e)return e[n]||e["@@iterator"]||s[o(e)]}},function(e,t,i){var o=i(11),n=i(47)("toStringTag"),s="Arguments"==o(function(){return arguments}()),r=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,i,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=r(t=Object(e),n))?i:s?o(t):"Object"==(a=o(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,i){e.exports={default:i(56),__esModule:!0}},function(e,t,i){i(57);var o=i(17).Object;e.exports=function(e,t){return o.create(e,t)}},function(e,t,i){var o=i(15);o(o.S,"Object",{create:i(33)})},function(e,t,i){e.exports={default:i(59),__esModule:!0}},function(e,t,i){i(60),e.exports=i(17).Object.keys},function(e,t,i){var o=i(49),n=i(35);i(61)("keys",function(){return function(e){return n(o(e))}})},function(e,t,i){var o=i(15),n=i(17),s=i(26);e.exports=function(e,t){var i=(n.Object||{})[e]||Object[e],r={};r[e]=t(i),o(o.S+o.F*s(function(){i(1)}),"Object",r)}},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var n=i(63),s=o(n),r=i(66),a=o(r),d="function"==typeof a.default&&"symbol"==typeof s.default?function(e){return typeof e}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":typeof e};t.default="function"==typeof a.default&&"symbol"===d(s.default)?function(e){return"undefined"==typeof e?"undefined":d(e)}:function(e){return e&&"function"==typeof a.default&&e.constructor===a.default&&e!==a.default.prototype?"symbol":"undefined"==typeof e?"undefined":d(e)}},function(e,t,i){e.exports={default:i(64),__esModule:!0}},function(e,t,i){i(50),i(4),e.exports=i(65).f("iterator")},function(e,t,i){t.f=i(47)},function(e,t,i){e.exports={default:i(67),__esModule:!0}},function(e,t,i){i(68),i(79),i(80),i(81),e.exports=i(17).Symbol},function(e,t,i){var o=i(16),n=i(31),s=i(25),r=i(15),a=i(30),d=i(69).KEY,h=i(26),l=i(42),u=i(46),c=i(43),f=i(47),p=i(65),v=i(70),g=i(71),y=i(72),m=i(75),b=i(22),_=i(9),w=i(28),k=i(29),x=i(33),O=i(76),M=i(78),E=i(21),S=i(35),D=M.f,C=E.f,T=O.f,P=o.Symbol,F=o.JSON,I=F&&F.stringify,N="prototype",B=f("_hidden"),z=f("toPrimitive"),A={}.propertyIsEnumerable,R=l("symbol-registry"),j=l("symbols"),H=l("op-symbols"),L=Object[N],W="function"==typeof P,Y=o.QObject,V=!Y||!Y[N]||!Y[N].findChild,U=s&&h(function(){return 7!=x(C({},"a",{get:function(){return C(this,"a",{value:7}).a}})).a})?function(e,t,i){var o=D(L,t);o&&delete L[t],C(e,t,i),o&&e!==L&&C(L,t,o)}:C,q=function(e){var t=j[e]=x(P[N]);return t._k=e,t},G=W&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},X=function(e,t,i){return e===L&&X(H,t,i),b(e),t=w(t,!0),b(i),n(j,t)?(i.enumerable?(n(e,B)&&e[B][t]&&(e[B][t]=!1),i=x(i,{enumerable:k(0,!1)})):(n(e,B)||C(e,B,k(1,{})),e[B][t]=!0),U(e,t,i)):C(e,t,i)},K=function(e,t){b(e);for(var i,o=y(t=_(t)),n=0,s=o.length;s>n;)X(e,i=o[n++],t[i]);return e},Z=function(e,t){return void 0===t?x(e):K(x(e),t)},Q=function(e){var t=A.call(this,e=w(e,!0));return!(this===L&&n(j,e)&&!n(H,e))&&(!(t||!n(this,e)||!n(j,e)||n(this,B)&&this[B][e])||t)},$=function(e,t){if(e=_(e),t=w(t,!0),e!==L||!n(j,t)||n(H,t)){var i=D(e,t);return!i||!n(j,t)||n(e,B)&&e[B][t]||(i.enumerable=!0),i}},J=function(e){for(var t,i=T(_(e)),o=[],s=0;i.length>s;)n(j,t=i[s++])||t==B||t==d||o.push(t);return o},ee=function(e){for(var t,i=e===L,o=T(i?H:_(e)),s=[],r=0;o.length>r;)!n(j,t=o[r++])||i&&!n(L,t)||s.push(j[t]);return s};W||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=c(arguments.length>0?arguments[0]:void 0),t=function(i){this===L&&t.call(H,i),n(this,B)&&n(this[B],e)&&(this[B][e]=!1),U(this,e,k(1,i))};return s&&V&&U(L,e,{configurable:!0,set:t}),q(e)},a(P[N],"toString",function(){return this._k}),M.f=$,E.f=X,i(77).f=O.f=J,i(74).f=Q,i(73).f=ee,s&&!i(14)&&a(L,"propertyIsEnumerable",Q,!0),p.f=function(e){return q(f(e))}),r(r.G+r.W+r.F*!W,{Symbol:P});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ie=0;te.length>ie;)f(te[ie++]);for(var te=S(f.store),ie=0;te.length>ie;)v(te[ie++]);r(r.S+r.F*!W,"Symbol",{for:function(e){return n(R,e+="")?R[e]:R[e]=P(e)},keyFor:function(e){if(G(e))return g(R,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){V=!0},useSimple:function(){V=!1}}),r(r.S+r.F*!W,"Object",{create:Z,defineProperty:X,defineProperties:K,getOwnPropertyDescriptor:$,getOwnPropertyNames:J,getOwnPropertySymbols:ee}),F&&r(r.S+r.F*(!W||h(function(){var e=P();return"[null]"!=I([e])||"{}"!=I({a:e})||"{}"!=I(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!G(e)){for(var t,i,o=[e],n=1;arguments.length>n;)o.push(arguments[n++]);return t=o[1],"function"==typeof t&&(i=t),!i&&m(t)||(t=function(e,t){if(i&&(t=i.call(this,e,t)),!G(t))return t}),o[1]=t,I.apply(F,o)}}}),P[N][z]||i(20)(P[N],z,P[N].valueOf),u(P,"Symbol"),u(Math,"Math",!0),u(o.JSON,"JSON",!0)},function(e,t,i){var o=i(43)("meta"),n=i(23),s=i(31),r=i(21).f,a=0,d=Object.isExtensible||function(){return!0},h=!i(26)(function(){return d(Object.preventExtensions({}))}),l=function(e){r(e,o,{value:{i:"O"+ ++a,w:{}}})},u=function(e,t){if(!n(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,o)){if(!d(e))return"F";if(!t)return"E";l(e)}return e[o].i},c=function(e,t){if(!s(e,o)){if(!d(e))return!0;if(!t)return!1;l(e)}return e[o].w},f=function(e){return h&&p.NEED&&d(e)&&!s(e,o)&&l(e),e},p=e.exports={KEY:o,NEED:!1,fastKey:u,getWeak:c,onFreeze:f}},function(e,t,i){var o=i(16),n=i(17),s=i(14),r=i(65),a=i(21).f;e.exports=function(e){var t=n.Symbol||(n.Symbol=s?{}:o.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:r.f(e)})}},function(e,t,i){var o=i(35),n=i(9);e.exports=function(e,t){for(var i,s=n(e),r=o(s),a=r.length,d=0;a>d;)if(s[i=r[d++]]===t)return i}},function(e,t,i){var o=i(35),n=i(73),s=i(74);e.exports=function(e){var t=o(e),i=n.f;if(i)for(var r,a=i(e),d=s.f,h=0;a.length>h;)d.call(e,r=a[h++])&&t.push(r);return t}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,i){var o=i(11);e.exports=Array.isArray||function(e){return"Array"==o(e)}},function(e,t,i){var o=i(9),n=i(77).f,s={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(e){try{return n(e)}catch(e){return r.slice()}};e.exports.f=function(e){return r&&"[object Window]"==s.call(e)?a(e):n(o(e))}},function(e,t,i){var o=i(36),n=i(44).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return o(e,n)}},function(e,t,i){var o=i(74),n=i(29),s=i(9),r=i(28),a=i(31),d=i(24),h=Object.getOwnPropertyDescriptor;t.f=i(25)?h:function(e,t){if(e=s(e),t=r(t,!0),d)try{return h(e,t)}catch(e){}if(a(e,t))return n(!o.f.call(e,t),e[t])}},function(e,t){},function(e,t,i){i(70)("asyncIterator")},function(e,t,i){i(70)("observable")},function(e,t,i){e.exports="undefined"!=typeof window&&window.moment||i(83)},function(e,t,i){(function(e){!function(t,i){e.exports=i()}(this,function(){function t(){return _o.apply(null,arguments)}function i(e){_o=e}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function n(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function s(e){var t;for(t in e)return!1;return!0}function r(e){return void 0===e}function a(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function d(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function h(e,t){var i,o=[];for(i=0;i0)for(i=0;i0?"future":"past"];return E(i)?i(t):i.replace(/%s/i,t)}function z(e,t){var i=e.toLowerCase();Bo[i]=Bo[i+"s"]=Bo[t]=e}function A(e){return"string"==typeof e?Bo[e]||Bo[e.toLowerCase()]:void 0}function R(e){var t,i,o={};for(i in e)l(e,i)&&(t=A(i),t&&(o[t]=e[i]));return o}function j(e,t){zo[e]=t}function H(e){var t=[];for(var i in e)t.push({unit:i,priority:zo[i]});return t.sort(function(e,t){return e.priority-t.priority}),t}function L(e,i){return function(o){return null!=o?(Y(this,e,o),t.updateOffset(this,i),this):W(this,e)}}function W(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Y(e,t,i){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](i)}function V(e){return e=A(e),E(this[e])?this[e]():this}function U(e,t){if("object"==typeof e){e=R(e);for(var i=H(e),o=0;o=0;return(s?i?"+":"":"-")+Math.pow(10,Math.max(0,n)).toString().substr(1)+o}function G(e,t,i,o){var n=o;"string"==typeof o&&(n=function(){return this[o]()}),e&&(Ho[e]=n),t&&(Ho[t[0]]=function(){return q(n.apply(this,arguments),t[1],t[2])}),i&&(Ho[i]=function(){return this.localeData().ordinal(n.apply(this,arguments),e)})}function X(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function K(e){var t,i,o=e.match(Ao);for(t=0,i=o.length;t=0&&Ro.test(e);)e=e.replace(Ro,i),Ro.lastIndex=0,o-=1;return e}function $(e,t,i){sn[e]=E(t)?t:function(e,o){return e&&i?i:t}}function J(e,t){return l(sn,e)?sn[e](t._strict,t._locale):new RegExp(ee(e))}function ee(e){return te(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,o,n){return t||i||o||n}))}function te(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ie(e,t){var i,o=t;for("string"==typeof e&&(e=[e]),a(t)&&(o=function(e,i){i[t]=w(e)}),i=0;i=0&&isFinite(a.getFullYear())&&a.setFullYear(e),a}function _e(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function we(e,t,i){var o=7+t-i,n=(7+_e(e,0,o).getUTCDay()-t)%7;return-n+o-1}function ke(e,t,i,o,n){var s,r,a=(7+i-o)%7,d=we(e,o,n),h=1+7*(t-1)+a+d;return h<=0?(s=e-1,r=ge(s)+h):h>ge(e)?(s=e+1,r=h-ge(e)):(s=e,r=h),{year:s,dayOfYear:r}}function xe(e,t,i){var o,n,s=we(e.year(),t,i),r=Math.floor((e.dayOfYear()-s-1)/7)+1;return r<1?(n=e.year()-1,o=r+Oe(n,t,i)):r>Oe(e.year(),t,i)?(o=r-Oe(e.year(),t,i),n=e.year()+1):(n=e.year(),o=r),{week:o,year:n}}function Oe(e,t,i){var o=we(e,t,i),n=we(e+1,t,i);return(ge(e)-o+n)/7}function Me(e){return xe(e,this._week.dow,this._week.doy).week}function Ee(){return this._week.dow}function Se(){return this._week.doy}function De(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Ce(e){var t=xe(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Te(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function Pe(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Fe(e,t){return e?o(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:o(this._weekdays)?this._weekdays:this._weekdays.standalone}function Ie(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Ne(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Be(e,t,i){var o,n,s,r=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)s=c([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(s,"").toLocaleLowerCase();return i?"dddd"===t?(n=gn.call(this._weekdaysParse,r),n!==-1?n:null):"ddd"===t?(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:null):(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:null):"dddd"===t?(n=gn.call(this._weekdaysParse,r),n!==-1?n:(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:null))):"ddd"===t?(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:(n=gn.call(this._weekdaysParse,r),n!==-1?n:(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:null))):(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:(n=gn.call(this._weekdaysParse,r),n!==-1?n:(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:null)))}function ze(e,t,i){var o,n,s;if(this._weekdaysParseExact)return Be.call(this,e,t,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(n=c([2e3,1]).day(o),i&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(n,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(n,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(n,"").replace(".",".?")+"$","i")),this._weekdaysParse[o]||(s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[o]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===t&&this._fullWeekdaysParse[o].test(e))return o;if(i&&"ddd"===t&&this._shortWeekdaysParse[o].test(e))return o;if(i&&"dd"===t&&this._minWeekdaysParse[o].test(e))return o;if(!i&&this._weekdaysParse[o].test(e))return o}}function Ae(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Te(e,this.localeData()),this.add(e-t,"d")):t}function Re(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function je(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Pe(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function He(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ye.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Sn),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function Le(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ye.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Dn),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function We(e){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Ye.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Cn),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ye(){function e(e,t){return t.length-e.length}var t,i,o,n,s,r=[],a=[],d=[],h=[];for(t=0;t<7;t++)i=c([2e3,1]).day(t),o=this.weekdaysMin(i,""),n=this.weekdaysShort(i,""),s=this.weekdays(i,""),r.push(o),a.push(n),d.push(s),h.push(o),h.push(n),h.push(s);for(r.sort(e),a.sort(e),d.sort(e),h.sort(e),t=0;t<7;t++)a[t]=te(a[t]),d[t]=te(d[t]),h[t]=te(h[t]);this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Ve(){return this.hours()%12||12}function Ue(){return this.hours()||24}function qe(e,t){G(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ge(e,t){return t._meridiemParse}function Xe(e){return"p"===(e+"").toLowerCase().charAt(0)}function Ke(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"}function Ze(e){return e?e.toLowerCase().replace("_","-"):e}function Qe(e){for(var t,i,o,n,s=0;s0;){if(o=$e(n.slice(0,t).join("-")))return o;if(i&&i.length>=t&&k(n,i,!0)>=t-1)break;t--}s++}return null}function $e(t){var i=null;if(!Nn[t]&&"undefined"!=typeof e&&e&&e.exports)try{i=Tn._abbr,!function(){var e=new Error('Cannot find module "./locale"');throw e.code="MODULE_NOT_FOUND",e}(),Je(i)}catch(e){}return Nn[t]}function Je(e,t){var i;return e&&(i=r(t)?it(e):et(e,t),i&&(Tn=i)),Tn._abbr}function et(e,t){if(null!==t){var i=In;if(t.abbr=e,null!=Nn[e])M("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=Nn[e]._config;else if(null!=t.parentLocale){if(null==Nn[t.parentLocale])return Bn[t.parentLocale]||(Bn[t.parentLocale]=[]),Bn[t.parentLocale].push({name:e,config:t}),null;i=Nn[t.parentLocale]._config}return Nn[e]=new C(D(i,t)),Bn[e]&&Bn[e].forEach(function(e){et(e.name,e.config)}),Je(e),Nn[e]}return delete Nn[e],null}function tt(e,t){if(null!=t){var i,o=In;null!=Nn[e]&&(o=Nn[e]._config),t=D(o,t),i=new C(t),i.parentLocale=Nn[e],Nn[e]=i,Je(e)}else null!=Nn[e]&&(null!=Nn[e].parentLocale?Nn[e]=Nn[e].parentLocale:null!=Nn[e]&&delete Nn[e]);return Nn[e]}function it(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Tn;if(!o(e)){if(t=$e(e))return t;e=[e]}return Qe(e)}function ot(){return Do(Nn)}function nt(e){var t,i=e._a;return i&&p(e).overflow===-2&&(t=i[dn]<0||i[dn]>11?dn:i[hn]<1||i[hn]>se(i[an],i[dn])?hn:i[ln]<0||i[ln]>24||24===i[ln]&&(0!==i[un]||0!==i[cn]||0!==i[fn])?ln:i[un]<0||i[un]>59?un:i[cn]<0||i[cn]>59?cn:i[fn]<0||i[fn]>999?fn:-1,p(e)._overflowDayOfYear&&(thn)&&(t=hn),p(e)._overflowWeeks&&t===-1&&(t=pn),p(e)._overflowWeekday&&t===-1&&(t=vn),p(e).overflow=t),e}function st(e){var t,i,o,n,s,r,a=e._i,d=zn.exec(a)||An.exec(a);if(d){for(p(e).iso=!0,t=0,i=jn.length;t10?"YYYY ":"YY "),s="HH:mm"+(i[4]?":ss":""),i[1]){var u=new Date(i[2]),c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][u.getDay()];if(i[1].substr(0,3)!==c)return p(e).weekdayMismatch=!0,void(e._isValid=!1)}switch(i[5].length){case 2:0===d?a=" +0000":(d=l.indexOf(i[5][1].toUpperCase())-12,a=(d<0?" -":" +")+(""+d).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:a=h[i[5]];break;default:a=h[" GMT"]}i[5]=a,e._i=i.splice(1).join(""),r=" ZZ",e._f=o+n+s+r,ct(e),p(e).rfc2822=!0}else e._isValid=!1}function at(e){var i=Ln.exec(e._i);return null!==i?void(e._d=new Date(+i[1])):(st(e),void(e._isValid===!1&&(delete e._isValid,rt(e),e._isValid===!1&&(delete e._isValid,t.createFromInputFallback(e)))))}function dt(e,t,i){return null!=e?e:null!=t?t:i}function ht(e){var i=new Date(t.now());return e._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function lt(e){var t,i,o,n,s=[];if(!e._d){for(o=ht(e),e._w&&null==e._a[hn]&&null==e._a[dn]&&ut(e),null!=e._dayOfYear&&(n=dt(e._a[an],o[an]),(e._dayOfYear>ge(n)||0===e._dayOfYear)&&(p(e)._overflowDayOfYear=!0),i=_e(n,0,e._dayOfYear),e._a[dn]=i.getUTCMonth(),e._a[hn]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=o[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ln]&&0===e._a[un]&&0===e._a[cn]&&0===e._a[fn]&&(e._nextDay=!0,e._a[ln]=0),e._d=(e._useUTC?_e:be).apply(null,s),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ln]=24)}}function ut(e){var t,i,o,n,s,r,a,d;if(t=e._w,null!=t.GG||null!=t.W||null!=t.E)s=1,r=4,i=dt(t.GG,e._a[an],xe(_t(),1,4).year),o=dt(t.W,1),n=dt(t.E,1),(n<1||n>7)&&(d=!0);else{s=e._locale._week.dow,r=e._locale._week.doy;var h=xe(_t(),s,r);i=dt(t.gg,e._a[an],h.year),o=dt(t.w,h.week),null!=t.d?(n=t.d,(n<0||n>6)&&(d=!0)):null!=t.e?(n=t.e+s,(t.e<0||t.e>6)&&(d=!0)):n=s}o<1||o>Oe(i,s,r)?p(e)._overflowWeeks=!0:null!=d?p(e)._overflowWeekday=!0:(a=ke(i,o,n,s,r),e._a[an]=a.year,e._dayOfYear=a.dayOfYear)}function ct(e){if(e._f===t.ISO_8601)return void st(e);if(e._f===t.RFC_2822)return void rt(e);e._a=[],p(e).empty=!0;var i,o,n,s,r,a=""+e._i,d=a.length,h=0;for(n=Q(e._f,e._locale).match(Ao)||[],i=0;i0&&p(e).unusedInput.push(r),a=a.slice(a.indexOf(o)+o.length),h+=o.length),Ho[s]?(o?p(e).empty=!1:p(e).unusedTokens.push(s),ne(s,o,e)):e._strict&&!o&&p(e).unusedTokens.push(s);p(e).charsLeftOver=d-h,a.length>0&&p(e).unusedInput.push(a),e._a[ln]<=12&&p(e).bigHour===!0&&e._a[ln]>0&&(p(e).bigHour=void 0),p(e).parsedDateParts=e._a.slice(0),p(e).meridiem=e._meridiem,e._a[ln]=ft(e._locale,e._a[ln],e._meridiem),lt(e),nt(e)}function ft(e,t,i){var o;return null==i?t:null!=e.meridiemHour?e.meridiemHour(t,i):null!=e.isPM?(o=e.isPM(i),o&&t<12&&(t+=12),o||12!==t||(t=0),t):t}function pt(e){var t,i,o,n,s;if(0===e._f.length)return p(e).invalidFormat=!0,void(e._d=new Date(NaN));for(n=0;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Lt(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e={};if(y(e,this),e=yt(e),e._a){var t=e._isUTC?c(e._a):_t(e._a);this._isDSTShifted=this.isValid()&&k(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Wt(){return!!this.isValid()&&!this._isUTC}function Yt(){return!!this.isValid()&&this._isUTC}function Vt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ut(e,t){var i,o,n,s=e,r=null;return Dt(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:a(e)?(s={},t?s[t]=e:s.milliseconds=e):(r=Xn.exec(e))?(i="-"===r[1]?-1:1,s={y:0,d:w(r[hn])*i,h:w(r[ln])*i,m:w(r[un])*i,s:w(r[cn])*i,ms:w(Ct(1e3*r[fn]))*i}):(r=Kn.exec(e))?(i="-"===r[1]?-1:1,s={y:qt(r[2],i),M:qt(r[3],i),w:qt(r[4],i),d:qt(r[5],i),h:qt(r[6],i),m:qt(r[7],i),s:qt(r[8],i)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(n=Xt(_t(s.from),_t(s.to)),s={},s.ms=n.milliseconds,s.M=n.months),o=new St(s),Dt(e)&&l(e,"_locale")&&(o._locale=e._locale),o}function qt(e,t){var i=e&&parseFloat(e.replace(",","."));return(isNaN(i)?0:i)*t}function Gt(e,t){var i={milliseconds:0,months:0};return i.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+e.clone().add(i.months,"M"),i}function Xt(e,t){var i;return e.isValid()&&t.isValid()?(t=Ft(t,e),e.isBefore(t)?i=Gt(e,t):(i=Gt(t,e),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function Kt(e,t){return function(i,o){var n,s;return null===o||isNaN(+o)||(M(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=i,i=o,o=s),i="string"==typeof i?+i:i,n=Ut(i,o),Zt(this,n,e),this}}function Zt(e,i,o,n){var s=i._milliseconds,r=Ct(i._days),a=Ct(i._months);e.isValid()&&(n=null==n||n,s&&e._d.setTime(e._d.valueOf()+s*o),r&&Y(e,"Date",W(e,"Date")+r*o),a&&le(e,W(e,"Month")+a*o),n&&t.updateOffset(e,r||a))}function Qt(e,t){var i=e.diff(t,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"}function $t(e,i){var o=e||_t(),n=Ft(o,this).startOf("day"),s=t.calendarFormat(this,n)||"sameElse",r=i&&(E(i[s])?i[s].call(this,o):i[s]);return this.format(r||this.localeData().calendar(s,this,_t(o)))}function Jt(){return new m(this)}function ei(e,t){var i=b(e)?e:_t(e);return!(!this.isValid()||!i.isValid())&&(t=A(r(t)?"millisecond":t),"millisecond"===t?this.valueOf()>i.valueOf():i.valueOf()9999?Z(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):E(Date.prototype.toISOString)?this.toDate().toISOString():Z(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function li(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var i="["+e+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",s=t+'[")]';return this.format(i+o+n+s)}function ui(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var i=Z(this,e);return this.localeData().postformat(i)}function ci(e,t){return this.isValid()&&(b(e)&&e.isValid()||_t(e).isValid())?Ut({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function fi(e){return this.from(_t(),e)}function pi(e,t){return this.isValid()&&(b(e)&&e.isValid()||_t(e).isValid())?Ut({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function vi(e){return this.to(_t(),e)}function gi(e){var t;return void 0===e?this._locale._abbr:(t=it(e),null!=t&&(this._locale=t),this)}function yi(){return this._locale}function mi(e){switch(e=A(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this}function bi(e){return e=A(e),void 0===e||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))}function _i(){return this._d.valueOf()-6e4*(this._offset||0)}function wi(){return Math.floor(this.valueOf()/1e3)}function ki(){return new Date(this.valueOf())}function xi(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Oi(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Mi(){return this.isValid()?this.toISOString():null}function Ei(){return v(this)}function Si(){return u({},p(this))}function Di(){return p(this).overflow}function Ci(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Ti(e,t){G(0,[e,e.length],0,t)}function Pi(e){return Bi.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Fi(e){return Bi.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function Ii(){return Oe(this.year(),1,4)}function Ni(){var e=this.localeData()._week;return Oe(this.year(),e.dow,e.doy)}function Bi(e,t,i,o,n){var s;return null==e?xe(this,o,n).year:(s=Oe(e,o,n),t>s&&(t=s),zi.call(this,e,t,i,o,n))}function zi(e,t,i,o,n){var s=ke(e,t,i,o,n),r=_e(s.year,0,s.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}function Ai(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function Ri(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function ji(e,t){t[fn]=w(1e3*("0."+e))}function Hi(){return this._isUTC?"UTC":""}function Li(){return this._isUTC?"Coordinated Universal Time":""}function Wi(e){return _t(1e3*e)}function Yi(){return _t.apply(null,arguments).parseZone()}function Vi(e){return e}function Ui(e,t,i,o){var n=it(),s=c().set(o,t);return n[i](s,e)}function qi(e,t,i){if(a(e)&&(t=e,e=void 0),e=e||"",null!=t)return Ui(e,t,i,"month");var o,n=[];for(o=0;o<12;o++)n[o]=Ui(e,o,i,"month");return n}function Gi(e,t,i,o){"boolean"==typeof e?(a(t)&&(i=t,t=void 0),t=t||""):(t=e,i=t, -e=!1,a(t)&&(i=t,t=void 0),t=t||"");var n=it(),s=e?n._week.dow:0;if(null!=i)return Ui(t,(i+s)%7,o,"day");var r,d=[];for(r=0;r<7;r++)d[r]=Ui(t,(r+s)%7,o,"day");return d}function Xi(e,t){return qi(e,t,"months")}function Ki(e,t){return qi(e,t,"monthsShort")}function Zi(e,t,i){return Gi(e,t,i,"weekdays")}function Qi(e,t,i){return Gi(e,t,i,"weekdaysShort")}function $i(e,t,i){return Gi(e,t,i,"weekdaysMin")}function Ji(){var e=this._data;return this._milliseconds=rs(this._milliseconds),this._days=rs(this._days),this._months=rs(this._months),e.milliseconds=rs(e.milliseconds),e.seconds=rs(e.seconds),e.minutes=rs(e.minutes),e.hours=rs(e.hours),e.months=rs(e.months),e.years=rs(e.years),this}function eo(e,t,i,o){var n=Ut(t,i);return e._milliseconds+=o*n._milliseconds,e._days+=o*n._days,e._months+=o*n._months,e._bubble()}function to(e,t){return eo(this,e,t,1)}function io(e,t){return eo(this,e,t,-1)}function oo(e){return e<0?Math.floor(e):Math.ceil(e)}function no(){var e,t,i,o,n,s=this._milliseconds,r=this._days,a=this._months,d=this._data;return s>=0&&r>=0&&a>=0||s<=0&&r<=0&&a<=0||(s+=864e5*oo(ro(a)+r),r=0,a=0),d.milliseconds=s%1e3,e=_(s/1e3),d.seconds=e%60,t=_(e/60),d.minutes=t%60,i=_(t/60),d.hours=i%24,r+=_(i/24),n=_(so(r)),a+=n,r-=oo(ro(n)),o=_(a/12),a%=12,d.days=r,d.months=a,d.years=o,this}function so(e){return 4800*e/146097}function ro(e){return 146097*e/4800}function ao(e){if(!this.isValid())return NaN;var t,i,o=this._milliseconds;if(e=A(e),"month"===e||"year"===e)return t=this._days+o/864e5,i=this._months+so(t),"month"===e?i:i/12;switch(t=this._days+Math.round(ro(this._months)),e){case"week":return t/7+o/6048e5;case"day":return t+o/864e5;case"hour":return 24*t+o/36e5;case"minute":return 1440*t+o/6e4;case"second":return 86400*t+o/1e3;case"millisecond":return Math.floor(864e5*t)+o;default:throw new Error("Unknown unit "+e)}}function ho(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*w(this._months/12):NaN}function lo(e){return function(){return this.as(e)}}function uo(e){return e=A(e),this.isValid()?this[e+"s"]():NaN}function co(e){return function(){return this.isValid()?this._data[e]:NaN}}function fo(){return _(this.days()/7)}function po(e,t,i,o,n){return n.relativeTime(t||1,!!i,e,o)}function vo(e,t,i){var o=Ut(e).abs(),n=ks(o.as("s")),s=ks(o.as("m")),r=ks(o.as("h")),a=ks(o.as("d")),d=ks(o.as("M")),h=ks(o.as("y")),l=n<=xs.ss&&["s",n]||n0,l[4]=i,po.apply(null,l)}function go(e){return void 0===e?ks:"function"==typeof e&&(ks=e,!0)}function yo(e,t){return void 0!==xs[e]&&(void 0===t?xs[e]:(xs[e]=t,"s"===e&&(xs.ss=t-1),!0))}function mo(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),i=vo(this,!e,t);return e&&(i=t.pastFuture(+this,i)),t.postformat(i)}function bo(){if(!this.isValid())return this.localeData().invalidDate();var e,t,i,o=Os(this._milliseconds)/1e3,n=Os(this._days),s=Os(this._months);e=_(o/60),t=_(e/60),o%=60,e%=60,i=_(s/12),s%=12;var r=i,a=s,d=n,h=t,l=e,u=o,c=this.asSeconds();return c?(c<0?"-":"")+"P"+(r?r+"Y":"")+(a?a+"M":"")+(d?d+"D":"")+(h||l||u?"T":"")+(h?h+"H":"")+(l?l+"M":"")+(u?u+"S":""):"P0D"}var _o,wo;wo=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),i=t.length>>>0,o=0;o68?1900:2e3)};var kn=L("FullYear",!0);G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),z("week","w"),z("isoWeek","W"),j("week",5),j("isoWeek",5),$("w",qo),$("ww",qo,Wo),$("W",qo),$("WW",qo,Wo),oe(["w","ww","W","WW"],function(e,t,i,o){t[o.substr(0,1)]=w(e)});var xn={dow:0,doy:6};G("d",0,"do","day"),G("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),G("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),G("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),z("day","d"),z("weekday","e"),z("isoWeekday","E"),j("day",11),j("weekday",11),j("isoWeekday",11),$("d",qo),$("e",qo),$("E",qo),$("dd",function(e,t){return t.weekdaysMinRegex(e)}),$("ddd",function(e,t){return t.weekdaysShortRegex(e)}),$("dddd",function(e,t){return t.weekdaysRegex(e)}),oe(["dd","ddd","dddd"],function(e,t,i,o){var n=i._locale.weekdaysParse(e,o,i._strict);null!=n?t.d=n:p(i).invalidWeekday=e}),oe(["d","e","E"],function(e,t,i,o){t[o]=w(e)});var On="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Mn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),En="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Sn=nn,Dn=nn,Cn=nn;G("H",["HH",2],0,"hour"),G("h",["hh",2],0,Ve),G("k",["kk",2],0,Ue),G("hmm",0,0,function(){return""+Ve.apply(this)+q(this.minutes(),2)}),G("hmmss",0,0,function(){return""+Ve.apply(this)+q(this.minutes(),2)+q(this.seconds(),2)}),G("Hmm",0,0,function(){return""+this.hours()+q(this.minutes(),2)}),G("Hmmss",0,0,function(){return""+this.hours()+q(this.minutes(),2)+q(this.seconds(),2)}),qe("a",!0),qe("A",!1),z("hour","h"),j("hour",13),$("a",Ge),$("A",Ge),$("H",qo),$("h",qo),$("k",qo),$("HH",qo,Wo),$("hh",qo,Wo),$("kk",qo,Wo),$("hmm",Go),$("hmmss",Xo),$("Hmm",Go),$("Hmmss",Xo),ie(["H","HH"],ln),ie(["k","kk"],function(e,t,i){var o=w(e);t[ln]=24===o?0:o}),ie(["a","A"],function(e,t,i){i._isPm=i._locale.isPM(e),i._meridiem=e}),ie(["h","hh"],function(e,t,i){t[ln]=w(e),p(i).bigHour=!0}),ie("hmm",function(e,t,i){var o=e.length-2;t[ln]=w(e.substr(0,o)),t[un]=w(e.substr(o)),p(i).bigHour=!0}),ie("hmmss",function(e,t,i){var o=e.length-4,n=e.length-2;t[ln]=w(e.substr(0,o)),t[un]=w(e.substr(o,2)),t[cn]=w(e.substr(n)),p(i).bigHour=!0}),ie("Hmm",function(e,t,i){var o=e.length-2;t[ln]=w(e.substr(0,o)),t[un]=w(e.substr(o))}),ie("Hmmss",function(e,t,i){var o=e.length-4,n=e.length-2;t[ln]=w(e.substr(0,o)),t[un]=w(e.substr(o,2)),t[cn]=w(e.substr(n))});var Tn,Pn=/[ap]\.?m?\.?/i,Fn=L("Hours",!0),In={calendar:Co,longDateFormat:To,invalidDate:Po,ordinal:Fo,dayOfMonthOrdinalParse:Io,relativeTime:No,months:mn,monthsShort:bn,week:xn,weekdays:On,weekdaysMin:En,weekdaysShort:Mn,meridiemParse:Pn},Nn={},Bn={},zn=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,An=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Rn=/Z|[+-]\d\d(?::?\d\d)?/,jn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Hn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ln=/^\/?Date\((\-?\d+)/i,Wn=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;t.createFromInputFallback=O("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),t.ISO_8601=function(){},t.RFC_2822=function(){};var Yn=O("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=_t.apply(null,arguments);return this.isValid()&&e.isValid()?ethis?this:e:g()}),Un=function(){return Date.now?Date.now():+new Date},qn=["year","quarter","month","week","day","hour","minute","second","millisecond"];Tt("Z",":"),Tt("ZZ",""),$("Z",tn),$("ZZ",tn),ie(["Z","ZZ"],function(e,t,i){i._useUTC=!0,i._tzm=Pt(tn,e)});var Gn=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var Xn=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Kn=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ut.fn=St.prototype,Ut.invalid=Et;var Zn=Kt(1,"add"),Qn=Kt(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var $n=O("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ti("gggg","weekYear"),Ti("ggggg","weekYear"),Ti("GGGG","isoWeekYear"),Ti("GGGGG","isoWeekYear"),z("weekYear","gg"),z("isoWeekYear","GG"),j("weekYear",1),j("isoWeekYear",1),$("G",Jo),$("g",Jo),$("GG",qo,Wo),$("gg",qo,Wo),$("GGGG",Zo,Vo),$("gggg",Zo,Vo),$("GGGGG",Qo,Uo),$("ggggg",Qo,Uo),oe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,i,o){t[o.substr(0,2)]=w(e)}),oe(["gg","GG"],function(e,i,o,n){i[n]=t.parseTwoDigitYear(e)}),G("Q",0,"Qo","quarter"),z("quarter","Q"),j("quarter",7),$("Q",Lo),ie("Q",function(e,t){t[dn]=3*(w(e)-1)}),G("D",["DD",2],"Do","date"),z("date","D"),j("date",9),$("D",qo),$("DD",qo,Wo),$("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ie(["D","DD"],hn),ie("Do",function(e,t){t[hn]=w(e.match(qo)[0],10)});var Jn=L("Date",!0);G("DDD",["DDDD",3],"DDDo","dayOfYear"),z("dayOfYear","DDD"),j("dayOfYear",4),$("DDD",Ko),$("DDDD",Yo),ie(["DDD","DDDD"],function(e,t,i){i._dayOfYear=w(e)}),G("m",["mm",2],0,"minute"),z("minute","m"),j("minute",14),$("m",qo),$("mm",qo,Wo),ie(["m","mm"],un);var es=L("Minutes",!1);G("s",["ss",2],0,"second"),z("second","s"),j("second",15),$("s",qo),$("ss",qo,Wo),ie(["s","ss"],cn);var ts=L("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),G(0,["SSS",3],0,"millisecond"),G(0,["SSSS",4],0,function(){return 10*this.millisecond()}),G(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),G(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),G(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),G(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),G(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),z("millisecond","ms"),j("millisecond",16),$("S",Ko,Lo),$("SS",Ko,Wo),$("SSS",Ko,Yo);var is;for(is="SSSS";is.length<=9;is+="S")$(is,$o);for(is="S";is.length<=9;is+="S")ie(is,ji);var os=L("Milliseconds",!1);G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");var ns=m.prototype;ns.add=Zn,ns.calendar=$t,ns.clone=Jt,ns.diff=ri,ns.endOf=bi,ns.format=ui,ns.from=ci,ns.fromNow=fi,ns.to=pi,ns.toNow=vi,ns.get=V,ns.invalidAt=Di,ns.isAfter=ei,ns.isBefore=ti,ns.isBetween=ii,ns.isSame=oi,ns.isSameOrAfter=ni,ns.isSameOrBefore=si,ns.isValid=Ei,ns.lang=$n,ns.locale=gi,ns.localeData=yi,ns.max=Vn,ns.min=Yn,ns.parsingFlags=Si,ns.set=U,ns.startOf=mi,ns.subtract=Qn,ns.toArray=xi,ns.toObject=Oi,ns.toDate=ki,ns.toISOString=hi,ns.inspect=li,ns.toJSON=Mi,ns.toString=di,ns.unix=wi,ns.valueOf=_i,ns.creationData=Ci,ns.year=kn,ns.isLeapYear=me,ns.weekYear=Pi,ns.isoWeekYear=Fi,ns.quarter=ns.quarters=Ai,ns.month=ue,ns.daysInMonth=ce,ns.week=ns.weeks=De,ns.isoWeek=ns.isoWeeks=Ce,ns.weeksInYear=Ni,ns.isoWeeksInYear=Ii,ns.date=Jn,ns.day=ns.days=Ae,ns.weekday=Re,ns.isoWeekday=je,ns.dayOfYear=Ri,ns.hour=ns.hours=Fn,ns.minute=ns.minutes=es,ns.second=ns.seconds=ts,ns.millisecond=ns.milliseconds=os,ns.utcOffset=Nt,ns.utc=zt,ns.local=At,ns.parseZone=Rt,ns.hasAlignedHourOffset=jt,ns.isDST=Ht,ns.isLocal=Wt,ns.isUtcOffset=Yt,ns.isUtc=Vt,ns.isUTC=Vt,ns.zoneAbbr=Hi,ns.zoneName=Li,ns.dates=O("dates accessor is deprecated. Use date instead.",Jn),ns.months=O("months accessor is deprecated. Use month instead",ue),ns.years=O("years accessor is deprecated. Use year instead",kn),ns.zone=O("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Bt),ns.isDSTShifted=O("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Lt);var ss=C.prototype;ss.calendar=T,ss.longDateFormat=P,ss.invalidDate=F,ss.ordinal=I,ss.preparse=Vi,ss.postformat=Vi,ss.relativeTime=N,ss.pastFuture=B,ss.set=S,ss.months=re,ss.monthsShort=ae,ss.monthsParse=he,ss.monthsRegex=pe,ss.monthsShortRegex=fe,ss.week=Me,ss.firstDayOfYear=Se,ss.firstDayOfWeek=Ee,ss.weekdays=Fe,ss.weekdaysMin=Ne,ss.weekdaysShort=Ie,ss.weekdaysParse=ze,ss.weekdaysRegex=He,ss.weekdaysShortRegex=Le,ss.weekdaysMinRegex=We,ss.isPM=Xe,ss.meridiem=Ke,Je("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,i=1===w(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+i}}),t.lang=O("moment.lang is deprecated. Use moment.locale instead.",Je),t.langData=O("moment.langData is deprecated. Use moment.localeData instead.",it);var rs=Math.abs,as=lo("ms"),ds=lo("s"),hs=lo("m"),ls=lo("h"),us=lo("d"),cs=lo("w"),fs=lo("M"),ps=lo("y"),vs=co("milliseconds"),gs=co("seconds"),ys=co("minutes"),ms=co("hours"),bs=co("days"),_s=co("months"),ws=co("years"),ks=Math.round,xs={ss:44,s:45,m:45,h:22,d:26,M:11},Os=Math.abs,Ms=St.prototype;return Ms.isValid=Mt,Ms.abs=Ji,Ms.add=to,Ms.subtract=io,Ms.as=ao,Ms.asMilliseconds=as,Ms.asSeconds=ds,Ms.asMinutes=hs,Ms.asHours=ls,Ms.asDays=us,Ms.asWeeks=cs,Ms.asMonths=fs,Ms.asYears=ps,Ms.valueOf=ho,Ms._bubble=no,Ms.get=uo,Ms.milliseconds=vs,Ms.seconds=gs,Ms.minutes=ys,Ms.hours=ms,Ms.days=bs,Ms.weeks=fo,Ms.months=_s,Ms.years=ws,Ms.humanize=mo,Ms.toISOString=bo,Ms.toString=bo,Ms.toJSON=bo,Ms.locale=gi,Ms.localeData=yi,Ms.toIsoString=O("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",bo),Ms.lang=$n,G("X",0,0,"unix"),G("x",0,0,"valueOf"),$("x",Jo),$("X",on),ie("X",function(e,t,i){i._d=new Date(1e3*parseFloat(e,10))}),ie("x",function(e,t,i){i._d=new Date(w(e))}),t.version="2.18.1",i(_t),t.fn=ns,t.min=kt,t.max=xt,t.now=Un,t.utc=c,t.unix=Wi,t.months=Xi,t.isDate=d,t.locale=Je,t.invalid=g,t.duration=Ut,t.isMoment=b,t.weekdays=Zi,t.parseZone=Yi,t.localeData=it,t.isDuration=Dt,t.monthsShort=Ki,t.weekdaysMin=$i,t.defineLocale=et,t.updateLocale=tt,t.locales=ot,t.weekdaysShort=Qi,t.normalizeUnits=A,t.relativeTimeRounding=go,t.relativeTimeThreshold=yo,t.calendarFormat=Qt,t.prototype=ns,t})}).call(t,i(84)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){function i(e){throw new Error("Cannot find module '"+e+"'.")}i.keys=function(){return[]},i.resolve=i,e.exports=i,i.id=85},function(e,t){(function(t){function i(e,t,i){var o=t&&i||0,n=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){n<16&&(t[o+n++]=u[e])});n<16;)t[o+n++]=0;return t}function o(e,t){var i=t||0,o=l;return o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+"-"+o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]+o[e[i++]]}function n(e,t,i){var n=t&&i||0,s=t||[];e=e||{};var r=void 0!==e.clockseq?e.clockseq:v,a=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:y+1,h=a-g+(d-y)/1e4;if(h<0&&void 0===e.clockseq&&(r=r+1&16383),(h<0||a>g)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");g=a,y=d,v=r,a+=122192928e5;var l=(1e4*(268435455&a)+d)%4294967296;s[n++]=l>>>24&255,s[n++]=l>>>16&255,s[n++]=l>>>8&255,s[n++]=255&l;var u=a/4294967296*1e4&268435455;s[n++]=u>>>8&255,s[n++]=255&u,s[n++]=u>>>24&15|16,s[n++]=u>>>16&255,s[n++]=r>>>8|128,s[n++]=255&r;for(var c=e.node||p,f=0;f<6;f++)s[n+f]=c[f];return t?t:o(s)}function s(e,t,i){var n=t&&i||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;a++)t[n+a]=s[a];return t||o(s)}var r,a="undefined"!=typeof window?window:"undefined"!=typeof t?t:null;if(a&&a.crypto&&crypto.getRandomValues){var d=new Uint8Array(16);r=function(){return crypto.getRandomValues(d),d}}if(!r){var h=new Array(16);r=function(){for(var e,t=0;t<16;t++)0===(3&t)&&(e=4294967296*Math.random()),h[t]=e>>>((3&t)<<3)&255;return h}}for(var l=[],u={},c=0;c<256;c++)l[c]=(c+256).toString(16).substr(1),u[l[c]]=c;var f=r(),p=[1|f[0],f[1],f[2],f[3],f[4],f[5]],v=16383&(f[6]<<8|f[7]),g=0,y=0,m=s;m.v1=n,m.v4=s,m.parse=i,m.unparse=o,e.exports=m}).call(t,function(){return this}())},function(e,t){t.prepareElements=function(e){for(var t in e)e.hasOwnProperty(t)&&(e[t].redundant=e[t].used,e[t].used=[])},t.cleanupElements=function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t].redundant){for(var i=0;i0?(o=t[e].redundant[0],t[e].redundant.shift()):(o=document.createElementNS("http://www.w3.org/2000/svg",e),i.appendChild(o)):(o=document.createElementNS("http://www.w3.org/2000/svg",e),t[e]={used:[],redundant:[]},i.appendChild(o)),t[e].used.push(o),o},t.getDOMElement=function(e,t,i,o){var n;return t.hasOwnProperty(e)?t[e].redundant.length>0?(n=t[e].redundant[0],t[e].redundant.shift()):(n=document.createElement(e),void 0!==o?i.insertBefore(n,o):i.appendChild(n)):(n=document.createElement(e),t[e]={used:[],redundant:[]},void 0!==o?i.insertBefore(n,o):i.appendChild(n)),t[e].used.push(n),n},t.drawPoint=function(e,i,o,n,s,r){var a;if("circle"==o.style?(a=t.getSVGElement("circle",n,s),a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",i),a.setAttributeNS(null,"r",.5*o.size)):(a=t.getSVGElement("rect",n,s),a.setAttributeNS(null,"x",e-.5*o.size),a.setAttributeNS(null,"y",i-.5*o.size),a.setAttributeNS(null,"width",o.size),a.setAttributeNS(null,"height",o.size)),void 0!==o.styles&&a.setAttributeNS(null,"style",o.styles),a.setAttributeNS(null,"class",o.className+" vis-point"),r){var d=t.getSVGElement("text",n,s);r.xOffset&&(e+=r.xOffset),r.yOffset&&(i+=r.yOffset),r.content&&(d.textContent=r.content),r.className&&d.setAttributeNS(null,"class",r.className+" vis-label"),d.setAttributeNS(null,"x",e),d.setAttributeNS(null,"y",i)}return a},t.drawBar=function(e,i,o,n,s,r,a,d){if(0!=n){n<0&&(n*=-1,i-=n);var h=t.getSVGElement("rect",r,a);h.setAttributeNS(null,"x",e-.5*o),h.setAttributeNS(null,"y",i),h.setAttributeNS(null,"width",o),h.setAttributeNS(null,"height",n),h.setAttributeNS(null,"class",s),d&&h.setAttributeNS(null,"style",d)}}},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(e&&!Array.isArray(e)&&(t=e,e=null),this._options=t||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i=(0,l.default)(this._options.type),o=0,n=i.length;on?1:or)&&(s=d,r=h)}return s},n.prototype.min=function(e){var t,i,o=this._data,n=(0,l.default)(o),s=null,r=null;for(t=0,i=n.length;tthis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var e=this;this._timeout=setTimeout(function(){e.flush()},this.delay)}},i.prototype.flush=function(){for(;this._queue.length>0;){var e=this._queue.shift();e.fn.apply(e.context||e.fn,e.args||[])}},e.exports=i},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t){this._data=null,this._ids={},this.length=0,this._options=t||{},this._fieldId="id",this._subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(e)}var s=i(58),r=o(s),a=i(1),d=i(88);n.prototype.setData=function(e){var t,i,o,n,s;if(this._data){for(this._data.off&&this._data.off("*",this.listener),t=this._data.getIds({filter:this._options&&this._options.filter}),s=[],o=0,n=t.length;o=.1;)f=n[l++%s],f>h&&(f=h),c=Math.sqrt(f*f/(1+d*d)),c=r<0?-c:c,e+=c,t+=d*c,u===!0?this.lineTo(e,t):this.moveTo(e,t),h-=f,u=!u})},function(e,t){function i(e){if(e)return o(e)}function o(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}e.exports=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(t),this},i.prototype.once=function(e,t){function i(){o.off(e,i),t.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},i.fn=t,this.on(e,i),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[e];if(!i)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var o,n=0;n=0;i--){var a=s[i];a.nodes||(a.nodes=[]),a.nodes.indexOf(n)===-1&&a.nodes.push(n)}t.attr&&(n.attr=h(n.attr,t.attr))}function c(e,t){if(e.edges||(e.edges=[]),e.edges.push(t),e.edge){var i=h({},e.edge);t.attr=h(i,t.attr)}}function f(e,t,i,o,n){var s={from:t,to:i,type:o};return e.edge&&(s.attr=h({},e.edge)),s.attr=h(s.attr||{},n),s}function p(){for(j=I.NULL,R="";" "===A||"\t"===A||"\n"===A||"\r"===A;)r();do{var e=!1;if("#"===A){for(var t=z-1;" "===B.charAt(t)||"\t"===B.charAt(t);)t--;if("\n"===B.charAt(t)||""===B.charAt(t)){for(;""!=A&&"\n"!=A;)r();e=!0}}if("/"===A&&"/"===a()){for(;""!=A&&"\n"!=A;)r();e=!0}if("/"===A&&"*"===a()){for(;""!=A;){if("*"===A&&"/"===a()){r(),r();break}r()}e=!0}for(;" "===A||"\t"===A||"\n"===A||"\r"===A;)r()}while(e);if(""===A)return void(j=I.DELIMITER);var i=A+a();if(N[i])return j=I.DELIMITER,R=i,r(),void r();if(N[A])return j=I.DELIMITER,R=A,void r();if(d(A)||"-"===A){for(R+=A,r();d(A);)R+=A,r();return"false"===R?R=!1:"true"===R?R=!0:isNaN(Number(R))||(R=Number(R)),void(j=I.IDENTIFIER)}if('"'===A){for(r();""!=A&&('"'!=A||'"'===A&&'"'===a());)'"'===A?(R+=A,r()):"\\"===A&&"n"===a()?(R+="\n",r()):R+=A,r();if('"'!=A)throw x('End of string " expected');return r(),void(j=I.IDENTIFIER)}for(j=I.UNKNOWN;""!=A;)R+=A,r();throw new SyntaxError('Syntax error in part "'+O(R,30)+'"')}function v(){var e={};if(s(),p(),"strict"===R&&(e.strict=!0,p()),"graph"!==R&&"digraph"!==R||(e.type=R,p()),j===I.IDENTIFIER&&(e.id=R,p()),"{"!=R)throw x("Angle bracket { expected");if(p(),g(e),"}"!=R)throw x("Angle bracket } expected");if(p(),""!==R)throw x("End of file expected");return p(),delete e.node,delete e.edge,delete e.graph,e}function g(e){for(;""!==R&&"}"!=R;)y(e),";"===R&&p()}function y(e){var t=m(e);if(t)return void w(e,t);var i=b(e);if(!i){if(j!=I.IDENTIFIER)throw x("Identifier expected");var o=R;if(p(),"="===R){if(p(),j!=I.IDENTIFIER)throw x("Identifier expected");e[o]=R,p()}else _(e,o)}}function m(e){var t=null;if("subgraph"===R&&(t={},t.type="subgraph",p(),j===I.IDENTIFIER&&(t.id=R,p())),"{"===R){if(p(),t||(t={}),t.parent=e,t.node=e.node,t.edge=e.edge,t.graph=e.graph,g(t),"}"!=R)throw x("Angle bracket } expected");p(),delete t.node,delete t.edge,delete t.graph,delete t.parent,e.subgraphs||(e.subgraphs=[]),e.subgraphs.push(t)}return t}function b(e){return"node"===R?(p(),e.node=k(),"node"):"edge"===R?(p(),e.edge=k(),"edge"):"graph"===R?(p(),e.graph=k(),"graph"):null}function _(e,t){var i={id:t},o=k();o&&(i.attr=o),u(e,i),w(e,t)}function w(e,t){for(;"->"===R||"--"===R;){var i,o=R;p();var n=m(e);if(n)i=n;else{if(j!=I.IDENTIFIER)throw x("Identifier or subgraph expected");i=R,u(e,{id:i}),p()}var s=k(),r=f(e,t,i,o,s);c(e,r),t=i}}function k(){for(var e=null;"["===R;){for(p(),e={};""!==R&&"]"!=R;){if(j!=I.IDENTIFIER)throw x("Attribute name expected");var t=R;if(p(),"="!=R)throw x("Equal sign = expected");if(p(),j!=I.IDENTIFIER)throw x("Attribute value expected");var i=R;l(e,t,i),p(),","==R&&p()}if("]"!=R)throw x("Bracket ] expected");p()}return e}function x(e){return new SyntaxError(e+', got "'+O(R,30)+'" (char '+z+")")}function O(e,t){return e.length<=t?e:e.substr(0,27)+"..."}function M(e,t,i){Array.isArray(e)?e.forEach(function(e){Array.isArray(t)?t.forEach(function(t){i(e,t)}):i(e,t)}):Array.isArray(t)?t.forEach(function(t){i(e,t)}):i(e,t)}function E(e,t,i){for(var o=t.split("."),n=o.pop(),s=e,r=0;r":!0,"--":!0},B="",z=0,A="",R="",j=I.NULL,H=/[a-zA-Z_0-9.:#]/;t.parseDOT=n,t.DOTToGraph=D},function(e,t){function i(e,t){var i=[],o=[],n={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};void 0!==t&&(void 0!==t.fixed&&(n.nodes.fixed=t.fixed),void 0!==t.parseColor&&(n.nodes.parseColor=t.parseColor),void 0!==t.inheritColor&&(n.edges.inheritColor=t.inheritColor));for(var s=e.edges,r=e.nodes,a=0;a0?h._handlers[e]=o:(i.off(e,s),delete h._handlers[e]))}),h},h.emit=function(t,o){e=o.target,i.emit(t,o)},h.destroy=function(){var e=i.element.hammer,t=e.indexOf(h);t!==-1&&e.splice(t,1),e.length||delete i.element.hammer,h._handlers={},i.destroy()},h}})},function(e,t,i){var o;/*! Hammer.JS - v2.0.7 - 2016-04-22 - * http://hammerjs.github.io/ - * - * Copyright (c) 2016 Jorik Tangelder; - * Licensed under the MIT license */ -!function(n,s,r,a){function d(e,t,i){return setTimeout(f(e,i),t)}function h(e,t,i){return!!Array.isArray(e)&&(l(e,i[t],i),!0)}function l(e,t,i){var o;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==a)for(o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=n.console&&(n.console.warn||n.console.log);return s&&s.call(n.console,o,i),e.apply(this,arguments)}}function c(e,t,i){var o,n=t.prototype;o=e.prototype=Object.create(n),o.constructor=e,o._super=n,i&&ve(o,i)}function f(e,t){return function(){return e.apply(t,arguments)}}function p(e,t){return typeof e==me?e.apply(t?t[0]||a:a,t):e}function v(e,t){return e===a?t:e}function g(e,t,i){l(_(t),function(t){e.addEventListener(t,i,!1)})}function y(e,t,i){l(_(t),function(t){e.removeEventListener(t,i,!1)})}function m(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function b(e,t){return e.indexOf(t)>-1}function _(e){return e.trim().split(/\s+/g)}function w(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var o=0;oi[t]}):o.sort()),o}function O(e,t){for(var i,o,n=t[0].toUpperCase()+t.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=I(t):1===n&&(i.firstMultiple=!1);var s=i.firstInput,r=i.firstMultiple,a=r?r.center:s.center,d=t.center=N(o);t.timeStamp=we(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=R(a,d),t.distance=A(a,d),P(i,t),t.offsetDirection=z(t.deltaX,t.deltaY);var h=B(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=_e(h.x)>_e(h.y)?h.x:h.y,t.scale=r?H(r.pointers,o):1,t.rotation=r?j(r.pointers,o):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,F(i,t);var l=e.element;m(t.srcEvent.target,l)&&(l=t.srcEvent.target),t.target=l}function P(e,t){var i=t.center,o=e.offsetDelta||{},n=e.prevDelta||{},s=e.prevInput||{};t.eventType!==Ne&&s.eventType!==ze||(n=e.prevDelta={x:s.deltaX||0,y:s.deltaY||0},o=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=n.x+(i.x-o.x),t.deltaY=n.y+(i.y-o.y)}function F(e,t){var i,o,n,s,r=e.lastInterval||t,d=t.timeStamp-r.timeStamp;if(t.eventType!=Ae&&(d>Ie||r.velocity===a)){var h=t.deltaX-r.deltaX,l=t.deltaY-r.deltaY,u=B(d,h,l);o=u.x,n=u.y,i=_e(u.x)>_e(u.y)?u.x:u.y,s=z(h,l),e.lastInterval=t}else i=r.velocity,o=r.velocityX,n=r.velocityY,s=r.direction;t.velocity=i,t.velocityX=o,t.velocityY=n,t.direction=s}function I(e){for(var t=[],i=0;i=_e(t)?e<0?je:He:t<0?Le:We}function A(e,t,i){i||(i=qe);var o=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return Math.sqrt(o*o+n*n)}function R(e,t,i){i||(i=qe);var o=t[i[0]]-e[i[0]],n=t[i[1]]-e[i[1]];return 180*Math.atan2(n,o)/Math.PI}function j(e,t){return R(t[1],t[0],Ge)+R(e[1],e[0],Ge)}function H(e,t){return A(t[0],t[1],Ge)/A(e[0],e[1],Ge)}function L(){this.evEl=Ke,this.evWin=Ze,this.pressed=!1,S.apply(this,arguments)}function W(){this.evEl=Je,this.evWin=et,S.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function Y(){this.evTarget=it,this.evWin=ot,this.started=!1,S.apply(this,arguments)}function V(e,t){var i=k(e.touches),o=k(e.changedTouches);return t&(ze|Ae)&&(i=x(i.concat(o),"identifier",!0)),[i,o]}function U(){this.evTarget=st,this.targetIds={},S.apply(this,arguments)}function q(e,t){var i=k(e.touches),o=this.targetIds;if(t&(Ne|Be)&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,s,r=k(e.changedTouches),a=[],d=this.target;if(s=i.filter(function(e){return m(e.target,d)}),t===Ne)for(n=0;n-1&&o.splice(e,1)};setTimeout(n,rt)}}function Z(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){i.manager.emit(t,e)}var i=this,o=this.state;o<_t&&t(i.options.event+te(o)),t(i.options.event),e.additionalEvent&&t(e.additionalEvent),o>=_t&&t(i.options.event+te(o))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=xt)},canEmit:function(){for(var e=0;et.threshold&&n&t.direction},attrTest:function(e){return ne.prototype.attrTest.call(this,e)&&(this.state&mt||!(this.state&mt)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=ie(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),c(re,ne,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ft]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&mt)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),c(ae,ee,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ut]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,o=e.distancet.time;if(this._input=e,!o||!i||e.eventType&(ze|Ae)&&!n)this.reset();else if(e.eventType&Ne)this.reset(),this._timer=d(function(){this.state=wt,this.tryEmit()},t.time,this);else if(e.eventType&ze)return wt;return xt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===wt&&(e&&e.eventType&ze?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=we(),this.manager.emit(this.options.event,this._input)))}}),c(de,ne,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ft]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&mt)}}),c(he,ne,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ye|Ve,pointers:1},getTouchAction:function(){return se.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return i&(Ye|Ve)?t=e.overallVelocity:i&Ye?t=e.overallVelocityX:i&Ve&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&_e(t)>this.options.velocity&&e.eventType&ze},emit:function(e){var t=ie(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),c(le,ee,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ct]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,o=e.distance2&&this.initialized()){t*=.5;for(var r=0;t>2&&r=this.NUM_ITERATIONS&&(r=this.NUM_ITERATIONS-1);var a=this.coordinates[r];e.drawImage(this.canvas,a[0],a[1],a[2],a[3],i,o,n,s)}else this._isImageOk()&&e.drawImage(this.image,i,o,n,s)}},{key:"_isImageOk",value:function(e){var e=this.image;return!!e.complete&&("undefined"==typeof e.naturalWidth||0!==e.naturalWidth)}}]),e}();t.default=d},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=i(1),h=function(){function e(){(0,s.default)(this,e),this.clear(),this.defaultIndex=0,this.groupsArray=[],this.groupIndex=0,this.defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},d.extend(this.options,this.defaultOptions)}return(0,a.default)(e,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(void 0!==e)for(var i in e)if(e.hasOwnProperty(i)&&t.indexOf(i)===-1){var o=e[i];this.add(i,o)}}},{key:"clear",value:function(){this.groups={},this.groupsArray=[]}},{key:"get",value:function(e){var t=this.groups[e];if(void 0===t)if(this.options.useDefaultGroups===!1&&this.groupsArray.length>0){var i=this.groupIndex%this.groupsArray.length;this.groupIndex++,t={},t.color=this.groups[this.groupsArray[i]],this.groups[e]=t}else{var o=this.defaultIndex%this.defaultGroups.length;this.defaultIndex++,t={},t.color=this.defaultGroups[o],this.groups[e]=t}return t}},{key:"add",value:function(e,t){return this.groups[e]=t,this.groupsArray.push(e),t}}]),e}();t.default=h; -},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=i(1),h=i(88),l=i(92),u=i(113).default,c=i(114).default,f=function(){function e(t,i,o,n){var r=this;if((0,s.default)(this,e),this.body=t,this.images=i,this.groups=o,this.layoutEngine=n,this.body.functions.createNode=this.create.bind(this),this.nodesListeners={add:function(e,t){r.add(t.items)},update:function(e,t){r.update(t.items,t.data)},remove:function(e,t){r.remove(t.items)}},this.options={},this.defaultOptions={borderWidth:1,borderWidthSelected:2,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,i,o){if(t===e)return.5;var n=1/(t-e);return Math.max(0,(o-e)*n)}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";d.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("refreshNodes",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",function(){d.forEach(e.nodesListeners,function(t,i){e.body.data.nodes&&e.body.data.nodes.off(i,t)}),delete e.body.functions.createNode,delete e.nodesListeners.add,delete e.nodesListeners.update,delete e.nodesListeners.remove,delete e.nodesListeners})}},{key:"setOptions",value:function(e){if(this.nodeOptions=e,void 0!==e){if(u.parseOptions(this.options,e),void 0!==e.shape)for(var t in this.body.nodes)this.body.nodes.hasOwnProperty(t)&&this.body.nodes[t].updateShape();if(void 0!==e.font){c.parseOptions(this.options.font,e);for(var i in this.body.nodes)this.body.nodes.hasOwnProperty(i)&&(this.body.nodes[i].updateLabelModule(),this.body.nodes[i].needsRefresh())}if(void 0!==e.size)for(var o in this.body.nodes)this.body.nodes.hasOwnProperty(o)&&this.body.nodes[o].needsRefresh();void 0===e.hidden&&void 0===e.physics||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.data.nodes;if(e instanceof h||e instanceof l)this.body.data.nodes=e;else if(Array.isArray(e))this.body.data.nodes=new h,this.body.data.nodes.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new h}if(i&&d.forEach(this.nodesListeners,function(e,t){i.off(t,e)}),this.body.nodes={},this.body.data.nodes){var o=this;d.forEach(this.nodesListeners,function(e,t){o.body.data.nodes.on(t,e)});var n=this.body.data.nodes.getIds();this.add(n,!0)}t===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,o=[],n=0;n1&&void 0!==arguments[1]?arguments[1]:u;return new t(e,this.body,this.images,this.groups,this.options,this.defaultOptions,this.nodeOptions)}},{key:"refresh",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.body.nodes;for(var i in t){var o=void 0;t.hasOwnProperty(i)&&(o=t[i]);var n=this.body.data.nodes.get(i);void 0!==o&&void 0!==n&&(e===!0&&o.setOptions({x:null,y:null}),o.setOptions({fixed:!1}),o.setOptions(n))}}},{key:"getPositions",value:function(e){var t={};if(void 0!==e){if(Array.isArray(e)===!0){for(var i=0;ie.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"parseOptions",value:function(t,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=["color","font","fixed","shadow"];if(l.selectiveNotDeepExtend(s,t,i,o),e.checkMass(i),l.mergeOptions(t,i,"shadow",o,n),void 0!==i.color&&null!==i.color){var r=l.parseColor(i.color);l.fillIfDefined(t.color,r)}else o===!0&&null===i.color&&(t.color=l.bridgeObject(n.color));void 0!==i.fixed&&null!==i.fixed&&("boolean"==typeof i.fixed?(t.fixed.x=i.fixed,t.fixed.y=i.fixed):(void 0!==i.fixed.x&&"boolean"==typeof i.fixed.x&&(t.fixed.x=i.fixed.x),void 0!==i.fixed.y&&"boolean"==typeof i.fixed.y&&(t.fixed.y=i.fixed.y))),void 0!==i.font&&null!==i.font?u.parseOptions(t.font,i):o===!0&&null===i.font&&(t.font=l.bridgeObject(n.font)),void 0!==i.scaling&&l.mergeOptions(t.scaling,i.scaling,"label",o,n.scaling)}},{key:"checkMass",value:function(e,t){if(void 0!==e.mass&&e.mass<=0){var i="";void 0!==t&&(i=" in node id: "+t),console.log("%cNegative or zero mass disallowed"+i+", setting mass to 1.",S),e.mass=1}}}]),e}();t.default=D},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(2),a=o(r),d=i(62),h=o(d),l=i(105),u=o(l),c=i(106),f=o(c),p=i(1),v=function(){function e(t,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,u.default)(this,e),this.body=t,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(i),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=o}return(0,f.default)(e,[{key:"setOptions",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.elementOptions=t,this.fontOptions=p.deepExtend({},t.font,!0),void 0!==t.label&&(this.labelDirty=!0),void 0!==t.font&&(e.parseOptions(this.fontOptions,t,i),"string"==typeof t.font?this.baseSize=this.fontOptions.size:"object"===(0,h.default)(t.font)&&void 0!==t.font.size&&(this.baseSize=t.font.size))}},{key:"constrain",value:function(e,t,i){this.fontOptions.constrainWidth=!1,this.fontOptions.maxWdt=-1,this.fontOptions.minWdt=-1;var o=[t,e,i],n=p.topMost(o,"widthConstraint");if("number"==typeof n)this.fontOptions.maxWdt=Number(n),this.fontOptions.minWdt=Number(n);else if("object"===("undefined"==typeof n?"undefined":(0,h.default)(n))){var s=p.topMost(o,["widthConstraint","maximum"]);"number"==typeof s&&(this.fontOptions.maxWdt=Number(s));var r=p.topMost(o,["widthConstraint","minimum"]);"number"==typeof r&&(this.fontOptions.minWdt=Number(r))}this.fontOptions.constrainHeight=!1,this.fontOptions.minHgt=-1,this.fontOptions.valign="middle";var a=p.topMost(o,"heightConstraint");if("number"==typeof a)this.fontOptions.minHgt=Number(a);else if("object"===("undefined"==typeof a?"undefined":(0,h.default)(a))){var d=p.topMost(o,["heightConstraint","minimum"]);"number"==typeof d&&(this.fontOptions.minHgt=Number(d));var l=p.topMost(o,["heightConstraint","valign"]);"string"==typeof l&&("top"!==l&&"bottom"!==l||(this.fontOptions.valign=l))}}},{key:"choosify",value:function(e,t,i){this.fontOptions.chooser=!0;var o=[t,e,i],n=p.topMost(o,"chosen");if("boolean"==typeof n)this.fontOptions.chooser=n;else if("object"===("undefined"==typeof n?"undefined":(0,h.default)(n))){var s=p.topMost(o,["chosen","label"]);"boolean"!=typeof s&&"function"!=typeof s||(this.fontOptions.chooser=s)}}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}},{key:"propagateFonts",value:function(t,i,o){if(this.fontOptions.multi){var n=function(e,t){if(!e||!e.font)return null;var i=e.font;if(t){if(!i[t])return null;i=i[t]}return i},s=function(e,t,i){var o=n(e,t);return o&&o.hasOwnProperty(i)?o[i]:null},r=["bold","ital","boldital","mono"],d=!0,h=!1,l=void 0;try{for(var u,c=(0,a.default)(r);!(d=(u=c.next()).done);d=!0){var f=u.value,p=this.fontOptions[f],v=o.font[f];if(e.parseFontString(p,n(t,f)))p.vadjust=this.fontOptions.vadjust,p.mod=v.mod;else{p.face=s(t,f,"face")||s(i,f,"face")||("mono"===f?v.face:null)||s(i,null,"face")||this.fontOptions.face,p.color=s(t,f,"color")||s(i,f,"color")||s(i,null,"color")||this.fontOptions.color,p.mod=s(t,f,"mod")||s(i,f,"mod")||s(i,null,"mod")||v.mod;var g=void 0;p.face===v.face&&this.fontOptions.face===o.font.face&&(g=this.fontOptions.size/Number(o.font.size)),p.size=s(t,f,"size")||s(i,f,"size")||(g?v.size*g:null)||s(i,null,"size")||this.fontOptions.size,p.vadjust=s(t,f,"vadjust")||s(i,f,"vadjust")||(g?v.vadjust*Math.round(g):null)||this.fontOptions.vadjust}p.size=Number(p.size),p.vadjust=Number(p.vadjust)}}catch(e){h=!0,l=e}finally{try{!d&&c.return&&c.return()}finally{if(h)throw l}}}}},{key:"draw",value:function(e,t,i,o,n){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";if(void 0!==this.elementOptions.label){var r=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&r5&&void 0!==arguments[5]?arguments[5]:"middle",a=this.fontOptions.size,d=a*this.body.view.scale;d>=this.elementOptions.scaling.label.maxVisible&&(a=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale);var h=this.size.yLine,l=this._setAlignment(e,o,h,r),u=(0,s.default)(l,2);o=u[0],h=u[1],e.textAlign="left",o-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(h-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(h+=(this.size.height-this.size.labelHeight)/2));for(var c=0;c0&&(e.lineWidth=v.strokeWidth,e.strokeStyle=b,e.lineJoin="round"),e.fillStyle=m,v.strokeWidth>0&&e.strokeText(v.text,o+f,h+v.vadjust),e.fillText(v.text,o+f,h+v.vadjust),f+=v.width}h+=this.lines[c].height}}},{key:"_setAlignment",value:function(e,t,i,o){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&this.pointToSelf===!1){t=0,i=0;var n=2;"top"===this.fontOptions.align?(e.textBaseline="alphabetic",i-=2*n):"bottom"===this.fontOptions.align?(e.textBaseline="hanging",i+=2*n):e.textBaseline="middle"}else e.textBaseline=o;return[t,i]}},{key:"_getColor",value:function(e,t,i){var o=e||"#000000",n=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));o=p.overrideOpacity(o,s),n=p.overrideOpacity(n,s)}return[o,n]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"calculateLabelSize",value:function(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this.labelDirty===!0&&this._processLabel(e,t,i),this.size.left=o-.5*this.size.width,this.size.top=n-.5*this.size.height,this.size.yLine=n+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===s&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4),this.labelDirty=!1}},{key:"decodeMarkupSystem",value:function(e){var t="none";return"markdown"===e||"md"===e?t="markdown":e!==!0&&"html"!==e||(t="html"),t}},{key:"splitBlocks",value:function(e,t){var i=this.decodeMarkupSystem(t);return"none"===i?[{text:e,mod:"normal"}]:"markdown"===i?this.splitMarkdownBlocks(e):"html"===i?this.splitHtmlBlocks(e):void 0}},{key:"splitMarkdownBlocks",value:function(e){var t=[],i={bold:!1,ital:!1,mono:!1,beginable:!0,spacing:!1,position:0,buffer:"",modStack:[]};for(i.mod=function(){return 0===this.modStack.length?"normal":this.modStack[0]},i.modName=function(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":i.bold&&i.ital?"boldital":i.bold?"bold":i.ital?"ital":void 0},i.emitBlock=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(t.push({text:this.buffer,mod:this.modName()}),this.buffer="")},i.add=function(e){" "===e&&(i.spacing=!0),i.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)};i.position0&&void 0!==arguments[0]&&arguments[0];this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(t.push({text:this.buffer,mod:this.modName()}),this.buffer="")},i.add=function(e){" "===e&&(i.spacing=!0),i.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)};i.position/.test(e.substr(i.position,3))?i.mono||i.ital||!//.test(e.substr(i.position,3))?!i.mono&&//.test(e.substr(i.position,6))?(i.emitBlock(),i.mono=!0,i.modStack.unshift("mono"),i.position+=5):!i.mono&&"bold"===i.mod()&&/<\/b>/.test(e.substr(i.position,4))?(i.emitBlock(),i.bold=!1,i.modStack.shift(),i.position+=3):!i.mono&&"ital"===i.mod()&&/<\/i>/.test(e.substr(i.position,4))?(i.emitBlock(),i.ital=!1,i.modStack.shift(),i.position+=3):"mono"===i.mod()&&/<\/code>/.test(e.substr(i.position,7))?(i.emitBlock(),i.mono=!1,i.modStack.shift(),i.position+=6):i.add(o):(i.emitBlock(),i.ital=!0,i.modStack.unshift("ital"),i.position+=2):(i.emitBlock(),i.bold=!0,i.modStack.unshift("bold"),i.position+=2):/&/.test(o)?/</.test(e.substr(i.position,4))?(i.add("<"),i.position+=3):/&/.test(e.substr(i.position,5))?(i.add("&"),i.position+=4):i.add("&"):i.add(o),i.position++}return i.emitBlock(),t}},{key:"getFormattingValues",value:function(e,t,i,o){var n=function(e,t,i){return"normal"===t?"mod"===i?"":e[i]:e[t][i]?e[t][i]:e[i]},s={color:n(this.fontOptions,o,"color"),size:n(this.fontOptions,o,"size"),face:n(this.fontOptions,o,"face"),mod:n(this.fontOptions,o,"mod"),vadjust:n(this.fontOptions,o,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};return(t||i)&&("normal"===o&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?s.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(s,this.elementOptions.id,t,i)),e.font=(s.mod+" "+s.size+"px "+s.face).replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.fontOptions.selectedState&&t!==this.fontOptions.hoverState}},{key:"_processLabel",value:function(e,t,i){var o=0,n=0,s=[],r=0;if(s.add=function(e,t,i,o,n,s,r,a,d,h){this.length==e&&(this[e]={width:0,height:0,blocks:[]}),this[e].blocks.push({text:t,font:i,color:o,width:n,height:s,vadjust:r,mod:a,strokeWidth:d,strokeColor:h})},s.accumulate=function(e,t,i){this[e].width+=t,this[e].height=i>this[e].height?i:this[e].height},s.addAndAccumulate=function(e,t,i,o,n,s,r,a,d,h){this.add(e,t,i,o,n,s,r,a,d,h),this.accumulate(e,n,s)},void 0!==this.elementOptions.label){var a=String(this.elementOptions.label).split("\n"),d=a.length;if(this.elementOptions.font.multi)for(var h=0;h0)for(var v=this.getFormattingValues(e,t,i,l[p].mod),g=l[p].text.split(" "),y=!0,m="",b={width:0},_=void 0,w=0;wthis.fontOptions.maxWdt&&0!=_.width?(c=v.height>c?v.height:c,s.add(r,m,v.font,v.color,_.width,v.height,v.vadjust,l[p].mod,v.strokeWidth,v.strokeColor),s.accumulate(r,_.width,c),m="",y=!0,u=0,o=s[r].width>o?s[r].width:o,n+=s[r].height,r++):(m=m+k+g[w],w===g.length-1&&(c=v.height>c?v.height:c,u+=b.width,s.add(r,m,v.font,v.color,b.width,v.height,v.vadjust,l[p].mod,v.strokeWidth,v.strokeColor),s.accumulate(r,b.width,c),p===l.length-1&&(o=s[r].width>o?s[r].width:o,n+=s[r].height,r++)),w++,y=!1)}else{var x=this.getFormattingValues(e,t,i,l[p].mod),O=e.measureText(l[p].text);s.addAndAccumulate(r,l[p].text,x.font,x.color,O.width,x.height,x.vadjust,l[p].mod,x.strokeWidth,x.strokeColor),o=s[r].width>o?s[r].width:o,l.length-1===p&&(n+=s[r].height,r++)}}}else for(var M=0;M0)for(var S=a[M].split(" "),D="",C={width:0},T=void 0,P=0;Pthis.fontOptions.maxWdt&&0!=T.width?(s.addAndAccumulate(r,D,E.font,E.color,T.width,E.size,E.vadjust,"normal",E.strokeWidth,E.strokeColor),o=s[r].width>o?s[r].width:o,n+=s[r].height,D="",r++):(D=D+F+S[P],P===S.length-1&&(s.addAndAccumulate(r,D,E.font,E.color,C.width,E.size,E.vadjust,"normal",E.strokeWidth,E.strokeColor),o=s[r].width>o?s[r].width:o,n+=s[r].height,r++),P++)}else{var I=a[M],N=e.measureText(I);s.addAndAccumulate(r,I,E.font,E.color,N.width,E.size,E.vadjust,"normal",E.strokeWidth,E.strokeColor),o=s[r].width>o?s[r].width:o,n+=s[r].height,r++}}}this.fontOptions.minWdt>0&&o0&&n2&&void 0!==arguments[2]&&arguments[2];e.parseFontString(t,i.font)?t.vadjust=0:"object"===(0,h.default)(i.font)&&p.fillIfDefined(t,i.font,o),t.size=Number(t.size),t.vadjust=Number(t.vadjust)}},{key:"parseFontString",value:function(e,t){if(!t||"string"!=typeof t)return!1;var i=t.split(" ");return e.size=i[0].replace("px",""),e.face=i[1],e.color=i[2],!0}}]),e}();t.default=v},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var n=i(116),s=o(n),r=i(2),a=o(r);t.default=function(){function e(e,t){var i=[],o=!0,n=!1,s=void 0;try{for(var r,d=(0,a.default)(e);!(o=(r=d.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){n=!0,s=e}finally{try{!o&&d.return&&d.return()}finally{if(n)throw s}}return i}return function(t,i){if(Array.isArray(t))return t;if((0,s.default)(Object(t)))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t,i){e.exports={default:i(117),__esModule:!0}},function(e,t,i){i(4),i(50),e.exports=i(118)},function(e,t,i){var o=i(54),n=i(47)("iterator"),s=i(8);e.exports=i(17).isIterable=function(e){var t=Object(e);return void 0!==t[n]||"@@iterator"in t||s.hasOwnProperty(o(t))}},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{ -value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=function(e){function t(e,i,o){(0,a.default)(this,t);var n=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return n._setMargins(o),n}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=this.width/2)}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),e.roundRect(this.left,this.top,this.width,this.height,s.borderRadius),this.performFill(e,s),this.updateBoundingBox(t,i,e,o,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"updateBoundingBox",value:function(e,t,i,o,n){this._updateBoundingBox(e,t,i,o,n);var s=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(s)}},{key:"distanceToBorder",value:function(e,t){this.resize(e);var i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}}]),t}(v.default);t.default=g},function(e,t,i){e.exports={default:i(121),__esModule:!0}},function(e,t,i){i(122),e.exports=i(17).Object.getPrototypeOf},function(e,t,i){var o=i(49),n=i(48);i(61)("getPrototypeOf",function(){return function(e){return n(o(e))}})},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var n=i(62),s=o(n);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,s.default)(t))&&"function"!=typeof t?e:t}},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var n=i(125),s=o(n),r=i(55),a=o(r),d=i(62),h=o(d);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,h.default)(t)));e.prototype=(0,a.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(s.default?(0,s.default)(e,t):e.__proto__=t)}},function(e,t,i){e.exports={default:i(126),__esModule:!0}},function(e,t,i){i(127),e.exports=i(17).Object.setPrototypeOf},function(e,t,i){var o=i(15);o(o.S,"Object",{setPrototypeOf:i(128).set})},function(e,t,i){var o=i(23),n=i(22),s=function(e,t){if(n(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{o=i(18)(Function.call,i(78).f(Object.prototype,"__proto__").set,2),o(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,i){return s(e,i),t?e.__proto__=i:o(e,i),e}}({},!1):void 0),check:s}},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(62),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=function(){function e(t,i,o){(0,a.default)(this,e),this.body=i,this.labelModule=o,this.setOptions(t),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.refreshNeeded=!0,this.boundingBox={top:0,left:0,right:0,bottom:0}}return(0,h.default)(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"_setMargins",value:function(e){this.margin={},this.options.margin&&("object"==(0,s.default)(this.options.margin)?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),e.adjustSizes(this.margin)}},{key:"_distanceToBorder",value:function(e,t){var i=this.options.borderWidth;return this.resize(e),Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}},{key:"enableShadow",value:function(e,t){t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}},{key:"enableBorderDashes",value:function(e,t){if(t.borderDashes!==!1)if(void 0!==e.setLineDash){var i=t.borderDashes;i===!0&&(i=[5,15]),e.setLineDash(i)}else console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1}},{key:"disableBorderDashes",value:function(e,t){t.borderDashes!==!1&&(void 0!==e.setLineDash?e.setLineDash([0]):(console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1))}},{key:"needsRefresh",value:function(e,t){return this.refreshNeeded===!0?(this.refreshNeeded=!1,!0):void 0===this.width||this.labelModule.differentState(e,t)}},{key:"initContextForDraw",value:function(e,t){var i=t.borderWidth/this.body.view.scale;e.lineWidth=Math.min(this.width,i),e.strokeStyle=t.borderColor,e.fillStyle=t.color}},{key:"performStroke",value:function(e,t){var i=t.borderWidth/this.body.view.scale;e.save(),i>0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){this.enableShadow(e,t),e.fill(),this.disableShadow(e,t),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,i,o,n){void 0!==i&&this.resize(i,o,n),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,i,o,n){this._updateBoundingBox(e,t,i,o,n)}}]),e}();t.default=l},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(131),v=o(p),g=function(e){function t(e,i,o){(0,a.default)(this,t);var n=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return n._setMargins(o),n}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){this.textSize=this.labelModule.getTextSize(e,t,i);var o=Math.max(this.textSize.width+this.margin.right+this.margin.left,this.textSize.height+this.margin.top+this.margin.bottom);this.options.size=o/2,this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,o,n)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),.5*this.width}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=i(110),y=(o(g),function(e){function t(e,i,o){(0,a.default)(this,t);var n=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return n.labelOffset=0,n.selected=!1,n}return(0,f.default)(t,e),(0,h.default)(t,[{key:"setOptions",value:function(e,t,i){this.options=e,void 0===t&&void 0===i||this.setImages(t,i)}},{key:"setImages",value:function(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}},{key:"switchImages",value:function(e){var t=e&&!this.selected||!e&&this.selected;if(this.selected=e,void 0!==this.imageObjAlt&&t){var i=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=i}}},{key:"_resizeImage",value:function(){var e,t;if(this.options.shapeProperties.useImageSize===!1){var i=1,o=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?i=this.imageObj.width/this.imageObj.height:o=this.imageObj.height/this.imageObj.width),e=2*this.options.size*i,t=2*this.options.size*o}else e=this.imageObj.width,t=this.imageObj.height;this.width=e,this.height=t,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(e,t,i,o){this.initContextForDraw(e,o),e.circle(t,i,o.size),this.performFill(e,o)}},{key:"_drawImageAtPosition",value:function(e,t){if(0!=this.imageObj.width){e.globalAlpha=1,this.enableShadow(e,t);var i=1;this.options.shapeProperties.interpolation===!0&&(i=this.imageObj.width/this.width/this.body.view.scale),this.imageObj.drawImageAtPosition(e,i,this.left,this.top,this.width,this.height),this.disableShadow(e,t)}}},{key:"_drawImageLabel",value:function(e,t,i,o,n){var s,r=0;if(void 0!==this.height){r=.5*this.height;var a=this.labelModule.getTextSize(e,o,n);a.lineCount>=1&&(r+=a.height/2)}s=i+r,this.options.label&&(this.labelOffset=r),this.labelModule.draw(e,t,s,o,n,"hanging")}}]),t}(v.default));t.default=y},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(131),v=o(p),g=function(e){function t(e,i,o,n,r){(0,a.default)(this,t);var d=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return d.setImages(n,r),d}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,o=void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height;if(o){var n=2*this.options.size;return this.width=n,this.height=n,void(this.radius=.5*this.width)}this.needsRefresh(t,i)&&this._resizeImage()}},{key:"draw",value:function(e,t,i,o,n,s){this.switchImages(o),this.resize(),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),e.save(),e.clip(),this._drawImageAtPosition(e,s),e.restore(),this._drawImageLabel(e,t,i,o,n),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),.5*this.width}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=function(e){function t(e,i,o){(0,a.default)(this,t);var n=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return n._setMargins(o),n}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e,t,i){if(this.needsRefresh(t,i)){this.textSize=this.labelModule.getTextSize(e,t,i);var o=this.textSize.width+this.margin.right+this.margin.left;this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),e.database(t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,o,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(135),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"diamond",4,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){this.labelModule.getTextSize(e,t,i);var n=2*o.size;this.width=n,this.height=n,this.radius=.5*this.width}}},{key:"_drawShape",value:function(e,t,i,o,n,s,r,a){if(this.resize(e,s,r,a),this.left=o-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),e[t](o,n,a.size),this.performFill(e,a),void 0!==this.options.label){this.labelModule.calculateLabelSize(e,s,r,o,n,"hanging");var d=n+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,o,d,s,r,"hanging")}this.updateBoundingBox(o,n)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(135),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"circle",2,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),this.options.size}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var o=this.labelModule.getTextSize(e,t,i);this.height=2*o.height,this.width=o.width+this.height,this.radius=.5*this.width}}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-.5*this.width,this.top=i-.5*this.height,this.initContextForDraw(e,s),e.ellipse_vis(this.left,this.top,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,o,n),this.labelModule.draw(e,t,i,o,n)}},{key:"distanceToBorder",value:function(e,t){this.resize(e);var i=.5*this.width,o=.5*this.height,n=Math.sin(t)*i,s=Math.cos(t)*o;return i*o/Math.sqrt(n*n+s*s)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=function(e){function t(e,i,o){(0,a.default)(this,t);var n=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return n._setMargins(o),n}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(e,t,i,o,n,s){if(this.resize(e,o,n),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,o,n,s),void 0!==this.options.label){var r=5;this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+r,o)}this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){if(this.boundingBox.top=t-.5*this.options.icon.size,this.boundingBox.left=e-.5*this.options.icon.size,this.boundingBox.right=e+.5*this.options.icon.size,this.boundingBox.bottom=t+.5*this.options.icon.size,void 0!==this.options.label&&this.labelModule.size.width>0){var i=5;this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+i)}}},{key:"_icon",value:function(e,t,i,o,n,s){var r=Number(this.options.icon.size);void 0!==this.options.icon.code?(e.font=(o?"bold ":"")+r+"px "+this.options.icon.face,e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,s),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,s)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(131),v=o(p),g=function(e){function t(e,i,o,n,r){(0,a.default)(this,t);var d=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return d.setImages(n,r),d}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,o=void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height;if(o){var n=2*this.options.size;return this.width=n,void(this.height=n)}this.needsRefresh(t,i)&&this._resizeImage()}},{key:"draw",value:function(e,t,i,o,n,s){if(this.switchImages(o),this.resize(),this.left=t-this.width/2,this.top=i-this.height/2,this.options.shapeProperties.useBorderWithImage===!0){var r=this.options.borderWidth,a=this.options.borderWidthSelected||2*this.options.borderWidth,d=(o?a:r)/this.body.view.scale;e.lineWidth=Math.min(this.width,d),e.beginPath(),e.strokeStyle=o?this.options.color.highlight.border:n?this.options.color.hover.border:this.options.color.border,e.fillStyle=o?this.options.color.highlight.background:n?this.options.color.hover.background:this.options.color.background,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),e.fill(),this.performStroke(e,s),e.closePath()}this._drawImageAtPosition(e,s),this._drawImageLabel(e,t,i,o,n),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.resize(),this._updateBoundingBox(e,t),void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(135),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"square",2,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(135),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"star",4,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(129),v=o(p),g=function(e){function t(e,i,o){(0,a.default)(this,t);var n=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o));return n._setMargins(o),n}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(e,t,i,o,n,s){this.resize(e,o,n),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,o,n),this.disableShadow(e,s),this.updateBoundingBox(t,i,e,o,n)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(135),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"triangle",3,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(135),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,o,n,s){this._drawShape(e,"triangleDown",3,t,i,o,n,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.printStyle=void 0;var n=i(89),s=o(n),r=i(62),a=o(r),d=i(58),h=o(d),l=i(105),u=o(l),c=i(106),f=o(c),p=i(1),v=!1,g=void 0,y="background: #FFeeee; color: #dd0000",m=function(){function e(){(0,u.default)(this,e)}return(0,f.default)(e,null,[{key:"validate",value:function(t,i,o){v=!1,g=i;var n=i;return void 0!==o&&(n=i[o]),e.parse(t,n,[]),v}},{key:"parse",value:function(t,i,o){for(var n in t)t.hasOwnProperty(n)&&e.check(n,t,i,o)}},{key:"check",value:function(t,i,o,n){void 0===o[t]&&void 0===o.__any__?e.getSuggestion(t,o,n):void 0===o[t]&&void 0!==o.__any__?"object"===e.getType(i[t])&&void 0!==o.__any__.__type__?e.checkFields(t,i,o,"__any__",o.__any__.__type__,n):e.checkFields(t,i,o,"__any__",o.__any__,n):void 0!==o[t].__type__?e.checkFields(t,i,o,t,o[t].__type__,n):e.checkFields(t,i,o,t,o[t],n)}},{key:"checkFields",value:function(t,i,o,n,s,r){var a=e.getType(i[t]),d=s[a];void 0!==d?"array"===e.getType(d)&&d.indexOf(i[t])===-1?(console.log('%cInvalid option detected in "'+t+'". Allowed values are:'+e.print(d)+' not "'+i[t]+'". '+e.printLocation(r,t),y),v=!0):"object"===a&&"__any__"!==n&&(r=p.copyAndExtendArray(r,t),e.parse(i[t],o[n],r)):void 0===s.any&&(console.log('%cInvalid type received for "'+t+'". Expected: '+e.print((0,h.default)(s))+". Received ["+a+'] "'+i[t]+'"'+e.printLocation(r,t),y),v=!0)}},{key:"getType",value:function(e){var t="undefined"==typeof e?"undefined":(0,a.default)(e);return"object"===t?null===e?"null":e instanceof Boolean?"boolean":e instanceof Number?"number":e instanceof String?"string":Array.isArray(e)?"array":e instanceof Date?"date":void 0!==e.nodeType?"dom":e._isAMomentObject===!0?"moment":"object":"number"===t?"number":"boolean"===t?"boolean":"string"===t?"string":void 0===t?"undefined":t}},{key:"getSuggestion",value:function(t,i,o){var n=e.findInOptions(t,i,o,!1),s=e.findInOptions(t,g,[],!0),r=8,a=4;void 0!==n.indexMatch?console.log('%cUnknown option detected: "'+t+'" in '+e.printLocation(n.path,t,"")+'Perhaps it was incomplete? Did you mean: "'+n.indexMatch+'"?\n\n',y):s.distance<=a&&n.distance>s.distance?console.log('%cUnknown option detected: "'+t+'" in '+e.printLocation(n.path,t,"")+"Perhaps it was misplaced? Matching option found at: "+e.printLocation(s.path,s.closestMatch,""),y):n.distance<=r?console.log('%cUnknown option detected: "'+t+'". Did you mean "'+n.closestMatch+'"?'+e.printLocation(n.path,t),y):console.log('%cUnknown option detected: "'+t+'". Did you mean one of these: '+e.print((0,h.default)(i))+e.printLocation(o,t),y),v=!0}},{key:"findInOptions",value:function(t,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,r="",a=[],d=t.toLowerCase(),h=void 0;for(var l in i){var u=void 0;if(void 0!==i[l].__type__&&n===!0){var c=e.findInOptions(t,i[l],p.copyAndExtendArray(o,l));s>c.distance&&(r=c.closestMatch,a=c.path,s=c.distance,h=c.indexMatch)}else l.toLowerCase().indexOf(d)!==-1&&(h=l),u=e.levenshteinDistance(t,l),s>u&&(r=l,a=p.copyArray(o),s=u)}return{closestMatch:r,path:a,distance:s,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",o="\n\n"+i+"options = {\n",n=0;n1&&void 0!==arguments[1])||arguments[1];"dynamic"===t&&(t="continuous");var o=!1;for(var n in e.body.edges)if(e.body.edges.hasOwnProperty(n)){var s=e.body.edges[n],r=e.body.data.edges._data[n];if(void 0!==r){var a=r.smooth;void 0!==a&&a.enabled===!0&&"dynamic"===a.type&&(void 0===t?s.setOptions({smooth:!1}):s.setOptions({smooth:{type:t}}),o=!0)}}i===!0&&o===!0&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",function(){d.forEach(e.edgesListeners,function(t,i){e.body.data.edges&&e.body.data.edges.off(i,t)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(this.edgeOptions=e,void 0!==e){u.parseOptions(this.options,e);var t=!1;if(void 0!==e.smooth)for(var i in this.body.edges)this.body.edges.hasOwnProperty(i)&&(t=this.body.edges[i].updateEdgeType()||t);if(void 0!==e.font){c.parseOptions(this.options.font,e);for(var o in this.body.edges)this.body.edges.hasOwnProperty(o)&&this.body.edges[o].updateLabelModule()}void 0===e.hidden&&void 0===e.physics&&t!==!0||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){ -var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this.body.data.edges;if(e instanceof h||e instanceof l)this.body.data.edges=e;else if(Array.isArray(e))this.body.data.edges=new h,this.body.data.edges.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.edges=new h}if(o&&d.forEach(this.edgesListeners,function(e,t){o.off(t,e)}),this.body.edges={},this.body.data.edges){d.forEach(this.edgesListeners,function(e,i){t.body.data.edges.on(i,e)});var n=this.body.data.edges.getIds();this.add(n,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),i===!1&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.edges,o=this.body.data.edges,n=0;ni.shape.height?(s=i.x+.5*i.shape.width,r=i.y-a):(s=i.x+a,r=i.y-.5*i.shape.height),n=this._pointOnCircle(s,r,a,.125),this.labelModule.draw(e,n.x,n.y,this.selected,this.hover)}}}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=10,i=this.from.x,o=this.from.y,n=this.to.x,s=this.to.y,r=e.left,a=e.top,d=this.edgeType.getDistanceToEdge(i,o,n,s,r,a);return d0&&i<0)&&(o+=Math.PI),e.rotate(o)}},{key:"_pointOnCircle",value:function(e,t,i,o){var n=2*o*Math.PI;return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}}],[{key:"parseOptions",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=["arrowStrikethrough","id","from","hidden","hoverWidth","label","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","to","title","value","width"];if(p.selectiveDeepExtend(n,e,t,i),p.mergeOptions(e,t,"smooth",i,o),p.mergeOptions(e,t,"shadow",i,o),void 0!==t.dashes&&null!==t.dashes?e.dashes=t.dashes:i===!0&&null===t.dashes&&(e.dashes=(0,a.default)(o.dashes)),void 0!==t.scaling&&null!==t.scaling?(void 0!==t.scaling.min&&(e.scaling.min=t.scaling.min),void 0!==t.scaling.max&&(e.scaling.max=t.scaling.max),p.mergeOptions(e.scaling,t.scaling,"label",i,o.scaling)):i===!0&&null===t.scaling&&(e.scaling=(0,a.default)(o.scaling)),void 0!==t.arrows&&null!==t.arrows)if("string"==typeof t.arrows){var r=t.arrows.toLowerCase();e.arrows.to.enabled=r.indexOf("to")!=-1,e.arrows.middle.enabled=r.indexOf("middle")!=-1,e.arrows.from.enabled=r.indexOf("from")!=-1}else{if("object"!==(0,h.default)(t.arrows))throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+(0,s.default)(t.arrows));p.mergeOptions(e.arrows,t.arrows,"to",i,o.arrows),p.mergeOptions(e.arrows,t.arrows,"middle",i,o.arrows),p.mergeOptions(e.arrows,t.arrows,"from",i,o.arrows)}else i===!0&&null===t.arrows&&(e.arrows=(0,a.default)(o.arrows));if(void 0!==t.color&&null!==t.color)if(e.color=p.deepExtend({},e.color,!0),p.isString(t.color))e.color.color=t.color,e.color.highlight=t.color,e.color.hover=t.color,e.color.inherit=!1;else{var d=!1;void 0!==t.color.color&&(e.color.color=t.color.color,d=!0),void 0!==t.color.highlight&&(e.color.highlight=t.color.highlight,d=!0),void 0!==t.color.hover&&(e.color.hover=t.color.hover,d=!0),void 0!==t.color.inherit&&(e.color.inherit=t.color.inherit),void 0!==t.color.opacity&&(e.color.opacity=Math.min(1,Math.max(0,t.color.opacity))),void 0===t.color.inherit&&d===!0&&(e.color.inherit=!1)}else i===!0&&null===t.color&&(e.color=p.bridgeObject(o.color));void 0!==t.font&&null!==t.font?v.parseOptions(e.font,t):i===!0&&null===t.font&&(e.font=p.bridgeObject(o.font))}}]),e}();t.default=_},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(120),a=o(r),d=i(105),h=o(d),l=i(106),u=o(l),c=i(123),f=o(c),p=i(124),v=o(p),g=i(149),y=o(g),m=function(e){function t(e,i,o){return(0,h.default)(this,t),(0,f.default)(this,(t.__proto__||(0,a.default)(t)).call(this,e,i,o))}return(0,v.default)(t,e),(0,u.default)(t,[{key:"_line",value:function(e,t,i){var o=i[0],n=i[1];this._bezierCurve(e,t,o,n)}},{key:"_getViaCoordinates",value:function(){var e=this.from.x-this.to.x,t=this.from.y-this.to.y,i=void 0,o=void 0,n=void 0,s=void 0,r=this.options.smooth.roundness;return(Math.abs(e)>Math.abs(t)||this.options.smooth.forceDirection===!0||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(o=this.from.y,s=this.to.y,i=this.from.x-r*e,n=this.to.x+r*e):(o=this.from.y-r*t,s=this.to.y+r*t,i=this.from.x,n=this.to.x),[{x:i,y:o},{x:n,y:s}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(e,t){return this._findBorderPositionBezier(e,t)}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,r){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates(),d=(0,s.default)(a,2),h=d[0],l=d[1];return this._getDistanceToBezierEdge(e,t,i,o,n,r,h,l)}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=(0,s.default)(t,2),o=i[0],n=i[1],r=e,a=[];a[0]=Math.pow(1-r,3),a[1]=3*r*Math.pow(1-r,2),a[2]=3*Math.pow(r,2)*(1-r),a[3]=Math.pow(r,3);var d=a[0]*this.fromPoint.x+a[1]*o.x+a[2]*n.x+a[3]*this.toPoint.x,h=a[0]*this.fromPoint.y+a[1]*o.y+a[2]*n.y+a[3]*this.toPoint.y;return{x:d,y:h}}}]),t}(y.default);t.default=m},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(150),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_getDistanceToBezierEdge",value:function(e,t,i,o,n,s,r,a){var d=1e9,h=void 0,l=void 0,u=void 0,c=void 0,f=void 0,p=e,v=t,g=[0,0,0,0];for(l=1;l<10;l++)u=.1*l,g[0]=Math.pow(1-u,3),g[1]=3*u*Math.pow(1-u,2),g[2]=3*Math.pow(u,2)*(1-u),g[3]=Math.pow(u,3),c=g[0]*e+g[1]*r.x+g[2]*a.x+g[3]*i,f=g[0]*t+g[1]*r.y+g[2]*a.y+g[3]*o,l>0&&(h=this._getDistanceToLine(p,v,c,f,n,s),d=h2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),d=10,h=0,l=0,u=1,c=.2,f=this.to,p=!1;for(e.id===this.from.id&&(f=this.from,p=!0);l<=u&&h0&&(d=this._getDistanceToLine(f,p,u,c,n,s),a=do.shape.height?(t=o.x+.5*o.shape.width,i=o.y-n):(t=o.x+n,i=o.y-.5*o.shape.height),[t,i,n]}},{key:"_pointOnCircle",value:function(e,t,i,o){var n=2*o*Math.PI;return{x:e+i*Math.cos(n),y:t-i*Math.sin(n)}}},{key:"_findBorderPositionCircle",value:function(e,t,i){for(var o=i.x,n=i.y,s=i.low,r=i.high,a=i.direction,d=10,h=0,l=this.options.selfReferenceSize,u=void 0,c=void 0,f=void 0,p=void 0,v=void 0,g=.05,y=.5*(s+r);s<=r&&h0?a>0?s=y:r=y:a>0?r=y:s=y,h++;return u.t=y,u}},{key:"getLineWidth",value:function(e,t){return e===!0?Math.max(this.selectionWidth,.3/this.body.view.scale):t===!0?Math.max(this.hoverWidth,.3/this.body.view.scale):Math.max(this.options.width,.3/this.body.view.scale)}},{key:"getColor",value:function(e,t,i,o){if(t.inheritsColor!==!1){if("both"===t.inheritsColor&&this.from.id!==this.to.id){var n=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),s=void 0,r=void 0;return s=this.from.options.color.highlight.border,r=this.to.options.color.highlight.border,this.from.selected===!1&&this.to.selected===!1?(s=l.overrideOpacity(this.from.options.color.border,t.opacity),r=l.overrideOpacity(this.to.options.color.border,t.opacity)):this.from.selected===!0&&this.to.selected===!1?r=this.to.options.color.border:this.from.selected===!1&&this.to.selected===!0&&(s=this.from.options.color.border),n.addColorStop(0,s),n.addColorStop(1,r),n}return"to"===t.inheritsColor?l.overrideOpacity(this.to.options.color.border,t.opacity):l.overrideOpacity(this.from.options.color.border,t.opacity)}return l.overrideOpacity(t.color,t.opacity)}},{key:"_circle",value:function(e,t,i,o,n){this.enableShadow(e,t),e.beginPath(),e.arc(i,o,n,0,2*Math.PI,!1),e.stroke(),this.disableShadow(e,t)}},{key:"getDistanceToEdge",value:function(e,t,i,o,n,r,a,d){var h=0;if(this.from!=this.to)h=this._getDistanceToEdge(e,t,i,o,n,r,a);else{var l=this._getCircleData(void 0),u=(0,s.default)(l,3),c=u[0],f=u[1],p=u[2],v=c-n,g=f-r;h=Math.abs(Math.sqrt(v*v+g*g)-p)}return this.labelModule.size.leftn&&this.labelModule.size.topr?0:h}},{key:"_getDistanceToLine",value:function(e,t,i,o,n,s){var r=i-e,a=o-t,d=r*r+a*a,h=((n-e)*r+(s-t)*a)/d;h>1?h=1:h<0&&(h=0);var l=e+h*r,u=t+h*a,c=l-n,f=u-s;return Math.sqrt(c*c+f*f)}},{key:"getArrowData",value:function(e,t,i,o,n,r){var a=void 0,d=void 0,h=void 0,l=void 0,u=void 0,c=void 0,f=void 0,p=r.width;if("from"===t?(h=this.from,l=this.to,u=.1,c=r.fromArrowScale,f=r.fromArrowType):"to"===t?(h=this.to,l=this.from,u=-.1,c=r.toArrowScale,f=r.toArrowType):(h=this.to,l=this.from,c=r.middleArrowScale,f=r.middleArrowType),h!=l)if("middle"!==t)if(this.options.smooth.enabled===!0){d=this.findBorderPosition(h,e,{via:i});var v=this.getPoint(Math.max(0,Math.min(1,d.t+u)),i);a=Math.atan2(d.y-v.y,d.x-v.x)}else a=Math.atan2(h.y-l.y,h.x-l.x),d=this.findBorderPosition(h,e);else a=Math.atan2(h.y-l.y,h.x-l.x),d=this.getPoint(.5,i);else{var g=this._getCircleData(e),y=(0,s.default)(g,3),m=y[0],b=y[1],_=y[2];"from"===t?(d=this.findBorderPosition(this.from,e,{x:m,y:b,low:.25,high:.6,direction:-1}),a=d.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI):"to"===t?(d=this.findBorderPosition(this.from,e,{x:m,y:b,low:.6,high:1,direction:1}),a=d.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI):(d=this._pointOnCircle(m,b,_,.175),a=3.9269908169872414)}var w=15*c+3*p,k=d.x-.9*w*Math.cos(a),x=d.y-.9*w*Math.sin(a),O={x:k,y:x};return{point:d,core:O,angle:a,length:w,type:f}}},{key:"drawArrowHead",value:function(e,t,i,o,n){e.strokeStyle=this.getColor(e,t,i,o),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,n.type&&"circle"===n.type.toLowerCase()?e.circleEndpoint(n.point.x,n.point.y,n.angle,n.length):e.arrowEndpoint(n.point.x,n.point.y,n.angle,n.length),this.enableShadow(e,t),e.fill(),this.disableShadow(e,t)}},{key:"enableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){t.shadow===!0&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}}]),e}();t.default=u},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(115),s=o(n),r=i(120),a=o(r),d=i(105),h=o(d),l=i(106),u=o(l),c=i(123),f=o(c),p=i(124),v=o(p),g=i(150),y=o(g),m=function(e){function t(e,i,o){(0,h.default)(this,t);var n=(0,f.default)(this,(t.__proto__||(0,a.default)(t)).call(this,e,i,o));return n._boundFunction=function(){n.positionBezierNode()},n.body.emitter.on("_repositionBezierNodes",n._boundFunction),n}return(0,v.default)(t,e),(0,u.default)(t,[{key:"setOptions",value:function(e){var t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this.body.nodes[this.options.from],this.to=this.body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}},{key:"connect",value:function(){this.from=this.body.nodes[this.options.from],this.to=this.body.nodes[this.options.to],void 0===this.from||void 0===this.to||this.options.physics===!1?this.via.setOptions({physics:!1}):this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}},{key:"cleanup",value:function(){return this.body.emitter.off("_repositionBezierNodes",this._boundFunction),void 0!==this.via&&(delete this.body.nodes[this.via.id],this.via=void 0,!0)}},{key:"setupSupportNode",value:function(){if(void 0===this.via){var e="edgeId:"+this.id,t=this.body.functions.createNode({id:e,shape:"circle",physics:!0,hidden:!0});this.body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}},{key:"positionBezierNode",value:function(){void 0!==this.via&&void 0!==this.from&&void 0!==this.to?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):void 0!==this.via&&(this.via.x=0,this.via.y=0)}},{key:"_line",value:function(e,t,i){this._bezierCurve(e,t,i)}},{key:"getViaNode",value:function(){return this.via}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.via,i=e,o=void 0,n=void 0;if(this.from===this.to){var r=this._getCircleData(this.from),a=(0,s.default)(r,3),d=a[0],h=a[1],l=a[2],u=2*Math.PI*(1-i);o=d+l*Math.sin(u),n=h+l-l*(1-Math.cos(u))}else o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,n=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:n}}},{key:"_findBorderPosition",value:function(e,t){return this._findBorderPositionBezier(e,t,this.via)}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,s){return this._getDistanceToBezierEdge(e,t,i,o,n,s,this.via)}}]),t}(y.default);t.default=m},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(150),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_line",value:function(e,t,i){this._bezierCurve(e,t,i)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var e=void 0,t=void 0,i=this.options.smooth.roundness,o=this.options.smooth.type,n=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if("discrete"===o||"diagonalCross"===o){var r=void 0,a=void 0;r=a=n<=s?i*s:i*n,this.from.x>this.to.x&&(r=-r),this.from.y>=this.to.y&&(a=-a),e=this.from.x+r,t=this.from.y+a,"discrete"===o&&(n<=s?e=nthis.to.x&&(_=-_),this.from.y>=this.to.y&&(w=-w),e=this.from.x+_,t=this.from.y+w,n<=s?e=this.from.x<=this.to.x?this.to.xe?this.to.x:e:t=this.from.y>=this.to.y?this.to.y>t?this.to.y:t:this.to.y2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,s){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,o,n,s,r)}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=e,o=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,n=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:o,y:n}}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(106),h=o(d),l=i(123),u=o(l),c=i(124),f=o(c),p=i(151),v=o(p),g=function(e){function t(e,i,o){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_line",value:function(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}},{key:"_findBorderPosition",value:function(e,t){var i=this.to,o=this.from;e.id===this.from.id&&(i=this.from,o=this.to);var n=Math.atan2(i.y-o.y,i.x-o.x),s=i.x-o.x,r=i.y-o.y,a=Math.sqrt(s*s+r*r),d=e.distanceToBorder(t,n),h=(a-d)/a,l={};return l.x=(1-h)*o.x+h*i.x,l.y=(1-h)*o.y+h*i.y,l}},{key:"_getDistanceToEdge",value:function(e,t,i,o,n,s){return this._getDistanceToLine(e,t,i,o,n,s)}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(115),a=o(r),d=i(62),h=o(d),l=i(105),u=o(l),c=i(106),f=o(c),p=i(1),v=i(156).default,g=function(){function e(){(0,u.default)(this,e),this.childrenReference={},this.parentReference={},this.levels={},this.trees={},this.isTree=!1}return(0,f.default)(e,[{key:"addRelation",value:function(e,t){void 0===this.childrenReference[e]&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),void 0===this.parentReference[t]&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1)return void(this.isTree=!1);this.isTree=!0}},{key:"ensureLevel",value:function(e){void 0===this.levels[e]&&(this.levels[e]=0); -}},{key:"getMaxLevel",value:function(e){var t=this,i={},o=function e(o){if(void 0!==i[o])return i[o];var n=t.levels[o];if(t.childrenReference[o]){var s=t.childrenReference[o];if(s.length>0)for(var r=0;r0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(o===!0)return this.body.emitter.emit("refresh"),p.deepExtend(t,this.optionsBackup)}return t}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(this.options.hierarchical.enabled===!0){var t=this.optionsBackup.physics;void 0===e.physics||e.physics===!0?(e.physics={enabled:void 0===t.enabled||t.enabled,solver:"hierarchicalRepulsion"},t.enabled=void 0===t.enabled||t.enabled,t.solver=t.solver||"barnesHut"):"object"===(0,h.default)(e.physics)?(t.enabled=void 0===e.physics.enabled||e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):e.physics!==!1&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var i=this.getStaticType();if(void 0===e.edges)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(void 0===e.edges.smooth)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if("boolean"==typeof e.edges.smooth)this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{var o=e.edges.smooth;void 0!==o.type&&"dynamic"!==o.type&&(i=o.type),this.optionsBackup.edges={smooth:void 0===o.enabled||o.enabled,type:void 0===o.type?"dynamic":o.type,roundness:void 0===o.roundness?.5:o.roundness,forceDirection:void 0!==o.forceDirection&&o.forceDirection},e.edges.smooth={enabled:void 0===o.enabled||o.enabled,type:i,roundness:void 0===o.roundness?.5:o.roundness,forceDirection:void 0!==o.forceDirection&&o.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}},{key:"seededRandom",value:function(){var e=1e4*Math.sin(this.randomSeed++);return e-Math.floor(e)}},{key:"positionInitially",value:function(e){if(this.options.hierarchical.enabled!==!0){this.randomSeed=this.initialRandomSeed;for(var t=e.length+50,i=0;ir){for(var d=e.length;e.length>r&&s<=n;){s+=1;var h=e.length;s%3===0?this.body.modules.clustering.clusterBridges(a):this.body.modules.clustering.clusterOutliers(a);var l=e.length;if(h==l&&s%3!==0)return this._declusterAll(),this.body.emitter.emit("_layoutFailed"),void console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.")}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*d)})}s>n&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var u=70,c=0;c0){var e=void 0,t=void 0,i=!1,o=!0,n=!1;this.lastNodeOnLevel={},this.hierarchical=new g,this.treeIndex=-1,this.distributionOrdering={},this.distributionIndex={},this.distributionOrderingPresence={};for(t in this.body.nodes)this.body.nodes.hasOwnProperty(t)&&(e=this.body.nodes[t],void 0===e.options.x&&void 0===e.options.y&&(o=!1),void 0!==e.options.level?(i=!0,this.hierarchical.levels[t]=e.options.level):n=!0);if(n===!0&&i===!0)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(n===!0){var s=this.options.hierarchical.sortMethod;"hubsize"===s?this._determineLevelsByHubsize():"directed"===s?this._determineLevelsDirected():"custom"===s&&this._determineLevelsCustomCallback()}for(var r in this.body.nodes)this.body.nodes.hasOwnProperty(r)&&this.hierarchical.ensureLevel(r);var a=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(a),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,i={},o=function(){for(var t=d(),i=0,o=0;o0)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:1e9,o=1e9,n=1e9,s=1e9,r=-1e9;for(var d in t)if(t.hasOwnProperty(d)){var h=e.body.nodes[d],l=e.hierarchical.levels[h.id],u=e._getPositionForHierarchy(h),c=e._getSpaceAroundNode(h,t),f=(0,a.default)(c,2),p=f[0],v=f[1];o=Math.min(p,o),n=Math.min(v,n),l<=i&&(s=Math.min(u,s),r=Math.max(u,r))}return[s,r,o,n]},u=function(t,i){var o=e.hierarchical.getMaxLevel(t.id),n=e.hierarchical.getMaxLevel(i.id);return Math.min(o,n)},c=function(t,i){var o=e.hierarchical.parentReference[t.id],n=e.hierarchical.parentReference[i.id];if(void 0===o||void 0===n)return!1;for(var s=0;s1)for(var a=0;a2&&void 0!==arguments[2]&&arguments[2],s=e._getPositionForHierarchy(i),r=e._getPositionForHierarchy(o),d=Math.abs(r-s),c=e.options.hierarchical.nodeSpacing;if(d>c){var f={},p={};h(i,f),h(o,p);var v=u(i,o),g=l(f,v),y=(0,a.default)(g,4),m=(y[0],y[1]),b=(y[2],y[3],l(p,v)),_=(0,a.default)(b,4),w=_[0],k=(_[1],_[2]),x=(_[3],Math.abs(m-w));if(x>c){var O=m-w+c;O<-k+c&&(O=-k+c),O<0&&(e._shiftBlock(o.id,O),t=!0,n===!0&&e._centerParent(o))}}},v=function(o,n){for(var s=n.id,r=n.edges,d=e.hierarchical.levels[n.id],u=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,c={},f=[],p=0;p0?v=Math.min(p,f-e.options.hierarchical.nodeSpacing):p<0&&(v=-Math.min(-p,c-e.options.hierarchical.nodeSpacing)),0!=v&&(e._shiftBlock(n.id,v),t=!0)},w=function(i){var o=e._getPositionForHierarchy(n),s=e._getSpaceAroundNode(n),r=(0,a.default)(s,2),d=r[0],h=r[1],l=i-o,u=o;l>0?u=Math.min(o+(h-e.options.hierarchical.nodeSpacing),i):l<0&&(u=Math.max(o-(d-e.options.hierarchical.nodeSpacing),i)),u!==o&&(e._setPositionForHierarchy(n,u,void 0,!0),t=!0)},k=b(o,f);_(k),k=b(o,r),w(k)},g=function(i){var o=(0,s.default)(e.distributionOrdering);o=o.reverse();for(var n=0;n0&&Math.abs(f)0&&(d=this._getPositionForHierarchy(i[n-1])+a),this._setPositionForHierarchy(r,d,t),this._validatePositionAndContinue(r,t,d),o++}}}}},{key:"_placeBranchNodes",value:function(e,t){var i=this.hierarchical.childrenReference[e];if(void 0!==i){for(var o=[],n=0;nt&&void 0===this.positionedNodes[r.id]))return;var d=this.options.hierarchical.nodeSpacing,h=void 0;h=0===s?this._getPositionForHierarchy(this.body.nodes[e]):this._getPositionForHierarchy(o[s-1])+d,this._setPositionForHierarchy(r,h,a),this._validatePositionAndContinue(r,a,h)}var l=this._getCenterPosition(o);this._setPositionForHierarchy(this.body.nodes[e],l,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,i){if(this.hierarchical.isTree){if(void 0!==this.lastNodeOnLevel[t]){var o=this._getPositionForHierarchy(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-oe.hierarchical.levels[t.id]&&e.hierarchical.addRelation(t.id,i.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},i=arguments[1],o={},n=0,s=function i(n,s){if(void 0===o[n.id]){void 0===e.hierarchical.trees[n.id]&&(e.hierarchical.trees[n.id]=s,e.treeIndex=Math.max(s,e.treeIndex)),o[n.id]=!0;for(var r=void 0,a=e._getActiveEdges(n),d=0;d3&&void 0!==arguments[3]&&arguments[3];o!==!0&&(void 0===this.distributionOrdering[i]&&(this.distributionOrdering[i]=[],this.distributionOrderingPresence[i]={}),void 0===this.distributionOrderingPresence[i][e.id]&&(this.distributionOrdering[i].push(e),this.distributionIndex[e.id]=this.distributionOrdering[i].length-1),this.distributionOrderingPresence[i][e.id]=!0),this._isVertical()?e.x=t:e.y=t}},{key:"_isVertical",value:function(){return"UD"===this.options.hierarchical.direction||"DU"===this.options.hierarchical.direction}},{key:"_getPositionForHierarchy",value:function(e){return this._isVertical()?e.x:e.y}},{key:"_sortNodeArray",value:function(e){e.length>1&&(this._isVertical()?e.sort(function(e,t){return e.x-t.x}):e.sort(function(e,t){return e.y-t.y}))}},{key:"getStaticType",value:function(){var e="horizontal";return this._isVertical()||(e="vertical"),e}},{key:"_getCenterPosition",value:function(e){for(var t=1e9,i=-1e9,o=0;o1&&void 0!==arguments[1]?arguments[1]:[],o=1e9,n=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;at.shape.boundingBox.left&&(s=t.shape.boundingBox.left),rt.shape.boundingBox.top&&(o=t.shape.boundingBox.top),n1&&void 0!==arguments[1]?arguments[1]:[],o=1e9,n=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;at.x&&(s=t.x),rt.y&&(o=t.y),n0&&void 0!==arguments[0])||arguments[0];this.stabilized=!0,e===!0&&this._emitStabilized(),void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Date.now();this.physicsTick();var t=Date.now()-e;(t<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&setTimeout(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsTick",value:function(){if(this.startedStabilization===!1&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0),this.stabilized===!1){if(this.adaptiveTimestep===!0&&this.adaptiveTimestepEnabled===!0){var e=1.2;this.adaptiveCounter%this.adaptiveInterval===0?(this.timestep=2*this.timestep,this.calculateForces(),this.moveNodes(),this.revert(),this.timestep=.5*this.timestep,this.calculateForces(),this.moveNodes(),this.calculateForces(),this.moveNodes(),this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/es))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=this.options.maxVelocity?this.options.maxVelocity:1e9,i=0,o=0,n=5,s=0;st?s[e].x>0?t:-t:s[e].x,i.x+=s[e].x*o}else n[e].x=0,s[e].x=0;if(i.options.fixed.y===!1){var d=this.modelOptions.damping*s[e].y,h=(n[e].y-d)/i.options.mass;s[e].y+=h*o,s[e].y=Math.abs(s[e].y)>t?s[e].y>0?t:-t:s[e].y,i.y+=s[e].y*o}else n[e].y=0,s[e].y=0;var l=Math.sqrt(Math.pow(s[e].x,2)+Math.pow(s[e].y,2));return l}},{key:"calculateForces",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve()}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)e.hasOwnProperty(t)&&e[t].x&&e[t].y&&(this.freezeCache[t]={x:e[t].options.fixed.x,y:e[t].options.fixed.y},e[t].options.fixed.x=!0,e[t].options.fixed.y=!0)}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)e.hasOwnProperty(t)&&void 0!==this.freezeCache[t]&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;return"number"!=typeof t&&(console.log("The stabilize method needs a numeric amount of iterations. Switching to default: ",this.options.stabilization.iterations),t=this.options.stabilization.iterations),0===this.physicsBody.physicsNodeIndices.length?void(this.ready=!0):(this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,void setTimeout(function(){return e._stabilizationBatch()},0))}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return e.stabilized===!1&&e.stabilizationIterations0){var e=void 0,t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,o=i.length,n=this._formBarnesHutTree(t,i);this.barnesHutTree=n;for(var s=0;s0&&(this._getForceContribution(n.root.children.NW,e),this._getForceContribution(n.root.children.NE,e),this._getForceContribution(n.root.children.SW,e),this._getForceContribution(n.root.children.SE,e))}}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var i=void 0,o=void 0,n=void 0;i=e.centerOfMass.x-t.x,o=e.centerOfMass.y-t.y,n=Math.sqrt(i*i+o*o),n*e.calcSize>this.thetaInversed?this._calculateForces(n,i,o,t,e):4===e.childrenCount?(this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)):e.children.data.id!=t.id&&this._calculateForces(n,i,o,t,e)}}},{key:"_calculateForces",value:function(e,t,i,o,n){0===e&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&o.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*o.shape.radius,e-o.shape.radius));var s=this.options.gravitationalConstant*n.mass*o.options.mass/Math.pow(e,3),r=t*s,a=i*s;this.physicsBody.forces[o.id].x+=r,this.physicsBody.forces[o.id].y+=a}},{key:"_formBarnesHutTree",value:function(e,t){for(var i=void 0,o=t.length,n=e[t[0]].x,s=e[t[0]].y,r=e[t[0]].x,a=e[t[0]].y,d=1;d0&&(hr&&(r=h),la&&(a=l))}var u=Math.abs(r-n)-Math.abs(a-s);u>0?(s-=.5*u,a+=.5*u):(n+=.5*u,r-=.5*u);var c=1e-5,f=Math.max(c,Math.abs(r-n)),p=.5*f,v=.5*(n+r),g=.5*(s+a),y={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:v-p,maxX:v+p,minY:g-p,maxY:g+p},size:f,calcSize:1/f,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(y.root);for(var m=0;m0&&this._placeInTree(y.root,i);return y}},{key:"_updateBranchMass",value:function(e,t){var i=e.mass+t.options.mass,o=1/i;e.centerOfMass.x=e.centerOfMass.x*e.mass+t.x*t.options.mass,e.centerOfMass.x*=o,e.centerOfMass.y=e.centerOfMass.y*e.mass+t.y*t.options.mass,e.centerOfMass.y*=o,e.mass=i;var n=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?e.children.NW.range.maxY>t.y?this._placeInRegion(e,t,"NW"):this._placeInRegion(e,t,"SW"):e.children.NW.range.maxY>t.y?this._placeInRegion(e,t,"NE"):this._placeInRegion(e,t,"SE")}},{key:"_placeInRegion",value:function(e,t,i){switch(e.children[i].childrenCount){case 0:e.children[i].children.data=t,e.children[i].childrenCount=1,this._updateBranchMass(e.children[i],t);break;case 1:e.children[i].children.data.x===t.x&&e.children[i].children.data.y===t.y?(t.x+=this.seededRandom(),t.y+=this.seededRandom()):(this._splitBranch(e.children[i]),this._placeInTree(e.children[i],t));break;case 4:this._placeInTree(e.children[i],t)}}},{key:"_splitBranch",value:function(e){var t=null;1===e.childrenCount&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),null!=t&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var i=void 0,o=void 0,n=void 0,s=void 0,r=.5*e.size;switch(t){case"NW":i=e.range.minX,o=e.range.minX+r,n=e.range.minY,s=e.range.minY+r;break;case"NE":i=e.range.minX+r,o=e.range.maxX,n=e.range.minY,s=e.range.minY+r;break;case"SW":i=e.range.minX,o=e.range.minX+r,n=e.range.minY+r,s=e.range.maxY;break;case"SE":i=e.range.minX+r,o=e.range.maxX,n=e.range.minY+r,s=e.range.maxY}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:o,minY:n,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){void 0!==this.barnesHutTree&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,i){void 0===i&&(i="#FF0000"),4===e.childrenCount&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),e}();t.default=d},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=function(){function e(t,i,o){(0,s.default)(this,e),this.body=t,this.physicsBody=i,this.setOptions(o)}return(0,a.default)(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e,t,i,o,n,s,r,a,d=this.body.nodes,h=this.physicsBody.physicsNodeIndices,l=this.physicsBody.forces,u=this.options.nodeDistance,c=-2/3/u,f=4/3,p=0;p0){var s=n.edges.length+1,r=this.options.centralGravity*s*n.options.mass;o[n.id].x=t*r,o[n.id].y=i*r}}}]),t}(v.default);t.default=g},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(62),a=o(r),d=i(105),h=o(d),l=i(106),u=o(l),c=i(1),f=i(156).default,p=i(167).default,v=function(){function e(t){var i=this;(0,h.default)(this,e),this.body=t,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},c.extend(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){i.clusteredNodes={},i.clusteredEdges={}})}return(0,u.default)(e,[{key:"clusterByHubsize",value:function(e,t){void 0===e?e=this._getHubSize():"object"===("undefined"==typeof e?"undefined":(0,a.default)(e))&&(t=this._checkOptions(e),e=this._getHubSize());for(var i=[],o=0;o=e&&i.push(n.id)}for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===e.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");e=this._checkOptions(e);for(var i={},o={},n=0;n2&&void 0!==arguments[2])||arguments[2];t=this._checkOptions(t);for(var o=[],n={},r=void 0,a=void 0,d=void 0,h=void 0,l=void 0,u=0;u0&&(0,s.default)(p).length>0&&g===!0&&o.push({nodes:c,edges:p})}}}for(var _=0;_1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No nodeId supplied to clusterByConnection!");if(void 0===this.body.nodes[e])throw new Error("The nodeId given to clusterByConnection does not exist!");var o=this.body.nodes[e];t=this._checkOptions(t,o),void 0===t.clusterNodeProperties.x&&(t.clusterNodeProperties.x=o.x),void 0===t.clusterNodeProperties.y&&(t.clusterNodeProperties.y=o.y),void 0===t.clusterNodeProperties.fixed&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=o.options.fixed.x,t.clusterNodeProperties.fixed.y=o.options.fixed.y);var n={},r={},a=o.id,d=f.cloneOptions(o);n[a]=o;for(var h=0;h-1&&(r[y.id]=y)}this._cluster(n,r,t,i)}},{key:"_createClusterEdges",value:function(e,t,i,o){for(var n=void 0,r=void 0,a=void 0,d=void 0,h=void 0,l=void 0,u=(0,s.default)(e),p=[],v=0;v0&&void 0!==arguments[0]?arguments[0]:{};return void 0===e.clusterEdgeProperties&&(e.clusterEdgeProperties={}),void 0===e.clusterNodeProperties&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,i){var o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(0!=(0,s.default)(e).length&&(1!=(0,s.default)(e).length||1==i.clusterNodeProperties.allowSingleNodeCluster)){for(var n in e)if(e.hasOwnProperty(n)&&void 0!==this.clusteredNodes[n])return;var r=c.deepExtend({},i.clusterNodeProperties);if(void 0!==i.processProperties){var a=[];for(var d in e)if(e.hasOwnProperty(d)){var h=f.cloneOptions(e[d]);a.push(h)}var l=[];for(var u in t)if(t.hasOwnProperty(u)&&"clusterEdge:"!==u.substr(0,12)){var v=f.cloneOptions(t[u],"edge");l.push(v)}if(r=i.processProperties(r,a,l),!r)throw new Error("The processProperties function does not return properties!")}void 0===r.id&&(r.id="cluster:"+c.randomUUID());var g=r.id;void 0===r.label&&(r.label="cluster");var y=void 0;void 0===r.x&&(y=this._getClusterPosition(e),r.x=y.x),void 0===r.y&&(void 0===y&&(y=this._getClusterPosition(e)),r.y=y.y),r.id=g;var m=this.body.functions.createNode(r,p);m.isCluster=!0,m.containedNodes=e,m.containedEdges=t,m.clusterEdgeProperties=i.clusterEdgeProperties,this.body.nodes[r.id]=m,this._createClusterEdges(e,t,r,i.clusterEdgeProperties);for(var b in t)if(t.hasOwnProperty(b)&&void 0!==this.body.edges[b]){var _=this.body.edges[b];this._backupEdgeOptions(_),_.setOptions({physics:!1,hidden:!0})}for(var w in e)e.hasOwnProperty(w)&&(this.clusteredNodes[w]={clusterId:r.id,node:this.body.nodes[w]},this.body.nodes[w].setOptions({hidden:!0,physics:!1}));r.id=void 0,o===!0&&this.body.emitter.emit("_dataChanged")}}},{key:"_backupEdgeOptions",value:function(e){void 0===this.clusteredEdges[e.id]&&(this.clusteredEdges[e.id]={physics:e.options.physics,hidden:e.options.hidden})}},{key:"_restoreEdge",value:function(e){var t=this.clusteredEdges[e.id];void 0!==t&&(e.setOptions({physics:t.physics,hidden:t.hidden}),delete this.clusteredEdges[e.id])}},{key:"isCluster",value:function(e){return void 0!==this.body.nodes[e]?this.body.nodes[e].isCluster===!0:(console.log("Node does not exist."),!1)}},{key:"_getClusterPosition",value:function(e){for(var t=(0,s.default)(e),i=e[t[0]].x,o=e[t[0]].x,n=e[t[0]].y,r=e[t[0]].y,a=void 0,d=1;do?a.x:o,n=a.yr?a.y:r;return{x:.5*(i+o),y:.5*(n+r)}}},{key:"openCluster",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No clusterNodeId supplied to openCluster.");if(void 0===this.body.nodes[e])throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(void 0===this.body.nodes[e].containedNodes)return void console.log("The node:"+e+" is not a cluster.");var o=this.body.nodes[e],n=o.containedNodes,s=o.containedEdges;if(void 0!==t&&void 0!==t.releaseFunction&&"function"==typeof t.releaseFunction){var r={},a={x:o.x,y:o.y};for(var d in n)if(n.hasOwnProperty(d)){var h=this.body.nodes[d];r[d]={x:h.x,y:h.y}}var l=t.releaseFunction(a,r);for(var u in n)if(n.hasOwnProperty(u)){var p=this.body.nodes[u];void 0!==l[u]&&(p.x=void 0===l[u].x?o.x:l[u].x,p.y=void 0===l[u].y?o.y:l[u].y)}}else for(var v in n)if(n.hasOwnProperty(v)){var g=this.body.nodes[v];g=n[v],g.options.fixed.x===!1&&(g.x=o.x),g.options.fixed.y===!1&&(g.y=o.y)}for(var y in n)if(n.hasOwnProperty(y)){var m=this.body.nodes[y];m.vx=o.vx,m.vy=o.vy,m.setOptions({hidden:!1,physics:!0}),delete this.clusteredNodes[y]}for(var b=[],_=0;_o&&(o=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),i+=1}e/=i,t/=i;var r=t-Math.pow(e,2),a=Math.sqrt(r),d=Math.floor(e+2*a);return d>o&&(d=o),d}}]),e}();t.default=v},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(120),s=o(n),r=i(105),a=o(r),d=i(123),h=o(d),l=i(124),u=o(l),c=i(113),f=o(c),p=function(e){function t(e,i,o,n,r){(0,a.default)(this,t);var d=(0,h.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,o,n,r));return d.isCluster=!0,d.containedNodes={},d.containedEdges={},d}return(0,u.default)(t,e),t}(f.default);t.default=p},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r);"undefined"!=typeof window&&(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame);var d=i(1),h=function(){function e(t,i){(0,s.default)(this,e),this.body=t,this.canvas=i,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideNodesOnDrag:!1},d.extend(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return(0,a.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){e.renderingActive===!1&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",this._requestRedraw.bind(this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,e.requiresTimeout===!0?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(void 0!==e){var t=["hideEdgesOnDrag","hideNodesOnDrag"];d.selectiveDeepExtend(t,this.options,e)}}},{key:"_startRendering",value:function(){this.renderingActive===!0&&void 0===this.renderTimer&&(this.requiresTimeout===!0?this.renderTimer=window.setTimeout(this._renderStep.bind(this),this.simulationInterval):this.renderTimer=window.requestAnimationFrame(this._renderStep.bind(this)))}},{key:"_renderStep",value:function(){this.renderingActive===!0&&(this.renderTimer=void 0,this.requiresTimeout===!0&&this._startRendering(),this._redraw(),this.requiresTimeout===!1&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,this.requiresTimeout===!0?window.setTimeout(function(){e._redraw(!1)},0):window.requestAnimationFrame(function(){e._redraw(!1)}))}},{key:"_redraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.allowRedraw===!0){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1,0!==this.canvas.frame.canvas.width&&0!==this.canvas.frame.canvas.height||this.canvas.setSize(),this.canvas.setTransform();var t=this.canvas.getContext(),i=this.canvas.frame.canvas.clientWidth,o=this.canvas.frame.canvas.clientHeight;if(t.clearRect(0,0,i,o),0===this.canvas.frame.clientWidth)return;t.save(),t.translate(this.body.view.translation.x,this.body.view.translation.y),t.scale(this.body.view.scale,this.body.view.scale),t.beginPath(),this.body.emitter.emit("beforeDrawing",t),t.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&this._drawEdges(t),(this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1)&&this._drawNodes(t,e),t.beginPath(),this.body.emitter.emit("afterDrawing",t),t.closePath(),t.restore(),e===!0&&t.clearRect(0,0,i,o)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,i=void 0;for(var o in t)t.hasOwnProperty(o)&&(i=t[o],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.nodes,o=this.body.nodeIndices,n=void 0,s=[],r=20,a=this.canvas.DOMtoCanvas({x:-r,y:-r}),d=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+r,y:this.canvas.frame.canvas.clientHeight+r}),h={top:a.y,left:a.x,bottom:d.y,right:d.x},l=0;l0&&void 0!==arguments[0]?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(void 0!==this.cameraState.scale&&0!==this.frame.canvas.clientWidth&&0!==this.frame.canvas.clientHeight&&0!==this.pixelRatio&&this.cameraState.previousWidth>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,i=this.cameraState.scale;1!=e&&1!=t?i=.5*this.cameraState.scale*(e+t):1!=e?i=this.cameraState.scale*e:1!=t&&(i=this.cameraState.scale*t),this.body.view.scale=i;var o=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),n={x:o.x-this.cameraState.position.x,y:o.y-this.cameraState.position.y};this.body.view.translation.x+=n.x*this.body.view.scale,this.body.view.translation.y+=n.y*this.body.view.scale; -}}},{key:"_prepareValue",value:function(e){if("number"==typeof e)return e+"px";if("string"==typeof e){if(e.indexOf("%")!==-1||e.indexOf("px")!==-1)return e;if(e.indexOf("%")===-1)return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=900,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new d(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:d.DIRECTION_ALL}),h.onTouch(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("mousewheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("DOMMouseScroll",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new d(this.frame),h.onRelease(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var i=!1,o=this.frame.canvas.width,n=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{var r=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),a=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);this.frame.canvas.width===r&&this.frame.canvas.height===a||this._getCameraState(s),this.frame.canvas.width!==r&&(this.frame.canvas.width=r,i=!0),this.frame.canvas.height!==a&&(this.frame.canvas.height=a,i=!0)}return i===!0&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(o/this.pixelRatio),oldHeight:Math.round(n/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(void 0===e)throw"Could not get canvax context";return(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(void 0===e)throw"Could not get canvax context";e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),e}();t.default=u},function(e,t,i){i(100);t.onTouch=function(e,t){t.inputHandler=function(e){e.isFirst&&t(e)},e.on("hammer.input",t.inputHandler)},t.onRelease=function(e,t){return t.inputHandler=function(e){e.isFinal&&t(e)},e.on("hammer.input",t.inputHandler)},t.offTouch=function(e,t){e.off("hammer.input",t.inputHandler)},t.offRelease=t.offTouch,t.disablePreventDefaultVertically=function(e){var t="pan-y";return e.getTouchAction=function(){return[t]},e}},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=i(1),h=i(156).default,l=function(){function e(t,i){var o=this;(0,s.default)(this,e),this.body=t,this.canvas=i,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",this.fit.bind(this)),this.body.emitter.on("animationFinished",function(){o.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",this.releaseNode.bind(this))}return(0,a.default)(e,[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}},{key:"fit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{nodes:[]},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,o=void 0;if(void 0!==e.nodes&&0!==e.nodes.length||(e.nodes=this.body.nodeIndices),t===!0){var n=0;for(var s in this.body.nodes)if(this.body.nodes.hasOwnProperty(s)){var r=this.body.nodes[s];r.predefinedPosition===!0&&(n+=1)}if(n>.5*this.body.nodeIndices.length)return void this.fit(e,!1);i=h.getRange(this.body.nodes,e.nodes);var a=this.body.nodeIndices.length;o=12.662/(a+7.4147)+.0964822;var d=Math.min(this.canvas.frame.canvas.clientWidth/600,this.canvas.frame.canvas.clientHeight/600);o*=d}else{this.body.emitter.emit("_resizeNodes"),i=h.getRange(this.body.nodes,e.nodes);var l=1.1*Math.abs(i.maxX-i.minX),u=1.1*Math.abs(i.maxY-i.minY),c=this.canvas.frame.canvas.clientWidth/l,f=this.canvas.frame.canvas.clientHeight/u;o=c<=f?c:f}o>1?o=1:0===o&&(o=1);var p=h.findCenter(i),v={position:p,scale:o,animation:e.animation};this.moveTo(v)}},{key:"focus",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[e]){var i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.log("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){return void 0===e?void(e={}):(void 0===e.offset&&(e.offset={x:0,y:0}),void 0===e.offset.x&&(e.offset.x=0),void 0===e.offset.y&&(e.offset.y=0),void 0===e.scale&&(e.scale=this.body.view.scale),void 0===e.position&&(e.position=this.getViewPosition()),void 0===e.animation&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),void 0===e.animation.duration&&(e.animation.duration=1e3),void 0===e.animation.easingFunction&&(e.animation.easingFunction="easeInOutQuad"),void this.animateView(e))}},{key:"animateView",value:function(e){if(void 0!==e){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),0!=this.easingTime&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.position.x,y:t.y-e.position.y};this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+e.offset.y},0===e.animation.duration?void 0!=this.lockedOnNodeId?(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)):(this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw")):(this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=this._transitionRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.x,y:t.y-e.y},o=this.body.view.translation,n={x:o.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:o.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=n}},{key:"releaseNode",value:function(){void 0!==this.lockedOnNodeId&&void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;var t=d.easingFunctions[this.animationEasingFunction](this.easingTime);this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1&&(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,void 0!=this.lockedOnNodeId&&(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)),this.body.emitter.emit("animationFinished"))}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),e}();t.default=l},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=i(1),h=i(173).default,l=i(174).default,u=function(){function e(t,i,o){(0,s.default)(this,e),this.body=t,this.canvas=i,this.selectionHandler=o,this.navigationHandler=new h(t,i),this.body.eventListeners.onTap=this.onTap.bind(this),this.body.eventListeners.onTouch=this.onTouch.bind(this),this.body.eventListeners.onDoubleTap=this.onDoubleTap.bind(this),this.body.eventListeners.onHold=this.onHold.bind(this),this.body.eventListeners.onDragStart=this.onDragStart.bind(this),this.body.eventListeners.onDrag=this.onDrag.bind(this),this.body.eventListeners.onDragEnd=this.onDragEnd.bind(this),this.body.eventListeners.onMouseWheel=this.onMouseWheel.bind(this),this.body.eventListeners.onPinch=this.onPinch.bind(this),this.body.eventListeners.onMouseMove=this.onMouseMove.bind(this),this.body.eventListeners.onRelease=this.onRelease.bind(this),this.body.eventListeners.onContext=this.onContext.bind(this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=this.getPointer.bind(this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0},d.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("destroy",function(){clearTimeout(e.popupTimer),delete e.body.functions.getPointer})}},{key:"setOptions",value:function(e){if(void 0!==e){var t=["hideEdgesOnDrag","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"];d.selectiveNotDeepExtend(t,this.options,e),d.mergeOptions(this.options,e,"keyboard"),e.tooltip&&(d.extend(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=d.parseColor(e.tooltip.color)))}this.navigationHandler.setOptions(this.options)}},{key:"getPointer",value:function(e){return{x:e.x-d.getAbsoluteLeft(this.canvas.frame.canvas),y:e.y-d.getAbsoluteTop(this.canvas.frame.canvas)}}},{key:"onTouch",value:function(e){(new Date).valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=(new Date).valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,e,i),this.selectionHandler._generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler._generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,e,i),this.selectionHandler._generateClickEvent("click",e,t),this.selectionHandler._generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if((new Date).valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler._generateClickEvent("release",e,t),this.touchTime=(new Date).valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler._generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.selectionHandler.getSelection(),n=!1;n=i===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e);var s=this.selectionHandler.getSelection(),r=this._determineDifference(o,s),a=this._determineDifference(s,o);r.edges.length>0&&(this.selectionHandler._generateClickEvent("deselectEdge",t,e,o),n=!0),r.nodes.length>0&&(this.selectionHandler._generateClickEvent("deselectNode",t,e,o),n=!0),a.nodes.length>0&&(this.selectionHandler._generateClickEvent("selectNode",t,e),n=!0),a.edges.length>0&&(this.selectionHandler._generateClickEvent("selectEdge",t,e),n=!0),n===!0&&this.selectionHandler._generateClickEvent("select",t,e)}},{key:"_determineDifference",value:function(e,t){var i=function(e,t){for(var i=[],o=0;o10&&(e=10);var o=void 0;void 0!==this.drag&&this.drag.dragging===!0&&(o=this.canvas.DOMtoCanvas(this.drag.pointer));var n=this.body.view.translation,s=e/i,r=(1-s)*t.x+n.x*s,a=(1-s)*t.y+n.y*s;if(this.body.view.scale=e,this.body.view.translation={x:r,y:a},void 0!=o){var d=this.canvas.canvasToDOM(o);this.drag.pointer.x=d.x,this.drag.pointer.y=d.y}this.body.emitter.emit("_requestRedraw"),i0&&(this.popupObj=d[u[u.length-1]],s=!0)}if(void 0===this.popupObj&&s===!1){for(var f=this.body.edgeIndices,p=this.body.edges,v=void 0,g=[],y=0;y0&&(this.popupObj=p[g[g.length-1]],r="edge")}void 0!==this.popupObj?this.popupObj.id!==n&&(void 0===this.popup&&(this.popup=new l(this.canvas.frame)),this.popup.popupTargetType=r,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):void 0!==this.popup&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),i=!1;if("node"===this.popup.popupTargetType){if(void 0!==this.body.nodes[this.popup.popupTargetId]&&(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),i===!0)){var o=this.selectionHandler.getNodeAt(e);i=void 0!==o&&o.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(e)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));i===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),e}();t.default=u},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=(i(1),i(100)),h=i(170),l=i(99),u=function(){function e(t,i){var o=this;(0,s.default)(this,e),this.body=t,this.canvas=i,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on("activate",function(){o.activated=!0,o.configureKeyboardBindings()}),this.body.emitter.on("deactivate",function(){o.activated=!1,o.configureKeyboardBindings()}),this.body.emitter.on("destroy",function(){void 0!==o.keycharm&&o.keycharm.destroy()}),this.options={}}return(0,a.default)(e,[{key:"setOptions",value:function(e){void 0!==e&&(this.options=e,this.create())}},{key:"create",value:function(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}},{key:"cleanNavigation",value:function(){if(0!=this.navigationHammers.length){for(var e=0;e700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=(new Date).valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)this.boundFunctions.hasOwnProperty(e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,n=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,s=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,o=t/e,n=(1-o)*this.canvas.canvasViewCenter.x+i.x*o,s=(1-o)*this.canvas.canvasViewCenter.y+i.y*o;this.body.view.scale=t,this.body.view.translation={x:n,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;void 0!==this.keycharm&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=l({container:window,preventDefault:!0}):this.keycharm=l({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0&&(this.keycharm.bind("up",function(){e.bindToRedraw("_moveUp")},"keydown"),this.keycharm.bind("down",function(){e.bindToRedraw("_moveDown")},"keydown"),this.keycharm.bind("left",function(){e.bindToRedraw("_moveLeft")},"keydown"),this.keycharm.bind("right",function(){e.bindToRedraw("_moveRight")},"keydown"),this.keycharm.bind("=",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("-",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("[",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("]",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),this.keycharm.bind("down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),this.keycharm.bind("left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),this.keycharm.bind("right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),this.keycharm.bind("=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")))}}]),e}();t.default=u},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(105),s=o(n),r=i(106),a=o(r),d=function(){function e(t,i){(0,s.default)(this,e),this.container=t,this.overflowMethod=i||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return(0,a.default)(e,[{key:"setPosition",value:function(e,t){this.x=parseInt(e),this.y=parseInt(t)}},{key:"setText",value:function(e){e instanceof Element?(this.frame.innerHTML="",this.frame.appendChild(e)):this.frame.innerHTML=e}},{key:"show",value:function(e){if(void 0===e&&(e=!0),e===!0){var t=this.frame.clientHeight,i=this.frame.clientWidth,o=this.frame.parentNode.clientHeight,n=this.frame.parentNode.clientWidth,s=0,r=0;if("flip"==this.overflowMethod){var a=!1,d=!0;this.y-tn-this.padding&&(a=!0),s=a?this.x-i:this.x,r=d?this.y-t:this.y}else r=this.y-t,r+t+this.padding>o&&(r=o-t-this.padding),rn&&(s=n-i-this.padding),s4&&void 0!==arguments[4]&&arguments[4],s=void 0;s=n===!0?{nodes:[],edges:[]}:this.getSelection(),s.pointer={DOM:{x:i.x,y:i.y},canvas:this.canvas.DOMtoCanvas(i)},s.event=t,void 0!==o&&(s.previousSelection=o),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;return void 0!==e&&(e instanceof d&&t===!0&&this._selectConnectedEdges(e),e.select(),this._addToSelection(e),!0)}},{key:"deselectObject",value:function(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],i=this.body.nodes,o=0;o1&&void 0!==arguments[1])||arguments[1],i=this._pointerToPositionObject(e),o=this._getAllNodesOverlappingWith(i);return o.length>0?t===!0?this.body.nodes[o[o.length-1]]:o[o.length-1]:void 0}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var i=this.body.edges,o=0;o1&&void 0!==arguments[1])||arguments[1],i=this.canvas.DOMtoCanvas(e),o=10,n=null,s=this.body.edges,r=0;r1)return!0;return!1}},{key:"_selectConnectedEdges",value:function(e){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,o=void 0;if(!e||!e.nodes&&!e.edges)throw"Selection must be an object with nodes and/or edges properties";if((t.unselectAll||void 0===t.unselectAll)&&this.unselectAll(),e.nodes)for(i=0;i1&&void 0!==arguments[1])||arguments[1];if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(this.body.nodes.hasOwnProperty(e)||delete this.selectionObj.nodes[e]);for(var t in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(t)&&(this.body.edges.hasOwnProperty(t)||delete this.selectionObj.edges[t])}}]),e}();t.default=u},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(58),s=o(n),r=i(89),a=o(r),d=i(62),h=o(d),l=i(105),u=o(l),c=i(106),f=o(c),p=i(1),v=i(100),g=i(170),y=function(){function e(t,i,o){var n=this;(0,u.default)(this,e),this.body=t,this.canvas=i,this.selectionHandler=o,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this.manipulationHammers=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},p.extend(this.options,this.defaultOptions),this.body.emitter.on("destroy",function(){n._clean()}),this.body.emitter.on("_dataChanged",this._restore.bind(this)),this.body.emitter.on("_resetData",this._restore.bind(this))}return(0,f.default)(e,[{key:"_restore",value:function(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}},{key:"setOptions",value:function(e,t,i){void 0!==t&&(void 0!==t.locale?this.options.locale=t.locale:this.options.locale=i.locale,void 0!==t.locales?this.options.locales=t.locales:this.options.locales=i.locales),void 0!==e&&("boolean"==typeof e?this.options.enabled=e:(this.options.enabled=!0,p.deepExtend(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}},{key:"toggleEditMode",value:function(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}},{key:"enableEditMode",value:function(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}},{key:"disableEditMode",value:function(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}},{key:"showManipulatorToolbar",value:function(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";var e=this.selectionHandler._getSelectedNodeCount(),t=this.selectionHandler._getSelectedEdgeCount(),i=e+t,o=this.options.locales[this.options.locale],n=!1;this.options.addNode!==!1&&(this._createAddNodeButton(o),n=!0),this.options.addEdge!==!1&&(n===!0?this._createSeperator(1):n=!0,this._createAddEdgeButton(o)),1===e&&"function"==typeof this.options.editNode?(n===!0?this._createSeperator(2):n=!0,this._createEditNodeButton(o)):1===t&&0===e&&this.options.editEdge!==!1&&(n===!0?this._createSeperator(3):n=!0,this._createEditEdgeButton(o)),0!==i&&(e>0&&this.options.deleteNode!==!1?(n===!0&&this._createSeperator(4),this._createDeleteButton(o)):0===e&&this.options.deleteEdge!==!1&&(n===!0&&this._createSeperator(4),this._createDeleteButton(o))),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this)),this._temporaryBindEvent("select",this.showManipulatorToolbar.bind(this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.addDescription||this.options.locales.en.addDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindEvent("click",this._performAddNode.bind(this))}},{key:"editNode",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean();var t=this.selectionHandler._getSelectedNode();if(void 0!==t){if(this.inMode="editNode","function"!=typeof this.options.editNode)throw new Error("No function has been configured to handle the editing of nodes.");if(t.isCluster!==!0){var i=p.deepExtend({},t.options,!1);if(i.x=t.x,i.y=t.y,2!==this.options.editNode.length)throw new Error("The function for edit does not support two arguments (data, callback)");this.options.editNode(i,function(t){null!==t&&void 0!==t&&"editNode"===e.inMode&&e.body.data.nodes.getDataSet().update(t),e.showManipulatorToolbar()})}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.edgeDescription||this.options.locales.en.edgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindUI("onTouch",this._handleConnect.bind(this)),this._temporaryBindUI("onDragEnd",this._finishConnect.bind(this)),this._temporaryBindUI("onDrag",this._dragControlNode.bind(this)),this._temporaryBindUI("onRelease",this._finishConnect.bind(this)),this._temporaryBindUI("onDragStart",function(){}),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"===(0,h.default)(this.options.editEdge)&&"function"==typeof this.options.editEdge.editWithoutDrag&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId)){var e=this.body.edges[this.edgeBeingEditedId];return void this._performEditEdge(e.from,e.to)}if(this.guiEnabled===!0){var t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId){var i=this.body.edges[this.edgeBeingEditedId],o=this._getNewTargetNode(i.from.x,i.from.y),n=this._getNewTargetNode(i.to.x,i.to.y);this.temporaryIds.nodes.push(o.id),this.temporaryIds.nodes.push(n.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this.body.nodes[n.id]=n,this.body.nodeIndices.push(n.id),this._temporaryBindUI("onTouch",this._controlNodeTouch.bind(this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",this._controlNodeDragStart.bind(this)),this._temporaryBindUI("onDrag",this._controlNodeDrag.bind(this)),this._temporaryBindUI("onDragEnd",this._controlNodeDragEnd.bind(this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(e){var t=i.edgeType.findBorderPositions(e);o.selected===!1&&(o.x=t.from.x,o.y=t.from.y),n.selected===!1&&(n.x=t.to.x,n.y=t.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodes(),i=this.selectionHandler.getSelectedEdges(),o=void 0;if(t.length>0){for(var n=0;n0&&"function"==typeof this.options.deleteEdge&&(o=this.options.deleteEdge);if("function"==typeof o){var s={nodes:t,edges:i};if(2!==o.length)throw new Error("The function for delete does not support two arguments (data, callback)");o(s,function(t){null!==t&&void 0!==t&&"delete"===e.inMode?(e.body.data.edges.getDataSet().remove(t.edges),e.body.data.nodes.getDataSet().remove(t.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().remove(i),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){void 0===this.manipulationDiv&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),void 0===this.editModeDiv&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),void 0===this.closeDiv&&(this.closeDiv=document.createElement("div"),this.closeDiv.className="vis-close",this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}},{key:"_getNewTargetNode",value:function(e,t){var i=p.deepExtend({},this.options.controlNodeStyle);i.id="targetNode"+p.randomUUID(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;var o=this.body.functions.createNode(i);return o.shape.boundingBox={left:e,right:e,top:t,bottom:t},o}},{key:"_createEditButton",value:function(){this._clean(),this.manipulationDOM={},p.recursiveDOMDelete(this.editModeDiv);var e=this.options.locales[this.options.locale],t=this._createButton("editMode","vis-button vis-edit vis-edit-mode",e.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(t),this._bindHammerToDiv(t,this.toggleEditMode.bind(this))}},{key:"_clean",value:function(){this.inMode=!1,this.guiEnabled===!0&&(p.recursiveDOMDelete(this.editModeDiv),p.recursiveDOMDelete(this.manipulationDiv),this._cleanManipulatorHammers()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanManipulatorHammers",value:function(){if(0!=this.manipulationHammers.length){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t=this._createButton("addNode","vis-button vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.addNodeMode.bind(this))}},{key:"_createAddEdgeButton",value:function(e){var t=this._createButton("addEdge","vis-button vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.addEdgeMode.bind(this))}},{key:"_createEditNodeButton",value:function(e){var t=this._createButton("editNode","vis-button vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.editNode.bind(this))}},{key:"_createEditEdgeButton",value:function(e){var t=this._createButton("editEdge","vis-button vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.editEdgeMode.bind(this))}},{key:"_createDeleteButton",value:function(e){if(this.options.rtl)var t="vis-button vis-delete-rtl";else var t="vis-button vis-delete";var i=this._createButton("delete",t,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(i),this._bindHammerToDiv(i,this.deleteSelected.bind(this))}},{key:"_createBackButton",value:function(e){var t=this._createButton("back","vis-button vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.showManipulatorToolbar.bind(this))}},{key:"_createButton",value:function(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("div"),this.manipulationDOM[e+"Div"].className=t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=o,this.manipulationDOM[e+"Label"].innerHTML=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDiv.appendChild(this._createButton("description","vis-button vis-none",e))}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(void 0===this.body.eventListeners[e])throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+(0,a.default)((0,s.default)(this.body.eventListeners)));this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)this.temporaryUIFunctions.hasOwnProperty(e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;r--)if(n[r]!==this.selectedControlNode.id){s=this.body.nodes[n[r]];break}if(void 0!==s&&void 0!==this.selectedControlNode)if(s.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===a.id?this._performEditEdge(s.id,o.to.id):this._performEditEdge(o.from.id,s.id)}else o.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=p.extend({},this.body.view.translation);var t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(void 0!==i)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var o=this._getNewTargetNode(i.x,i.y);this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id);var n=this.body.functions.createEdge({id:"connectionEdge"+p.randomUUID(),from:i.id,to:o.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[n.id]=n,this.body.edgeIndices.push(n.id),this.temporaryIds.nodes.push(o.id),this.temporaryIds.edges.push(n.id)}this.touchTime=(new Date).valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center);if(void 0!==this.temporaryIds.nodes[0]){var i=this.body.nodes[this.temporaryIds.nodes[0]];i.x=this.canvas._XconvertDOMtoCanvas(t.x),i.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else{var o=t.x-this.lastTouch.x,n=t.y-this.lastTouch.y;this.body.view.translation={x:this.lastTouch.translation.x+o,y:this.lastTouch.translation.y+n}}}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t),o=void 0;void 0!==this.temporaryIds.edges[0]&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var n=this.selectionHandler._getAllNodesOverlappingWith(i),s=void 0,r=n.length-1;r>=0;r--)if(this.temporaryIds.nodes.indexOf(n[r])===-1){s=this.body.nodes[n[r]];break}this._cleanupTemporaryNodesAndEdges(),void 0!==s&&(s.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):void 0!==this.body.nodes[o]&&void 0!==this.body.nodes[s.id]&&this._performAddEdge(o,s.id)),this.body.emitter.emit("_redraw")}},{key:"_performAddNode",value:function(e){var t=this,i={id:p.randomUUID(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if("function"==typeof this.options.addNode){if(2!==this.options.addNode.length)throw new Error("The function for add does not support two arguments (data,callback)");this.options.addNode(i,function(e){null!==e&&void 0!==e&&"addNode"===t.inMode&&(t.body.data.nodes.getDataSet().add(e),t.showManipulatorToolbar())})}else this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var i=this,o={from:e,to:t};if("function"==typeof this.options.addEdge){if(2!==this.options.addEdge.length)throw new Error("The function for connect does not support two arguments (data,callback)");this.options.addEdge(o,function(e){null!==e&&void 0!==e&&"addEdge"===i.inMode&&(i.body.data.edges.getDataSet().add(e),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().add(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var i=this,o={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges._data[this.edgeBeingEditedId].label},n=this.options.editEdge;if("object"===("undefined"==typeof n?"undefined":(0,h.default)(n))&&(n=n.editWithoutDrag),"function"==typeof n){if(2!==n.length)throw new Error("The function for edit does not support two arguments (data, callback)");n(o,function(e){null===e||void 0===e||"editEdge"!==i.inMode?(i.body.edges[o.id].updateEdgeType(),i.body.emitter.emit("_redraw"),i.showManipulatorToolbar()):(i.body.data.edges.getDataSet().update(e),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().update(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),e}();t.default=y},function(e,t,i){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=i(89),s=o(n),r=i(62),a=o(r),d=i(105),h=o(d),l=i(106),u=o(l),c=i(1),f=i(178).default,p=function(){function e(t,i,o){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,h.default)(this,e),this.parent=t,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},c.extend(this.options,this.defaultOptions),this.configureOptions=o,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new f(n),this.wrapper=void 0}return(0,u.default)(e,[{key:"setOptions",value:function(e){if(void 0!==e){this.popupHistory={},this._removePopup();var t=!0;"string"==typeof e?this.options.filter=e:e instanceof Array?this.options.filter=e.join():"object"===("undefined"==typeof e?"undefined":(0,a.default)(e))?(void 0!==e.container&&(this.options.container=e.container),void 0!==e.filter&&(this.options.filter=e.filter),void 0!==e.showButton&&(this.options.showButton=e.showButton),void 0!==e.enabled&&(t=e.enabled)):"boolean"==typeof e?(this.options.filter=!0,t=e):"function"==typeof e&&(this.options.filter=e,t=!0),this.options.filter===!1&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,this.options.enabled===!0&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){var e=this;this._clean(),this.changedOptions=[];var t=this.options.filter,i=0,o=!1;for(var n in this.configureOptions)this.configureOptions.hasOwnProperty(n)&&(this.allowCreation=!1,o=!1,"function"==typeof t?(o=t(n,[]),o=o||this._handleObject(this.configureOptions[n],[n],!0)):t!==!0&&t.indexOf(n)===-1||(o=!0),o!==!1&&(this.allowCreation=!0,i>0&&this._makeItem([]),this._makeHeader(n),this._handleObject(this.configureOptions[n],[n])),i++);if(this.options.showButton===!0){var s=document.createElement("div");s.className="vis-configuration vis-config-button",s.innerHTML="generate options",s.onclick=function(){e._printOptions()},s.onmouseover=function(){s.className="vis-configuration vis-config-button hover"},s.onmouseout=function(){s.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(s)}this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?i-1:0),n=1;n2&&void 0!==arguments[2]&&arguments[2],o=document.createElement("div");return o.className="vis-configuration vis-config-label vis-config-s"+t.length,i===!0?o.innerHTML=""+e+":":o.innerHTML=e+":",o}},{key:"_makeDropdown",value:function(e,t,i){var o=document.createElement("select");o.className="vis-configuration vis-config-select";var n=0;void 0!==t&&e.indexOf(t)!==-1&&(n=e.indexOf(t));for(var s=0;ss&&1!==s&&(a.max=Math.ceil(t*l),h=a.max,d="range increased"),a.value=t}else a.value=o;var u=document.createElement("input");u.className="vis-configuration vis-config-rangeinput",u.value=a.value;var c=this;a.onchange=function(){u.value=this.value,c._update(Number(this.value),i)},a.oninput=function(){u.value=this.value};var f=this._makeLabel(i[i.length-1],i),p=this._makeItem(i,f,a,u);""!==d&&this.popupHistory[p]!==h&&(this.popupHistory[p]=h,this._setupPopup(d,p))}},{key:"_setupPopup",value:function(e,t){var i=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1,n=this.options.filter,s=!1;for(var r in e)if(e.hasOwnProperty(r)){o=!0;var a=e[r],d=c.copyAndExtendArray(t,r);if("function"==typeof n&&(o=n(r,t),o===!1&&!(a instanceof Array)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,o=this._handleObject(a,d,!0),this.allowCreation=i===!1)),o!==!1){s=!0;var h=this._getValue(d);if(a instanceof Array)this._handleArray(a,h,d);else if("string"==typeof a)this._makeTextInput(a,h,d);else if("boolean"==typeof a)this._makeCheckbox(a,h,d);else if(a instanceof Object){var l=!0;if(t.indexOf("physics")!==-1&&this.moduleOptions.physics.solver!==r&&(l=!1),l===!0)if(void 0!==a.enabled){var u=c.copyAndExtendArray(d,"enabled"),f=this._getValue(u);if(f===!0){var p=this._makeLabel(r,d,!0);this._makeItem(d,p),s=this._handleObject(a,d)||s}else this._makeCheckbox(a,f,d)}else{var v=this._makeLabel(r,d,!0);this._makeItem(d,v),s=this._handleObject(a,d)||s}}else console.error("dont know how to handle",a,r,d)}}return s}},{key:"_handleArray",value:function(e,t,i){"string"==typeof e[0]&&"color"===e[0]?(this._makeColorField(e,t,i),e[1]!==t&&this.changedOptions.push({path:i,value:t})):"string"==typeof e[0]?(this._makeDropdown(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:t})):"number"==typeof e[0]&&(this._makeRange(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:Number(t)}))}},{key:"_update",value:function(e,t){var i=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i;e="true"===e||e,e="false"!==e&&e;for(var n=0;nvar options = "+(0,s.default)(e,null,2)+""}},{key:"getOptions",value:function(){for(var e={},t=0;t0&&void 0!==arguments[0]?arguments[0]:1;(0,a.default)(this,e),this.pixelRatio=t,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return(0,h.default)(e,[{key:"insertTo",value:function(e){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=e}},{key:"setCloseCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=e}},{key:"_isColorString",value:function(e){var t={black:"#000000",navy:"#000080",darkblue:"#00008B",mediumblue:"#0000CD",blue:"#0000FF",darkgreen:"#006400",green:"#008000",teal:"#008080",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",lime:"#00FF00",springgreen:"#00FF7F",aqua:"#00FFFF",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",mediumaquamarine:"#66CDAA",dimgray:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",lightslategray:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",maroon:"#800000",purple:"#800080",olive:"#808000",gray:"#808080",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370D8",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",silver:"#C0C0C0",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgrey:"#D3D3D3",palevioletred:"#D87093",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",red:"#FF0000",fuchsia:"#FF00FF",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",yellow:"#FFFF00",lightyellow:"#FFFFE0",ivory:"#FFFFF0",white:"#FFFFFF"};if("string"==typeof e)return t[e]}},{key:"setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==e){var i=void 0,o=this._isColorString(e);if(void 0!==o&&(e=o),c.isString(e)===!0){if(c.isValidRGB(e)===!0){var n=e.substr(4).substr(0,e.length-5).split(",");i={r:n[0],g:n[1],b:n[2],a:1}}else if(c.isValidRGBA(e)===!0){var r=e.substr(5).substr(0,e.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(c.isValidHex(e)===!0){var a=c.hexToRGB(e);i={r:a.r,g:a.g,b:a.b,a:1}}}else if(e instanceof Object&&void 0!==e.r&&void 0!==e.g&&void 0!==e.b){var d=void 0!==e.a?e.a:"1.0";i={r:e.r,g:e.g,b:e.b,a:d}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+(0,s.default)(e));this._setColor(i,t)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t===!0&&(this.previousColor=c.extend({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",setTimeout(function(){void 0!==e.closeCallback&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t===!0&&(this.initialColor=c.extend({},e)),this.color=e;var i=c.RGBToHSV(e.r,e.g,e.b),o=2*Math.PI,n=this.r*i.s,s=this.centerCoordinates.x+n*Math.sin(o*i.h),r=this.centerCoordinates.y+n*Math.cos(o*i.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=r-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=c.RGBToHSV(this.color.r,this.color.g,this.color.b);t.v=e/100;var i=c.HSVToRGB(t.h,t.s,t.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,t=c.RGBToHSV(e.r,e.g,e.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var o=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,n),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-t.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),i.fill(),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var e=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(t)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(e){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(e){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var i=this;this.opacityRange.onchange=function(){i._setOpacity(this.value)},this.opacityRange.oninput=function(){i._setOpacity(this.value)},this.brightnessRange.onchange=function(){i._setBrightness(this.value)},this.brightnessRange.oninput=function(){i._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=this._hide.bind(this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=this._apply.bind(this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=this._save.bind(this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=this._loadLast.bind(this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new l(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),u.onTouch(this.hammer,function(t){e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var e=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,i);var o=void 0,n=void 0,s=void 0,r=void 0;this.centerCoordinates={x:.5*t,y:.5*i},this.r=.49*t;var a=2*Math.PI/360,d=1/360,h=1/this.r,l=void 0;for(s=0;s<360;s++)for(r=0;r2&&void 0!==arguments[2]&&arguments[2],o=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(o),this._createK_matrix(o),this._createE_matrix();for(var n=.01,r=1,a=0,d=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),h=5,l=1e9,u=0,c=0,f=0,p=0,v=0;l>n&&ar&&v2&&void 0!==arguments[2]&&arguments[2];for(var s in e)void 0!==i[s]&&(null===i[s]||"object"!==(0,c.default)(i[s])?o(e,i,s,n):"object"===(0,c.default)(e[s])&&t.fillIfDefined(e[s],i[s],n))},t.extend=function(e,t){for(var i=1;i3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(n))throw new TypeError("Arrays are not supported by deepExtend");for(var r=0;r3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(n))throw new TypeError("Arrays are not supported by deepExtend");for(var r in n)if(n.hasOwnProperty(r)&&-1===e.indexOf(r))if(n[r]&&n[r].constructor===Object)void 0===i[r]&&(i[r]={}),i[r].constructor===Object?t.deepExtend(i[r],n[r]):o(i,n,r,s);else if(Array.isArray(n[r])){i[r]=[];for(var a=0;a2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var r in i)if(i.hasOwnProperty(r)||!0===n)if(i[r]&&i[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r].constructor===Object?t.deepExtend(e[r],i[r],n):o(e,i,r,s);else if(Array.isArray(i[r])){e[r]=[];for(var a=0;a=0&&(t="DOMMouseScroll"),e.addEventListener(t,i,n)):e.attachEvent("on"+t,i)},t.removeEventListener=function(e,t,i,n){e.removeEventListener?(void 0===n&&(n=!1),"mousewheel"===t&&navigator.userAgent.indexOf("Firefox")>=0&&(t="DOMMouseScroll"),e.removeEventListener(t,i,n)):e.detachEvent("on"+t,i)},t.preventDefault=function(e){e||(e=window.event),e.preventDefault?e.preventDefault():e.returnValue=!1},t.getTarget=function(e){e||(e=window.event);var t;return e.target?t=e.target:e.srcElement&&(t=e.srcElement),void 0!=t.nodeType&&3==t.nodeType&&(t=t.parentNode),t},t.hasParent=function(e,t){for(var i=e;i;){if(i===t)return!0;i=i.parentNode}return!1},t.option={},t.option.asBoolean=function(e,t){return"function"==typeof e&&(e=e()),null!=e?0!=e:t||null},t.option.asNumber=function(e,t){return"function"==typeof e&&(e=e()),null!=e?Number(e)||t||null:t||null},t.option.asString=function(e,t){return"function"==typeof e&&(e=e()),null!=e?String(e):t||null},t.option.asSize=function(e,i){return"function"==typeof e&&(e=e()),t.isString(e)?e:t.isNumber(e)?e+"px":i||null},t.option.asElement=function(e,t){return"function"==typeof e&&(e=e()),e||t||null},t.hexToRGB=function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(t,function(e,t,i,n){return t+t+i+i+n+n});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},t.overrideOpacity=function(e,i){var n;return-1!=e.indexOf("rgba")?e:-1!=e.indexOf("rgb")?(n=e.substr(e.indexOf("(")+1).replace(")","").split(","),"rgba("+n[0]+","+n[1]+","+n[2]+","+i+")"):(n=t.hexToRGB(e),null==n?e:"rgba("+n.r+","+n.g+","+n.b+","+i+")")},t.RGBToHex=function(e,t,i){return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1)},t.parseColor=function(e){var i;if(!0===t.isString(e)){if(!0===t.isValidRGB(e)){var n=e.substr(4).substr(0,e.length-5).split(",").map(function(e){return parseInt(e)});e=t.RGBToHex(n[0],n[1],n[2])}if(!0===t.isValidHex(e)){var o=t.hexToHSV(e),s={h:o.h,s:.8*o.s,v:Math.min(1,1.02*o.v)},r={h:o.h,s:Math.min(1,1.25*o.s),v:.8*o.v},a=t.HSVToHex(r.h,r.s,r.v),d=t.HSVToHex(s.h,s.s,s.v);i={background:e,border:a,highlight:{background:d,border:a},hover:{background:d,border:a}}}else i={background:e,border:e,highlight:{background:e,border:e},hover:{background:e,border:e}}}else i={},i.background=e.background||void 0,i.border=e.border||void 0,t.isString(e.highlight)?i.highlight={border:e.highlight,background:e.highlight}:(i.highlight={},i.highlight.background=e.highlight&&e.highlight.background||void 0,i.highlight.border=e.highlight&&e.highlight.border||void 0),t.isString(e.hover)?i.hover={border:e.hover,background:e.hover}:(i.hover={},i.hover.background=e.hover&&e.hover.background||void 0,i.hover.border=e.hover&&e.hover.border||void 0);return i},t.RGBToHSV=function(e,t,i){e/=255,t/=255,i/=255;var n=Math.min(e,Math.min(t,i)),o=Math.max(e,Math.max(t,i));if(n==o)return{h:0,s:0,v:n};var s=e==n?t-i:i==n?e-t:i-e;return{h:60*((e==n?3:i==n?1:5)-s/(o-n))/360,s:(o-n)/o,v:o}};var g={split:function(e){var t={};return e.split(";").forEach(function(e){if(""!=e.trim()){var i=e.split(":"),n=i[0].trim(),o=i[1].trim();t[n]=o}}),t},join:function(e){return(0,l.default)(e).map(function(t){return t+": "+e[t]}).join("; ")}};t.addCssText=function(e,i){var n=g.split(e.style.cssText),o=g.split(i),s=t.extend(n,o);e.style.cssText=g.join(s)},t.removeCssText=function(e,t){var i=g.split(e.style.cssText),n=g.split(t);for(var o in n)n.hasOwnProperty(o)&&delete i[o];e.style.cssText=g.join(i)},t.HSVToRGB=function(e,t,i){var n,o,s,r=Math.floor(6*e),a=6*e-r,d=i*(1-t),h=i*(1-a*t),l=i*(1-(1-a)*t);switch(r%6){case 0:n=i,o=l,s=d;break;case 1:n=h,o=i,s=d;break;case 2:n=d,o=i,s=l;break;case 3:n=d,o=h,s=i;break;case 4:n=l,o=d,s=i;break;case 5:n=i,o=d,s=h}return{r:Math.floor(255*n),g:Math.floor(255*o),b:Math.floor(255*s)}},t.HSVToHex=function(e,i,n){var o=t.HSVToRGB(e,i,n);return t.RGBToHex(o.r,o.g,o.b)},t.hexToHSV=function(e){var i=t.hexToRGB(e);return t.RGBToHSV(i.r,i.g,i.b)},t.isValidHex=function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},t.isValidRGB=function(e){return e=e.replace(" ",""),/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(e)},t.isValidRGBA=function(e){return e=e.replace(" ",""),/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(e)},t.selectiveBridgeObject=function(e,i){if(null!==i&&"object"===(void 0===i?"undefined":(0,c.default)(i))){for(var n=(0,d.default)(i),o=0;o0&&t(n,e[o-1])<0;o--)e[o]=e[o-1];e[o]=n}return e},t.mergeOptions=function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=function(e){return null!==e&&void 0!==e},s=function(e){return null!==e&&"object"===(void 0===e?"undefined":(0,c.default)(e))};if(!s(e))throw new Error("Parameter mergeTarget must be an object");if(!s(t))throw new Error("Parameter options must be an object");if(!o(i))throw new Error("Parameter option must have a value");if(!s(n))throw new Error("Parameter globalOptions must be an object");var r=t[i],a=s(n)&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(n),h=a?n[i]:void 0,l=h?h.enabled:void 0;if(void 0!==r){if("boolean"==typeof r)return s(e[i])||(e[i]={}),void(e[i].enabled=r);if(null===r&&!s(e[i])){if(!o(h))return;e[i]=(0,d.default)(h)}if(s(r)){var u=!0;void 0!==r.enabled?u=r.enabled:void 0!==l&&(u=h.enabled),function(e,t,i){s(e[i])||(e[i]={});var n=t[i],o=e[i];for(var r in n)n.hasOwnProperty(r)&&(o[r]=n[r])}(e,t,i),e[i].enabled=u}}},t.binarySearchCustom=function(e,t,i,n){for(var o=0,s=0,r=e.length-1;s<=r&&o<1e4;){var a=Math.floor((s+r)/2),d=e[a],h=void 0===n?d[i]:d[i][n],l=t(h);if(0==l)return a;-1==l?s=a+1:r=a-1,o++}return-1},t.binarySearchValue=function(e,t,i,n,o){var s,r,a,d,h=0,l=0,u=e.length-1;for(o=void 0!=o?o:function(e,t){return e==t?0:e0)return"before"==n?Math.max(0,d-1):d;if(o(r,t)<0&&o(a,t)>0)return"before"==n?d:Math.min(e.length-1,d+1);o(r,t)<0?l=d+1:u=d-1,h++}return-1},t.easingFunctions={linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:(4-2*e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}},t.getScrollBarWidth=function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var i=e.offsetWidth;t.style.overflow="scroll";var n=e.offsetWidth;return i==n&&(n=t.clientWidth),document.body.removeChild(t),i-n},t.topMost=function(e,t){var i=void 0;Array.isArray(t)||(t=[t]);var n=!0,o=!1,s=void 0;try{for(var a,d=(0,r.default)(e);!(n=(a=d.next()).done);n=!0){var h=a.value;if(h){i=h[t[0]];for(var l=1;l0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}},{key:"performFill",value:function(e,t){this.enableShadow(e,t),e.fill(),this.disableShadow(e,t),this.performStroke(e,t)}},{key:"_addBoundingBoxMargin",value:function(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}},{key:"_updateBoundingBox",value:function(e,t,i,n,o){void 0!==i&&this.resize(i,n,o),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}},{key:"updateBoundingBox",value:function(e,t,i,n,o){this._updateBoundingBox(e,t,i,n,o)}},{key:"getDimensionsFromLabel",value:function(e,t,i){this.textSize=this.labelModule.getTextSize(e,t,i);var n=this.textSize.width,o=this.textSize.height;return 0===n&&(n=14,o=14),{width:n,height:o}}}]),e}();t.default=l},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(15),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,i)){this.labelModule.getTextSize(e,t,i);var o=2*n.size;this.width=o,this.height=o,this.radius=.5*this.width}}},{key:"_drawShape",value:function(e,t,i,n,o,s,r,a){if(this.resize(e,s,r,a),this.left=n-this.width/2,this.top=o-this.height/2,this.initContextForDraw(e,a),e[t](n,o,a.size),this.performFill(e,a),void 0!==this.options.label){this.labelModule.calculateLabelSize(e,s,r,n,o,"hanging");var d=o+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,n,d,s,r,"hanging")}this.updateBoundingBox(n,o)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}}]),t}(v.default);t.default=g},function(e,t,i){var n=i(59),o=i(38);e.exports=function(e){return n(o(e))}},function(e,t,i){var n=i(12),o=i(27);e.exports=i(13)?function(e,t,i){return n.f(e,t,o(1,i))}:function(e,t,i){return e[t]=i,e}},function(e,t,i){var n=i(25);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,i){e.exports={default:i(120),__esModule:!0}},function(e,t,i){function n(){var e=function(){};return{on:e,off:e,destroy:e,emit:e,get:function(t){return{set:e}}}}if("undefined"!=typeof window){var o=i(124),s=window.Hammer||i(125);e.exports=o(s,{preventDefault:"mouse"})}else e.exports=function(){return n()}},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=i(133),s=n(o),r=i(58),a=n(r);t.default=function(){function e(e,t){var i=[],n=!0,o=!1,s=void 0;try{for(var r,d=(0,a.default)(e);!(n=(r=d.next()).done)&&(i.push(r.value),!t||i.length!==t);n=!0);}catch(e){o=!0,s=e}finally{try{!n&&d.return&&d.return()}finally{if(o)throw s}}return i}return function(t,i){if(Array.isArray(t))return t;if((0,s.default)(Object(t)))return e(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t){e.exports={}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,i){var n=i(65),o=i(45);e.exports=Object.keys||function(e){return n(e,o)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var i=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++i+n).toString(36))}},function(e,t,i){var n=i(38);e.exports=function(e){return Object(n(e))}},function(e,t,i){e.exports={default:i(98),__esModule:!0}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(e&&!Array.isArray(e)&&(t=e,e=null),this._options=t||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i=(0,l.default)(this._options.type),n=0,o=i.length;no?1:nr)&&(s=d,r=h)}return s},o.prototype.min=function(e){var t,i,n=this._data,o=(0,l.default)(n),s=null,r=null;for(t=0,i=o.length;te.left&&this.shape.tope.top}},{key:"isBoundingBoxOverlappingWith",value:function(e){return this.shape.boundingBox.lefte.left&&this.shape.boundingBox.tope.top}}],[{key:"updateGroupOptions",value:function(e,t,i){if(void 0!==i){var n=e.group;if(void 0!==t&&void 0!==t.group&&n!==t.group)throw new Error("updateGroupOptions: group values in options don't match.");if("number"==typeof n||"string"==typeof n&&""!=n){var o=i.get(n);d.selectiveNotDeepExtend(["font"],e,o),e.color=d.parseColor(e.color)}}}},{key:"parseOptions",value:function(t,i){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments[4],r=["color","fixed","shadow"];if(d.selectiveNotDeepExtend(r,t,i,n),e.checkMass(i),d.mergeOptions(t,i,"shadow",o),void 0!==i.color&&null!==i.color){var a=d.parseColor(i.color);d.fillIfDefined(t.color,a)}else!0===n&&null===i.color&&(t.color=d.bridgeObject(o.color));void 0!==i.fixed&&null!==i.fixed&&("boolean"==typeof i.fixed?(t.fixed.x=i.fixed,t.fixed.y=i.fixed):(void 0!==i.fixed.x&&"boolean"==typeof i.fixed.x&&(t.fixed.x=i.fixed.x),void 0!==i.fixed.y&&"boolean"==typeof i.fixed.y&&(t.fixed.y=i.fixed.y))),!0===n&&null===i.font&&(t.font=d.bridgeObject(o.font)),e.updateGroupOptions(t,i,s),void 0!==i.scaling&&d.mergeOptions(t.scaling,i.scaling,"label",o.scaling)}},{key:"checkMass",value:function(e,t){if(void 0!==e.mass&&e.mass<=0){var i="";void 0!==t&&(i=" in node id: "+t),console.log("%cNegative or zero mass disallowed"+i+", setting mass to 1.",S),e.mass=1}}}]),e}();t.default=D},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(7),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(5),u=function(){function e(){(0,a.default)(this,e)}return(0,h.default)(e,null,[{key:"choosify",value:function(e,t){var i=["node","edge","label"],n=!0,o=l.topMost(t,"chosen");if("boolean"==typeof o)n=o;else if("object"===(void 0===o?"undefined":(0,s.default)(o))){if(-1===i.indexOf(e))throw new Error("choosify: subOption '"+e+"' should be one of '"+i.join("', '")+"'");var r=l.topMost(t,["chosen",e]);"boolean"!=typeof r&&"function"!=typeof r||(n=r)}return n}},{key:"pointInRect",value:function(e,t,i){if(e.width<=0||e.height<=0)return!1;if(void 0!==i){var n={x:t.x-i.x,y:t.y-i.y};if(0!==i.angle){var o=-i.angle;t={x:Math.cos(o)*n.x-Math.sin(o)*n.y,y:Math.sin(o)*n.x+Math.cos(o)*n.y}}else t=n}var s=e.x+e.width,r=e.y+e.width;return e.leftt.x&&e.topt.y}},{key:"isValidLabel",value:function(e){return"string"==typeof e&&""!==e}}]),e}();t.default=u},function(e,t,i){t.onTouch=function(e,t){t.inputHandler=function(e){e.isFirst&&t(e)},e.on("hammer.input",t.inputHandler)},t.onRelease=function(e,t){return t.inputHandler=function(e){e.isFinal&&t(e)},e.on("hammer.input",t.inputHandler)},t.offTouch=function(e,t){e.off("hammer.input",t.inputHandler)},t.offRelease=t.offTouch,t.disablePreventDefaultVertically=function(e){return e.getTouchAction=function(){return["pan-y"]},e}},function(e,t,i){i(85);for(var n=i(9),o=i(18),s=i(24),r=i(8)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),d=0;ddocument.F=Object<\/script>"),e.close(),d=e.F;n--;)delete d.prototype[s[n]];return d()};e.exports=Object.create||function(e,t){var i;return null!==e?(a.prototype=n(e),i=new a,a.prototype=null,i[r]=e):i=d(),void 0===t?i:o(i,t)}},function(e,t){var i=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:i)(e)}},function(e,t,i){var n=i(44)("keys"),o=i(28);e.exports=function(e){return n[e]||(n[e]=o(e))}},function(e,t,i){var n=i(9),o=n["__core-js_shared__"]||(n["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,i){var n=i(12).f,o=i(14),s=i(8)("toStringTag");e.exports=function(e,t,i){e&&!o(e=i?e:e.prototype,s)&&n(e,s,{configurable:!0,value:t})}},function(e,t,i){var n=i(95)(!0);i(60)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,i=this._i;return i>=t.length?{value:void 0,done:!0}:(e=n(t,i),this._i+=e.length,{value:e,done:!1})})},function(e,t,i){t.f=i(8)},function(e,t,i){var n=i(9),o=i(6),s=i(39),r=i(48),a=i(12).f;e.exports=function(e){var t=o.Symbol||(o.Symbol=s?{}:n.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:r.f(e)})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,i){function n(e,t){this._data=null,this._ids={},this.length=0,this._options=t||{},this._fieldId="id",this._subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(e)}var o=i(10),s=function(e){return e&&e.__esModule?e:{default:e}}(o),r=i(5),a=i(32);n.prototype.setData=function(e){var t,i,n,o,s;if(this._data){for(this._data.off&&this._data.off("*",this.listener),t=this._data.getIds({filter:this._options&&this._options.filter}),s=[],n=0,o=t.length;nthis.imageObj.height?i=this.imageObj.width/this.imageObj.height:n=this.imageObj.height/this.imageObj.width),e=2*this.options.size*i,t=2*this.options.size*n}else e=this.imageObj.width,t=this.imageObj.height;this.width=e,this.height=t,this.radius=.5*this.width}},{key:"_drawRawCircle",value:function(e,t,i,n){this.initContextForDraw(e,n),e.circle(t,i,n.size),this.performFill(e,n)}},{key:"_drawImageAtPosition",value:function(e,t){if(0!=this.imageObj.width){e.globalAlpha=1,this.enableShadow(e,t);var i=1;!0===this.options.shapeProperties.interpolation&&(i=this.imageObj.width/this.width/this.body.view.scale),this.imageObj.drawImageAtPosition(e,i,this.left,this.top,this.width,this.height),this.disableShadow(e,t)}}},{key:"_drawImageLabel",value:function(e,t,i,n,o){var s,r=0;if(void 0!==this.height){r=.5*this.height;var a=this.labelModule.getTextSize(e,n,o);a.lineCount>=1&&(r+=a.height/2)}s=i+r,this.options.label&&(this.labelOffset=r),this.labelModule.draw(e,t,s,n,o,"hanging")}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.printStyle=void 0;var o=i(21),s=n(o),r=i(7),a=n(r),d=i(10),h=n(d),l=i(0),u=n(l),c=i(1),f=n(c),p=i(5),v=!1,g=void 0,y="background: #FFeeee; color: #dd0000",m=function(){function e(){(0,u.default)(this,e)}return(0,f.default)(e,null,[{key:"validate",value:function(t,i,n){v=!1,g=i;var o=i;return void 0!==n&&(o=i[n]),e.parse(t,o,[]),v}},{key:"parse",value:function(t,i,n){for(var o in t)t.hasOwnProperty(o)&&e.check(o,t,i,n)}},{key:"check",value:function(t,i,n,o){if(void 0===n[t]&&void 0===n.__any__)return void e.getSuggestion(t,n,o);var s=t,r=!0;void 0===n[t]&&void 0!==n.__any__&&(s="__any__",r="object"===e.getType(i[t]));var a=n[s];r&&void 0!==a.__type__&&(a=a.__type__),e.checkFields(t,i,n,s,a,o)}},{key:"checkFields",value:function(t,i,n,o,s,r){var a=function(i){console.log("%c"+i+e.printLocation(r,t),y)},d=e.getType(i[t]),l=s[d];void 0!==l?"array"===e.getType(l)&&-1===l.indexOf(i[t])?(a('Invalid option detected in "'+t+'". Allowed values are:'+e.print(l)+' not "'+i[t]+'". '),v=!0):"object"===d&&"__any__"!==o&&(r=p.copyAndExtendArray(r,t),e.parse(i[t],n[o],r)):void 0===s.any&&(a('Invalid type received for "'+t+'". Expected: '+e.print((0,h.default)(s))+". Received ["+d+'] "'+i[t]+'"'),v=!0)}},{key:"getType",value:function(e){var t=void 0===e?"undefined":(0,a.default)(e);return"object"===t?null===e?"null":e instanceof Boolean?"boolean":e instanceof Number?"number":e instanceof String?"string":Array.isArray(e)?"array":e instanceof Date?"date":void 0!==e.nodeType?"dom":!0===e._isAMomentObject?"moment":"object":"number"===t?"number":"boolean"===t?"boolean":"string"===t?"string":void 0===t?"undefined":t}},{key:"getSuggestion",value:function(t,i,n){var o=e.findInOptions(t,i,n,!1),s=e.findInOptions(t,g,[],!0),r=void 0;r=void 0!==o.indexMatch?" in "+e.printLocation(o.path,t,"")+'Perhaps it was incomplete? Did you mean: "'+o.indexMatch+'"?\n\n':s.distance<=4&&o.distance>s.distance?" in "+e.printLocation(o.path,t,"")+"Perhaps it was misplaced? Matching option found at: "+e.printLocation(s.path,s.closestMatch,""):o.distance<=8?'. Did you mean "'+o.closestMatch+'"?'+e.printLocation(o.path,t):". Did you mean one of these: "+e.print((0,h.default)(i))+e.printLocation(n,t),console.log('%cUnknown option detected: "'+t+'"'+r,y),v=!0}},{key:"findInOptions",value:function(t,i,n){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,r="",a=[],d=t.toLowerCase(),h=void 0;for(var l in i){var u=void 0;if(void 0!==i[l].__type__&&!0===o){var c=e.findInOptions(t,i[l],p.copyAndExtendArray(n,l));s>c.distance&&(r=c.closestMatch,a=c.path,s=c.distance,h=c.indexMatch)}else-1!==l.toLowerCase().indexOf(d)&&(h=l),u=e.levenshteinDistance(t,l),s>u&&(r=l,a=p.copyArray(n),s=u)}return{closestMatch:r,path:a,distance:s,indexMatch:h}}},{key:"printLocation",value:function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",n="\n\n"+i+"options = {\n",o=0;oi.shape.height?(r=i.x+.5*i.shape.width,a=i.y-d):(r=i.x+d,a=i.y-.5*i.shape.height),o=this._pointOnCircle(r,a,d,.125),this.labelModule.draw(e,o.x,o.y,this.selected,this.hover)}}}},{key:"getItemsOnPoint",value:function(e){var t=[];if(this.labelModule.visible()){var i=this._getRotation();g.pointInRect(this.labelModule.getSize(),e,i)&&t.push({edgeId:this.id,labelId:0})}var n={left:e.x,top:e.y};return this.isOverlappingWith(n)&&t.push({edgeId:this.id}),t}},{key:"isOverlappingWith",value:function(e){if(this.connected){var t=this.from.x,i=this.from.y,n=this.to.x,o=this.to.y,s=e.left,r=e.top;return this.edgeType.getDistanceToEdge(t,i,n,o,s,r)<10}return!1}},{key:"_getRotation",value:function(e){var t=this.edgeType.getViaNode(),i=this.edgeType.getPoint(.5,t);void 0!==e&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,i.x,i.y);var n={x:i.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible())return n;if("horizontal"===this.options.font.align)return n;var o=this.from.y-this.to.y,s=this.from.x-this.to.x,r=Math.atan2(o,s);return(r<-1&&s<0||r>0&&s<0)&&(r+=Math.PI),n.angle=r,n}},{key:"_pointOnCircle",value:function(e,t,i,n){var o=2*n*Math.PI;return{x:e+i*Math.cos(o),y:t-i*Math.sin(o)}}},{key:"select",value:function(){this.selected=!0}},{key:"unselect",value:function(){this.selected=!1}},{key:"cleanup",value:function(){return this.edgeType.cleanup()}},{key:"remove",value:function(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}},{key:"endPointsValid",value:function(){return void 0!==this.body.nodes[this.fromId]&&void 0!==this.body.nodes[this.toId]}}],[{key:"parseOptions",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=["arrowStrikethrough","id","from","hidden","hoverWidth","labelHighlightBold","length","line","opacity","physics","scaling","selectionWidth","selfReferenceSize","to","title","value","width","font","chosen","widthConstraint"];if(p.selectiveDeepExtend(r,e,t,i),g.isValidLabel(t.label)?e.label=t.label:e.label=void 0,p.mergeOptions(e,t,"smooth",n),p.mergeOptions(e,t,"shadow",n),void 0!==t.dashes&&null!==t.dashes?e.dashes=t.dashes:!0===i&&null===t.dashes&&(e.dashes=(0,h.default)(n.dashes)),void 0!==t.scaling&&null!==t.scaling?(void 0!==t.scaling.min&&(e.scaling.min=t.scaling.min),void 0!==t.scaling.max&&(e.scaling.max=t.scaling.max),p.mergeOptions(e.scaling,t.scaling,"label",n.scaling)):!0===i&&null===t.scaling&&(e.scaling=(0,h.default)(n.scaling)),void 0!==t.arrows&&null!==t.arrows)if("string"==typeof t.arrows){var d=t.arrows.toLowerCase();e.arrows.to.enabled=-1!=d.indexOf("to"),e.arrows.middle.enabled=-1!=d.indexOf("middle"),e.arrows.from.enabled=-1!=d.indexOf("from")}else{if("object"!==(0,a.default)(t.arrows))throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:"+(0,s.default)(t.arrows));p.mergeOptions(e.arrows,t.arrows,"to",n.arrows),p.mergeOptions(e.arrows,t.arrows,"middle",n.arrows),p.mergeOptions(e.arrows,t.arrows,"from",n.arrows)}else!0===i&&null===t.arrows&&(e.arrows=(0,h.default)(n.arrows));if(void 0!==t.color&&null!==t.color){var l=t.color,u=e.color;if(o)p.deepExtend(u,n.color,!1,i);else for(var c in u)u.hasOwnProperty(c)&&delete u[c];if(p.isString(u))u.color=u,u.highlight=u,u.hover=u,u.inherit=!1,void 0===l.opacity&&(u.opacity=1);else{var f=!1;void 0!==l.color&&(u.color=l.color,f=!0),void 0!==l.highlight&&(u.highlight=l.highlight,f=!0),void 0!==l.hover&&(u.hover=l.hover,f=!0),void 0!==l.inherit&&(u.inherit=l.inherit),void 0!==l.opacity&&(u.opacity=Math.min(1,Math.max(0,l.opacity))),!0===f?u.inherit=!1:void 0===u.inherit&&(u.inherit="from")}}else!0===i&&null===t.color&&(e.color=p.bridgeObject(n.color));!0===i&&null===t.font&&(e.font=p.bridgeObject(n.font))}}]),e}();t.default=w},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(78),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_findBorderPositionBezier",value:function(e,t){var i,n,o,s,r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._getViaCoordinates(),d=0,h=0,l=1,u=this.to,c=!1;for(e.id===this.from.id&&(u=this.from,c=!0);h<=l&&d<10;){var f=.5*(h+l);if(i=this.getPoint(f,a),n=Math.atan2(u.y-i.y,u.x-i.x),o=u.distanceToBorder(t,n),s=Math.sqrt(Math.pow(i.x-u.x,2)+Math.pow(i.y-u.y,2)),r=o-s,Math.abs(r)<.2)break;r<0?!1===c?h=f:l=f:!1===c?l=f:h=f,d++}return i.t=f,i}},{key:"_getDistanceToBezierEdge",value:function(e,t,i,n,o,s,r){var a=1e9,d=void 0,h=void 0,l=void 0,u=void 0,c=void 0,f=e,p=t;for(h=1;h<10;h++)l=.1*h,u=Math.pow(1-l,2)*e+2*l*(1-l)*r.x+Math.pow(l,2)*i,c=Math.pow(1-l,2)*t+2*l*(1-l)*r.y+Math.pow(l,2)*n,h>0&&(d=this._getDistanceToLine(f,p,u,c,o,s),a=d1&&void 0!==arguments[1]?arguments[1]:[],n=1e9,o=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;at.shape.boundingBox.left&&(s=t.shape.boundingBox.left),rt.shape.boundingBox.top&&(n=t.shape.boundingBox.top),o1&&void 0!==arguments[1]?arguments[1]:[],n=1e9,o=-1e9,s=1e9,r=-1e9;if(i.length>0)for(var a=0;at.x&&(s=t.x),rt.y&&(n=t.y),od;)n(a,i=t[d++])&&(~s(h,i)||h.push(i));return h}},function(e,t,i){var n=i(14),o=i(29),s=i(43)("IE_PROTO"),r=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),n(e,s)?e[s]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?r:null}},function(e,t,i){var n=i(37),o=i(8)("toStringTag"),s="Arguments"==n(function(){return arguments}()),r=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,i,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=r(t=Object(e),o))?i:s?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,i){var n=i(11),o=i(6),s=i(20);e.exports=function(e,t){var i=(o.Object||{})[e]||Object[e],r={};r[e]=t(i),n(n.S+n.F*s(function(){i(1)}),"Object",r)}},function(e,t,i){var n=i(65),o=i(45).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,o)}},function(e,t,i){var n=i(31),o=i(27),s=i(17),r=i(40),a=i(14),d=i(62),h=Object.getOwnPropertyDescriptor;t.f=i(13)?h:function(e,t){if(e=s(e),t=r(t,!0),d)try{return h(e,t)}catch(e){}if(a(e,t))return o(!n.f.call(e,t),e[t])}},function(e,t,i){e.exports="undefined"!=typeof window&&window.moment||i(114)},function(e,t,i){function n(e){this.delay=null,this.max=1/0,this._queue=[],this._timeout=null,this._extended=null,this.setOptions(e)}n.prototype.setOptions=function(e){e&&void 0!==e.delay&&(this.delay=e.delay),e&&void 0!==e.max&&(this.max=e.max),this._flushIfNeeded()},n.extend=function(e,t){var i=new n(t);if(void 0!==e.flush)throw new Error("Target object already has a property flush");e.flush=function(){i.flush()};var o=[{name:"flush",original:void 0}];if(t&&t.replace)for(var s=0;sthis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var e=this;this._timeout=setTimeout(function(){e.flush()},this.delay)}},n.prototype.flush=function(){for(;this._queue.length>0;){var e=this._queue.shift();e.fn.apply(e.context||e.fn,e.args||[])}},e.exports=n},function(e,t){function i(e){if(e)return n(e)}function n(e){for(var t in i.prototype)e[t]=i.prototype[t];return e}e.exports=i,i.prototype.on=i.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(t),this},i.prototype.once=function(e,t){function i(){n.off(e,i),t.apply(this,arguments)}var n=this;return this._callbacks=this._callbacks||{},i.fn=t,this.on(e,i),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[e];if(!i)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var n,o=0;o=0;i--){var a=s[i];a.nodes||(a.nodes=[]),-1===a.nodes.indexOf(o)&&a.nodes.push(o)}t.attr&&(o.attr=d(o.attr,t.attr))}function u(e,t){if(e.edges||(e.edges=[]),e.edges.push(t),e.edge){var i=d({},e.edge);t.attr=d(i,t.attr)}}function c(e,t,i,n,o){var s={from:t,to:i,type:n};return e.edge&&(s.attr=d({},e.edge)),s.attr=d(s.attr||{},o),s}function f(){for(A=I.NULL,R="";" "===z||"\t"===z||"\n"===z||"\r"===z;)s();do{var e=!1;if("#"===z){for(var t=B-1;" "===N.charAt(t)||"\t"===N.charAt(t);)t--;if("\n"===N.charAt(t)||""===N.charAt(t)){for(;""!=z&&"\n"!=z;)s();e=!0}}if("/"===z&&"/"===r()){for(;""!=z&&"\n"!=z;)s();e=!0}if("/"===z&&"*"===r()){for(;""!=z;){if("*"===z&&"/"===r()){s(),s();break}s()}e=!0}for(;" "===z||"\t"===z||"\n"===z||"\r"===z;)s()}while(e);if(""===z)return void(A=I.DELIMITER);var i=z+r();if(F[i])return A=I.DELIMITER,R=i,s(),void s();if(F[z])return A=I.DELIMITER,R=z,void s();if(a(z)||"-"===z){for(R+=z,s();a(z);)R+=z,s();return"false"===R?R=!1:"true"===R?R=!0:isNaN(Number(R))||(R=Number(R)),void(A=I.IDENTIFIER)}if('"'===z){for(s();""!=z&&('"'!=z||'"'===z&&'"'===r());)'"'===z?(R+=z,s()):"\\"===z&&"n"===r()?(R+="\n",s()):R+=z,s();if('"'!=z)throw k('End of string " expected');return s(),void(A=I.IDENTIFIER)}for(A=I.UNKNOWN;""!=z;)R+=z,s();throw new SyntaxError('Syntax error in part "'+x(R,30)+'"')}function p(){var e={};if(o(),f(),"strict"===R&&(e.strict=!0,f()),"graph"!==R&&"digraph"!==R||(e.type=R,f()),A===I.IDENTIFIER&&(e.id=R,f()),"{"!=R)throw k("Angle bracket { expected");if(f(),v(e),"}"!=R)throw k("Angle bracket } expected");if(f(),""!==R)throw k("End of file expected");return f(),delete e.node,delete e.edge,delete e.graph,e}function v(e){for(;""!==R&&"}"!=R;)g(e),";"===R&&f()}function g(e){var t=y(e);if(t)return void _(e,t);if(!m(e)){if(A!=I.IDENTIFIER)throw k("Identifier expected");var i=R;if(f(),"="===R){if(f(),A!=I.IDENTIFIER)throw k("Identifier expected");e[i]=R,f()}else b(e,i)}}function y(e){var t=null;if("subgraph"===R&&(t={},t.type="subgraph",f(),A===I.IDENTIFIER&&(t.id=R,f())),"{"===R){if(f(),t||(t={}),t.parent=e,t.node=e.node,t.edge=e.edge,t.graph=e.graph,v(t),"}"!=R)throw k("Angle bracket } expected");f(),delete t.node,delete t.edge,delete t.graph,delete t.parent,e.subgraphs||(e.subgraphs=[]),e.subgraphs.push(t)}return t}function m(e){return"node"===R?(f(),e.node=w(),"node"):"edge"===R?(f(),e.edge=w(),"edge"):"graph"===R?(f(),e.graph=w(),"graph"):null}function b(e,t){var i={id:t},n=w();n&&(i.attr=n),l(e,i),_(e,t)}function _(e,t){for(;"->"===R||"--"===R;){var i,n=R;f();var o=y(e);if(o)i=o;else{if(A!=I.IDENTIFIER)throw k("Identifier or subgraph expected");i=R,l(e,{id:i}),f()}u(e,c(e,t,i,n,w())),t=i}}function w(){for(var e=null,t={dashed:!0,solid:!1,dotted:[1,5]};"["===R;){for(f(),e={};""!==R&&"]"!=R;){if(A!=I.IDENTIFIER)throw k("Attribute name expected");var i=R;if(f(),"="!=R)throw k("Equal sign = expected");if(f(),A!=I.IDENTIFIER)throw k("Attribute value expected");var n=R;"style"===i&&(n=t[n]),h(e,i,n),f(),","==R&&f()}if("]"!=R)throw k("Bracket ] expected");f()}return e}function k(e){return new SyntaxError(e+', got "'+x(R,30)+'" (char '+B+")")}function x(e,t){return e.length<=t?e:e.substr(0,27)+"..."}function O(e,t,i){Array.isArray(e)?e.forEach(function(e){Array.isArray(t)?t.forEach(function(t){i(e,t)}):i(e,t)}):Array.isArray(t)?t.forEach(function(t){i(e,t)}):i(e,t)}function M(e,t,i){for(var n=t.split("."),o=n.pop(),s=e,r=0;r":!0,"--":!0},N="",B=0,z="",R="",A=I.NULL,j=/[a-zA-Z_0-9.:#]/;t.parseDOT=n,t.DOTToGraph=S},function(e,t,i){function n(e,t){var i=[],n=[],o={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};void 0!==t&&(void 0!==t.fixed&&(o.nodes.fixed=t.fixed),void 0!==t.parseColor&&(o.nodes.parseColor=t.parseColor),void 0!==t.inheritColor&&(o.edges.inheritColor=t.inheritColor));for(var s=e.edges,r=e.nodes,a=0;a2&&void 0!==arguments[2]&&arguments[2];(0,h.default)(this,e),this.body=t,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(i),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=n}return(0,u.default)(e,[{key:"setOptions",value:function(e){if(this.elementOptions=e,this.initFontOptions(e.font),f.isValidLabel(e.label)?this.labelDirty=!0:e.label="",void 0!==e.font&&null!==e.font)if("string"==typeof e.font)this.baseSize=this.fontOptions.size;else if("object"===(0,a.default)(e.font)){var t=e.font.size;void 0!==t&&(this.baseSize=t)}}},{key:"initFontOptions",value:function(t){var i=this;if(c.forEach(v,function(e){i.fontOptions[e]={}}),e.parseFontString(this.fontOptions,t))return void(this.fontOptions.vadjust=0);c.forEach(t,function(e,t){void 0!==e&&null!==e&&"object"!==(void 0===e?"undefined":(0,a.default)(e))&&(i.fontOptions[t]=e)})}},{key:"constrain",value:function(e){var t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:"middle"},i=c.topMost(e,"widthConstraint");if("number"==typeof i)t.maxWdt=Number(i),t.minWdt=Number(i);else if("object"===(void 0===i?"undefined":(0,a.default)(i))){var n=c.topMost(e,["widthConstraint","maximum"]);"number"==typeof n&&(t.maxWdt=Number(n));var o=c.topMost(e,["widthConstraint","minimum"]);"number"==typeof o&&(t.minWdt=Number(o))}var s=c.topMost(e,"heightConstraint");if("number"==typeof s)t.minHgt=Number(s);else if("object"===(void 0===s?"undefined":(0,a.default)(s))){var r=c.topMost(e,["heightConstraint","minimum"]);"number"==typeof r&&(t.minHgt=Number(r));var d=c.topMost(e,["heightConstraint","valign"]);"string"==typeof d&&("top"!==d&&"bottom"!==d||(t.valign=d))}return t}},{key:"update",value:function(e,t){this.setOptions(e,!0),this.propagateFonts(t),c.deepExtend(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=f.choosify("label",t)}},{key:"adjustSizes",value:function(e){var t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);var i=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=i)}},{key:"addFontOptionsToPile",value:function(e,t){for(var i=0;i5&&void 0!==arguments[5]?arguments[5]:"middle";if(void 0!==this.elementOptions.label){var r=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&r=this.elementOptions.scaling.label.maxVisible&&(r=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,n,o,t,i,s),this._drawBackground(e),this._drawText(e,t,this.size.yLine,s,r))}}},{key:"_drawBackground",value:function(e){if(void 0!==this.fontOptions.background&&"none"!==this.fontOptions.background){e.fillStyle=this.fontOptions.background;var t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}},{key:"_drawText",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle",o=arguments[4],r=this._setAlignment(e,t,i,n),a=(0,s.default)(r,2);t=a[0],i=a[1],e.textAlign="left",t-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&("top"===this.fontOptions.valign&&(i-=(this.size.height-this.size.labelHeight)/2),"bottom"===this.fontOptions.valign&&(i+=(this.size.height-this.size.labelHeight)/2));for(var d=0;d0&&(e.lineWidth=c.strokeWidth,e.strokeStyle=g,e.lineJoin="round"),e.fillStyle=v,c.strokeWidth>0&&e.strokeText(c.text,t+l,i+c.vadjust),e.fillText(c.text,t+l,i+c.vadjust),l+=c.width}i+=h.height}}}},{key:"_setAlignment",value:function(e,t,i,n){if(this.isEdgeLabel&&"horizontal"!==this.fontOptions.align&&!1===this.pointToSelf){t=0,i=0;"top"===this.fontOptions.align?(e.textBaseline="alphabetic",i-=4):"bottom"===this.fontOptions.align?(e.textBaseline="hanging",i+=4):e.textBaseline="middle"}else e.textBaseline=n;return[t,i]}},{key:"_getColor",value:function(e,t,i){var n=e||"#000000",o=i||"#ffffff";if(t<=this.elementOptions.scaling.label.drawThreshold){var s=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));n=c.overrideOpacity(n,s),o=c.overrideOpacity(o,s)}return[n,o]}},{key:"getTextSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this._processLabel(e,t,i),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}},{key:"getSize",value:function(){var e=this.size.left,t=this.size.top-1;if(this.isEdgeLabel){var i=.5*-this.size.width;switch(this.fontOptions.align){case"middle":e=i,t=.5*-this.size.height;break;case"top":e=i,t=-(this.size.height+2);break;case"bottom":e=i,t=2}}return{left:e,top:t,width:this.size.width,height:this.size.height}}},{key:"calculateLabelSize",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"middle";this._processLabel(e,t,i),this.size.left=n-.5*this.size.width,this.size.top=o-.5*this.size.height,this.size.yLine=o+.5*(1-this.lineCount)*this.fontOptions.size,"hanging"===s&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}},{key:"getFormattingValues",value:function(e,t,i,n){var o=function(e,t,i){return"normal"===t?"mod"===i?"":e[i]:void 0!==e[t][i]?e[t][i]:e[i]},s={color:o(this.fontOptions,n,"color"),size:o(this.fontOptions,n,"size"),face:o(this.fontOptions,n,"face"),mod:o(this.fontOptions,n,"mod"),vadjust:o(this.fontOptions,n,"vadjust"),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||i)&&("normal"===n&&!0===this.fontOptions.chooser&&this.elementOptions.labelHighlightBold?s.mod="bold":"function"==typeof this.fontOptions.chooser&&this.fontOptions.chooser(s,this.elementOptions.id,t,i));var r="";return void 0!==s.mod&&""!==s.mod&&(r+=s.mod+" "),r+=s.size+"px "+s.face,e.font=r.replace(/"/g,""),s.font=e.font,s.height=s.size,s}},{key:"differentState",value:function(e,t){return e!==this.selectedState||t!==this.hoverState}},{key:"_processLabelText",value:function(e,t,i,n){return new p(e,this,t,i).process(n)}},{key:"_processLabel",value:function(e,t,i){if(!1!==this.labelDirty||this.differentState(t,i)){var n=this._processLabelText(e,t,i,this.elementOptions.label);this.fontOptions.minWdt>0&&n.width0&&n.heightn.shape.height?(t=n.x+.5*n.shape.width,i=n.y-o):(t=n.x+o,i=n.y-.5*n.shape.height),[t,i,o]}},{key:"_pointOnCircle",value:function(e,t,i,n){var o=2*n*Math.PI;return{x:e+i*Math.cos(o),y:t-i*Math.sin(o)}}},{key:"_findBorderPositionCircle",value:function(e,t,i){for(var n=i.x,o=i.y,s=i.low,r=i.high,a=i.direction,d=0,h=this.options.selfReferenceSize,l=void 0,u=void 0,c=void 0,f=void 0,p=void 0,v=.5*(s+r);s<=r&&d<10&&(v=.5*(s+r),l=this._pointOnCircle(n,o,h,v),u=Math.atan2(e.y-l.y,e.x-l.x),c=e.distanceToBorder(t,u),f=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2)),p=c-f,!(Math.abs(p)<.05));)p>0?a>0?s=v:r=v:a>0?r=v:s=v,d++;return l.t=v,l}},{key:"getLineWidth",value:function(e,t){return!0===e?Math.max(this.selectionWidth,.3/this.body.view.scale):!0===t?Math.max(this.hoverWidth,.3/this.body.view.scale):Math.max(this.options.width,.3/this.body.view.scale)}},{key:"getColor",value:function(e,t,i,n){if(!1!==t.inheritsColor){if("both"===t.inheritsColor&&this.from.id!==this.to.id){var o=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),s=void 0,r=void 0;return s=this.from.options.color.highlight.border,r=this.to.options.color.highlight.border,!1===this.from.selected&&!1===this.to.selected?(s=l.overrideOpacity(this.from.options.color.border,t.opacity),r=l.overrideOpacity(this.to.options.color.border,t.opacity)):!0===this.from.selected&&!1===this.to.selected?r=this.to.options.color.border:!1===this.from.selected&&!0===this.to.selected&&(s=this.from.options.color.border),o.addColorStop(0,s),o.addColorStop(1,r),o}return"to"===t.inheritsColor?l.overrideOpacity(this.to.options.color.border,t.opacity):l.overrideOpacity(this.from.options.color.border,t.opacity)}return l.overrideOpacity(t.color,t.opacity)}},{key:"_circle",value:function(e,t,i,n,o){this.enableShadow(e,t),e.beginPath(),e.arc(i,n,o,0,2*Math.PI,!1),e.stroke(),this.disableShadow(e,t)}},{key:"getDistanceToEdge",value:function(e,t,i,n,o,r,a,d){var h=0;if(this.from!=this.to)h=this._getDistanceToEdge(e,t,i,n,o,r,a);else{var l=this._getCircleData(void 0),u=(0,s.default)(l,3),c=u[0],f=u[1],p=u[2],v=c-o,g=f-r;h=Math.abs(Math.sqrt(v*v+g*g)-p)}return h}},{key:"_getDistanceToLine",value:function(e,t,i,n,o,s){var r=i-e,a=n-t,d=r*r+a*a,h=((o-e)*r+(s-t)*a)/d;h>1?h=1:h<0&&(h=0);var l=e+h*r,u=t+h*a,c=l-o,f=u-s;return Math.sqrt(c*c+f*f)}},{key:"getArrowData",value:function(e,t,i,n,o,r){var a=void 0,d=void 0,h=void 0,l=void 0,u=void 0,c=void 0,f=void 0,p=r.width;if("from"===t?(h=this.from,l=this.to,u=.1,c=r.fromArrowScale,f=r.fromArrowType):"to"===t?(h=this.to,l=this.from,u=-.1,c=r.toArrowScale,f=r.toArrowType):(h=this.to,l=this.from,c=r.middleArrowScale,f=r.middleArrowType),h!=l)if("middle"!==t)if(!0===this.options.smooth.enabled){d=this.findBorderPosition(h,e,{via:i});var v=this.getPoint(Math.max(0,Math.min(1,d.t+u)),i);a=Math.atan2(d.y-v.y,d.x-v.x)}else a=Math.atan2(h.y-l.y,h.x-l.x),d=this.findBorderPosition(h,e);else a=Math.atan2(h.y-l.y,h.x-l.x),d=this.getPoint(.5,i);else{var g=this._getCircleData(e),y=(0,s.default)(g,3),m=y[0],b=y[1],_=y[2];"from"===t?(d=this.findBorderPosition(this.from,e,{x:m,y:b,low:.25,high:.6,direction:-1}),a=-2*d.t*Math.PI+1.5*Math.PI+.1*Math.PI):"to"===t?(d=this.findBorderPosition(this.from,e,{x:m,y:b,low:.6,high:1,direction:1}),a=-2*d.t*Math.PI+1.5*Math.PI-1.1*Math.PI):(d=this._pointOnCircle(m,b,_,.175),a=3.9269908169872414)}"middle"===t&&c<0&&(p*=-1);var w=15*c+3*p;return{point:d,core:{x:d.x-.9*w*Math.cos(a),y:d.y-.9*w*Math.sin(a)},angle:a,length:w,type:f}}},{key:"drawArrowHead",value:function(e,t,i,n,o){e.strokeStyle=this.getColor(e,t,i,n),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,u.draw(e,o),this.enableShadow(e,t),e.fill(),this.disableShadow(e,t)}},{key:"enableShadow",value:function(e,t){!0===t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}},{key:"disableShadow",value:function(e,t){!0===t.shadow&&(e.shadowColor="rgba(0,0,0,0)",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}}]),e}();t.default=c},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(3),a=n(r),d=i(4),h=n(d),l=i(0),u=n(l),c=i(1),f=n(c),p=function(){function e(){(0,u.default)(this,e)}return(0,f.default)(e,null,[{key:"transform",value:function(e,t){e instanceof Array||(e=[e]);for(var i=t.point.x,n=t.point.y,o=t.angle,s=t.length,r=0;r0){var e=void 0,t=this.body.nodes,i=this.physicsBody.physicsNodeIndices,n=i.length,o=this._formBarnesHutTree(t,i);this.barnesHutTree=o;for(var s=0;s0&&this._getForceContributions(o.root,e)}}},{key:"_getForceContributions",value:function(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}},{key:"_getForceContribution",value:function(e,t){if(e.childrenCount>0){var i=void 0,n=void 0,o=void 0;i=e.centerOfMass.x-t.x,n=e.centerOfMass.y-t.y,o=Math.sqrt(i*i+n*n),o*e.calcSize>this.thetaInversed?this._calculateForces(o,i,n,t,e):4===e.childrenCount?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(o,i,n,t,e)}}},{key:"_calculateForces",value:function(e,t,i,n,o){0===e&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&n.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*n.shape.radius,e-n.shape.radius));var s=this.options.gravitationalConstant*o.mass*n.options.mass/Math.pow(e,3),r=t*s,a=i*s;this.physicsBody.forces[n.id].x+=r,this.physicsBody.forces[n.id].y+=a}},{key:"_formBarnesHutTree",value:function(e,t){for(var i=void 0,n=t.length,o=e[t[0]].x,s=e[t[0]].y,r=e[t[0]].x,a=e[t[0]].y,d=1;d0&&(lr&&(r=l),ua&&(a=u))}var c=Math.abs(r-o)-Math.abs(a-s);c>0?(s-=.5*c,a+=.5*c):(o+=.5*c,r-=.5*c);var f=Math.max(1e-5,Math.abs(r-o)),p=.5*f,v=.5*(o+r),g=.5*(s+a),y={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:v-p,maxX:v+p,minY:g-p,maxY:g+p},size:f,calcSize:1/f,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(y.root);for(var m=0;m0&&this._placeInTree(y.root,i);return y}},{key:"_updateBranchMass",value:function(e,t){var i=e.centerOfMass,n=e.mass+t.options.mass,o=1/n;i.x=i.x*e.mass+t.x*t.options.mass,i.x*=o,i.y=i.y*e.mass+t.y*t.options.mass,i.y*=o,e.mass=n;var s=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidtht.x?n.maxY>t.y?"NW":"SW":n.maxY>t.y?"NE":"SE",this._placeInRegion(e,t,o)}},{key:"_placeInRegion",value:function(e,t,i){var n=e.children[i];switch(n.childrenCount){case 0:n.children.data=t,n.childrenCount=1,this._updateBranchMass(n,t);break;case 1:n.children.data.x===t.x&&n.children.data.y===t.y?(t.x+=this.seededRandom(),t.y+=this.seededRandom()):(this._splitBranch(n),this._placeInTree(n,t));break;case 4:this._placeInTree(n,t)}}},{key:"_splitBranch",value:function(e){var t=null;1===e.childrenCount&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,"NW"),this._insertRegion(e,"NE"),this._insertRegion(e,"SW"),this._insertRegion(e,"SE"),null!=t&&this._placeInTree(e,t)}},{key:"_insertRegion",value:function(e,t){var i=void 0,n=void 0,o=void 0,s=void 0,r=.5*e.size;switch(t){case"NW":i=e.range.minX,n=e.range.minX+r,o=e.range.minY,s=e.range.minY+r;break;case"NE":i=e.range.minX+r,n=e.range.maxX,o=e.range.minY,s=e.range.minY+r;break;case"SW":i=e.range.minX,n=e.range.minX+r,o=e.range.minY+r,s=e.range.maxY;break;case"SE":i=e.range.minX+r,n=e.range.maxX,o=e.range.minY+r,s=e.range.maxY}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:i,maxX:n,minY:o,maxY:s},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}},{key:"_debug",value:function(e,t){void 0!==this.barnesHutTree&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}},{key:"_drawBranch",value:function(e,t,i){void 0===i&&(i="#FF0000"),4===e.childrenCount&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=i,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}}]),e}();t.default=d},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=function(){function e(t,i,n){(0,s.default)(this,e),this.body=t,this.physicsBody=i,this.setOptions(n)}return(0,a.default)(e,[{key:"setOptions",value:function(e){this.options=e}},{key:"solve",value:function(){for(var e=void 0,t=void 0,i=void 0,n=void 0,o=this.body.nodes,s=this.physicsBody.physicsNodeIndices,r=this.physicsBody.forces,a=0;a=e.length?(this._t=void 0,o(1)):"keys"==t?o(0,i):"values"==t?o(0,e[i]):o(0,[i,e[i]])},"values"),s.Arguments=s.Array,n("keys"),n("values"),n("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,i){var n=i(41),o=i(27),s=i(46),r={};i(18)(r,i(8)("iterator"),function(){return this}),e.exports=function(e,t,i){e.prototype=n(r,{next:o(1,i)}),s(e,t+" Iterator")}},function(e,t,i){var n=i(12),o=i(19),s=i(26);e.exports=i(13)?Object.defineProperties:function(e,t){o(e);for(var i,r=s(t),a=r.length,d=0;a>d;)n.f(e,i=r[d++],t[i]);return e}},function(e,t,i){var n=i(17),o=i(92),s=i(93);e.exports=function(e){return function(t,i,r){var a,d=n(t),h=o(d.length),l=s(r,h);if(e&&i!=i){for(;h>l;)if((a=d[l++])!=a)return!0}else for(;h>l;l++)if((e||l in d)&&d[l]===i)return e||l||0;return!e&&-1}}},function(e,t,i){var n=i(42),o=Math.min;e.exports=function(e){return e>0?o(n(e),9007199254740991):0}},function(e,t,i){var n=i(42),o=Math.max,s=Math.min;e.exports=function(e,t){return e=n(e),e<0?o(e+t,0):s(e,t)}},function(e,t,i){var n=i(9).document;e.exports=n&&n.documentElement},function(e,t,i){var n=i(42),o=i(38);e.exports=function(e){return function(t,i){var s,r,a=String(o(t)),d=n(i),h=a.length;return d<0||d>=h?e?"":void 0:(s=a.charCodeAt(d),s<55296||s>56319||d+1===h||(r=a.charCodeAt(d+1))<56320||r>57343?e?a.charAt(d):s:e?a.slice(d,d+2):r-56320+(s-55296<<10)+65536)}}},function(e,t,i){var n=i(19),o=i(97);e.exports=i(6).getIterator=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return n(t.call(e))}},function(e,t,i){var n=i(67),o=i(8)("iterator"),s=i(24);e.exports=i(6).getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||s[n(e)]}},function(e,t,i){i(99);var n=i(6).Object;e.exports=function(e,t){return n.create(e,t)}},function(e,t,i){var n=i(11);n(n.S,"Object",{create:i(41)})},function(e,t,i){i(101),e.exports=i(6).Object.keys},function(e,t,i){var n=i(29),o=i(26);i(68)("keys",function(){return function(e){return o(n(e))}})},function(e,t,i){e.exports={default:i(103),__esModule:!0}},function(e,t,i){i(47),i(36),e.exports=i(48).f("iterator")},function(e,t,i){e.exports={default:i(105),__esModule:!0}},function(e,t,i){i(106),i(111),i(112),i(113),e.exports=i(6).Symbol},function(e,t,i){var n=i(9),o=i(14),s=i(13),r=i(11),a=i(64),d=i(107).KEY,h=i(20),l=i(44),u=i(46),c=i(28),f=i(8),p=i(48),v=i(49),g=i(108),y=i(109),m=i(19),b=i(17),_=i(40),w=i(27),k=i(41),x=i(110),O=i(70),M=i(12),E=i(26),S=O.f,D=M.f,C=x.f,T=n.Symbol,P=n.JSON,I=P&&P.stringify,F=f("_hidden"),N=f("toPrimitive"),B={}.propertyIsEnumerable,z=l("symbol-registry"),R=l("symbols"),A=l("op-symbols"),j=Object.prototype,L="function"==typeof T,H=n.QObject,W=!H||!H.prototype||!H.prototype.findChild,Y=s&&h(function(){return 7!=k(D({},"a",{get:function(){return D(this,"a",{value:7}).a}})).a})?function(e,t,i){var n=S(j,t);n&&delete j[t],D(e,t,i),n&&e!==j&&D(j,t,n)}:D,V=function(e){var t=R[e]=k(T.prototype);return t._k=e,t},U=L&&"symbol"==typeof T.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof T},q=function(e,t,i){return e===j&&q(A,t,i),m(e),t=_(t,!0),m(i),o(R,t)?(i.enumerable?(o(e,F)&&e[F][t]&&(e[F][t]=!1),i=k(i,{enumerable:w(0,!1)})):(o(e,F)||D(e,F,w(1,{})),e[F][t]=!0),Y(e,t,i)):D(e,t,i)},G=function(e,t){m(e);for(var i,n=g(t=b(t)),o=0,s=n.length;s>o;)q(e,i=n[o++],t[i]);return e},X=function(e,t){return void 0===t?k(e):G(k(e),t)},K=function(e){var t=B.call(this,e=_(e,!0));return!(this===j&&o(R,e)&&!o(A,e))&&(!(t||!o(this,e)||!o(R,e)||o(this,F)&&this[F][e])||t)},Z=function(e,t){if(e=b(e),t=_(t,!0),e!==j||!o(R,t)||o(A,t)){var i=S(e,t);return!i||!o(R,t)||o(e,F)&&e[F][t]||(i.enumerable=!0),i}},$=function(e){for(var t,i=C(b(e)),n=[],s=0;i.length>s;)o(R,t=i[s++])||t==F||t==d||n.push(t);return n},Q=function(e){for(var t,i=e===j,n=C(i?A:b(e)),s=[],r=0;n.length>r;)!o(R,t=n[r++])||i&&!o(j,t)||s.push(R[t]);return s};L||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor!");var e=c(arguments.length>0?arguments[0]:void 0),t=function(i){this===j&&t.call(A,i),o(this,F)&&o(this[F],e)&&(this[F][e]=!1),Y(this,e,w(1,i))};return s&&W&&Y(j,e,{configurable:!0,set:t}),V(e)},a(T.prototype,"toString",function(){return this._k}),O.f=Z,M.f=q,i(69).f=x.f=$,i(31).f=K,i(50).f=Q,s&&!i(39)&&a(j,"propertyIsEnumerable",K,!0),p.f=function(e){return V(f(e))}),r(r.G+r.W+r.F*!L,{Symbol:T});for(var J="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ee=0;J.length>ee;)f(J[ee++]);for(var te=E(f.store),ie=0;te.length>ie;)v(te[ie++]);r(r.S+r.F*!L,"Symbol",{for:function(e){return o(z,e+="")?z[e]:z[e]=T(e)},keyFor:function(e){if(!U(e))throw TypeError(e+" is not a symbol!");for(var t in z)if(z[t]===e)return t},useSetter:function(){W=!0},useSimple:function(){W=!1}}),r(r.S+r.F*!L,"Object",{create:X,defineProperty:q,defineProperties:G,getOwnPropertyDescriptor:Z,getOwnPropertyNames:$,getOwnPropertySymbols:Q}),P&&r(r.S+r.F*(!L||h(function(){var e=T();return"[null]"!=I([e])||"{}"!=I({a:e})||"{}"!=I(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!U(e)){for(var t,i,n=[e],o=1;arguments.length>o;)n.push(arguments[o++]);return t=n[1],"function"==typeof t&&(i=t),!i&&y(t)||(t=function(e,t){if(i&&(t=i.call(this,e,t)),!U(t))return t}),n[1]=t,I.apply(P,n)}}}),T.prototype[N]||i(18)(T.prototype,N,T.prototype.valueOf),u(T,"Symbol"),u(Math,"Math",!0),u(n.JSON,"JSON",!0)},function(e,t,i){var n=i(28)("meta"),o=i(25),s=i(14),r=i(12).f,a=0,d=Object.isExtensible||function(){return!0},h=!i(20)(function(){return d(Object.preventExtensions({}))}),l=function(e){r(e,n,{value:{i:"O"+ ++a,w:{}}})},u=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,n)){if(!d(e))return"F";if(!t)return"E";l(e)}return e[n].i},c=function(e,t){if(!s(e,n)){if(!d(e))return!0;if(!t)return!1;l(e)}return e[n].w},f=function(e){return h&&p.NEED&&d(e)&&!s(e,n)&&l(e),e},p=e.exports={KEY:n,NEED:!1,fastKey:u,getWeak:c,onFreeze:f}},function(e,t,i){var n=i(26),o=i(50),s=i(31);e.exports=function(e){var t=n(e),i=o.f;if(i)for(var r,a=i(e),d=s.f,h=0;a.length>h;)d.call(e,r=a[h++])&&t.push(r);return t}},function(e,t,i){var n=i(37);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,i){var n=i(17),o=i(69).f,s={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(e){try{return o(e)}catch(e){return r.slice()}};e.exports.f=function(e){return r&&"[object Window]"==s.call(e)?a(e):o(n(e))}},function(e,t){},function(e,t,i){i(49)("asyncIterator")},function(e,t,i){i(49)("observable")},function(e,t,i){(function(e){!function(t,i){e.exports=i()}(0,function(){function t(){return Sn.apply(null,arguments)}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function n(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function o(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}function s(e){return void 0===e}function r(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){var i,n=[];for(i=0;i0)for(i=0;i0?"future":"past"];return M(i)?i(t):i.replace(/%s/i,t)}function B(e,t){var i=e.toLowerCase();Rn[i]=Rn[i+"s"]=Rn[t]=e}function z(e){return"string"==typeof e?Rn[e]||Rn[e.toLowerCase()]:void 0}function R(e){var t,i,n={};for(i in e)h(e,i)&&(t=z(i))&&(n[t]=e[i]);return n}function A(e,t){An[e]=t}function j(e){var t=[];for(var i in e)t.push({unit:i,priority:An[i]});return t.sort(function(e,t){return e.priority-t.priority}),t}function L(e,t,i){var n=""+Math.abs(e),o=t-n.length;return(e>=0?i?"+":"":"-")+Math.pow(10,Math.max(0,o)).toString().substr(1)+n}function H(e,t,i,n){var o=n;"string"==typeof n&&(o=function(){return this[n]()}),e&&(Wn[e]=o),t&&(Wn[t[0]]=function(){return L(o.apply(this,arguments),t[1],t[2])}),i&&(Wn[i]=function(){return this.localeData().ordinal(o.apply(this,arguments),e)})}function W(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function Y(e){var t,i,n=e.match(jn);for(t=0,i=n.length;t=0&&Ln.test(e);)e=e.replace(Ln,i),Ln.lastIndex=0,n-=1;return e}function q(e,t,i){ro[e]=M(t)?t:function(e,n){return e&&i?i:t}}function G(e,t){return h(ro,e)?ro[e](t._strict,t._locale):new RegExp(X(e))}function X(e){return K(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,n,o){return t||i||n||o}))}function K(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(e,t){var i,n=t;for("string"==typeof e&&(e=[e]),r(t)&&(n=function(e,i){i[t]=_(e)}),i=0;i=0&&isFinite(a.getFullYear())&&a.setFullYear(e),a}function _e(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function we(e,t,i){var n=7+t-i;return-(7+_e(e,0,n).getUTCDay()-t)%7+n-1}function ke(e,t,i,n,o){var s,r,a=(7+i-n)%7,d=we(e,n,o),h=1+7*(t-1)+a+d;return h<=0?(s=e-1,r=J(s)+h):h>J(e)?(s=e+1,r=h-J(e)):(s=e,r=h),{year:s,dayOfYear:r}}function xe(e,t,i){var n,o,s=we(e.year(),t,i),r=Math.floor((e.dayOfYear()-s-1)/7)+1;return r<1?(o=e.year()-1,n=r+Oe(o,t,i)):r>Oe(e.year(),t,i)?(n=r-Oe(e.year(),t,i),o=e.year()+1):(o=e.year(),n=r),{week:n,year:o}}function Oe(e,t,i){var n=we(e,t,i),o=we(e+1,t,i);return(J(e)-n+o)/7}function Me(e){return xe(e,this._week.dow,this._week.doy).week}function Ee(){return this._week.dow}function Se(){return this._week.doy}function De(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function Ce(e){var t=xe(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Te(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function Pe(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function Ie(e,t){return e?i(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:i(this._weekdays)?this._weekdays:this._weekdays.standalone}function Fe(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort}function Ne(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin}function Be(e,t,i){var n,o,s,r=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],n=0;n<7;++n)s=u([2e3,1]).day(n),this._minWeekdaysParse[n]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[n]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[n]=this.weekdays(s,"").toLocaleLowerCase();return i?"dddd"===t?(o=mo.call(this._weekdaysParse,r),-1!==o?o:null):"ddd"===t?(o=mo.call(this._shortWeekdaysParse,r),-1!==o?o:null):(o=mo.call(this._minWeekdaysParse,r),-1!==o?o:null):"dddd"===t?-1!==(o=mo.call(this._weekdaysParse,r))?o:-1!==(o=mo.call(this._shortWeekdaysParse,r))?o:(o=mo.call(this._minWeekdaysParse,r),-1!==o?o:null):"ddd"===t?-1!==(o=mo.call(this._shortWeekdaysParse,r))?o:-1!==(o=mo.call(this._weekdaysParse,r))?o:(o=mo.call(this._minWeekdaysParse,r),-1!==o?o:null):-1!==(o=mo.call(this._minWeekdaysParse,r))?o:-1!==(o=mo.call(this._weekdaysParse,r))?o:(o=mo.call(this._shortWeekdaysParse,r),-1!==o?o:null)}function ze(e,t,i){var n,o,s;if(this._weekdaysParseExact)return Be.call(this,e,t,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(o=u([2e3,1]).day(n),i&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(o,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(o,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(o,"").replace(".",".?")+"$","i")),this._weekdaysParse[n]||(s="^"+this.weekdays(o,"")+"|^"+this.weekdaysShort(o,"")+"|^"+this.weekdaysMin(o,""),this._weekdaysParse[n]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(i&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(i&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;if(!i&&this._weekdaysParse[n].test(e))return n}}function Re(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Te(e,this.localeData()),this.add(e-t,"d")):t}function Ae(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function je(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=Pe(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7}function Le(e){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Ye.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(h(this,"_weekdaysRegex")||(this._weekdaysRegex=Co),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function He(e){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Ye.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(h(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=To),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function We(e){return this._weekdaysParseExact?(h(this,"_weekdaysRegex")||Ye.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(h(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Po),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ye(){function e(e,t){return t.length-e.length}var t,i,n,o,s,r=[],a=[],d=[],h=[];for(t=0;t<7;t++)i=u([2e3,1]).day(t),n=this.weekdaysMin(i,""),o=this.weekdaysShort(i,""),s=this.weekdays(i,""),r.push(n),a.push(o),d.push(s),h.push(n),h.push(o),h.push(s);for(r.sort(e),a.sort(e),d.sort(e),h.sort(e),t=0;t<7;t++)a[t]=K(a[t]),d[t]=K(d[t]),h[t]=K(h[t]);this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Ve(){return this.hours()%12||12}function Ue(){return this.hours()||24}function qe(e,t){H(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ge(e,t){return t._meridiemParse}function Xe(e){return"p"===(e+"").toLowerCase().charAt(0)}function Ke(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"}function Ze(e){return e?e.toLowerCase().replace("_","-"):e}function $e(e){for(var t,i,n,o,s=0;s0;){if(n=Qe(o.slice(0,t).join("-")))return n;if(i&&i.length>=t&&w(o,i,!0)>=t-1)break;t--}s++}return null}function Qe(t){var i=null;if(!zo[t]&&void 0!==e&&e&&e.exports)try{i=Io._abbr;!function(){var e=new Error('Cannot find module "./locale"');throw e.code="MODULE_NOT_FOUND",e}(),Je(i)}catch(e){}return zo[t]}function Je(e,t){var i;return e&&(i=s(t)?it(e):et(e,t))&&(Io=i),Io._abbr}function et(e,t){if(null!==t){var i=Bo;if(t.abbr=e,null!=zo[e])O("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=zo[e]._config;else if(null!=t.parentLocale){if(null==zo[t.parentLocale])return Ro[t.parentLocale]||(Ro[t.parentLocale]=[]),Ro[t.parentLocale].push({name:e,config:t}),null;i=zo[t.parentLocale]._config}return zo[e]=new D(S(i,t)),Ro[e]&&Ro[e].forEach(function(e){et(e.name,e.config)}),Je(e),zo[e]}return delete zo[e],null}function tt(e,t){if(null!=t){var i,n=Bo;null!=zo[e]&&(n=zo[e]._config),t=S(n,t),i=new D(t),i.parentLocale=zo[e],zo[e]=i,Je(e)}else null!=zo[e]&&(null!=zo[e].parentLocale?zo[e]=zo[e].parentLocale:null!=zo[e]&&delete zo[e]);return zo[e]}function it(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Io;if(!i(e)){if(t=Qe(e))return t;e=[e]}return $e(e)}function nt(){return In(zo)}function ot(e){var t,i=e._a;return i&&-2===f(e).overflow&&(t=i[lo]<0||i[lo]>11?lo:i[uo]<1||i[uo]>de(i[ho],i[lo])?uo:i[co]<0||i[co]>24||24===i[co]&&(0!==i[fo]||0!==i[po]||0!==i[vo])?co:i[fo]<0||i[fo]>59?fo:i[po]<0||i[po]>59?po:i[vo]<0||i[vo]>999?vo:-1,f(e)._overflowDayOfYear&&(tuo)&&(t=uo),f(e)._overflowWeeks&&-1===t&&(t=go),f(e)._overflowWeekday&&-1===t&&(t=yo),f(e).overflow=t),e}function st(e,t,i){return null!=e?e:null!=t?t:i}function rt(e){var i=new Date(t.now());return e._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function at(e){var t,i,n,o,s=[];if(!e._d){for(n=rt(e),e._w&&null==e._a[uo]&&null==e._a[lo]&&dt(e),null!=e._dayOfYear&&(o=st(e._a[ho],n[ho]),(e._dayOfYear>J(o)||0===e._dayOfYear)&&(f(e)._overflowDayOfYear=!0),i=_e(o,0,e._dayOfYear),e._a[lo]=i.getUTCMonth(),e._a[uo]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=n[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[co]&&0===e._a[fo]&&0===e._a[po]&&0===e._a[vo]&&(e._nextDay=!0,e._a[co]=0),e._d=(e._useUTC?_e:be).apply(null,s),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[co]=24),e._w&&void 0!==e._w.d&&e._w.d!==e._d.getDay()&&(f(e).weekdayMismatch=!0)}}function dt(e){var t,i,n,o,s,r,a,d;if(t=e._w,null!=t.GG||null!=t.W||null!=t.E)s=1,r=4,i=st(t.GG,e._a[ho],xe(Mt(),1,4).year),n=st(t.W,1),((o=st(t.E,1))<1||o>7)&&(d=!0);else{s=e._locale._week.dow,r=e._locale._week.doy;var h=xe(Mt(),s,r);i=st(t.gg,e._a[ho],h.year),n=st(t.w,h.week),null!=t.d?((o=t.d)<0||o>6)&&(d=!0):null!=t.e?(o=t.e+s,(t.e<0||t.e>6)&&(d=!0)):o=s}n<1||n>Oe(i,s,r)?f(e)._overflowWeeks=!0:null!=d?f(e)._overflowWeekday=!0:(a=ke(i,n,o,s,r),e._a[ho]=a.year,e._dayOfYear=a.dayOfYear)}function ht(e){var t,i,n,o,s,r,a=e._i,d=Ao.exec(a)||jo.exec(a);if(d){for(f(e).iso=!0,t=0,i=Ho.length;t0&&f(e).unusedInput.push(r),a=a.slice(a.indexOf(n)+n.length),h+=n.length),Wn[s]?(n?f(e).empty=!1:f(e).unusedTokens.push(s),Q(s,n,e)):e._strict&&!n&&f(e).unusedTokens.push(s);f(e).charsLeftOver=d-h,a.length>0&&f(e).unusedInput.push(a),e._a[co]<=12&&!0===f(e).bigHour&&e._a[co]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[co]=mt(e._locale,e._a[co],e._meridiem),at(e),ot(e)}function mt(e,t,i){var n;return null==i?t:null!=e.meridiemHour?e.meridiemHour(t,i):null!=e.isPM?(n=e.isPM(i),n&&t<12&&(t+=12),n||12!==t||(t=0),t):t}function bt(e){var t,i,n,o,s;if(0===e._f.length)return f(e).invalidFormat=!0,void(e._d=new Date(NaN));for(o=0;othis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function qt(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e={};if(g(e,this),e=kt(e),e._a){var t=e._isUTC?u(e._a):Mt(e._a);this._isDSTShifted=this.isValid()&&w(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Gt(){return!!this.isValid()&&!this._isUTC}function Xt(){return!!this.isValid()&&this._isUTC}function Kt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Zt(e,t){var i,n,o,s=e,a=null;return Ft(e)?s={ms:e._milliseconds,d:e._days,M:e._months}:r(e)?(s={},t?s[t]=e:s.milliseconds=e):(a=$o.exec(e))?(i="-"===a[1]?-1:1,s={y:0,d:_(a[uo])*i,h:_(a[co])*i,m:_(a[fo])*i,s:_(a[po])*i,ms:_(Nt(1e3*a[vo]))*i}):(a=Qo.exec(e))?(i="-"===a[1]?-1:(a[1],1),s={y:$t(a[2],i),M:$t(a[3],i),w:$t(a[4],i),d:$t(a[5],i),h:$t(a[6],i),m:$t(a[7],i),s:$t(a[8],i)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(o=Jt(Mt(s.from),Mt(s.to)),s={},s.ms=o.milliseconds,s.M=o.months),n=new It(s),Ft(e)&&h(e,"_locale")&&(n._locale=e._locale),n}function $t(e,t){var i=e&&parseFloat(e.replace(",","."));return(isNaN(i)?0:i)*t}function Qt(e,t){var i={milliseconds:0,months:0};return i.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+e.clone().add(i.months,"M"),i}function Jt(e,t){var i;return e.isValid()&&t.isValid()?(t=Rt(t,e),e.isBefore(t)?i=Qt(e,t):(i=Qt(t,e),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function ei(e,t){return function(i,n){var o,s;return null===n||isNaN(+n)||(O(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=i,i=n,n=s),i="string"==typeof i?+i:i,o=Zt(i,n),ti(this,o,e),this}}function ti(e,i,n,o){var s=i._milliseconds,r=Nt(i._days),a=Nt(i._months);e.isValid()&&(o=null==o||o,a&&fe(e,ne(e,"Month")+a*n),r&&oe(e,"Date",ne(e,"Date")+r*n),s&&e._d.setTime(e._d.valueOf()+s*n),o&&t.updateOffset(e,r||a))}function ii(e,t){var i=e.diff(t,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"}function ni(e,i){var n=e||Mt(),o=Rt(n,this).startOf("day"),s=t.calendarFormat(this,o)||"sameElse",r=i&&(M(i[s])?i[s].call(this,n):i[s]);return this.format(r||this.localeData().calendar(s,this,Mt(n)))}function oi(){return new y(this)}function si(e,t){var i=m(e)?e:Mt(e);return!(!this.isValid()||!i.isValid())&&(t=z(s(t)?"millisecond":t),"millisecond"===t?this.valueOf()>i.valueOf():i.valueOf()9999?V(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):M(Date.prototype.toISOString)?this.toDate().toISOString():V(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function vi(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var i="["+e+'("]',n=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",o=t+'[")]';return this.format(i+n+"-MM-DD[T]HH:mm:ss.SSS"+o)}function gi(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var i=V(this,e);return this.localeData().postformat(i)}function yi(e,t){return this.isValid()&&(m(e)&&e.isValid()||Mt(e).isValid())?Zt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function mi(e){return this.from(Mt(),e)}function bi(e,t){return this.isValid()&&(m(e)&&e.isValid()||Mt(e).isValid())?Zt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function _i(e){return this.to(Mt(),e)}function wi(e){var t;return void 0===e?this._locale._abbr:(t=it(e),null!=t&&(this._locale=t),this)}function ki(){return this._locale}function xi(e){switch(e=z(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this}function Oi(e){return void 0===(e=z(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))}function Mi(){return this._d.valueOf()-6e4*(this._offset||0)}function Ei(){return Math.floor(this.valueOf()/1e3)}function Si(){return new Date(this.valueOf())}function Di(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Ci(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Ti(){return this.isValid()?this.toISOString():null}function Pi(){return p(this)}function Ii(){return l({},f(this))}function Fi(){return f(this).overflow}function Ni(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Bi(e,t){H(0,[e,e.length],0,t)}function zi(e){return Li.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Ri(e){return Li.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function Ai(){return Oe(this.year(),1,4)}function ji(){var e=this.localeData()._week;return Oe(this.year(),e.dow,e.doy)}function Li(e,t,i,n,o){var s;return null==e?xe(this,n,o).year:(s=Oe(e,n,o),t>s&&(t=s),Hi.call(this,e,t,i,n,o))}function Hi(e,t,i,n,o){var s=ke(e,t,i,n,o),r=_e(s.year,0,s.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}function Wi(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function Yi(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function Vi(e,t){t[vo]=_(1e3*("0."+e))}function Ui(){return this._isUTC?"UTC":""}function qi(){return this._isUTC?"Coordinated Universal Time":""}function Gi(e){return Mt(1e3*e)}function Xi(){return Mt.apply(null,arguments).parseZone()}function Ki(e){return e}function Zi(e,t,i,n){var o=it(),s=u().set(n,t);return o[i](s,e)}function $i(e,t,i){if(r(e)&&(t=e,e=void 0),e=e||"",null!=t)return Zi(e,t,i,"month");var n,o=[];for(n=0;n<12;n++)o[n]=Zi(e,n,i,"month");return o}function Qi(e,t,i,n){"boolean"==typeof e?(r(t)&&(i=t,t=void 0),t=t||""):(t=e,i=t,e=!1,r(t)&&(i=t,t=void 0),t=t||"");var o=it(),s=e?o._week.dow:0;if(null!=i)return Zi(t,(i+s)%7,n,"day");var a,d=[];for(a=0;a<7;a++)d[a]=Zi(t,(a+s)%7,n,"day");return d}function Ji(e,t){return $i(e,t,"months")}function en(e,t){return $i(e,t,"monthsShort")}function tn(e,t,i){return Qi(e,t,i,"weekdays")}function nn(e,t,i){return Qi(e,t,i,"weekdaysShort")}function on(e,t,i){return Qi(e,t,i,"weekdaysMin")}function sn(){var e=this._data;return this._milliseconds=hs(this._milliseconds),this._days=hs(this._days),this._months=hs(this._months),e.milliseconds=hs(e.milliseconds),e.seconds=hs(e.seconds),e.minutes=hs(e.minutes),e.hours=hs(e.hours),e.months=hs(e.months),e.years=hs(e.years),this}function rn(e,t,i,n){var o=Zt(t,i);return e._milliseconds+=n*o._milliseconds,e._days+=n*o._days,e._months+=n*o._months,e._bubble()}function an(e,t){return rn(this,e,t,1)}function dn(e,t){return rn(this,e,t,-1)}function hn(e){return e<0?Math.floor(e):Math.ceil(e)}function ln(){var e,t,i,n,o,s=this._milliseconds,r=this._days,a=this._months,d=this._data;return s>=0&&r>=0&&a>=0||s<=0&&r<=0&&a<=0||(s+=864e5*hn(cn(a)+r),r=0,a=0),d.milliseconds=s%1e3,e=b(s/1e3),d.seconds=e%60,t=b(e/60),d.minutes=t%60,i=b(t/60),d.hours=i%24,r+=b(i/24),o=b(un(r)),a+=o,r-=hn(cn(o)),n=b(a/12),a%=12,d.days=r,d.months=a,d.years=n,this}function un(e){return 4800*e/146097}function cn(e){return 146097*e/4800}function fn(e){if(!this.isValid())return NaN;var t,i,n=this._milliseconds;if("month"===(e=z(e))||"year"===e)return t=this._days+n/864e5,i=this._months+un(t),"month"===e?i:i/12;switch(t=this._days+Math.round(cn(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw new Error("Unknown unit "+e)}}function pn(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12):NaN}function vn(e){return function(){return this.as(e)}}function gn(){return Zt(this)}function yn(e){return e=z(e),this.isValid()?this[e+"s"]():NaN}function mn(e){return function(){return this.isValid()?this._data[e]:NaN}}function bn(){return b(this.days()/7)}function _n(e,t,i,n,o){return o.relativeTime(t||1,!!i,e,n)}function wn(e,t,i){var n=Zt(e).abs(),o=Ms(n.as("s")),s=Ms(n.as("m")),r=Ms(n.as("h")),a=Ms(n.as("d")),d=Ms(n.as("M")),h=Ms(n.as("y")),l=o<=Es.ss&&["s",o]||o0,l[4]=i,_n.apply(null,l)}function kn(e){return void 0===e?Ms:"function"==typeof e&&(Ms=e,!0)}function xn(e,t){return void 0!==Es[e]&&(void 0===t?Es[e]:(Es[e]=t,"s"===e&&(Es.ss=t-1),!0))}function On(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),i=wn(this,!e,t);return e&&(i=t.pastFuture(+this,i)),t.postformat(i)}function Mn(e){return(e>0)-(e<0)||+e}function En(){if(!this.isValid())return this.localeData().invalidDate();var e,t,i,n=Ss(this._milliseconds)/1e3,o=Ss(this._days),s=Ss(this._months);e=b(n/60),t=b(e/60),n%=60,e%=60,i=b(s/12),s%=12;var r=i,a=s,d=o,h=t,l=e,u=n?n.toFixed(3).replace(/\.?0+$/,""):"",c=this.asSeconds();if(!c)return"P0D";var f=c<0?"-":"",p=Mn(this._months)!==Mn(c)?"-":"",v=Mn(this._days)!==Mn(c)?"-":"",g=Mn(this._milliseconds)!==Mn(c)?"-":"";return f+"P"+(r?p+r+"Y":"")+(a?p+a+"M":"")+(d?v+d+"D":"")+(h||l||u?"T":"")+(h?g+h+"H":"")+(l?g+l+"M":"")+(u?g+u+"S":"")}var Sn,Dn;Dn=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),i=t.length>>>0,n=0;n68?1900:2e3)};var mo,bo=ie("FullYear",!0);mo=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;tthis?this:e:v()}),Xo=function(){return Date.now?Date.now():+new Date},Ko=["year","quarter","month","week","day","hour","minute","second","millisecond"];Bt("Z",":"),Bt("ZZ",""),q("Z",no),q("ZZ",no),Z(["Z","ZZ"],function(e,t,i){i._useUTC=!0,i._tzm=zt(no,e)});var Zo=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var $o=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Qo=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;Zt.fn=It.prototype,Zt.invalid=Pt;var Jo=ei(1,"add"),es=ei(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var ts=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});H(0,["gg",2],0,function(){return this.weekYear()%100}),H(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Bi("gggg","weekYear"),Bi("ggggg","weekYear"),Bi("GGGG","isoWeekYear"),Bi("GGGGG","isoWeekYear"),B("weekYear","gg"),B("isoWeekYear","GG"),A("weekYear",1),A("isoWeekYear",1),q("G",to),q("g",to),q("GG",Xn,Vn),q("gg",Xn,Vn),q("GGGG",Qn,qn),q("gggg",Qn,qn),q("GGGGG",Jn,Gn),q("ggggg",Jn,Gn),$(["gggg","ggggg","GGGG","GGGGG"],function(e,t,i,n){t[n.substr(0,2)]=_(e)}),$(["gg","GG"],function(e,i,n,o){i[o]=t.parseTwoDigitYear(e)}),H("Q",0,"Qo","quarter"),B("quarter","Q"),A("quarter",7),q("Q",Yn),Z("Q",function(e,t){t[lo]=3*(_(e)-1)}),H("D",["DD",2],"Do","date"),B("date","D"),A("date",9),q("D",Xn),q("DD",Xn,Vn),q("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),Z(["D","DD"],uo),Z("Do",function(e,t){t[uo]=_(e.match(Xn)[0],10)});var is=ie("Date",!0);H("DDD",["DDDD",3],"DDDo","dayOfYear"),B("dayOfYear","DDD"),A("dayOfYear",4),q("DDD",$n),q("DDDD",Un),Z(["DDD","DDDD"],function(e,t,i){i._dayOfYear=_(e)}),H("m",["mm",2],0,"minute"),B("minute","m"),A("minute",14),q("m",Xn),q("mm",Xn,Vn),Z(["m","mm"],fo);var ns=ie("Minutes",!1);H("s",["ss",2],0,"second"),B("second","s"),A("second",15),q("s",Xn),q("ss",Xn,Vn),Z(["s","ss"],po);var os=ie("Seconds",!1);H("S",0,0,function(){return~~(this.millisecond()/100)}),H(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),H(0,["SSS",3],0,"millisecond"),H(0,["SSSS",4],0,function(){return 10*this.millisecond()}),H(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),H(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),H(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),H(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),H(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),B("millisecond","ms"),A("millisecond",16),q("S",$n,Yn),q("SS",$n,Vn),q("SSS",$n,Un);var ss;for(ss="SSSS";ss.length<=9;ss+="S")q(ss,eo);for(ss="S";ss.length<=9;ss+="S")Z(ss,Vi);var rs=ie("Milliseconds",!1);H("z",0,0,"zoneAbbr"),H("zz",0,0,"zoneName");var as=y.prototype;as.add=Jo,as.calendar=ni,as.clone=oi,as.diff=ui,as.endOf=Oi,as.format=gi,as.from=yi,as.fromNow=mi,as.to=bi,as.toNow=_i,as.get=se,as.invalidAt=Fi,as.isAfter=si,as.isBefore=ri,as.isBetween=ai,as.isSame=di,as.isSameOrAfter=hi,as.isSameOrBefore=li,as.isValid=Pi,as.lang=ts,as.locale=wi,as.localeData=ki,as.max=Go,as.min=qo,as.parsingFlags=Ii,as.set=re,as.startOf=xi,as.subtract=es,as.toArray=Di,as.toObject=Ci,as.toDate=Si,as.toISOString=pi,as.inspect=vi,as.toJSON=Ti,as.toString=fi,as.unix=Ei,as.valueOf=Mi,as.creationData=Ni,as.year=bo,as.isLeapYear=te,as.weekYear=zi,as.isoWeekYear=Ri,as.quarter=as.quarters=Wi,as.month=pe,as.daysInMonth=ve,as.week=as.weeks=De,as.isoWeek=as.isoWeeks=Ce,as.weeksInYear=ji,as.isoWeeksInYear=Ai,as.date=is,as.day=as.days=Re,as.weekday=Ae,as.isoWeekday=je,as.dayOfYear=Yi,as.hour=as.hours=No,as.minute=as.minutes=ns,as.second=as.seconds=os,as.millisecond=as.milliseconds=rs,as.utcOffset=jt,as.utc=Ht,as.local=Wt,as.parseZone=Yt,as.hasAlignedHourOffset=Vt,as.isDST=Ut,as.isLocal=Gt,as.isUtcOffset=Xt,as.isUtc=Kt,as.isUTC=Kt,as.zoneAbbr=Ui,as.zoneName=qi,as.dates=x("dates accessor is deprecated. Use date instead.",is),as.months=x("months accessor is deprecated. Use month instead",pe),as.years=x("years accessor is deprecated. Use year instead",bo),as.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Lt),as.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",qt);var ds=D.prototype;ds.calendar=C,ds.longDateFormat=T,ds.invalidDate=P,ds.ordinal=I,ds.preparse=Ki,ds.postformat=Ki,ds.relativeTime=F,ds.pastFuture=N,ds.set=E,ds.months=he,ds.monthsShort=le,ds.monthsParse=ce,ds.monthsRegex=ye,ds.monthsShortRegex=ge,ds.week=Me,ds.firstDayOfYear=Se,ds.firstDayOfWeek=Ee,ds.weekdays=Ie,ds.weekdaysMin=Ne,ds.weekdaysShort=Fe,ds.weekdaysParse=ze,ds.weekdaysRegex=Le,ds.weekdaysShortRegex=He,ds.weekdaysMinRegex=We,ds.isPM=Xe,ds.meridiem=Ke,Je("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===_(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),t.lang=x("moment.lang is deprecated. Use moment.locale instead.",Je),t.langData=x("moment.langData is deprecated. Use moment.localeData instead.",it);var hs=Math.abs,ls=vn("ms"),us=vn("s"),cs=vn("m"),fs=vn("h"),ps=vn("d"),vs=vn("w"),gs=vn("M"),ys=vn("y"),ms=mn("milliseconds"),bs=mn("seconds"),_s=mn("minutes"),ws=mn("hours"),ks=mn("days"),xs=mn("months"),Os=mn("years"),Ms=Math.round,Es={ss:44,s:45,m:45,h:22,d:26,M:11},Ss=Math.abs,Ds=It.prototype;return Ds.isValid=Tt,Ds.abs=sn,Ds.add=an,Ds.subtract=dn,Ds.as=fn,Ds.asMilliseconds=ls,Ds.asSeconds=us,Ds.asMinutes=cs,Ds.asHours=fs,Ds.asDays=ps,Ds.asWeeks=vs,Ds.asMonths=gs,Ds.asYears=ys,Ds.valueOf=pn,Ds._bubble=ln,Ds.clone=gn,Ds.get=yn,Ds.milliseconds=ms,Ds.seconds=bs,Ds.minutes=_s,Ds.hours=ws,Ds.days=ks,Ds.weeks=bn,Ds.months=xs,Ds.years=Os,Ds.humanize=On,Ds.toISOString=En,Ds.toString=En,Ds.toJSON=En,Ds.locale=wi,Ds.localeData=ki,Ds.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",En),Ds.lang=ts,H("X",0,0,"unix"),H("x",0,0,"valueOf"),q("x",to),q("X",oo),Z("X",function(e,t,i){i._d=new Date(1e3*parseFloat(e,10))}),Z("x",function(e,t,i){i._d=new Date(_(e))}),t.version="2.19.1",function(e){Sn=e}(Mt),t.fn=as,t.min=St,t.max=Dt,t.now=Xo,t.utc=u,t.unix=Gi,t.months=Ji,t.isDate=a,t.locale=Je,t.invalid=v,t.duration=Zt,t.isMoment=m,t.weekdays=tn,t.parseZone=Xi,t.localeData=it,t.isDuration=Ft,t.monthsShort=en,t.weekdaysMin=on,t.defineLocale=et,t.updateLocale=tt,t.locales=nt,t.weekdaysShort=nn,t.normalizeUnits=z,t.relativeTimeRounding=kn,t.relativeTimeThreshold=xn,t.calendarFormat=ii,t.prototype=as,t})}).call(t,i(115)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t){function i(e){throw new Error("Cannot find module '"+e+"'.")}i.keys=function(){return[]},i.resolve=i,e.exports=i,i.id=116},function(e,t,i){(function(t){function i(e,t,i){var n=t&&i||0,o=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){o<16&&(t[n+o++]=u[e])});o<16;)t[n+o++]=0;return t}function n(e,t){var i=t||0,n=l;return n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+"-"+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]+n[e[i++]]}function o(e,t,i){var o=t&&i||0,s=t||[];e=e||{};var r=void 0!==e.clockseq?e.clockseq:v,a=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:y+1,h=a-g+(d-y)/1e4;if(h<0&&void 0===e.clockseq&&(r=r+1&16383),(h<0||a>g)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");g=a,y=d,v=r,a+=122192928e5;var l=(1e4*(268435455&a)+d)%4294967296;s[o++]=l>>>24&255,s[o++]=l>>>16&255,s[o++]=l>>>8&255,s[o++]=255&l;var u=a/4294967296*1e4&268435455;s[o++]=u>>>8&255,s[o++]=255&u,s[o++]=u>>>24&15|16,s[o++]=u>>>16&255,s[o++]=r>>>8|128,s[o++]=255&r;for(var c=e.node||p,f=0;f<6;f++)s[o+f]=c[f];return t||n(s)}function s(e,t,i){var o=t&&i||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null),e=e||{};var s=e.random||(e.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var a=0;a<16;a++)t[o+a]=s[a];return t||n(s)}var r,a="undefined"!=typeof window?window:void 0!==t?t:null;if(a&&a.crypto&&crypto.getRandomValues){var d=new Uint8Array(16);r=function(){return crypto.getRandomValues(d),d}}if(!r){var h=new Array(16);r=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),h[t]=e>>>((3&t)<<3)&255;return h}}for(var l=[],u={},c=0;c<256;c++)l[c]=(c+256).toString(16).substr(1),u[l[c]]=c;var f=r(),p=[1|f[0],f[1],f[2],f[3],f[4],f[5]],v=16383&(f[6]<<8|f[7]),g=0,y=0,m=s;m.v1=o,m.v4=s,m.parse=i,m.unparse=n,e.exports=m}).call(t,i(118))},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){t.prepareElements=function(e){for(var t in e)e.hasOwnProperty(t)&&(e[t].redundant=e[t].used,e[t].used=[])},t.cleanupElements=function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t].redundant){for(var i=0;i0?(n=t[e].redundant[0],t[e].redundant.shift()):(n=document.createElementNS("http://www.w3.org/2000/svg",e),i.appendChild(n)):(n=document.createElementNS("http://www.w3.org/2000/svg",e),t[e]={used:[],redundant:[]},i.appendChild(n)),t[e].used.push(n),n},t.getDOMElement=function(e,t,i,n){var o;return t.hasOwnProperty(e)?t[e].redundant.length>0?(o=t[e].redundant[0],t[e].redundant.shift()):(o=document.createElement(e),void 0!==n?i.insertBefore(o,n):i.appendChild(o)):(o=document.createElement(e),t[e]={used:[],redundant:[]},void 0!==n?i.insertBefore(o,n):i.appendChild(o)),t[e].used.push(o),o},t.drawPoint=function(e,i,n,o,s,r){var a;if("circle"==n.style?(a=t.getSVGElement("circle",o,s),a.setAttributeNS(null,"cx",e),a.setAttributeNS(null,"cy",i),a.setAttributeNS(null,"r",.5*n.size)):(a=t.getSVGElement("rect",o,s),a.setAttributeNS(null,"x",e-.5*n.size),a.setAttributeNS(null,"y",i-.5*n.size),a.setAttributeNS(null,"width",n.size),a.setAttributeNS(null,"height",n.size)),void 0!==n.styles&&a.setAttributeNS(null,"style",n.styles),a.setAttributeNS(null,"class",n.className+" vis-point"),r){var d=t.getSVGElement("text",o,s);r.xOffset&&(e+=r.xOffset),r.yOffset&&(i+=r.yOffset),r.content&&(d.textContent=r.content),r.className&&d.setAttributeNS(null,"class",r.className+" vis-label"),d.setAttributeNS(null,"x",e),d.setAttributeNS(null,"y",i)}return a},t.drawBar=function(e,i,n,o,s,r,a,d){if(0!=o){o<0&&(o*=-1,i-=o);var h=t.getSVGElement("rect",r,a);h.setAttributeNS(null,"x",e-.5*n),h.setAttributeNS(null,"y",i),h.setAttributeNS(null,"width",n),h.setAttributeNS(null,"height",o),h.setAttributeNS(null,"class",s),d&&h.setAttributeNS(null,"style",d)}}},function(e,t,i){var n=i(6),o=n.JSON||(n.JSON={stringify:JSON.stringify});e.exports=function(e){return o.stringify.apply(o,arguments)}},function(e,t,i){function n(e,t,i){var o=this;if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this.options={},this.defaultOptions={locale:"en",locales:h,clickToUse:!1},s.extend(this.options,this.defaultOptions),this.body={container:e,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this),once:this.once.bind(this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}}},this.bindEventListeners(),this.images=new l(function(){return o.body.emitter.emit("_requestRedraw")}),this.groups=new u,this.canvas=new y(this.body),this.selectionHandler=new _(this.body,this.canvas),this.interactionHandler=new b(this.body,this.canvas,this.selectionHandler),this.view=new m(this.body,this.canvas),this.renderer=new g(this.body,this.canvas),this.physics=new p(this.body),this.layoutEngine=new w(this.body),this.clustering=new v(this.body),this.manipulation=new k(this.body,this.canvas,this.selectionHandler),this.nodesHandler=new c(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new f(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new T(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(i),this.setData(t)}i(122);var o=i(73),s=i(5),r=i(74),a=i(75),d=i(123),h=i(126),l=i(76).default,u=i(131).default,c=i(132).default,f=i(163).default,p=i(169).default,v=i(176).default,g=i(178).default,y=i(179).default,m=i(180).default,b=i(181).default,_=i(184).default,w=i(185).default,k=i(187).default,x=i(188).default,O=i(54).default,M=i(54),E=M.printStyle,S=i(82),D=S.allOptions,C=S.configureOptions,T=i(190).default;o(n.prototype),n.prototype.setOptions=function(e){var t=this;if(void 0!==e){!0===O.validate(e,D)&&console.log("%cErrors have been found in the supplied options object.",E);var i=["locale","locales","clickToUse"];if(s.selectiveDeepExtend(i,this.options,e),e=this.layoutEngine.setOptions(e.layout,e),this.canvas.setOptions(e),this.groups.setOptions(e.groups),this.nodesHandler.setOptions(e.nodes),this.edgesHandler.setOptions(e.edges),this.physics.setOptions(e.physics),this.manipulation.setOptions(e.manipulation,e,this.options),this.interactionHandler.setOptions(e.interaction),this.renderer.setOptions(e.interaction),this.selectionHandler.setOptions(e.interaction),void 0!==e.groups&&this.body.emitter.emit("refreshNodes"),"configure"in e&&(this.configurator||(this.configurator=new x(this,this.body.container,C,this.canvas.pixelRatio)),this.configurator.setOptions(e.configure)),this.configurator&&!0===this.configurator.options.enabled){var n={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};s.deepExtend(n.nodes,this.nodesHandler.options),s.deepExtend(n.edges,this.edgesHandler.options),s.deepExtend(n.layout,this.layoutEngine.options),s.deepExtend(n.interaction,this.selectionHandler.options),s.deepExtend(n.interaction,this.renderer.options),s.deepExtend(n.interaction,this.interactionHandler.options),s.deepExtend(n.manipulation,this.manipulation.options),s.deepExtend(n.physics,this.physics.options),s.deepExtend(n.global,this.canvas.options),s.deepExtend(n.global,this.options),this.configurator.setModuleOptions(n)}void 0!==e.clickToUse?!0===e.clickToUse?void 0===this.activator&&(this.activator=new d(this.canvas.frame),this.activator.on("change",function(){t.body.emitter.emit("activate")})):(void 0!==this.activator&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},n.prototype._updateVisibleIndices=function(){var e=this.body.nodes,t=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(var i in e)e.hasOwnProperty(i)&&(this.clustering._isClusteredNode(i)||!1!==e[i].options.hidden||this.body.nodeIndices.push(e[i].id));for(var n in t)if(t.hasOwnProperty(n)){var o=t[n],s=e[o.fromId],r=e[o.toId],a=void 0!==s&&void 0!==r,d=!this.clustering._isClusteredEdge(n)&&!1===o.options.hidden&&a&&!1===s.options.hidden&&!1===r.options.hidden;d&&this.body.edgeIndices.push(o.id)}},n.prototype.bindEventListeners=function(){var e=this;this.body.emitter.on("_dataChanged",function(){e.edgesHandler._updateState(),e.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",function(){e.clustering._updateState(),e._updateVisibleIndices(),e._updateValueRange(e.body.nodes),e._updateValueRange(e.body.edges),e.body.emitter.emit("startSimulation"),e.body.emitter.emit("_requestRedraw")})},n.prototype.setData=function(e){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),e&&e.dot&&(e.nodes||e.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(e&&e.options),e&&e.dot){console.log("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");var t=r.DOTToGraph(e.dot);return void this.setData(t)}if(e&&e.gephi){console.log("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");var i=a.parseGephi(e.gephi);return void this.setData(i)}this.nodesHandler.setData(e&&e.nodes,!0),this.edgesHandler.setData(e&&e.edges,!0),this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},n.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(var e in this.body.nodes)this.body.nodes.hasOwnProperty(e)&&delete this.body.nodes[e];for(var t in this.body.edges)this.body.edges.hasOwnProperty(t)&&delete this.body.edges[t];s.recursiveDOMDelete(this.body.container)},n.prototype._updateValueRange=function(e){var t,i=void 0,n=void 0,o=0;for(t in e)if(e.hasOwnProperty(t)){var s=e[t].getValue();void 0!==s&&(i=void 0===i?s:Math.min(s,i),n=void 0===n?s:Math.max(s,n),o+=s)}if(void 0!==i&&void 0!==n)for(t in e)e.hasOwnProperty(t)&&e[t].setValueRange(i,n,o)},n.prototype.isActive=function(){return!this.activator||this.activator.active},n.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},n.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},n.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},n.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},n.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},n.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},n.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},n.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},n.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},n.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},n.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},n.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},n.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},n.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},n.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},n.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},n.prototype.editNodeMode=function(){return console.log("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},n.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},n.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},n.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},n.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},n.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},n.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},n.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},n.prototype.getConnectedNodes=function(e){return void 0!==this.body.nodes[e]?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},n.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},n.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},n.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},n.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},n.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},n.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},n.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler,arguments)},n.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler,arguments)},n.prototype.getNodeAt=function(){var e=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},n.prototype.getEdgeAt=function(){var e=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return void 0!==e&&void 0!==e.id?e.id:e},n.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},n.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},n.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.redraw()},n.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},n.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},n.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},n.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},n.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},n.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},n.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},n.prototype.getOptionsFromConfigurator=function(){var e={};return this.configurator&&(e=this.configurator.getOptions.apply(this.configurator)),e},e.exports=n},function(e,t,i){"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.circle=function(e,t,i){this.beginPath(),this.arc(e,t,i,0,2*Math.PI,!1),this.closePath()},CanvasRenderingContext2D.prototype.square=function(e,t,i){this.beginPath(),this.rect(e-i,t-i,2*i,2*i),this.closePath()},CanvasRenderingContext2D.prototype.triangle=function(e,t,i){this.beginPath(),i*=1.15,t+=.275*i;var n=2*i,o=n/2,s=Math.sqrt(3)/6*n,r=Math.sqrt(n*n-o*o);this.moveTo(e,t-(r-s)),this.lineTo(e+o,t+s),this.lineTo(e-o,t+s),this.lineTo(e,t-(r-s)),this.closePath()},CanvasRenderingContext2D.prototype.triangleDown=function(e,t,i){this.beginPath(),i*=1.15,t-=.275*i;var n=2*i,o=n/2,s=Math.sqrt(3)/6*n,r=Math.sqrt(n*n-o*o);this.moveTo(e,t+(r-s)),this.lineTo(e+o,t-s),this.lineTo(e-o,t-s),this.lineTo(e,t+(r-s)),this.closePath()},CanvasRenderingContext2D.prototype.star=function(e,t,i){this.beginPath(),i*=.82,t+=.1*i;for(var n=0;n<10;n++){var o=n%2==0?1.3*i:.5*i;this.lineTo(e+o*Math.sin(2*n*Math.PI/10),t-o*Math.cos(2*n*Math.PI/10))}this.closePath()},CanvasRenderingContext2D.prototype.diamond=function(e,t,i){this.beginPath(),this.lineTo(e,t+i),this.lineTo(e+i,t),this.lineTo(e,t-i),this.lineTo(e-i,t),this.closePath()},CanvasRenderingContext2D.prototype.roundRect=function(e,t,i,n,o){var s=Math.PI/180;i-2*o<0&&(o=i/2),n-2*o<0&&(o=n/2),this.beginPath(),this.moveTo(e+o,t),this.lineTo(e+i-o,t),this.arc(e+i-o,t+o,o,270*s,360*s,!1),this.lineTo(e+i,t+n-o),this.arc(e+i-o,t+n-o,o,0,90*s,!1),this.lineTo(e+o,t+n),this.arc(e+o,t+n-o,o,90*s,180*s,!1),this.lineTo(e,t+o),this.arc(e+o,t+o,o,180*s,270*s,!1),this.closePath()},CanvasRenderingContext2D.prototype.ellipse_vis=function(e,t,i,n){var o=i/2*.5522848,s=n/2*.5522848,r=e+i,a=t+n,d=e+i/2,h=t+n/2;this.beginPath(),this.moveTo(e,h),this.bezierCurveTo(e,h-s,d-o,t,d,t),this.bezierCurveTo(d+o,t,r,h-s,r,h),this.bezierCurveTo(r,h+s,d+o,a,d,a),this.bezierCurveTo(d-o,a,e,h+s,e,h),this.closePath()},CanvasRenderingContext2D.prototype.database=function(e,t,i,n){var o=i,s=n*(1/3),r=o/2*.5522848,a=s/2*.5522848,d=e+o,h=t+s,l=e+o/2,u=t+s/2,c=t+(n-s/2),f=t+n;this.beginPath(),this.moveTo(d,u),this.bezierCurveTo(d,u+a,l+r,h,l,h),this.bezierCurveTo(l-r,h,e,u+a,e,u),this.bezierCurveTo(e,u-a,l-r,t,l,t),this.bezierCurveTo(l+r,t,d,u-a,d,u),this.lineTo(d,c),this.bezierCurveTo(d,c+a,l+r,f,l,f),this.bezierCurveTo(l-r,f,e,c+a,e,c),this.lineTo(e,u)},CanvasRenderingContext2D.prototype.dashedLine=function(e,t,i,n,o){this.beginPath(),this.moveTo(e,t);for(var s=o.length,r=i-e,a=n-t,d=a/r,h=Math.sqrt(r*r+a*a),l=0,u=!0,c=0,f=o[0];h>=.1;)f=o[l++%s],f>h&&(f=h),c=Math.sqrt(f*f/(1+d*d)),c=r<0?-c:c,e+=c,t+=d*c,!0===u?this.lineTo(e,t):this.moveTo(e,t),h-=f,u=!u},CanvasRenderingContext2D.prototype.hexagon=function(e,t,i){this.beginPath();var n=2*Math.PI/6;this.moveTo(e+i,t);for(var o=1;o<6;o++)this.lineTo(e+i*Math.cos(n*o),t+i*Math.sin(n*o));this.closePath()})},function(e,t,i){function n(e){this.active=!1,this.dom={container:e},this.dom.overlay=document.createElement("div"),this.dom.overlay.className="vis-overlay",this.dom.container.appendChild(this.dom.overlay),this.hammer=a(this.dom.overlay),this.hammer.on("tap",this._onTapOverlay.bind(this));var t=this;["tap","doubletap","press","pinch","pan","panstart","panmove","panend"].forEach(function(e){t.hammer.on(e,function(e){e.stopPropagation()})}),document&&document.body&&(this.onClick=function(i){o(i.target,e)||t.deactivate()},document.body.addEventListener("click",this.onClick)),void 0!==this.keycharm&&this.keycharm.destroy(),this.keycharm=s(),this.escListener=this.deactivate.bind(this)}function o(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}var s=i(52),r=i(73),a=i(22),d=i(5);r(n.prototype),n.current=null,n.prototype.destroy=function(){this.deactivate(),this.dom.overlay.parentNode.removeChild(this.dom.overlay),this.onClick&&document.body.removeEventListener("click",this.onClick),this.hammer.destroy(),this.hammer=null},n.prototype.activate=function(){n.current&&n.current.deactivate(),n.current=this,this.active=!0,this.dom.overlay.style.display="none",d.addClassName(this.dom.container,"vis-active"),this.emit("change"),this.emit("activate"),this.keycharm.bind("esc",this.escListener)},n.prototype.deactivate=function(){this.active=!1,this.dom.overlay.style.display="",d.removeClassName(this.dom.container,"vis-active"),this.keycharm.unbind("esc",this.escListener),this.emit("change"),this.emit("deactivate")},n.prototype._onTapOverlay=function(e){this.activate(),e.stopPropagation()},e.exports=n},function(e,t,i){var n,o,s;!function(i){o=[],n=i,void 0!==(s="function"==typeof n?n.apply(t,o):n)&&(e.exports=s)}(function(){var e=null;return function t(i,n){function o(e){return e.match(/[^ ]+/g)}function s(t){if("hammer.input"!==t.type){if(t.srcEvent._handled||(t.srcEvent._handled={}),t.srcEvent._handled[t.type])return;t.srcEvent._handled[t.type]=!0}var i=!1;t.stopPropagation=function(){i=!0};var n=t.srcEvent.stopPropagation.bind(t.srcEvent);"function"==typeof n&&(t.srcEvent.stopPropagation=function(){n(),t.stopPropagation()}),t.firstTarget=e;for(var o=e;o&&!i;){var s=o.hammer;if(s)for(var r,a=0;a0?h._handlers[e]=n:(i.off(e,s),delete h._handlers[e]))}),h},h.emit=function(t,n){e=n.target,i.emit(t,n)},h.destroy=function(){var e=i.element.hammer,t=e.indexOf(h);-1!==t&&e.splice(t,1),e.length||delete i.element.hammer,h._handlers={},i.destroy()},h}})},function(e,t,i){var n;/*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license */ +!function(o,s,r,a){function d(e,t,i){return setTimeout(f(e,i),t)}function h(e,t,i){return!!Array.isArray(e)&&(l(e,i[t],i),!0)}function l(e,t,i){var n;if(e)if(e.forEach)e.forEach(t,i);else if(e.length!==a)for(n=0;n\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=o.console&&(o.console.warn||o.console.log);return s&&s.call(o.console,n,i),e.apply(this,arguments)}}function c(e,t,i){var n,o=t.prototype;n=e.prototype=Object.create(o),n.constructor=e,n._super=o,i&&pe(n,i)}function f(e,t){return function(){return e.apply(t,arguments)}}function p(e,t){return typeof e==ye?e.apply(t?t[0]||a:a,t):e}function v(e,t){return e===a?t:e}function g(e,t,i){l(_(t),function(t){e.addEventListener(t,i,!1)})}function y(e,t,i){l(_(t),function(t){e.removeEventListener(t,i,!1)})}function m(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function b(e,t){return e.indexOf(t)>-1}function _(e){return e.trim().split(/\s+/g)}function w(e,t,i){if(e.indexOf&&!i)return e.indexOf(t);for(var n=0;ni[t]}):n.sort()),n}function O(e,t){for(var i,n,o=t[0].toUpperCase()+t.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=F(t):1===o&&(i.firstMultiple=!1);var s=i.firstInput,r=i.firstMultiple,a=r?r.center:s.center,d=t.center=N(n);t.timeStamp=_e(),t.deltaTime=t.timeStamp-s.timeStamp,t.angle=A(a,d),t.distance=R(a,d),P(i,t),t.offsetDirection=z(t.deltaX,t.deltaY);var h=B(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=be(h.x)>be(h.y)?h.x:h.y,t.scale=r?L(r.pointers,n):1,t.rotation=r?j(r.pointers,n):0,t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length,I(i,t);var l=e.element;m(t.srcEvent.target,l)&&(l=t.srcEvent.target),t.target=l}function P(e,t){var i=t.center,n=e.offsetDelta||{},o=e.prevDelta||{},s=e.prevInput||{};t.eventType!==Ce&&s.eventType!==Pe||(o=e.prevDelta={x:s.deltaX||0,y:s.deltaY||0},n=e.offsetDelta={x:i.x,y:i.y}),t.deltaX=o.x+(i.x-n.x),t.deltaY=o.y+(i.y-n.y)}function I(e,t){var i,n,o,s,r=e.lastInterval||t,d=t.timeStamp-r.timeStamp;if(t.eventType!=Ie&&(d>De||r.velocity===a)){var h=t.deltaX-r.deltaX,l=t.deltaY-r.deltaY,u=B(d,h,l);n=u.x,o=u.y,i=be(u.x)>be(u.y)?u.x:u.y,s=z(h,l),e.lastInterval=t}else i=r.velocity,n=r.velocityX,o=r.velocityY,s=r.direction;t.velocity=i,t.velocityX=n,t.velocityY=o,t.direction=s}function F(e){for(var t=[],i=0;i=be(t)?e<0?Ne:Be:t<0?ze:Re}function R(e,t,i){i||(i=He);var n=t[i[0]]-e[i[0]],o=t[i[1]]-e[i[1]];return Math.sqrt(n*n+o*o)}function A(e,t,i){i||(i=He);var n=t[i[0]]-e[i[0]],o=t[i[1]]-e[i[1]];return 180*Math.atan2(o,n)/Math.PI}function j(e,t){return A(t[1],t[0],We)+A(e[1],e[0],We)}function L(e,t){return R(t[0],t[1],We)/R(e[0],e[1],We)}function H(){this.evEl=Ve,this.evWin=Ue,this.pressed=!1,S.apply(this,arguments)}function W(){this.evEl=Xe,this.evWin=Ke,S.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function Y(){this.evTarget=$e,this.evWin=Qe,this.started=!1,S.apply(this,arguments)}function V(e,t){var i=k(e.touches),n=k(e.changedTouches);return t&(Pe|Ie)&&(i=x(i.concat(n),"identifier",!0)),[i,n]}function U(){this.evTarget=et,this.targetIds={},S.apply(this,arguments)}function q(e,t){var i=k(e.touches),n=this.targetIds;if(t&(Ce|Te)&&1===i.length)return n[i[0].identifier]=!0,[i,i];var o,s,r=k(e.changedTouches),a=[],d=this.target;if(s=i.filter(function(e){return m(e.target,d)}),t===Ce)for(o=0;o-1&&n.splice(e,1)};setTimeout(o,tt)}}function Z(e){for(var t=e.srcEvent.clientX,i=e.srcEvent.clientY,n=0;n-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){i.manager.emit(t,e)}var i=this,n=this.state;n=pt&&t(i.options.event+ee(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;et.threshold&&o&t.direction},attrTest:function(e){return ne.prototype.attrTest.call(this,e)&&(this.state&ct||!(this.state&ct)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=te(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),c(se,ne,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[at]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ct)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),c(re,J,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[st]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distancet.time;if(this._input=e,!n||!i||e.eventType&(Pe|Ie)&&!o)this.reset();else if(e.eventType&Ce)this.reset(),this._timer=d(function(){this.state=vt,this.tryEmit()},t.time,this);else if(e.eventType&Pe)return vt;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===vt&&(e&&e.eventType&Pe?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=_e(),this.manager.emit(this.options.event,this._input)))}}),c(ae,ne,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[at]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ct)}}),c(de,ne,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ae|je,pointers:1},getTouchAction:function(){return oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,i=this.options.direction;return i&(Ae|je)?t=e.overallVelocity:i&Ae?t=e.overallVelocityX:i&je&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&i&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&be(t)>this.options.velocity&&e.eventType&Pe},emit:function(e){var t=te(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),c(he,J,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[rt]},process:function(e){var t=this.options,i=e.pointers.length===t.pointers,n=e.distance2){t*=.5;for(var r=0;t>2&&r=this.NUM_ITERATIONS&&(r=this.NUM_ITERATIONS-1);var a=this.coordinates[r];e.drawImage(this.canvas,a[0],a[1],a[2],a[3],i,n,o,s)}else e.drawImage(this.image,i,n,o,s)}}]),e}();t.default=d},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=i(5),h=function(){function e(){(0,s.default)(this,e),this.clear(),this.defaultIndex=0,this.groupsArray=[],this.groupIndex=0,this.defaultGroups=[{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},{border:"#FFA500",background:"#FFFF00",highlight:{border:"#FFA500",background:"#FFFFA3"},hover:{border:"#FFA500",background:"#FFFFA3"}},{border:"#FA0A10",background:"#FB7E81",highlight:{border:"#FA0A10",background:"#FFAFB1"},hover:{border:"#FA0A10",background:"#FFAFB1"}},{border:"#41A906",background:"#7BE141",highlight:{border:"#41A906",background:"#A1EC76"},hover:{border:"#41A906",background:"#A1EC76"}},{border:"#E129F0",background:"#EB7DF4",highlight:{border:"#E129F0",background:"#F0B3F5"},hover:{border:"#E129F0",background:"#F0B3F5"}},{border:"#7C29F0",background:"#AD85E4",highlight:{border:"#7C29F0",background:"#D3BDF0"},hover:{border:"#7C29F0",background:"#D3BDF0"}},{border:"#C37F00",background:"#FFA807",highlight:{border:"#C37F00",background:"#FFCA66"},hover:{border:"#C37F00",background:"#FFCA66"}},{border:"#4220FB",background:"#6E6EFD",highlight:{border:"#4220FB",background:"#9B9BFD"},hover:{border:"#4220FB",background:"#9B9BFD"}},{border:"#FD5A77",background:"#FFC0CB",highlight:{border:"#FD5A77",background:"#FFD1D9"},hover:{border:"#FD5A77",background:"#FFD1D9"}},{border:"#4AD63A",background:"#C2FABC",highlight:{border:"#4AD63A",background:"#E6FFE3"},hover:{border:"#4AD63A",background:"#E6FFE3"}},{border:"#990000",background:"#EE0000",highlight:{border:"#BB0000",background:"#FF3333"},hover:{border:"#BB0000",background:"#FF3333"}},{border:"#FF6000",background:"#FF6000",highlight:{border:"#FF6000",background:"#FF6000"},hover:{border:"#FF6000",background:"#FF6000"}},{border:"#97C2FC",background:"#2B7CE9",highlight:{border:"#D2E5FF",background:"#2B7CE9"},hover:{border:"#D2E5FF",background:"#2B7CE9"}},{border:"#399605",background:"#255C03",highlight:{border:"#399605",background:"#255C03"},hover:{border:"#399605",background:"#255C03"}},{border:"#B70054",background:"#FF007E",highlight:{border:"#B70054",background:"#FF007E"},hover:{border:"#B70054",background:"#FF007E"}},{border:"#AD85E4",background:"#7C29F0",highlight:{border:"#D3BDF0",background:"#7C29F0"},hover:{border:"#D3BDF0",background:"#7C29F0"}},{border:"#4557FA",background:"#000EA1",highlight:{border:"#6E6EFD",background:"#000EA1"},hover:{border:"#6E6EFD",background:"#000EA1"}},{border:"#FFC0CB",background:"#FD5A77",highlight:{border:"#FFD1D9",background:"#FD5A77"},hover:{border:"#FFD1D9",background:"#FD5A77"}},{border:"#C2FABC",background:"#74D66A",highlight:{border:"#E6FFE3",background:"#74D66A"},hover:{border:"#E6FFE3",background:"#74D66A"}},{border:"#EE0000",background:"#990000",highlight:{border:"#FF3333",background:"#BB0000"},hover:{border:"#FF3333",background:"#BB0000"}}],this.options={},this.defaultOptions={useDefaultGroups:!0},d.extend(this.options,this.defaultOptions)}return(0,a.default)(e,[{key:"setOptions",value:function(e){var t=["useDefaultGroups"];if(void 0!==e)for(var i in e)if(e.hasOwnProperty(i)&&-1===t.indexOf(i)){var n=e[i];this.add(i,n)}}},{key:"clear",value:function(){this.groups={},this.groupsArray=[]}},{key:"get",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this.groups[e];if(void 0===i&&t)if(!1===this.options.useDefaultGroups&&this.groupsArray.length>0){var n=this.groupIndex%this.groupsArray.length;this.groupIndex++,i={},i.color=this.groups[this.groupsArray[n]],this.groups[e]=i}else{var o=this.defaultIndex%this.defaultGroups.length;this.defaultIndex++,i={},i.color=this.defaultGroups[o],this.groups[e]=i}return i}},{key:"add",value:function(e,t){return this.groups[e]=t,this.groupsArray.push(e),t}}]),e}();t.default=h},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=i(5),h=i(32),l=i(51),u=i(33).default,c=function(){function e(t,i,n,o){var r=this;if((0,s.default)(this,e),this.body=t,this.images=i,this.groups=n,this.layoutEngine=o,this.body.functions.createNode=this.create.bind(this),this.nodesListeners={add:function(e,t){r.add(t.items)},update:function(e,t){r.update(t.items,t.data,t.oldData)},remove:function(e,t){r.remove(t.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:2,brokenImage:void 0,color:{border:"#2B7CE9",background:"#97C2FC",highlight:{border:"#2B7CE9",background:"#D2E5FF"},hover:{border:"#2B7CE9",background:"#D2E5FF"}},fixed:{x:!1,y:!1},font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:0,strokeColor:"#ffffff",align:"center",vadjust:0,multi:!1,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"monospace",vadjust:2}},group:void 0,hidden:!1,icon:{face:"FontAwesome",code:void 0,size:50,color:"#2B7CE9"},image:void 0,label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,i,n){if(t===e)return.5;var o=1/(t-e);return Math.max(0,(n-e)*o)}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},shape:"ellipse",shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw"Internal error: mass in defaultOptions of NodesHandler may not be zero or negative";this.options=d.bridgeObject(this.defaultOptions),this.bindEventListeners()}return(0,a.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("refreshNodes",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",function(){d.forEach(e.nodesListeners,function(t,i){e.body.data.nodes&&e.body.data.nodes.off(i,t)}),delete e.body.functions.createNode,delete e.nodesListeners.add,delete e.nodesListeners.update,delete e.nodesListeners.remove,delete e.nodesListeners})}},{key:"setOptions",value:function(e){if(void 0!==e){if(u.parseOptions(this.options,e),void 0!==e.shape)for(var t in this.body.nodes)this.body.nodes.hasOwnProperty(t)&&this.body.nodes[t].updateShape();if(void 0!==e.font)for(var i in this.body.nodes)this.body.nodes.hasOwnProperty(i)&&(this.body.nodes[i].updateLabelModule(),this.body.nodes[i].needsRefresh());if(void 0!==e.size)for(var n in this.body.nodes)this.body.nodes.hasOwnProperty(n)&&this.body.nodes[n].needsRefresh();void 0===e.hidden&&void 0===e.physics||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.data.nodes;if(e instanceof h||e instanceof l)this.body.data.nodes=e;else if(Array.isArray(e))this.body.data.nodes=new h,this.body.data.nodes.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.nodes=new h}if(i&&d.forEach(this.nodesListeners,function(e,t){i.off(t,e)}),this.body.nodes={},this.body.data.nodes){var n=this;d.forEach(this.nodesListeners,function(e,t){n.body.data.nodes.on(t,e)});var o=this.body.data.nodes.getIds();this.add(o,!0)}!1===t&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,n=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:u)(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}},{key:"refresh",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];d.forEach(this.body.nodes,function(i,n){var o=e.body.data.nodes.get(n);void 0!==o&&(!0===t&&i.setOptions({x:null,y:null}),i.setOptions({fixed:!1}),i.setOptions(o))})}},{key:"getPositions",value:function(e){var t={};if(void 0!==e){if(!0===Array.isArray(e)){for(var i=0;i0)for(var r=0;r0)for(var f=0;f0&&void 0!==arguments[0]&&arguments[0];this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(t.push({text:this.buffer,mod:this.modName()}),this.buffer="")},i.add=function(e){" "===e&&(i.spacing=!0),i.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)};i.position/.test(e.substr(i.position,3))?i.mono||i.ital||!//.test(e.substr(i.position,3))?!i.mono&&//.test(e.substr(i.position,6))?(i.emitBlock(),i.mono=!0,i.modStack.unshift("mono"),i.position+=5):!i.mono&&"bold"===i.mod()&&/<\/b>/.test(e.substr(i.position,4))?(i.emitBlock(),i.bold=!1,i.modStack.shift(),i.position+=3):!i.mono&&"ital"===i.mod()&&/<\/i>/.test(e.substr(i.position,4))?(i.emitBlock(),i.ital=!1,i.modStack.shift(),i.position+=3):"mono"===i.mod()&&/<\/code>/.test(e.substr(i.position,7))?(i.emitBlock(),i.mono=!1,i.modStack.shift(),i.position+=6):i.add(n):(i.emitBlock(),i.ital=!0,i.modStack.unshift("ital"),i.position+=2):(i.emitBlock(),i.bold=!0,i.modStack.unshift("bold"),i.position+=2):/&/.test(n)?/</.test(e.substr(i.position,4))?(i.add("<"),i.position+=3):/&/.test(e.substr(i.position,5))?(i.add("&"),i.position+=4):i.add("&"):i.add(n),i.position++}return i.emitBlock(),t}},{key:"splitMarkdownBlocks",value:function(e){var t=[],i={bold:!1,ital:!1,mono:!1,beginable:!0,spacing:!1,position:0,buffer:"",modStack:[]};for(i.mod=function(){return 0===this.modStack.length?"normal":this.modStack[0]},i.modName=function(){return 0===this.modStack.length?"normal":"mono"===this.modStack[0]?"mono":i.bold&&i.ital?"boldital":i.bold?"bold":i.ital?"ital":void 0},i.emitBlock=function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.spacing&&(this.add(" "),this.spacing=!1),this.buffer.length>0&&(t.push({text:this.buffer,mod:this.modName()}),this.buffer="")},i.add=function(e){" "===e&&(i.spacing=!0),i.spacing&&(this.buffer+=" ",this.spacing=!1)," "!=e&&(this.buffer+=e)};i.positionthis.parent.fontOptions.maxWdt}},{key:"getLongestFit",value:function(e){for(var t="",i=0;i1&&void 0!==arguments[1]?arguments[1]:"normal",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e=e.replace(/^( +)/g,"$1\r"),e=e.replace(/([^\r][^ ]*)( +)/g,"$1\r$2\r");for(var n=e.split("\r");n.length>0;){var o=this.getLongestFit(n);if(0===o){var s=n[0],r=this.getLongestFitWord(s);this.lines.newLine(s.slice(0,r),t),n[0]=s.slice(r)}else{var a=o;" "===n[o-1]?o--:" "===n[a]&&a++;var d=n.slice(0,o).join("");o==n.length&&i?this.lines.append(d,t):this.lines.newLine(d,t),n=n.slice(a)}}}}]),e}();t.default=l},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(138),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=function(){function e(t){(0,a.default)(this,e),this.measureText=t,this.current=0,this.width=0,this.height=0,this.lines=[]}return(0,h.default)(e,[{key:"_add",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"normal";void 0===this.lines[e]&&(this.lines[e]={width:0,height:0,blocks:[]});var n=t;void 0!==t&&""!==t||(n=" ");var o=this.measureText(n,i),r=(0,s.default)({},o.values);r.text=t,r.width=o.width,r.mod=i,void 0!==t&&""!==t||(r.width=0),this.lines[e].blocks.push(r),this.lines[e].width+=r.width}},{key:"curWidth",value:function(){var e=this.lines[this.current];return void 0===e?0:e.width}},{key:"append",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,t)}},{key:"newLine",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"normal";this._add(this.current,e,t),this.current++}},{key:"determineLineHeights",value:function(){for(var e=0;ee&&(e=n.width),t+=n.height}this.width=e,this.height=t}},{key:"removeEmptyBlocks",value:function(){for(var e=[],t=0;th;)for(var c,f=a(arguments[h++]),p=l?n(f).concat(l(f)):n(f),v=p.length,g=0;v>g;)u.call(f,c=p[g++])&&(i[c]=f[c]);return i}:d},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(15),v=n(p),g=function(e){function t(e,i,n){(0,a.default)(this,t);var o=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return o._setMargins(n),o}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var n=this.getDimensionsFromLabel(e,t,i);this.width=n.width+this.margin.right+this.margin.left,this.height=n.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,n,o,s){this.resize(e,n,o),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),e.roundRect(this.left,this.top,this.width,this.height,s.borderRadius),this.performFill(e,s),this.updateBoundingBox(t,i,e,n,o),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,o)}},{key:"updateBoundingBox",value:function(e,t,i,n,o){this._updateBoundingBox(e,t,i,n,o);var s=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(s)}},{key:"distanceToBorder",value:function(e,t){this.resize(e);var i=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+i}}]),t}(v.default);t.default=g},function(e,t,i){i(144),e.exports=i(6).Object.getPrototypeOf},function(e,t,i){var n=i(29),o=i(66);i(68)("getPrototypeOf",function(){return function(e){return o(n(e))}})},function(e,t,i){e.exports={default:i(146),__esModule:!0}},function(e,t,i){i(147),e.exports=i(6).Object.setPrototypeOf},function(e,t,i){var n=i(11);n(n.S,"Object",{setPrototypeOf:i(148).set})},function(e,t,i){var n=i(25),o=i(19),s=function(e,t){if(o(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{n=i(61)(Function.call,i(70).f(Object.prototype,"__proto__").set,2),n(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,i){return s(e,i),t?e.__proto__=i:n(e,i),e}}({},!1):void 0),check:s}},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(53),v=n(p),g=function(e){function t(e,i,n){(0,a.default)(this,t);var o=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return o._setMargins(n),o}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var n=this.getDimensionsFromLabel(e,t,i),o=Math.max(n.width+this.margin.right+this.margin.left,n.height+this.margin.top+this.margin.bottom);this.options.size=o/2,this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,n,o,s){this.resize(e,n,o),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),this.updateBoundingBox(t,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,i,n,o)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),.5*this.width}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(53),v=n(p),g=function(e){function t(e,i,n,o,r){(0,a.default)(this,t);var d=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return d.setImages(o,r),d}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height){var n=2*this.options.size;return this.width=n,this.height=n,void(this.radius=.5*this.width)}this.needsRefresh(t,i)&&this._resizeImage()}},{key:"draw",value:function(e,t,i,n,o,s){this.switchImages(n),this.resize(),this.left=t-this.width/2,this.top=i-this.height/2,this._drawRawCircle(e,t,i,s),e.save(),e.clip(),this._drawImageAtPosition(e,s),e.restore(),this._drawImageLabel(e,t,i,n,o),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),.5*this.width}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(15),v=n(p),g=function(e){function t(e,i,n){(0,a.default)(this,t);var o=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return o._setMargins(n),o}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e,t,i){if(this.needsRefresh(t,i)){var n=this.getDimensionsFromLabel(e,t,i),o=n.width+this.margin.right+this.margin.left;this.width=o,this.height=o,this.radius=this.width/2}}},{key:"draw",value:function(e,t,i,n,o,s){this.resize(e,n,o),this.left=t-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),e.database(t-this.width/2,i-this.height/2,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,n,o),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,o)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"diamond",4,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"circle",2,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this.resize(e),this.options.size}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(15),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(this.needsRefresh(t,i)){var n=this.getDimensionsFromLabel(e,t,i);this.height=2*n.height,this.width=n.width+n.height,this.radius=.5*this.width}}},{key:"draw",value:function(e,t,i,n,o,s){this.resize(e,n,o),this.left=t-.5*this.width,this.top=i-.5*this.height,this.initContextForDraw(e,s),e.ellipse_vis(this.left,this.top,this.width,this.height),this.performFill(e,s),this.updateBoundingBox(t,i,e,n,o),this.labelModule.draw(e,t,i,n,o)}},{key:"distanceToBorder",value:function(e,t){this.resize(e);var i=.5*this.width,n=.5*this.height,o=Math.sin(t)*i,s=Math.cos(t)*n;return i*n/Math.sqrt(o*o+s*s)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(15),v=n(p),g=function(e){function t(e,i,n){(0,a.default)(this,t);var o=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return o._setMargins(n),o}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e,t,i){this.needsRefresh(t,i)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(e,t,i,n,o,s){if(this.resize(e,n,o),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=i-this.height/2,this._icon(e,t,i,n,o,s),void 0!==this.options.label){this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,i+this.height/2+5,n)}this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){if(this.boundingBox.top=t-.5*this.options.icon.size,this.boundingBox.left=e-.5*this.options.icon.size,this.boundingBox.right=e+.5*this.options.icon.size,this.boundingBox.bottom=t+.5*this.options.icon.size,void 0!==this.options.label&&this.labelModule.size.width>0){this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5)}}},{key:"_icon",value:function(e,t,i,n,o,s){var r=Number(this.options.icon.size);void 0!==this.options.icon.code?(e.font=(n?"bold ":"")+r+"px "+this.options.icon.face,e.fillStyle=this.options.icon.color||"black",e.textAlign="center",e.textBaseline="middle",this.enableShadow(e,s),e.fillText(this.options.icon.code,t,i),this.disableShadow(e,s)):console.error("When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.")}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(53),v=n(p),g=function(e){function t(e,i,n,o,r){(0,a.default)(this,t);var d=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return d.setImages(o,r),d}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.selected,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.hover;if(void 0===this.imageObj.src||void 0===this.imageObj.width||void 0===this.imageObj.height){var n=2*this.options.size;return this.width=n,void(this.height=n)}this.needsRefresh(t,i)&&this._resizeImage()}},{key:"draw",value:function(e,t,i,n,o,s){if(this.switchImages(n),this.resize(),this.left=t-this.width/2,this.top=i-this.height/2,!0===this.options.shapeProperties.useBorderWithImage){var r=this.options.borderWidth,a=this.options.borderWidthSelected||2*this.options.borderWidth,d=(n?a:r)/this.body.view.scale;e.lineWidth=Math.min(this.width,d),e.beginPath(),e.strokeStyle=n?this.options.color.highlight.border:o?this.options.color.hover.border:this.options.color.border,e.fillStyle=n?this.options.color.highlight.background:o?this.options.color.hover.background:this.options.color.background,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),e.fill(),this.performStroke(e,s),e.closePath()}this._drawImageAtPosition(e,s),this._drawImageLabel(e,t,i,n,o),this.updateBoundingBox(t,i)}},{key:"updateBoundingBox",value:function(e,t){this.resize(),this._updateBoundingBox(e,t),void 0!==this.options.label&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"square",2,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"hexagon",4,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"star",4,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(15),v=n(p),g=function(e){function t(e,i,n){(0,a.default)(this,t);var o=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n));return o._setMargins(n),o}return(0,f.default)(t,e),(0,h.default)(t,[{key:"resize",value:function(e,t,i){this.needsRefresh(t,i)&&(this.textSize=this.labelModule.getTextSize(e,t,i),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}},{key:"draw",value:function(e,t,i,n,o,s){this.resize(e,n,o),this.left=t-this.width/2,this.top=i-this.height/2,this.enableShadow(e,s),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,n,o),this.disableShadow(e,s),this.updateBoundingBox(t,i,e,n,o)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"triangle",3,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(16),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"draw",value:function(e,t,i,n,o,s){this._drawShape(e,"triangleDown",3,t,i,n,o,s)}},{key:"distanceToBorder",value:function(e,t){return this._distanceToBorder(e,t)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=i(5),h=i(32),l=i(51),u=i(55).default,c=function(){function e(t,i,n){var o=this;(0,s.default)(this,e),this.body=t,this.images=i,this.groups=n,this.body.functions.createEdge=this.create.bind(this),this.edgesListeners={add:function(e,t){o.add(t.items)},update:function(e,t){o.update(t.items)},remove:function(e,t){o.remove(t.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:"arrow"},middle:{enabled:!1,scaleFactor:1,type:"arrow"},from:{enabled:!1,scaleFactor:1,type:"arrow"}},arrowStrikethrough:!0,color:{color:"#848484",highlight:"#848484",hover:"#848484",inherit:"from",opacity:1},dashes:!1,font:{color:"#343434",size:14,face:"arial",background:"none",strokeWidth:2,strokeColor:"#ffffff",align:"horizontal",multi:!1,vadjust:0,bold:{mod:"bold"},boldital:{mod:"bold italic"},ital:{mod:"italic"},mono:{mod:"",size:15,face:"courier new",vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,i,n){if(t===e)return.5;var o=1/(t-e);return Math.max(0,(n-e)*o)}},selectionWidth:1.5,selfReferenceSize:20,shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:10,x:5,y:5},smooth:{enabled:!0,type:"dynamic",forceDirection:"none",roundness:.5},title:void 0,width:1,value:void 0},d.deepExtend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("_forceDisableDynamicCurves",function(t){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];"dynamic"===t&&(t="continuous");var n=!1;for(var o in e.body.edges)if(e.body.edges.hasOwnProperty(o)){var s=e.body.edges[o],r=e.body.data.edges._data[o];if(void 0!==r){var a=r.smooth;void 0!==a&&!0===a.enabled&&"dynamic"===a.type&&(void 0===t?s.setOptions({smooth:!1}):s.setOptions({smooth:{type:t}}),n=!0)}}!0===i&&!0===n&&e.body.emitter.emit("_dataChanged")}),this.body.emitter.on("_dataUpdated",function(){e.reconnectEdges()}),this.body.emitter.on("refreshEdges",this.refresh.bind(this)),this.body.emitter.on("refresh",this.refresh.bind(this)),this.body.emitter.on("destroy",function(){d.forEach(e.edgesListeners,function(t,i){e.body.data.edges&&e.body.data.edges.off(i,t)}),delete e.body.functions.createEdge,delete e.edgesListeners.add,delete e.edgesListeners.update,delete e.edgesListeners.remove,delete e.edgesListeners})}},{key:"setOptions",value:function(e){if(void 0!==e){u.parseOptions(this.options,e,!0,this.defaultOptions,!0);var t=!1;if(void 0!==e.smooth)for(var i in this.body.edges)this.body.edges.hasOwnProperty(i)&&(t=this.body.edges[i].updateEdgeType()||t);if(void 0!==e.font)for(var n in this.body.edges)this.body.edges.hasOwnProperty(n)&&this.body.edges[n].updateLabelModule();void 0===e.hidden&&void 0===e.physics&&!0!==t||this.body.emitter.emit("_dataChanged")}}},{key:"setData",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.body.data.edges;if(e instanceof h||e instanceof l)this.body.data.edges=e;else if(Array.isArray(e))this.body.data.edges=new h,this.body.data.edges.add(e);else{if(e)throw new TypeError("Array or DataSet expected");this.body.data.edges=new h}if(n&&d.forEach(this.edgesListeners,function(e,t){n.off(t,e)}),this.body.edges={},this.body.data.edges){d.forEach(this.edgesListeners,function(e,i){t.body.data.edges.on(i,e)});var o=this.body.data.edges.getIds();this.add(o,!0)}this.body.emitter.emit("_adjustEdgesForHierarchicalLayout"),!1===i&&this.body.emitter.emit("_dataChanged")}},{key:"add",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.edges,n=this.body.data.edges,o=0;o1&&void 0!==arguments[1])||arguments[1];if(0!==e.length){var i=this.body.edges;d.forEach(e,function(e){var t=i[e];void 0!==t&&t.remove()}),t&&this.body.emitter.emit("_dataChanged")}}},{key:"refresh",value:function(){var e=this;d.forEach(this.body.edges,function(t,i){var n=e.body.data.edges._data[i];void 0!==n&&t.setOptions(n)})}},{key:"create",value:function(e){return new u(e,this.body,this.options,this.defaultOptions)}},{key:"reconnectEdges",value:function(){var e,t=this.body.nodes,i=this.body.edges;for(e in t)t.hasOwnProperty(e)&&(t[e].edges=[]);for(e in i)if(i.hasOwnProperty(e)){var n=i[e];n.from=null,n.to=null,n.connect()}}},{key:"getConnectedNodes",value:function(e){var t=[];if(void 0!==this.body.edges[e]){var i=this.body.edges[e];void 0!==i.fromId&&t.push(i.fromId),void 0!==i.toId&&t.push(i.toId)}return t}},{key:"_updateState",value:function(){this._addMissingEdges(),this._removeInvalidEdges()}},{key:"_removeInvalidEdges",value:function(){var e=this,t=[];d.forEach(this.body.edges,function(i,n){var o=e.body.nodes[i.toId],s=e.body.nodes[i.fromId];void 0!==o&&!0===o.isCluster||void 0!==s&&!0===s.isCluster||void 0!==o&&void 0!==s||t.push(n)}),this.remove(t,!1)}},{key:"_addMissingEdges",value:function(){var e=this.body.edges,t=this.body.data.edges,i=[];t.forEach(function(t,n){void 0===e[n]&&i.push(n)}),this.add(i,!0)}}]),e}();t.default=c},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(23),s=n(o),r=i(2),a=n(r),d=i(0),h=n(d),l=i(1),u=n(l),c=i(3),f=n(c),p=i(4),v=n(p),g=i(165),y=n(g),m=function(e){function t(e,i,n){return(0,h.default)(this,t),(0,f.default)(this,(t.__proto__||(0,a.default)(t)).call(this,e,i,n))}return(0,v.default)(t,e),(0,u.default)(t,[{key:"_line",value:function(e,t,i){var n=i[0],o=i[1];this._bezierCurve(e,t,n,o)}},{key:"_getViaCoordinates",value:function(){var e=this.from.x-this.to.x,t=this.from.y-this.to.y,i=void 0,n=void 0,o=void 0,s=void 0,r=this.options.smooth.roundness;return(Math.abs(e)>Math.abs(t)||!0===this.options.smooth.forceDirection||"horizontal"===this.options.smooth.forceDirection)&&"vertical"!==this.options.smooth.forceDirection?(n=this.from.y,s=this.to.y,i=this.from.x-r*e,o=this.to.x+r*e):(n=this.from.y-r*t,s=this.to.y+r*t,i=this.from.x,o=this.to.x),[{x:i,y:n},{x:o,y:s}]}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_findBorderPosition",value:function(e,t){return this._findBorderPositionBezier(e,t)}},{key:"_getDistanceToEdge",value:function(e,t,i,n,o,r){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates(),d=(0,s.default)(a,2),h=d[0],l=d[1];return this._getDistanceToBezierEdge(e,t,i,n,o,r,h,l)}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=(0,s.default)(t,2),n=i[0],o=i[1],r=e,a=[];return a[0]=Math.pow(1-r,3),a[1]=3*r*Math.pow(1-r,2),a[2]=3*Math.pow(r,2)*(1-r),a[3]=Math.pow(r,3),{x:a[0]*this.fromPoint.x+a[1]*n.x+a[2]*o.x+a[3]*this.toPoint.x,y:a[0]*this.fromPoint.y+a[1]*n.y+a[2]*o.y+a[3]*this.toPoint.y}}}]),t}(y.default);t.default=m},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(56),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_getDistanceToBezierEdge",value:function(e,t,i,n,o,s,r,a){var d=1e9,h=void 0,l=void 0,u=void 0,c=void 0,f=void 0,p=e,v=t,g=[0,0,0,0];for(l=1;l<10;l++)u=.1*l,g[0]=Math.pow(1-u,3),g[1]=3*u*Math.pow(1-u,2),g[2]=3*Math.pow(u,2)*(1-u),g[3]=Math.pow(u,3),c=g[0]*e+g[1]*r.x+g[2]*a.x+g[3]*i,f=g[0]*t+g[1]*r.y+g[2]*a.y+g[3]*n,l>0&&(h=this._getDistanceToLine(p,v,c,f,o,s),d=h1&&void 0!==arguments[1]?arguments[1]:this.via,i=e,n=void 0,o=void 0;if(this.from===this.to){var r=this._getCircleData(this.from),a=(0,s.default)(r,3),d=a[0],h=a[1],l=a[2],u=2*Math.PI*(1-i);n=d+l*Math.sin(u),o=h+l-l*(1-Math.cos(u))}else n=Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,o=Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y;return{x:n,y:o}}},{key:"_findBorderPosition",value:function(e,t){return this._findBorderPositionBezier(e,t,this.via)}},{key:"_getDistanceToEdge",value:function(e,t,i,n,o,s){return this._getDistanceToBezierEdge(e,t,i,n,o,s,this.via)}}]),t}(y.default);t.default=m},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(56),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_line",value:function(e,t,i){this._bezierCurve(e,t,i)}},{key:"getViaNode",value:function(){return this._getViaCoordinates()}},{key:"_getViaCoordinates",value:function(){var e=void 0,t=void 0,i=this.options.smooth.roundness,n=this.options.smooth.type,o=Math.abs(this.from.x-this.to.x),s=Math.abs(this.from.y-this.to.y);if("discrete"===n||"diagonalCross"===n){var r=void 0,a=void 0;r=a=o<=s?i*s:i*o,this.from.x>this.to.x&&(r=-r),this.from.y>=this.to.y&&(a=-a),e=this.from.x+r,t=this.from.y+a,"discrete"===n&&(o<=s?e=othis.to.x&&(_=-_),this.from.y>=this.to.y&&(w=-w),e=this.from.x+_,t=this.from.y+w,o<=s?e=this.from.x<=this.to.x?this.to.xe?this.to.x:e:t=this.from.y>=this.to.y?this.to.y>t?this.to.y:t:this.to.y2&&void 0!==arguments[2]?arguments[2]:{};return this._findBorderPositionBezier(e,t,i.via)}},{key:"_getDistanceToEdge",value:function(e,t,i,n,o,s){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,i,n,o,s,r)}},{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._getViaCoordinates(),i=e;return{x:Math.pow(1-i,2)*this.fromPoint.x+2*i*(1-i)*t.x+Math.pow(i,2)*this.toPoint.x,y:Math.pow(1-i,2)*this.fromPoint.y+2*i*(1-i)*t.y+Math.pow(i,2)*this.toPoint.y}}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(78),v=n(p),g=function(e){function t(e,i,n){return(0,a.default)(this,t),(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n))}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_line",value:function(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}},{key:"getViaNode",value:function(){}},{key:"getPoint",value:function(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}},{key:"_findBorderPosition",value:function(e,t){var i=this.to,n=this.from;e.id===this.from.id&&(i=this.from,n=this.to);var o=Math.atan2(i.y-n.y,i.x-n.x),s=i.x-n.x,r=i.y-n.y,a=Math.sqrt(s*s+r*r),d=e.distanceToBorder(t,o),h=(a-d)/a,l={};return l.x=(1-h)*n.x+h*i.x,l.y=(1-h)*n.y+h*i.y,l}},{key:"_getDistanceToEdge",value:function(e,t,i,n,o,s){return this._getDistanceToLine(e,t,i,n,o,s)}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(10),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(80).default,u=i(170).default,c=i(171).default,f=i(172).default,p=i(173).default,v=i(81).default,g=i(174).default,y=i(175).default,m=i(5),b=i(79).default,_=function(){function e(t){(0,a.default)(this,e),this.body=t,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:"barnesHut",stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0},m.extend(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}return(0,h.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("initPhysics",function(){e.initPhysics()}),this.body.emitter.on("_layoutFailed",function(){e.layoutFailed=!0}),this.body.emitter.on("resetPhysics",function(){e.stopSimulation(),e.ready=!1}),this.body.emitter.on("disablePhysics",function(){e.physicsEnabled=!1,e.stopSimulation()}),this.body.emitter.on("restorePhysics",function(){e.setOptions(e.options),!0===e.ready&&e.startSimulation()}),this.body.emitter.on("startSimulation",function(){!0===e.ready&&e.startSimulation()}),this.body.emitter.on("stopSimulation",function(){e.stopSimulation()}),this.body.emitter.on("destroy",function(){e.stopSimulation(!1),e.body.emitter.off()}),this.body.emitter.on("_dataChanged",function(){e.updatePhysicsData()})}},{key:"setOptions",value:function(e){void 0!==e&&(!1===e?(this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation()):!0===e?(this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation()):(this.physicsEnabled=!0,m.selectiveNotDeepExtend(["stabilization"],this.options,e),m.mergeOptions(this.options,e,"stabilization"),void 0===e.enabled&&(this.options.enabled=!0),!1===this.options.enabled&&(this.physicsEnabled=!1,this.stopSimulation()),this.timestep=this.options.timestep)),this.init()}},{key:"init",value:function(){var e;"forceAtlas2Based"===this.options.solver?(e=this.options.forceAtlas2Based,this.nodesSolver=new g(this.body,this.physicsBody,e),this.edgesSolver=new f(this.body,this.physicsBody,e),this.gravitySolver=new y(this.body,this.physicsBody,e)):"repulsion"===this.options.solver?(e=this.options.repulsion,this.nodesSolver=new u(this.body,this.physicsBody,e),this.edgesSolver=new f(this.body,this.physicsBody,e),this.gravitySolver=new v(this.body,this.physicsBody,e)):"hierarchicalRepulsion"===this.options.solver?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new c(this.body,this.physicsBody,e),this.edgesSolver=new p(this.body,this.physicsBody,e),this.gravitySolver=new v(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new l(this.body,this.physicsBody,e),this.edgesSolver=new f(this.body,this.physicsBody,e),this.gravitySolver=new v(this.body,this.physicsBody,e)),this.modelOptions=e}},{key:"initPhysics",value:function(){!0===this.physicsEnabled&&!0===this.options.enabled?!0===this.options.stabilization.enabled?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit("fit",{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit("fit"))}},{key:"startSimulation",value:function(){!0===this.physicsEnabled&&!0===this.options.enabled?(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit("_resizeNodes"),void 0===this.viewFunction&&(this.viewFunction=this.simulationStep.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))):this.body.emitter.emit("_redraw")}},{key:"stopSimulation",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.stabilized=!0,!0===e&&this._emitStabilized(),void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.viewFunction=void 0,!0===e&&this.body.emitter.emit("_stopRendering"))}},{key:"simulationStep",value:function(){var e=Date.now();this.physicsTick(),(Date.now()-e<.4*this.simulationInterval||!0===this.runDoubleSpeed)&&!1===this.stabilized&&(this.physicsTick(),this.runDoubleSpeed=!0),!0===this.stabilized&&this.stopSimulation()}},{key:"_emitStabilized",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||!0===this.startedStabilization)&&setTimeout(function(){e.body.emitter.emit("stabilized",{iterations:t}),e.startedStabilization=!1,e.stabilizationIterations=0},0)}},{key:"physicsStep",value:function(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}},{key:"adjustTimeStep",value:function(){!0===this._evaluateStepQuality()?this.timestep=1.2*this.timestep:this.timestep/1.2.3))return!1;return!0}},{key:"moveNodes",value:function(){for(var e=this.physicsBody.physicsNodeIndices,t=0,i=0,n=0;nn&&(e=e>0?n:-n),e}},{key:"_performStep",value:function(e){var t=this.body.nodes[e],i=this.physicsBody.forces[e],n=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:n.x,vy:n.y},!1===t.options.fixed.x?(n.x=this.calculateComponentVelocity(n.x,i.x,t.options.mass),t.x+=n.x*this.timestep):(i.x=0,n.x=0),!1===t.options.fixed.y?(n.y=this.calculateComponentVelocity(n.y,i.y,t.options.mass),t.y+=n.y*this.timestep):(i.y=0,n.y=0),Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}},{key:"_freezeNodes",value:function(){var e=this.body.nodes;for(var t in e)if(e.hasOwnProperty(t)&&e[t].x&&e[t].y){var i=e[t].options.fixed;this.freezeCache[t]={x:i.x,y:i.y},i.x=!0,i.y=!0}}},{key:"_restoreFrozenNodes",value:function(){var e=this.body.nodes;for(var t in e)e.hasOwnProperty(t)&&void 0!==this.freezeCache[t]&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}},{key:"stabilize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.stabilization.iterations;if("number"!=typeof t&&(t=this.options.stabilization.iterations,console.log("The stabilize method needs a numeric amount of iterations. Switching to default: ",t)),0===this.physicsBody.physicsNodeIndices.length)return void(this.ready=!0);this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit("_resizeNodes"),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit("_blockRedraw"),this.targetIterations=t,!0===this.options.stabilization.onlyDynamicEdges&&this._freezeNodes(),this.stabilizationIterations=0,setTimeout(function(){return e._stabilizationBatch()},0)}},{key:"_startStabilizing",value:function(){return!0!==this.startedStabilization&&(this.body.emitter.emit("startStabilizing"),this.startedStabilization=!0,!0)}},{key:"_stabilizationBatch",value:function(){var e=this,t=function(){return!1===e.stabilized&&e.stabilizationIterations0){var s=o.edges.length+1,r=this.options.centralGravity*s*o.options.mass;n[o.id].x=t*r,n[o.id].y=i*r}}}]),t}(v.default);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(10),s=n(o),r=i(7),a=n(r),d=i(0),h=n(d),l=i(1),u=n(l),c=i(5),f=i(57).default,p=i(177).default,v=i(55).default,g=i(33).default,y=function(){function e(t){var i=this;(0,h.default)(this,e),this.body=t,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},c.extend(this.options,this.defaultOptions),this.body.emitter.on("_resetData",function(){i.clusteredNodes={},i.clusteredEdges={}})}return(0,u.default)(e,[{key:"clusterByHubsize",value:function(e,t){void 0===e?e=this._getHubSize():"object"===(void 0===e?"undefined":(0,a.default)(e))&&(t=this._checkOptions(e),e=this._getHubSize());for(var i=[],n=0;n=e&&i.push(o.id)}for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:{},i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(void 0===t.joinCondition)throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options.");t=this._checkOptions(t);var n={},o={};c.forEach(this.body.nodes,function(i,s){var r=f.cloneOptions(i);!0===t.joinCondition(r)&&(n[s]=i,c.forEach(i.edges,function(t){void 0===e.clusteredEdges[t.id]&&(o[t.id]=t)}))}),this._cluster(n,o,t,i)}},{key:"clusterByEdgeCount",value:function(e,t){var i=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=this._checkOptions(t);for(var o=[],r={},a=void 0,d=void 0,h=void 0,l=0;l0&&(0,s.default)(v).length>0&&!0===b)if(c=function(){for(var e=0;e1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(1,e,t)}},{key:"clusterBridges",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clusterByEdgeCount(2,e,t)}},{key:"clusterByConnection",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No nodeId supplied to clusterByConnection!");if(void 0===this.body.nodes[e])throw new Error("The nodeId given to clusterByConnection does not exist!");var n=this.body.nodes[e];t=this._checkOptions(t,n),void 0===t.clusterNodeProperties.x&&(t.clusterNodeProperties.x=n.x),void 0===t.clusterNodeProperties.y&&(t.clusterNodeProperties.y=n.y),void 0===t.clusterNodeProperties.fixed&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=n.options.fixed.x,t.clusterNodeProperties.fixed.y=n.options.fixed.y);var o={},r={},a=n.id,d=f.cloneOptions(n);o[a]=n;for(var h=0;h-1&&(r[y.id]=y)}this._cluster(o,r,t,i)}},{key:"_createClusterEdges",value:function(e,t,i,n){for(var o=void 0,r=void 0,a=void 0,d=void 0,h=void 0,l=void 0,u=(0,s.default)(e),c=[],f=0;f0&&void 0!==arguments[0]?arguments[0]:{};return void 0===e.clusterEdgeProperties&&(e.clusterEdgeProperties={}),void 0===e.clusterNodeProperties&&(e.clusterNodeProperties={}),e}},{key:"_cluster",value:function(e,t,i){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=[];for(var r in e)e.hasOwnProperty(r)&&void 0!==this.clusteredNodes[r]&&o.push(r);for(var a=0;an?a.x:n,o=a.yr?a.y:r;return{x:.5*(i+n),y:.5*(o+r)}}},{key:"openCluster",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===e)throw new Error("No clusterNodeId supplied to openCluster.");var n=this.body.nodes[e];if(void 0===n)throw new Error("The clusterNodeId supplied to openCluster does not exist.");if(!0!==n.isCluster||void 0===n.containedNodes||void 0===n.containedEdges)throw new Error("The node:"+e+" is not a valid cluster.");var o=this.findNode(e),s=o.indexOf(e)-1;if(s>=0){var r=o[s];return this.body.nodes[r]._openChildCluster(e),delete this.body.nodes[e],void(!0===i&&this.body.emitter.emit("_dataChanged"))}var a=n.containedNodes,d=n.containedEdges;if(void 0!==t&&void 0!==t.releaseFunction&&"function"==typeof t.releaseFunction){var h={},l={x:n.x,y:n.y};for(var u in a)if(a.hasOwnProperty(u)){var f=this.body.nodes[u];h[u]={x:f.x,y:f.y}}var p=t.releaseFunction(l,h);for(var v in a)if(a.hasOwnProperty(v)){var g=this.body.nodes[v];void 0!==p[v]&&(g.x=void 0===p[v].x?n.x:p[v].x,g.y=void 0===p[v].y?n.y:p[v].y)}}else c.forEach(a,function(e){!1===e.options.fixed.x&&(e.x=n.x),!1===e.options.fixed.y&&(e.y=n.y)});for(var y in a)if(a.hasOwnProperty(y)){var m=this.body.nodes[y];m.vx=n.vx,m.vy=n.vy,m.setOptions({physics:!0}),delete this.clusteredNodes[y]}for(var b=[],_=0;_0&&o<100;){var s=t.pop();if(void 0!==s){var r=this.body.edges[s];if(void 0!==r){o++;var a=r.clusteringEdgeReplacingIds;if(void 0===a)n.push(s);else for(var d=0;dn&&(n=s.edges.length),e+=s.edges.length,t+=Math.pow(s.edges.length,2),i+=1}e/=i,t/=i;var r=t-Math.pow(e,2),a=Math.sqrt(r),d=Math.floor(e+2*a);return d>n&&(d=n),d}},{key:"_createClusteredEdge",value:function(e,t,i,n,o){var s=f.cloneOptions(i,"edge");c.deepExtend(s,n),s.from=e,s.to=t,s.id="clusterEdge:"+c.randomUUID(),void 0!==o&&c.deepExtend(s,o);var r=this.body.functions.createEdge(s);return r.clusteringEdgeReplacingIds=[i.id],r.connect(),this.body.edges[r.id]=r,r}},{key:"_clusterEdges",value:function(e,t,i,n){if(t instanceof v){var o=t,s={};s[o.id]=o,t=s}if(e instanceof g){var r=e,a={};a[r.id]=r,e=a}if(void 0===i||null===i)throw new Error("_clusterEdges: parameter clusterNode required");void 0===n&&(n=i.clusterEdgeProperties),this._createClusterEdges(e,t,i,n);for(var d in t)if(t.hasOwnProperty(d)&&void 0!==this.body.edges[d]){var h=this.body.edges[d];this._backupEdgeOptions(h),h.setOptions({physics:!1})}for(var l in e)e.hasOwnProperty(l)&&(this.clusteredNodes[l]={clusterId:i.id,node:this.body.nodes[l]},this.body.nodes[l].setOptions({physics:!1}))}},{key:"_getClusterNodeForNode",value:function(e){if(void 0!==e){var t=this.clusteredNodes[e];if(void 0!==t){var i=t.clusterId;if(void 0!==i)return this.body.nodes[i]}}}},{key:"_filter",value:function(e,t){var i=[];return c.forEach(e,function(e){t(e)&&i.push(e)}),i}},{key:"_updateState",value:function(){var e=this,t=void 0,i=[],n=[],o=function(t){c.forEach(e.body.nodes,function(e){!0===e.isCluster&&t(e)})};for(t in this.clusteredNodes)if(this.clusteredNodes.hasOwnProperty(t)){var r=this.body.nodes[t];void 0===r&&i.push(t)}o(function(e){for(var t=0;t0}t.endPointsValid()&&o||n.push(i)}),o(function(t){c.forEach(n,function(i){delete t.containedEdges[i],c.forEach(t.edges,function(o,s){if(o.id===i)return void(t.edges[s]=null);o.clusteringEdgeReplacingIds=e._filter(o.clusteringEdgeReplacingIds,function(e){return-1===n.indexOf(e)})}),t.edges=e._filter(t.edges,function(e){return null!==e})})}),c.forEach(n,function(t){delete e.clusteredEdges[t]}),c.forEach(n,function(t){delete e.body.edges[t]});var d=(0,s.default)(this.body.edges);c.forEach(d,function(t){var i=e.body.edges[t],n=e._isClusteredNode(i.fromId)||e._isClusteredNode(i.toId);if(n!==e._isClusteredEdge(i.id)){if(!n)throw new Error("remove edge from clustering not implemented!");var o=e._getClusterNodeForNode(i.fromId);void 0!==o&&e._clusterEdges(e.body.nodes[i.fromId],i,o);var s=e._getClusterNodeForNode(i.toId);void 0!==s&&e._clusterEdges(e.body.nodes[i.toId],i,s)}});for(var h=!1,l=!0;l;)!function(){var t=[];o(function(e){var i=(0,s.default)(e.containedNodes).length,n=!0===e.options.allowSingleNodeCluster;(n&&i<1||!n&&i<2)&&t.push(e.id)});for(var i=0;i0,h=h||l}();h&&this._updateState()}},{key:"_isClusteredNode",value:function(e){return void 0!==this.clusteredNodes[e]}},{key:"_isClusteredEdge",value:function(e){return void 0!==this.clusteredEdges[e]}}]),e}();t.default=y},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(2),s=n(o),r=i(0),a=n(r),d=i(1),h=n(d),l=i(3),u=n(l),c=i(4),f=n(c),p=i(5),v=i(33).default,g=function(e){function t(e,i,n,o,r,d){(0,a.default)(this,t);var h=(0,u.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,i,n,o,r,d));return h.isCluster=!0,h.containedNodes={},h.containedEdges={},h}return(0,f.default)(t,e),(0,h.default)(t,[{key:"_openChildCluster",value:function(e){var t=this,i=this.body.nodes[e];if(void 0===this.containedNodes[e])throw new Error("node with id: "+e+" not in current cluster");if(!i.isCluster)throw new Error("node with id: "+e+" is not a cluster");delete this.containedNodes[e],p.forEach(i.edges,function(e){delete t.containedEdges[e.id]}),p.forEach(i.containedNodes,function(e,i){t.containedNodes[i]=e}),i.containedNodes={},p.forEach(i.containedEdges,function(e,i){t.containedEdges[i]=e}),i.containedEdges={},p.forEach(i.edges,function(e){p.forEach(t.edges,function(i){var n=i.clusteringEdgeReplacingIds.indexOf(e.id);-1!==n&&(p.forEach(e.clusteringEdgeReplacingIds,function(e){i.clusteringEdgeReplacingIds.push(e),t.body.edges[e].edgeReplacedById=i.id}),i.clusteringEdgeReplacingIds.splice(n,1))})}),i.edges=[]}}]),t}(v);t.default=g},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}function o(){var e;void 0!==window&&(e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame),window.requestAnimationFrame=void 0===e?function(e){e()}:e}Object.defineProperty(t,"__esModule",{value:!0});var s=i(0),r=n(s),a=i(1),d=n(a),h=i(5),l=function(){function e(t,i){(0,r.default)(this,e),o(),this.body=t,this.canvas=i,this.redrawRequested=!1,this.renderTimer=void 0,this.requiresTimeout=!0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideNodesOnDrag:!1},h.extend(this.options,this.defaultOptions),this._determineBrowserMethod(),this.bindEventListeners()}return(0,d.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("dragStart",function(){e.dragging=!0}),this.body.emitter.on("dragEnd",function(){e.dragging=!1}),this.body.emitter.on("_resizeNodes",function(){e._resizeNodes()}),this.body.emitter.on("_redraw",function(){!1===e.renderingActive&&e._redraw()}),this.body.emitter.on("_blockRedraw",function(){e.allowRedraw=!1}),this.body.emitter.on("_allowRedraw",function(){e.allowRedraw=!0,e.redrawRequested=!1}),this.body.emitter.on("_requestRedraw",this._requestRedraw.bind(this)),this.body.emitter.on("_startRendering",function(){e.renderRequests+=1,e.renderingActive=!0,e._startRendering()}),this.body.emitter.on("_stopRendering",function(){e.renderRequests-=1,e.renderingActive=e.renderRequests>0,e.renderTimer=void 0}),this.body.emitter.on("destroy",function(){e.renderRequests=0,e.allowRedraw=!1,e.renderingActive=!1,!0===e.requiresTimeout?clearTimeout(e.renderTimer):window.cancelAnimationFrame(e.renderTimer),e.body.emitter.off()})}},{key:"setOptions",value:function(e){if(void 0!==e){var t=["hideEdgesOnDrag","hideNodesOnDrag"];h.selectiveDeepExtend(t,this.options,e)}}},{key:"_requestNextFrame",value:function(e,t){if("undefined"!=typeof window){var i=void 0,n=window;return!0===this.requiresTimeout?i=n.setTimeout(e,t):n.requestAnimationFrame&&(i=n.requestAnimationFrame(e)),i}}},{key:"_startRendering",value:function(){!0===this.renderingActive&&void 0===this.renderTimer&&(this.renderTimer=this._requestNextFrame(this._renderStep.bind(this),this.simulationInterval))}},{key:"_renderStep",value:function(){!0===this.renderingActive&&(this.renderTimer=void 0,!0===this.requiresTimeout&&this._startRendering(),this._redraw(),!1===this.requiresTimeout&&this._startRendering())}},{key:"redraw",value:function(){this.body.emitter.emit("setSize"),this._redraw()}},{key:"_requestRedraw",value:function(){var e=this;!0!==this.redrawRequested&&!1===this.renderingActive&&!0===this.allowRedraw&&(this.redrawRequested=!0,this._requestNextFrame(function(){e._redraw(!1)},0))}},{key:"_redraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!0===this.allowRedraw){this.body.emitter.emit("initRedraw"),this.redrawRequested=!1,0!==this.canvas.frame.canvas.width&&0!==this.canvas.frame.canvas.height||this.canvas.setSize(),this.canvas.setTransform();var t=this.canvas.getContext(),i=this.canvas.frame.canvas.clientWidth,n=this.canvas.frame.canvas.clientHeight;if(t.clearRect(0,0,i,n),0===this.canvas.frame.clientWidth)return;t.save(),t.translate(this.body.view.translation.x,this.body.view.translation.y),t.scale(this.body.view.scale,this.body.view.scale),t.beginPath(),this.body.emitter.emit("beforeDrawing",t),t.closePath(),!1===e&&(!1===this.dragging||!0===this.dragging&&!1===this.options.hideEdgesOnDrag)&&this._drawEdges(t),(!1===this.dragging||!0===this.dragging&&!1===this.options.hideNodesOnDrag)&&this._drawNodes(t,e),t.beginPath(),this.body.emitter.emit("afterDrawing",t),t.closePath(),t.restore(),!0===e&&t.clearRect(0,0,i,n)}}},{key:"_resizeNodes",value:function(){this.canvas.setTransform();var e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);var t=this.body.nodes,i=void 0;for(var n in t)t.hasOwnProperty(n)&&(i=t[n],i.resize(e),i.updateBoundingBox(e,i.selected));e.restore()}},{key:"_drawNodes",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.body.nodes,n=this.body.nodeIndices,o=void 0,s=[],r=this.canvas.DOMtoCanvas({x:-20,y:-20}),a=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+20,y:this.canvas.frame.canvas.clientHeight+20}),d={top:r.y,left:r.x,bottom:a.y,right:a.x},h=0;h0&&void 0!==arguments[0]?arguments[0]:this.pixelRatio;!0===this.initialized&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}},{key:"_setCameraState",value:function(){if(void 0!==this.cameraState.scale&&0!==this.frame.canvas.clientWidth&&0!==this.frame.canvas.clientHeight&&0!==this.pixelRatio&&this.cameraState.previousWidth>0){var e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,i=this.cameraState.scale;1!=e&&1!=t?i=.5*this.cameraState.scale*(e+t):1!=e?i=this.cameraState.scale*e:1!=t&&(i=this.cameraState.scale*t),this.body.view.scale=i;var n=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),o={x:n.x-this.cameraState.position.x,y:n.y-this.cameraState.position.y};this.body.view.translation.x+=o.x*this.body.view.scale,this.body.view.translation.y+=o.y*this.body.view.scale}}},{key:"_prepareValue",value:function(e){if("number"==typeof e)return e+"px";if("string"==typeof e){if(-1!==e.indexOf("%")||-1!==e.indexOf("px"))return e;if(-1===e.indexOf("%"))return e+"px"}throw new Error("Could not use the value supplied for width or height:"+e)}},{key:"_create",value:function(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement("div"),this.frame.className="vis-network",this.frame.style.position="relative",this.frame.style.overflow="hidden",this.frame.tabIndex=900,this.frame.canvas=document.createElement("canvas"),this.frame.canvas.style.position="relative",this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}},{key:"_bindHammer",value:function(){var e=this;void 0!==this.hammer&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new d(this.frame.canvas),this.hammer.get("pinch").set({enable:!0}),this.hammer.get("pan").set({threshold:5,direction:d.DIRECTION_ALL}),h.onTouch(this.hammer,function(t){e.body.eventListeners.onTouch(t)}),this.hammer.on("tap",function(t){e.body.eventListeners.onTap(t)}),this.hammer.on("doubletap",function(t){e.body.eventListeners.onDoubleTap(t)}),this.hammer.on("press",function(t){e.body.eventListeners.onHold(t)}),this.hammer.on("panstart",function(t){e.body.eventListeners.onDragStart(t)}),this.hammer.on("panmove",function(t){e.body.eventListeners.onDrag(t)}),this.hammer.on("panend",function(t){e.body.eventListeners.onDragEnd(t)}),this.hammer.on("pinch",function(t){e.body.eventListeners.onPinch(t)}),this.frame.canvas.addEventListener("mousewheel",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("DOMMouseScroll",function(t){e.body.eventListeners.onMouseWheel(t)}),this.frame.canvas.addEventListener("mousemove",function(t){e.body.eventListeners.onMouseMove(t)}),this.frame.canvas.addEventListener("contextmenu",function(t){e.body.eventListeners.onContext(t)}),this.hammerFrame=new d(this.frame),h.onRelease(this.hammerFrame,function(t){e.body.eventListeners.onRelease(t)})}},{key:"setSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.width,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);var i=!1,n=this.frame.canvas.width,o=this.frame.canvas.height,s=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(s),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width="100%",this.frame.canvas.style.height="100%",this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},i=!0;else{var r=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),a=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);this.frame.canvas.width===r&&this.frame.canvas.height===a||this._getCameraState(s),this.frame.canvas.width!==r&&(this.frame.canvas.width=r,i=!0),this.frame.canvas.height!==a&&(this.frame.canvas.height=a,i=!0)}return!0===i&&(this.body.emitter.emit("resize",{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(n/this.pixelRatio),oldHeight:Math.round(o/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,i}},{key:"getContext",value:function(){return this.frame.canvas.getContext("2d")}},{key:"_determinePixelRatio",value:function(){var e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");var t=1;return"undefined"!=typeof window&&(t=window.devicePixelRatio||1),t/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)}},{key:"_setPixelRatio",value:function(){this.pixelRatio=this._determinePixelRatio()}},{key:"setTransform",value:function(){var e=this.getContext();if(void 0===e)throw new Error("Could not get canvax context");e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}},{key:"_XconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.x)/this.body.view.scale}},{key:"_XconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.x}},{key:"_YconvertDOMtoCanvas",value:function(e){return(e-this.body.view.translation.y)/this.body.view.scale}},{key:"_YconvertCanvasToDOM",value:function(e){return e*this.body.view.scale+this.body.view.translation.y}},{key:"canvasToDOM",value:function(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}},{key:"DOMtoCanvas",value:function(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}}]),e}();t.default=u},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=i(5),h=i(57).default,l=function(){function e(t,i){var n=this;(0,s.default)(this,e),this.body=t,this.canvas=i,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction="easeInOutQuint",this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on("fit",this.fit.bind(this)),this.body.emitter.on("animationFinished",function(){n.body.emitter.emit("_stopRendering")}),this.body.emitter.on("unlockNode",this.releaseNode.bind(this))}return(0,a.default)(e,[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e}},{key:"fit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{nodes:[]},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=void 0,n=void 0;if(void 0!==e.nodes&&0!==e.nodes.length||(e.nodes=this.body.nodeIndices),!0===t){var o=0;for(var s in this.body.nodes)if(this.body.nodes.hasOwnProperty(s)){var r=this.body.nodes[s];!0===r.predefinedPosition&&(o+=1)}if(o>.5*this.body.nodeIndices.length)return void this.fit(e,!1);i=h.getRange(this.body.nodes,e.nodes);n=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;n*=Math.min(this.canvas.frame.canvas.clientWidth/600,this.canvas.frame.canvas.clientHeight/600)}else{this.body.emitter.emit("_resizeNodes"),i=h.getRange(this.body.nodes,e.nodes);var a=1.1*Math.abs(i.maxX-i.minX),d=1.1*Math.abs(i.maxY-i.minY),l=this.canvas.frame.canvas.clientWidth/a,u=this.canvas.frame.canvas.clientHeight/d;n=l<=u?l:u}n>1?n=1:0===n&&(n=1);var c=h.findCenter(i),f={position:c,scale:n,animation:e.animation};this.moveTo(f)}},{key:"focus",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==this.body.nodes[e]){var i={x:this.body.nodes[e].x,y:this.body.nodes[e].y};t.position=i,t.lockedOnNode=e,this.moveTo(t)}else console.log("Node: "+e+" cannot be found.")}},{key:"moveTo",value:function(e){if(void 0===e)return void(e={});void 0===e.offset&&(e.offset={x:0,y:0}),void 0===e.offset.x&&(e.offset.x=0),void 0===e.offset.y&&(e.offset.y=0),void 0===e.scale&&(e.scale=this.body.view.scale),void 0===e.position&&(e.position=this.getViewPosition()),void 0===e.animation&&(e.animation={duration:0}),!1===e.animation&&(e.animation={duration:0}),!0===e.animation&&(e.animation={}),void 0===e.animation.duration&&(e.animation.duration=1e3),void 0===e.animation.easingFunction&&(e.animation.easingFunction="easeInOutQuad"),this.animateView(e)}},{key:"animateView",value:function(e){if(void 0!==e){this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),!0===e.locked&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),0!=this.easingTime&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;var t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.position.x,y:t.y-e.position.y};this.targetTranslation={x:this.sourceTranslation.x+i.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+i.y*this.targetScale+e.offset.y},0===e.animation.duration?void 0!=this.lockedOnNodeId?(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)):(this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit("_requestRedraw")):(this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=this._transitionRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction),this.body.emitter.emit("_startRendering"))}}},{key:"_lockedRedraw",value:function(){var e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),i={x:t.x-e.x,y:t.y-e.y},n=this.body.view.translation,o={x:n.x+i.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:n.y+i.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=o}},{key:"releaseNode",value:function(){void 0!==this.lockedOnNodeId&&void 0!==this.viewFunction&&(this.body.emitter.off("initRedraw",this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}},{key:"_transitionRedraw",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.easingTime+=this.animationSpeed,this.easingTime=!0===e?1:this.easingTime;var t=d.easingFunctions[this.animationEasingFunction](this.easingTime);this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1&&(this.body.emitter.off("initRedraw",this.viewFunction),this.easingTime=0,void 0!=this.lockedOnNodeId&&(this.viewFunction=this._lockedRedraw.bind(this),this.body.emitter.on("initRedraw",this.viewFunction)),this.body.emitter.emit("animationFinished"))}},{key:"getScale",value:function(){return this.body.view.scale}},{key:"getViewPosition",value:function(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}}]),e}();t.default=l},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=i(5),h=i(182).default,l=i(183).default,u=function(){function e(t,i,n){(0,s.default)(this,e),this.body=t,this.canvas=i,this.selectionHandler=n,this.navigationHandler=new h(t,i),this.body.eventListeners.onTap=this.onTap.bind(this),this.body.eventListeners.onTouch=this.onTouch.bind(this),this.body.eventListeners.onDoubleTap=this.onDoubleTap.bind(this),this.body.eventListeners.onHold=this.onHold.bind(this),this.body.eventListeners.onDragStart=this.onDragStart.bind(this),this.body.eventListeners.onDrag=this.onDrag.bind(this),this.body.eventListeners.onDragEnd=this.onDragEnd.bind(this),this.body.eventListeners.onMouseWheel=this.onMouseWheel.bind(this),this.body.eventListeners.onPinch=this.onPinch.bind(this),this.body.eventListeners.onMouseMove=this.onMouseMove.bind(this),this.body.eventListeners.onRelease=this.onRelease.bind(this),this.body.eventListeners.onContext=this.onContext.bind(this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=this.getPointer.bind(this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0},d.extend(this.options,this.defaultOptions),this.bindEventListeners()}return(0,a.default)(e,[{key:"bindEventListeners",value:function(){var e=this;this.body.emitter.on("destroy",function(){clearTimeout(e.popupTimer),delete e.body.functions.getPointer})}},{key:"setOptions",value:function(e){if(void 0!==e){var t=["hideEdgesOnDrag","hideNodesOnDrag","keyboard","multiselect","selectable","selectConnectedEdges"];d.selectiveNotDeepExtend(t,this.options,e),d.mergeOptions(this.options,e,"keyboard"),e.tooltip&&(d.extend(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=d.parseColor(e.tooltip.color)))}this.navigationHandler.setOptions(this.options)}},{key:"getPointer",value:function(e){return{x:e.x-d.getAbsoluteLeft(this.canvas.frame.canvas),y:e.y-d.getAbsoluteTop(this.canvas.frame.canvas)}}},{key:"onTouch",value:function(e){(new Date).valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=(new Date).valueOf())}},{key:"onTap",value:function(e){var t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,e,i),this.selectionHandler._generateClickEvent("click",e,t)}},{key:"onDoubleTap",value:function(e){var t=this.getPointer(e.center);this.selectionHandler._generateClickEvent("doubleClick",e,t)}},{key:"onHold",value:function(e){var t=this.getPointer(e.center),i=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,e,i),this.selectionHandler._generateClickEvent("click",e,t),this.selectionHandler._generateClickEvent("hold",e,t)}},{key:"onRelease",value:function(e){if((new Date).valueOf()-this.touchTime>10){var t=this.getPointer(e.center);this.selectionHandler._generateClickEvent("release",e,t),this.touchTime=(new Date).valueOf()}}},{key:"onContext",value:function(e){var t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler._generateClickEvent("oncontext",e,t)}},{key:"checkSelectionChanges",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.selectionHandler.getSelection(),o=!1;o=!0===i?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e);var s=this.selectionHandler.getSelection(),r=this._determineDifference(n,s),a=this._determineDifference(s,n);r.edges.length>0&&(this.selectionHandler._generateClickEvent("deselectEdge",t,e,n),o=!0),r.nodes.length>0&&(this.selectionHandler._generateClickEvent("deselectNode",t,e,n),o=!0),a.nodes.length>0&&(this.selectionHandler._generateClickEvent("selectNode",t,e),o=!0),a.edges.length>0&&(this.selectionHandler._generateClickEvent("selectEdge",t,e),o=!0),!0===o&&this.selectionHandler._generateClickEvent("select",t,e)}},{key:"_determineDifference",value:function(e,t){var i=function(e,t){for(var i=[],n=0;n10&&(e=10);var n=void 0;void 0!==this.drag&&!0===this.drag.dragging&&(n=this.canvas.DOMtoCanvas(this.drag.pointer));var o=this.body.view.translation,s=e/i,r=(1-s)*t.x+o.x*s,a=(1-s)*t.y+o.y*s;if(this.body.view.scale=e,this.body.view.translation={x:r,y:a},void 0!=n){var d=this.canvas.canvasToDOM(n);this.drag.pointer.x=d.x,this.drag.pointer.y=d.y}this.body.emitter.emit("_requestRedraw"),i0&&(this.popupObj=d[u[u.length-1]],s=!0)}if(void 0===this.popupObj&&!1===s){for(var f=this.body.edgeIndices,p=this.body.edges,v=void 0,g=[],y=0;y0&&(this.popupObj=p[g[g.length-1]],r="edge")}void 0!==this.popupObj?this.popupObj.id!==o&&(void 0===this.popup&&(this.popup=new l(this.canvas.frame)),this.popup.popupTargetType=r,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit("showPopup",this.popupObj.id)):void 0!==this.popup&&(this.popup.hide(),this.body.emitter.emit("hidePopup"))}},{key:"_checkHidePopup",value:function(e){var t=this.selectionHandler._pointerToPositionObject(e),i=!1;if("node"===this.popup.popupTargetType){if(void 0!==this.body.nodes[this.popup.popupTargetId]&&!0===(i=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t))){var n=this.selectionHandler.getNodeAt(e);i=void 0!==n&&n.id===this.popup.popupTargetId}}else void 0===this.selectionHandler.getNodeAt(e)&&void 0!==this.body.edges[this.popup.popupTargetId]&&(i=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));!1===i&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit("hidePopup"))}}]),e}();t.default=u},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=i(22),h=i(35),l=i(52),u=function(){function e(t,i){var n=this;(0,s.default)(this,e),this.body=t,this.canvas=i,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on("activate",function(){n.activated=!0,n.configureKeyboardBindings()}),this.body.emitter.on("deactivate",function(){n.activated=!1,n.configureKeyboardBindings()}),this.body.emitter.on("destroy",function(){void 0!==n.keycharm&&n.keycharm.destroy()}),this.options={}}return(0,a.default)(e,[{key:"setOptions",value:function(e){void 0!==e&&(this.options=e,this.create())}},{key:"create",value:function(){!0===this.options.navigationButtons?!1===this.iconsCreated&&this.loadNavigationElements():!0===this.iconsCreated&&this.cleanNavigation(),this.configureKeyboardBindings()}},{key:"cleanNavigation",value:function(){if(0!=this.navigationHammers.length){for(var e=0;e700&&(this.body.emitter.emit("fit",{duration:700}),this.touchTime=(new Date).valueOf())}},{key:"_stopMovement",value:function(){for(var e in this.boundFunctions)this.boundFunctions.hasOwnProperty(e)&&(this.body.emitter.off("initRedraw",this.boundFunctions[e]),this.body.emitter.emit("_stopRendering"));this.boundFunctions={}}},{key:"_moveUp",value:function(){this.body.view.translation.y+=this.options.keyboard.speed.y}},{key:"_moveDown",value:function(){this.body.view.translation.y-=this.options.keyboard.speed.y}},{key:"_moveLeft",value:function(){this.body.view.translation.x+=this.options.keyboard.speed.x}},{key:"_moveRight",value:function(){this.body.view.translation.x-=this.options.keyboard.speed.x}},{key:"_zoomIn",value:function(){var e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,n=t/e,o=(1-n)*this.canvas.canvasViewCenter.x+i.x*n,s=(1-n)*this.canvas.canvasViewCenter.y+i.y*n;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"+",scale:this.body.view.scale,pointer:null})}},{key:"_zoomOut",value:function(){var e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),i=this.body.view.translation,n=t/e,o=(1-n)*this.canvas.canvasViewCenter.x+i.x*n,s=(1-n)*this.canvas.canvasViewCenter.y+i.y*n;this.body.view.scale=t,this.body.view.translation={x:o,y:s},this.body.emitter.emit("zoom",{direction:"-",scale:this.body.view.scale,pointer:null})}},{key:"configureKeyboardBindings",value:function(){var e=this;void 0!==this.keycharm&&this.keycharm.destroy(),!0===this.options.keyboard.enabled&&(!0===this.options.keyboard.bindToWindow?this.keycharm=l({container:window,preventDefault:!0}):this.keycharm=l({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),!0===this.activated&&(this.keycharm.bind("up",function(){e.bindToRedraw("_moveUp")},"keydown"),this.keycharm.bind("down",function(){e.bindToRedraw("_moveDown")},"keydown"),this.keycharm.bind("left",function(){e.bindToRedraw("_moveLeft")},"keydown"),this.keycharm.bind("right",function(){e.bindToRedraw("_moveRight")},"keydown"),this.keycharm.bind("=",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("num+",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("num-",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("-",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("[",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("]",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("pageup",function(){e.bindToRedraw("_zoomIn")},"keydown"),this.keycharm.bind("pagedown",function(){e.bindToRedraw("_zoomOut")},"keydown"),this.keycharm.bind("up",function(){e.unbindFromRedraw("_moveUp")},"keyup"),this.keycharm.bind("down",function(){e.unbindFromRedraw("_moveDown")},"keyup"),this.keycharm.bind("left",function(){e.unbindFromRedraw("_moveLeft")},"keyup"),this.keycharm.bind("right",function(){e.unbindFromRedraw("_moveRight")},"keyup"),this.keycharm.bind("=",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("num+",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("num-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("-",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("[",function(){e.unbindFromRedraw("_zoomOut")},"keyup"),this.keycharm.bind("]",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("pageup",function(){e.unbindFromRedraw("_zoomIn")},"keyup"),this.keycharm.bind("pagedown",function(){e.unbindFromRedraw("_zoomOut")},"keyup")))}}]),e}();t.default=u},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(0),s=n(o),r=i(1),a=n(r),d=function(){function e(t,i){(0,s.default)(this,e),this.container=t,this.overflowMethod=i||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return(0,a.default)(e,[{key:"setPosition",value:function(e,t){this.x=parseInt(e),this.y=parseInt(t)}},{key:"setText",value:function(e){e instanceof Element?(this.frame.innerHTML="",this.frame.appendChild(e)):this.frame.innerHTML=e}},{key:"show",value:function(e){if(void 0===e&&(e=!0),!0===e){var t=this.frame.clientHeight,i=this.frame.clientWidth,n=this.frame.parentNode.clientHeight,o=this.frame.parentNode.clientWidth,s=0,r=0;if("flip"==this.overflowMethod){var a=!1,d=!0;this.y-to-this.padding&&(a=!0),s=a?this.x-i:this.x,r=d?this.y-t:this.y}else r=this.y-t,r+t+this.padding>n&&(r=n-t-this.padding),ro&&(s=o-i-this.padding),s4&&void 0!==arguments[4]&&arguments[4],s=this._initBaseEvent(t,i);if(!0===o)s.nodes=[],s.edges=[];else{var r=this.getSelection();s.nodes=r.nodes,s.edges=r.edges}void 0!==n&&(s.previousSelection=n),"click"==e&&(s.items=this.getClickedItems(i)),this.body.emitter.emit(e,s)}},{key:"selectObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.selectConnectedEdges;return void 0!==e&&(e instanceof d&&!0===t&&this._selectConnectedEdges(e),e.select(),this._addToSelection(e),!0)}},{key:"deselectObject",value:function(e){!0===e.isSelected()&&(e.selected=!1,this._removeFromSelection(e))}},{key:"_getAllNodesOverlappingWith",value:function(e){for(var t=[],i=this.body.nodes,n=0;n1&&void 0!==arguments[1])||arguments[1],i=this._pointerToPositionObject(e),n=this._getAllNodesOverlappingWith(i);return n.length>0?!0===t?this.body.nodes[n[n.length-1]]:n[n.length-1]:void 0}},{key:"_getEdgesOverlappingWith",value:function(e,t){for(var i=this.body.edges,n=0;n1&&void 0!==arguments[1])||arguments[1],i=this.canvas.DOMtoCanvas(e),n=10,o=null,s=this.body.edges,r=0;r1)return!0;return!1}},{key:"_selectConnectedEdges",value:function(e){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:{},i=void 0,n=void 0;if(!e||!e.nodes&&!e.edges)throw"Selection must be an object with nodes and/or edges properties";if((t.unselectAll||void 0===t.unselectAll)&&this.unselectAll(),e.nodes)for(i=0;i1&&void 0!==arguments[1])||arguments[1];if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({nodes:e},{highlightEdges:t})}},{key:"selectEdges",value:function(e){if(!e||void 0===e.length)throw"Selection must be an array with ids";this.setSelection({edges:e})}},{key:"updateSelection",value:function(){for(var e in this.selectionObj.nodes)this.selectionObj.nodes.hasOwnProperty(e)&&(this.body.nodes.hasOwnProperty(e)||delete this.selectionObj.nodes[e]);for(var t in this.selectionObj.edges)this.selectionObj.edges.hasOwnProperty(t)&&(this.body.edges.hasOwnProperty(t)||delete this.selectionObj.edges[t])}},{key:"getClickedItems",value:function(e){for(var t=this.canvas.DOMtoCanvas(e),i=[],n=this.body.nodeIndices,o=this.body.nodes,s=n.length-1;s>=0;s--){var r=o[n[s]],a=r.getItemsOnPoint(t);i.push.apply(i,a)}for(var d=this.body.edgeIndices,h=this.body.edges,l=d.length-1;l>=0;l--){var u=h[d[l]],c=u.getItemsOnPoint(t);i.push.apply(i,c)}return i}}]),e}();t.default=u},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(23),s=n(o),r=i(7),a=n(r),d=i(10),h=n(d),l=i(0),u=n(l),c=i(1),f=n(c),p=i(5),v=i(57).default,g=i(186),y=g.HorizontalStrategy,m=g.VerticalStrategy,b=function(){function e(){(0,u.default)(this,e),this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}return(0,f.default)(e,[{key:"addRelation",value:function(e,t){void 0===this.childrenReference[e]&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),void 0===this.parentReference[t]&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}},{key:"checkIfTree",value:function(){for(var e in this.parentReference)if(this.parentReference[e].length>1)return void(this.isTree=!1);this.isTree=!0}},{key:"numTrees",value:function(){return this.treeIndex+1}},{key:"setTreeIndex",value:function(e,t){void 0!==t&&void 0===this.trees[e.id]&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}},{key:"ensureLevel",value:function(e){void 0===this.levels[e]&&(this.levels[e]=0)}},{key:"getMaxLevel",value:function(e){var t=this,i={};return function e(n){if(void 0!==i[n])return i[n];var o=t.levels[n];if(t.childrenReference[n]){var s=t.childrenReference[n];if(s.length>0)for(var r=0;r0&&(i.levelSeparation*=-1):i.levelSeparation<0&&(i.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit("_resetHierarchicalLayout"),this.adaptAllOptionsForHierarchicalLayout(t);if(!0===n)return this.body.emitter.emit("refresh"),p.deepExtend(t,this.optionsBackup)}return t}},{key:"adaptAllOptionsForHierarchicalLayout",value:function(e){if(!0===this.options.hierarchical.enabled){var t=this.optionsBackup.physics;void 0===e.physics||!0===e.physics?(e.physics={enabled:void 0===t.enabled||t.enabled,solver:"hierarchicalRepulsion"},t.enabled=void 0===t.enabled||t.enabled,t.solver=t.solver||"barnesHut"):"object"===(0,a.default)(e.physics)?(t.enabled=void 0===e.physics.enabled||e.physics.enabled,t.solver=e.physics.solver||"barnesHut",e.physics.solver="hierarchicalRepulsion"):!1!==e.physics&&(t.solver="barnesHut",e.physics={solver:"hierarchicalRepulsion"});var i=this.direction.curveType();if(void 0===e.edges)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges={smooth:!1};else if(void 0===e.edges.smooth)this.optionsBackup.edges={smooth:{enabled:!0,type:"dynamic"}},e.edges.smooth=!1;else if("boolean"==typeof e.edges.smooth)this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:i};else{var n=e.edges.smooth;void 0!==n.type&&"dynamic"!==n.type&&(i=n.type),this.optionsBackup.edges={smooth:void 0===n.enabled||n.enabled,type:void 0===n.type?"dynamic":n.type,roundness:void 0===n.roundness?.5:n.roundness,forceDirection:void 0!==n.forceDirection&&n.forceDirection},e.edges.smooth={enabled:void 0===n.enabled||n.enabled,type:i,roundness:void 0===n.roundness?.5:n.roundness,forceDirection:void 0!==n.forceDirection&&n.forceDirection}}this.body.emitter.emit("_forceDisableDynamicCurves",i)}return e}},{key:"seededRandom",value:function(){var e=1e4*Math.sin(this.randomSeed++);return e-Math.floor(e)}},{key:"positionInitially",value:function(e){if(!0!==this.options.hierarchical.enabled){this.randomSeed=this.initialRandomSeed;for(var t=e.length+50,i=0;i150){for(var s=e.length;e.length>150&&n<=10;){n+=1;var r=e.length;n%3==0?this.body.modules.clustering.clusterBridges(o):this.body.modules.clustering.clusterOutliers(o);if(r==e.length&&n%3!=0)return this._declusterAll(),this.body.emitter.emit("_layoutFailed"),void console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.")}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*s)})}n>10&&console.info("The clustering didn't succeed within the amount of interations allowed, progressing with partial result."),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(var a=0;a0){var e=void 0,t=void 0,i=!1,n=!1;this.lastNodeOnLevel={},this.hierarchical=new b;for(t in this.body.nodes)this.body.nodes.hasOwnProperty(t)&&(e=this.body.nodes[t],void 0!==e.options.level?(i=!0,this.hierarchical.levels[t]=e.options.level):n=!0);if(!0===n&&!0===i)throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");if(!0===n){var o=this.options.hierarchical.sortMethod;"hubsize"===o?this._determineLevelsByHubsize():"directed"===o?this._determineLevelsDirected():"custom"===o&&this._determineLevelsCustomCallback()}for(var s in this.body.nodes)this.body.nodes.hasOwnProperty(s)&&this.hierarchical.ensureLevel(s);var r=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(r),this._condenseHierarchy(),this._shiftToCenter()}}},{key:"_condenseHierarchy",value:function(){var e=this,t=!1,i={},n=function(t,i){var n=e.hierarchical.trees;for(var o in n)n.hasOwnProperty(o)&&n[o]===t&&e.direction.shift(o,i)},o=function(){for(var t=[],i=0;i0)for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:1e9,n=1e9,o=1e9,r=1e9,a=-1e9;for(var d in t)if(t.hasOwnProperty(d)){var h=e.body.nodes[d],l=e.hierarchical.levels[h.id],u=e.direction.getPosition(h),c=e._getSpaceAroundNode(h,t),f=(0,s.default)(c,2),p=f[0],v=f[1];n=Math.min(p,n),o=Math.min(v,o),l<=i&&(r=Math.min(u,r),a=Math.max(u,a))}return[r,a,n,o]},d=function(t,i){var n=e.hierarchical.getMaxLevel(t.id),o=e.hierarchical.getMaxLevel(i.id);return Math.min(n,o)},h=function(t,i,n){for(var o=e.hierarchical,s=0;s1)for(var d=0;d2&&void 0!==arguments[2]&&arguments[2],s=e.direction.getPosition(i),h=e.direction.getPosition(n),l=Math.abs(h-s),u=e.options.hierarchical.nodeSpacing;if(l>u){var c={},f={};r(i,c),r(n,f);var p=d(i,n),v=a(c,p),g=a(f,p),y=v[1],m=g[0],b=g[2];if(Math.abs(y-m)>u){var _=y-m+u;_<-b+u&&(_=-b+u),_<0&&(e._shiftBlock(n.id,_),t=!0,!0===o&&e._centerParent(n))}}},u=function(n,o){for(var d=o.id,h=o.edges,l=e.hierarchical.levels[o.id],u=e.options.hierarchical.levelSeparation*e.options.hierarchical.levelSeparation,c={},f=[],p=0;p0?f=Math.min(c,u-e.options.hierarchical.nodeSpacing):c<0&&(f=-Math.min(-c,l-e.options.hierarchical.nodeSpacing)),0!=f&&(e._shiftBlock(o.id,f),t=!0)}(_),_=b(n,h),function(i){var n=e.direction.getPosition(o),r=e._getSpaceAroundNode(o),a=(0,s.default)(r,2),d=a[0],h=a[1],l=i-n,u=n;l>0?u=Math.min(n+(h-e.options.hierarchical.nodeSpacing),i):l<0&&(u=Math.max(n-(d-e.options.hierarchical.nodeSpacing),i)),u!==n&&(e.direction.setPosition(o,u),t=!0)}(_)};!0===this.options.hierarchical.blockShifting&&(function(i){var n=e.hierarchical.getLevels();n=n.reverse();for(var o=0;o0&&Math.abs(f)0&&(a=this.direction.getPosition(i[o-1])+r),this.direction.setPosition(s,a,t),this._validatePositionAndContinue(s,t,a),n++}}}}},{key:"_placeBranchNodes",value:function(e,t){var i=this.hierarchical.childrenReference[e];if(void 0!==i){for(var n=[],o=0;ot&&void 0===this.positionedNodes[r.id]))return;var d=this.options.hierarchical.nodeSpacing,h=void 0;h=0===s?this.direction.getPosition(this.body.nodes[e]):this.direction.getPosition(n[s-1])+d,this.direction.setPosition(r,h,a),this._validatePositionAndContinue(r,a,h)}var l=this._getCenterPosition(n);this.direction.setPosition(this.body.nodes[e],l,t)}}},{key:"_validatePositionAndContinue",value:function(e,t,i){if(this.hierarchical.isTree){if(void 0!==this.lastNodeOnLevel[t]){var n=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(i-ne.hierarchical.levels[t.id]&&e.hierarchical.addRelation(t.id,i.id)};this._crawlNetwork(t),this.hierarchical.checkIfTree()}},{key:"_crawlNetwork",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},i=arguments[1],n={},o=function i(o,s){if(void 0===n[o.id]){e.hierarchical.setTreeIndex(o,s),n[o.id]=!0;for(var r=void 0,a=e._getActiveEdges(o),d=0;d2&&void 0!==arguments[2]?arguments[2]:void 0;this.fake_use(e,t,i),this.abstract()}},{key:"getTreeSize",value:function(e){return this.fake_use(e),this.abstract()}},{key:"sort",value:function(e){this.fake_use(e),this.abstract()}},{key:"fix",value:function(e,t){this.fake_use(e,t),this.abstract()}},{key:"shift",value:function(e,t){this.fake_use(e,t),this.abstract()}}]),e}(),v=function(e){function t(e){(0,u.default)(this,t);var i=(0,a.default)(this,(t.__proto__||(0,s.default)(t)).call(this));return i.layout=e,i}return(0,h.default)(t,e),(0,f.default)(t,[{key:"curveType",value:function(){return"horizontal"}},{key:"getPosition",value:function(e){return e.x}},{key:"setPosition",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==i&&this.layout.hierarchical.addToOrdering(e,i),e.x=t}},{key:"getTreeSize",value:function(e){var t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}},{key:"sort",value:function(e){e.sort(function(e,t){return void 0===e.x||void 0===t.x?0:e.x-t.x})}},{key:"fix",value:function(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}},{key:"shift",value:function(e,t){this.layout.body.nodes[e].x+=t}}]),t}(p),g=function(e){function t(e){(0,u.default)(this,t);var i=(0,a.default)(this,(t.__proto__||(0,s.default)(t)).call(this));return i.layout=e,i}return(0,h.default)(t,e),(0,f.default)(t,[{key:"curveType",value:function(){return"vertical"}},{key:"getPosition",value:function(e){return e.y}},{key:"setPosition",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;void 0!==i&&this.layout.hierarchical.addToOrdering(e,i),e.y=t}},{key:"getTreeSize",value:function(e){var t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}},{key:"sort",value:function(e){e.sort(function(e,t){return void 0===e.y||void 0===t.y?0:e.y-t.y})}},{key:"fix",value:function(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}},{key:"shift",value:function(e,t){this.layout.body.nodes[e].y+=t}}]),t}(p);t.HorizontalStrategy=g,t.VerticalStrategy=v},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(10),s=n(o),r=i(21),a=n(r),d=i(7),h=n(d),l=i(0),u=n(l),c=i(1),f=n(c),p=i(5),v=i(22),g=i(35),y=function(){function e(t,i,n){var o=this;(0,u.default)(this,e),this.body=t,this.canvas=i,this.selectionHandler=n,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this.manipulationHammers=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},p.extend(this.options,this.defaultOptions),this.body.emitter.on("destroy",function(){o._clean()}),this.body.emitter.on("_dataChanged",this._restore.bind(this)),this.body.emitter.on("_resetData",this._restore.bind(this))}return(0,f.default)(e,[{key:"_restore",value:function(){!1!==this.inMode&&(!0===this.options.initiallyActive?this.enableEditMode():this.disableEditMode())}},{key:"setOptions",value:function(e,t,i){void 0!==t&&(void 0!==t.locale?this.options.locale=t.locale:this.options.locale=i.locale,void 0!==t.locales?this.options.locales=t.locales:this.options.locales=i.locales),void 0!==e&&("boolean"==typeof e?this.options.enabled=e:(this.options.enabled=!0,p.deepExtend(this.options,e)),!0===this.options.initiallyActive&&(this.editMode=!0),this._setup())}},{key:"toggleEditMode",value:function(){!0===this.editMode?this.disableEditMode():this.enableEditMode()}},{key:"enableEditMode",value:function(){this.editMode=!0,this._clean(),!0===this.guiEnabled&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}},{key:"disableEditMode",value:function(){this.editMode=!1,this._clean(),!0===this.guiEnabled&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}},{key:"showManipulatorToolbar",value:function(){if(this._clean(),this.manipulationDOM={},!0===this.guiEnabled){this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";var e=this.selectionHandler._getSelectedNodeCount(),t=this.selectionHandler._getSelectedEdgeCount(),i=e+t,n=this.options.locales[this.options.locale],o=!1;!1!==this.options.addNode&&(this._createAddNodeButton(n),o=!0),!1!==this.options.addEdge&&(!0===o?this._createSeperator(1):o=!0,this._createAddEdgeButton(n)),1===e&&"function"==typeof this.options.editNode?(!0===o?this._createSeperator(2):o=!0,this._createEditNodeButton(n)):1===t&&0===e&&!1!==this.options.editEdge&&(!0===o?this._createSeperator(3):o=!0,this._createEditEdgeButton(n)),0!==i&&(e>0&&!1!==this.options.deleteNode?(!0===o&&this._createSeperator(4),this._createDeleteButton(n)):0===e&&!1!==this.options.deleteEdge&&(!0===o&&this._createSeperator(4),this._createDeleteButton(n))),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this)),this._temporaryBindEvent("select",this.showManipulatorToolbar.bind(this))}this.body.emitter.emit("_redraw")}},{key:"addNodeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addNode",!0===this.guiEnabled){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.addDescription||this.options.locales.en.addDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindEvent("click",this._performAddNode.bind(this))}},{key:"editNode",value:function(){var e=this;!0!==this.editMode&&this.enableEditMode(),this._clean();var t=this.selectionHandler._getSelectedNode();if(void 0!==t){if(this.inMode="editNode","function"!=typeof this.options.editNode)throw new Error("No function has been configured to handle the editing of nodes.");if(!0!==t.isCluster){var i=p.deepExtend({},t.options,!1);if(i.x=t.x,i.y=t.y,2!==this.options.editNode.length)throw new Error("The function for edit does not support two arguments (data, callback)");this.options.editNode(i,function(t){null!==t&&void 0!==t&&"editNode"===e.inMode&&e.body.data.nodes.getDataSet().update(t),e.showManipulatorToolbar()})}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError)}else this.showManipulatorToolbar()}},{key:"addEdgeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="addEdge",!0===this.guiEnabled){var e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.edgeDescription||this.options.locales.en.edgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}this._temporaryBindUI("onTouch",this._handleConnect.bind(this)),this._temporaryBindUI("onDragEnd",this._finishConnect.bind(this)),this._temporaryBindUI("onDrag",this._dragControlNode.bind(this)),this._temporaryBindUI("onRelease",this._finishConnect.bind(this)),this._temporaryBindUI("onDragStart",this._dragStartEdge.bind(this)),this._temporaryBindUI("onHold",function(){})}},{key:"editEdgeMode",value:function(){if(!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="editEdge","object"===(0,h.default)(this.options.editEdge)&&"function"==typeof this.options.editEdge.editWithoutDrag&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId)){var e=this.body.edges[this.edgeBeingEditedId];return void this._performEditEdge(e.from,e.to)}if(!0===this.guiEnabled){var t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindHammerToDiv(this.closeDiv,this.toggleEditMode.bind(this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdges()[0],void 0!==this.edgeBeingEditedId){var i=this.body.edges[this.edgeBeingEditedId],n=this._getNewTargetNode(i.from.x,i.from.y),o=this._getNewTargetNode(i.to.x,i.to.y);this.temporaryIds.nodes.push(n.id),this.temporaryIds.nodes.push(o.id),this.body.nodes[n.id]=n,this.body.nodeIndices.push(n.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this._temporaryBindUI("onTouch",this._controlNodeTouch.bind(this)),this._temporaryBindUI("onTap",function(){}),this._temporaryBindUI("onHold",function(){}),this._temporaryBindUI("onDragStart",this._controlNodeDragStart.bind(this)),this._temporaryBindUI("onDrag",this._controlNodeDrag.bind(this)),this._temporaryBindUI("onDragEnd",this._controlNodeDragEnd.bind(this)),this._temporaryBindUI("onMouseMove",function(){}),this._temporaryBindEvent("beforeDrawing",function(e){var t=i.edgeType.findBorderPositions(e);!1===n.selected&&(n.x=t.from.x,n.y=t.from.y),!1===o.selected&&(o.x=t.to.x,o.y=t.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}},{key:"deleteSelected",value:function(){var e=this;!0!==this.editMode&&this.enableEditMode(),this._clean(),this.inMode="delete";var t=this.selectionHandler.getSelectedNodes(),i=this.selectionHandler.getSelectedEdges(),n=void 0;if(t.length>0){for(var o=0;o0&&"function"==typeof this.options.deleteEdge&&(n=this.options.deleteEdge);if("function"==typeof n){var s={nodes:t,edges:i};if(2!==n.length)throw new Error("The function for delete does not support two arguments (data, callback)");n(s,function(t){null!==t&&void 0!==t&&"delete"===e.inMode?(e.body.data.edges.getDataSet().remove(t.edges),e.body.data.nodes.getDataSet().remove(t.nodes),e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar()):(e.body.emitter.emit("startSimulation"),e.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().remove(i),this.body.data.nodes.getDataSet().remove(t),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}},{key:"_setup",value:function(){!0===this.options.enabled?(this.guiEnabled=!0,this._createWrappers(),!1===this.editMode?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}},{key:"_createWrappers",value:function(){void 0===this.manipulationDiv&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",!0===this.editMode?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),void 0===this.editModeDiv&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",!0===this.editMode?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),void 0===this.closeDiv&&(this.closeDiv=document.createElement("div"),this.closeDiv.className="vis-close",this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}},{key:"_getNewTargetNode",value:function(e,t){var i=p.deepExtend({},this.options.controlNodeStyle);i.id="targetNode"+p.randomUUID(),i.hidden=!1,i.physics=!1,i.x=e,i.y=t;var n=this.body.functions.createNode(i);return n.shape.boundingBox={left:e,right:e,top:t,bottom:t},n}},{key:"_createEditButton",value:function(){this._clean(),this.manipulationDOM={},p.recursiveDOMDelete(this.editModeDiv);var e=this.options.locales[this.options.locale],t=this._createButton("editMode","vis-button vis-edit vis-edit-mode",e.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(t),this._bindHammerToDiv(t,this.toggleEditMode.bind(this))}},{key:"_clean",value:function(){this.inMode=!1,!0===this.guiEnabled&&(p.recursiveDOMDelete(this.editModeDiv),p.recursiveDOMDelete(this.manipulationDiv),this._cleanManipulatorHammers()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}},{key:"_cleanManipulatorHammers",value:function(){if(0!=this.manipulationHammers.length){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}},{key:"_createAddNodeButton",value:function(e){var t=this._createButton("addNode","vis-button vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.addNodeMode.bind(this))}},{key:"_createAddEdgeButton",value:function(e){var t=this._createButton("addEdge","vis-button vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.addEdgeMode.bind(this))}},{key:"_createEditNodeButton",value:function(e){var t=this._createButton("editNode","vis-button vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.editNode.bind(this))}},{key:"_createEditEdgeButton",value:function(e){var t=this._createButton("editEdge","vis-button vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.editEdgeMode.bind(this))}},{key:"_createDeleteButton",value:function(e){var t;t=this.options.rtl?"vis-button vis-delete-rtl":"vis-button vis-delete";var i=this._createButton("delete",t,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(i),this._bindHammerToDiv(i,this.deleteSelected.bind(this))}},{key:"_createBackButton",value:function(e){var t=this._createButton("back","vis-button vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(t),this._bindHammerToDiv(t,this.showManipulatorToolbar.bind(this))}},{key:"_createButton",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("div"),this.manipulationDOM[e+"Div"].className=t,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=n,this.manipulationDOM[e+"Label"].innerHTML=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}},{key:"_createDescription",value:function(e){this.manipulationDiv.appendChild(this._createButton("description","vis-button vis-none",e))}},{key:"_temporaryBindEvent",value:function(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}},{key:"_temporaryBindUI",value:function(e,t){if(void 0===this.body.eventListeners[e])throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+(0,a.default)((0,s.default)(this.body.eventListeners)));this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t}},{key:"_unbindTemporaryUIs",value:function(){for(var e in this.temporaryUIFunctions)this.temporaryUIFunctions.hasOwnProperty(e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}},{key:"_unbindTemporaryEvents",value:function(){for(var e=0;e=0;r--)if(o[r]!==this.selectedControlNode.id){s=this.body.nodes[o[r]];break}if(void 0!==s&&void 0!==this.selectedControlNode)if(!0===s.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var a=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===a.id?this._performEditEdge(s.id,n.to.id):this._performEditEdge(n.from.id,s.id)}else n.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}}},{key:"_handleConnect",value:function(e){if((new Date).valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=p.extend({},this.body.view.translation);var t=this.lastTouch,i=this.selectionHandler.getNodeAt(t);if(void 0!==i)if(!0===i.isCluster)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{var n=this._getNewTargetNode(i.x,i.y);this.body.nodes[n.id]=n,this.body.nodeIndices.push(n.id);var o=this.body.functions.createEdge({id:"connectionEdge"+p.randomUUID(),from:i.id,to:n.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[o.id]=o,this.body.edgeIndices.push(o.id),this.temporaryIds.nodes.push(n.id),this.temporaryIds.edges.push(o.id)}this.touchTime=(new Date).valueOf()}}},{key:"_dragControlNode",value:function(e){var t=this.body.functions.getPointer(e.center);if(void 0!==this.temporaryIds.nodes[0]){var i=this.body.nodes[this.temporaryIds.nodes[0]];i.x=this.canvas._XconvertDOMtoCanvas(t.x),i.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit("_redraw")}else{var n=t.x-this.lastTouch.x,o=t.y-this.lastTouch.y;this.body.view.translation={x:this.lastTouch.translation.x+n,y:this.lastTouch.translation.y+o}}}},{key:"_finishConnect",value:function(e){var t=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(t),n=void 0;void 0!==this.temporaryIds.edges[0]&&(n=this.body.edges[this.temporaryIds.edges[0]].fromId);for(var o=this.selectionHandler._getAllNodesOverlappingWith(i),s=void 0,r=o.length-1;r>=0;r--)if(-1===this.temporaryIds.nodes.indexOf(o[r])){s=this.body.nodes[o[r]];break}this._cleanupTemporaryNodesAndEdges(),void 0!==s&&(!0===s.isCluster?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):void 0!==this.body.nodes[n]&&void 0!==this.body.nodes[s.id]&&this._performAddEdge(n,s.id)),this.body.emitter.emit("_redraw")}},{key:"_dragStartEdge",value:function(e){var t=this.lastTouch;this.selectionHandler._generateClickEvent("dragStart",e,t,void 0,!0)}},{key:"_performAddNode",value:function(e){var t=this,i={id:p.randomUUID(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if("function"==typeof this.options.addNode){if(2!==this.options.addNode.length)throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");this.options.addNode(i,function(e){null!==e&&void 0!==e&&"addNode"===t.inMode&&(t.body.data.nodes.getDataSet().add(e),t.showManipulatorToolbar())})}else this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()}},{key:"_performAddEdge",value:function(e,t){var i=this,n={from:e,to:t};if("function"==typeof this.options.addEdge){if(2!==this.options.addEdge.length)throw new Error("The function for connect does not support two arguments (data,callback)");this.options.addEdge(n,function(e){null!==e&&void 0!==e&&"addEdge"===i.inMode&&(i.body.data.edges.getDataSet().add(e),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().add(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},{key:"_performEditEdge",value:function(e,t){var i=this,n={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges._data[this.edgeBeingEditedId].label},o=this.options.editEdge;if("object"===(void 0===o?"undefined":(0,h.default)(o))&&(o=o.editWithoutDrag),"function"==typeof o){if(2!==o.length)throw new Error("The function for edit does not support two arguments (data, callback)");o(n,function(e){null===e||void 0===e||"editEdge"!==i.inMode?(i.body.edges[n.id].updateEdgeType(),i.body.emitter.emit("_redraw"),i.showManipulatorToolbar()):(i.body.data.edges.getDataSet().update(e),i.selectionHandler.unselectAll(),i.showManipulatorToolbar())})}else this.body.data.edges.getDataSet().update(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}]),e}();t.default=y},function(e,t,i){function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(21),s=n(o),r=i(7),a=n(r),d=i(0),h=n(d),l=i(1),u=n(l),c=i(5),f=i(189).default,p=function(){function e(t,i,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,h.default)(this,e),this.parent=t,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},c.extend(this.options,this.defaultOptions),this.configureOptions=n,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new f(o),this.wrapper=void 0}return(0,u.default)(e,[{key:"setOptions",value:function(e){if(void 0!==e){this.popupHistory={},this._removePopup();var t=!0;"string"==typeof e?this.options.filter=e:e instanceof Array?this.options.filter=e.join():"object"===(void 0===e?"undefined":(0,a.default)(e))?(void 0!==e.container&&(this.options.container=e.container),void 0!==e.filter&&(this.options.filter=e.filter),void 0!==e.showButton&&(this.options.showButton=e.showButton),void 0!==e.enabled&&(t=e.enabled)):"boolean"==typeof e?(this.options.filter=!0,t=e):"function"==typeof e&&(this.options.filter=e,t=!0),!1===this.options.filter&&(t=!1),this.options.enabled=t}this._clean()}},{key:"setModuleOptions",value:function(e){this.moduleOptions=e,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){var e=this;this._clean(),this.changedOptions=[];var t=this.options.filter,i=0,n=!1;for(var o in this.configureOptions)this.configureOptions.hasOwnProperty(o)&&(this.allowCreation=!1,n=!1,"function"==typeof t?(n=t(o,[]),n=n||this._handleObject(this.configureOptions[o],[o],!0)):!0!==t&&-1===t.indexOf(o)||(n=!0),!1!==n&&(this.allowCreation=!0,i>0&&this._makeItem([]),this._makeHeader(o),this._handleObject(this.configureOptions[o],[o])),i++);if(!0===this.options.showButton){var s=document.createElement("div");s.className="vis-configuration vis-config-button",s.innerHTML="generate options",s.onclick=function(){e._printOptions()},s.onmouseover=function(){s.className="vis-configuration vis-config-button hover"},s.onmouseout=function(){s.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(s)}this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var e=0;e1?i-1:0),o=1;o2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");return n.className="vis-configuration vis-config-label vis-config-s"+t.length,n.innerHTML=!0===i?""+e+":":e+":",n}},{key:"_makeDropdown",value:function(e,t,i){var n=document.createElement("select");n.className="vis-configuration vis-config-select";var o=0;void 0!==t&&-1!==e.indexOf(t)&&(o=e.indexOf(t));for(var s=0;ss&&1!==s&&(a.max=Math.ceil(1.2*t),h=a.max,d="range increased"),a.value=t}else a.value=n;var l=document.createElement("input");l.className="vis-configuration vis-config-rangeinput",l.value=a.value;var u=this;a.onchange=function(){l.value=this.value,u._update(Number(this.value),i)},a.oninput=function(){l.value=this.value};var c=this._makeLabel(i[i.length-1],i),f=this._makeItem(i,c,a,l);""!==d&&this.popupHistory[f]!==h&&(this.popupHistory[f]=h,this._setupPopup(d,f))}},{key:"_setupPopup",value:function(e,t){var i=this;if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!1,o=this.options.filter,s=!1;for(var r in e)if(e.hasOwnProperty(r)){n=!0;var a=e[r],d=c.copyAndExtendArray(t,r);if("function"==typeof o&&!1===(n=o(r,t))&&!(a instanceof Array)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,n=this._handleObject(a,d,!0),this.allowCreation=!1===i),!1!==n){s=!0;var h=this._getValue(d);if(a instanceof Array)this._handleArray(a,h,d);else if("string"==typeof a)this._makeTextInput(a,h,d);else if("boolean"==typeof a)this._makeCheckbox(a,h,d);else if(a instanceof Object){var l=!0;if(-1!==t.indexOf("physics")&&this.moduleOptions.physics.solver!==r&&(l=!1),!0===l)if(void 0!==a.enabled){var u=c.copyAndExtendArray(d,"enabled"),f=this._getValue(u);if(!0===f){var p=this._makeLabel(r,d,!0);this._makeItem(d,p),s=this._handleObject(a,d)||s}else this._makeCheckbox(a,f,d)}else{var v=this._makeLabel(r,d,!0);this._makeItem(d,v),s=this._handleObject(a,d)||s}}else console.error("dont know how to handle",a,r,d)}}return s}},{key:"_handleArray",value:function(e,t,i){"string"==typeof e[0]&&"color"===e[0]?(this._makeColorField(e,t,i),e[1]!==t&&this.changedOptions.push({path:i,value:t})):"string"==typeof e[0]?(this._makeDropdown(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:t})):"number"==typeof e[0]&&(this._makeRange(e,t,i),e[0]!==t&&this.changedOptions.push({path:i,value:Number(t)}))}},{key:"_update",value:function(e,t){var i=this._constructOptions(e,t);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i;e="true"===e||e,e="false"!==e&&e;for(var o=0;ovar options = "+(0,s.default)(e,null,2)+""}},{key:"getOptions",value:function(){for(var e={},t=0;t0&&void 0!==arguments[0]?arguments[0]:1;(0,a.default)(this,e),this.pixelRatio=t,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return(0,h.default)(e,[{key:"insertTo",value:function(e){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=e,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=e}},{key:"setCloseCallback",value:function(e){if("function"!=typeof e)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=e}},{key:"_isColorString",value:function(e){var t={black:"#000000",navy:"#000080",darkblue:"#00008B",mediumblue:"#0000CD",blue:"#0000FF",darkgreen:"#006400",green:"#008000",teal:"#008080",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",lime:"#00FF00",springgreen:"#00FF7F",aqua:"#00FFFF",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",mediumaquamarine:"#66CDAA",dimgray:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",lightslategray:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",maroon:"#800000",purple:"#800080",olive:"#808000",gray:"#808080",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370D8",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",silver:"#C0C0C0",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgrey:"#D3D3D3",palevioletred:"#D87093",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",red:"#FF0000",fuchsia:"#FF00FF",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",yellow:"#FFFF00",lightyellow:"#FFFFE0",ivory:"#FFFFF0",white:"#FFFFFF"};if("string"==typeof e)return t[e]}},{key:"setColor",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==e){var i=void 0,n=this._isColorString(e);if(void 0!==n&&(e=n),!0===c.isString(e)){if(!0===c.isValidRGB(e)){var o=e.substr(4).substr(0,e.length-5).split(",");i={r:o[0],g:o[1],b:o[2],a:1}}else if(!0===c.isValidRGBA(e)){var r=e.substr(5).substr(0,e.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(!0===c.isValidHex(e)){var a=c.hexToRGB(e);i={r:a.r,g:a.g,b:a.b,a:1}}}else if(e instanceof Object&&void 0!==e.r&&void 0!==e.g&&void 0!==e.b){var d=void 0!==e.a?e.a:"1.0";i={r:e.r,g:e.g,b:e.b,a:d}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+(0,s.default)(e));this._setColor(i,t)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var e=this;!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.previousColor=c.extend({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",setTimeout(function(){void 0!==e.closeCallback&&(e.closeCallback(),e.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(e){!0===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(this.initialColor=c.extend({},e)),this.color=e;var t=c.RGBToHSV(e.r,e.g,e.b),i=2*Math.PI,n=this.r*t.s,o=this.centerCoordinates.x+n*Math.sin(i*t.h),s=this.centerCoordinates.y+n*Math.cos(i*t.h);this.colorPickerSelector.style.left=o-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=s-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(e)}},{key:"_setOpacity",value:function(e){this.color.a=e/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(e){var t=c.RGBToHSV(this.color.r,this.color.g,this.color.b);t.v=e/100;var i=c.HSVToRGB(t.h,t.s,t.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,t=c.RGBToHSV(e.r,e.g,e.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var n=this.colorPickerCanvas.clientWidth,o=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,n,o),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-t.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),i.fill(),this.brightnessRange.value=100*t.v,this.opacityRange.value=100*e.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var e=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var t=document.createElement("DIV");t.style.color="red",t.style.fontWeight="bold",t.style.padding="10px",t.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(t)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(e){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(e){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var i=this;this.opacityRange.onchange=function(){i._setOpacity(this.value)},this.opacityRange.oninput=function(){i._setOpacity(this.value)},this.brightnessRange.onchange=function(){i._setBrightness(this.value)},this.brightnessRange.oninput=function(){i._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=this._hide.bind(this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=this._apply.bind(this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=this._save.bind(this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=this._loadLast.bind(this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var e=this;this.drag={},this.pinch={},this.hammer=new l(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),u.onTouch(this.hammer,function(t){e._moveSelector(t)}),this.hammer.on("tap",function(t){e._moveSelector(t)}),this.hammer.on("panstart",function(t){e._moveSelector(t)}),this.hammer.on("panmove",function(t){e._moveSelector(t)}),this.hammer.on("panend",function(t){e._moveSelector(t)})}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var e=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1)),e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var t=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;e.clearRect(0,0,t,i);var n=void 0,o=void 0,s=void 0,r=void 0;this.centerCoordinates={x:.5*t,y:.5*i},this.r=.49*t;var a=2*Math.PI/360,d=1/this.r,h=void 0;for(s=0;s<360;s++)for(r=0;r2&&void 0!==arguments[2]&&arguments[2],n=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(n),this._createK_matrix(n),this._createE_matrix();for(var o=0,r=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),a=1e9,d=0,h=0,l=0,u=0,c=0;a>.01&&o1&&c<5;){c+=1,this._moveNode(d,h,l);var v=this._getEnergy(d),g=(0,s.default)(v,3);u=g[0],h=g[1],l=g[2]}}}},{key:"_getHighestEnergyNode",value:function(e){for(var t=this.body.nodeIndices,i=this.body.nodes,n=0,o=t[0],r=0,a=0,d=0;d2&&void 0!==arguments[2]&&arguments[2];for(var n in t)void 0!==i[n]&&("object"!==(0,u.default)(i[n])?void 0!==i[n]&&null!==i[n]||void 0===t[n]||o!==!0?t[n]=i[n]:delete t[n]:"object"===(0,u.default)(t[n])&&e.fillIfDefined(t[n],i[n],o))},e.protoExtend=function(t,e){for(var i=1;i3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s=2;s3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s in o)if(o.hasOwnProperty(s)&&t.indexOf(s)==-1)if(o[s]&&o[s].constructor===Object)void 0===i[s]&&(i[s]={}),i[s].constructor===Object?e.deepExtend(i[s],o[s]):null===o[s]&&void 0!==i[s]&&n===!0?delete i[s]:i[s]=o[s];else if(Array.isArray(o[s])){i[s]=[];for(var r=0;r=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,o)):t.attachEvent("on"+e,i)},e.removeEventListener=function(t,e,i,o){t.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,o)):t.detachEvent("on"+e,i)},e.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},e.hasParent=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},e.option={},e.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},e.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},e.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},e.option.asSize=function(t,i){return"function"==typeof t&&(t=t()),e.isString(t)?t:e.isNumber(t)?t+"px":i||null},e.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},e.hexToRGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,i,o){return e+e+i+i+o+o});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},e.overrideOpacity=function(t,i){if(t.indexOf("rgba")!=-1)return t;if(t.indexOf("rgb")!=-1){var o=t.substr(t.indexOf("(")+1).replace(")","").split(",");return"rgba("+o[0]+","+o[1]+","+o[2]+","+i+")"}var o=e.hexToRGB(t);return null==o?t:"rgba("+o.r+","+o.g+","+o.b+","+i+")"},e.RGBToHex=function(t,e,i){return"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},e.parseColor=function(t){var i;if(e.isString(t)===!0){if(e.isValidRGB(t)===!0){var o=t.substr(4).substr(0,t.length-5).split(",").map(function(t){return parseInt(t)});t=e.RGBToHex(o[0],o[1],o[2])}if(e.isValidHex(t)===!0){var n=e.hexToHSV(t),s={h:n.h,s:.8*n.s,v:Math.min(1,1.02*n.v)},r={h:n.h,s:Math.min(1,1.25*n.s),v:.8*n.v},a=e.HSVToHex(r.h,r.s,r.v),h=e.HSVToHex(s.h,s.s,s.v);i={background:t,border:a,highlight:{background:h,border:a},hover:{background:h,border:a}}}else i={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else i={},i.background=t.background||void 0,i.border=t.border||void 0,e.isString(t.highlight)?i.highlight={border:t.highlight,background:t.highlight}:(i.highlight={},i.highlight.background=t.highlight&&t.highlight.background||void 0,i.highlight.border=t.highlight&&t.highlight.border||void 0),e.isString(t.hover)?i.hover={border:t.hover,background:t.hover}:(i.hover={},i.hover.background=t.hover&&t.hover.background||void 0,i.hover.border=t.hover&&t.hover.border||void 0);return i},e.RGBToHSV=function(t,e,i){t/=255,e/=255,i/=255;var o=Math.min(t,Math.min(e,i)),n=Math.max(t,Math.max(e,i));if(o==n)return{h:0,s:0,v:o};var s=t==o?e-i:i==o?t-e:i-t,r=t==o?3:i==o?1:5,a=60*(r-s/(n-o))/360,h=(n-o)/n,d=n;return{h:a,s:h,v:d}};var m={split:function(t){var e={};return t.split(";").forEach(function(t){if(""!=t.trim()){var i=t.split(":"),o=i[0].trim(),n=i[1].trim();e[o]=n}}),e},join:function(t){return(0,d.default)(t).map(function(e){return e+": "+t[e]}).join("; ")}};e.addCssText=function(t,i){var o=m.split(t.style.cssText),n=m.split(i),s=e.extend(o,n);t.style.cssText=m.join(s)},e.removeCssText=function(t,e){var i=m.split(t.style.cssText),o=m.split(e);for(var n in o)o.hasOwnProperty(n)&&delete i[n];t.style.cssText=m.join(i)},e.HSVToRGB=function(t,e,i){var o,n,s,r=Math.floor(6*t),a=6*t-r,h=i*(1-e),d=i*(1-a*e),l=i*(1-(1-a)*e);switch(r%6){case 0:o=i,n=l,s=h;break;case 1:o=d,n=i,s=h;break;case 2:o=h,n=i,s=l;break;case 3:o=h,n=d,s=i;break;case 4:o=l,n=h,s=i;break;case 5:o=i,n=h,s=d}return{r:Math.floor(255*o),g:Math.floor(255*n),b:Math.floor(255*s)}},e.HSVToHex=function(t,i,o){var n=e.HSVToRGB(t,i,o);return e.RGBToHex(n.r,n.g,n.b)},e.hexToHSV=function(t){var i=e.hexToRGB(t);return e.RGBToHSV(i.r,i.g,i.b)},e.isValidHex=function(t){var e=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t);return e},e.isValidRGB=function(t){t=t.replace(" ","");var e=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t);return e},e.isValidRGBA=function(t){t=t.replace(" ","");var e=/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(t);return e},e.selectiveBridgeObject=function(t,i){if("object"==("undefined"==typeof i?"undefined":(0,u.default)(i))){for(var o=(0,a.default)(i),n=0;n0&&e(o,t[n-1])<0;n--)t[n]=t[n-1];t[n]=o}return t},e.mergeOptions=function(t,e,i){var o=(arguments.length>3&&void 0!==arguments[3]&&arguments[3],arguments.length>4&&void 0!==arguments[4]?arguments[4]:{});if(null===e[i])t[i]=(0,a.default)(o[i]);else if(void 0!==e[i])if("boolean"==typeof e[i])t[i].enabled=e[i];else{void 0===e[i].enabled&&(t[i].enabled=!0);for(var n in e[i])e[i].hasOwnProperty(n)&&(t[i][n]=e[i][n])}},e.binarySearchCustom=function(t,e,i,o){for(var n=1e4,s=0,r=0,a=t.length-1;r<=a&&s0)return"before"==o?Math.max(0,h-1):h;if(n(r,e)<0&&n(a,e)>0)return"before"==o?h:Math.min(t.length-1,h+1);n(r,e)<0?u=h+1:p=h-1,l++}return-1},e.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},e.getScrollBarWidth=function(){var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var i=t.offsetWidth;e.style.overflow="scroll";var o=t.offsetWidth;return i==o&&(o=e.clientWidth),document.body.removeChild(e),i-o},e.topMost=function(t,e){var i=void 0;Array.isArray(e)||(e=[e]);var o=!0,n=!1,r=void 0;try{for(var a,h=(0,s.default)(t);!(o=(a=h.next()).done);o=!0){var d=a.value;if(d){i=d[e[0]];for(var l=1;l=t.length?(this._t=void 0,n(1)):"keys"==e?n(0,i):"values"==e?n(0,t[i]):n(0,[i,t[i]])},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports={}},function(t,e,i){var o=i(10),n=i(12);t.exports=function(t){return o(n(t))}},function(t,e,i){var o=i(11);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==o(t)?t.split(""):Object(t)}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var o=i(14),n=i(15),s=i(30),r=i(20),a=i(31),h=i(8),d=i(32),l=i(46),u=i(48),p=i(47)("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",m="keys",g="values",v=function(){return this};t.exports=function(t,e,i,y,b,_,w){d(i,e,y);var x,D,S,k=function(t){if(!c&&t in O)return O[t];switch(t){case m:return function(){return new i(this,t)};case g:return function(){return new i(this,t)}}return function(){return new i(this,t)}},T=e+" Iterator",C=b==g,M=!1,O=t.prototype,E=O[p]||O[f]||b&&O[b],P=E||k(b),N=b?C?k("entries"):P:void 0,A="Array"==e?O.entries||E:E;if(A&&(S=u(A.call(new t)),S!==Object.prototype&&(l(S,T,!0),o||a(S,p)||r(S,p,v))),C&&E&&E.name!==g&&(M=!0,P=function(){return E.call(this)}),o&&!w||!c&&!M&&O[p]||r(O,p,P),h[e]=P,h[T]=v,b)if(x={values:C?P:k(g),keys:_?P:k(m),entries:N},w)for(D in x)D in O||s(O,D,x[D]);else n(n.P+n.F*(c||M),e,x);return x}},function(t,e){t.exports=!0},function(t,e,i){var o=i(16),n=i(17),s=i(18),r=i(20),a="prototype",h=function(t,e,i){var d,l,u,p=t&h.F,c=t&h.G,f=t&h.S,m=t&h.P,g=t&h.B,v=t&h.W,y=c?n:n[e]||(n[e]={}),b=y[a],_=c?o:f?o[e]:(o[e]||{})[a];c&&(i=e);for(d in i)l=!p&&_&&void 0!==_[d],l&&d in y||(u=l?_[d]:i[d],y[d]=c&&"function"!=typeof _[d]?i[d]:g&&l?s(u,o):v&&_[d]==u?function(t){var e=function(e,i,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,o)}return t.apply(this,arguments)};return e[a]=t[a],e}(u):m&&"function"==typeof u?s(Function.call,u):u,m&&((y.virtual||(y.virtual={}))[d]=u,t&h.R&&b&&!b[d]&&r(b,d,u)))};h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,t.exports=h},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var i=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)},function(t,e,i){var o=i(19);t.exports=function(t,e,i){if(o(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,o){return t.call(e,i,o)};case 3:return function(i,o,n){return t.call(e,i,o,n)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var o=i(21),n=i(29);t.exports=i(25)?function(t,e,i){return o.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var o=i(22),n=i(24),s=i(28),r=Object.defineProperty;e.f=i(25)?Object.defineProperty:function(t,e,i){if(o(t),e=s(e,!0),o(i),n)try{return r(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var o=i(23);t.exports=function(t){if(!o(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){t.exports=!i(25)&&!i(26)(function(){return 7!=Object.defineProperty(i(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){t.exports=!i(26)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){var o=i(23),n=i(16).document,s=o(n)&&o(n.createElement);t.exports=function(t){return s?n.createElement(t):{}}},function(t,e,i){var o=i(23);t.exports=function(t,e){if(!o(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!o(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!o(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!o(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){t.exports=i(20)},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var o=i(33),n=i(29),s=i(46),r={};i(20)(r,i(47)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=o(r,{next:n(1,i)}),s(t,e+" Iterator")}},function(t,e,i){var o=i(22),n=i(34),s=i(44),r=i(41)("IE_PROTO"),a=function(){},h="prototype",d=function(){var t,e=i(27)("iframe"),o=s.length,n="<",r=">";for(e.style.display="none",i(45).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(n+"script"+r+"document.F=Object"+n+"/script"+r),t.close(),d=t.F;o--;)delete d[h][s[o]];return d()};t.exports=Object.create||function(t,e){var i;return null!==t?(a[h]=o(t),i=new a,a[h]=null,i[r]=t):i=d(),void 0===e?i:n(i,e)}},function(t,e,i){var o=i(21),n=i(22),s=i(35);t.exports=i(25)?Object.defineProperties:function(t,e){n(t);for(var i,r=s(e),a=r.length,h=0;a>h;)o.f(t,i=r[h++],e[i]);return t}},function(t,e,i){var o=i(36),n=i(44);t.exports=Object.keys||function(t){return o(t,n)}},function(t,e,i){var o=i(31),n=i(9),s=i(37)(!1),r=i(41)("IE_PROTO");t.exports=function(t,e){var i,a=n(t),h=0,d=[];for(i in a)i!=r&&o(a,i)&&d.push(i);for(;e.length>h;)o(a,i=e[h++])&&(~s(d,i)||d.push(i));return d}},function(t,e,i){var o=i(9),n=i(38),s=i(40);t.exports=function(t){return function(e,i,r){var a,h=o(e),d=n(h.length),l=s(r,d);if(t&&i!=i){for(;d>l;)if(a=h[l++],a!=a)return!0}else for(;d>l;l++)if((t||l in h)&&h[l]===i)return t||l||0;return!t&&-1}}},function(t,e,i){var o=i(39),n=Math.min;t.exports=function(t){return t>0?n(o(t),9007199254740991):0}},function(t,e){var i=Math.ceil,o=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?o:i)(t)}},function(t,e,i){var o=i(39),n=Math.max,s=Math.min;t.exports=function(t,e){return t=o(t),t<0?n(t+e,0):s(t,e)}},function(t,e,i){var o=i(42)("keys"),n=i(43);t.exports=function(t){return o[t]||(o[t]=n(t))}},function(t,e,i){var o=i(16),n="__core-js_shared__",s=o[n]||(o[n]={});t.exports=function(t){return s[t]||(s[t]={})}},function(t,e){var i=0,o=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+o).toString(36))}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){t.exports=i(16).document&&document.documentElement},function(t,e,i){var o=i(21).f,n=i(31),s=i(47)("toStringTag");t.exports=function(t,e,i){t&&!n(t=i?t:t.prototype,s)&&o(t,s,{configurable:!0,value:e})}},function(t,e,i){var o=i(42)("wks"),n=i(43),s=i(16).Symbol,r="function"==typeof s,a=t.exports=function(t){return o[t]||(o[t]=r&&s[t]||(r?s:n)("Symbol."+t))};a.store=o},function(t,e,i){var o=i(31),n=i(49),s=i(41)("IE_PROTO"),r=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=n(t),o(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?r:null}},function(t,e,i){var o=i(12);t.exports=function(t){return Object(o(t))}},function(t,e,i){var o=i(51)(!0);i(13)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=o(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e,i){var o=i(39),n=i(12);t.exports=function(t){return function(e,i){var s,r,a=String(n(e)),h=o(i),d=a.length;return h<0||h>=d?t?"":void 0:(s=a.charCodeAt(h),s<55296||s>56319||h+1===d||(r=a.charCodeAt(h+1))<56320||r>57343?t?a.charAt(h):s:t?a.slice(h,h+2):(s-55296<<10)+(r-56320)+65536)}}},function(t,e,i){var o=i(22),n=i(53);t.exports=i(17).getIterator=function(t){var e=n(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return o(e.call(t))}},function(t,e,i){var o=i(54),n=i(47)("iterator"),s=i(8);t.exports=i(17).getIteratorMethod=function(t){if(void 0!=t)return t[n]||t["@@iterator"]||s[o(t)]}},function(t,e,i){var o=i(11),n=i(47)("toStringTag"),s="Arguments"==o(function(){return arguments}()),r=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,i,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=r(e=Object(t),n))?i:s?o(e):"Object"==(a=o(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,i){t.exports={default:i(56),__esModule:!0}},function(t,e,i){i(57);var o=i(17).Object;t.exports=function(t,e){return o.create(t,e)}},function(t,e,i){var o=i(15);o(o.S,"Object",{create:i(33)})},function(t,e,i){t.exports={default:i(59),__esModule:!0}},function(t,e,i){i(60),t.exports=i(17).Object.keys},function(t,e,i){var o=i(49),n=i(35);i(61)("keys",function(){return function(t){return n(o(t))}})},function(t,e,i){var o=i(15),n=i(17),s=i(26);t.exports=function(t,e){var i=(n.Object||{})[t]||Object[t],r={};r[t]=e(i),o(o.S+o.F*s(function(){i(1)}),"Object",r)}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var n=i(63),s=o(n),r=i(66),a=o(r),h="function"==typeof a.default&&"symbol"==typeof s.default?function(t){return typeof t}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":typeof t};e.default="function"==typeof a.default&&"symbol"===h(s.default)?function(t){return"undefined"==typeof t?"undefined":h(t)}:function(t){return t&&"function"==typeof a.default&&t.constructor===a.default&&t!==a.default.prototype?"symbol":"undefined"==typeof t?"undefined":h(t)}},function(t,e,i){t.exports={default:i(64),__esModule:!0}},function(t,e,i){i(50),i(4),t.exports=i(65).f("iterator")},function(t,e,i){e.f=i(47)},function(t,e,i){t.exports={default:i(67),__esModule:!0}},function(t,e,i){i(68),i(79),i(80),i(81),t.exports=i(17).Symbol},function(t,e,i){var o=i(16),n=i(31),s=i(25),r=i(15),a=i(30),h=i(69).KEY,d=i(26),l=i(42),u=i(46),p=i(43),c=i(47),f=i(65),m=i(70),g=i(71),v=i(72),y=i(75),b=i(22),_=i(9),w=i(28),x=i(29),D=i(33),S=i(76),k=i(78),T=i(21),C=i(35),M=k.f,O=T.f,E=S.f,P=o.Symbol,N=o.JSON,A=N&&N.stringify,I="prototype",R=c("_hidden"),L=c("toPrimitive"),F={}.propertyIsEnumerable,H=l("symbol-registry"),Y=l("symbols"),j=l("op-symbols"),G=Object[I],z="function"==typeof P,W=o.QObject,U=!W||!W[I]||!W[I].findChild,V=s&&d(function(){return 7!=D(O({},"a",{get:function(){return O(this,"a",{value:7}).a}})).a})?function(t,e,i){var o=M(G,e);o&&delete G[e],O(t,e,i),o&&t!==G&&O(G,e,o)}:O,B=function(t){var e=Y[t]=D(P[I]);return e._k=t,e},q=z&&"symbol"==typeof P.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof P},X=function(t,e,i){return t===G&&X(j,e,i),b(t),e=w(e,!0),b(i),n(Y,e)?(i.enumerable?(n(t,R)&&t[R][e]&&(t[R][e]=!1),i=D(i,{enumerable:x(0,!1)})):(n(t,R)||O(t,R,x(1,{})),t[R][e]=!0),V(t,e,i)):O(t,e,i)},Z=function(t,e){b(t);for(var i,o=v(e=_(e)),n=0,s=o.length;s>n;)X(t,i=o[n++],e[i]);return t},K=function(t,e){return void 0===e?D(t):Z(D(t),e)},$=function(t){var e=F.call(this,t=w(t,!0));return!(this===G&&n(Y,t)&&!n(j,t))&&(!(e||!n(this,t)||!n(Y,t)||n(this,R)&&this[R][t])||e)},J=function(t,e){if(t=_(t),e=w(e,!0),t!==G||!n(Y,e)||n(j,e)){var i=M(t,e);return!i||!n(Y,e)||n(t,R)&&t[R][e]||(i.enumerable=!0),i}},Q=function(t){for(var e,i=E(_(t)),o=[],s=0;i.length>s;)n(Y,e=i[s++])||e==R||e==h||o.push(e);return o},tt=function(t){for(var e,i=t===G,o=E(i?j:_(t)),s=[],r=0;o.length>r;)!n(Y,e=o[r++])||i&&!n(G,e)||s.push(Y[e]);return s};z||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(i){this===G&&e.call(j,i),n(this,R)&&n(this[R],t)&&(this[R][t]=!1),V(this,t,x(1,i))};return s&&U&&V(G,t,{configurable:!0,set:e}),B(t)},a(P[I],"toString",function(){return this._k}),k.f=J,T.f=X,i(77).f=S.f=Q,i(74).f=$,i(73).f=tt,s&&!i(14)&&a(G,"propertyIsEnumerable",$,!0),f.f=function(t){return B(c(t))}),r(r.G+r.W+r.F*!z,{Symbol:P});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),it=0;et.length>it;)c(et[it++]);for(var et=C(c.store),it=0;et.length>it;)m(et[it++]);r(r.S+r.F*!z,"Symbol",{for:function(t){return n(H,t+="")?H[t]:H[t]=P(t)},keyFor:function(t){if(q(t))return g(H,t);throw TypeError(t+" is not a symbol!")},useSetter:function(){U=!0},useSimple:function(){U=!1}}),r(r.S+r.F*!z,"Object",{create:K,defineProperty:X,defineProperties:Z,getOwnPropertyDescriptor:J,getOwnPropertyNames:Q,getOwnPropertySymbols:tt}),N&&r(r.S+r.F*(!z||d(function(){var t=P();return"[null]"!=A([t])||"{}"!=A({a:t})||"{}"!=A(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!q(t)){for(var e,i,o=[t],n=1;arguments.length>n;)o.push(arguments[n++]);return e=o[1],"function"==typeof e&&(i=e),!i&&y(e)||(e=function(t,e){if(i&&(e=i.call(this,t,e)),!q(e))return e}),o[1]=e,A.apply(N,o)}}}),P[I][L]||i(20)(P[I],L,P[I].valueOf),u(P,"Symbol"),u(Math,"Math",!0),u(o.JSON,"JSON",!0)},function(t,e,i){var o=i(43)("meta"),n=i(23),s=i(31),r=i(21).f,a=0,h=Object.isExtensible||function(){return!0},d=!i(26)(function(){return h(Object.preventExtensions({}))}),l=function(t){r(t,o,{value:{i:"O"+ ++a,w:{}}})},u=function(t,e){if(!n(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!s(t,o)){if(!h(t))return"F";if(!e)return"E";l(t)}return t[o].i},p=function(t,e){if(!s(t,o)){if(!h(t))return!0;if(!e)return!1;l(t)}return t[o].w},c=function(t){return d&&f.NEED&&h(t)&&!s(t,o)&&l(t),t},f=t.exports={KEY:o,NEED:!1,fastKey:u,getWeak:p,onFreeze:c}},function(t,e,i){var o=i(16),n=i(17),s=i(14),r=i(65),a=i(21).f;t.exports=function(t){var e=n.Symbol||(n.Symbol=s?{}:o.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:r.f(t)})}},function(t,e,i){var o=i(35),n=i(9);t.exports=function(t,e){for(var i,s=n(t),r=o(s),a=r.length,h=0;a>h;)if(s[i=r[h++]]===e)return i}},function(t,e,i){var o=i(35),n=i(73),s=i(74);t.exports=function(t){var e=o(t),i=n.f;if(i)for(var r,a=i(t),h=s.f,d=0;a.length>d;)h.call(t,r=a[d++])&&e.push(r);return e}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,i){var o=i(11);t.exports=Array.isArray||function(t){return"Array"==o(t)}},function(t,e,i){var o=i(9),n=i(77).f,s={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return n(t)}catch(t){return r.slice()}};t.exports.f=function(t){return r&&"[object Window]"==s.call(t)?a(t):n(o(t))}},function(t,e,i){var o=i(36),n=i(44).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return o(t,n)}},function(t,e,i){var o=i(74),n=i(29),s=i(9),r=i(28),a=i(31),h=i(24),d=Object.getOwnPropertyDescriptor;e.f=i(25)?d:function(t,e){if(t=s(t),e=r(e,!0),h)try{return d(t,e)}catch(t){}if(a(t,e))return n(!o.f.call(t,e),t[e])}},function(t,e){},function(t,e,i){i(70)("asyncIterator")},function(t,e,i){i(70)("observable")},function(t,e,i){t.exports="undefined"!=typeof window&&window.moment||i(83)},function(t,e,i){(function(t){!function(e,i){t.exports=i()}(this,function(){function e(){return _o.apply(null,arguments)}function i(t){_o=t}function o(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function n(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function s(t){var e;for(e in t)return!1;return!0}function r(t){return void 0===t}function a(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function h(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function d(t,e){var i,o=[];for(i=0;i0)for(i=0;i0?"future":"past"];return T(i)?i(e):i.replace(/%s/i,e)}function L(t,e){var i=t.toLowerCase();Ro[i]=Ro[i+"s"]=Ro[e]=t}function F(t){return"string"==typeof t?Ro[t]||Ro[t.toLowerCase()]:void 0}function H(t){var e,i,o={};for(i in t)l(t,i)&&(e=F(i),e&&(o[e]=t[i]));return o}function Y(t,e){Lo[t]=e}function j(t){var e=[];for(var i in t)e.push({unit:i,priority:Lo[i]});return e.sort(function(t,e){return t.priority-e.priority}),e}function G(t,i){return function(o){return null!=o?(W(this,t,o),e.updateOffset(this,i),this):z(this,t)}}function z(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function W(t,e,i){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](i)}function U(t){return t=F(t),T(this[t])?this[t]():this}function V(t,e){if("object"==typeof t){t=H(t);for(var i=j(t),o=0;o=0;return(s?i?"+":"":"-")+Math.pow(10,Math.max(0,n)).toString().substr(1)+o}function q(t,e,i,o){var n=o;"string"==typeof o&&(n=function(){return this[o]()}),t&&(jo[t]=n),e&&(jo[e[0]]=function(){return B(n.apply(this,arguments),e[1],e[2])}),i&&(jo[i]=function(){return this.localeData().ordinal(n.apply(this,arguments),t)})}function X(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function Z(t){var e,i,o=t.match(Fo);for(e=0,i=o.length;e=0&&Ho.test(t);)t=t.replace(Ho,i),Ho.lastIndex=0,o-=1;return t}function J(t,e,i){sn[t]=T(e)?e:function(t,o){return t&&i?i:e}}function Q(t,e){return l(sn,t)?sn[t](e._strict,e._locale):new RegExp(tt(t))}function tt(t){return et(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,i,o,n){return e||i||o||n}))}function et(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function it(t,e){var i,o=e;for("string"==typeof t&&(t=[t]),a(e)&&(o=function(t,i){i[e]=w(t)}),i=0;i=0&&isFinite(a.getFullYear())&&a.setFullYear(t),a}function _t(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function wt(t,e,i){var o=7+e-i,n=(7+_t(t,0,o).getUTCDay()-e)%7;return-n+o-1}function xt(t,e,i,o,n){var s,r,a=(7+i-o)%7,h=wt(t,o,n),d=1+7*(e-1)+a+h;return d<=0?(s=t-1,r=gt(s)+d):d>gt(t)?(s=t+1,r=d-gt(t)):(s=t,r=d),{year:s,dayOfYear:r}}function Dt(t,e,i){var o,n,s=wt(t.year(),e,i),r=Math.floor((t.dayOfYear()-s-1)/7)+1;return r<1?(n=t.year()-1,o=r+St(n,e,i)):r>St(t.year(),e,i)?(o=r-St(t.year(),e,i),n=t.year()+1):(n=t.year(),o=r),{week:o,year:n}}function St(t,e,i){var o=wt(t,e,i),n=wt(t+1,e,i);return(gt(t)-o+n)/7}function kt(t){return Dt(t,this._week.dow,this._week.doy).week}function Tt(){return this._week.dow}function Ct(){return this._week.doy}function Mt(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ot(t){var e=Dt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Et(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Pt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Nt(t,e){return t?o(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:o(this._weekdays)?this._weekdays:this._weekdays.standalone}function At(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort}function It(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Rt(t,e,i){var o,n,s,r=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)s=p([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(s,"").toLocaleLowerCase();return i?"dddd"===e?(n=gn.call(this._weekdaysParse,r),n!==-1?n:null):"ddd"===e?(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:null):(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:null):"dddd"===e?(n=gn.call(this._weekdaysParse,r),n!==-1?n:(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:null))):"ddd"===e?(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:(n=gn.call(this._weekdaysParse,r),n!==-1?n:(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:null))):(n=gn.call(this._minWeekdaysParse,r),n!==-1?n:(n=gn.call(this._weekdaysParse,r),n!==-1?n:(n=gn.call(this._shortWeekdaysParse,r),n!==-1?n:null)))}function Lt(t,e,i){var o,n,s;if(this._weekdaysParseExact)return Rt.call(this,t,e,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(n=p([2e3,1]).day(o),i&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(n,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(n,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(n,"").replace(".",".?")+"$","i")),this._weekdaysParse[o]||(s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[o]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===e&&this._fullWeekdaysParse[o].test(t))return o;if(i&&"ddd"===e&&this._shortWeekdaysParse[o].test(t))return o;if(i&&"dd"===e&&this._minWeekdaysParse[o].test(t))return o;if(!i&&this._weekdaysParse[o].test(t))return o}}function Ft(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Et(t,this.localeData()),this.add(t-e,"d")):e}function Ht(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function Yt(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Pt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function jt(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Wt.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(l(this,"_weekdaysRegex")||(this._weekdaysRegex=Cn),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Gt(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Wt.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(l(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Mn),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function zt(t){return this._weekdaysParseExact?(l(this,"_weekdaysRegex")||Wt.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(l(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=On),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Wt(){function t(t,e){return e.length-t.length}var e,i,o,n,s,r=[],a=[],h=[],d=[];for(e=0;e<7;e++)i=p([2e3,1]).day(e),o=this.weekdaysMin(i,""),n=this.weekdaysShort(i,""),s=this.weekdays(i,""),r.push(o),a.push(n),h.push(s),d.push(o),d.push(n),d.push(s);for(r.sort(t),a.sort(t),h.sort(t),d.sort(t),e=0;e<7;e++)a[e]=et(a[e]),h[e]=et(h[e]),d[e]=et(d[e]);this._weekdaysRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Ut(){return this.hours()%12||12}function Vt(){return this.hours()||24}function Bt(t,e){q(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function qt(t,e){return e._meridiemParse}function Xt(t){return"p"===(t+"").toLowerCase().charAt(0)}function Zt(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"}function Kt(t){return t?t.toLowerCase().replace("_","-"):t}function $t(t){for(var e,i,o,n,s=0;s0;){if(o=Jt(n.slice(0,e).join("-")))return o;if(i&&i.length>=e&&x(n,i,!0)>=e-1)break;e--}s++}return null}function Jt(e){var i=null;if(!In[e]&&"undefined"!=typeof t&&t&&t.exports)try{i=En._abbr,!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),Qt(i)}catch(t){}return In[e]}function Qt(t,e){var i;return t&&(i=r(e)?ie(t):te(t,e),i&&(En=i)),En._abbr}function te(t,e){if(null!==e){var i=An;if(e.abbr=t,null!=In[t])k("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=In[t]._config;else if(null!=e.parentLocale){if(null==In[e.parentLocale])return Rn[e.parentLocale]||(Rn[e.parentLocale]=[]),Rn[e.parentLocale].push({name:t,config:e}),null;i=In[e.parentLocale]._config}return In[t]=new O(M(i,e)),Rn[t]&&Rn[t].forEach(function(t){te(t.name,t.config)}),Qt(t),In[t]}return delete In[t],null}function ee(t,e){if(null!=e){var i,o=An;null!=In[t]&&(o=In[t]._config),e=M(o,e),i=new O(e),i.parentLocale=In[t],In[t]=i,Qt(t)}else null!=In[t]&&(null!=In[t].parentLocale?In[t]=In[t].parentLocale:null!=In[t]&&delete In[t]);return In[t]}function ie(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return En;if(!o(t)){if(e=Jt(t))return e;t=[t]}return $t(t)}function oe(){return Mo(In)}function ne(t){var e,i=t._a;return i&&f(t).overflow===-2&&(e=i[hn]<0||i[hn]>11?hn:i[dn]<1||i[dn]>st(i[an],i[hn])?dn:i[ln]<0||i[ln]>24||24===i[ln]&&(0!==i[un]||0!==i[pn]||0!==i[cn])?ln:i[un]<0||i[un]>59?un:i[pn]<0||i[pn]>59?pn:i[cn]<0||i[cn]>999?cn:-1,f(t)._overflowDayOfYear&&(edn)&&(e=dn),f(t)._overflowWeeks&&e===-1&&(e=fn),f(t)._overflowWeekday&&e===-1&&(e=mn),f(t).overflow=e),t}function se(t){var e,i,o,n,s,r,a=t._i,h=Ln.exec(a)||Fn.exec(a);if(h){for(f(t).iso=!0,e=0,i=Yn.length;e10?"YYYY ":"YY "),s="HH:mm"+(i[4]?":ss":""),i[1]){var u=new Date(i[2]),p=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][u.getDay()];if(i[1].substr(0,3)!==p)return f(t).weekdayMismatch=!0,void(t._isValid=!1)}switch(i[5].length){case 2:0===h?a=" +0000":(h=l.indexOf(i[5][1].toUpperCase())-12,a=(h<0?" -":" +")+(""+h).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:a=d[i[5]];break;default:a=d[" GMT"]}i[5]=a,t._i=i.splice(1).join(""),r=" ZZ",t._f=o+n+s+r,pe(t),f(t).rfc2822=!0}else t._isValid=!1}function ae(t){var i=Gn.exec(t._i);return null!==i?void(t._d=new Date(+i[1])):(se(t),void(t._isValid===!1&&(delete t._isValid,re(t),t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t)))))}function he(t,e,i){return null!=t?t:null!=e?e:i}function de(t){var i=new Date(e.now());return t._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function le(t){var e,i,o,n,s=[];if(!t._d){for(o=de(t),t._w&&null==t._a[dn]&&null==t._a[hn]&&ue(t),null!=t._dayOfYear&&(n=he(t._a[an],o[an]),(t._dayOfYear>gt(n)||0===t._dayOfYear)&&(f(t)._overflowDayOfYear=!0),i=_t(n,0,t._dayOfYear),t._a[hn]=i.getUTCMonth(),t._a[dn]=i.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=o[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[ln]&&0===t._a[un]&&0===t._a[pn]&&0===t._a[cn]&&(t._nextDay=!0,t._a[ln]=0),t._d=(t._useUTC?_t:bt).apply(null,s),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[ln]=24)}}function ue(t){var e,i,o,n,s,r,a,h;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)s=1,r=4,i=he(e.GG,t._a[an],Dt(_e(),1,4).year),o=he(e.W,1),n=he(e.E,1),(n<1||n>7)&&(h=!0);else{s=t._locale._week.dow,r=t._locale._week.doy;var d=Dt(_e(),s,r);i=he(e.gg,t._a[an],d.year),o=he(e.w,d.week),null!=e.d?(n=e.d,(n<0||n>6)&&(h=!0)):null!=e.e?(n=e.e+s,(e.e<0||e.e>6)&&(h=!0)):n=s}o<1||o>St(i,s,r)?f(t)._overflowWeeks=!0:null!=h?f(t)._overflowWeekday=!0:(a=xt(i,o,n,s,r),t._a[an]=a.year,t._dayOfYear=a.dayOfYear)}function pe(t){if(t._f===e.ISO_8601)return void se(t);if(t._f===e.RFC_2822)return void re(t);t._a=[],f(t).empty=!0;var i,o,n,s,r,a=""+t._i,h=a.length,d=0;for(n=$(t._f,t._locale).match(Fo)||[],i=0;i0&&f(t).unusedInput.push(r),a=a.slice(a.indexOf(o)+o.length),d+=o.length),jo[s]?(o?f(t).empty=!1:f(t).unusedTokens.push(s),nt(s,o,t)):t._strict&&!o&&f(t).unusedTokens.push(s);f(t).charsLeftOver=h-d,a.length>0&&f(t).unusedInput.push(a),t._a[ln]<=12&&f(t).bigHour===!0&&t._a[ln]>0&&(f(t).bigHour=void 0),f(t).parsedDateParts=t._a.slice(0),f(t).meridiem=t._meridiem,t._a[ln]=ce(t._locale,t._a[ln],t._meridiem),le(t),ne(t)}function ce(t,e,i){var o;return null==i?e:null!=t.meridiemHour?t.meridiemHour(e,i):null!=t.isPM?(o=t.isPM(i),o&&e<12&&(e+=12),o||12!==e||(e=0),e):e}function fe(t){var e,i,o,n,s;if(0===t._f.length)return f(t).invalidFormat=!0,void(t._d=new Date(NaN));for(n=0;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ge(){if(!r(this._isDSTShifted))return this._isDSTShifted;var t={};if(v(t,this),t=ve(t),t._a){var e=t._isUTC?p(t._a):_e(t._a);this._isDSTShifted=this.isValid()&&x(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function ze(){return!!this.isValid()&&!this._isUTC}function We(){return!!this.isValid()&&this._isUTC}function Ue(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ve(t,e){var i,o,n,s=t,r=null;return Me(t)?s={ms:t._milliseconds,d:t._days,M:t._months}:a(t)?(s={},e?s[e]=t:s.milliseconds=t):(r=Xn.exec(t))?(i="-"===r[1]?-1:1,s={y:0,d:w(r[dn])*i,h:w(r[ln])*i,m:w(r[un])*i,s:w(r[pn])*i,ms:w(Oe(1e3*r[cn]))*i}):(r=Zn.exec(t))?(i="-"===r[1]?-1:1,s={y:Be(r[2],i),M:Be(r[3],i),w:Be(r[4],i),d:Be(r[5],i),h:Be(r[6],i),m:Be(r[7],i),s:Be(r[8],i)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(n=Xe(_e(s.from),_e(s.to)),s={},s.ms=n.milliseconds,s.M=n.months),o=new Ce(s),Me(t)&&l(t,"_locale")&&(o._locale=t._locale),o}function Be(t,e){var i=t&&parseFloat(t.replace(",","."));return(isNaN(i)?0:i)*e}function qe(t,e){var i={milliseconds:0,months:0};return i.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(i.months,"M").isAfter(e)&&--i.months,i.milliseconds=+e-+t.clone().add(i.months,"M"),i}function Xe(t,e){var i;return t.isValid()&&e.isValid()?(e=Ne(e,t),t.isBefore(e)?i=qe(t,e):(i=qe(e,t),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function Ze(t,e){return function(i,o){var n,s;return null===o||isNaN(+o)||(k(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=i,i=o,o=s),i="string"==typeof i?+i:i,n=Ve(i,o),Ke(this,n,t),this}}function Ke(t,i,o,n){var s=i._milliseconds,r=Oe(i._days),a=Oe(i._months);t.isValid()&&(n=null==n||n,s&&t._d.setTime(t._d.valueOf()+s*o),r&&W(t,"Date",z(t,"Date")+r*o),a&<(t,z(t,"Month")+a*o),n&&e.updateOffset(t,r||a))}function $e(t,e){var i=t.diff(e,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"}function Je(t,i){var o=t||_e(),n=Ne(o,this).startOf("day"),s=e.calendarFormat(this,n)||"sameElse",r=i&&(T(i[s])?i[s].call(this,o):i[s]);return this.format(r||this.localeData().calendar(s,this,_e(o)))}function Qe(){return new y(this)}function ti(t,e){var i=b(t)?t:_e(t);return!(!this.isValid()||!i.isValid())&&(e=F(r(e)?"millisecond":e),"millisecond"===e?this.valueOf()>i.valueOf():i.valueOf()9999?K(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):T(Date.prototype.toISOString)?this.toDate().toISOString():K(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function li(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var i="["+t+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n="-MM-DD[T]HH:mm:ss.SSS",s=e+'[")]';return this.format(i+o+n+s)}function ui(t){t||(t=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var i=K(this,t);return this.localeData().postformat(i)}function pi(t,e){return this.isValid()&&(b(t)&&t.isValid()||_e(t).isValid())?Ve({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function ci(t){return this.from(_e(),t)}function fi(t,e){return this.isValid()&&(b(t)&&t.isValid()||_e(t).isValid())?Ve({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function mi(t){return this.to(_e(),t)}function gi(t){var e;return void 0===t?this._locale._abbr:(e=ie(t),null!=e&&(this._locale=e),this)}function vi(){return this._locale}function yi(t){switch(t=F(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function bi(t){return t=F(t),void 0===t||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function _i(){return this._d.valueOf()-6e4*(this._offset||0)}function wi(){return Math.floor(this.valueOf()/1e3)}function xi(){return new Date(this.valueOf())}function Di(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function Si(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function ki(){return this.isValid()?this.toISOString():null}function Ti(){return m(this)}function Ci(){return u({},f(this))}function Mi(){return f(this).overflow}function Oi(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Ei(t,e){q(0,[t,t.length],0,e)}function Pi(t){return Ri.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Ni(t){return Ri.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function Ai(){return St(this.year(),1,4)}function Ii(){var t=this.localeData()._week;return St(this.year(),t.dow,t.doy)}function Ri(t,e,i,o,n){var s;return null==t?Dt(this,o,n).year:(s=St(t,o,n),e>s&&(e=s),Li.call(this,t,e,i,o,n))}function Li(t,e,i,o,n){var s=xt(t,e,i,o,n),r=_t(s.year,0,s.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}function Fi(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Hi(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Yi(t,e){e[cn]=w(1e3*("0."+t))}function ji(){return this._isUTC?"UTC":""}function Gi(){return this._isUTC?"Coordinated Universal Time":""}function zi(t){return _e(1e3*t)}function Wi(){return _e.apply(null,arguments).parseZone()}function Ui(t){return t}function Vi(t,e,i,o){var n=ie(),s=p().set(o,e);return n[i](s,t)}function Bi(t,e,i){if(a(t)&&(e=t,t=void 0),t=t||"",null!=e)return Vi(t,e,i,"month");var o,n=[];for(o=0;o<12;o++)n[o]=Vi(t,o,i,"month");return n; -}function qi(t,e,i,o){"boolean"==typeof t?(a(e)&&(i=e,e=void 0),e=e||""):(e=t,i=e,t=!1,a(e)&&(i=e,e=void 0),e=e||"");var n=ie(),s=t?n._week.dow:0;if(null!=i)return Vi(e,(i+s)%7,o,"day");var r,h=[];for(r=0;r<7;r++)h[r]=Vi(e,(r+s)%7,o,"day");return h}function Xi(t,e){return Bi(t,e,"months")}function Zi(t,e){return Bi(t,e,"monthsShort")}function Ki(t,e,i){return qi(t,e,i,"weekdays")}function $i(t,e,i){return qi(t,e,i,"weekdaysShort")}function Ji(t,e,i){return qi(t,e,i,"weekdaysMin")}function Qi(){var t=this._data;return this._milliseconds=rs(this._milliseconds),this._days=rs(this._days),this._months=rs(this._months),t.milliseconds=rs(t.milliseconds),t.seconds=rs(t.seconds),t.minutes=rs(t.minutes),t.hours=rs(t.hours),t.months=rs(t.months),t.years=rs(t.years),this}function to(t,e,i,o){var n=Ve(e,i);return t._milliseconds+=o*n._milliseconds,t._days+=o*n._days,t._months+=o*n._months,t._bubble()}function eo(t,e){return to(this,t,e,1)}function io(t,e){return to(this,t,e,-1)}function oo(t){return t<0?Math.floor(t):Math.ceil(t)}function no(){var t,e,i,o,n,s=this._milliseconds,r=this._days,a=this._months,h=this._data;return s>=0&&r>=0&&a>=0||s<=0&&r<=0&&a<=0||(s+=864e5*oo(ro(a)+r),r=0,a=0),h.milliseconds=s%1e3,t=_(s/1e3),h.seconds=t%60,e=_(t/60),h.minutes=e%60,i=_(e/60),h.hours=i%24,r+=_(i/24),n=_(so(r)),a+=n,r-=oo(ro(n)),o=_(a/12),a%=12,h.days=r,h.months=a,h.years=o,this}function so(t){return 4800*t/146097}function ro(t){return 146097*t/4800}function ao(t){if(!this.isValid())return NaN;var e,i,o=this._milliseconds;if(t=F(t),"month"===t||"year"===t)return e=this._days+o/864e5,i=this._months+so(e),"month"===t?i:i/12;switch(e=this._days+Math.round(ro(this._months)),t){case"week":return e/7+o/6048e5;case"day":return e+o/864e5;case"hour":return 24*e+o/36e5;case"minute":return 1440*e+o/6e4;case"second":return 86400*e+o/1e3;case"millisecond":return Math.floor(864e5*e)+o;default:throw new Error("Unknown unit "+t)}}function ho(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*w(this._months/12):NaN}function lo(t){return function(){return this.as(t)}}function uo(t){return t=F(t),this.isValid()?this[t+"s"]():NaN}function po(t){return function(){return this.isValid()?this._data[t]:NaN}}function co(){return _(this.days()/7)}function fo(t,e,i,o,n){return n.relativeTime(e||1,!!i,t,o)}function mo(t,e,i){var o=Ve(t).abs(),n=xs(o.as("s")),s=xs(o.as("m")),r=xs(o.as("h")),a=xs(o.as("d")),h=xs(o.as("M")),d=xs(o.as("y")),l=n<=Ds.ss&&["s",n]||n0,l[4]=i,fo.apply(null,l)}function go(t){return void 0===t?xs:"function"==typeof t&&(xs=t,!0)}function vo(t,e){return void 0!==Ds[t]&&(void 0===e?Ds[t]:(Ds[t]=e,"s"===t&&(Ds.ss=e-1),!0))}function yo(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),i=mo(this,!t,e);return t&&(i=e.pastFuture(+this,i)),e.postformat(i)}function bo(){if(!this.isValid())return this.localeData().invalidDate();var t,e,i,o=Ss(this._milliseconds)/1e3,n=Ss(this._days),s=Ss(this._months);t=_(o/60),e=_(t/60),o%=60,t%=60,i=_(s/12),s%=12;var r=i,a=s,h=n,d=e,l=t,u=o,p=this.asSeconds();return p?(p<0?"-":"")+"P"+(r?r+"Y":"")+(a?a+"M":"")+(h?h+"D":"")+(d||l||u?"T":"")+(d?d+"H":"")+(l?l+"M":"")+(u?u+"S":""):"P0D"}var _o,wo;wo=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),i=e.length>>>0,o=0;o68?1900:2e3)};var xn=G("FullYear",!0);q("w",["ww",2],"wo","week"),q("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),Y("week",5),Y("isoWeek",5),J("w",Bo),J("ww",Bo,zo),J("W",Bo),J("WW",Bo,zo),ot(["w","ww","W","WW"],function(t,e,i,o){e[o.substr(0,1)]=w(t)});var Dn={dow:0,doy:6};q("d",0,"do","day"),q("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),q("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),q("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),q("e",0,0,"weekday"),q("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),Y("day",11),Y("weekday",11),Y("isoWeekday",11),J("d",Bo),J("e",Bo),J("E",Bo),J("dd",function(t,e){return e.weekdaysMinRegex(t)}),J("ddd",function(t,e){return e.weekdaysShortRegex(t)}),J("dddd",function(t,e){return e.weekdaysRegex(t)}),ot(["dd","ddd","dddd"],function(t,e,i,o){var n=i._locale.weekdaysParse(t,o,i._strict);null!=n?e.d=n:f(i).invalidWeekday=t}),ot(["d","e","E"],function(t,e,i,o){e[o]=w(t)});var Sn="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),kn="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Tn="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Cn=nn,Mn=nn,On=nn;q("H",["HH",2],0,"hour"),q("h",["hh",2],0,Ut),q("k",["kk",2],0,Vt),q("hmm",0,0,function(){return""+Ut.apply(this)+B(this.minutes(),2)}),q("hmmss",0,0,function(){return""+Ut.apply(this)+B(this.minutes(),2)+B(this.seconds(),2)}),q("Hmm",0,0,function(){return""+this.hours()+B(this.minutes(),2)}),q("Hmmss",0,0,function(){return""+this.hours()+B(this.minutes(),2)+B(this.seconds(),2)}),Bt("a",!0),Bt("A",!1),L("hour","h"),Y("hour",13),J("a",qt),J("A",qt),J("H",Bo),J("h",Bo),J("k",Bo),J("HH",Bo,zo),J("hh",Bo,zo),J("kk",Bo,zo),J("hmm",qo),J("hmmss",Xo),J("Hmm",qo),J("Hmmss",Xo),it(["H","HH"],ln),it(["k","kk"],function(t,e,i){var o=w(t);e[ln]=24===o?0:o}),it(["a","A"],function(t,e,i){i._isPm=i._locale.isPM(t),i._meridiem=t}),it(["h","hh"],function(t,e,i){e[ln]=w(t),f(i).bigHour=!0}),it("hmm",function(t,e,i){var o=t.length-2;e[ln]=w(t.substr(0,o)),e[un]=w(t.substr(o)),f(i).bigHour=!0}),it("hmmss",function(t,e,i){var o=t.length-4,n=t.length-2;e[ln]=w(t.substr(0,o)),e[un]=w(t.substr(o,2)),e[pn]=w(t.substr(n)),f(i).bigHour=!0}),it("Hmm",function(t,e,i){var o=t.length-2;e[ln]=w(t.substr(0,o)),e[un]=w(t.substr(o))}),it("Hmmss",function(t,e,i){var o=t.length-4,n=t.length-2;e[ln]=w(t.substr(0,o)),e[un]=w(t.substr(o,2)),e[pn]=w(t.substr(n))});var En,Pn=/[ap]\.?m?\.?/i,Nn=G("Hours",!0),An={calendar:Oo,longDateFormat:Eo,invalidDate:Po,ordinal:No,dayOfMonthOrdinalParse:Ao,relativeTime:Io,months:yn,monthsShort:bn,week:Dn,weekdays:Sn,weekdaysMin:Tn,weekdaysShort:kn,meridiemParse:Pn},In={},Rn={},Ln=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fn=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Hn=/Z|[+-]\d\d(?::?\d\d)?/,Yn=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],jn=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Gn=/^\/?Date\((\-?\d+)/i,zn=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;e.createFromInputFallback=S("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),e.ISO_8601=function(){},e.RFC_2822=function(){};var Wn=S("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=_e.apply(null,arguments);return this.isValid()&&t.isValid()?tthis?this:t:g()}),Vn=function(){return Date.now?Date.now():+new Date},Bn=["year","quarter","month","week","day","hour","minute","second","millisecond"];Ee("Z",":"),Ee("ZZ",""),J("Z",en),J("ZZ",en),it(["Z","ZZ"],function(t,e,i){i._useUTC=!0,i._tzm=Pe(en,t)});var qn=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Xn=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Zn=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ve.fn=Ce.prototype,Ve.invalid=Te;var Kn=Ze(1,"add"),$n=Ze(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Jn=S("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});q(0,["gg",2],0,function(){return this.weekYear()%100}),q(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ei("gggg","weekYear"),Ei("ggggg","weekYear"),Ei("GGGG","isoWeekYear"),Ei("GGGGG","isoWeekYear"),L("weekYear","gg"),L("isoWeekYear","GG"),Y("weekYear",1),Y("isoWeekYear",1),J("G",Qo),J("g",Qo),J("GG",Bo,zo),J("gg",Bo,zo),J("GGGG",Ko,Uo),J("gggg",Ko,Uo),J("GGGGG",$o,Vo),J("ggggg",$o,Vo),ot(["gggg","ggggg","GGGG","GGGGG"],function(t,e,i,o){e[o.substr(0,2)]=w(t)}),ot(["gg","GG"],function(t,i,o,n){i[n]=e.parseTwoDigitYear(t)}),q("Q",0,"Qo","quarter"),L("quarter","Q"),Y("quarter",7),J("Q",Go),it("Q",function(t,e){e[hn]=3*(w(t)-1)}),q("D",["DD",2],"Do","date"),L("date","D"),Y("date",9),J("D",Bo),J("DD",Bo,zo),J("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),it(["D","DD"],dn),it("Do",function(t,e){e[dn]=w(t.match(Bo)[0],10)});var Qn=G("Date",!0);q("DDD",["DDDD",3],"DDDo","dayOfYear"),L("dayOfYear","DDD"),Y("dayOfYear",4),J("DDD",Zo),J("DDDD",Wo),it(["DDD","DDDD"],function(t,e,i){i._dayOfYear=w(t)}),q("m",["mm",2],0,"minute"),L("minute","m"),Y("minute",14),J("m",Bo),J("mm",Bo,zo),it(["m","mm"],un);var ts=G("Minutes",!1);q("s",["ss",2],0,"second"),L("second","s"),Y("second",15),J("s",Bo),J("ss",Bo,zo),it(["s","ss"],pn);var es=G("Seconds",!1);q("S",0,0,function(){return~~(this.millisecond()/100)}),q(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),q(0,["SSS",3],0,"millisecond"),q(0,["SSSS",4],0,function(){return 10*this.millisecond()}),q(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),q(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),q(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),q(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),q(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),L("millisecond","ms"),Y("millisecond",16),J("S",Zo,Go),J("SS",Zo,zo),J("SSS",Zo,Wo);var is;for(is="SSSS";is.length<=9;is+="S")J(is,Jo);for(is="S";is.length<=9;is+="S")it(is,Yi);var os=G("Milliseconds",!1);q("z",0,0,"zoneAbbr"),q("zz",0,0,"zoneName");var ns=y.prototype;ns.add=Kn,ns.calendar=Je,ns.clone=Qe,ns.diff=ri,ns.endOf=bi,ns.format=ui,ns.from=pi,ns.fromNow=ci,ns.to=fi,ns.toNow=mi,ns.get=U,ns.invalidAt=Mi,ns.isAfter=ti,ns.isBefore=ei,ns.isBetween=ii,ns.isSame=oi,ns.isSameOrAfter=ni,ns.isSameOrBefore=si,ns.isValid=Ti,ns.lang=Jn,ns.locale=gi,ns.localeData=vi,ns.max=Un,ns.min=Wn,ns.parsingFlags=Ci,ns.set=V,ns.startOf=yi,ns.subtract=$n,ns.toArray=Di,ns.toObject=Si,ns.toDate=xi,ns.toISOString=di,ns.inspect=li,ns.toJSON=ki,ns.toString=hi,ns.unix=wi,ns.valueOf=_i,ns.creationData=Oi,ns.year=xn,ns.isLeapYear=yt,ns.weekYear=Pi,ns.isoWeekYear=Ni,ns.quarter=ns.quarters=Fi,ns.month=ut,ns.daysInMonth=pt,ns.week=ns.weeks=Mt,ns.isoWeek=ns.isoWeeks=Ot,ns.weeksInYear=Ii,ns.isoWeeksInYear=Ai,ns.date=Qn,ns.day=ns.days=Ft,ns.weekday=Ht,ns.isoWeekday=Yt,ns.dayOfYear=Hi,ns.hour=ns.hours=Nn,ns.minute=ns.minutes=ts,ns.second=ns.seconds=es,ns.millisecond=ns.milliseconds=os,ns.utcOffset=Ie,ns.utc=Le,ns.local=Fe,ns.parseZone=He,ns.hasAlignedHourOffset=Ye,ns.isDST=je,ns.isLocal=ze,ns.isUtcOffset=We,ns.isUtc=Ue,ns.isUTC=Ue,ns.zoneAbbr=ji,ns.zoneName=Gi,ns.dates=S("dates accessor is deprecated. Use date instead.",Qn),ns.months=S("months accessor is deprecated. Use month instead",ut),ns.years=S("years accessor is deprecated. Use year instead",xn),ns.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Re),ns.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ge);var ss=O.prototype;ss.calendar=E,ss.longDateFormat=P,ss.invalidDate=N,ss.ordinal=A,ss.preparse=Ui,ss.postformat=Ui,ss.relativeTime=I,ss.pastFuture=R,ss.set=C,ss.months=rt,ss.monthsShort=at,ss.monthsParse=dt,ss.monthsRegex=ft,ss.monthsShortRegex=ct,ss.week=kt,ss.firstDayOfYear=Ct,ss.firstDayOfWeek=Tt,ss.weekdays=Nt,ss.weekdaysMin=It,ss.weekdaysShort=At,ss.weekdaysParse=Lt,ss.weekdaysRegex=jt,ss.weekdaysShortRegex=Gt,ss.weekdaysMinRegex=zt,ss.isPM=Xt,ss.meridiem=Zt,Qt("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,i=1===w(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+i}}),e.lang=S("moment.lang is deprecated. Use moment.locale instead.",Qt),e.langData=S("moment.langData is deprecated. Use moment.localeData instead.",ie);var rs=Math.abs,as=lo("ms"),hs=lo("s"),ds=lo("m"),ls=lo("h"),us=lo("d"),ps=lo("w"),cs=lo("M"),fs=lo("y"),ms=po("milliseconds"),gs=po("seconds"),vs=po("minutes"),ys=po("hours"),bs=po("days"),_s=po("months"),ws=po("years"),xs=Math.round,Ds={ss:44,s:45,m:45,h:22,d:26,M:11},Ss=Math.abs,ks=Ce.prototype;return ks.isValid=ke,ks.abs=Qi,ks.add=eo,ks.subtract=io,ks.as=ao,ks.asMilliseconds=as,ks.asSeconds=hs,ks.asMinutes=ds,ks.asHours=ls,ks.asDays=us,ks.asWeeks=ps,ks.asMonths=cs,ks.asYears=fs,ks.valueOf=ho,ks._bubble=no,ks.get=uo,ks.milliseconds=ms,ks.seconds=gs,ks.minutes=vs,ks.hours=ys,ks.days=bs,ks.weeks=co,ks.months=_s,ks.years=ws,ks.humanize=yo,ks.toISOString=bo,ks.toString=bo,ks.toJSON=bo,ks.locale=gi,ks.localeData=vi,ks.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",bo),ks.lang=Jn,q("X",0,0,"unix"),q("x",0,0,"valueOf"),J("x",Qo),J("X",on),it("X",function(t,e,i){i._d=new Date(1e3*parseFloat(t,10))}),it("x",function(t,e,i){i._d=new Date(w(t))}),e.version="2.18.1",i(_e),e.fn=ns,e.min=xe,e.max=De,e.now=Vn,e.utc=p,e.unix=zi,e.months=Xi,e.isDate=h,e.locale=Qt,e.invalid=g,e.duration=Ve,e.isMoment=b,e.weekdays=Ki,e.parseZone=Wi,e.localeData=ie,e.isDuration=Me,e.monthsShort=Zi,e.weekdaysMin=Ji,e.defineLocale=te,e.updateLocale=ee,e.locales=oe,e.weekdaysShort=$i,e.normalizeUnits=F,e.relativeTimeRounding=go,e.relativeTimeThreshold=vo,e.calendarFormat=$e,e.prototype=ns,e})}).call(e,i(84)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){function i(t){throw new Error("Cannot find module '"+t+"'.")}i.keys=function(){return[]},i.resolve=i,t.exports=i,i.id=85},function(t,e){(function(e){function i(t,e,i){var o=e&&i||0,n=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){n<16&&(e[o+n++]=u[t])});n<16;)e[o+n++]=0;return e}function o(t,e){var i=e||0,o=l;return o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]}function n(t,e,i){var n=e&&i||0,s=e||[];t=t||{};var r=void 0!==t.clockseq?t.clockseq:m,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),h=void 0!==t.nsecs?t.nsecs:v+1,d=a-g+(h-v)/1e4;if(d<0&&void 0===t.clockseq&&(r=r+1&16383),(d<0||a>g)&&void 0===t.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");g=a,v=h,m=r,a+=122192928e5;var l=(1e4*(268435455&a)+h)%4294967296;s[n++]=l>>>24&255,s[n++]=l>>>16&255,s[n++]=l>>>8&255,s[n++]=255&l;var u=a/4294967296*1e4&268435455;s[n++]=u>>>8&255,s[n++]=255&u,s[n++]=u>>>24&15|16,s[n++]=u>>>16&255,s[n++]=r>>>8|128,s[n++]=255&r;for(var p=t.node||f,c=0;c<6;c++)s[n+c]=p[c];return e?e:o(s)}function s(t,e,i){var n=e&&i||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;a++)e[n+a]=s[a];return e||o(s)}var r,a="undefined"!=typeof window?window:"undefined"!=typeof e?e:null;if(a&&a.crypto&&crypto.getRandomValues){var h=new Uint8Array(16);r=function(){return crypto.getRandomValues(h),h}}if(!r){var d=new Array(16);r=function(){for(var t,e=0;e<16;e++)0===(3&e)&&(t=4294967296*Math.random()),d[e]=t>>>((3&e)<<3)&255;return d}}for(var l=[],u={},p=0;p<256;p++)l[p]=(p+256).toString(16).substr(1),u[l[p]]=p;var c=r(),f=[1|c[0],c[1],c[2],c[3],c[4],c[5]],m=16383&(c[6]<<8|c[7]),g=0,v=0,y=s;y.v1=n,y.v4=s,y.parse=i,y.unparse=o,t.exports=y}).call(e,function(){return this}())},function(t,e){e.prepareElements=function(t){for(var e in t)t.hasOwnProperty(e)&&(t[e].redundant=t[e].used,t[e].used=[])},e.cleanupElements=function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e].redundant){for(var i=0;i0?(o=e[t].redundant[0],e[t].redundant.shift()):(o=document.createElementNS("http://www.w3.org/2000/svg",t),i.appendChild(o)):(o=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},i.appendChild(o)),e[t].used.push(o),o},e.getDOMElement=function(t,e,i,o){var n;return e.hasOwnProperty(t)?e[t].redundant.length>0?(n=e[t].redundant[0],e[t].redundant.shift()):(n=document.createElement(t),void 0!==o?i.insertBefore(n,o):i.appendChild(n)):(n=document.createElement(t),e[t]={used:[],redundant:[]},void 0!==o?i.insertBefore(n,o):i.appendChild(n)),e[t].used.push(n),n},e.drawPoint=function(t,i,o,n,s,r){var a;if("circle"==o.style?(a=e.getSVGElement("circle",n,s),a.setAttributeNS(null,"cx",t),a.setAttributeNS(null,"cy",i),a.setAttributeNS(null,"r",.5*o.size)):(a=e.getSVGElement("rect",n,s),a.setAttributeNS(null,"x",t-.5*o.size),a.setAttributeNS(null,"y",i-.5*o.size),a.setAttributeNS(null,"width",o.size),a.setAttributeNS(null,"height",o.size)),void 0!==o.styles&&a.setAttributeNS(null,"style",o.styles),a.setAttributeNS(null,"class",o.className+" vis-point"),r){var h=e.getSVGElement("text",n,s);r.xOffset&&(t+=r.xOffset),r.yOffset&&(i+=r.yOffset),r.content&&(h.textContent=r.content),r.className&&h.setAttributeNS(null,"class",r.className+" vis-label"),h.setAttributeNS(null,"x",t),h.setAttributeNS(null,"y",i)}return a},e.drawBar=function(t,i,o,n,s,r,a,h){if(0!=n){n<0&&(n*=-1,i-=n);var d=e.getSVGElement("rect",r,a);d.setAttributeNS(null,"x",t-.5*o),d.setAttributeNS(null,"y",i),d.setAttributeNS(null,"width",o),d.setAttributeNS(null,"height",n),d.setAttributeNS(null,"class",s),h&&d.setAttributeNS(null,"style",h)}}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){if(t&&!Array.isArray(t)&&(e=t,t=null),this._options=e||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i=(0,l.default)(this._options.type),o=0,n=i.length;on?1:or)&&(s=h,r=d)}return s},n.prototype.min=function(t){var e,i,o=this._data,n=(0,l.default)(o),s=null,r=null;for(e=0,i=n.length;ethis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var t=this;this._timeout=setTimeout(function(){t.flush()},this.delay)}},i.prototype.flush=function(){for(;this._queue.length>0;){var t=this._queue.shift();t.fn.apply(t.context||t.fn,t.args||[])}},t.exports=i},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){this._data=null,this._ids={},this.length=0,this._options=e||{},this._fieldId="id",this._subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(t)}var s=i(58),r=o(s),a=i(1),h=i(88);n.prototype.setData=function(t){var e,i,o,n,s;if(this._data){for(this._data.off&&this._data.off("*",this.listener),e=this._data.getIds({filter:this._options&&this._options.filter}),s=[],o=0,n=e.length;os)&&(s=i)}),null!==n&&null!==s){var r=(n+s)/2,a=Math.max(this.range.end-this.range.start,1.1*(s-n)),h=!e||void 0===e.animation||e.animation;this.range.setRange(r-a/2,r+a/2,{animation:h})}}},o.prototype.fit=function(t){var e,i=!t||void 0===t.animation||t.animation,o=this.itemsData&&this.itemsData.getDataSet();1===o.length&&void 0===o.get()[0].end?(e=this.getDataRange(),this.moveTo(e.min.valueOf(),{animation:i})):(e=this.getItemRange(),this.range.setRange(e.min,e.max,{animation:i}))},o.prototype.getItemRange=function(){var t=this.getDataRange(),e=null!==t.min?t.min.valueOf():null,i=null!==t.max?t.max.valueOf():null,o=null,n=null;if(null!=e&&null!=i){var r=function(t){return s.convert(t.data.start,"Date").valueOf()},a=function(t){var e=void 0!=t.data.end?t.data.end:t.data.start;return s.convert(e,"Date").valueOf()},h=i-e;h<=0&&(h=10);var d=h/this.props.center.width;if(s.forEach(this.itemSet.items,function(t){t.groupShowing&&(t.show(),t.repositionX());var s=r(t),h=a(t);if(this.options.rtl)var l=s-(t.getWidthRight()+10)*d,u=h+(t.getWidthLeft()+10)*d;else var l=s-(t.getWidthLeft()+10)*d,u=h+(t.getWidthRight()+10)*d;li&&(i=u,n=t)}.bind(this)),o&&n){var l=o.getWidthLeft()+10,u=n.getWidthRight()+10,p=this.props.center.width-l-u;p>0&&(this.options.rtl?(e=r(o)-u*h/p,i=a(n)+l*h/p):(e=r(o)-l*h/p,i=a(n)+u*h/p))}}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}},o.prototype.getDataRange=function(){var t=null,e=null,i=this.itemsData&&this.itemsData.getDataSet();return i&&i.forEach(function(i){var o=s.convert(i.start,"Date").valueOf(),n=s.convert(void 0!=i.end?i.end:i.start,"Date").valueOf();(null===t||oe)&&(e=n)}),{min:null!=t?new Date(t):null,max:null!=e?new Date(e):null}},o.prototype.getEventProperties=function(t){var e=t.center?t.center.x:t.clientX,i=t.center?t.center.y:t.clientY;if(this.options.rtl)var o=s.getAbsoluteRight(this.dom.centerContainer)-e;else var o=e-s.getAbsoluteLeft(this.dom.centerContainer);var n=i-s.getAbsoluteTop(this.dom.centerContainer),r=this.itemSet.itemFromTarget(t),a=this.itemSet.groupFromTarget(t),h=p.customTimeFromTarget(t),d=this.itemSet.options.snap||null,l=this.body.util.getScale(),u=this.body.util.getStep(),c=this._toTime(o),f=d?d(c,l,u):c,m=s.getTarget(t),g=null;return null!=r?g="item":null!=h?g="custom-time":s.hasParent(m,this.timeAxis.dom.foreground)?g="axis":this.timeAxis2&&s.hasParent(m,this.timeAxis2.dom.foreground)?g="axis":s.hasParent(m,this.itemSet.dom.labelSet)?g="group-label":s.hasParent(m,this.currentTime.bar)?g="current-time":s.hasParent(m,this.dom.center)&&(g="background"),{event:t,item:r?r.id:null,group:a?a.groupId:null,what:g,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:o,y:n,time:c,snappedTime:f}},o.prototype.toggleRollingMode=function(){this.range.rolling?this.range.stopRolling():(void 0==this.options.rollingMode&&this.setOptions(this.options),this.range.startRolling())},t.exports=o},function(t,e){function i(t){if(t)return o(t)}function o(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},i.prototype.once=function(t,e){function i(){o.off(t,i),e.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},i.fn=e,this.on(t,i),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[t];if(!i)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o,n=0;n0?d._handlers[t]=o:(i.off(t,s),delete d._handlers[t]))}),d},d.emit=function(e,o){t=o.target,i.emit(e,o)},d.destroy=function(){var t=i.element.hammer,e=t.indexOf(d);e!==-1&&t.splice(e,1),t.length||delete i.element.hammer,d._handlers={},i.destroy()},d}})},function(t,e,i){var o;/*! Hammer.JS - v2.0.7 - 2016-04-22 - * http://hammerjs.github.io/ - * - * Copyright (c) 2016 Jorik Tangelder; - * Licensed under the MIT license */ -!function(n,s,r,a){function h(t,e,i){return setTimeout(c(t,i),e)}function d(t,e,i){return!!Array.isArray(t)&&(l(t,i[e],i),!0)}function l(t,e,i){var o;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==a)for(o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=n.console&&(n.console.warn||n.console.log);return s&&s.call(n.console,o,i),t.apply(this,arguments)}}function p(t,e,i){var o,n=e.prototype;o=t.prototype=Object.create(n),o.constructor=t,o._super=n,i&&mt(o,i)}function c(t,e){return function(){return t.apply(e,arguments)}}function f(t,e){return typeof t==yt?t.apply(e?e[0]||a:a,e):t}function m(t,e){return t===a?e:t}function g(t,e,i){l(_(e),function(e){t.addEventListener(e,i,!1)})}function v(t,e,i){l(_(e),function(e){t.removeEventListener(e,i,!1)})}function y(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function b(t,e){return t.indexOf(e)>-1}function _(t){return t.trim().split(/\s+/g)}function w(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var o=0;oi[e]}):o.sort()),o}function S(t,e){for(var i,o,n=e[0].toUpperCase()+e.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=A(e):1===n&&(i.firstMultiple=!1);var s=i.firstInput,r=i.firstMultiple,a=r?r.center:s.center,h=e.center=I(o);e.timeStamp=wt(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=H(a,h),e.distance=F(a,h),P(i,e),e.offsetDirection=L(e.deltaX,e.deltaY);var d=R(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=_t(d.x)>_t(d.y)?d.x:d.y,e.scale=r?j(r.pointers,o):1,e.rotation=r?Y(r.pointers,o):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,N(i,e);var l=t.element;y(e.srcEvent.target,l)&&(l=e.srcEvent.target),e.target=l}function P(t,e){var i=e.center,o=t.offsetDelta||{},n=t.prevDelta||{},s=t.prevInput||{};e.eventType!==It&&s.eventType!==Lt||(n=t.prevDelta={x:s.deltaX||0,y:s.deltaY||0},o=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=n.x+(i.x-o.x),e.deltaY=n.y+(i.y-o.y)}function N(t,e){var i,o,n,s,r=t.lastInterval||e,h=e.timeStamp-r.timeStamp;if(e.eventType!=Ft&&(h>At||r.velocity===a)){var d=e.deltaX-r.deltaX,l=e.deltaY-r.deltaY,u=R(h,d,l);o=u.x,n=u.y,i=_t(u.x)>_t(u.y)?u.x:u.y,s=L(d,l),t.lastInterval=e}else i=r.velocity,o=r.velocityX,n=r.velocityY,s=r.direction;e.velocity=i,e.velocityX=o,e.velocityY=n,e.direction=s}function A(t){for(var e=[],i=0;i=_t(e)?t<0?Yt:jt:e<0?Gt:zt}function F(t,e,i){i||(i=Bt);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return Math.sqrt(o*o+n*n)}function H(t,e,i){i||(i=Bt);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return 180*Math.atan2(n,o)/Math.PI}function Y(t,e){return H(e[1],e[0],qt)+H(t[1],t[0],qt)}function j(t,e){return F(e[0],e[1],qt)/F(t[0],t[1],qt)}function G(){this.evEl=Zt,this.evWin=Kt,this.pressed=!1,C.apply(this,arguments)}function z(){this.evEl=Qt,this.evWin=te,C.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function W(){this.evTarget=ie,this.evWin=oe,this.started=!1,C.apply(this,arguments)}function U(t,e){var i=x(t.touches),o=x(t.changedTouches);return e&(Lt|Ft)&&(i=D(i.concat(o),"identifier",!0)),[i,o]}function V(){this.evTarget=se,this.targetIds={},C.apply(this,arguments)}function B(t,e){var i=x(t.touches),o=this.targetIds;if(e&(It|Rt)&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,s,r=x(t.changedTouches),a=[],h=this.target;if(s=i.filter(function(t){return y(t.target,h)}),e===It)for(n=0;n-1&&o.splice(t,1)};setTimeout(n,re)}}function K(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){i.manager.emit(e,t)}var i=this,o=this.state;o<_e&&e(i.options.event+et(o)),e(i.options.event),t.additionalEvent&&e(t.additionalEvent),o>=_e&&e(i.options.event+et(o))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=De)},canEmit:function(){for(var t=0;te.threshold&&n&e.direction},attrTest:function(t){return nt.prototype.attrTest.call(this,t)&&(this.state&ye||!(this.state&ye)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=it(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),p(rt,nt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ce]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ye)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),p(at,tt,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ue]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distancee.time;if(this._input=t,!o||!i||t.eventType&(Lt|Ft)&&!n)this.reset();else if(t.eventType&It)this.reset(),this._timer=h(function(){this.state=we,this.tryEmit()},e.time,this);else if(t.eventType&Lt)return we;return De},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===we&&(t&&t.eventType&Lt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=wt(),this.manager.emit(this.options.event,this._input)))}}),p(ht,nt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ce]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ye)}}),p(dt,nt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Wt|Ut,pointers:1},getTouchAction:function(){return st.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(Wt|Ut)?e=t.overallVelocity:i&Wt?e=t.overallVelocityX:i&Ut&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&_t(e)>this.options.velocity&&t.eventType&Lt},emit:function(t){var e=it(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),p(lt,tt,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[pe]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distance1e3&&(i=1e3),e.body.dom.rollingModeBtn.style.visibility="hidden",e.currentTimeTimer=setTimeout(t,i)}var e=this;t()},n.prototype.stopRolling=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),this.rolling=!1,this.body.dom.rollingModeBtn.style.visibility="visible")},n.prototype.setRange=function(t,e,i,o){i||(i={}),i.byUser!==!0&&(i.byUser=!1);var n=this,s=void 0!=t?p.convert(t,"Date").valueOf():null,r=void 0!=e?p.convert(e,"Date").valueOf():null;if(this._cancelAnimation(),this.millisecondsPerPixelCache=void 0,i.animation){var h=this.start,l=this.end,c="object"===(0,u.default)(i.animation)&&"duration"in i.animation?i.animation.duration:500,f="object"===(0,u.default)(i.animation)&&"easingFunction"in i.animation?i.animation.easingFunction:"easeInOutQuad",g=p.easingFunctions[f];if(!g)throw new Error("Unknown easing function "+(0,d.default)(f)+". Choose from: "+(0,a.default)(p.easingFunctions).join(", "));var v=(new Date).valueOf(),y=!1,b=function t(){if(!n.props.touch.dragging){var e=(new Date).valueOf(),a=e-v,d=g(a/c),u=a>c,p=u||null===s?s:h+(s-h)*d,f=u||null===r?r:l+(r-l)*d;_=n._applyRange(p,f),m.updateHiddenDates(n.options.moment,n.body,n.options.hiddenDates),y=y||_;var b={start:new Date(n.start),end:new Date(n.end),byUser:i.byUser,event:i.event};if(_&&n.body.emitter.emit("rangechange",b),u){if(y&&(n.body.emitter.emit("rangechanged",b),o))return o()}else n.animationTimer=setTimeout(t,20)}};return b()}var _=this._applyRange(s,r);if(m.updateHiddenDates(this.options.moment,this.body,this.options.hiddenDates),_){var w={start:new Date(this.start),end:new Date(this.end),byUser:i.byUser,event:i.event};if(this.body.emitter.emit("rangechange",w),clearTimeout(n.timeoutID),n.timeoutID=setTimeout(function(){n.body.emitter.emit("rangechanged",w)},200),o)return o()}},n.prototype.getMillisecondsPerPixel=function(){return void 0===this.millisecondsPerPixelCache&&(this.millisecondsPerPixelCache=(this.end-this.start)/this.body.dom.center.clientWidth),this.millisecondsPerPixelCache},n.prototype._cancelAnimation=function(){this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=null)},n.prototype._applyRange=function(t,e){var i,o=null!=t?p.convert(t,"Date").valueOf():this.start,n=null!=e?p.convert(e,"Date").valueOf():this.end,s=null!=this.options.max?p.convert(this.options.max,"Date").valueOf():null,r=null!=this.options.min?p.convert(this.options.min,"Date").valueOf():null;if(isNaN(o)||null===o)throw new Error('Invalid start "'+t+'"');if(isNaN(n)||null===n)throw new Error('Invalid end "'+e+'"');if(ns&&(n=s)),null!==s&&n>s&&(i=n-s,o-=i,n-=i,null!=r&&o=this.start-h&&n<=this.end?(o=this.start,n=this.end):(i=a-(n-o),o-=i/2,n+=i/2)}}if(null!==this.options.zoomMax){var d=parseFloat(this.options.zoomMax);d<0&&(d=0),n-o>d&&(this.end-this.start===d&&othis.end?(o=this.start,n=this.end):(i=n-o-d,o+=i/2,n-=i/2))}var l=this.start!=o||this.end!=n;return o>=this.start&&o<=this.end||n>=this.start&&n<=this.end||this.start>=o&&this.start<=n||this.end>=o&&this.end<=n||this.body.emitter.emit("checkRangedItems"),this.start=o,this.end=n,l},n.prototype.getRange=function(){return{start:this.start,end:this.end}},n.prototype.conversion=function(t,e){return n.conversion(this.start,this.end,t,e)},n.conversion=function(t,e,i,o){return void 0===o&&(o=0),0!=i&&e-t!=0?{offset:t,scale:i/(e-t-o)}:{offset:0,scale:1}},n.prototype._onDragStart=function(t){this.deltaDifference=0,this.previousDelta=0,this.options.moveable&&this._isInsideRange(t)&&this.props.touch.allowDragging&&(this.stopRolling(),this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.dragging=!0,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))},n.prototype._onDrag=function(t){if(t&&this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging){var e=this.options.direction;s(e);var i="horizontal"==e?t.deltaX:t.deltaY;i-=this.deltaDifference;var o=this.props.touch.end-this.props.touch.start,n=m.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end);o-=n;var r="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height;if(this.options.rtl)var a=i/r*o;else var a=-i/r*o;var h=this.props.touch.start+a,d=this.props.touch.end+a,l=m.snapAwayFromHidden(this.body.hiddenDates,h,this.previousDelta-i,!0),u=m.snapAwayFromHidden(this.body.hiddenDates,d,this.previousDelta-i,!0);if(l!=h||u!=d)return this.deltaDifference+=i,this.props.touch.start=l,this.props.touch.end=u,void this._onDrag(t);this.previousDelta=i,this._applyRange(h,d);var p=new Date(this.start),c=new Date(this.end);this.body.emitter.emit("rangechange",{start:p,end:c,byUser:!0,event:t}),this.body.emitter.emit("panmove")}},n.prototype._onDragEnd=function(t){this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.dragging=!1,this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end),byUser:!0,event:t}))},n.prototype._onMouseWheel=function(t){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),this.options.zoomKey&&!t[this.options.zoomKey]&&this.options.zoomable||!this.options.zoomable&&this.options.moveable){if(this.options.horizontalScroll){t.preventDefault();var i=e*(this.end-this.start)/20,o=this.start-i,n=this.end-i,s={animation:!1,byUser:!0,event:t};this.setRange(o,n,s)}}else if(this.options.zoomable&&this.options.moveable&&this._isInsideRange(t)&&e){var r;r=e<0?1-e/5:1/(1+e/5);var a;if(this.rolling)a=this.start+(this.end-this.start)*this.options.rollingMode.offset;else{var h=this.getPointer({x:t.clientX,y:t.clientY},this.body.dom.center);a=this._pointerToDate(h)}this.zoom(r,a,e,t),t.preventDefault()}},n.prototype._onTouch=function(t){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null,this.scaleOffset=0,this.deltaDifference=0},n.prototype._onPinch=function(t){if(this.options.zoomable&&this.options.moveable){this.props.touch.allowDragging=!1,this.props.touch.center||(this.props.touch.center=this.getPointer(t.center,this.body.dom.center)),this.stopRolling();var e=1/(t.scale+this.scaleOffset),i=this._pointerToDate(this.props.touch.center),o=m.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end),n=m.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this,i),s=o-n,r=i-n+(this.props.touch.start-(i-n))*e,a=i+s+(this.props.touch.end-(i+s))*e;this.startToFront=1-e<=0,this.endToFront=e-1<=0;var h=m.snapAwayFromHidden(this.body.hiddenDates,r,1-e,!0),d=m.snapAwayFromHidden(this.body.hiddenDates,a,e-1,!0);h==r&&d==a||(this.props.touch.start=h,this.props.touch.end=d,this.scaleOffset=1-t.scale,r=h,a=d);var l={animation:!1,byUser:!0,event:t};this.setRange(r,a,l),this.startToFront=!1,this.endToFront=!0}},n.prototype._isInsideRange=function(t){var e=t.center?t.center.x:t.clientX;if(this.options.rtl)var i=e-p.getAbsoluteLeft(this.body.dom.centerContainer);else var i=p.getAbsoluteRight(this.body.dom.centerContainer)-e;var o=this.body.util.toTime(i);return o>=this.start&&o<=this.end},n.prototype._pointerToDate=function(t){var e,i=this.options.direction;if(s(i),"horizontal"==i)return this.body.util.toTime(t.x).valueOf();var o=this.body.domProps.center.height;return e=this.conversion(o),t.y/e.scale+e.offset},n.prototype.getPointer=function(t,e){return this.options.rtl?{x:p.getAbsoluteRight(e)-t.x,y:t.y-p.getAbsoluteTop(e)}:{x:t.x-p.getAbsoluteLeft(e),y:t.y-p.getAbsoluteTop(e)}},n.prototype.zoom=function(t,e,i,o){null==e&&(e=(this.start+this.end)/2);var n=m.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end),s=m.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this,e),r=n-s,a=e-s+(this.start-(e-s))*t,h=e+r+(this.end-(e+r))*t;this.startToFront=!(i>0),this.endToFront=!(-i>0);var d=m.snapAwayFromHidden(this.body.hiddenDates,a,i,!0),l=m.snapAwayFromHidden(this.body.hiddenDates,h,-i,!0);d==a&&l==h||(a=d,h=l);var u={animation:!1,byUser:!0,event:o};this.setRange(a,h,u),this.startToFront=!1,this.endToFront=!0},n.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,o=this.end+e*t;this.start=i,this.end=o},n.prototype.moveTo=function(t){var e=(this.start+this.end)/2,i=e-t,o=this.start-i,n=this.end-i,s={animation:!1,byUser:!0,event:null};this.setRange(o,n,s)},t.exports=n},function(t,e,i){i(95);e.onTouch=function(t,e){e.inputHandler=function(t){t.isFirst&&e(t)},t.on("hammer.input",e.inputHandler)},e.onRelease=function(t,e){return e.inputHandler=function(t){t.isFinal&&e(t)},t.on("hammer.input",e.inputHandler)},e.offTouch=function(t,e){t.off("hammer.input",e.inputHandler)},e.offRelease=e.offTouch,e.disablePreventDefaultVertically=function(t){var e="pan-y";return t.getTouchAction=function(){return[e]},t}},function(t,e,i){function o(t,e){this.options=null,this.props=null}var n=i(1);o.prototype.setOptions=function(t){t&&n.extend(this.options,t)},o.prototype.redraw=function(){return!1},o.prototype.destroy=function(){},o.prototype._isResized=function(){var t=this.props._previousWidth!==this.props.width||this.props._previousHeight!==this.props.height; -return this.props._previousWidth=this.props.width,this.props._previousHeight=this.props.height,t},t.exports=o},function(t,e){e.convertHiddenOptions=function(t,i,o){if(o&&!Array.isArray(o))return e.convertHiddenOptions(t,i,[o]);if(i.hiddenDates=[],o&&1==Array.isArray(o)){for(var n=0;n=4*a){var p=0,c=s.clone();switch(o[h].repeat){case"daily":d.day()!=l.day()&&(p=1),d.dayOfYear(n.dayOfYear()),d.year(n.year()),d.subtract(7,"days"),l.dayOfYear(n.dayOfYear()),l.year(n.year()),l.subtract(7-p,"days"),c.add(1,"weeks");break;case"weekly":var f=l.diff(d,"days"),m=d.day();d.date(n.date()),d.month(n.month()),d.year(n.year()),l=d.clone(),d.day(m),l.day(m),l.add(f,"days"),d.subtract(1,"weeks"),l.subtract(1,"weeks"),c.add(1,"weeks");break;case"monthly":d.month()!=l.month()&&(p=1),d.month(n.month()),d.year(n.year()),d.subtract(1,"months"),l.month(n.month()),l.year(n.year()),l.subtract(1,"months"),l.add(p,"months"),c.add(1,"months");break;case"yearly":d.year()!=l.year()&&(p=1),d.year(n.year()),d.subtract(1,"years"),l.year(n.year()),l.subtract(1,"years"),l.add(p,"years"),c.add(1,"years");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",o[h].repeat)}for(;d=e[o].start&&e[n].end<=e[o].end?e[n].remove=!0:e[n].start>=e[o].start&&e[n].start<=e[o].end?(e[o].end=e[n].end,e[n].remove=!0):e[n].end>=e[o].start&&e[n].end<=e[o].end&&(e[o].start=e[n].start,e[n].remove=!0));for(var o=0;o=r&&nt.range.end){var h={start:t.range.start,end:i};i=e.correctTimeForHidden(t.options.moment,t.body.hiddenDates,h,i);var n=t.range.conversion(o,r);return(i.valueOf()-n.offset)*n.scale}i=e.correctTimeForHidden(t.options.moment,t.body.hiddenDates,t.range,i);var n=t.range.conversion(o,r);return(i.valueOf()-n.offset)*n.scale},e.toTime=function(t,i,o){if(0==t.body.hiddenDates.length){var n=t.range.conversion(o);return new Date(i/n.scale+n.offset)}var s=e.getHiddenDurationBetween(t.body.hiddenDates,t.range.start,t.range.end),r=t.range.end-t.range.start-s,a=r*i/o,h=e.getAccumulatedHiddenDuration(t.body.hiddenDates,t.range,a),d=new Date(h+a+t.range.start);return d},e.getHiddenDurationBetween=function(t,e,i){for(var o=0,n=0;n=e&&r=e&&r<=i&&(o+=r-s)}return o},e.correctTimeForHidden=function(t,i,o,n){return n=t(n).toDate().valueOf(),n-=e.getHiddenDurationBefore(t,i,o,n)},e.getHiddenDurationBefore=function(t,e,i,o){var n=0;o=t(o).toDate().valueOf();for(var s=0;s=i.start&&a=a&&(n+=a-r)}return n},e.getAccumulatedHiddenDuration=function(t,e,i){for(var o=0,n=0,s=e.start,r=0;r=e.start&&h=i)break;o+=h-a}}return o},e.snapAwayFromHidden=function(t,i,o,n){var s=e.isHidden(i,t);return 1==s.hidden?o<0?1==n?s.startDate-(s.endDate-i)-1:s.startDate-1:1==n?s.endDate+(i-s.startDate)+1:s.endDate+1:i},e.isHidden=function(t,e){for(var i=0;i=o&&t-1||h))return t.dataTransfer.dropEffect="move",h=!0,!1}function n(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation();try{var e=JSON.parse(t.dataTransfer.getData("text"));if(!e.content)return}catch(t){return!1}return h=!1,t.center={x:t.clientX,y:t.clientY},s.itemSet._onAddItem(t),s.emit("drop",s.getEventProperties(t)),!1}this.dom={},this.dom.container=t,this.dom.root=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.backgroundVertical=document.createElement("div"),this.dom.backgroundHorizontal=document.createElement("div"),this.dom.centerContainer=document.createElement("div"),this.dom.leftContainer=document.createElement("div"),this.dom.rightContainer=document.createElement("div"),this.dom.center=document.createElement("div"),this.dom.left=document.createElement("div"),this.dom.right=document.createElement("div"),this.dom.top=document.createElement("div"),this.dom.bottom=document.createElement("div"),this.dom.shadowTop=document.createElement("div"),this.dom.shadowBottom=document.createElement("div"),this.dom.shadowTopLeft=document.createElement("div"),this.dom.shadowBottomLeft=document.createElement("div"),this.dom.shadowTopRight=document.createElement("div"),this.dom.shadowBottomRight=document.createElement("div"),this.dom.rollingModeBtn=document.createElement("div"),this.dom.root.className="vis-timeline",this.dom.background.className="vis-panel vis-background",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical",this.dom.backgroundHorizontal.className="vis-panel vis-background vis-horizontal",this.dom.centerContainer.className="vis-panel vis-center",this.dom.leftContainer.className="vis-panel vis-left",this.dom.rightContainer.className="vis-panel vis-right",this.dom.top.className="vis-panel vis-top",this.dom.bottom.className="vis-panel vis-bottom",this.dom.left.className="vis-content",this.dom.center.className="vis-content",this.dom.right.className="vis-content",this.dom.shadowTop.className="vis-shadow vis-top",this.dom.shadowBottom.className="vis-shadow vis-bottom",this.dom.shadowTopLeft.className="vis-shadow vis-top",this.dom.shadowBottomLeft.className="vis-shadow vis-bottom",this.dom.shadowTopRight.className="vis-shadow vis-top",this.dom.shadowBottomRight.className="vis-shadow vis-bottom",this.dom.rollingModeBtn.className="vis-rolling-mode-btn",this.dom.root.appendChild(this.dom.background),this.dom.root.appendChild(this.dom.backgroundVertical),this.dom.root.appendChild(this.dom.backgroundHorizontal),this.dom.root.appendChild(this.dom.centerContainer),this.dom.root.appendChild(this.dom.leftContainer),this.dom.root.appendChild(this.dom.rightContainer),this.dom.root.appendChild(this.dom.top),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.rollingModeBtn),this.dom.centerContainer.appendChild(this.dom.center),this.dom.leftContainer.appendChild(this.dom.left),this.dom.rightContainer.appendChild(this.dom.right),this.dom.centerContainer.appendChild(this.dom.shadowTop),this.dom.centerContainer.appendChild(this.dom.shadowBottom),this.dom.leftContainer.appendChild(this.dom.shadowTopLeft),this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft),this.dom.rightContainer.appendChild(this.dom.shadowTopRight),this.dom.rightContainer.appendChild(this.dom.shadowBottomRight),this.props={root:{},background:{},centerContainer:{},leftContainer:{},rightContainer:{},center:{},left:{},right:{},top:{},bottom:{},border:{},scrollTop:0,scrollTopMin:0},this.on("rangechange",function(){this.initialDrawDone===!0&&this._redraw()}.bind(this)),this.on("touch",this._onTouch.bind(this)),this.on("panmove",this._onDrag.bind(this));var s=this;this._origRedraw=this._redraw.bind(this),this._redraw=p.throttle(this._origRedraw),this.on("_change",function(t){s.itemSet&&s.itemSet.initialItemSetDrawn&&t&&1==t.queue?s._redraw():s._origRedraw()}),this.hammer=new l(this.dom.root);var r=this.hammer.get("pinch").set({enable:!0});u.disablePreventDefaultVertically(r),this.hammer.get("pan").set({threshold:5,direction:l.DIRECTION_HORIZONTAL}),this.listeners={};var a=["tap","doubletap","press","pinch","pan","panstart","panmove","panend"];a.forEach(function(t){var e=function(e){s.isActive()&&s.emit(t,e)};s.hammer.on(t,e),s.listeners[t]=e}),u.onTouch(this.hammer,function(t){s.emit("touch",t)}.bind(this)),u.onRelease(this.hammer,function(t){s.emit("release",t)}.bind(this)),this.dom.centerContainer.addEventListener?(this.dom.centerContainer.addEventListener("mousewheel",e.bind(this),!1),this.dom.centerContainer.addEventListener("DOMMouseScroll",e.bind(this),!1)):this.dom.centerContainer.attachEvent("onmousewheel",e.bind(this)),this.dom.left.parentNode.addEventListener("scroll",i.bind(this)),this.dom.right.parentNode.addEventListener("scroll",i.bind(this));var h=!1;if(this.dom.center.addEventListener("dragover",o.bind(this),!1),this.dom.center.addEventListener("drop",n.bind(this),!1),this.customTimes=[],this.touch={},this.redrawCount=0,this.initialDrawDone=!1,!t)throw new Error("No container provided");t.appendChild(this.dom.root)},n.prototype.setOptions=function(t){if(t){var e=["width","height","minHeight","maxHeight","autoResize","start","end","clickToUse","dataAttributes","hiddenDates","locale","locales","moment","rtl","zoomKey","horizontalScroll","verticalScroll"];if(p.selectiveExtend(e,this.options,t),this.dom.rollingModeBtn.style.visibility="hidden",this.options.rtl&&(this.dom.container.style.direction="rtl",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical-rtl"),this.options.verticalScroll&&(this.options.rtl?this.dom.rightContainer.className="vis-panel vis-right vis-vertical-scroll":this.dom.leftContainer.className="vis-panel vis-left vis-vertical-scroll"),this.options.orientation={item:void 0,axis:void 0},"orientation"in t&&("string"==typeof t.orientation?this.options.orientation={item:t.orientation,axis:t.orientation}:"object"===(0,h.default)(t.orientation)&&("item"in t.orientation&&(this.options.orientation.item=t.orientation.item),"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis))),"both"===this.options.orientation.axis){if(!this.timeAxis2){var i=this.timeAxis2=new c(this.body);i.setOptions=function(t){var e=t?p.extend({},t):{};e.orientation="top",c.prototype.setOptions.call(i,e)},this.components.push(i)}}else if(this.timeAxis2){var o=this.components.indexOf(this.timeAxis2);o!==-1&&this.components.splice(o,1),this.timeAxis2.destroy(),this.timeAxis2=null}if("function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),"hiddenDates"in this.options&&m.convertHiddenOptions(this.options.moment,this.body,this.options.hiddenDates),"clickToUse"in t&&(t.clickToUse?this.activator||(this.activator=new f(this.dom.root)):this.activator&&(this.activator.destroy(),delete this.activator)),"showCustomTime"in t)throw new Error("Option `showCustomTime` is deprecated. Create a custom time bar via timeline.addCustomTime(time [, id])");this._initAutoResize()}if(this.components.forEach(function(e){return e.setOptions(t)}),"configure"in t){this.configurator||(this.configurator=this._createConfigurator()),this.configurator.setOptions(t.configure);var n=p.deepExtend({},this.options);this.components.forEach(function(t){p.deepExtend(n,t.options)}),this.configurator.setModuleOptions({global:n})}this._redraw()},n.prototype.isActive=function(){return!this.activator||this.activator.active},n.prototype.destroy=function(){this.setItems(null),this.setGroups(null),this.off(),this._stopAutoResize(),this.dom.root.parentNode&&this.dom.root.parentNode.removeChild(this.dom.root),this.dom=null,this.activator&&(this.activator.destroy(),delete this.activator);for(var t in this.listeners)this.listeners.hasOwnProperty(t)&&delete this.listeners[t];this.listeners=null,this.hammer=null,this.components.forEach(function(t){return t.destroy()}),this.body=null},n.prototype.setCustomTime=function(t,e){var i=this.customTimes.filter(function(t){return e===t.options.id});if(0===i.length)throw new Error("No custom time bar found with id "+(0,r.default)(e));i.length>0&&i[0].setCustomTime(t)},n.prototype.getCustomTime=function(t){var e=this.customTimes.filter(function(e){return e.options.id===t});if(0===e.length)throw new Error("No custom time bar found with id "+(0,r.default)(t));return e[0].getCustomTime()},n.prototype.setCustomTimeTitle=function(t,e){var i=this.customTimes.filter(function(t){return t.options.id===e});if(0===i.length)throw new Error("No custom time bar found with id "+(0,r.default)(e));if(i.length>0)return i[0].setCustomTitle(t)},n.prototype.getEventProperties=function(t){return{event:t}},n.prototype.addCustomTime=function(t,e){var i=void 0!==t?p.convert(t,"Date").valueOf():new Date,o=this.customTimes.some(function(t){return t.options.id===e});if(o)throw new Error("A custom time with id "+(0,r.default)(e)+" already exists");var n=new g(this.body,p.extend({},this.options,{time:i,id:e}));return this.customTimes.push(n),this.components.push(n),this._redraw(),e},n.prototype.removeCustomTime=function(t){var e=this.customTimes.filter(function(e){return e.options.id===t});if(0===e.length)throw new Error("No custom time bar found with id "+(0,r.default)(t));e.forEach(function(t){this.customTimes.splice(this.customTimes.indexOf(t),1),this.components.splice(this.components.indexOf(t),1),t.destroy()}.bind(this))},n.prototype.getVisibleItems=function(){return this.itemSet&&this.itemSet.getVisibleItems()||[]},n.prototype.fit=function(t,e){var i=this.getDataRange();if(null!==i.min||null!==i.max){var o=i.max-i.min,n=new Date(i.min.valueOf()-.01*o),s=new Date(i.max.valueOf()+.01*o),r=!t||void 0===t.animation||t.animation;this.range.setRange(n,s,{animation:r},e)}},n.prototype.getDataRange=function(){throw new Error("Cannot invoke abstract method getDataRange")},n.prototype.setWindow=function(t,e,i,o){"function"==typeof arguments[2]&&(o=arguments[2],i={});var n;if(1==arguments.length){var s=arguments[0];n=void 0===s.animation||s.animation,this.range.setRange(s.start,s.end,{animation:n})}else if(2==arguments.length&&"function"==typeof arguments[1]){var s=arguments[0];o=arguments[1],n=void 0===s.animation||s.animation,this.range.setRange(s.start,s.end,{animation:n},o)}else n=!i||void 0===i.animation||i.animation,this.range.setRange(t,e,{animation:n},o)},n.prototype.moveTo=function(t,e,i){"function"==typeof arguments[1]&&(i=arguments[1],e={});var o=this.range.end-this.range.start,n=p.convert(t,"Date").valueOf(),s=n-o/2,r=n+o/2,a=!e||void 0===e.animation||e.animation;this.range.setRange(s,r,{animation:a},i)},n.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},n.prototype.zoomIn=function(t,e,i){if(!(!t||t<0||t>1)){"function"==typeof arguments[1]&&(i=arguments[1],e={});var o=this.getWindow(),n=o.start.valueOf(),s=o.end.valueOf(),r=s-n,a=r/(1+t),h=(r-a)/2,d=n+h,l=s-h;this.setWindow(d,l,e,i)}},n.prototype.zoomOut=function(t,e,i){if(!(!t||t<0||t>1)){"function"==typeof arguments[1]&&(i=arguments[1],e={});var o=this.getWindow(),n=o.start.valueOf(),s=o.end.valueOf(),r=s-n,a=n-r*t/2,h=s+r*t/2;this.setWindow(a,h,e,i)}},n.prototype.redraw=function(){this._redraw()},n.prototype._redraw=function(){this.redrawCount++;var t=!1,e=this.options,i=this.props,o=this.dom;if(o&&o.container&&0!=o.root.offsetWidth){m.updateHiddenDates(this.options.moment,this.body,this.options.hiddenDates),"top"==e.orientation?(p.addClassName(o.root,"vis-top"),p.removeClassName(o.root,"vis-bottom")):(p.removeClassName(o.root,"vis-top"),p.addClassName(o.root,"vis-bottom")),o.root.style.maxHeight=p.option.asSize(e.maxHeight,""),o.root.style.minHeight=p.option.asSize(e.minHeight,""),o.root.style.width=p.option.asSize(e.width,""),i.border.left=(o.centerContainer.offsetWidth-o.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(o.centerContainer.offsetHeight-o.centerContainer.clientHeight)/2,i.border.bottom=i.border.top,i.borderRootHeight=o.root.offsetHeight-o.root.clientHeight,i.borderRootWidth=o.root.offsetWidth-o.root.clientWidth,0===o.centerContainer.clientHeight&&(i.border.left=i.border.top,i.border.right=i.border.left),0===o.root.clientHeight&&(i.borderRootWidth=i.borderRootHeight),i.center.height=o.center.offsetHeight,i.left.height=o.left.offsetHeight,i.right.height=o.right.offsetHeight,i.top.height=o.top.clientHeight||-i.border.top,i.bottom.height=o.bottom.clientHeight||-i.border.bottom;var n=Math.max(i.left.height,i.center.height,i.right.height),s=i.top.height+n+i.bottom.height+i.borderRootHeight+i.border.top+i.border.bottom;o.root.style.height=p.option.asSize(e.height,s+"px"),i.root.height=o.root.offsetHeight,i.background.height=i.root.height-i.borderRootHeight;var r=i.root.height-i.top.height-i.bottom.height-i.borderRootHeight;i.centerContainer.height=r,i.leftContainer.height=r,i.rightContainer.height=i.leftContainer.height,i.root.width=o.root.offsetWidth,i.background.width=i.root.width-i.borderRootWidth,this.initialDrawDone||(i.scrollbarWidth=p.getScrollBarWidth()),e.verticalScroll?e.rtl?(i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth+i.scrollbarWidth||-i.border.right):(i.left.width=o.leftContainer.clientWidth+i.scrollbarWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right):(i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right),this._setDOM();var a=this._updateScrollTop();"top"!=e.orientation.item&&(a+=Math.max(i.centerContainer.height-i.center.height-i.border.top-i.border.bottom,0)),o.center.style.top=a+"px";var h=0==i.scrollTop?"hidden":"",d=i.scrollTop==i.scrollTopMin?"hidden":"";o.shadowTop.style.visibility=h,o.shadowBottom.style.visibility=d,o.shadowTopLeft.style.visibility=h,o.shadowBottomLeft.style.visibility=d,o.shadowTopRight.style.visibility=h,o.shadowBottomRight.style.visibility=d,e.verticalScroll&&(o.rightContainer.className="vis-panel vis-right vis-vertical-scroll",o.leftContainer.className="vis-panel vis-left vis-vertical-scroll",o.shadowTopRight.style.visibility="hidden",o.shadowBottomRight.style.visibility="hidden",o.shadowTopLeft.style.visibility="hidden",o.shadowBottomLeft.style.visibility="hidden",o.left.style.top="0px",o.right.style.top="0px"),(!e.verticalScroll||i.center.heighti.centerContainer.height;this.hammer.get("pan").set({direction:u?l.DIRECTION_ALL:l.DIRECTION_HORIZONTAL}),this.components.forEach(function(e){t=e.redraw()||t});var c=5;if(t){if(this.redrawCount0&&(this.props.scrollTop=0),this.props.scrollTope&&o.push(h.id):h.lefti&&o.push(h.id)}return o},n.prototype._deselect=function(t){for(var e=this.selection,i=0,o=e.length;in)return}}if(i&&i!=this.groupTouchParams.group){var h=e.get(i.groupId),d=e.get(this.groupTouchParams.group.groupId);d&&h&&(this.options.groupOrderSwap(d,h,e),e.update(d),e.update(h));var u=e.getIds({order:this.options.groupOrder});if(!l.equalArray(u,this.groupTouchParams.originalOrder))for(var c=this.groupTouchParams.originalOrder,f=this.groupTouchParams.group.groupId,m=Math.min(c.length,u.length),g=0,v=0,y=0;g=m)break;if(u[g+v]!=f)if(c[g+y]!=f){var b=u.indexOf(c[g+y]),_=e.get(u[g+v]),w=e.get(c[g+y]);this.options.groupOrderSwap(_,w,e),e.update(_),e.update(w);var x=u[g+v];u[g+v]=c[g+y],u[b]=x,g++}else y=1;else v=1}}}},n.prototype._onGroupDragEnd=function(t){if(this.options.groupEditable.order&&this.groupTouchParams.group){t.stopPropagation();var e=this,i=e.groupTouchParams.group.groupId,o=e.groupsData.getDataSet(),n=l.extend({},o.get(i));e.options.onMoveGroup(n,function(t){if(t)t[o._fieldId]=i,o.update(t);else{var n=o.getIds({order:e.options.groupOrder});if(!l.equalArray(n,e.groupTouchParams.originalOrder))for(var s=e.groupTouchParams.originalOrder,r=Math.min(s.length,n.length),a=0;a=r)break;var h=n.indexOf(s[a]),d=o.get(n[a]),u=o.get(s[a]);e.options.groupOrderSwap(d,u,o),o.update(d),o.update(u);var p=n[a];n[a]=s[a],n[h]=p,a++}}}),e.body.emitter.emit("groupDragged",{groupId:i})}},n.prototype._onSelectItem=function(t){if(this.options.selectable){var e=t.srcEvent&&(t.srcEvent.ctrlKey||t.srcEvent.metaKey),i=t.srcEvent&&t.srcEvent.shiftKey;if(e||i)return void this._onMultiSelectItem(t);var o=this.getSelection(),n=this.itemFromTarget(t),s=n?[n.id]:[];this.setSelection(s);var r=this.getSelection();(r.length>0||o.length>0)&&this.body.emitter.emit("select",{items:r,event:t})}},n.prototype._onMouseOver=function(t){var e=this.itemFromTarget(t);if(e){var i=this.itemFromRelatedTarget(t);if(e!==i){var o=e.getTitle();if(this.options.showTooltips&&o){null==this.popup&&(this.popup=new w(this.body.dom.root,this.options.tooltip.overflowMethod||"flip")),this.popup.setText(o);var n=this.body.dom.centerContainer;this.popup.setPosition(t.clientX-l.getAbsoluteLeft(n)+n.offsetLeft,t.clientY-l.getAbsoluteTop(n)+n.offsetTop),this.popup.show()}else null!=this.popup&&this.popup.hide();this.body.emitter.emit("itemover",{item:e.id,event:t})}}},n.prototype._onMouseOut=function(t){var e=this.itemFromTarget(t);if(e){var i=this.itemFromRelatedTarget(t);e!==i&&(null!=this.popup&&this.popup.hide(),this.body.emitter.emit("itemout",{item:e.id,event:t}))}},n.prototype._onMouseMove=function(t){var e=this.itemFromTarget(t);if(e&&this.options.showTooltips&&this.options.tooltip.followMouse&&this.popup&&!this.popup.hidden){var i=this.body.dom.centerContainer;this.popup.setPosition(t.clientX-l.getAbsoluteLeft(i)+i.offsetLeft,t.clientY-l.getAbsoluteTop(i)+i.offsetTop),this.popup.show()}},n.prototype._onMouseWheel=function(t){this.touchParams.itemIsDragging&&this._onDragEnd(t)},n.prototype._onUpdateItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this;if(t){var i=e.itemsData.get(t.id);this.options.onUpdate(i,function(t){t&&e.itemsData.getDataSet().update(t)})}}},n.prototype._onAddItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this,i=this.options.snap||null,o=this.itemFromTarget(t);if(!o){if(this.options.rtl)var n=l.getAbsoluteRight(this.dom.frame),s=n-t.center.x;else var n=l.getAbsoluteLeft(this.dom.frame),s=t.center.x-n;var r,a=this.body.util.toTime(s),h=this.body.util.getScale(),d=this.body.util.getStep();if("drop"==t.type){if(r=JSON.parse(t.dataTransfer.getData("text")),r.content=r.content?r.content:"new item",r.start=r.start?r.start:i?i(a,h,d):a,r.type=r.type||"box",r[this.itemsData._fieldId]=r.id||l.randomUUID(),"range"==r.type&&!r.end){var u=this.body.util.toTime(s+this.props.width/5);r.end=i?i(u,h,d):u}}else if(r={start:i?i(a,h,d):a,content:"new item"},r[this.itemsData._fieldId]=l.randomUUID(),"range"===this.options.type){var u=this.body.util.toTime(s+this.props.width/5);r.end=i?i(u,h,d):u}var p=this.groupFromTarget(t);p&&(r.group=p.groupId),r=this._cloneItemData(r),this.options.onAdd(r,function(i){i&&(e.itemsData.getDataSet().add(i),"drop"==t.type&&e.setSelection([i.id]))})}}},n.prototype._onMultiSelectItem=function(t){if(this.options.selectable){var e=this.itemFromTarget(t);if(e){var i=this.options.multiselect?this.getSelection():[],o=t.srcEvent&&t.srcEvent.shiftKey||!1;if(o&&this.options.multiselect){var s=this.itemsData.get(e.id).group,r=void 0;this.options.multiselectPerGroup&&i.length>0&&(r=this.itemsData.get(i[0]).group),this.options.multiselectPerGroup&&void 0!=r&&r!=s||i.push(e.id);var a=n._getItemRange(this.itemsData.get(i,this.itemOptions));if(!this.options.multiselectPerGroup||r==s){i=[];for(var h in this.items)if(this.items.hasOwnProperty(h)){var d=this.items[h],l=d.data.start,u=void 0!==d.data.end?d.data.end:l;!(l>=a.min&&u<=a.max)||this.options.multiselectPerGroup&&r!=this.itemsData.get(d.id).group||d instanceof _||i.push(d.id)}}}else{var p=i.indexOf(e.id);p==-1?i.push(e.id):i.splice(p,1)}this.setSelection(i),this.body.emitter.emit("select",{items:this.getSelection(),event:t})}}},n._getItemRange=function(t){var e=null,i=null;return t.forEach(function(t){(null==i||t.starte)&&(e=t.end):(null==e||t.start>e)&&(e=t.start)}),{min:i,max:e}},n.prototype.itemFromElement=function(t){for(var e=t;e;){if(e.hasOwnProperty("timeline-item"))return e["timeline-item"];e=e.parentNode}return null},n.prototype.itemFromTarget=function(t){return this.itemFromElement(t.target)},n.prototype.itemFromRelatedTarget=function(t){return this.itemFromElement(t.relatedTarget)},n.prototype.groupFromTarget=function(t){var e=t.center?t.center.y:t.clientY,i=this.groupIds;i.length<=0&&this.groupsData&&(i=this.groupsData.getIds({order:this.options.groupOrder}));for(var o=0;oa&&ea)return s}else if(0===o&&e0&&this.current.milliseconds()0&&this.current.seconds()0&&this.current.minutes()0&&this.current.hours()0?t.step:1,this.autoScale=!1)},o.prototype.setAutoScale=function(t){this.autoScale=t},o.prototype.setMinimumStep=function(t){if(void 0!=t){var e=31104e6,i=2592e6,o=864e5,n=36e5,s=6e4,r=1e3,a=1;1e3*e>t&&(this.scale="year",this.step=1e3),500*e>t&&(this.scale="year",this.step=500),100*e>t&&(this.scale="year",this.step=100),50*e>t&&(this.scale="year",this.step=50),10*e>t&&(this.scale="year",this.step=10),5*e>t&&(this.scale="year",this.step=5),e>t&&(this.scale="year",this.step=1),3*i>t&&(this.scale="month",this.step=3),i>t&&(this.scale="month",this.step=1),5*o>t&&(this.scale="day",this.step=5),2*o>t&&(this.scale="day",this.step=2),o>t&&(this.scale="day",this.step=1),o/2>t&&(this.scale="weekday",this.step=1),4*n>t&&(this.scale="hour",this.step=4),n>t&&(this.scale="hour",this.step=1),15*s>t&&(this.scale="minute",this.step=15),10*s>t&&(this.scale="minute",this.step=10),5*s>t&&(this.scale="minute",this.step=5),s>t&&(this.scale="minute",this.step=1),15*r>t&&(this.scale="second",this.step=15),10*r>t&&(this.scale="second",this.step=10),5*r>t&&(this.scale="second",this.step=5),r>t&&(this.scale="second",this.step=1),200*a>t&&(this.scale="millisecond",this.step=200),100*a>t&&(this.scale="millisecond",this.step=100),50*a>t&&(this.scale="millisecond",this.step=50),10*a>t&&(this.scale="millisecond",this.step=10),5*a>t&&(this.scale="millisecond",this.step=5),a>t&&(this.scale="millisecond",this.step=1)}},o.snap=function(t,e,i){var o=n(t);if("year"==e){var s=o.year()+Math.round(o.month()/12);o.year(Math.round(s/i)*i),o.month(0),o.date(0),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("month"==e)o.date()>15?(o.date(1),o.add(1,"month")):o.date(1),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0);else if("week"==e)o.weekday()>2?(o.weekday(0),o.add(1,"week")):o.weekday(0),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0);else if("day"==e){switch(i){case 5:case 2:o.hours(24*Math.round(o.hours()/24));break;default:o.hours(12*Math.round(o.hours()/12))}o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("weekday"==e){switch(i){case 5:case 2:o.hours(12*Math.round(o.hours()/12));break;default:o.hours(6*Math.round(o.hours()/6))}o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("hour"==e){switch(i){case 4:o.minutes(60*Math.round(o.minutes()/60));break;default:o.minutes(30*Math.round(o.minutes()/30))}o.seconds(0),o.milliseconds(0)}else if("minute"==e){switch(i){case 15:case 10:o.minutes(5*Math.round(o.minutes()/5)),o.seconds(0);break;case 5:o.seconds(60*Math.round(o.seconds()/60));break;default:o.seconds(30*Math.round(o.seconds()/30))}o.milliseconds(0)}else if("second"==e)switch(i){case 15:case 10:o.seconds(5*Math.round(o.seconds()/5)),o.milliseconds(0);break;case 5:o.milliseconds(1e3*Math.round(o.milliseconds()/1e3));break;default:o.milliseconds(500*Math.round(o.milliseconds()/500))}else if("millisecond"==e){var r=i>5?i/2:1;o.milliseconds(Math.round(o.milliseconds()/r)*r)}return o},o.prototype.isMajor=function(){if(1==this.switchedYear)switch(this.scale){case"year":case"month":case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedMonth)switch(this.scale){case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedDay)switch(this.scale){case"millisecond":case"second":case"minute":case"hour":return!0;default:return!1}var t=this.moment(this.current);switch(this.scale){case"millisecond":return 0==t.milliseconds();case"second":return 0==t.seconds();case"minute":return 0==t.hours()&&0==t.minutes();case"hour":return 0==t.hours();case"weekday":case"day":return 1==t.date();case"week":return 1==t.date();case"month":return 0==t.month();case"year":return!1;default:return!1}},o.prototype.getLabelMinor=function(t){if(void 0==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.minorLabels)return this.format.minorLabels(t,this.scale,this.step);var e=this.format.minorLabels[this.scale];switch(this.scale){case"week":if(this.isMajor()&&0!==t.weekday())return"";default:return e&&e.length>0?this.moment(t).format(e):""}},o.prototype.getLabelMajor=function(t){if(void 0==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)), -"function"==typeof this.format.majorLabels)return this.format.majorLabels(t,this.scale,this.step);var e=this.format.majorLabels[this.scale];return e&&e.length>0?this.moment(t).format(e):""},o.prototype.getClassName=function(){function t(t){return t/h%2==0?" vis-even":" vis-odd"}function e(t){return t.isSame(new Date,"day")?" vis-today":t.isSame(s().add(1,"day"),"day")?" vis-tomorrow":t.isSame(s().add(-1,"day"),"day")?" vis-yesterday":""}function i(t){return t.isSame(new Date,"week")?" vis-current-week":""}function o(t){return t.isSame(new Date,"month")?" vis-current-month":""}function n(t){return t.isSame(new Date,"year")?" vis-current-year":""}var s=this.moment,r=this.moment(this.current),a=r.locale?r.locale("en"):r.lang("en"),h=this.step,d=[];switch(this.scale){case"millisecond":d.push(e(a)),d.push(t(a.milliseconds()));break;case"second":d.push(e(a)),d.push(t(a.seconds()));break;case"minute":d.push(e(a)),d.push(t(a.minutes()));break;case"hour":d.push("vis-h"+a.hours()+this.step==4?"-h"+(a.hours()+4):""),d.push(e(a)),d.push(t(a.hours()));break;case"weekday":d.push("vis-"+a.format("dddd").toLowerCase()),d.push(e(a)),d.push(i(a)),d.push(t(a.date()));break;case"day":d.push("vis-day"+a.date()),d.push("vis-"+a.format("MMMM").toLowerCase()),d.push(e(a)),d.push(o(a)),d.push(this.step<=2?e(a):""),d.push(this.step<=2?"vis-"+a.format("dddd").toLowerCase():""),d.push(t(a.date()-1));break;case"week":d.push("vis-week"+a.format("w")),d.push(i(a)),d.push(t(a.week()));break;case"month":d.push("vis-"+a.format("MMMM").toLowerCase()),d.push(o(a)),d.push(t(a.month()));break;case"year":d.push("vis-year"+a.year()),d.push(n(a)),d.push(t(a.year()))}return d.filter(String).join(" ")},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i){this.groupId=t,this.subgroups={},this.subgroupIndex=0,this.subgroupOrderer=e&&e.subgroupOrder,this.itemSet=i,this.isVisible=null,this.stackDirty=!0,e&&e.nestedGroups&&(this.nestedGroups=e.nestedGroups,0==e.showNested?this.showNested=!1:this.showNested=!0),this.nestedInGroup=null,this.dom={},this.props={label:{width:0,height:0}},this.className=null,this.items={},this.visibleItems=[],this.itemsInRange=[],this.orderedItems={byStart:[],byEnd:[]},this.checkRangedItems=!1;var o=this;this.itemSet.body.emitter.on("checkRangedItems",function(){o.checkRangedItems=!0}),this._create(),this.setData(e)}var s=i(58),r=o(s),a=i(1),h=i(106);i(107);n.prototype._create=function(){var t=document.createElement("div");this.itemSet.options.groupEditable.order?t.className="vis-label draggable":t.className="vis-label",this.dom.label=t;var e=document.createElement("div");e.className="vis-inner",t.appendChild(e),this.dom.inner=e;var i=document.createElement("div");i.className="vis-group",i["timeline-group"]=this,this.dom.foreground=i,this.dom.background=document.createElement("div"),this.dom.background.className="vis-group",this.dom.axis=document.createElement("div"),this.dom.axis.className="vis-group",this.dom.marker=document.createElement("div"),this.dom.marker.style.visibility="hidden",this.dom.marker.style.position="absolute",this.dom.marker.innerHTML="",this.dom.background.appendChild(this.dom.marker)},n.prototype.setData=function(t){var e,i;if(this.itemSet.options&&this.itemSet.options.groupTemplate?(i=this.itemSet.options.groupTemplate.bind(this),e=i(t,this.dom.inner)):e=t&&t.content,e instanceof Element){for(this.dom.inner.appendChild(e);this.dom.inner.firstChild;)this.dom.inner.removeChild(this.dom.inner.firstChild);this.dom.inner.appendChild(e)}else e instanceof Object?i(t,this.dom.inner):void 0!==e&&null!==e?this.dom.inner.innerHTML=e:this.dom.inner.innerHTML=this.groupId||"";if(this.dom.label.title=t&&t.title||"",this.dom.inner.firstChild?a.removeClassName(this.dom.inner,"vis-hidden"):a.addClassName(this.dom.inner,"vis-hidden"),t&&t.nestedGroups){this.nestedGroups&&this.nestedGroups==t.nestedGroups||(this.nestedGroups=t.nestedGroups),void 0===t.showNested&&void 0!==this.showNested||(0==t.showNested?this.showNested=!1:this.showNested=!0),a.addClassName(this.dom.label,"vis-nesting-group");var o=this.itemSet.options.rtl?"collapsed-rtl":"collapsed";this.showNested?(a.removeClassName(this.dom.label,o),a.addClassName(this.dom.label,"expanded")):(a.removeClassName(this.dom.label,"expanded"),a.addClassName(this.dom.label,o))}else if(this.nestedGroups){this.nestedGroups=null;var o=this.itemSet.options.rtl?"collapsed-rtl":"collapsed";a.removeClassName(this.dom.label,o),a.removeClassName(this.dom.label,"expanded"),a.removeClassName(this.dom.label,"vis-nesting-group")}t&&t.nestedInGroup&&(a.addClassName(this.dom.label,"vis-nested-group"),this.itemSet.options&&this.itemSet.options.rtl?this.dom.inner.style.paddingRight="30px":this.dom.inner.style.paddingLeft="30px");var n=t&&t.className||null;n!=this.className&&(this.className&&(a.removeClassName(this.dom.label,this.className),a.removeClassName(this.dom.foreground,this.className),a.removeClassName(this.dom.background,this.className),a.removeClassName(this.dom.axis,this.className)),a.addClassName(this.dom.label,n),a.addClassName(this.dom.foreground,n),a.addClassName(this.dom.background,n),a.addClassName(this.dom.axis,n),this.className=n),this.style&&(a.removeCssText(this.dom.label,this.style),this.style=null),t&&t.style&&(a.addCssText(this.dom.label,t.style),this.style=t.style)},n.prototype.getLabelWidth=function(){return this.props.label.width},n.prototype.redraw=function(t,e,i){var o=!1,n=this.dom.marker.clientHeight;n!=this.lastMarkerHeight&&(this.lastMarkerHeight=n,a.forEach(this.items,function(t){t.dirty=!0,t.displayed&&t.redraw()}),i=!0),this._calculateSubGroupHeights(e);var s=this.dom.foreground;this.top=s.offsetTop,this.right=s.offsetLeft,this.width=s.offsetWidth;var r=this.isVisible;this.isVisible=this._isGroupVisible(t,e);var d=i||this.stackDirty||this.isVisible&&!r;if(this._updateSubgroupsSizes(),d){if("function"==typeof this.itemSet.options.order){var l=this,u=!1;a.forEach(this.items,function(t){t.displayed||(t.redraw(),l.visibleItems.push(t)),t.repositionX(u)});var p=this.orderedItems.byStart.slice().sort(function(t,e){return l.itemSet.options.order(t.data,e.data)});h.stack(p,e,!0),this.visibleItems=this._updateItemsInRange(this.orderedItems,this.visibleItems,t)}else this.visibleItems=this._updateItemsInRange(this.orderedItems,this.visibleItems,t),this.itemSet.options.stack?h.stack(this.visibleItems,e,!0):h.nostack(this.visibleItems,e,this.subgroups,this.itemSet.options.stackSubgroups);this.stackDirty=!1}var c=this._calculateHeight(e),s=this.dom.foreground;this.top=s.offsetTop,this.right=s.offsetLeft,this.width=s.offsetWidth,o=a.updateProperty(this,"height",c)||o,o=a.updateProperty(this.props.label,"width",this.dom.inner.clientWidth)||o,o=a.updateProperty(this.props.label,"height",this.dom.inner.clientHeight)||o,this.dom.background.style.height=c+"px",this.dom.foreground.style.height=c+"px",this.dom.label.style.height=c+"px";for(var f=0,m=this.visibleItems.length;f0){var e=this;this.resetSubgroups(),a.forEach(this.visibleItems,function(i){void 0!==i.data.subgroup&&(e.subgroups[i.data.subgroup].height=Math.max(e.subgroups[i.data.subgroup].height,i.height+t.item.vertical),e.subgroups[i.data.subgroup].visible=!0)})}},n.prototype._isGroupVisible=function(t,e){var i=this.top<=t.body.domProps.centerContainer.height-t.body.domProps.scrollTop+e.axis&&this.top+this.height+e.axis>=-t.body.domProps.scrollTop;return i},n.prototype._calculateHeight=function(t){var e,i=this.visibleItems;if(i.length>0){var o=i[0].top,n=i[0].top+i[0].height;if(a.forEach(i,function(t){o=Math.min(o,t.top),n=Math.max(n,t.top+t.height)}),o>t.axis){var s=o-t.axis;n-=s,a.forEach(i,function(t){t.top-=s})}e=n+t.item.vertical/2}else e=0;return e=Math.max(e,this.props.label.height)},n.prototype.show=function(){this.dom.label.parentNode||this.itemSet.dom.labelSet.appendChild(this.dom.label),this.dom.foreground.parentNode||this.itemSet.dom.foreground.appendChild(this.dom.foreground),this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background),this.dom.axis.parentNode||this.itemSet.dom.axis.appendChild(this.dom.axis)},n.prototype.hide=function(){var t=this.dom.label;t.parentNode&&t.parentNode.removeChild(t);var e=this.dom.foreground;e.parentNode&&e.parentNode.removeChild(e);var i=this.dom.background;i.parentNode&&i.parentNode.removeChild(i);var o=this.dom.axis;o.parentNode&&o.parentNode.removeChild(o)},n.prototype.add=function(t){if(this.items[t.id]=t,t.setParent(this),this.stackDirty=!0,void 0!==t.data.subgroup&&(this._addToSubgroup(t),this.orderSubgroups()),this.visibleItems.indexOf(t)==-1){var e=this.itemSet.body.range;this._checkIfVisible(t,this.visibleItems,e)}},n.prototype._addToSubgroup=function(t,e){e=e||t.data.subgroup,void 0!=e&&void 0===this.subgroups[e]&&(this.subgroups[e]={height:0,top:0,start:t.data.start,end:t.data.end,visible:!1,index:this.subgroupIndex,items:[]},this.subgroupIndex++),new Date(t.data.start)new Date(this.subgroups[e].end)&&(this.subgroups[e].end=t.data.end),this.subgroups[e].items.push(t)},n.prototype._updateSubgroupsSizes=function(){var t=this;if(t.subgroups)for(var e in t.subgroups){var i=t.subgroups[e].items[0].data.start,o=t.subgroups[e].items[0].data.end-1;t.subgroups[e].items.forEach(function(t){new Date(t.data.start)new Date(o)&&(o=t.data.end)}),t.subgroups[e].start=i,t.subgroups[e].end=new Date(o-1)}},n.prototype.orderSubgroups=function(){if(void 0!==this.subgroupOrderer){var t=[];if("string"==typeof this.subgroupOrderer){for(var e in this.subgroups)t.push({subgroup:e,sortField:this.subgroups[e].items[0].data[this.subgroupOrderer]});t.sort(function(t,e){return t.sortField-e.sortField})}else if("function"==typeof this.subgroupOrderer){for(var e in this.subgroups)t.push(this.subgroups[e].items[0].data);t.sort(this.subgroupOrderer)}if(t.length>0)for(var i=0;i=0&&(i.items.splice(o,1),i.items.length?this._updateSubgroupsSizes():delete this.subgroups[e])}}},n.prototype.removeFromDataSet=function(t){this.itemSet.removeItem(t.id)},n.prototype.order=function(){for(var t=a.toArray(this.items),e=[],i=[],o=0;o0)for(var l=0;lh}),1==this.checkRangedItems)for(this.checkRangedItems=!1,l=0;lh})}for(var l=0;l=0;s--){var r=e[s];if(n(r))break;void 0===o[r.id]&&(o[r.id]=!0,i.push(r))}for(var s=t+1;so[r].index&&e.collisionByTimes(o[n],o[r])){s=o[r];break}null!=s&&(o[n].top=s.top+s.height)}while(s)}for(var a=0;ae.right&&t.top-o.vertical+ie.top:t.left-o.horizontal+ie.left&&t.top-o.vertical+ie.top},e.collisionByTimes=function(t,e){return t.start<=e.start&&t.end>=e.start&&t.tope.top||e.start<=t.start&&e.end>=t.start&&e.topt.top}},function(t,e,i){function o(t,e,i){if(this.props={content:{width:0}},this.overflow=!1,this.options=i,t){if(void 0==t.start)throw new Error('Property "start" missing in item '+t.id);if(void 0==t.end)throw new Error('Property "end" missing in item '+t.id)}n.call(this,t,e,i)}var n=(i(95),i(108));o.prototype=new n(null,null,null),o.prototype.baseClassName="vis-item vis-range",o.prototype.isVisible=function(t){return this.data.startt.start},o.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("div"),t.frame=document.createElement("div"),t.frame.className="vis-item-overflow",t.box.appendChild(t.frame),t.visibleFrame=document.createElement("div"),t.visibleFrame.className="vis-item-visible-frame",t.box.appendChild(t.visibleFrame),t.content=document.createElement("div"),t.content.className="vis-item-content",t.frame.appendChild(t.content),t.box["timeline-item"]=this,this.dirty=!0),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.foreground;if(!e)throw new Error("Cannot redraw item: parent has no foreground container element");e.appendChild(t.box)}if(this.displayed=!0,this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.box),this._updateStyle(this.dom.box);var i=this.editable.updateTime||this.editable.updateGroup,o=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+(i?" vis-editable":" vis-readonly");t.box.className=this.baseClassName+o,this.overflow="hidden"!==window.getComputedStyle(t.frame).overflow,this.dom.content.style.maxWidth="none",this.props.content.width=this.dom.content.offsetWidth,this.height=this.dom.box.offsetHeight,this.dom.content.style.maxWidth="",this.dirty=!1}this._repaintOnItemUpdateTimeTooltip(t.box),this._repaintDeleteButton(t.box),this._repaintDragCenter(),this._repaintDragLeft(),this._repaintDragRight()},o.prototype.show=function(){this.displayed||this.redraw()},o.prototype.hide=function(){if(this.displayed){var t=this.dom.box;t.parentNode&&t.parentNode.removeChild(t),this.displayed=!1}},o.prototype.repositionX=function(t){var e,i,o=this.parent.width,n=this.conversion.toScreen(this.data.start),s=this.conversion.toScreen(this.data.end),r=void 0===this.data.align?this.options.align:this.data.align;void 0!==t&&t!==!0||(n<-o&&(n=-o),s>2*o&&(s=2*o));var a=Math.max(s-n+.5,1);switch(this.overflow?(this.options.rtl?this.right=n:this.left=n,this.width=a+this.props.content.width,i=this.props.content.width):(this.options.rtl?this.right=n:this.left=n,this.width=a,i=Math.min(s-n,this.props.content.width)),this.options.rtl?this.dom.box.style.right=this.right+"px":this.dom.box.style.left=this.left+"px",this.dom.box.style.width=a+"px",r){case"left":this.options.rtl?this.dom.content.style.right="0":this.dom.content.style.left="0";break;case"right":this.options.rtl?this.dom.content.style.right=Math.max(a-i,0)+"px":this.dom.content.style.left=Math.max(a-i,0)+"px";break;case"center":this.options.rtl?this.dom.content.style.right=Math.max((a-i)/2,0)+"px":this.dom.content.style.left=Math.max((a-i)/2,0)+"px";break;default:e=this.overflow?s>0?Math.max(-n,0):-i:n<0?-n:0,this.options.rtl?this.dom.content.style.right=e+"px":(this.dom.content.style.left=e+"px",this.dom.content.style.width="calc(100% - "+e+"px)")}},o.prototype.repositionY=function(){var t=this.options.orientation.item,e=this.dom.box;"top"==t?e.style.top=this.top+"px":e.style.top=this.parent.height-this.top-this.height+"px"},o.prototype._repaintDragLeft=function(){if((this.selected||this.options.itemsAlwaysDraggable.range)&&this.options.editable.updateTime&&!this.dom.dragLeft){var t=document.createElement("div");t.className="vis-drag-left",t.dragLeftItem=this,this.dom.box.appendChild(t),this.dom.dragLeft=t}else this.selected||this.options.itemsAlwaysDraggable.range||!this.dom.dragLeft||(this.dom.dragLeft.parentNode&&this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft),this.dom.dragLeft=null)},o.prototype._repaintDragRight=function(){if((this.selected||this.options.itemsAlwaysDraggable.range)&&this.options.editable.updateTime&&!this.dom.dragRight){var t=document.createElement("div");t.className="vis-drag-right",t.dragRightItem=this,this.dom.box.appendChild(t),this.dom.dragRight=t}else this.selected||this.options.itemsAlwaysDraggable.range||!this.dom.dragRight||(this.dom.dragRight.parentNode&&this.dom.dragRight.parentNode.removeChild(this.dom.dragRight),this.dom.dragRight=null)},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e,i){this.id=null,this.parent=null,this.data=t,this.dom=null,this.conversion=e||{},this.options=i||{},this.selected=!1,this.displayed=!1,this.groupShowing=!0,this.dirty=!0,this.top=null,this.right=null,this.left=null,this.width=null,this.height=null,this.editable=null,this._updateEditStatus()}var s=i(62),r=o(s),a=i(58),h=o(a),d=i(95),l=i(1),u=i(82);n.prototype.stack=!0,n.prototype.select=function(){this.selected=!0,this.dirty=!0,this.displayed&&this.redraw()},n.prototype.unselect=function(){this.selected=!1,this.dirty=!0,this.displayed&&this.redraw()},n.prototype.setData=function(t){var e=void 0!=t.group&&this.data.group!=t.group;e&&null!=this.parent&&this.parent.itemSet._moveToGroup(this,t.group),this.parent.stackDirty=!0;var i=void 0!=t.subgroup&&this.data.subgroup!=t.subgroup;i&&null!=this.parent&&this.parent.changeSubgroup(this,this.data.subgroup,t.subgroup),this.data=t,this._updateEditStatus(),this.dirty=!0,this.displayed&&this.redraw()},n.prototype.setParent=function(t){this.displayed?(this.hide(),this.parent=t,this.parent&&this.show()):this.parent=t},n.prototype.isVisible=function(t){return!1},n.prototype.show=function(){return!1},n.prototype.hide=function(){return!1},n.prototype.redraw=function(){},n.prototype.repositionX=function(){},n.prototype.repositionY=function(){},n.prototype._repaintDragCenter=function(){if(this.selected&&this.options.editable.updateTime&&!this.dom.dragCenter){var t=this,e=document.createElement("div");e.className="vis-drag-center",e.dragCenterItem=this;var i=new d(e);i.on("tap",function(e){t.parent.itemSet.body.emitter.emit("click",{event:e,item:t.id})}),i.on("doubletap",function(e){e.stopPropagation(),t.parent.itemSet._onUpdateItem(t),t.parent.itemSet.body.emitter.emit("doubleClick",{event:e,item:t.id})}),this.dom.box?this.dom.dragLeft?this.dom.box.insertBefore(e,this.dom.dragLeft):this.dom.box.appendChild(e):this.dom.point&&this.dom.point.appendChild(e),this.dom.dragCenter=e}else!this.selected&&this.dom.dragCenter&&(this.dom.dragCenter.parentNode&&this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter),this.dom.dragCenter=null)},n.prototype._repaintDeleteButton=function(t){var e=(this.options.editable.overrideItems||null==this.editable)&&this.options.editable.remove||!this.options.editable.overrideItems&&null!=this.editable&&this.editable.remove;if(this.selected&&e&&!this.dom.deleteButton){var i=this,o=document.createElement("div");this.options.rtl?o.className="vis-delete-rtl":o.className="vis-delete",o.title="Delete this item",new d(o).on("tap",function(t){t.stopPropagation(),i.parent.removeFromDataSet(i)}),t.appendChild(o),this.dom.deleteButton=o}else!this.selected&&this.dom.deleteButton&&(this.dom.deleteButton.parentNode&&this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton),this.dom.deleteButton=null)},n.prototype._repaintOnItemUpdateTimeTooltip=function(t){if(this.options.tooltipOnItemUpdateTime){var e=(this.options.editable.updateTime||this.data.editable===!0)&&this.data.editable!==!1;if(this.selected&&e&&!this.dom.onItemUpdateTimeTooltip){var i=document.createElement("div");i.className="vis-onUpdateTime-tooltip",t.appendChild(i),this.dom.onItemUpdateTimeTooltip=i}else!this.selected&&this.dom.onItemUpdateTimeTooltip&&(this.dom.onItemUpdateTimeTooltip.parentNode&&this.dom.onItemUpdateTimeTooltip.parentNode.removeChild(this.dom.onItemUpdateTimeTooltip),this.dom.onItemUpdateTimeTooltip=null);if(this.dom.onItemUpdateTimeTooltip){this.dom.onItemUpdateTimeTooltip.style.visibility=this.parent.itemSet.touchParams.itemIsDragging?"visible":"hidden",this.options.rtl?this.dom.onItemUpdateTimeTooltip.style.right=this.dom.content.style.right:this.dom.onItemUpdateTimeTooltip.style.left=this.dom.content.style.left;var o,n=50,s=this.parent.itemSet.body.domProps.scrollTop;o="top"==this.options.orientation.item?this.top:this.parent.height-this.top-this.height;var r=o+this.parent.top-n<-s;r?(this.dom.onItemUpdateTimeTooltip.style.bottom="",this.dom.onItemUpdateTimeTooltip.style.top=this.height+2+"px"):(this.dom.onItemUpdateTimeTooltip.style.top="",this.dom.onItemUpdateTimeTooltip.style.bottom=this.height+2+"px");var a,h;this.options.tooltipOnItemUpdateTime&&this.options.tooltipOnItemUpdateTime.template?(h=this.options.tooltipOnItemUpdateTime.template.bind(this),a=h(this.data)):(a="start: "+u(this.data.start).format("MM/DD/YYYY hh:mm"),this.data.end&&(a+="
end: "+u(this.data.end).format("MM/DD/YYYY hh:mm"))),this.dom.onItemUpdateTimeTooltip.innerHTML=a}}},n.prototype._updateContents=function(t){var e,i,o,n,s=this.parent.itemSet.itemsData.get(this.id),r=this.dom.box||this.dom.point,a=r.getElementsByClassName("vis-item-visible-frame")[0];if(this.options.visibleFrameTemplate?(n=this.options.visibleFrameTemplate.bind(this),o=n(s,r)):o="",a)if(o instanceof Object&&!(o instanceof Element))n(s,a);else{var h=this._contentToString(this.itemVisibleFrameContent)!==this._contentToString(o);if(h){if(o instanceof Element)a.innerHTML="",a.appendChild(o);else if(void 0!=o)a.innerHTML=o;else if("background"!=this.data.type||void 0!==this.data.content)throw new Error('Property "content" missing in item '+this.id);this.itemVisibleFrameContent=o}}if(this.options.template?(i=this.options.template.bind(this),e=i(s,t,this.data)):e=this.data.content,e instanceof Object&&!(e instanceof Element))i(s,t);else{var h=this._contentToString(this.content)!==this._contentToString(e);if(h){if(e instanceof Element)t.innerHTML="",t.appendChild(e);else if(void 0!=e)t.innerHTML=e;else if("background"!=this.data.type||void 0!==this.data.content)throw new Error('Property "content" missing in item '+this.id);this.content=e}}},n.prototype._updateDataAttributes=function(t){if(this.options.dataAttributes&&this.options.dataAttributes.length>0){var e=[];if(Array.isArray(this.options.dataAttributes))e=this.options.dataAttributes;else{if("all"!=this.options.dataAttributes)return;e=(0,h.default)(this.data)}for(var i=0;it.start&&this.data.start.getTime()-ot.start&&this.data.start.getTime()t.start&&this.data.start.getTime()-o/2t.start&&this.data.startt.start},o.prototype.redraw=function(){var t=this.dom;if(t||(this.dom={},t=this.dom,t.box=document.createElement("div"),t.frame=document.createElement("div"),t.frame.className="vis-item-overflow",t.box.appendChild(t.frame),t.content=document.createElement("div"),t.content.className="vis-item-content",t.frame.appendChild(t.content),this.dirty=!0),!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!t.box.parentNode){var e=this.parent.dom.background;if(!e)throw new Error("Cannot redraw item: parent has no background container element");e.appendChild(t.box)}if(this.displayed=!0,this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.content),this._updateStyle(this.dom.box);var i=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"");t.box.className=this.baseClassName+i,this.overflow="hidden"!==window.getComputedStyle(t.content).overflow,this.props.content.width=this.dom.content.offsetWidth,this.height=0,this.dirty=!1}},o.prototype.show=r.prototype.show,o.prototype.hide=r.prototype.hide,o.prototype.repositionX=r.prototype.repositionX,o.prototype.repositionY=function(t){var e,i=this.options.orientation.item;if(void 0!==this.data.subgroup){var o=this.data.subgroup,n=this.parent.subgroups;n[o].index;this.dom.box.style.height=this.parent.subgroups[o].height+"px","top"==i?this.dom.box.style.top=this.parent.top+this.parent.subgroups[o].top+"px":this.dom.box.style.top=this.parent.top+this.parent.height-this.parent.subgroups[o].top-this.parent.subgroups[o].height+"px",this.dom.box.style.bottom=""}else this.parent instanceof s?(e=Math.max(this.parent.height,this.parent.itemSet.body.domProps.center.height,this.parent.itemSet.body.domProps.centerContainer.height),this.dom.box.style.bottom="bottom"==i?"0":"",this.dom.box.style.top="top"==i?"0":""):(e=this.parent.height,this.dom.box.style.top=this.parent.top+"px",this.dom.box.style.bottom="");this.dom.box.style.height=e+"px"},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(114),s=o(n),r=i(115),a=o(r),h=function(){function t(e,i){(0,s.default)(this,t),this.container=e,this.overflowMethod=i||"cap",this.x=0,this.y=0,this.padding=5,this.hidden=!1,this.frame=document.createElement("div"),this.frame.className="vis-tooltip",this.container.appendChild(this.frame)}return(0,a.default)(t,[{key:"setPosition",value:function(t,e){this.x=parseInt(t),this.y=parseInt(e)}},{key:"setText",value:function(t){t instanceof Element?(this.frame.innerHTML="",this.frame.appendChild(t)):this.frame.innerHTML=t}},{key:"show",value:function(t){if(void 0===t&&(t=!0),t===!0){var e=this.frame.clientHeight,i=this.frame.clientWidth,o=this.frame.parentNode.clientHeight,n=this.frame.parentNode.clientWidth,s=0,r=0;if("flip"==this.overflowMethod){var a=!1,h=!0;this.y-en-this.padding&&(a=!0),s=a?this.x-i:this.x,r=h?this.y-e:this.y}else r=this.y-e,r+e+this.padding>o&&(r=o-e-this.padding),rn&&(s=n-i-this.padding),s=.4*y}if(this.options.showMinorLabels&&v){var T=this._repaintMinorText(c,_,t,w);T.style.width=x+"px"}m&&this.options.showMajorLabels?(c>0&&(void 0==D&&(D=c),T=this._repaintMajorText(c,s.getLabelMajor(),t,w)),b=this._repaintMajorLine(c,x,t,w)):v?b=this._repaintMinorLine(c,x,t,w):b&&(b.style.width=parseInt(b.style.width)+x+"px")}if(S!==k||p||(console.warn("Something is wrong with the Timeline scale. Limited drawing of grid lines to "+k+" lines."),p=!0),this.options.showMajorLabels){var C=this.body.util.toTime(0),M=s.getLabelMajor(C),O=M.length*(this.props.majorCharWidth||10)+10;(void 0==D||O1e3&&(o=1e3),e.redraw(),e.body.emitter.emit("currentTimeTick"),e.currentTimeTimer=setTimeout(t,o)}var e=this;t()},o.prototype.stop=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer)},o.prototype.setCurrentTime=function(t){var e=n.convert(t,"Date").valueOf(),i=(new Date).valueOf();this.offset=e-i,this.redraw()},o.prototype.getCurrentTime=function(){return new Date((new Date).valueOf()+this.offset)},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.printStyle=void 0;var n=i(89),s=o(n),r=i(62),a=o(r),h=i(58),d=o(h),l=i(114),u=o(l),p=i(115),c=o(p),f=i(1),m=!1,g=void 0,v="background: #FFeeee; color: #dd0000",y=function(){function t(){(0,u.default)(this,t)}return(0,c.default)(t,null,[{key:"validate",value:function(e,i,o){m=!1,g=i;var n=i;return void 0!==o&&(n=i[o]),t.parse(e,n,[]),m}},{key:"parse",value:function(e,i,o){for(var n in e)e.hasOwnProperty(n)&&t.check(n,e,i,o)}},{key:"check",value:function(e,i,o,n){void 0===o[e]&&void 0===o.__any__?t.getSuggestion(e,o,n):void 0===o[e]&&void 0!==o.__any__?"object"===t.getType(i[e])&&void 0!==o.__any__.__type__?t.checkFields(e,i,o,"__any__",o.__any__.__type__,n):t.checkFields(e,i,o,"__any__",o.__any__,n):void 0!==o[e].__type__?t.checkFields(e,i,o,e,o[e].__type__,n):t.checkFields(e,i,o,e,o[e],n)}},{key:"checkFields",value:function(e,i,o,n,s,r){var a=t.getType(i[e]),h=s[a];void 0!==h?"array"===t.getType(h)&&h.indexOf(i[e])===-1?(console.log('%cInvalid option detected in "'+e+'". Allowed values are:'+t.print(h)+' not "'+i[e]+'". '+t.printLocation(r,e),v),m=!0):"object"===a&&"__any__"!==n&&(r=f.copyAndExtendArray(r,e),t.parse(i[e],o[n],r)):void 0===s.any&&(console.log('%cInvalid type received for "'+e+'". Expected: '+t.print((0,d.default)(s))+". Received ["+a+'] "'+i[e]+'"'+t.printLocation(r,e),v),m=!0)}},{key:"getType",value:function(t){var e="undefined"==typeof t?"undefined":(0,a.default)(t);return"object"===e?null===t?"null":t instanceof Boolean?"boolean":t instanceof Number?"number":t instanceof String?"string":Array.isArray(t)?"array":t instanceof Date?"date":void 0!==t.nodeType?"dom":t._isAMomentObject===!0?"moment":"object":"number"===e?"number":"boolean"===e?"boolean":"string"===e?"string":void 0===e?"undefined":e}},{key:"getSuggestion",value:function(e,i,o){var n=t.findInOptions(e,i,o,!1),s=t.findInOptions(e,g,[],!0),r=8,a=4;void 0!==n.indexMatch?console.log('%cUnknown option detected: "'+e+'" in '+t.printLocation(n.path,e,"")+'Perhaps it was incomplete? Did you mean: "'+n.indexMatch+'"?\n\n',v):s.distance<=a&&n.distance>s.distance?console.log('%cUnknown option detected: "'+e+'" in '+t.printLocation(n.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+t.printLocation(s.path,s.closestMatch,""),v):n.distance<=r?console.log('%cUnknown option detected: "'+e+'". Did you mean "'+n.closestMatch+'"?'+t.printLocation(n.path,e),v):console.log('%cUnknown option detected: "'+e+'". Did you mean one of these: '+t.print((0,d.default)(i))+t.printLocation(o,e),v),m=!0}},{key:"findInOptions",value:function(e,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,r="",a=[],h=e.toLowerCase(),d=void 0;for(var l in i){var u=void 0;if(void 0!==i[l].__type__&&n===!0){var p=t.findInOptions(e,i[l],f.copyAndExtendArray(o,l));s>p.distance&&(r=p.closestMatch,a=p.path,s=p.distance,d=p.indexMatch)}else l.toLowerCase().indexOf(h)!==-1&&(d=l),u=t.levenshteinDistance(e,l),s>u&&(r=l,a=f.copyArray(o),s=u)}return{closestMatch:r,path:a,distance:s,indexMatch:d}}},{key:"printLocation",value:function(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",o="\n\n"+i+"options = {\n",n=0;n3&&void 0!==arguments[3]?arguments[3]:1;(0,d.default)(this,t),this.parent=e,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},p.extend(this.options,this.defaultOptions),this.configureOptions=o,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new c(n),this.wrapper=void 0}return(0,u.default)(t,[{key:"setOptions",value:function(t){if(void 0!==t){this.popupHistory={},this._removePopup();var e=!0;"string"==typeof t?this.options.filter=t:t instanceof Array?this.options.filter=t.join():"object"===("undefined"==typeof t?"undefined":(0,a.default)(t))?(void 0!==t.container&&(this.options.container=t.container),void 0!==t.filter&&(this.options.filter=t.filter),void 0!==t.showButton&&(this.options.showButton=t.showButton),void 0!==t.enabled&&(e=t.enabled)):"boolean"==typeof t?(this.options.filter=!0,e=t):"function"==typeof t&&(this.options.filter=t,e=!0),this.options.filter===!1&&(e=!1),this.options.enabled=e}this._clean()}},{key:"setModuleOptions",value:function(t){this.moduleOptions=t,this.options.enabled===!0&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){var t=this;this._clean(),this.changedOptions=[];var e=this.options.filter,i=0,o=!1;for(var n in this.configureOptions)this.configureOptions.hasOwnProperty(n)&&(this.allowCreation=!1,o=!1,"function"==typeof e?(o=e(n,[]),o=o||this._handleObject(this.configureOptions[n],[n],!0)):e!==!0&&e.indexOf(n)===-1||(o=!0),o!==!1&&(this.allowCreation=!0,i>0&&this._makeItem([]),this._makeHeader(n),this._handleObject(this.configureOptions[n],[n])),i++);if(this.options.showButton===!0){var s=document.createElement("div");s.className="vis-configuration vis-config-button",s.innerHTML="generate options",s.onclick=function(){t._printOptions()},s.onmouseover=function(){s.className="vis-configuration vis-config-button hover"},s.onmouseout=function(){s.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(s)}this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var t=0;t1?i-1:0),n=1;n2&&void 0!==arguments[2]&&arguments[2],o=document.createElement("div");return o.className="vis-configuration vis-config-label vis-config-s"+e.length,i===!0?o.innerHTML=""+t+":":o.innerHTML=t+":",o}},{key:"_makeDropdown",value:function(t,e,i){var o=document.createElement("select");o.className="vis-configuration vis-config-select";var n=0;void 0!==e&&t.indexOf(e)!==-1&&(n=t.indexOf(e));for(var s=0;ss&&1!==s&&(a.max=Math.ceil(e*l),d=a.max,h="range increased"),a.value=e}else a.value=o;var u=document.createElement("input");u.className="vis-configuration vis-config-rangeinput",u.value=a.value;var p=this;a.onchange=function(){u.value=this.value,p._update(Number(this.value),i)},a.oninput=function(){u.value=this.value};var c=this._makeLabel(i[i.length-1],i),f=this._makeItem(i,c,a,u);""!==h&&this.popupHistory[f]!==d&&(this.popupHistory[f]=d,this._setupPopup(h,f))}},{key:"_setupPopup",value:function(t,e){var i=this;if(this.initialized===!0&&this.allowCreation===!0&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1,n=this.options.filter,s=!1;for(var r in t)if(t.hasOwnProperty(r)){o=!0;var a=t[r],h=p.copyAndExtendArray(e,r);if("function"==typeof n&&(o=n(r,e),o===!1&&!(a instanceof Array)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,o=this._handleObject(a,h,!0),this.allowCreation=i===!1)),o!==!1){s=!0;var d=this._getValue(h);if(a instanceof Array)this._handleArray(a,d,h);else if("string"==typeof a)this._makeTextInput(a,d,h);else if("boolean"==typeof a)this._makeCheckbox(a,d,h);else if(a instanceof Object){var l=!0;if(e.indexOf("physics")!==-1&&this.moduleOptions.physics.solver!==r&&(l=!1),l===!0)if(void 0!==a.enabled){var u=p.copyAndExtendArray(h,"enabled"),c=this._getValue(u);if(c===!0){var f=this._makeLabel(r,h,!0);this._makeItem(h,f),s=this._handleObject(a,h)||s}else this._makeCheckbox(a,c,h)}else{var m=this._makeLabel(r,h,!0);this._makeItem(h,m),s=this._handleObject(a,h)||s}}else console.error("dont know how to handle",a,r,h)}}return s}},{key:"_handleArray",value:function(t,e,i){"string"==typeof t[0]&&"color"===t[0]?(this._makeColorField(t,e,i),t[1]!==e&&this.changedOptions.push({path:i,value:e})):"string"==typeof t[0]?(this._makeDropdown(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:e})):"number"==typeof t[0]&&(this._makeRange(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:Number(e)}))}},{key:"_update",value:function(t,e){var i=this._constructOptions(t,e);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i;t="true"===t||t,t="false"!==t&&t;for(var n=0;nvar options = "+(0,s.default)(t,null,2)+""}},{key:"getOptions",value:function(){for(var t={},e=0;e0&&void 0!==arguments[0]?arguments[0]:1;(0,a.default)(this,t),this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return(0,d.default)(t,[{key:"insertTo",value:function(t){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=t,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=t}},{key:"setCloseCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=t}},{key:"_isColorString",value:function(t){var e={black:"#000000",navy:"#000080",darkblue:"#00008B",mediumblue:"#0000CD",blue:"#0000FF",darkgreen:"#006400",green:"#008000",teal:"#008080",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",lime:"#00FF00",springgreen:"#00FF7F",aqua:"#00FFFF",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",mediumaquamarine:"#66CDAA",dimgray:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",lightslategray:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",maroon:"#800000",purple:"#800080",olive:"#808000",gray:"#808080",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370D8",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",silver:"#C0C0C0",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgrey:"#D3D3D3",palevioletred:"#D87093",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",red:"#FF0000",fuchsia:"#FF00FF",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",yellow:"#FFFF00",lightyellow:"#FFFFE0",ivory:"#FFFFF0",white:"#FFFFFF"};if("string"==typeof t)return e[t]}},{key:"setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==t){var i=void 0,o=this._isColorString(t);if(void 0!==o&&(t=o),p.isString(t)===!0){if(p.isValidRGB(t)===!0){var n=t.substr(4).substr(0,t.length-5).split(",");i={r:n[0],g:n[1],b:n[2],a:1}}else if(p.isValidRGBA(t)===!0){var r=t.substr(5).substr(0,t.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(p.isValidHex(t)===!0){var a=p.hexToRGB(t);i={r:a.r,g:a.g,b:a.b,a:1}}}else if(t instanceof Object&&void 0!==t.r&&void 0!==t.g&&void 0!==t.b){var h=void 0!==t.a?t.a:"1.0";i={r:t.r,g:t.g,b:t.b,a:h}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+(0,s.default)(t));this._setColor(i,e)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e===!0&&(this.previousColor=p.extend({},this.color)),this.applied===!0&&this.updateCallback(this.initialColor),this.frame.style.display="none",setTimeout(function(){void 0!==t.closeCallback&&(t.closeCallback(),t.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e===!0&&(this.initialColor=p.extend({},t)),this.color=t;var i=p.RGBToHSV(t.r,t.g,t.b),o=2*Math.PI,n=this.r*i.s,s=this.centerCoordinates.x+n*Math.sin(o*i.h),r=this.centerCoordinates.y+n*Math.cos(o*i.h);this.colorPickerSelector.style.left=s-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=r-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(t)}},{key:"_setOpacity",value:function(t){this.color.a=t/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(t){var e=p.RGBToHSV(this.color.r,this.color.g,this.color.b);e.v=t/100;var i=p.HSVToRGB(e.h,e.s,e.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,e=p.RGBToHSV(t.r,t.g,t.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var o=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,n),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-e.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),i.fill(),this.brightnessRange.value=100*e.v,this.opacityRange.value=100*t.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var t=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(e)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(t){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(t){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var i=this;this.opacityRange.onchange=function(){i._setOpacity(this.value)},this.opacityRange.oninput=function(){i._setOpacity(this.value)},this.brightnessRange.onchange=function(){i._setBrightness(this.value)},this.brightnessRange.oninput=function(){i._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=this._hide.bind(this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=this._apply.bind(this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=this._save.bind(this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=this._loadLast.bind(this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var t=this;this.drag={},this.pinch={},this.hammer=new l(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),u.onTouch(this.hammer,function(e){t._moveSelector(e)}),this.hammer.on("tap",function(e){t._moveSelector(e)}),this.hammer.on("panstart",function(e){t._moveSelector(e)}),this.hammer.on("panmove",function(e){t._moveSelector(e)}),this.hammer.on("panend",function(e){t._moveSelector(e)})}},{key:"_generateHueCircle",value:function(){if(this.generated===!1){var t=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var e=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,e,i);var o=void 0,n=void 0,s=void 0,r=void 0;this.centerCoordinates={x:.5*e,y:.5*i},this.r=.49*e;var a=2*Math.PI/360,h=1/360,d=1/this.r,l=void 0;for(s=0;s<360;s++)for(r=0;rr?r:t,e=null==e?r:e0&&l.push(u.screenToValue(n)),!c.hidden&&this.itemsData.length>0&&l.push(c.screenToValue(n)),{event:t,what:d,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:o,y:n,time:r,value:l}},o.prototype._createConfigurator=function(){return new v(this,this.dom.container,g)},t.exports=o},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){this.id=a.randomUUID(),this.body=t,this.defaultOptions={yAxisOrientation:"left",defaultGroup:"default",sort:!0,sampling:!0,stack:!1,graphHeight:"400px",shaded:{enabled:!1,orientation:"bottom"},style:"line",barChart:{width:50,sideBySide:!1,align:"center"},interpolation:{enabled:!0,parametrization:"centripetal",alpha:.5},drawPoints:{enabled:!0,size:6,style:"square"},dataAxis:{},legend:{},groups:{visibility:{}}},this.options=a.extend({},this.defaultOptions),this.dom={},this.props={},this.hammer=null,this.groups={},this.abortedGraphUpdate=!1,this.updateSVGheight=!1,this.updateSVGheightOnResize=!1,this.forceGraphUpdate=!0;var i=this;this.itemsData=null,this.groupsData=null,this.itemListeners={add:function(t,e,o){i._onAdd(e.items)},update:function(t,e,o){i._onUpdate(e.items)},remove:function(t,e,o){i._onRemove(e.items)}},this.groupListeners={add:function(t,e,o){i._onAddGroups(e.items)},update:function(t,e,o){i._onUpdateGroups(e.items)},remove:function(t,e,o){i._onRemoveGroups(e.items)}},this.items={},this.selection=[],this.lastStart=this.body.range.start,this.touchParams={},this.svgElements={}, -this.setOptions(e),this.groupsUsingDefaultStyles=[0],this.body.emitter.on("rangechanged",function(){i.lastStart=i.body.range.start,i.svg.style.left=a.option.asSize(-i.props.width),i.forceGraphUpdate=!0,i.redraw.call(i)}),this._create(),this.framework={svg:this.svg,svgElements:this.svgElements,options:this.options,groups:this.groups}}var s=i(62),r=o(s),a=i(1),h=i(87),d=i(88),l=i(92),u=i(100),p=i(131),c=i(133),f=i(137),m=i(134),g=i(136),v=i(135),y="__ungrouped__";n.prototype=new u,n.prototype._create=function(){var t=document.createElement("div");t.className="vis-line-graph",this.dom.frame=t,this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.position="relative",this.svg.style.height=(""+this.options.graphHeight).replace("px","")+"px",this.svg.style.display="block",t.appendChild(this.svg),this.options.dataAxis.orientation="left",this.yAxisLeft=new p(this.body,this.options.dataAxis,this.svg,this.options.groups),this.options.dataAxis.orientation="right",this.yAxisRight=new p(this.body,this.options.dataAxis,this.svg,this.options.groups),delete this.options.dataAxis.orientation,this.legendLeft=new f(this.body,this.options.legend,"left",this.options.groups),this.legendRight=new f(this.body,this.options.legend,"right",this.options.groups),this.show()},n.prototype.setOptions=function(t){if(t){var e=["sampling","defaultGroup","stack","height","graphHeight","yAxisOrientation","style","barChart","dataAxis","sort","groups"];void 0===t.graphHeight&&void 0!==t.height?(this.updateSVGheight=!0,this.updateSVGheightOnResize=!0):void 0!==this.body.domProps.centerContainer.height&&void 0!==t.graphHeight&&parseInt((t.graphHeight+"").replace("px",""))0){var a={};for(this._getRelevantData(r,a,n,s),this._applySampling(r,a),e=0;e0)switch(t.options.style){case"line":l.hasOwnProperty(r[e])||(l[r[e]]=g.calcPath(a[r[e]],t)),g.draw(l[r[e]],t,this.framework);case"point":case"points":"point"!=t.options.style&&"points"!=t.options.style&&1!=t.options.drawPoints.enabled||v.draw(a[r[e]],t,this.framework);break;case"bar":}}}return h.cleanupElements(this.svgElements),!1},n.prototype._stack=function(t,e){var i,o,n,s,r;i=0;for(var a=0;at[a].x){r=e[h],s=0==h?r:e[h-1],i=h;break}}void 0===r&&(s=e[e.length-1],r=e[e.length-1]),o=r.x-s.x,n=r.y-s.y,0==o?t[a].y=t[a].orginalY+r.y:t[a].y=t[a].orginalY+n/o*(t[a].x-s.x)+s.y}},n.prototype._getRelevantData=function(t,e,i,o){var n,s,r,h;if(t.length>0)for(s=0;s0)for(var o=0;o0){var s=1,r=n.length,a=this.body.util.toGlobalScreen(n[n.length-1].x)-this.body.util.toGlobalScreen(n[0].x),h=r/a;s=Math.min(Math.ceil(.2*r),Math.max(1,Math.round(h)));for(var d=new Array(r),l=0;l0){for(s=0;s0&&(n=this.groups[t[s]],r.stack===!0&&"bar"===r.style?"left"===r.yAxisOrientation?a=a.concat(o):h=h.concat(o):i[t[s]]=n.getYRange(o,t[s]));m.getStackedYRange(a,i,t,"__barStackLeft","left"),m.getStackedYRange(h,i,t,"__barStackRight","right")}},n.prototype._updateYAxis=function(t,e){var i,o,n=!1,s=!1,r=!1,a=1e9,h=1e9,d=-1e9,l=-1e9;if(t.length>0){for(var u=0;ui?i:a,d=di?i:h,l=l=0&&t._redrawLabel(o-2,e.val,i,"vis-y-axis vis-major",t.props.majorCharHeight),t.master===!0&&(n?t._redrawLine(o,i,"vis-grid vis-horizontal vis-major",t.options.majorLinesOffset,t.props.majorLineWidth):t._redrawLine(o,i,"vis-grid vis-horizontal vis-minor",t.options.minorLinesOffset,t.props.minorLineWidth))});var a=0;void 0!==this.options[i].title&&void 0!==this.options[i].title.text&&(a=this.props.titleCharHeight);var d=this.options.icons===!0?Math.max(this.options.iconWidth,a)+this.options.labelOffsetX+15:a+this.options.labelOffsetX+15;return this.maxLabelSize>this.width-d&&this.options.visible===!0?(this.width=this.maxLabelSize+d,this.options.width=this.width+"px",h.cleanupElements(this.DOMelements.lines),h.cleanupElements(this.DOMelements.labels),this.redraw(),e=!0):this.maxLabelSizethis.minWidth?(this.width=Math.max(this.minWidth,this.maxLabelSize+d),this.options.width=this.width+"px",h.cleanupElements(this.DOMelements.lines),h.cleanupElements(this.DOMelements.labels),this.redraw(),e=!0):(h.cleanupElements(this.DOMelements.lines),h.cleanupElements(this.DOMelements.labels),e=!1),e},n.prototype.convertValue=function(t){return this.scale.convertValue(t)},n.prototype.screenToValue=function(t){return this.scale.screenToValue(t)},n.prototype._redrawLabel=function(t,e,i,o,n){var s=h.getDOMElement("div",this.DOMelements.labels,this.dom.frame);s.className=o,s.innerHTML=e,"left"===i?(s.style.left="-"+this.options.labelOffsetX+"px",s.style.textAlign="right"):(s.style.right="-"+this.options.labelOffsetX+"px",s.style.textAlign="left"),s.style.top=t-.5*n+this.options.labelOffsetY+"px",e+="";var r=Math.max(this.props.majorCharWidth,this.props.minorCharWidth);this.maxLabelSize6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]&&arguments[7];if(this.majorSteps=[1,2,5,10],this.minorSteps=[.25,.5,1,2],this.customLines=null,this.containerHeight=n,this.majorCharHeight=s,this._start=t,this._end=e,this.scale=1,this.minorStepIdx=-1,this.magnitudefactor=1,this.determineScale(),this.zeroAlign=r,this.autoScaleStart=i,this.autoScaleEnd=o,this.formattingFunction=a,i||o){var h=this,d=function(t){var e=t-t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx]);return t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx])>.5*(h.magnitudefactor*h.minorSteps[h.minorStepIdx])?e+h.magnitudefactor*h.minorSteps[h.minorStepIdx]:e};i&&(this._start-=2*this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._start=d(this._start)),o&&(this._end+=this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._end=d(this._end)),this.determineScale()}}i.prototype.setCharHeight=function(t){this.majorCharHeight=t},i.prototype.setHeight=function(t){this.containerHeight=t},i.prototype.determineScale=function(){var t=this._end-this._start;this.scale=this.containerHeight/t;var e=this.majorCharHeight/this.scale,i=t>0?Math.round(Math.log(t)/Math.LN10):0;this.minorStepIdx=-1,this.magnitudefactor=Math.pow(10,i);var o=0;i<0&&(o=i);for(var n=!1,s=o;Math.abs(s)<=Math.abs(i);s++){this.magnitudefactor=Math.pow(10,s);for(var r=0;r=e){n=!0,this.minorStepIdx=r;break}}if(n===!0)break}},i.prototype.is_major=function(t){return t%(this.magnitudefactor*this.majorSteps[this.minorStepIdx])===0},i.prototype.getStep=function(){return this.magnitudefactor*this.minorSteps[this.minorStepIdx]},i.prototype.getFirstMajor=function(){var t=this.magnitudefactor*this.majorSteps[this.minorStepIdx];return this.convertValue(this._start+(t-this._start%t)%t)},i.prototype.formatValue=function(t){var e=t.toPrecision(5);return"function"==typeof this.formattingFunction&&(e=this.formattingFunction(t)),"number"==typeof e?""+e:"string"==typeof e?e:t.toPrecision(5)},i.prototype.getLines=function(){for(var t=[],e=this.getStep(),i=(e-this._start%e)%e,o=this._start+i;this._end-o>1e-5;o+=e)o!=this._start&&t.push({major:this.is_major(o),y:this.convertValue(o),val:this.formatValue(o)});return t},i.prototype.followScale=function(t){var e=this.minorStepIdx,i=this._start,o=this._end,n=this,s=function(){n.magnitudefactor*=2},r=function(){n.magnitudefactor/=2};t.minorStepIdx<=1&&this.minorStepIdx<=1||t.minorStepIdx>1&&this.minorStepIdx>1||(t.minorStepIdxo+1e-5)r(),d=!1;else{if(!this.autoScaleStart&&this._start=0)){r(),d=!1;continue}console.warn("Can't adhere to given 'min' range, due to zeroalign")}this.autoScaleStart&&this.autoScaleEnd&&ue.x?1:-1})):this.itemsData=[]},n.prototype.getItems=function(){return this.itemsData},n.prototype.setZeroPosition=function(t){this.zeroPosition=t},n.prototype.setOptions=function(t){if(void 0!==t){var e=["sampling","style","sort","yAxisOrientation","barChart","zIndex","excludeFromStacking","excludeFromLegend"];a.selectiveDeepExtend(e,this.options,t),"function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),a.mergeOptions(this.options,t,"interpolation"),a.mergeOptions(this.options,t,"drawPoints"),a.mergeOptions(this.options,t,"shaded"),t.interpolation&&"object"==(0,r.default)(t.interpolation)&&t.interpolation.parametrization&&("uniform"==t.interpolation.parametrization?this.options.interpolation.alpha=0:"chordal"==t.interpolation.parametrization?this.options.interpolation.alpha=1:(this.options.interpolation.parametrization="centripetal",this.options.interpolation.alpha=.5))}},n.prototype.update=function(t){this.group=t,this.content=t.content||"graph",this.className=t.className||this.className||"vis-graph-group"+this.groupsUsingDefaultStyles[0]%10,this.visible=void 0===t.visible||t.visible,this.style=t.style,this.setOptions(t.options)},n.prototype.getLegend=function(t,e,i,o,n){if(void 0==i||null==i){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");i={svg:s,svgElements:{},options:this.options,groups:[this]}}switch(void 0!=o&&null!=o||(o=0),void 0!=n&&null!=n||(n=.5*e),this.options.style){case"line":d.drawIcon(this,o,n,t,e,i);break;case"points":case"point":l.drawIcon(this,o,n,t,e,i);break;case"bar":h.drawIcon(this,o,n,t,e,i)}return{icon:i.svg,label:this.content,orientation:this.options.yAxisOrientation}},n.prototype.getYRange=function(t){for(var e=t[0].y,i=t[0].y,o=0;ot[o].y?t[o].y:e,i=i0&&(i=Math.min(i,Math.abs(e[o-1].screen_x-e[o].screen_x))),0===i&&(void 0===t[e[o].screen_x]&&(t[e[o].screen_x]={amount:0,resolved:0,accumulatedPositive:0,accumulatedNegative:0}),t[e[o].screen_x].amount+=1)},o._getSafeDrawData=function(t,e,i){var o,n;return t0?(o=t0){t.sort(function(t,e){return t.screen_x===e.screen_x?t.groupIde[s].screen_y?e[s].screen_y:o,n=nt[r].accumulatedNegative?t[r].accumulatedNegative:o,o=o>t[r].accumulatedPositive?t[r].accumulatedPositive:o,n=n0){var i=[];return i=1==e.options.interpolation.enabled?o._catmullRom(t,e):o._linear(t)}},o.drawIcon=function(t,e,i,o,s,r){var a,h,d=.5*s,l=n.getSVGElement("rect",r.svgElements,r.svg);if(l.setAttributeNS(null,"x",e),l.setAttributeNS(null,"y",i-d),l.setAttributeNS(null,"width",o),l.setAttributeNS(null,"height",2*d),l.setAttributeNS(null,"class","vis-outline"),a=n.getSVGElement("path",r.svgElements,r.svg),a.setAttributeNS(null,"class",t.className),void 0!==t.style&&a.setAttributeNS(null,"style",t.style),a.setAttributeNS(null,"d","M"+e+","+i+" L"+(e+o)+","+i),1==t.options.shaded.enabled&&(h=n.getSVGElement("path",r.svgElements,r.svg),"top"==t.options.shaded.orientation?h.setAttributeNS(null,"d","M"+e+", "+(i-d)+"L"+e+","+i+" L"+(e+o)+","+i+" L"+(e+o)+","+(i-d)):h.setAttributeNS(null,"d","M"+e+","+i+" L"+e+","+(i+d)+" L"+(e+o)+","+(i+d)+"L"+(e+o)+","+i),h.setAttributeNS(null,"class",t.className+" vis-icon-fill"),void 0!==t.options.shaded.style&&""!==t.options.shaded.style&&h.setAttributeNS(null,"style",t.options.shaded.style)),1==t.options.drawPoints.enabled){var u={style:t.options.drawPoints.style,styles:t.options.drawPoints.styles,size:t.options.drawPoints.size,className:t.className};n.drawPoint(e+.5*o,i,u,r.svgElements,r.svg)}},o.drawShading=function(t,e,i,o){if(1==e.options.shaded.enabled){var s=Number(o.svg.style.height.replace("px","")),r=n.getSVGElement("path",o.svgElements,o.svg),a="L";1==e.options.interpolation.enabled&&(a="C");var h,d=0;d="top"==e.options.shaded.orientation?0:"bottom"==e.options.shaded.orientation?s:Math.min(Math.max(0,e.zeroPosition),s),h="group"==e.options.shaded.orientation&&null!=i&&void 0!=i?"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" L"+i[i.length-1][0]+","+i[i.length-1][1]+" "+this.serializePath(i,a,!0)+i[0][0]+","+i[0][1]+" Z":"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" V"+d+" H"+t[0][0]+" Z",r.setAttributeNS(null,"class",e.className+" vis-fill"),void 0!==e.options.shaded.style&&r.setAttributeNS(null,"style",e.options.shaded.style),r.setAttributeNS(null,"d",h)}},o.draw=function(t,e,i){if(null!=t&&void 0!=t){var o=n.getSVGElement("path",i.svgElements,i.svg);o.setAttributeNS(null,"class",e.className),void 0!==e.style&&o.setAttributeNS(null,"style",e.style);var s="L";1==e.options.interpolation.enabled&&(s="C"),o.setAttributeNS(null,"d","M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,s,!1))}},o.serializePath=function(t,e,i){if(t.length<2)return"";var o=e;if(i)for(var n=t.length-2;n>0;n--)o+=t[n][0]+","+t[n][1]+" ";else for(var n=1;n0&&(f=1/f),m=3*g*(g+v),m>0&&(m=1/m),a={screen_x:(-b*o.screen_x+p*n.screen_x+_*s.screen_x)*f,screen_y:(-b*o.screen_y+p*n.screen_y+_*s.screen_y)*f},h={screen_x:(y*n.screen_x+c*s.screen_x-b*r.screen_x)*m,screen_y:(y*n.screen_y+c*s.screen_y-b*r.screen_y)*m},0==a.screen_x&&0==a.screen_y&&(a=n),0==h.screen_x&&0==h.screen_y&&(h=s),x.push([a.screen_x,a.screen_y]),x.push([h.screen_x,h.screen_y]),x.push([s.screen_x,s.screen_y]);return x},o._linear=function(t){for(var e=[],i=0;i")}this.dom.textArea.innerHTML=s,this.dom.textArea.style.lineHeight=.75*this.options.iconSize+this.options.iconSpacing+"px"}},n.prototype.drawLegendIcons=function(){if(this.dom.frame.parentNode){var t=(0,r.default)(this.groups);t.sort(function(t,e){return t2&&void 0!==arguments[2]&&arguments[2];for(var s in t)void 0!==i[s]&&(null===i[s]||"object"!==(0,p.default)(i[s])?n(t,i,s,o):"object"===(0,p.default)(t[s])&&e.fillIfDefined(t[s],i[s],o))},e.extend=function(t,e){for(var i=1;i3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var r=0;r3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var r in o)if(o.hasOwnProperty(r)&&-1===t.indexOf(r))if(o[r]&&o[r].constructor===Object)void 0===i[r]&&(i[r]={}),i[r].constructor===Object?e.deepExtend(i[r],o[r]):n(i,o,r,s);else if(Array.isArray(o[r])){i[r]=[];for(var a=0;a2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var r in i)if(i.hasOwnProperty(r)||!0===o)if(i[r]&&i[r].constructor===Object)void 0===t[r]&&(t[r]={}),t[r].constructor===Object?e.deepExtend(t[r],i[r],o):n(t,i,r,s);else if(Array.isArray(i[r])){t[r]=[];for(var a=0;a=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,o)):t.attachEvent("on"+e,i)},e.removeEventListener=function(t,e,i,o){t.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,o)):t.detachEvent("on"+e,i)},e.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},e.hasParent=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},e.option={},e.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},e.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},e.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},e.option.asSize=function(t,i){return"function"==typeof t&&(t=t()),e.isString(t)?t:e.isNumber(t)?t+"px":i||null},e.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},e.hexToRGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,i,o){return e+e+i+i+o+o});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},e.overrideOpacity=function(t,i){var o;return-1!=t.indexOf("rgba")?t:-1!=t.indexOf("rgb")?(o=t.substr(t.indexOf("(")+1).replace(")","").split(","),"rgba("+o[0]+","+o[1]+","+o[2]+","+i+")"):(o=e.hexToRGB(t),null==o?t:"rgba("+o.r+","+o.g+","+o.b+","+i+")")},e.RGBToHex=function(t,e,i){return"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},e.parseColor=function(t){var i;if(!0===e.isString(t)){if(!0===e.isValidRGB(t)){var o=t.substr(4).substr(0,t.length-5).split(",").map(function(t){return parseInt(t)});t=e.RGBToHex(o[0],o[1],o[2])}if(!0===e.isValidHex(t)){var n=e.hexToHSV(t),s={h:n.h,s:.8*n.s,v:Math.min(1,1.02*n.v)},r={h:n.h,s:Math.min(1,1.25*n.s),v:.8*n.v},a=e.HSVToHex(r.h,r.s,r.v),h=e.HSVToHex(s.h,s.s,s.v);i={background:t,border:a,highlight:{background:h,border:a},hover:{background:h,border:a}}}else i={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else i={},i.background=t.background||void 0,i.border=t.border||void 0,e.isString(t.highlight)?i.highlight={border:t.highlight,background:t.highlight}:(i.highlight={},i.highlight.background=t.highlight&&t.highlight.background||void 0,i.highlight.border=t.highlight&&t.highlight.border||void 0),e.isString(t.hover)?i.hover={border:t.hover,background:t.hover}:(i.hover={},i.hover.background=t.hover&&t.hover.background||void 0,i.hover.border=t.hover&&t.hover.border||void 0);return i},e.RGBToHSV=function(t,e,i){t/=255,e/=255,i/=255;var o=Math.min(t,Math.min(e,i)),n=Math.max(t,Math.max(e,i));if(o==n)return{h:0,s:0,v:o};var s=t==o?e-i:i==o?t-e:i-t;return{h:60*((t==o?3:i==o?1:5)-s/(n-o))/360,s:(n-o)/n,v:n}};var g={split:function(t){var e={};return t.split(";").forEach(function(t){if(""!=t.trim()){var i=t.split(":"),o=i[0].trim(),n=i[1].trim();e[o]=n}}),e},join:function(t){return(0,l.default)(t).map(function(e){return e+": "+t[e]}).join("; ")}};e.addCssText=function(t,i){var o=g.split(t.style.cssText),n=g.split(i),s=e.extend(o,n);t.style.cssText=g.join(s)},e.removeCssText=function(t,e){var i=g.split(t.style.cssText),o=g.split(e);for(var n in o)o.hasOwnProperty(n)&&delete i[n];t.style.cssText=g.join(i)},e.HSVToRGB=function(t,e,i){var o,n,s,r=Math.floor(6*t),a=6*t-r,h=i*(1-e),d=i*(1-a*e),l=i*(1-(1-a)*e);switch(r%6){case 0:o=i,n=l,s=h;break;case 1:o=d,n=i,s=h;break;case 2:o=h,n=i,s=l;break;case 3:o=h,n=d,s=i;break;case 4:o=l,n=h,s=i;break;case 5:o=i,n=h,s=d}return{r:Math.floor(255*o),g:Math.floor(255*n),b:Math.floor(255*s)}},e.HSVToHex=function(t,i,o){var n=e.HSVToRGB(t,i,o);return e.RGBToHex(n.r,n.g,n.b)},e.hexToHSV=function(t){var i=e.hexToRGB(t);return e.RGBToHSV(i.r,i.g,i.b)},e.isValidHex=function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},e.isValidRGB=function(t){return t=t.replace(" ",""),/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t)},e.isValidRGBA=function(t){return t=t.replace(" ",""),/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(t)},e.selectiveBridgeObject=function(t,i){if(null!==i&&"object"===(void 0===i?"undefined":(0,p.default)(i))){for(var o=(0,h.default)(i),n=0;n0&&e(o,t[n-1])<0;n--)t[n]=t[n-1];t[n]=o}return t},e.mergeOptions=function(t,e,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=function(t){return null!==t&&void 0!==t},s=function(t){return null!==t&&"object"===(void 0===t?"undefined":(0,p.default)(t))};if(!s(t))throw new Error("Parameter mergeTarget must be an object");if(!s(e))throw new Error("Parameter options must be an object");if(!n(i))throw new Error("Parameter option must have a value");if(!s(o))throw new Error("Parameter globalOptions must be an object");var r=e[i],a=s(o)&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(o),d=a?o[i]:void 0,l=d?d.enabled:void 0;if(void 0!==r){if("boolean"==typeof r)return s(t[i])||(t[i]={}),void(t[i].enabled=r);if(null===r&&!s(t[i])){if(!n(d))return;t[i]=(0,h.default)(d)}if(s(r)){var u=!0;void 0!==r.enabled?u=r.enabled:void 0!==l&&(u=d.enabled),function(t,e,i){s(t[i])||(t[i]={});var o=e[i],n=t[i];for(var r in o)o.hasOwnProperty(r)&&(n[r]=o[r])}(t,e,i),t[i].enabled=u}}},e.binarySearchCustom=function(t,e,i,o){for(var n=0,s=0,r=t.length-1;s<=r&&n<1e4;){var a=Math.floor((s+r)/2),h=t[a],d=void 0===o?h[i]:h[i][o],l=e(d);if(0==l)return a;-1==l?s=a+1:r=a-1,n++}return-1},e.binarySearchValue=function(t,e,i,o,n){var s,r,a,h,d=0,l=0,u=t.length-1;for(n=void 0!=n?n:function(t,e){return t==e?0:t0)return"before"==o?Math.max(0,h-1):h;if(n(r,e)<0&&n(a,e)>0)return"before"==o?h:Math.min(t.length-1,h+1);n(r,e)<0?l=h+1:u=h-1,d++}return-1},e.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},e.getScrollBarWidth=function(){var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var i=t.offsetWidth;e.style.overflow="scroll";var o=t.offsetWidth;return i==o&&(o=e.clientWidth),document.body.removeChild(e),i-o},e.topMost=function(t,e){var i=void 0;Array.isArray(e)||(e=[e]);var o=!0,n=!1,s=void 0;try{for(var a,h=(0,r.default)(t);!(o=(a=h.next()).done);o=!0){var d=a.value;if(d){i=d[e[0]];for(var l=1;l0?(o=e[t].redundant[0],e[t].redundant.shift()):(o=document.createElementNS("http://www.w3.org/2000/svg",t),i.appendChild(o)):(o=document.createElementNS("http://www.w3.org/2000/svg",t),e[t]={used:[],redundant:[]},i.appendChild(o)),e[t].used.push(o),o},e.getDOMElement=function(t,e,i,o){var n;return e.hasOwnProperty(t)?e[t].redundant.length>0?(n=e[t].redundant[0],e[t].redundant.shift()):(n=document.createElement(t),void 0!==o?i.insertBefore(n,o):i.appendChild(n)):(n=document.createElement(t),e[t]={used:[],redundant:[]},void 0!==o?i.insertBefore(n,o):i.appendChild(n)),e[t].used.push(n),n},e.drawPoint=function(t,i,o,n,s,r){var a;if("circle"==o.style?(a=e.getSVGElement("circle",n,s),a.setAttributeNS(null,"cx",t),a.setAttributeNS(null,"cy",i),a.setAttributeNS(null,"r",.5*o.size)):(a=e.getSVGElement("rect",n,s),a.setAttributeNS(null,"x",t-.5*o.size),a.setAttributeNS(null,"y",i-.5*o.size),a.setAttributeNS(null,"width",o.size),a.setAttributeNS(null,"height",o.size)),void 0!==o.styles&&a.setAttributeNS(null,"style",o.styles),a.setAttributeNS(null,"class",o.className+" vis-point"),r){var h=e.getSVGElement("text",n,s);r.xOffset&&(t+=r.xOffset),r.yOffset&&(i+=r.yOffset),r.content&&(h.textContent=r.content),r.className&&h.setAttributeNS(null,"class",r.className+" vis-label"),h.setAttributeNS(null,"x",t),h.setAttributeNS(null,"y",i)}return a},e.drawBar=function(t,i,o,n,s,r,a,h){if(0!=n){n<0&&(n*=-1,i-=n);var d=e.getSVGElement("rect",r,a);d.setAttributeNS(null,"x",t-.5*o),d.setAttributeNS(null,"y",i),d.setAttributeNS(null,"width",o),d.setAttributeNS(null,"height",n),d.setAttributeNS(null,"class",s),h&&d.setAttributeNS(null,"style",h)}}},function(t,e,i){function o(){var t=function(){};return{on:t,off:t,destroy:t,emit:t,get:function(e){return{set:t}}}}if("undefined"!=typeof window){var n=i(130),s=window.Hammer||i(131);t.exports=n(s,{preventDefault:"mouse"})}else t.exports=function(){return o()}},function(t,e,i){var o=i(91),n=i(34);t.exports=function(t){return o(n(t))}},function(t,e,i){var o=i(8),n=i(25);t.exports=i(9)?function(t,e,i){return o.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){if(t&&!Array.isArray(t)&&(e=t,t=null),this._options=e||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i=(0,l.default)(this._options.type),o=0,n=i.length;on?1:or)&&(s=h,r=d)}return s},n.prototype.min=function(t){var e,i,o=this._data,n=(0,l.default)(o),s=null,r=null;for(e=0,i=n.length;e=4*a){var p=0,c=s.clone();switch(o[h].repeat){case"daily":d.day()!=l.day()&&(p=1),d.dayOfYear(n.dayOfYear()),d.year(n.year()),d.subtract(7,"days"),l.dayOfYear(n.dayOfYear()),l.year(n.year()),l.subtract(7-p,"days"),c.add(1,"weeks");break;case"weekly":var m=l.diff(d,"days"),f=d.day();d.date(n.date()),d.month(n.month()),d.year(n.year()),l=d.clone(),d.day(f),l.day(f),l.add(m,"days"),d.subtract(1,"weeks"),l.subtract(1,"weeks"),c.add(1,"weeks");break;case"monthly":d.month()!=l.month()&&(p=1),d.month(n.month()),d.year(n.year()),d.subtract(1,"months"),l.month(n.month()),l.year(n.year()),l.subtract(1,"months"),l.add(p,"months"),c.add(1,"months");break;case"yearly":d.year()!=l.year()&&(p=1),d.year(n.year()),d.subtract(1,"years"),l.year(n.year()),l.subtract(1,"years"),l.add(p,"years"),c.add(1,"years");break;default:return void console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:",o[h].repeat)}for(;d=e[o].start&&e[n].end<=e[o].end?e[n].remove=!0:e[n].start>=e[o].start&&e[n].start<=e[o].end?(e[o].end=e[n].end,e[n].remove=!0):e[n].end>=e[o].start&&e[n].end<=e[o].end&&(e[o].start=e[n].start,e[n].remove=!0));for(o=0;o=r&&nt.range.end){var h={start:t.range.start,end:i};return i=e.correctTimeForHidden(t.options.moment,t.body.hiddenDates,h,i),n=t.range.conversion(o,r),(i.valueOf()-n.offset)*n.scale}return i=e.correctTimeForHidden(t.options.moment,t.body.hiddenDates,t.range,i),n=t.range.conversion(o,r),(i.valueOf()-n.offset)*n.scale},e.toTime=function(t,i,o){if(0==t.body.hiddenDates.length){var n=t.range.conversion(o);return new Date(i/n.scale+n.offset)}var s=e.getHiddenDurationBetween(t.body.hiddenDates,t.range.start,t.range.end),r=t.range.end-t.range.start-s,a=r*i/o,h=e.getAccumulatedHiddenDuration(t.body.hiddenDates,t.range,a);return new Date(h+a+t.range.start)},e.getHiddenDurationBetween=function(t,e,i){for(var o=0,n=0;n=e&&r=e&&r<=i&&(o+=r-s)}return o},e.correctTimeForHidden=function(t,i,o,n){return n=t(n).toDate().valueOf(),n-=e.getHiddenDurationBefore(t,i,o,n)},e.getHiddenDurationBefore=function(t,e,i,o){var n=0;o=t(o).toDate().valueOf();for(var s=0;s=i.start&&a=a&&(n+=a-r)}return n},e.getAccumulatedHiddenDuration=function(t,e,i){for(var o=0,n=0,s=e.start,r=0;r=e.start&&h=i)break;o+=h-a}}return o},e.snapAwayFromHidden=function(t,i,o,n){var s=e.isHidden(i,t);return 1==s.hidden?o<0?1==n?s.startDate-(s.endDate-i)-1:s.startDate-1:1==n?s.endDate+(i-s.startDate)+1:s.endDate+1:i},e.isHidden=function(t,e){for(var i=0;i=o&&t0){var e=[];if(Array.isArray(this.options.dataAttributes))e=this.options.dataAttributes;else{if("all"!=this.options.dataAttributes)return;e=(0,h.default)(this.data)}for(var i=0;i=.4*g}if(this.options.showMinorLabels&&f){var D=this._repaintMinorText(p,y,t,b);D.style.width=_+"px"}m&&this.options.showMajorLabels?(p>0&&(void 0==w&&(w=p),D=this._repaintMajorText(p,s.getLabelMajor(),t,b)),v=this._repaintMajorLine(p,_,t,b)):f?v=this._repaintMinorLine(p,_,t,b):v&&(v.style.width=parseInt(v.style.width)+_+"px")}if(1e3!==x||u||(console.warn("Something is wrong with the Timeline scale. Limited drawing of grid lines to 1000 lines."),u=!0),this.options.showMajorLabels){var S=this.body.util.toTime(0),k=s.getLabelMajor(S),C=k.length*(this.props.majorCharWidth||10)+10;(void 0==w||Cs.distance?" in "+t.printLocation(n.path,e,"")+"Perhaps it was misplaced? Matching option found at: "+t.printLocation(s.path,s.closestMatch,""):n.distance<=8?'. Did you mean "'+n.closestMatch+'"?'+t.printLocation(n.path,e):". Did you mean one of these: "+t.print((0,d.default)(i))+t.printLocation(o,e),console.log('%cUnknown option detected: "'+e+'"'+r,v),f=!0}},{key:"findInOptions",value:function(e,i,o){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=1e9,r="",a=[],h=e.toLowerCase(),d=void 0;for(var l in i){var u=void 0;if(void 0!==i[l].__type__&&!0===n){var p=t.findInOptions(e,i[l],m.copyAndExtendArray(o,l));s>p.distance&&(r=p.closestMatch,a=p.path,s=p.distance,d=p.indexMatch)}else-1!==l.toLowerCase().indexOf(h)&&(d=l),u=t.levenshteinDistance(e,l),s>u&&(r=l,a=m.copyArray(o),s=u)}return{closestMatch:r,path:a,distance:s,indexMatch:d}}},{key:"printLocation",value:function(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Problem value found at: \n",o="\n\n"+i+"options = {\n",n=0;ndocument.F=Object<\/script>"),t.close(),h=t.F;o--;)delete h.prototype[s[o]];return h()};t.exports=Object.create||function(t,e){var i;return null!==t?(a.prototype=o(t),i=new a,a.prototype=null,i[r]=t):i=h(),void 0===e?i:n(i,e)}},function(t,e){var i=Math.ceil,o=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?o:i)(t)}},function(t,e,i){var o=i(40)("keys"),n=i(27);t.exports=function(t){return o[t]||(o[t]=n(t))}},function(t,e,i){var o=i(6),n=o["__core-js_shared__"]||(o["__core-js_shared__"]={});t.exports=function(t){return n[t]||(n[t]={})}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){var o=i(8).f,n=i(10),s=i(7)("toStringTag");t.exports=function(t,e,i){t&&!n(t=i?t:t.prototype,s)&&o(t,s,{configurable:!0,value:e})}},function(t,e,i){t.exports={default:i(105),__esModule:!0}},function(t,e,i){e.f=i(7)},function(t,e,i){var o=i(6),n=i(2),s=i(35),r=i(44),a=i(8).f;t.exports=function(t){var e=n.Symbol||(n.Symbol=s?{}:o.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:r.f(t)})}},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(t,e){var i=c().hours(0).minutes(0).seconds(0).milliseconds(0),o=i.clone().add(-3,"days").valueOf(),n=i.clone().add(3,"days").valueOf();this.millisecondsPerPixelCache=void 0,void 0===e?(this.start=o,this.end=n):(this.start=e.start||o,this.end=e.end||n),this.rolling=!1,this.body=t,this.deltaDifference=0,this.scaleOffset=0,this.startToFront=!1,this.endToFront=!0,this.defaultOptions={rtl:!1,start:null,end:null,moment:c,direction:"horizontal",moveable:!0,zoomable:!0,min:null,max:null,zoomMin:10,zoomMax:31536e10,rollingMode:{follow:!1,offset:.5}},this.options=p.extend({},this.defaultOptions),this.props={touch:{}},this.animationTimer=null,this.body.emitter.on("panstart",this._onDragStart.bind(this)),this.body.emitter.on("panmove",this._onDrag.bind(this)),this.body.emitter.on("panend",this._onDragEnd.bind(this)),this.body.emitter.on("mousewheel",this._onMouseWheel.bind(this)),this.body.emitter.on("touch",this._onTouch.bind(this)),this.body.emitter.on("pinch",this._onPinch.bind(this)),this.body.dom.rollingModeBtn.addEventListener("click",this.startRolling.bind(this)),this.setOptions(e)}function s(t){if("horizontal"!=t&&"vertical"!=t)throw new TypeError('Unknown direction "'+t+'". Choose "horizontal" or "vertical".')}var r=i(4),a=o(r),h=i(16),d=o(h),l=i(1),u=o(l),p=i(0),c=i(3),m=i(5),f=i(21);n.prototype=new m,n.prototype.setOptions=function(t){if(t){var e=["animation","direction","min","max","zoomMin","zoomMax","moveable","zoomable","moment","activate","hiddenDates","zoomKey","rtl","showCurrentTime","rollingMode","horizontalScroll"];p.selectiveExtend(e,this.options,t),t.rollingMode&&t.rollingMode.follow&&this.startRolling(),("start"in t||"end"in t)&&this.setRange(t.start,t.end)}},n.prototype.startRolling=function(){function t(){e.stopRolling(),e.rolling=!0;var i=e.end-e.start,o=p.convert(new Date,"Date").valueOf(),n=o-i*e.options.rollingMode.offset,s=o+i*(1-e.options.rollingMode.offset),r={animation:!1};e.setRange(n,s,r),i=1/e.conversion(e.body.domProps.center.width).scale/10,i<30&&(i=30),i>1e3&&(i=1e3),e.body.dom.rollingModeBtn.style.visibility="hidden",e.currentTimeTimer=setTimeout(t,i)}var e=this;t()},n.prototype.stopRolling=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),this.rolling=!1,this.body.dom.rollingModeBtn.style.visibility="visible")},n.prototype.setRange=function(t,e,i,o,n){i||(i={}),!0!==i.byUser&&(i.byUser=!1);var s=this,r=void 0!=t?p.convert(t,"Date").valueOf():null,h=void 0!=e?p.convert(e,"Date").valueOf():null;if(this._cancelAnimation(),this.millisecondsPerPixelCache=void 0,i.animation){var l=this.start,c=this.end,m="object"===(0,u.default)(i.animation)&&"duration"in i.animation?i.animation.duration:500,g="object"===(0,u.default)(i.animation)&&"easingFunction"in i.animation?i.animation.easingFunction:"easeInOutQuad",v=p.easingFunctions[g];if(!v)throw new Error("Unknown easing function "+(0,d.default)(g)+". Choose from: "+(0,a.default)(p.easingFunctions).join(", "));var y=(new Date).valueOf(),b=!1;return function t(){if(!s.props.touch.dragging){var e=(new Date).valueOf(),a=e-y,d=v(a/m),u=a>m,p=u||null===r?r:l+(r-l)*d,g=u||null===h?h:c+(h-c)*d;_=s._applyRange(p,g),f.updateHiddenDates(s.options.moment,s.body,s.options.hiddenDates),b=b||_;var w={start:new Date(s.start),end:new Date(s.end),byUser:i.byUser,event:i.event};if(n&&n(d,_,u),_&&s.body.emitter.emit("rangechange",w),u){if(b&&(s.body.emitter.emit("rangechanged",w),o))return o()}else s.animationTimer=setTimeout(t,20)}}()}var _=this._applyRange(r,h);if(f.updateHiddenDates(this.options.moment,this.body,this.options.hiddenDates),_){var w={start:new Date(this.start),end:new Date(this.end),byUser:i.byUser,event:i.event};if(this.body.emitter.emit("rangechange",w),clearTimeout(s.timeoutID),s.timeoutID=setTimeout(function(){s.body.emitter.emit("rangechanged",w)},200),o)return o()}},n.prototype.getMillisecondsPerPixel=function(){return void 0===this.millisecondsPerPixelCache&&(this.millisecondsPerPixelCache=(this.end-this.start)/this.body.dom.center.clientWidth),this.millisecondsPerPixelCache},n.prototype._cancelAnimation=function(){this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=null)},n.prototype._applyRange=function(t,e){var i,o=null!=t?p.convert(t,"Date").valueOf():this.start,n=null!=e?p.convert(e,"Date").valueOf():this.end,s=null!=this.options.max?p.convert(this.options.max,"Date").valueOf():null,r=null!=this.options.min?p.convert(this.options.min,"Date").valueOf():null;if(isNaN(o)||null===o)throw new Error('Invalid start "'+t+'"');if(isNaN(n)||null===n)throw new Error('Invalid end "'+e+'"');if(ns&&(n=s)),null!==s&&n>s&&(i=n-s,o-=i,n-=i,null!=r&&o=this.start-.5&&n<=this.end?(o=this.start,n=this.end):(i=a-(n-o),o-=i/2,n+=i/2)}}if(null!==this.options.zoomMax){var h=parseFloat(this.options.zoomMax);h<0&&(h=0),n-o>h&&(this.end-this.start===h&&othis.end?(o=this.start,n=this.end):(i=n-o-h,o+=i/2,n-=i/2))}var d=this.start!=o||this.end!=n;return o>=this.start&&o<=this.end||n>=this.start&&n<=this.end||this.start>=o&&this.start<=n||this.end>=o&&this.end<=n||this.body.emitter.emit("checkRangedItems"),this.start=o,this.end=n,d},n.prototype.getRange=function(){return{start:this.start,end:this.end}},n.prototype.conversion=function(t,e){return n.conversion(this.start,this.end,t,e)},n.conversion=function(t,e,i,o){return void 0===o&&(o=0),0!=i&&e-t!=0?{offset:t,scale:i/(e-t-o)}:{offset:0,scale:1}},n.prototype._onDragStart=function(t){this.deltaDifference=0,this.previousDelta=0,this.options.moveable&&this._isInsideRange(t)&&this.props.touch.allowDragging&&(this.stopRolling(),this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.dragging=!0,this.body.dom.root&&(this.body.dom.root.style.cursor="move"))},n.prototype._onDrag=function(t){if(t&&this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging){var e=this.options.direction;s(e);var i="horizontal"==e?t.deltaX:t.deltaY;i-=this.deltaDifference;var o=this.props.touch.end-this.props.touch.start;o-=f.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end);var n,r="horizontal"==e?this.body.domProps.center.width:this.body.domProps.center.height;n=this.options.rtl?i/r*o:-i/r*o;var a=this.props.touch.start+n,h=this.props.touch.end+n,d=f.snapAwayFromHidden(this.body.hiddenDates,a,this.previousDelta-i,!0),l=f.snapAwayFromHidden(this.body.hiddenDates,h,this.previousDelta-i,!0);if(d!=a||l!=h)return this.deltaDifference+=i,this.props.touch.start=d,this.props.touch.end=l,void this._onDrag(t);this.previousDelta=i,this._applyRange(a,h);var u=new Date(this.start),p=new Date(this.end);this.body.emitter.emit("rangechange",{start:u,end:p,byUser:!0,event:t}),this.body.emitter.emit("panmove")}},n.prototype._onDragEnd=function(t){this.props.touch.dragging&&this.options.moveable&&this.props.touch.allowDragging&&(this.props.touch.dragging=!1,this.body.dom.root&&(this.body.dom.root.style.cursor="auto"),this.body.emitter.emit("rangechanged",{start:new Date(this.start),end:new Date(this.end),byUser:!0,event:t}))},n.prototype._onMouseWheel=function(t){var e=0;if(t.wheelDelta?e=t.wheelDelta/120:t.detail&&(e=-t.detail/3),!(this.options.zoomKey&&!t[this.options.zoomKey]&&this.options.zoomable||!this.options.zoomable&&this.options.moveable)&&this.options.zoomable&&this.options.moveable&&this._isInsideRange(t)&&e){var i;i=e<0?1-e/5:1/(1+e/5);var o;if(this.rolling)o=this.start+(this.end-this.start)*this.options.rollingMode.offset;else{var n=this.getPointer({x:t.clientX,y:t.clientY},this.body.dom.center);o=this._pointerToDate(n)}this.zoom(i,o,e,t),t.preventDefault()}},n.prototype._onTouch=function(t){this.props.touch.start=this.start,this.props.touch.end=this.end,this.props.touch.allowDragging=!0,this.props.touch.center=null,this.scaleOffset=0,this.deltaDifference=0,p.preventDefault(t)},n.prototype._onPinch=function(t){if(this.options.zoomable&&this.options.moveable){p.preventDefault(t),this.props.touch.allowDragging=!1,this.props.touch.center||(this.props.touch.center=this.getPointer(t.center,this.body.dom.center)),this.stopRolling();var e=1/(t.scale+this.scaleOffset),i=this._pointerToDate(this.props.touch.center),o=f.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end),n=f.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this,i),s=o-n,r=i-n+(this.props.touch.start-(i-n))*e,a=i+s+(this.props.touch.end-(i+s))*e;this.startToFront=1-e<=0,this.endToFront=e-1<=0;var h=f.snapAwayFromHidden(this.body.hiddenDates,r,1-e,!0),d=f.snapAwayFromHidden(this.body.hiddenDates,a,e-1,!0);h==r&&d==a||(this.props.touch.start=h,this.props.touch.end=d,this.scaleOffset=1-t.scale,r=h,a=d);var l={animation:!1,byUser:!0,event:t};this.setRange(r,a,l),this.startToFront=!1,this.endToFront=!0}},n.prototype._isInsideRange=function(t){var e,i=t.center?t.center.x:t.clientX;e=this.options.rtl?i-p.getAbsoluteLeft(this.body.dom.centerContainer):p.getAbsoluteRight(this.body.dom.centerContainer)-i;var o=this.body.util.toTime(e);return o>=this.start&&o<=this.end},n.prototype._pointerToDate=function(t){var e,i=this.options.direction;if(s(i),"horizontal"==i)return this.body.util.toTime(t.x).valueOf();var o=this.body.domProps.center.height;return e=this.conversion(o),t.y/e.scale+e.offset},n.prototype.getPointer=function(t,e){return this.options.rtl?{x:p.getAbsoluteRight(e)-t.x,y:t.y-p.getAbsoluteTop(e)}:{x:t.x-p.getAbsoluteLeft(e),y:t.y-p.getAbsoluteTop(e)}},n.prototype.zoom=function(t,e,i,o){null==e&&(e=(this.start+this.end)/2);var n=f.getHiddenDurationBetween(this.body.hiddenDates,this.start,this.end),s=f.getHiddenDurationBefore(this.options.moment,this.body.hiddenDates,this,e),r=n-s,a=e-s+(this.start-(e-s))*t,h=e+r+(this.end-(e+r))*t;this.startToFront=!(i>0),this.endToFront=!(-i>0);var d=f.snapAwayFromHidden(this.body.hiddenDates,a,i,!0),l=f.snapAwayFromHidden(this.body.hiddenDates,h,-i,!0);d==a&&l==h||(a=d,h=l);var u={animation:!1,byUser:!0,event:o};this.setRange(a,h,u),this.startToFront=!1,this.endToFront=!0},n.prototype.move=function(t){var e=this.end-this.start,i=this.start+e*t,o=this.end+e*t;this.start=i,this.end=o},n.prototype.moveTo=function(t){var e=(this.start+this.end)/2,i=e-t,o=this.start-i,n=this.end-i,s={animation:!1,byUser:!0,event:null};this.setRange(o,n,s)},t.exports=n},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}function n(){}var s=i(16),r=o(s),a=i(1),h=o(a),d=i(66),l=i(12),u=i(67),p=i(0),c=i(28),m=i(132),f=i(21),g=i(29);d(n.prototype),n.prototype._create=function(t){function e(t){this.isActive()&&this.emit("mousewheel",t);var e=0,i=0;if("detail"in t&&(i=-1*t.detail),"wheelDelta"in t&&(i=t.wheelDelta),"wheelDeltaY"in t&&(i=t.wheelDeltaY),"wheelDeltaX"in t&&(e=-1*t.wheelDeltaX),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=-1*i,i=0),"deltaY"in t&&(i=-1*t.deltaY),"deltaX"in t&&(e=t.deltaX),this.options.zoomKey&&!t[this.options.zoomKey])if(t.preventDefault(),this.options.verticalScroll&&Math.abs(i)>=Math.abs(e)){var o=this.props.scrollTop,n=o+i;this.isActive()&&(this._setScrollTop(n),this._redraw(),this.emit("scroll",t))}else if(this.options.horizontalScroll){var s=Math.abs(e)>=Math.abs(i)?e:i,r=s/120*(this.range.end-this.range.start)/20,a=this.range.start+r,h=this.range.end+r,d={animation:!1,byUser:!0,event:t};this.range.setRange(a,h,d)}}function i(t){if(s.options.verticalScroll&&(t.preventDefault(),s.isActive())){var e=-t.target.scrollTop;s._setScrollTop(e),s._redraw(),s.emit("scrollSide",t)}}function o(t){if(t.preventDefault&&t.preventDefault(),!(!t.target.className.indexOf("vis")>-1||a))return t.dataTransfer.dropEffect="move",a=!0,!1}function n(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation();try{var e=JSON.parse(t.dataTransfer.getData("text"));if(!e||!e.content)return}catch(t){return!1}return a=!1,t.center={x:t.clientX,y:t.clientY},"item"!==e.target?s.itemSet._onAddItem(t):s.itemSet._onDropObjectOnItem(t),s.emit("drop",s.getEventProperties(t)),!1}this.dom={},this.dom.container=t,this.dom.root=document.createElement("div"),this.dom.background=document.createElement("div"),this.dom.backgroundVertical=document.createElement("div"),this.dom.backgroundHorizontal=document.createElement("div"),this.dom.centerContainer=document.createElement("div"),this.dom.leftContainer=document.createElement("div"),this.dom.rightContainer=document.createElement("div"),this.dom.center=document.createElement("div"),this.dom.left=document.createElement("div"),this.dom.right=document.createElement("div"),this.dom.top=document.createElement("div"),this.dom.bottom=document.createElement("div"),this.dom.shadowTop=document.createElement("div"),this.dom.shadowBottom=document.createElement("div"),this.dom.shadowTopLeft=document.createElement("div"),this.dom.shadowBottomLeft=document.createElement("div"),this.dom.shadowTopRight=document.createElement("div"),this.dom.shadowBottomRight=document.createElement("div"),this.dom.rollingModeBtn=document.createElement("div"),this.dom.root.className="vis-timeline",this.dom.background.className="vis-panel vis-background",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical",this.dom.backgroundHorizontal.className="vis-panel vis-background vis-horizontal",this.dom.centerContainer.className="vis-panel vis-center",this.dom.leftContainer.className="vis-panel vis-left",this.dom.rightContainer.className="vis-panel vis-right",this.dom.top.className="vis-panel vis-top",this.dom.bottom.className="vis-panel vis-bottom",this.dom.left.className="vis-content",this.dom.center.className="vis-content",this.dom.right.className="vis-content",this.dom.shadowTop.className="vis-shadow vis-top",this.dom.shadowBottom.className="vis-shadow vis-bottom",this.dom.shadowTopLeft.className="vis-shadow vis-top",this.dom.shadowBottomLeft.className="vis-shadow vis-bottom",this.dom.shadowTopRight.className="vis-shadow vis-top",this.dom.shadowBottomRight.className="vis-shadow vis-bottom",this.dom.rollingModeBtn.className="vis-rolling-mode-btn",this.dom.root.appendChild(this.dom.background),this.dom.root.appendChild(this.dom.backgroundVertical),this.dom.root.appendChild(this.dom.backgroundHorizontal),this.dom.root.appendChild(this.dom.centerContainer),this.dom.root.appendChild(this.dom.leftContainer),this.dom.root.appendChild(this.dom.rightContainer),this.dom.root.appendChild(this.dom.top),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.bottom),this.dom.root.appendChild(this.dom.rollingModeBtn),this.dom.centerContainer.appendChild(this.dom.center),this.dom.leftContainer.appendChild(this.dom.left),this.dom.rightContainer.appendChild(this.dom.right),this.dom.centerContainer.appendChild(this.dom.shadowTop),this.dom.centerContainer.appendChild(this.dom.shadowBottom),this.dom.leftContainer.appendChild(this.dom.shadowTopLeft),this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft),this.dom.rightContainer.appendChild(this.dom.shadowTopRight),this.dom.rightContainer.appendChild(this.dom.shadowBottomRight),this.props={root:{},background:{},centerContainer:{},leftContainer:{},rightContainer:{},center:{},left:{},right:{},top:{},bottom:{},border:{},scrollTop:0,scrollTopMin:0},this.on("rangechange",function(){!0===this.initialDrawDone&&this._redraw()}.bind(this)),this.on("rangechanged",function(){this.initialRangeChangeDone||(this.initialRangeChangeDone=!0)}.bind(this)),this.on("touch",this._onTouch.bind(this)),this.on("panmove",this._onDrag.bind(this));var s=this;this._origRedraw=this._redraw.bind(this),this._redraw=p.throttle(this._origRedraw),this.on("_change",function(t){s.itemSet&&s.itemSet.initialItemSetDrawn&&t&&1==t.queue?s._redraw():s._origRedraw()}),this.hammer=new l(this.dom.root);var r=this.hammer.get("pinch").set({enable:!0});u.disablePreventDefaultVertically(r),this.hammer.get("pan").set({threshold:5,direction:l.DIRECTION_HORIZONTAL}),this.listeners={},["tap","doubletap","press","pinch","pan","panstart","panmove","panend"].forEach(function(t){var e=function(e){s.isActive()&&s.emit(t,e)};s.hammer.on(t,e),s.listeners[t]=e}),u.onTouch(this.hammer,function(t){s.emit("touch",t)}.bind(this)),u.onRelease(this.hammer,function(t){s.emit("release",t)}.bind(this)),this.dom.centerContainer.addEventListener?(this.dom.centerContainer.addEventListener("mousewheel",e.bind(this),!1),this.dom.centerContainer.addEventListener("DOMMouseScroll",e.bind(this),!1)):this.dom.centerContainer.attachEvent("onmousewheel",e.bind(this)),this.dom.left.parentNode.addEventListener("scroll",i.bind(this)),this.dom.right.parentNode.addEventListener("scroll",i.bind(this));var a=!1;if(this.dom.center.addEventListener("dragover",o.bind(this),!1),this.dom.center.addEventListener("drop",n.bind(this),!1),this.customTimes=[],this.touch={},this.redrawCount=0,this.initialDrawDone=!1,this.initialRangeChangeDone=!1,!t)throw new Error("No container provided");t.appendChild(this.dom.root)},n.prototype.setOptions=function(t){if(t){var e=["width","height","minHeight","maxHeight","autoResize","start","end","clickToUse","dataAttributes","hiddenDates","locale","locales","moment","rtl","zoomKey","horizontalScroll","verticalScroll"];if(p.selectiveExtend(e,this.options,t),this.dom.rollingModeBtn.style.visibility="hidden",this.options.rtl&&(this.dom.container.style.direction="rtl",this.dom.backgroundVertical.className="vis-panel vis-background vis-vertical-rtl"),this.options.verticalScroll&&(this.options.rtl?this.dom.rightContainer.className="vis-panel vis-right vis-vertical-scroll":this.dom.leftContainer.className="vis-panel vis-left vis-vertical-scroll"),"object"!==(0,h.default)(this.options.orientation)&&(this.options.orientation={item:void 0,axis:void 0}),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation={item:t.orientation,axis:t.orientation}:"object"===(0,h.default)(t.orientation)&&("item"in t.orientation&&(this.options.orientation.item=t.orientation.item),"axis"in t.orientation&&(this.options.orientation.axis=t.orientation.axis))),"both"===this.options.orientation.axis){if(!this.timeAxis2){var i=this.timeAxis2=new c(this.body);i.setOptions=function(t){var e=t?p.extend({},t):{};e.orientation="top",c.prototype.setOptions.call(i,e)},this.components.push(i)}}else if(this.timeAxis2){var o=this.components.indexOf(this.timeAxis2);-1!==o&&this.components.splice(o,1),this.timeAxis2.destroy(),this.timeAxis2=null}if("function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),"hiddenDates"in this.options&&f.convertHiddenOptions(this.options.moment,this.body,this.options.hiddenDates),"clickToUse"in t&&(t.clickToUse?this.activator||(this.activator=new m(this.dom.root)):this.activator&&(this.activator.destroy(),delete this.activator)),"showCustomTime"in t)throw new Error("Option `showCustomTime` is deprecated. Create a custom time bar via timeline.addCustomTime(time [, id])");this._initAutoResize()}if(this.components.forEach(function(e){return e.setOptions(t)}),"configure"in t){this.configurator||(this.configurator=this._createConfigurator()),this.configurator.setOptions(t.configure);var n=p.deepExtend({},this.options);this.components.forEach(function(t){p.deepExtend(n,t.options)}),this.configurator.setModuleOptions({global:n})}this._redraw()},n.prototype.isActive=function(){return!this.activator||this.activator.active},n.prototype.destroy=function(){this.setItems(null),this.setGroups(null),this.off(),this._stopAutoResize(),this.dom.root.parentNode&&this.dom.root.parentNode.removeChild(this.dom.root),this.dom=null,this.activator&&(this.activator.destroy(),delete this.activator);for(var t in this.listeners)this.listeners.hasOwnProperty(t)&&delete this.listeners[t];this.listeners=null,this.hammer=null,this.components.forEach(function(t){return t.destroy()}),this.body=null},n.prototype.setCustomTime=function(t,e){var i=this.customTimes.filter(function(t){return e===t.options.id});if(0===i.length)throw new Error("No custom time bar found with id "+(0,r.default)(e));i.length>0&&i[0].setCustomTime(t)},n.prototype.getCustomTime=function(t){var e=this.customTimes.filter(function(e){return e.options.id===t});if(0===e.length)throw new Error("No custom time bar found with id "+(0,r.default)(t));return e[0].getCustomTime()},n.prototype.setCustomTimeTitle=function(t,e){var i=this.customTimes.filter(function(t){return t.options.id===e});if(0===i.length)throw new Error("No custom time bar found with id "+(0,r.default)(e));if(i.length>0)return i[0].setCustomTitle(t)},n.prototype.getEventProperties=function(t){return{event:t}},n.prototype.addCustomTime=function(t,e){var i=void 0!==t?p.convert(t,"Date").valueOf():new Date;if(this.customTimes.some(function(t){return t.options.id===e}))throw new Error("A custom time with id "+(0,r.default)(e)+" already exists");var o=new g(this.body,p.extend({},this.options,{time:i,id:e}));return this.customTimes.push(o),this.components.push(o),this._redraw(),e},n.prototype.removeCustomTime=function(t){var e=this.customTimes.filter(function(e){return e.options.id===t});if(0===e.length)throw new Error("No custom time bar found with id "+(0,r.default)(t));e.forEach(function(t){this.customTimes.splice(this.customTimes.indexOf(t),1),this.components.splice(this.components.indexOf(t),1),t.destroy()}.bind(this))},n.prototype.getVisibleItems=function(){return this.itemSet&&this.itemSet.getVisibleItems()||[]},n.prototype.fit=function(t,e){var i=this.getDataRange();if(null!==i.min||null!==i.max){var o=i.max-i.min,n=new Date(i.min.valueOf()-.01*o),s=new Date(i.max.valueOf()+.01*o),r=!t||void 0===t.animation||t.animation;this.range.setRange(n,s,{animation:r},e)}},n.prototype.getDataRange=function(){throw new Error("Cannot invoke abstract method getDataRange")},n.prototype.setWindow=function(t,e,i,o){"function"==typeof arguments[2]&&(o=arguments[2],i={});var n,s;1==arguments.length?(s=arguments[0],n=void 0===s.animation||s.animation,this.range.setRange(s.start,s.end,{animation:n})):2==arguments.length&&"function"==typeof arguments[1]?(s=arguments[0],o=arguments[1],n=void 0===s.animation||s.animation,this.range.setRange(s.start,s.end,{animation:n},o)):(n=!i||void 0===i.animation||i.animation,this.range.setRange(t,e,{animation:n},o))},n.prototype.moveTo=function(t,e,i){"function"==typeof arguments[1]&&(i=arguments[1],e={});var o=this.range.end-this.range.start,n=p.convert(t,"Date").valueOf(),s=n-o/2,r=n+o/2,a=!e||void 0===e.animation||e.animation;this.range.setRange(s,r,{animation:a},i)},n.prototype.getWindow=function(){var t=this.range.getRange();return{start:new Date(t.start),end:new Date(t.end)}},n.prototype.zoomIn=function(t,e,i){if(!(!t||t<0||t>1)){"function"==typeof arguments[1]&&(i=arguments[1],e={});var o=this.getWindow(),n=o.start.valueOf(),s=o.end.valueOf(),r=s-n,a=r/(1+t),h=(r-a)/2,d=n+h,l=s-h;this.setWindow(d,l,e,i)}},n.prototype.zoomOut=function(t,e,i){if(!(!t||t<0||t>1)){"function"==typeof arguments[1]&&(i=arguments[1],e={});var o=this.getWindow(),n=o.start.valueOf(),s=o.end.valueOf(),r=s-n,a=n-r*t/2,h=s+r*t/2;this.setWindow(a,h,e,i)}},n.prototype.redraw=function(){this._redraw()},n.prototype._redraw=function(){this.redrawCount++;var t=!1,e=this.options,i=this.props,o=this.dom;if(o&&o.container&&0!=o.root.offsetWidth){f.updateHiddenDates(this.options.moment,this.body,this.options.hiddenDates),"top"==e.orientation?(p.addClassName(o.root,"vis-top"),p.removeClassName(o.root,"vis-bottom")):(p.removeClassName(o.root,"vis-top"),p.addClassName(o.root,"vis-bottom")),o.root.style.maxHeight=p.option.asSize(e.maxHeight,""),o.root.style.minHeight=p.option.asSize(e.minHeight,""),o.root.style.width=p.option.asSize(e.width,""),i.border.left=(o.centerContainer.offsetWidth-o.centerContainer.clientWidth)/2,i.border.right=i.border.left,i.border.top=(o.centerContainer.offsetHeight-o.centerContainer.clientHeight)/2,i.border.bottom=i.border.top,i.borderRootHeight=o.root.offsetHeight-o.root.clientHeight,i.borderRootWidth=o.root.offsetWidth-o.root.clientWidth,0===o.centerContainer.clientHeight&&(i.border.left=i.border.top,i.border.right=i.border.left),0===o.root.clientHeight&&(i.borderRootWidth=i.borderRootHeight),i.center.height=o.center.offsetHeight,i.left.height=o.left.offsetHeight,i.right.height=o.right.offsetHeight,i.top.height=o.top.clientHeight||-i.border.top,i.bottom.height=o.bottom.clientHeight||-i.border.bottom;var n=Math.max(i.left.height,i.center.height,i.right.height),s=i.top.height+n+i.bottom.height+i.borderRootHeight+i.border.top+i.border.bottom;o.root.style.height=p.option.asSize(e.height,s+"px"),i.root.height=o.root.offsetHeight,i.background.height=i.root.height-i.borderRootHeight;var r=i.root.height-i.top.height-i.bottom.height-i.borderRootHeight;i.centerContainer.height=r,i.leftContainer.height=r,i.rightContainer.height=i.leftContainer.height,i.root.width=o.root.offsetWidth,i.background.width=i.root.width-i.borderRootWidth,this.initialDrawDone||(i.scrollbarWidth=p.getScrollBarWidth()),e.verticalScroll?e.rtl?(i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth+i.scrollbarWidth||-i.border.right):(i.left.width=o.leftContainer.clientWidth+i.scrollbarWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right):(i.left.width=o.leftContainer.clientWidth||-i.border.left,i.right.width=o.rightContainer.clientWidth||-i.border.right),this._setDOM();var a=this._updateScrollTop();"top"!=e.orientation.item&&(a+=Math.max(i.centerContainer.height-i.center.height-i.border.top-i.border.bottom,0)),o.center.style.top=a+"px";var h=0==i.scrollTop?"hidden":"",d=i.scrollTop==i.scrollTopMin?"hidden":"";o.shadowTop.style.visibility=h,o.shadowBottom.style.visibility=d,o.shadowTopLeft.style.visibility=h,o.shadowBottomLeft.style.visibility=d,o.shadowTopRight.style.visibility=h,o.shadowBottomRight.style.visibility=d,e.verticalScroll&&(o.rightContainer.className="vis-panel vis-right vis-vertical-scroll",o.leftContainer.className="vis-panel vis-left vis-vertical-scroll",o.shadowTopRight.style.visibility="hidden",o.shadowBottomRight.style.visibility="hidden",o.shadowTopLeft.style.visibility="hidden",o.shadowBottomLeft.style.visibility="hidden",o.left.style.top="0px",o.right.style.top="0px"),(!e.verticalScroll||i.center.heighti.centerContainer.height;this.hammer.get("pan").set({direction:u?l.DIRECTION_ALL:l.DIRECTION_HORIZONTAL}),this.components.forEach(function(e){t=e.redraw()||t});if(t){if(this.redrawCount<5)return void this.body.emitter.emit("_change");console.log("WARNING: infinite loop in redraw?")}else this.redrawCount=0;this.body.emitter.emit("changed")}},n.prototype._setDOM=function(){var t=this.props,e=this.dom;t.leftContainer.width=t.left.width,t.rightContainer.width=t.right.width;var i=t.root.width-t.left.width-t.right.width-t.borderRootWidth;t.center.width=i,t.centerContainer.width=i,t.top.width=i,t.bottom.width=i,e.background.style.height=t.background.height+"px",e.backgroundVertical.style.height=t.background.height+"px",e.backgroundHorizontal.style.height=t.centerContainer.height+"px",e.centerContainer.style.height=t.centerContainer.height+"px",e.leftContainer.style.height=t.leftContainer.height+"px",e.rightContainer.style.height=t.rightContainer.height+"px",e.background.style.width=t.background.width+"px",e.backgroundVertical.style.width=t.centerContainer.width+"px",e.backgroundHorizontal.style.width=t.background.width+"px",e.centerContainer.style.width=t.center.width+"px",e.top.style.width=t.top.width+"px",e.bottom.style.width=t.bottom.width+"px",e.background.style.left="0",e.background.style.top="0",e.backgroundVertical.style.left=t.left.width+t.border.left+"px",e.backgroundVertical.style.top="0",e.backgroundHorizontal.style.left="0",e.backgroundHorizontal.style.top=t.top.height+"px",e.centerContainer.style.left=t.left.width+"px",e.centerContainer.style.top=t.top.height+"px",e.leftContainer.style.left="0",e.leftContainer.style.top=t.top.height+"px",e.rightContainer.style.left=t.left.width+t.center.width+"px",e.rightContainer.style.top=t.top.height+"px",e.top.style.left=t.left.width+"px",e.top.style.top="0",e.bottom.style.left=t.left.width+"px",e.bottom.style.top=t.top.height+t.centerContainer.height+"px",e.center.style.left="0",e.left.style.left="0",e.right.style.left="0"},n.prototype.repaint=function(){throw new Error("Function repaint is deprecated. Use redraw instead.")},n.prototype.setCurrentTime=function(t){if(!this.currentTime)throw new Error("Option showCurrentTime must be true");this.currentTime.setCurrentTime(t)},n.prototype.getCurrentTime=function(){if(!this.currentTime)throw new Error("Option showCurrentTime must be true");return this.currentTime.getCurrentTime()},n.prototype._toTime=function(t){return f.toTime(this,t,this.props.center.width)},n.prototype._toGlobalTime=function(t){return f.toTime(this,t,this.props.root.width)},n.prototype._toScreen=function(t){return f.toScreen(this,t,this.props.center.width)},n.prototype._toGlobalScreen=function(t){return f.toScreen(this,t,this.props.root.width)},n.prototype._initAutoResize=function(){1==this.options.autoResize?this._startAutoResize():this._stopAutoResize()},n.prototype._startAutoResize=function(){var t=this;this._stopAutoResize(),this._onResize=function(){if(1!=t.options.autoResize)return void t._stopAutoResize();t.dom.root&&(t.dom.root.offsetWidth==t.props.lastWidth&&t.dom.root.offsetHeight==t.props.lastHeight||(t.props.lastWidth=t.dom.root.offsetWidth,t.props.lastHeight=t.dom.root.offsetHeight,t.props.scrollbarWidth=p.getScrollBarWidth(),t.body.emitter.emit("_change")))},p.addEventListener(window,"resize",this._onResize),t.dom.root&&(t.props.lastWidth=t.dom.root.offsetWidth,t.props.lastHeight=t.dom.root.offsetHeight),this.watchTimer=setInterval(this._onResize,1e3)},n.prototype._stopAutoResize=function(){this.watchTimer&&(clearInterval(this.watchTimer),this.watchTimer=void 0),this._onResize&&(p.removeEventListener(window,"resize",this._onResize),this._onResize=null)},n.prototype._onTouch=function(t){this.touch.allowDragging=!0,this.touch.initialScrollTop=this.props.scrollTop},n.prototype._onPinch=function(t){this.touch.allowDragging=!1},n.prototype._onDrag=function(t){if(t&&this.touch.allowDragging){var e=t.deltaY,i=this._getScrollTop(),o=this._setScrollTop(this.touch.initialScrollTop+e);this.options.verticalScroll&&(this.dom.left.parentNode.scrollTop=-this.props.scrollTop,this.dom.right.parentNode.scrollTop=-this.props.scrollTop),o!=i&&this.emit("verticalDrag")}},n.prototype._setScrollTop=function(t){return this.props.scrollTop=t,this._updateScrollTop(),this.props.scrollTop},n.prototype._updateScrollTop=function(){var t=Math.min(this.props.centerContainer.height-this.props.center.height,0);return t!=this.props.scrollTopMin&&("top"!=this.options.orientation.item&&(this.props.scrollTop+=t-this.props.scrollTopMin),this.props.scrollTopMin=t),this.props.scrollTop>0&&(this.props.scrollTop=0),this.props.scrollTop0&&this.current.milliseconds()0&&this.current.seconds()0&&this.current.minutes()0&&this.current.hours()0?t.step:1,this.autoScale=!1)},o.prototype.setAutoScale=function(t){this.autoScale=t},o.prototype.setMinimumStep=function(t){if(void 0!=t){31104e9>t&&(this.scale="year",this.step=1e3),15552e9>t&&(this.scale="year",this.step=500),31104e8>t&&(this.scale="year",this.step=100),15552e8>t&&(this.scale="year",this.step=50),31104e7>t&&(this.scale="year",this.step=10),15552e7>t&&(this.scale="year",this.step=5),31104e6>t&&(this.scale="year",this.step=1),7776e6>t&&(this.scale="month",this.step=3),2592e6>t&&(this.scale="month",this.step=1),432e6>t&&(this.scale="day",this.step=5),1728e5>t&&(this.scale="day",this.step=2),864e5>t&&(this.scale="day",this.step=1),432e5>t&&(this.scale="weekday",this.step=1),144e5>t&&(this.scale="hour",this.step=4),36e5>t&&(this.scale="hour",this.step=1),9e5>t&&(this.scale="minute",this.step=15),6e5>t&&(this.scale="minute",this.step=10),3e5>t&&(this.scale="minute",this.step=5),6e4>t&&(this.scale="minute",this.step=1),15e3>t&&(this.scale="second",this.step=15),1e4>t&&(this.scale="second",this.step=10),5e3>t&&(this.scale="second",this.step=5),1e3>t&&(this.scale="second",this.step=1),200>t&&(this.scale="millisecond",this.step=200),100>t&&(this.scale="millisecond",this.step=100),50>t&&(this.scale="millisecond",this.step=50),10>t&&(this.scale="millisecond",this.step=10),5>t&&(this.scale="millisecond",this.step=5),1>t&&(this.scale="millisecond",this.step=1)}},o.snap=function(t,e,i){var o=n(t);if("year"==e){var s=o.year()+Math.round(o.month()/12);o.year(Math.round(s/i)*i),o.month(0),o.date(0),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("month"==e)o.date()>15?(o.date(1),o.add(1,"month")):o.date(1),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0);else if("week"==e)o.weekday()>2?(o.weekday(0),o.add(1,"week")):o.weekday(0),o.hours(0),o.minutes(0),o.seconds(0),o.milliseconds(0);else if("day"==e){switch(i){case 5:case 2:o.hours(24*Math.round(o.hours()/24));break;default:o.hours(12*Math.round(o.hours()/12))}o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("weekday"==e){switch(i){case 5:case 2:o.hours(12*Math.round(o.hours()/12));break;default:o.hours(6*Math.round(o.hours()/6))}o.minutes(0),o.seconds(0),o.milliseconds(0)}else if("hour"==e){switch(i){case 4:o.minutes(60*Math.round(o.minutes()/60));break;default:o.minutes(30*Math.round(o.minutes()/30))}o.seconds(0),o.milliseconds(0)}else if("minute"==e){switch(i){case 15:case 10:o.minutes(5*Math.round(o.minutes()/5)),o.seconds(0);break;case 5:o.seconds(60*Math.round(o.seconds()/60));break;default:o.seconds(30*Math.round(o.seconds()/30))}o.milliseconds(0)}else if("second"==e)switch(i){case 15:case 10:o.seconds(5*Math.round(o.seconds()/5)),o.milliseconds(0);break;case 5:o.milliseconds(1e3*Math.round(o.milliseconds()/1e3));break;default:o.milliseconds(500*Math.round(o.milliseconds()/500))}else if("millisecond"==e){var r=i>5?i/2:1;o.milliseconds(Math.round(o.milliseconds()/r)*r)}return o},o.prototype.isMajor=function(){if(1==this.switchedYear)switch(this.scale){case"year":case"month":case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedMonth)switch(this.scale){case"week":case"weekday":case"day":case"hour":case"minute":case"second":case"millisecond":return!0;default:return!1}else if(1==this.switchedDay)switch(this.scale){case"millisecond":case"second":case"minute":case"hour":return!0;default:return!1}var t=this.moment(this.current);switch(this.scale){case"millisecond":return 0==t.milliseconds();case"second":return 0==t.seconds();case"minute":return 0==t.hours()&&0==t.minutes();case"hour":return 0==t.hours();case"weekday":case"day":case"week":return 1==t.date();case"month":return 0==t.month();case"year":default:return!1}},o.prototype.getLabelMinor=function(t){if(void 0==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.minorLabels)return this.format.minorLabels(t,this.scale,this.step);var e=this.format.minorLabels[this.scale];switch(this.scale){case"week":if(this.isMajor()&&0!==t.weekday())return"";default:return e&&e.length>0?this.moment(t).format(e):""}},o.prototype.getLabelMajor=function(t){if(void 0==t&&(t=this.current),t instanceof Date&&(t=this.moment(t)),"function"==typeof this.format.majorLabels)return this.format.majorLabels(t,this.scale,this.step);var e=this.format.majorLabels[this.scale];return e&&e.length>0?this.moment(t).format(e):""},o.prototype.getClassName=function(){function t(t){return t/a%2==0?" vis-even":" vis-odd"}function e(t){return t.isSame(new Date,"day")?" vis-today":t.isSame(n().add(1,"day"),"day")?" vis-tomorrow":t.isSame(n().add(-1,"day"),"day")?" vis-yesterday":""}function i(t){return t.isSame(new Date,"week")?" vis-current-week":""}function o(t){return t.isSame(new Date,"month")?" vis-current-month":""}var n=this.moment,s=this.moment(this.current),r=s.locale?s.locale("en"):s.lang("en"),a=this.step,h=[];switch(this.scale){case"millisecond":h.push(e(r)),h.push(t(r.milliseconds()));break;case"second":h.push(e(r)),h.push(t(r.seconds()));break;case"minute":h.push(e(r)),h.push(t(r.minutes()));break;case"hour":h.push("vis-h"+r.hours()+(4==this.step?"-h"+(r.hours()+4):"")),h.push(e(r)),h.push(t(r.hours()));break;case"weekday":h.push("vis-"+r.format("dddd").toLowerCase()),h.push(e(r)),h.push(i(r)),h.push(t(r.date()));break;case"day":h.push("vis-day"+r.date()),h.push("vis-"+r.format("MMMM").toLowerCase()),h.push(e(r)),h.push(o(r)),h.push(this.step<=2?e(r):""),h.push(this.step<=2?"vis-"+r.format("dddd").toLowerCase():""),h.push(t(r.date()-1));break;case"week":h.push("vis-week"+r.format("w")),h.push(i(r)),h.push(t(r.week()));break;case"month":h.push("vis-"+r.format("MMMM").toLowerCase()),h.push(o(r)),h.push(t(r.month()));break;case"year":h.push("vis-year"+r.year()),h.push(function(t){return t.isSame(new Date,"year")?" vis-current-year":""}(r)),h.push(t(r.year()))}return h.filter(String).join(" ")},t.exports=o},function(t,e,i){function o(t,e){this.body=t,this.defaultOptions={rtl:!1,showCurrentTime:!0,moment:r,locales:a,locale:"en"},this.options=n.extend({},this.defaultOptions),this.offset=0,this._create(),this.setOptions(e)}var n=i(0),s=i(5),r=i(3),a=i(69);o.prototype=new s,o.prototype._create=function(){var t=document.createElement("div");t.className="vis-current-time",t.style.position="absolute",t.style.top="0px",t.style.height="100%",this.bar=t},o.prototype.destroy=function(){this.options.showCurrentTime=!1,this.redraw(),this.body=null},o.prototype.setOptions=function(t){t&&n.selectiveExtend(["rtl","showCurrentTime","moment","locale","locales"],this.options,t)},o.prototype.redraw=function(){if(this.options.showCurrentTime){var t=this.body.dom.backgroundVertical;this.bar.parentNode!=t&&(this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),t.appendChild(this.bar),this.start());var e=this.options.moment((new Date).valueOf()+this.offset),i=this.body.util.toScreen(e),o=this.options.locales[this.options.locale];o||(this.warned||(console.log("WARNING: options.locales['"+this.options.locale+"'] not found. See http://visjs.org/docs/timeline/#Localization"),this.warned=!0),o=this.options.locales.en);var n=o.current+" "+o.time+": "+e.format("dddd, MMMM Do YYYY, H:mm:ss");n=n.charAt(0).toUpperCase()+n.substring(1),this.options.rtl?this.bar.style.right=i+"px":this.bar.style.left=i+"px",this.bar.title=n}else this.bar.parentNode&&this.bar.parentNode.removeChild(this.bar),this.stop();return!1},o.prototype.start=function(){function t(){e.stop();var i=e.body.range.conversion(e.body.domProps.center.width).scale,o=1/i/10;o<30&&(o=30),o>1e3&&(o=1e3),e.redraw(),e.body.emitter.emit("currentTimeTick"),e.currentTimeTimer=setTimeout(t,o)}var e=this;t()},o.prototype.stop=function(){void 0!==this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer)},o.prototype.setCurrentTime=function(t){var e=n.convert(t,"Date").valueOf(),i=(new Date).valueOf();this.offset=e-i,this.redraw()},o.prototype.getCurrentTime=function(){return new Date((new Date).valueOf()+this.offset)},t.exports=o},function(t,e,i){function o(t,e,i){if(this.groupId=t,this.subgroups={},this.subgroupStack={},this.subgroupStackAll=!1,this.doInnerStack=!1,this.subgroupIndex=0,this.subgroupOrderer=e&&e.subgroupOrder,this.itemSet=i,this.isVisible=null,this.stackDirty=!0,e&&e.nestedGroups&&(this.nestedGroups=e.nestedGroups,0==e.showNested?this.showNested=!1:this.showNested=!0),e&&e.subgroupStack)if("boolean"==typeof e.subgroupStack)this.doInnerStack=e.subgroupStack,this.subgroupStackAll=e.subgroupStack;else for(var o in e.subgroupStack)this.subgroupStack[o]=e.subgroupStack[o],this.doInnerStack=this.doInnerStack||e.subgroupStack[o];this.nestedInGroup=null,this.dom={},this.props={label:{width:0,height:0}},this.className=null,this.items={},this.visibleItems=[],this.itemsInRange=[],this.orderedItems={byStart:[],byEnd:[]},this.checkRangedItems=!1;var n=this;this.itemSet.body.emitter.on("checkRangedItems",function(){n.checkRangedItems=!0}),this._create(),this.setData(e)}var n=i(4),s=function(t){return t&&t.__esModule?t:{default:t}}(n),r=i(0),a=i(71);o.prototype._create=function(){var t=document.createElement("div");this.itemSet.options.groupEditable.order?t.className="vis-label draggable":t.className="vis-label",this.dom.label=t;var e=document.createElement("div");e.className="vis-inner",t.appendChild(e),this.dom.inner=e;var i=document.createElement("div");i.className="vis-group",i["timeline-group"]=this,this.dom.foreground=i,this.dom.background=document.createElement("div"),this.dom.background.className="vis-group",this.dom.axis=document.createElement("div"),this.dom.axis.className="vis-group",this.dom.marker=document.createElement("div"),this.dom.marker.style.visibility="hidden",this.dom.marker.style.position="absolute",this.dom.marker.innerHTML="",this.dom.background.appendChild(this.dom.marker)},o.prototype.setData=function(t){var e,i;if(this.itemSet.options&&this.itemSet.options.groupTemplate?(i=this.itemSet.options.groupTemplate.bind(this),e=i(t,this.dom.inner)):e=t&&t.content,e instanceof Element){for(this.dom.inner.appendChild(e);this.dom.inner.firstChild;)this.dom.inner.removeChild(this.dom.inner.firstChild);this.dom.inner.appendChild(e)}else e instanceof Object?i(t,this.dom.inner):this.dom.inner.innerHTML=void 0!==e&&null!==e?e:this.groupId||"";if(this.dom.label.title=t&&t.title||"",this.dom.inner.firstChild?r.removeClassName(this.dom.inner,"vis-hidden"):r.addClassName(this.dom.inner,"vis-hidden"),t&&t.nestedGroups){this.nestedGroups&&this.nestedGroups==t.nestedGroups||(this.nestedGroups=t.nestedGroups),void 0===t.showNested&&void 0!==this.showNested||(0==t.showNested?this.showNested=!1:this.showNested=!0),r.addClassName(this.dom.label,"vis-nesting-group");var o=this.itemSet.options.rtl?"collapsed-rtl":"collapsed";this.showNested?(r.removeClassName(this.dom.label,o),r.addClassName(this.dom.label,"expanded")):(r.removeClassName(this.dom.label,"expanded"),r.addClassName(this.dom.label,o))}else this.nestedGroups&&(this.nestedGroups=null,o=this.itemSet.options.rtl?"collapsed-rtl":"collapsed",r.removeClassName(this.dom.label,o),r.removeClassName(this.dom.label,"expanded"),r.removeClassName(this.dom.label,"vis-nesting-group"));t&&t.nestedInGroup&&(r.addClassName(this.dom.label,"vis-nested-group"),this.itemSet.options&&this.itemSet.options.rtl?this.dom.inner.style.paddingRight="30px":this.dom.inner.style.paddingLeft="30px");var n=t&&t.className||null;n!=this.className&&(this.className&&(r.removeClassName(this.dom.label,this.className),r.removeClassName(this.dom.foreground,this.className),r.removeClassName(this.dom.background,this.className),r.removeClassName(this.dom.axis,this.className)),r.addClassName(this.dom.label,n),r.addClassName(this.dom.foreground,n),r.addClassName(this.dom.background,n),r.addClassName(this.dom.axis,n),this.className=n),this.style&&(r.removeCssText(this.dom.label,this.style),this.style=null),t&&t.style&&(r.addCssText(this.dom.label,t.style),this.style=t.style)},o.prototype.getLabelWidth=function(){return this.props.label.width},o.prototype._didMarkerHeightChange=function(){var t=this.dom.marker.clientHeight;if(t!=this.lastMarkerHeight){this.lastMarkerHeight=t;var e={},i=0;r.forEach(this.items,function(t,o){if(t.dirty=!0,t.displayed){e[o]=t.redraw(!0),i=e[o].length}});if(i>0)for(var o=0;o0)for(var u=0;u0){var e=this;this.resetSubgroups(),r.forEach(this.visibleItems,function(i){void 0!==i.data.subgroup&&(e.subgroups[i.data.subgroup].height=Math.max(e.subgroups[i.data.subgroup].height,i.height+t.item.vertical),e.subgroups[i.data.subgroup].visible=!0)})}},o.prototype._isGroupVisible=function(t,e){return this.top<=t.body.domProps.centerContainer.height-t.body.domProps.scrollTop+e.axis&&this.top+this.height+e.axis>=-t.body.domProps.scrollTop},o.prototype._calculateHeight=function(t){var e,i=this.visibleItems;if(i.length>0){var o=i[0].top,n=i[0].top+i[0].height;if(r.forEach(i,function(t){o=Math.min(o,t.top),n=Math.max(n,t.top+t.height)}),o>t.axis){var s=o-t.axis;n-=s,r.forEach(i,function(t){t.top-=s})}e=n+t.item.vertical/2}else e=0;return e=Math.max(e,this.props.label.height)},o.prototype.show=function(){this.dom.label.parentNode||this.itemSet.dom.labelSet.appendChild(this.dom.label),this.dom.foreground.parentNode||this.itemSet.dom.foreground.appendChild(this.dom.foreground),this.dom.background.parentNode||this.itemSet.dom.background.appendChild(this.dom.background),this.dom.axis.parentNode||this.itemSet.dom.axis.appendChild(this.dom.axis)},o.prototype.hide=function(){var t=this.dom.label;t.parentNode&&t.parentNode.removeChild(t);var e=this.dom.foreground;e.parentNode&&e.parentNode.removeChild(e);var i=this.dom.background;i.parentNode&&i.parentNode.removeChild(i);var o=this.dom.axis;o.parentNode&&o.parentNode.removeChild(o)},o.prototype.add=function(t){if(this.items[t.id]=t,t.setParent(this),this.stackDirty=!0,void 0!==t.data.subgroup&&(this._addToSubgroup(t),this.orderSubgroups()),-1==this.visibleItems.indexOf(t)){var e=this.itemSet.body.range;this._checkIfVisible(t,this.visibleItems,e)}},o.prototype._addToSubgroup=function(t,e){e=e||t.data.subgroup,void 0!=e&&void 0===this.subgroups[e]&&(this.subgroups[e]={height:0,top:0,start:t.data.start,end:t.data.end||t.data.start,visible:!1,index:this.subgroupIndex,items:[],stack:this.subgroupStackAll||this.subgroupStack[e]||!1},this.subgroupIndex++),new Date(t.data.start)new Date(this.subgroups[e].end)&&(this.subgroups[e].end=i),this.subgroups[e].items.push(t)},o.prototype._updateSubgroupsSizes=function(){var t=this;if(t.subgroups)for(var e in t.subgroups){var i=t.subgroups[e].items[0].data.end||t.subgroups[e].items[0].data.start,o=t.subgroups[e].items[0].data.start,n=i-1;t.subgroups[e].items.forEach(function(t){new Date(t.data.start)new Date(n)&&(n=e)}),t.subgroups[e].start=o,t.subgroups[e].end=new Date(n-1)}},o.prototype.orderSubgroups=function(){if(void 0!==this.subgroupOrderer){var t,e=[];if("string"==typeof this.subgroupOrderer){for(t in this.subgroups)e.push({subgroup:t,sortField:this.subgroups[t].items[0].data[this.subgroupOrderer]});e.sort(function(t,e){return t.sortField-e.sortField})}else if("function"==typeof this.subgroupOrderer){for(t in this.subgroups)e.push(this.subgroups[t].items[0].data);e.sort(this.subgroupOrderer)}if(e.length>0)for(var i=0;i=0&&(i.items.splice(o,1),i.items.length?this._updateSubgroupsSizes():delete this.subgroups[e])}}},o.prototype.removeFromDataSet=function(t){this.itemSet.removeItem(t.id)},o.prototype.order=function(){for(var t=r.toArray(this.items),e=[],i=[],o=0;o0)for(var l=0;lh}),1==this.checkRangedItems)for(this.checkRangedItems=!1,l=0;lh})}var c={},m=0;for(l=0;l0)for(var g=0;g=0&&(r=e[s],!n(r));s--)void 0===o[r.id]&&(o[r.id]=!0,i.push(r));for(s=t+1;st.start},o.prototype._createDomElement=function(){this.dom||(this.dom={},this.dom.box=document.createElement("div"),this.dom.frame=document.createElement("div"),this.dom.frame.className="vis-item-overflow",this.dom.box.appendChild(this.dom.frame),this.dom.visibleFrame=document.createElement("div"),this.dom.visibleFrame.className="vis-item-visible-frame",this.dom.box.appendChild(this.dom.visibleFrame),this.dom.content=document.createElement("div"),this.dom.content.className="vis-item-content",this.dom.frame.appendChild(this.dom.content),this.dom.box["timeline-item"]=this,this.dirty=!0)},o.prototype._appendDomElement=function(){if(!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!this.dom.box.parentNode){var t=this.parent.dom.foreground;if(!t)throw new Error("Cannot redraw item: parent has no foreground container element");t.appendChild(this.dom.box)}this.displayed=!0},o.prototype._updateDirtyDomComponents=function(){if(this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.box),this._updateStyle(this.dom.box);var t=this.editable.updateTime||this.editable.updateGroup,e=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"")+(t?" vis-editable":" vis-readonly");this.dom.box.className=this.baseClassName+e,this.dom.content.style.maxWidth="none"}},o.prototype._getDomComponentsSizes=function(){return this.overflow="hidden"!==window.getComputedStyle(this.dom.frame).overflow,{content:{width:this.dom.content.offsetWidth},box:{height:this.dom.box.offsetHeight}}},o.prototype._updateDomComponentsSizes=function(t){this.props.content.width=t.content.width,this.height=t.box.height,this.dom.content.style.maxWidth="",this.dirty=!1},o.prototype._repaintDomAdditionals=function(){this._repaintOnItemUpdateTimeTooltip(this.dom.box),this._repaintDeleteButton(this.dom.box),this._repaintDragCenter(),this._repaintDragLeft(),this._repaintDragRight()},o.prototype.redraw=function(t){var e,i=[this._createDomElement.bind(this),this._appendDomElement.bind(this),this._updateDirtyDomComponents.bind(this),function(){this.dirty&&(e=this._getDomComponentsSizes.bind(this)())}.bind(this),function(){this.dirty&&this._updateDomComponentsSizes.bind(this)(e)}.bind(this),this._repaintDomAdditionals.bind(this)];if(t)return i;var o;return i.forEach(function(t){o=t()}),o},o.prototype.show=function(){this.displayed||this.redraw()},o.prototype.hide=function(){if(this.displayed){var t=this.dom.box;t.parentNode&&t.parentNode.removeChild(t),this.displayed=!1}},o.prototype.repositionX=function(t){var e,i,o=this.parent.width,n=this.conversion.toScreen(this.data.start),s=this.conversion.toScreen(this.data.end),r=void 0===this.data.align?this.options.align:this.data.align;!1===this.data.limitSize||void 0!==t&&!0!==t||(n<-o&&(n=-o),s>2*o&&(s=2*o));var a=Math.max(s-n+.5,1);switch(this.overflow?(this.options.rtl?this.right=n:this.left=n,this.width=a+this.props.content.width,i=this.props.content.width):(this.options.rtl?this.right=n:this.left=n,this.width=a,i=Math.min(s-n,this.props.content.width)),this.options.rtl?this.dom.box.style.right=this.right+"px":this.dom.box.style.left=this.left+"px",this.dom.box.style.width=a+"px",r){case"left":this.options.rtl?this.dom.content.style.right="0":this.dom.content.style.left="0";break;case"right":this.options.rtl?this.dom.content.style.right=Math.max(a-i,0)+"px":this.dom.content.style.left=Math.max(a-i,0)+"px";break;case"center":this.options.rtl?this.dom.content.style.right=Math.max((a-i)/2,0)+"px":this.dom.content.style.left=Math.max((a-i)/2,0)+"px";break;default:e=this.overflow?s>0?Math.max(-n,0):-i:n<0?-n:0,this.options.rtl?this.dom.content.style.right=e+"px":(this.dom.content.style.left=e+"px",this.dom.content.style.width="calc(100% - "+e+"px)")}},o.prototype.repositionY=function(){var t=this.options.orientation.item,e=this.dom.box;e.style.top="top"==t?this.top+"px":this.parent.height-this.top-this.height+"px"},o.prototype._repaintDragLeft=function(){if((this.selected||this.options.itemsAlwaysDraggable.range)&&this.options.editable.updateTime&&!this.dom.dragLeft){var t=document.createElement("div");t.className="vis-drag-left",t.dragLeftItem=this,this.dom.box.appendChild(t),this.dom.dragLeft=t}else this.selected||this.options.itemsAlwaysDraggable.range||!this.dom.dragLeft||(this.dom.dragLeft.parentNode&&this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft),this.dom.dragLeft=null)},o.prototype._repaintDragRight=function(){if((this.selected||this.options.itemsAlwaysDraggable.range)&&this.options.editable.updateTime&&!this.dom.dragRight){var t=document.createElement("div");t.className="vis-drag-right",t.dragRightItem=this,this.dom.box.appendChild(t),this.dom.dragRight=t}else this.selected||this.options.itemsAlwaysDraggable.range||!this.dom.dragRight||(this.dom.dragRight.parentNode&&this.dom.dragRight.parentNode.removeChild(this.dom.dragRight),this.dom.dragRight=null)},t.exports=o},function(t,e,i){function o(t,e){}function n(t,e){return e=void 0===e?{}:e,{style:e.style||t.options.drawPoints.style,styles:e.styles||t.options.drawPoints.styles,size:e.size||t.options.drawPoints.size,className:e.className||t.className}}function s(t,e){var i=void 0;return t.options&&t.options.drawPoints&&t.options.drawPoints.onRender&&"function"==typeof t.options.drawPoints.onRender&&(i=t.options.drawPoints.onRender),e.group.options&&e.group.options.drawPoints&&e.group.options.drawPoints.onRender&&"function"==typeof e.group.options.drawPoints.onRender&&(i=e.group.options.drawPoints.onRender),i}var r=i(1),a=function(t){return t&&t.__esModule?t:{default:t}}(r),h=i(11);o.draw=function(t,e,i,o){o=o||0;for(var r=s(i,e),d=0;dh;)o(a,i=e[h++])&&(~s(d,i)||d.push(i));return d}},function(t,e,i){var o=i(34);t.exports=function(t){return Object(o(t))}},function(t,e,i){var o=i(101)(!0);i(56)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=o(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){var o=i(60),n=i(41).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return o(t,n)}},function(t,e,i){function o(t){this.delay=null,this.max=1/0,this._queue=[],this._timeout=null,this._extended=null,this.setOptions(t)}o.prototype.setOptions=function(t){t&&void 0!==t.delay&&(this.delay=t.delay),t&&void 0!==t.max&&(this.max=t.max),this._flushIfNeeded()},o.extend=function(t,e){var i=new o(e);if(void 0!==t.flush)throw new Error("Target object already has a property flush");t.flush=function(){i.flush()};var n=[{name:"flush",original:void 0}];if(e&&e.replace)for(var s=0;sthis.max&&this.flush(),clearTimeout(this._timeout),this.queue.length>0&&"number"==typeof this.delay){var t=this;this._timeout=setTimeout(function(){t.flush()},this.delay)}},o.prototype.flush=function(){for(;this._queue.length>0;){var t=this._queue.shift();t.fn.apply(t.context||t.fn,t.args||[])}},t.exports=o},function(t,e){function i(t){if(t)return o(t)}function o(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}t.exports=i,i.prototype.on=i.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},i.prototype.once=function(t,e){function i(){o.off(t,i),e.apply(this,arguments)}var o=this;return this._callbacks=this._callbacks||{},i.fn=e,this.on(t,i),this},i.prototype.off=i.prototype.removeListener=i.prototype.removeAllListeners=i.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks[t];if(!i)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var o,n=0;n0){var n=i.groupsData.getDataSet();n.get().forEach(function(t){if(t.nestedGroups){0!=t.showNested&&(t.showNested=!0);var e=[];t.nestedGroups.forEach(function(i){var o=n.get(i);o&&(o.nestedInGroup=t.id,0==t.showNested&&(o.visible=!1),e=e.concat(o))}),n.update(e,o)}})}},update:function(t,e,o){i._onUpdateGroups(e.items)},remove:function(t,e,o){i._onRemoveGroups(e.items)}},this.items={},this.groups={},this.groupIds=[],this.selection=[],this.popup=null,this.touchParams={},this.groupTouchParams={},this._create(),this.setOptions(e)}var s=i(43),r=o(s),a=i(1),h=o(a),d=i(12),l=i(0),u=i(15),p=i(20),c=i(49),m=i(5),f=i(51),g=i(52),v=i(72),y=i(73),b=i(53),_=i(74),w=i(133).default,x="__ungrouped__",D="__background__";n.prototype=new m,n.types={background:_,box:v,range:b,point:y},n.prototype._create=function(){var t=document.createElement("div");t.className="vis-itemset",t["timeline-itemset"]=this,this.dom.frame=t;var e=document.createElement("div");e.className="vis-background",t.appendChild(e),this.dom.background=e;var i=document.createElement("div");i.className="vis-foreground",t.appendChild(i),this.dom.foreground=i;var o=document.createElement("div");o.className="vis-axis",this.dom.axis=o;var n=document.createElement("div");n.className="vis-labelset",this.dom.labelSet=n,this._updateUngrouped();var s=new g(D,null,this);s.show(),this.groups[D]=s,this.hammer=new d(this.body.dom.centerContainer),this.hammer.on("hammer.input",function(t){t.isFirst&&this._onTouch(t)}.bind(this)),this.hammer.on("panstart",this._onDragStart.bind(this)),this.hammer.on("panmove",this._onDrag.bind(this)),this.hammer.on("panend",this._onDragEnd.bind(this)),this.hammer.get("pan").set({threshold:5,direction:d.DIRECTION_HORIZONTAL}),this.hammer.on("tap",this._onSelectItem.bind(this)),this.hammer.on("press",this._onMultiSelectItem.bind(this)),this.hammer.on("doubletap",this._onAddItem.bind(this)),this.options.rtl?this.groupHammer=new d(this.body.dom.rightContainer):this.groupHammer=new d(this.body.dom.leftContainer),this.groupHammer.on("tap",this._onGroupClick.bind(this)),this.groupHammer.on("panstart",this._onGroupDragStart.bind(this)),this.groupHammer.on("panmove",this._onGroupDrag.bind(this)),this.groupHammer.on("panend",this._onGroupDragEnd.bind(this)),this.groupHammer.get("pan").set({threshold:5,direction:d.DIRECTION_VERTICAL}),this.body.dom.centerContainer.addEventListener("mouseover",this._onMouseOver.bind(this)),this.body.dom.centerContainer.addEventListener("mouseout",this._onMouseOut.bind(this)),this.body.dom.centerContainer.addEventListener("mousemove",this._onMouseMove.bind(this)),this.body.dom.centerContainer.addEventListener("contextmenu",this._onDragEnd.bind(this)),this.body.dom.centerContainer.addEventListener("mousewheel",this._onMouseWheel.bind(this)),this.show()},n.prototype.setOptions=function(t){if(t){var e=["type","rtl","align","order","stack","stackSubgroups","selectable","multiselect","multiselectPerGroup","groupOrder","dataAttributes","template","groupTemplate","visibleFrameTemplate","hide","snap","groupOrderSwap","showTooltips","tooltip","tooltipOnItemUpdateTime"];l.selectiveExtend(e,this.options,t),"itemsAlwaysDraggable"in t&&("boolean"==typeof t.itemsAlwaysDraggable?(this.options.itemsAlwaysDraggable.item=t.itemsAlwaysDraggable,this.options.itemsAlwaysDraggable.range=!1):"object"===(0,h.default)(t.itemsAlwaysDraggable)&&(l.selectiveExtend(["item","range"],this.options.itemsAlwaysDraggable,t.itemsAlwaysDraggable),this.options.itemsAlwaysDraggable.item||(this.options.itemsAlwaysDraggable.range=!1))),"orientation"in t&&("string"==typeof t.orientation?this.options.orientation.item="top"===t.orientation?"top":"bottom":"object"===(0,h.default)(t.orientation)&&"item"in t.orientation&&(this.options.orientation.item=t.orientation.item)),"margin"in t&&("number"==typeof t.margin?(this.options.margin.axis=t.margin,this.options.margin.item.horizontal=t.margin,this.options.margin.item.vertical=t.margin):"object"===(0,h.default)(t.margin)&&(l.selectiveExtend(["axis"],this.options.margin,t.margin),"item"in t.margin&&("number"==typeof t.margin.item?(this.options.margin.item.horizontal=t.margin.item,this.options.margin.item.vertical=t.margin.item):"object"===(0,h.default)(t.margin.item)&&l.selectiveExtend(["horizontal","vertical"],this.options.margin.item,t.margin.item)))),"editable"in t&&("boolean"==typeof t.editable?(this.options.editable.updateTime=t.editable,this.options.editable.updateGroup=t.editable,this.options.editable.add=t.editable,this.options.editable.remove=t.editable,this.options.editable.overrideItems=!1):"object"===(0,h.default)(t.editable)&&l.selectiveExtend(["updateTime","updateGroup","add","remove","overrideItems"],this.options.editable,t.editable)),"groupEditable"in t&&("boolean"==typeof t.groupEditable?(this.options.groupEditable.order=t.groupEditable,this.options.groupEditable.add=t.groupEditable,this.options.groupEditable.remove=t.groupEditable):"object"===(0,h.default)(t.groupEditable)&&l.selectiveExtend(["order","add","remove"],this.options.groupEditable,t.groupEditable));["onDropObjectOnItem","onAdd","onUpdate","onRemove","onMove","onMoving","onAddGroup","onMoveGroup","onRemoveGroup"].forEach(function(e){var i=t[e];if(i){if(!(i instanceof Function))throw new Error("option "+e+" must be a function "+e+"(item, callback)");this.options[e]=i}}.bind(this)),this.markDirty()}},n.prototype.markDirty=function(t){this.groupIds=[],t&&t.refreshItems&&l.forEach(this.items,function(t){t.dirty=!0,t.displayed&&t.redraw()})},n.prototype.destroy=function(){this.hide(),this.setItems(null),this.setGroups(null),this.hammer=null,this.body=null,this.conversion=null},n.prototype.hide=function(){this.dom.frame.parentNode&&this.dom.frame.parentNode.removeChild(this.dom.frame),this.dom.axis.parentNode&&this.dom.axis.parentNode.removeChild(this.dom.axis),this.dom.labelSet.parentNode&&this.dom.labelSet.parentNode.removeChild(this.dom.labelSet)},n.prototype.show=function(){this.dom.frame.parentNode||this.body.dom.center.appendChild(this.dom.frame),this.dom.axis.parentNode||this.body.dom.backgroundVertical.appendChild(this.dom.axis),this.dom.labelSet.parentNode||(this.options.rtl?this.body.dom.right.appendChild(this.dom.labelSet):this.body.dom.left.appendChild(this.dom.labelSet))},n.prototype.setSelection=function(t){var e,i,o,n;for(void 0==t&&(t=[]),Array.isArray(t)||(t=[t]),e=0,i=this.selection.length;et&&o.push(h.id):h.lefte&&o.push(h.id)}return o},n.prototype._deselect=function(t){for(var e=this.selection,i=0,o=e.length;i0){for(var w={},x=0;x<_;x++)l.forEach(b,function(t,e){w[e]=t[x]()});l.forEach(this.groups,function(t,e){if(e!==D){var i=w[e];s=i||s,v+=t.height}}),v=Math.max(v,y)}return v=Math.max(v,y),r.style.height=i(v),this.props.width=r.offsetWidth,this.props.height=v,this.dom.axis.style.top=i("top"==n?this.body.domProps.top.height+this.body.domProps.border.top:this.body.domProps.top.height+this.body.domProps.centerContainer.height),this.options.rtl?this.dom.axis.style.right="0":this.dom.axis.style.left="0",this.initialItemSetDrawn=!0,s=this._isResized()||s},n.prototype._firstGroup=function(){var t="top"==this.options.orientation.item?0:this.groupIds.length-1,e=this.groupIds[t];return this.groups[e]||this.groups[x]||null},n.prototype._updateUngrouped=function(){var t,e,i=this.groups[x];if(this.groupsData){if(i){i.hide(),delete this.groups[x];for(e in this.items)if(this.items.hasOwnProperty(e)){t=this.items[e],t.parent&&t.parent.remove(t);var o=this._getGroupId(t.data),n=this.groups[o];n&&n.add(t)||t.hide()}}}else if(!i){i=new f(null,null,this),this.groups[x]=i;for(e in this.items)this.items.hasOwnProperty(e)&&(t=this.items[e],i.add(t));i.show()}},n.prototype.getLabelSet=function(){return this.dom.labelSet},n.prototype.setItems=function(t){var e,i=this,o=this.itemsData;if(t){if(!(t instanceof u||t instanceof p))throw new TypeError("Data must be an instance of DataSet or DataView");this.itemsData=t}else this.itemsData=null;if(o&&(l.forEach(this.itemListeners,function(t,e){o.off(e,t)}),e=o.getIds(),this._onRemove(e)),this.itemsData){var n=this.id;l.forEach(this.itemListeners,function(t,e){i.itemsData.on(e,t,n)}),e=this.itemsData.getIds(),this._onAdd(e),this._updateUngrouped()}this.body.emitter.emit("_change",{queue:!0})},n.prototype.getItems=function(){return this.itemsData},n.prototype.setGroups=function(t){var e,i=this;if(this.groupsData&&(l.forEach(this.groupListeners,function(t,e){i.groupsData.off(e,t)}),e=this.groupsData.getIds(),this.groupsData=null,this._onRemoveGroups(e)),t){if(!(t instanceof u||t instanceof p))throw new TypeError("Data must be an instance of DataSet or DataView");this.groupsData=t}else this.groupsData=null;if(this.groupsData){var o=this.groupsData;this.groupsData instanceof p&&(o=this.groupsData.getDataSet()),o.get().forEach(function(t){t.nestedGroups&&t.nestedGroups.forEach(function(e){var i=o.get(e);i.nestedInGroup=t.id,0==t.showNested&&(i.visible=!1),o.update(i)})});var n=this.id;l.forEach(this.groupListeners,function(t,e){i.groupsData.on(e,t,n)}),e=this.groupsData.getIds(),this._onAddGroups(e)}this._updateUngrouped(),this._order(),this.body.emitter.emit("_change",{queue:!0})},n.prototype.getGroups=function(){return this.groupsData},n.prototype.removeItem=function(t){var e=this.itemsData.get(t),i=this.itemsData.getDataSet();e&&this.options.onRemove(e,function(e){e&&i.remove(t)})},n.prototype._getType=function(t){return t.type||this.options.type||(t.end?"range":"box")},n.prototype._getGroupId=function(t){return"background"==this._getType(t)&&void 0==t.group?D:this.groupsData?t.group:x},n.prototype._onUpdate=function(t){var e=this;t.forEach(function(t){var i,o=e.itemsData.get(t,e.itemOptions),s=e.items[t],r=o?e._getType(o):null,a=n.types[r];if(s&&(a&&s instanceof a?e._updateItem(s,o):(i=s.selected,e._removeItem(s),s=null)),!s&&o){if(!a)throw"rangeoverflow"==r?new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: .vis-item.vis-range .vis-item-content {overflow: visible;}'):new TypeError('Unknown item type "'+r+'"');s=new a(o,e.conversion,e.options),s.id=t,e._addItem(s),i&&(this.selection.push(t),s.select())}}.bind(this)),this._order(),this.body.emitter.emit("_change",{queue:!0})},n.prototype._onAdd=n.prototype._onUpdate,n.prototype._onRemove=function(t){var e=0,i=this;t.forEach(function(t){var o=i.items[t];o&&(e++,i._removeItem(o))}),e&&(this._order(),this.body.emitter.emit("_change",{queue:!0}))},n.prototype._order=function(){l.forEach(this.groups,function(t){t.order()})},n.prototype._onUpdateGroups=function(t){this._onAddGroups(t)},n.prototype._onAddGroups=function(t){var e=this;t.forEach(function(t){var i=e.groupsData.get(t),o=e.groups[t];if(o)o.setData(i);else{if(t==x||t==D)throw new Error("Illegal group id. "+t+" is a reserved id.");var n=(0,r.default)(e.options);l.extend(n,{height:null}),o=new f(t,i,e),e.groups[t]=o;for(var s in e.items)if(e.items.hasOwnProperty(s)){var a=e.items[s];a.data.group==t&&o.add(a)}o.order(),o.show()}}),this.body.emitter.emit("_change",{queue:!0})},n.prototype._onRemoveGroups=function(t){var e=this.groups;t.forEach(function(t){var i=e[t];i&&(i.hide(),delete e[t])}),this.markDirty(),this.body.emitter.emit("_change",{queue:!0})},n.prototype._orderGroups=function(){if(this.groupsData){var t=this.groupsData.getIds({order:this.options.groupOrder});t=this._orderNestedGroups(t);var e=!l.equalArray(t,this.groupIds);if(e){var i=this.groups;t.forEach(function(t){i[t].hide()}),t.forEach(function(t){i[t].show()}),this.groupIds=t}return e}return!1},n.prototype._orderNestedGroups=function(t){var e=[];return t.forEach(function(t){var i=this.groupsData.get(t);if(i.nestedInGroup||e.push(t),i.nestedGroups){var o=this.groupsData.get({filter:function(e){return e.nestedInGroup==t},order:this.options.groupOrder}),n=o.map(function(t){return t.id});e=e.concat(n)}},this),e},n.prototype._addItem=function(t){this.items[t.id]=t;var e=this._getGroupId(t.data),i=this.groups[e];i?i&&i.data&&i.data.showNested&&(t.groupShowing=!0):t.groupShowing=!1,i&&i.add(t)},n.prototype._updateItem=function(t,e){t.setData(e);var i=this._getGroupId(t.data),o=this.groups[i];o?o&&o.data&&o.data.showNested&&(t.groupShowing=!0):t.groupShowing=!1},n.prototype._removeItem=function(t){t.hide(),delete this.items[t.id];var e=this.selection.indexOf(t.id);-1!=e&&this.selection.splice(e,1),t.parent&&t.parent.remove(t)},n.prototype._constructByEndArray=function(t){for(var e=[],i=0;in)return}}if(i&&i!=this.groupTouchParams.group){var a=e.get(i.groupId),h=e.get(this.groupTouchParams.group.groupId);h&&a&&(this.options.groupOrderSwap(h,a,e),e.update(h),e.update(a));var d=e.getIds({order:this.options.groupOrder});if(!l.equalArray(d,this.groupTouchParams.originalOrder))for(var u=this.groupTouchParams.originalOrder,c=this.groupTouchParams.group.groupId,m=Math.min(u.length,d.length),f=0,g=0,v=0;f=m)break;if(d[f+g]==c)g=1;else if(u[f+v]==c)v=1;else{var y=d.indexOf(u[f+v]),b=e.get(d[f+g]),_=e.get(u[f+v]);this.options.groupOrderSwap(b,_,e),e.update(b),e.update(_);var w=d[f+g];d[f+g]=u[f+v],d[y]=w,f++}}}}},n.prototype._onGroupDragEnd=function(t){if(this.options.groupEditable.order&&this.groupTouchParams.group){t.stopPropagation();var e=this,i=e.groupTouchParams.group.groupId,o=e.groupsData.getDataSet(),n=l.extend({},o.get(i));e.options.onMoveGroup(n,function(t){if(t)t[o._fieldId]=i,o.update(t);else{var n=o.getIds({order:e.options.groupOrder});if(!l.equalArray(n,e.groupTouchParams.originalOrder))for(var s=e.groupTouchParams.originalOrder,r=Math.min(s.length,n.length),a=0;a=r)break;var h=n.indexOf(s[a]),d=o.get(n[a]),u=o.get(s[a]);e.options.groupOrderSwap(d,u,o),o.update(d),o.update(u);var p=n[a];n[a]=s[a],n[h]=p,a++}}}),e.body.emitter.emit("groupDragged",{groupId:i})}},n.prototype._onSelectItem=function(t){if(this.options.selectable){var e=t.srcEvent&&(t.srcEvent.ctrlKey||t.srcEvent.metaKey),i=t.srcEvent&&t.srcEvent.shiftKey;if(e||i)return void this._onMultiSelectItem(t);var o=this.getSelection(),n=this.itemFromTarget(t),s=n?[n.id]:[];this.setSelection(s);var r=this.getSelection();(r.length>0||o.length>0)&&this.body.emitter.emit("select",{items:r,event:t})}},n.prototype._onMouseOver=function(t){var e=this.itemFromTarget(t);if(e){if(e!==this.itemFromRelatedTarget(t)){var i=e.getTitle();if(this.options.showTooltips&&i){null==this.popup&&(this.popup=new w(this.body.dom.root,this.options.tooltip.overflowMethod||"flip")),this.popup.setText(i);var o=this.body.dom.centerContainer;this.popup.setPosition(t.clientX-l.getAbsoluteLeft(o)+o.offsetLeft,t.clientY-l.getAbsoluteTop(o)+o.offsetTop),this.popup.show()}else null!=this.popup&&this.popup.hide();this.body.emitter.emit("itemover",{item:e.id,event:t})}}},n.prototype._onMouseOut=function(t){var e=this.itemFromTarget(t);if(e){e!==this.itemFromRelatedTarget(t)&&(null!=this.popup&&this.popup.hide(),this.body.emitter.emit("itemout",{item:e.id,event:t}))}},n.prototype._onMouseMove=function(t){if(this.itemFromTarget(t)&&this.options.showTooltips&&this.options.tooltip.followMouse&&this.popup&&!this.popup.hidden){var e=this.body.dom.centerContainer;this.popup.setPosition(t.clientX-l.getAbsoluteLeft(e)+e.offsetLeft,t.clientY-l.getAbsoluteTop(e)+e.offsetTop),this.popup.show()}},n.prototype._onMouseWheel=function(t){this.touchParams.itemIsDragging&&this._onDragEnd(t)},n.prototype._onUpdateItem=function(t){if(this.options.selectable&&this.options.editable.add){var e=this;if(t){var i=e.itemsData.get(t.id);this.options.onUpdate(i,function(t){t&&e.itemsData.getDataSet().update(t)})}}},n.prototype._onDropObjectOnItem=function(t){var e=this.itemFromTarget(t),i=JSON.parse(t.dataTransfer.getData("text"));this.options.onDropObjectOnItem(i,e)},n.prototype._onAddItem=function(t){if(this.options.selectable&&this.options.editable.add){var e,i,o=this,n=this.options.snap||null;this.options.rtl?(e=l.getAbsoluteRight(this.dom.frame),i=e-t.center.x):(e=l.getAbsoluteLeft(this.dom.frame),i=t.center.x-e);var s,r,a=this.body.util.toTime(i),h=this.body.util.getScale(),d=this.body.util.getStep();"drop"==t.type?(r=JSON.parse(t.dataTransfer.getData("text")),r.content=r.content?r.content:"new item",r.start=r.start?r.start:n?n(a,h,d):a,r.type=r.type||"box",r[this.itemsData._fieldId]=r.id||l.randomUUID(),"range"!=r.type||r.end||(s=this.body.util.toTime(i+this.props.width/5),r.end=n?n(s,h,d):s)):(r={start:n?n(a,h,d):a,content:"new item"},r[this.itemsData._fieldId]=l.randomUUID(),"range"===this.options.type&&(s=this.body.util.toTime(i+this.props.width/5),r.end=n?n(s,h,d):s));var u=this.groupFromTarget(t);u&&(r.group=u.groupId),r=this._cloneItemData(r),this.options.onAdd(r,function(e){e&&(o.itemsData.getDataSet().add(e),"drop"==t.type&&o.setSelection([e.id]))})}},n.prototype._onMultiSelectItem=function(t){if(this.options.selectable){var e=this.itemFromTarget(t);if(e){var i=this.options.multiselect?this.getSelection():[];if((t.srcEvent&&t.srcEvent.shiftKey||!1)&&this.options.multiselect){var o=this.itemsData.get(e.id).group,s=void 0;this.options.multiselectPerGroup&&i.length>0&&(s=this.itemsData.get(i[0]).group),this.options.multiselectPerGroup&&void 0!=s&&s!=o||i.push(e.id);var r=n._getItemRange(this.itemsData.get(i,this.itemOptions));if(!this.options.multiselectPerGroup||s==o){i=[];for(var a in this.items)if(this.items.hasOwnProperty(a)){var h=this.items[a],d=h.data.start,l=void 0!==h.data.end?h.data.end:d;!(d>=r.min&&l<=r.max)||this.options.multiselectPerGroup&&s!=this.itemsData.get(h.id).group||h instanceof _||i.push(h.id)}}}else{var u=i.indexOf(e.id);-1==u?i.push(e.id):i.splice(u,1)}this.setSelection(i),this.body.emitter.emit("select",{items:this.getSelection(),event:t})}}},n._getItemRange=function(t){var e=null,i=null;return t.forEach(function(t){(null==i||t.starte)&&(e=t.end):(null==e||t.start>e)&&(e=t.start)}),{min:i,max:e}},n.prototype.itemFromElement=function(t){for(var e=t;e;){if(e.hasOwnProperty("timeline-item"))return e["timeline-item"];e=e.parentNode}return null},n.prototype.itemFromTarget=function(t){return this.itemFromElement(t.target)},n.prototype.itemFromRelatedTarget=function(t){return this.itemFromElement(t.relatedTarget)},n.prototype.groupFromTarget=function(t){var e=t.center?t.center.y:t.clientY,i=this.groupIds;i.length<=0&&this.groupsData&&(i=this.groupsData.getIds({order:this.options.groupOrder}));for(var o=0;oa&&ea)return s}else if(0===o&&es&&(s=r.top+r.height)}while(a)}}o.height=s-o.top+.5*i.item.vertical},e.nostack=function(t,i,o,n){for(var s=0;so[r].index&&e.collisionByTimes(o[n],o[r])){s=o[r];break}null!=s&&(o[n].top=s.top+s.height)}while(s)}for(var a=0;ao[h].index&&(o[r].top+=o[h].height);for(var d=t[r],l=0;le.right&&t.top-i.vertical+.001e.top:t.left-i.horizontal+.001e.left&&t.top-i.vertical+.001e.top},e.collisionByTimes=function(t,e){return t.start<=e.start&&t.end>=e.start&&t.tope.top||e.start<=t.start&&e.end>=t.start&&e.topt.top}},function(t,e,i){function o(t,e,i){if(this.props={dot:{width:0,height:0},line:{width:0,height:0}},this.options=i,t&&void 0==t.start)throw new Error('Property "start" missing in item '+t);n.call(this,t,e,i)}var n=i(22);o.prototype=new n(null,null,null),o.prototype.isVisible=function(t){var e=this.options.align,i=this.width*t.getMillisecondsPerPixel();return"right"==e?this.data.start.getTime()>t.start&&this.data.start.getTime()-it.start&&this.data.start.getTime()t.start&&this.data.start.getTime()-i/2t.start&&this.data.startt.start},o.prototype._createDomElement=function(){this.dom||(this.dom={},this.dom.box=document.createElement("div"),this.dom.frame=document.createElement("div"),this.dom.frame.className="vis-item-overflow",this.dom.box.appendChild(this.dom.frame),this.dom.content=document.createElement("div"),this.dom.content.className="vis-item-content",this.dom.frame.appendChild(this.dom.content),this.dirty=!0)},o.prototype._appendDomElement=function(){if(!this.parent)throw new Error("Cannot redraw item: no parent attached");if(!this.dom.box.parentNode){var t=this.parent.dom.background;if(!t)throw new Error("Cannot redraw item: parent has no background container element");t.appendChild(this.dom.box)}this.displayed=!0},o.prototype._updateDirtyDomComponents=function(){if(this.dirty){this._updateContents(this.dom.content),this._updateDataAttributes(this.dom.content),this._updateStyle(this.dom.box);var t=(this.data.className?" "+this.data.className:"")+(this.selected?" vis-selected":"");this.dom.box.className=this.baseClassName+t}},o.prototype._getDomComponentsSizes=function(){return this.overflow="hidden"!==window.getComputedStyle(this.dom.content).overflow,{content:{width:this.dom.content.offsetWidth}}},o.prototype._updateDomComponentsSizes=function(t){this.props.content.width=t.content.width,this.height=0,this.dirty=!1},o.prototype._repaintDomAdditionals=function(){},o.prototype.redraw=function(t){var e,i=[this._createDomElement.bind(this),this._appendDomElement.bind(this),this._updateDirtyDomComponents.bind(this),function(){this.dirty&&(e=this._getDomComponentsSizes.bind(this)())}.bind(this),function(){this.dirty&&this._updateDomComponentsSizes.bind(this)(e)}.bind(this),this._repaintDomAdditionals.bind(this)];if(t)return i;var o;return i.forEach(function(t){o=t()}),o},o.prototype.show=r.prototype.show,o.prototype.hide=r.prototype.hide,o.prototype.repositionX=r.prototype.repositionX,o.prototype.repositionY=function(t){var e,i=this.options.orientation.item;if(void 0!==this.data.subgroup){var o=this.data.subgroup;this.dom.box.style.height=this.parent.subgroups[o].height+"px",this.dom.box.style.top="top"==i?this.parent.top+this.parent.subgroups[o].top+"px":this.parent.top+this.parent.height-this.parent.subgroups[o].top-this.parent.subgroups[o].height+"px",this.dom.box.style.bottom=""}else this.parent instanceof s?(e=Math.max(this.parent.height,this.parent.itemSet.body.domProps.center.height,this.parent.itemSet.body.domProps.centerContainer.height),this.dom.box.style.bottom="bottom"==i?"0":"",this.dom.box.style.top="top"==i?"0":""):(e=this.parent.height,this.dom.box.style.top=this.parent.top+"px",this.dom.box.style.bottom="");this.dom.box.style.height=e+"px"},t.exports=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var o="string",n="boolean",s="number",r="object",a={configure:{enabled:{boolean:n},filter:{boolean:n,function:"function"},container:{dom:"dom"},__type__:{object:r,boolean:n,function:"function"}},align:{string:o},rtl:{boolean:n,undefined:"undefined"},rollingMode:{follow:{boolean:n},offset:{number:s,undefined:"undefined"},__type__:{object:r}},verticalScroll:{boolean:n,undefined:"undefined"},horizontalScroll:{boolean:n,undefined:"undefined"},autoResize:{boolean:n},throttleRedraw:{number:s},clickToUse:{boolean:n},dataAttributes:{string:o,array:"array"},editable:{add:{boolean:n,undefined:"undefined"},remove:{boolean:n,undefined:"undefined"},updateGroup:{boolean:n,undefined:"undefined"},updateTime:{boolean:n,undefined:"undefined"},overrideItems:{boolean:n,undefined:"undefined"},__type__:{boolean:n,object:r}},end:{number:s,date:"date",string:o,moment:"moment"},format:{minorLabels:{millisecond:{string:o,undefined:"undefined"},second:{string:o,undefined:"undefined"},minute:{string:o,undefined:"undefined"},hour:{string:o,undefined:"undefined"},weekday:{string:o,undefined:"undefined"},day:{string:o,undefined:"undefined"},week:{string:o,undefined:"undefined"},month:{string:o,undefined:"undefined"},year:{string:o,undefined:"undefined"},__type__:{object:r,function:"function"}},majorLabels:{millisecond:{string:o,undefined:"undefined"},second:{string:o,undefined:"undefined"},minute:{string:o,undefined:"undefined"},hour:{string:o,undefined:"undefined"},weekday:{string:o,undefined:"undefined"},day:{string:o,undefined:"undefined"},week:{string:o,undefined:"undefined"},month:{string:o,undefined:"undefined"},year:{string:o,undefined:"undefined"},__type__:{object:r,function:"function"}},__type__:{object:r}},moment:{function:"function"},groupOrder:{string:o,function:"function"},groupEditable:{add:{boolean:n,undefined:"undefined"},remove:{boolean:n,undefined:"undefined"},order:{boolean:n,undefined:"undefined"},__type__:{boolean:n,object:r}},groupOrderSwap:{function:"function"},height:{string:o,number:s},hiddenDates:{start:{date:"date",number:s,string:o,moment:"moment"},end:{date:"date",number:s,string:o,moment:"moment"},repeat:{string:o},__type__:{object:r,array:"array"}},itemsAlwaysDraggable:{item:{boolean:n,undefined:"undefined"},range:{boolean:n,undefined:"undefined"},__type__:{boolean:n,object:r}},limitSize:{boolean:n},locale:{string:o},locales:{__any__:{any:"any"},__type__:{object:r}},margin:{axis:{number:s},item:{horizontal:{number:s,undefined:"undefined"},vertical:{number:s,undefined:"undefined"},__type__:{object:r,number:s}},__type__:{object:r,number:s}},max:{date:"date",number:s,string:o,moment:"moment"},maxHeight:{number:s,string:o},maxMinorChars:{number:s},min:{date:"date",number:s,string:o,moment:"moment"},minHeight:{number:s,string:o},moveable:{boolean:n},multiselect:{boolean:n},multiselectPerGroup:{boolean:n},onAdd:{function:"function"},onDropObjectOnItem:{function:"function"},onUpdate:{function:"function"},onMove:{function:"function"},onMoving:{function:"function"},onRemove:{function:"function"},onAddGroup:{function:"function"},onMoveGroup:{function:"function"},onRemoveGroup:{function:"function"},onInitialDrawComplete:{function:"function"},order:{function:"function"},orientation:{axis:{string:o,undefined:"undefined"},item:{string:o,undefined:"undefined"},__type__:{string:o,object:r}},selectable:{boolean:n},showCurrentTime:{boolean:n},showMajorLabels:{boolean:n},showMinorLabels:{boolean:n},stack:{boolean:n},stackSubgroups:{boolean:n},snap:{function:"function",null:"null"},start:{date:"date",number:s,string:o,moment:"moment"},template:{function:"function"},groupTemplate:{function:"function"},visibleFrameTemplate:{string:o,function:"function"},showTooltips:{boolean:n},tooltip:{followMouse:{boolean:n},overflowMethod:{string:["cap","flip"]},__type__:{object:r}},tooltipOnItemUpdateTime:{template:{function:"function"},__type__:{boolean:n,object:r}},timeAxis:{scale:{string:o,undefined:"undefined"},step:{number:s,undefined:"undefined"},__type__:{object:r}},type:{string:o},width:{string:o,number:s},zoomable:{boolean:n},zoomKey:{string:["ctrlKey","altKey","metaKey",""]},zoomMax:{number:s},zoomMin:{number:s},__type__:{object:r}},h={global:{align:["center","left","right"],direction:!1,autoResize:!0,clickToUse:!1,editable:{add:!1,remove:!1,updateGroup:!1,updateTime:!1},end:"",format:{minorLabels:{millisecond:"SSS",second:"s",minute:"HH:mm",hour:"HH:mm",weekday:"ddd D",day:"D",week:"w",month:"MMM",year:"YYYY"},majorLabels:{millisecond:"HH:mm:ss",second:"D MMMM HH:mm",minute:"ddd D MMMM",hour:"ddd D MMMM",weekday:"MMMM YYYY",day:"MMMM YYYY",week:"MMMM YYYY",month:"YYYY",year:""}},groupsDraggable:!1,height:"",locale:"",margin:{axis:[20,0,100,1],item:{horizontal:[10,0,100,1],vertical:[10,0,100,1]}},max:"",maxHeight:"",maxMinorChars:[7,0,20,1],min:"",minHeight:"",moveable:!1,multiselect:!1,multiselectPerGroup:!1,orientation:{axis:["both","bottom","top"],item:["bottom","top"]},selectable:!0,showCurrentTime:!1,showMajorLabels:!0,showMinorLabels:!0,stack:!0,stackSubgroups:!0,start:"",showTooltips:!0,tooltip:{followMouse:!1,overflowMethod:"flip"},tooltipOnItemUpdateTime:!1,type:["box","point","range","background"],width:"100%",zoomable:!0,zoomKey:["ctrlKey","altKey","metaKey",""],zoomMax:[31536e10,10,31536e10,1],zoomMin:[10,10,31536e10,1]}};e.allOptions=a,e.configureOptions=h},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var n=i(16),s=o(n),r=i(1),a=o(r),h=i(30),d=o(h),l=i(31),u=o(l),p=i(0),c=i(137).default,m=function(){function t(e,i,o){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,d.default)(this,t),this.parent=e,this.changedOptions=[],this.container=i,this.allowCreation=!1,this.options={},this.initialized=!1,this.popupCounter=0,this.defaultOptions={enabled:!1,filter:!0,container:void 0,showButton:!0},p.extend(this.options,this.defaultOptions),this.configureOptions=o,this.moduleOptions={},this.domElements=[],this.popupDiv={},this.popupLimit=5,this.popupHistory={},this.colorPicker=new c(n),this.wrapper=void 0}return(0,u.default)(t,[{key:"setOptions",value:function(t){if(void 0!==t){this.popupHistory={},this._removePopup();var e=!0;"string"==typeof t?this.options.filter=t:t instanceof Array?this.options.filter=t.join():"object"===(void 0===t?"undefined":(0,a.default)(t))?(void 0!==t.container&&(this.options.container=t.container),void 0!==t.filter&&(this.options.filter=t.filter),void 0!==t.showButton&&(this.options.showButton=t.showButton),void 0!==t.enabled&&(e=t.enabled)):"boolean"==typeof t?(this.options.filter=!0,e=t):"function"==typeof t&&(this.options.filter=t,e=!0),!1===this.options.filter&&(e=!1),this.options.enabled=e}this._clean()}},{key:"setModuleOptions",value:function(t){this.moduleOptions=t,!0===this.options.enabled&&(this._clean(),void 0!==this.options.container&&(this.container=this.options.container),this._create())}},{key:"_create",value:function(){var t=this;this._clean(),this.changedOptions=[];var e=this.options.filter,i=0,o=!1;for(var n in this.configureOptions)this.configureOptions.hasOwnProperty(n)&&(this.allowCreation=!1,o=!1,"function"==typeof e?(o=e(n,[]),o=o||this._handleObject(this.configureOptions[n],[n],!0)):!0!==e&&-1===e.indexOf(n)||(o=!0),!1!==o&&(this.allowCreation=!0,i>0&&this._makeItem([]),this._makeHeader(n),this._handleObject(this.configureOptions[n],[n])),i++);if(!0===this.options.showButton){var s=document.createElement("div");s.className="vis-configuration vis-config-button",s.innerHTML="generate options",s.onclick=function(){t._printOptions()},s.onmouseover=function(){s.className="vis-configuration vis-config-button hover"},s.onmouseout=function(){s.className="vis-configuration vis-config-button"},this.optionsContainer=document.createElement("div"),this.optionsContainer.className="vis-configuration vis-config-option-container",this.domElements.push(this.optionsContainer),this.domElements.push(s)}this._push()}},{key:"_push",value:function(){this.wrapper=document.createElement("div"),this.wrapper.className="vis-configuration-wrapper",this.container.appendChild(this.wrapper);for(var t=0;t1?i-1:0),n=1;n2&&void 0!==arguments[2]&&arguments[2],o=document.createElement("div");return o.className="vis-configuration vis-config-label vis-config-s"+e.length,o.innerHTML=!0===i?""+t+":":t+":",o}},{key:"_makeDropdown",value:function(t,e,i){var o=document.createElement("select");o.className="vis-configuration vis-config-select";var n=0;void 0!==e&&-1!==t.indexOf(e)&&(n=t.indexOf(e));for(var s=0;ss&&1!==s&&(a.max=Math.ceil(1.2*e),d=a.max,h="range increased"),a.value=e}else a.value=o;var l=document.createElement("input");l.className="vis-configuration vis-config-rangeinput",l.value=a.value;var u=this;a.onchange=function(){l.value=this.value,u._update(Number(this.value),i)},a.oninput=function(){l.value=this.value};var p=this._makeLabel(i[i.length-1],i),c=this._makeItem(i,p,a,l);""!==h&&this.popupHistory[c]!==d&&(this.popupHistory[c]=d,this._setupPopup(h,c))}},{key:"_setupPopup",value:function(t,e){var i=this;if(!0===this.initialized&&!0===this.allowCreation&&this.popupCounter1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1,n=this.options.filter,s=!1;for(var r in t)if(t.hasOwnProperty(r)){o=!0;var a=t[r],h=p.copyAndExtendArray(e,r);if("function"==typeof n&&!1===(o=n(r,e))&&!(a instanceof Array)&&"string"!=typeof a&&"boolean"!=typeof a&&a instanceof Object&&(this.allowCreation=!1,o=this._handleObject(a,h,!0),this.allowCreation=!1===i),!1!==o){s=!0;var d=this._getValue(h);if(a instanceof Array)this._handleArray(a,d,h);else if("string"==typeof a)this._makeTextInput(a,d,h);else if("boolean"==typeof a)this._makeCheckbox(a,d,h);else if(a instanceof Object){var l=!0;if(-1!==e.indexOf("physics")&&this.moduleOptions.physics.solver!==r&&(l=!1),!0===l)if(void 0!==a.enabled){var u=p.copyAndExtendArray(h,"enabled"),c=this._getValue(u);if(!0===c){var m=this._makeLabel(r,h,!0);this._makeItem(h,m),s=this._handleObject(a,h)||s}else this._makeCheckbox(a,c,h)}else{var f=this._makeLabel(r,h,!0);this._makeItem(h,f),s=this._handleObject(a,h)||s}}else console.error("dont know how to handle",a,r,h)}}return s}},{key:"_handleArray",value:function(t,e,i){"string"==typeof t[0]&&"color"===t[0]?(this._makeColorField(t,e,i),t[1]!==e&&this.changedOptions.push({path:i,value:e})):"string"==typeof t[0]?(this._makeDropdown(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:e})):"number"==typeof t[0]&&(this._makeRange(t,e,i),t[0]!==e&&this.changedOptions.push({path:i,value:Number(e)}))}},{key:"_update",value:function(t,e){var i=this._constructOptions(t,e);this.parent.body&&this.parent.body.emitter&&this.parent.body.emitter.emit&&this.parent.body.emitter.emit("configChange",i),this.initialized=!0,this.parent.setOptions(i)}},{key:"_constructOptions",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i;t="true"===t||t,t="false"!==t&&t;for(var n=0;nvar options = "+(0,s.default)(t,null,2)+""}},{key:"getOptions",value:function(){for(var t={},e=0;e0){var r={};for(this._getRelevantData(s,r,o,n),this._applySampling(s,r),e=0;e0)switch(t.options.style){case"line":d.hasOwnProperty(s[e])||(d[s[e]]=f.calcPath(r[s[e]],t)),f.draw(d[s[e]],t,this.framework);case"point":case"points":"point"!=t.options.style&&"points"!=t.options.style&&1!=t.options.drawPoints.enabled||g.draw(r[s[e]],t,this.framework)}}}return a.cleanupElements(this.svgElements),!1},o.prototype._stack=function(t,e){var i,o,n,s,r;i=0;for(var a=0;at[a].x){r=e[h],s=0==h?r:e[h-1],i=h;break}}void 0===r&&(s=e[e.length-1],r=e[e.length-1]),o=r.x-s.x,n=r.y-s.y,t[a].y=0==o?t[a].orginalY+r.y:t[a].orginalY+n/o*(t[a].x-s.x)+s.y}},o.prototype._getRelevantData=function(t,e,i,o){var n,s,a,h;if(t.length>0)for(s=0;s0)for(var o=0;o0){var s=1,r=n.length,a=this.body.util.toGlobalScreen(n[n.length-1].x)-this.body.util.toGlobalScreen(n[0].x),h=r/a;s=Math.min(Math.ceil(.2*r),Math.max(1,Math.round(h)));for(var d=new Array(r),l=0;l0){for(s=0;s0&&(n=this.groups[t[s]],!0===r.stack&&"bar"===r.style?"left"===r.yAxisOrientation?a=a.concat(o):h=h.concat(o):i[t[s]]=n.getYRange(o,t[s]));m.getStackedYRange(a,i,t,"__barStackLeft","left"),m.getStackedYRange(h,i,t,"__barStackRight","right")}},o.prototype._updateYAxis=function(t,e){var i,o,n=!1,s=!1,r=!1,a=1e9,h=1e9,d=-1e9,l=-1e9;if(t.length>0){for(var u=0;ui?i:a,d=di?i:h,l=l=0&&t._redrawLabel(o-2,e.val,i,"vis-y-axis vis-major",t.props.majorCharHeight),!0===t.master&&(n?t._redrawLine(o,i,"vis-grid vis-horizontal vis-major",t.options.majorLinesOffset,t.props.majorLineWidth):t._redrawLine(o,i,"vis-grid vis-horizontal vis-minor",t.options.minorLinesOffset,t.props.minorLineWidth))});var r=0;void 0!==this.options[i].title&&void 0!==this.options[i].title.text&&(r=this.props.titleCharHeight);var h=!0===this.options.icons?Math.max(this.options.iconWidth,r)+this.options.labelOffsetX+15:r+this.options.labelOffsetX+15;return this.maxLabelSize>this.width-h&&!0===this.options.visible?(this.width=this.maxLabelSize+h,this.options.width=this.width+"px",a.cleanupElements(this.DOMelements.lines),a.cleanupElements(this.DOMelements.labels),this.redraw(),e=!0):this.maxLabelSizethis.minWidth?(this.width=Math.max(this.minWidth,this.maxLabelSize+h),this.options.width=this.width+"px",a.cleanupElements(this.DOMelements.lines),a.cleanupElements(this.DOMelements.labels),this.redraw(),e=!0):(a.cleanupElements(this.DOMelements.lines),a.cleanupElements(this.DOMelements.labels),e=!1),e},o.prototype.convertValue=function(t){return this.scale.convertValue(t)},o.prototype.screenToValue=function(t){return this.scale.screenToValue(t)},o.prototype._redrawLabel=function(t,e,i,o,n){var s=a.getDOMElement("div",this.DOMelements.labels,this.dom.frame);s.className=o,s.innerHTML=e,"left"===i?(s.style.left="-"+this.options.labelOffsetX+"px",s.style.textAlign="right"):(s.style.right="-"+this.options.labelOffsetX+"px",s.style.textAlign="left"),s.style.top=t-.5*n+this.options.labelOffsetY+"px",e+="";var r=Math.max(this.props.majorCharWidth,this.props.minorCharWidth);this.maxLabelSize6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]&&arguments[7];if(this.majorSteps=[1,2,5,10],this.minorSteps=[.25,.5,1,2],this.customLines=null,this.containerHeight=n,this.majorCharHeight=s,this._start=t,this._end=e,this.scale=1,this.minorStepIdx=-1,this.magnitudefactor=1,this.determineScale(),this.zeroAlign=r,this.autoScaleStart=i,this.autoScaleEnd=o,this.formattingFunction=a,i||o){var h=this,d=function(t){var e=t-t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx]);return t%(h.magnitudefactor*h.minorSteps[h.minorStepIdx])>h.magnitudefactor*h.minorSteps[h.minorStepIdx]*.5?e+h.magnitudefactor*h.minorSteps[h.minorStepIdx]:e};i&&(this._start-=2*this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._start=d(this._start)),o&&(this._end+=this.magnitudefactor*this.minorSteps[this.minorStepIdx],this._end=d(this._end)),this.determineScale()}}o.prototype.setCharHeight=function(t){this.majorCharHeight=t},o.prototype.setHeight=function(t){this.containerHeight=t},o.prototype.determineScale=function(){var t=this._end-this._start;this.scale=this.containerHeight/t;var e=this.majorCharHeight/this.scale,i=t>0?Math.round(Math.log(t)/Math.LN10):0;this.minorStepIdx=-1,this.magnitudefactor=Math.pow(10,i);var o=0;i<0&&(o=i);for(var n=!1,s=o;Math.abs(s)<=Math.abs(i);s++){this.magnitudefactor=Math.pow(10,s);for(var r=0;r=e){n=!0,this.minorStepIdx=r;break}}if(!0===n)break}},o.prototype.is_major=function(t){return t%(this.magnitudefactor*this.majorSteps[this.minorStepIdx])==0},o.prototype.getStep=function(){return this.magnitudefactor*this.minorSteps[this.minorStepIdx]},o.prototype.getFirstMajor=function(){var t=this.magnitudefactor*this.majorSteps[this.minorStepIdx];return this.convertValue(this._start+(t-this._start%t)%t)},o.prototype.formatValue=function(t){var e=t.toPrecision(5);return"function"==typeof this.formattingFunction&&(e=this.formattingFunction(t)),"number"==typeof e?""+e:"string"==typeof e?e:t.toPrecision(5)},o.prototype.getLines=function(){for(var t=[],e=this.getStep(),i=(e-this._start%e)%e,o=this._start+i;this._end-o>1e-5;o+=e)o!=this._start&&t.push({major:this.is_major(o),y:this.convertValue(o),val:this.formatValue(o)});return t},o.prototype.followScale=function(t){var e=this.minorStepIdx,i=this._start,o=this._end,n=this,s=function(){n.magnitudefactor*=2},r=function(){n.magnitudefactor/=2};t.minorStepIdx<=1&&this.minorStepIdx<=1||t.minorStepIdx>1&&this.minorStepIdx>1||(t.minorStepIdxo+1e-5)r(),d=!1;else{if(!this.autoScaleStart&&this._start=0)){r(),d=!1;continue}console.warn("Can't adhere to given 'min' range, due to zeroalign")}this.autoScaleStart&&this.autoScaleEnd&&ue.x?1:-1})):this.itemsData=[]},o.prototype.getItems=function(){return this.itemsData},o.prototype.setZeroPosition=function(t){this.zeroPosition=t},o.prototype.setOptions=function(t){if(void 0!==t){var e=["sampling","style","sort","yAxisOrientation","barChart","zIndex","excludeFromStacking","excludeFromLegend"];r.selectiveDeepExtend(e,this.options,t),"function"==typeof t.drawPoints&&(t.drawPoints={onRender:t.drawPoints}),r.mergeOptions(this.options,t,"interpolation"),r.mergeOptions(this.options,t,"drawPoints"),r.mergeOptions(this.options,t,"shaded"),t.interpolation&&"object"==(0,s.default)(t.interpolation)&&t.interpolation.parametrization&&("uniform"==t.interpolation.parametrization?this.options.interpolation.alpha=0:"chordal"==t.interpolation.parametrization?this.options.interpolation.alpha=1:(this.options.interpolation.parametrization="centripetal",this.options.interpolation.alpha=.5))}},o.prototype.update=function(t){this.group=t,this.content=t.content||"graph",this.className=t.className||this.className||"vis-graph-group"+this.groupsUsingDefaultStyles[0]%10,this.visible=void 0===t.visible||t.visible,this.style=t.style,this.setOptions(t.options)},o.prototype.getLegend=function(t,e,i,o,n){if(void 0==i||null==i){i={svg:document.createElementNS("http://www.w3.org/2000/svg","svg"),svgElements:{},options:this.options,groups:[this]}}switch(void 0!=o&&null!=o||(o=0),void 0!=n&&null!=n||(n=.5*e),this.options.style){case"line":h.drawIcon(this,o,n,t,e,i);break;case"points":case"point":d.drawIcon(this,o,n,t,e,i);break;case"bar":a.drawIcon(this,o,n,t,e,i)}return{icon:i.svg,label:this.content,orientation:this.options.yAxisOrientation}},o.prototype.getYRange=function(t){for(var e=t[0].y,i=t[0].y,o=0;ot[o].y?t[o].y:e,i=i0&&(i=Math.min(i,Math.abs(e[o-1].screen_x-e[o].screen_x))),0===i&&(void 0===t[e[o].screen_x]&&(t[e[o].screen_x]={amount:0,resolved:0,accumulatedPositive:0,accumulatedNegative:0}),t[e[o].screen_x].amount+=1)},o._getSafeDrawData=function(t,e,i){var o,n;return t0?(o=t0){t.sort(function(t,e){return t.screen_x===e.screen_x?t.groupIde[s].screen_y?e[s].screen_y:o,n=nt[r].accumulatedNegative?t[r].accumulatedNegative:o,o=o>t[r].accumulatedPositive?t[r].accumulatedPositive:o,n=n0){return 1==e.options.interpolation.enabled?o._catmullRom(t,e):o._linear(t)}},o.drawIcon=function(t,e,i,o,s,r){var a,h,d=.5*s,l=n.getSVGElement("rect",r.svgElements,r.svg);if(l.setAttributeNS(null,"x",e),l.setAttributeNS(null,"y",i-d),l.setAttributeNS(null,"width",o),l.setAttributeNS(null,"height",2*d),l.setAttributeNS(null,"class","vis-outline"),a=n.getSVGElement("path",r.svgElements,r.svg),a.setAttributeNS(null,"class",t.className),void 0!==t.style&&a.setAttributeNS(null,"style",t.style),a.setAttributeNS(null,"d","M"+e+","+i+" L"+(e+o)+","+i),1==t.options.shaded.enabled&&(h=n.getSVGElement("path",r.svgElements,r.svg),"top"==t.options.shaded.orientation?h.setAttributeNS(null,"d","M"+e+", "+(i-d)+"L"+e+","+i+" L"+(e+o)+","+i+" L"+(e+o)+","+(i-d)):h.setAttributeNS(null,"d","M"+e+","+i+" L"+e+","+(i+d)+" L"+(e+o)+","+(i+d)+"L"+(e+o)+","+i),h.setAttributeNS(null,"class",t.className+" vis-icon-fill"),void 0!==t.options.shaded.style&&""!==t.options.shaded.style&&h.setAttributeNS(null,"style",t.options.shaded.style)),1==t.options.drawPoints.enabled){var u={style:t.options.drawPoints.style,styles:t.options.drawPoints.styles,size:t.options.drawPoints.size,className:t.className};n.drawPoint(e+.5*o,i,u,r.svgElements,r.svg)}},o.drawShading=function(t,e,i,o){if(1==e.options.shaded.enabled){var s=Number(o.svg.style.height.replace("px","")),r=n.getSVGElement("path",o.svgElements,o.svg),a="L";1==e.options.interpolation.enabled&&(a="C");var h,d=0;d="top"==e.options.shaded.orientation?0:"bottom"==e.options.shaded.orientation?s:Math.min(Math.max(0,e.zeroPosition),s),h="group"==e.options.shaded.orientation&&null!=i&&void 0!=i?"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" L"+i[i.length-1][0]+","+i[i.length-1][1]+" "+this.serializePath(i,a,!0)+i[0][0]+","+i[0][1]+" Z":"M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,a,!1)+" V"+d+" H"+t[0][0]+" Z",r.setAttributeNS(null,"class",e.className+" vis-fill"),void 0!==e.options.shaded.style&&r.setAttributeNS(null,"style",e.options.shaded.style),r.setAttributeNS(null,"d",h)}},o.draw=function(t,e,i){if(null!=t&&void 0!=t){var o=n.getSVGElement("path",i.svgElements,i.svg);o.setAttributeNS(null,"class",e.className),void 0!==e.style&&o.setAttributeNS(null,"style",e.style);var s="L";1==e.options.interpolation.enabled&&(s="C"),o.setAttributeNS(null,"d","M"+t[0][0]+","+t[0][1]+" "+this.serializePath(t,s,!1))}},o.serializePath=function(t,e,i){if(t.length<2)return"";var o,n=e;if(i)for(o=t.length-2;o>0;o--)n+=t[o][0]+","+t[o][1]+" ";else for(o=1;o0&&(m=1/m),f=3*g*(g+v),f>0&&(f=1/f),a={screen_x:(-b*o.screen_x+p*n.screen_x+_*s.screen_x)*m,screen_y:(-b*o.screen_y+p*n.screen_y+_*s.screen_y)*m},h={screen_x:(y*n.screen_x+c*s.screen_x-b*r.screen_x)*f,screen_y:(y*n.screen_y+c*s.screen_y-b*r.screen_y)*f},0==a.screen_x&&0==a.screen_y&&(a=n),0==h.screen_x&&0==h.screen_y&&(h=s),x.push([a.screen_x,a.screen_y]),x.push([h.screen_x,h.screen_y]),x.push([s.screen_x,s.screen_y]);return x},o._linear=function(t){for(var e=[],i=0;i");this.dom.textArea.innerHTML=r,this.dom.textArea.style.lineHeight=.75*this.options.iconSize+this.options.iconSpacing+"px"}},o.prototype.drawLegendIcons=function(){if(this.dom.frame.parentNode){var t=(0,s.default)(this.groups);t.sort(function(t,e){return t=t.length?(this._t=void 0,n(1)):"keys"==e?n(0,i):"values"==e?n(0,t[i]):n(0,[i,t[i]])},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,i){var o=i(33);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==o(t)?t.split(""):Object(t)}},function(t,e,i){var o=i(93);t.exports=function(t,e,i){if(o(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,o){return t.call(e,i,o)};case 3:return function(i,o,n){return t.call(e,i,o,n)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var o=i(37),n=i(25),s=i(42),r={};i(14)(r,i(7)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=o(r,{next:n(1,i)}),s(t,e+" Iterator")}},function(t,e,i){var o=i(8),n=i(18),s=i(26);t.exports=i(9)?Object.defineProperties:function(t,e){n(t);for(var i,r=s(e),a=r.length,h=0;a>h;)o.f(t,i=r[h++],e[i]);return t}},function(t,e,i){var o=i(13),n=i(97),s=i(98);t.exports=function(t){return function(e,i,r){var a,h=o(e),d=n(h.length),l=s(r,d);if(t&&i!=i){for(;d>l;)if((a=h[l++])!=a)return!0}else for(;d>l;l++)if((t||l in h)&&h[l]===i)return t||l||0;return!t&&-1}}},function(t,e,i){var o=i(38),n=Math.min;t.exports=function(t){return t>0?n(o(t),9007199254740991):0}},function(t,e,i){var o=i(38),n=Math.max,s=Math.min;t.exports=function(t,e){return t=o(t),t<0?n(t+e,0):s(t,e)}},function(t,e,i){var o=i(6).document;t.exports=o&&o.documentElement},function(t,e,i){var o=i(10),n=i(61),s=i(39)("IE_PROTO"),r=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=n(t),o(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?r:null}},function(t,e,i){var o=i(38),n=i(34);t.exports=function(t){return function(e,i){var s,r,a=String(n(e)),h=o(i),d=a.length;return h<0||h>=d?t?"":void 0:(s=a.charCodeAt(h),s<55296||s>56319||h+1===d||(r=a.charCodeAt(h+1))<56320||r>57343?t?a.charAt(h):s:t?a.slice(h,h+2):r-56320+(s-55296<<10)+65536)}}},function(t,e,i){var o=i(18),n=i(103);t.exports=i(2).getIterator=function(t){var e=n(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return o(e.call(t))}},function(t,e,i){var o=i(104),n=i(7)("iterator"),s=i(23);t.exports=i(2).getIteratorMethod=function(t){if(void 0!=t)return t[n]||t["@@iterator"]||s[o(t)]}},function(t,e,i){var o=i(33),n=i(7)("toStringTag"),s="Arguments"==o(function(){return arguments}()),r=function(t,e){try{return t[e]}catch(t){}};t.exports=function(t){var e,i,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=r(e=Object(t),n))?i:s?o(e):"Object"==(a=o(e))&&"function"==typeof e.callee?"Arguments":a}},function(t,e,i){i(106);var o=i(2).Object;t.exports=function(t,e){return o.create(t,e)}},function(t,e,i){var o=i(17);o(o.S,"Object",{create:i(37)})},function(t,e,i){i(108),t.exports=i(2).Object.keys},function(t,e,i){var o=i(61),n=i(26);i(109)("keys",function(){return function(t){return n(o(t))}})},function(t,e,i){var o=i(17),n=i(2),s=i(19);t.exports=function(t,e){var i=(n.Object||{})[t]||Object[t],r={};r[t]=e(i),o(o.S+o.F*s(function(){i(1)}),"Object",r)}},function(t,e,i){t.exports={default:i(111),__esModule:!0}},function(t,e,i){i(62),i(55),t.exports=i(44).f("iterator")},function(t,e,i){t.exports={default:i(113),__esModule:!0}},function(t,e,i){i(114),i(120),i(121),i(122),t.exports=i(2).Symbol},function(t,e,i){var o=i(6),n=i(10),s=i(9),r=i(17),a=i(59),h=i(115).KEY,d=i(19),l=i(40),u=i(42),p=i(27),c=i(7),m=i(44),f=i(45),g=i(116),v=i(117),y=i(18),b=i(13),_=i(36),w=i(25),x=i(37),D=i(118),S=i(119),k=i(8),C=i(26),T=S.f,M=k.f,O=D.f,E=o.Symbol,P=o.JSON,I=P&&P.stringify,N=c("_hidden"),A=c("toPrimitive"),R={}.propertyIsEnumerable,L=l("symbol-registry"),F=l("symbols"),H=l("op-symbols"),j=Object.prototype,Y="function"==typeof E,G=o.QObject,z=!G||!G.prototype||!G.prototype.findChild,W=s&&d(function(){return 7!=x(M({},"a",{get:function(){return M(this,"a",{value:7}).a}})).a})?function(t,e,i){var o=T(j,e);o&&delete j[e],M(t,e,i),o&&t!==j&&M(j,e,o)}:M,V=function(t){var e=F[t]=x(E.prototype);return e._k=t,e},B=Y&&"symbol"==typeof E.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof E},U=function(t,e,i){return t===j&&U(H,e,i),y(t),e=_(e,!0),y(i),n(F,e)?(i.enumerable?(n(t,N)&&t[N][e]&&(t[N][e]=!1),i=x(i,{enumerable:w(0,!1)})):(n(t,N)||M(t,N,w(1,{})),t[N][e]=!0),W(t,e,i)):M(t,e,i)},q=function(t,e){y(t);for(var i,o=g(e=b(e)),n=0,s=o.length;s>n;)U(t,i=o[n++],e[i]);return t},X=function(t,e){return void 0===e?x(t):q(x(t),e)},Z=function(t){var e=R.call(this,t=_(t,!0));return!(this===j&&n(F,t)&&!n(H,t))&&(!(e||!n(this,t)||!n(F,t)||n(this,N)&&this[N][t])||e)},K=function(t,e){if(t=b(t),e=_(e,!0),t!==j||!n(F,e)||n(H,e)){var i=T(t,e);return!i||!n(F,e)||n(t,N)&&t[N][e]||(i.enumerable=!0),i}},J=function(t){for(var e,i=O(b(t)),o=[],s=0;i.length>s;)n(F,e=i[s++])||e==N||e==h||o.push(e);return o},$=function(t){for(var e,i=t===j,o=O(i?H:b(t)),s=[],r=0;o.length>r;)!n(F,e=o[r++])||i&&!n(j,e)||s.push(F[e]);return s};Y||(E=function(){if(this instanceof E)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),e=function(i){this===j&&e.call(H,i),n(this,N)&&n(this[N],t)&&(this[N][t]=!1),W(this,t,w(1,i))};return s&&z&&W(j,t,{configurable:!0,set:e}),V(t)},a(E.prototype,"toString",function(){return this._k}),S.f=K,k.f=U,i(64).f=D.f=J,i(46).f=Z,i(63).f=$,s&&!i(35)&&a(j,"propertyIsEnumerable",Z,!0),m.f=function(t){return V(c(t))}),r(r.G+r.W+r.F*!Y,{Symbol:E});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Q.length>tt;)c(Q[tt++]);for(var et=C(c.store),it=0;et.length>it;)f(et[it++]);r(r.S+r.F*!Y,"Symbol",{for:function(t){return n(L,t+="")?L[t]:L[t]=E(t)},keyFor:function(t){if(!B(t))throw TypeError(t+" is not a symbol!");for(var e in L)if(L[e]===t)return e},useSetter:function(){z=!0},useSimple:function(){z=!1}}),r(r.S+r.F*!Y,"Object",{create:X,defineProperty:U,defineProperties:q,getOwnPropertyDescriptor:K,getOwnPropertyNames:J,getOwnPropertySymbols:$}),P&&r(r.S+r.F*(!Y||d(function(){var t=E();return"[null]"!=I([t])||"{}"!=I({a:t})||"{}"!=I(Object(t))})),"JSON",{stringify:function(t){if(void 0!==t&&!B(t)){for(var e,i,o=[t],n=1;arguments.length>n;)o.push(arguments[n++]);return e=o[1],"function"==typeof e&&(i=e),!i&&v(e)||(e=function(t,e){if(i&&(e=i.call(this,t,e)),!B(e))return e}),o[1]=e,I.apply(P,o)}}}),E.prototype[A]||i(14)(E.prototype,A,E.prototype.valueOf),u(E,"Symbol"),u(Math,"Math",!0),u(o.JSON,"JSON",!0)},function(t,e,i){var o=i(27)("meta"),n=i(24),s=i(10),r=i(8).f,a=0,h=Object.isExtensible||function(){return!0},d=!i(19)(function(){return h(Object.preventExtensions({}))}),l=function(t){r(t,o,{value:{i:"O"+ ++a,w:{}}})},u=function(t,e){if(!n(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!s(t,o)){if(!h(t))return"F";if(!e)return"E";l(t)}return t[o].i},p=function(t,e){if(!s(t,o)){if(!h(t))return!0;if(!e)return!1;l(t)}return t[o].w},c=function(t){return d&&m.NEED&&h(t)&&!s(t,o)&&l(t),t},m=t.exports={KEY:o,NEED:!1,fastKey:u,getWeak:p,onFreeze:c}},function(t,e,i){var o=i(26),n=i(63),s=i(46);t.exports=function(t){var e=o(t),i=n.f;if(i)for(var r,a=i(t),h=s.f,d=0;a.length>d;)h.call(t,r=a[d++])&&e.push(r);return e}},function(t,e,i){var o=i(33);t.exports=Array.isArray||function(t){return"Array"==o(t)}},function(t,e,i){var o=i(13),n=i(64).f,s={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return n(t)}catch(t){return r.slice()}};t.exports.f=function(t){return r&&"[object Window]"==s.call(t)?a(t):n(o(t))}},function(t,e,i){var o=i(46),n=i(25),s=i(13),r=i(36),a=i(10),h=i(57),d=Object.getOwnPropertyDescriptor;e.f=i(9)?d:function(t,e){if(t=s(t),e=r(e,!0),h)try{return d(t,e)}catch(t){}if(a(t,e))return n(!o.f.call(t,e),t[e])}},function(t,e){},function(t,e,i){i(45)("asyncIterator")},function(t,e,i){i(45)("observable")},function(t,e,i){(function(t){!function(e,i){t.exports=i()}(0,function(){function e(){return To.apply(null,arguments)}function i(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function o(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function n(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0}function s(t){return void 0===t}function r(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function a(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function h(t,e){var i,o=[];for(i=0;i0)for(i=0;i0?"future":"past"];return k(i)?i(e):i.replace(/%s/i,e)}function R(t,e){var i=t.toLowerCase();Fo[i]=Fo[i+"s"]=Fo[e]=t}function L(t){return"string"==typeof t?Fo[t]||Fo[t.toLowerCase()]:void 0}function F(t){var e,i,o={};for(i in t)d(t,i)&&(e=L(i))&&(o[e]=t[i]);return o}function H(t,e){Ho[t]=e}function j(t){var e=[];for(var i in t)e.push({unit:i,priority:Ho[i]});return e.sort(function(t,e){return t.priority-e.priority}),e}function Y(t,e,i){var o=""+Math.abs(t),n=e-o.length;return(t>=0?i?"+":"":"-")+Math.pow(10,Math.max(0,n)).toString().substr(1)+o}function G(t,e,i,o){var n=o;"string"==typeof o&&(n=function(){return this[o]()}),t&&(zo[t]=n),e&&(zo[e[0]]=function(){return Y(n.apply(this,arguments),e[1],e[2])}),i&&(zo[i]=function(){return this.localeData().ordinal(n.apply(this,arguments),t)})}function z(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function W(t){var e,i,o=t.match(jo);for(e=0,i=o.length;e=0&&Yo.test(t);)t=t.replace(Yo,i),Yo.lastIndex=0,o-=1;return t}function U(t,e,i){an[t]=k(e)?e:function(t,o){return t&&i?i:e}}function q(t,e){return d(an,t)?an[t](e._strict,e._locale):new RegExp(X(t))}function X(t){return Z(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,i,o,n){return e||i||o||n}))}function Z(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function K(t,e){var i,o=e;for("string"==typeof t&&(t=[t]),r(e)&&(o=function(t,i){i[e]=_(t)}),i=0;i=0&&isFinite(a.getFullYear())&&a.setFullYear(t),a}function _t(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function wt(t,e,i){var o=7+e-i;return-(7+_t(t,0,o).getUTCDay()-e)%7+o-1}function xt(t,e,i,o,n){var s,r,a=(7+i-o)%7,h=wt(t,o,n),d=1+7*(e-1)+a+h;return d<=0?(s=t-1,r=Q(s)+d):d>Q(t)?(s=t+1,r=d-Q(t)):(s=t,r=d),{year:s,dayOfYear:r}}function Dt(t,e,i){var o,n,s=wt(t.year(),e,i),r=Math.floor((t.dayOfYear()-s-1)/7)+1;return r<1?(n=t.year()-1,o=r+St(n,e,i)):r>St(t.year(),e,i)?(o=r-St(t.year(),e,i),n=t.year()+1):(n=t.year(),o=r),{week:o,year:n}}function St(t,e,i){var o=wt(t,e,i),n=wt(t+1,e,i);return(Q(t)-o+n)/7}function kt(t){return Dt(t,this._week.dow,this._week.doy).week}function Ct(){return this._week.dow}function Tt(){return this._week.doy}function Mt(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function Ot(t){var e=Dt(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function Et(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Pt(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function It(t,e){return t?i(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:i(this._weekdays)?this._weekdays:this._weekdays.standalone}function Nt(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort}function At(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Rt(t,e,i){var o,n,s,r=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)s=u([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(s,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(s,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(s,"").toLocaleLowerCase();return i?"dddd"===e?(n=yn.call(this._weekdaysParse,r),-1!==n?n:null):"ddd"===e?(n=yn.call(this._shortWeekdaysParse,r),-1!==n?n:null):(n=yn.call(this._minWeekdaysParse,r),-1!==n?n:null):"dddd"===e?-1!==(n=yn.call(this._weekdaysParse,r))?n:-1!==(n=yn.call(this._shortWeekdaysParse,r))?n:(n=yn.call(this._minWeekdaysParse,r),-1!==n?n:null):"ddd"===e?-1!==(n=yn.call(this._shortWeekdaysParse,r))?n:-1!==(n=yn.call(this._weekdaysParse,r))?n:(n=yn.call(this._minWeekdaysParse,r),-1!==n?n:null):-1!==(n=yn.call(this._minWeekdaysParse,r))?n:-1!==(n=yn.call(this._weekdaysParse,r))?n:(n=yn.call(this._shortWeekdaysParse,r),-1!==n?n:null)}function Lt(t,e,i){var o,n,s;if(this._weekdaysParseExact)return Rt.call(this,t,e,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(n=u([2e3,1]).day(o),i&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(n,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(n,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(n,"").replace(".",".?")+"$","i")),this._weekdaysParse[o]||(s="^"+this.weekdays(n,"")+"|^"+this.weekdaysShort(n,"")+"|^"+this.weekdaysMin(n,""),this._weekdaysParse[o]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===e&&this._fullWeekdaysParse[o].test(t))return o;if(i&&"ddd"===e&&this._shortWeekdaysParse[o].test(t))return o;if(i&&"dd"===e&&this._minWeekdaysParse[o].test(t))return o;if(!i&&this._weekdaysParse[o].test(t))return o}}function Ft(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=Et(t,this.localeData()),this.add(t-e,"d")):e}function Ht(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function jt(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Pt(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function Yt(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Wt.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=On),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Gt(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Wt.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=En),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function zt(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Wt.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Pn),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Wt(){function t(t,e){return e.length-t.length}var e,i,o,n,s,r=[],a=[],h=[],d=[];for(e=0;e<7;e++)i=u([2e3,1]).day(e),o=this.weekdaysMin(i,""),n=this.weekdaysShort(i,""),s=this.weekdays(i,""),r.push(o),a.push(n),h.push(s),d.push(o),d.push(n),d.push(s);for(r.sort(t),a.sort(t),h.sort(t),d.sort(t),e=0;e<7;e++)a[e]=Z(a[e]),h[e]=Z(h[e]),d[e]=Z(d[e]);this._weekdaysRegex=new RegExp("^("+d.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Vt(){return this.hours()%12||12}function Bt(){return this.hours()||24}function Ut(t,e){G(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function qt(t,e){return e._meridiemParse}function Xt(t){return"p"===(t+"").toLowerCase().charAt(0)}function Zt(t,e,i){return t>11?i?"pm":"PM":i?"am":"AM"}function Kt(t){return t?t.toLowerCase().replace("_","-"):t}function Jt(t){for(var e,i,o,n,s=0;s0;){if(o=$t(n.slice(0,e).join("-")))return o;if(i&&i.length>=e&&w(n,i,!0)>=e-1)break;e--}s++}return null}function $t(e){var i=null;if(!Ln[e]&&void 0!==t&&t&&t.exports)try{i=In._abbr;!function(){var t=new Error('Cannot find module "./locale"');throw t.code="MODULE_NOT_FOUND",t}(),Qt(i)}catch(t){}return Ln[e]}function Qt(t,e){var i;return t&&(i=s(e)?ie(t):te(t,e))&&(In=i),In._abbr}function te(t,e){if(null!==e){var i=Rn;if(e.abbr=t,null!=Ln[t])S("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=Ln[t]._config;else if(null!=e.parentLocale){if(null==Ln[e.parentLocale])return Fn[e.parentLocale]||(Fn[e.parentLocale]=[]),Fn[e.parentLocale].push({name:t,config:e}),null;i=Ln[e.parentLocale]._config}return Ln[t]=new M(T(i,e)),Fn[t]&&Fn[t].forEach(function(t){te(t.name,t.config)}),Qt(t),Ln[t]}return delete Ln[t],null}function ee(t,e){if(null!=e){var i,o=Rn;null!=Ln[t]&&(o=Ln[t]._config),e=T(o,e),i=new M(e),i.parentLocale=Ln[t],Ln[t]=i,Qt(t)}else null!=Ln[t]&&(null!=Ln[t].parentLocale?Ln[t]=Ln[t].parentLocale:null!=Ln[t]&&delete Ln[t]);return Ln[t]}function ie(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return In;if(!i(t)){if(e=$t(t))return e;t=[t]}return Jt(t)}function oe(){return Io(Ln)}function ne(t){var e,i=t._a;return i&&-2===c(t).overflow&&(e=i[ln]<0||i[ln]>11?ln:i[un]<1||i[un]>ht(i[dn],i[ln])?un:i[pn]<0||i[pn]>24||24===i[pn]&&(0!==i[cn]||0!==i[mn]||0!==i[fn])?pn:i[cn]<0||i[cn]>59?cn:i[mn]<0||i[mn]>59?mn:i[fn]<0||i[fn]>999?fn:-1,c(t)._overflowDayOfYear&&(eun)&&(e=un),c(t)._overflowWeeks&&-1===e&&(e=gn),c(t)._overflowWeekday&&-1===e&&(e=vn),c(t).overflow=e),t}function se(t,e,i){return null!=t?t:null!=e?e:i}function re(t){var i=new Date(e.now());return t._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function ae(t){var e,i,o,n,s=[];if(!t._d){for(o=re(t),t._w&&null==t._a[un]&&null==t._a[ln]&&he(t),null!=t._dayOfYear&&(n=se(t._a[dn],o[dn]),(t._dayOfYear>Q(n)||0===t._dayOfYear)&&(c(t)._overflowDayOfYear=!0),i=_t(n,0,t._dayOfYear),t._a[ln]=i.getUTCMonth(),t._a[un]=i.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=s[e]=o[e];for(;e<7;e++)t._a[e]=s[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[pn]&&0===t._a[cn]&&0===t._a[mn]&&0===t._a[fn]&&(t._nextDay=!0,t._a[pn]=0),t._d=(t._useUTC?_t:bt).apply(null,s),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[pn]=24),t._w&&void 0!==t._w.d&&t._w.d!==t._d.getDay()&&(c(t).weekdayMismatch=!0)}}function he(t){var e,i,o,n,s,r,a,h;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)s=1,r=4,i=se(e.GG,t._a[dn],Dt(ke(),1,4).year),o=se(e.W,1),((n=se(e.E,1))<1||n>7)&&(h=!0);else{s=t._locale._week.dow,r=t._locale._week.doy;var d=Dt(ke(),s,r);i=se(e.gg,t._a[dn],d.year),o=se(e.w,d.week),null!=e.d?((n=e.d)<0||n>6)&&(h=!0):null!=e.e?(n=e.e+s,(e.e<0||e.e>6)&&(h=!0)):n=s}o<1||o>St(i,s,r)?c(t)._overflowWeeks=!0:null!=h?c(t)._overflowWeekday=!0:(a=xt(i,o,n,s,r),t._a[dn]=a.year,t._dayOfYear=a.dayOfYear)}function de(t){var e,i,o,n,s,r,a=t._i,h=Hn.exec(a)||jn.exec(a);if(h){for(c(t).iso=!0,e=0,i=Gn.length;e0&&c(t).unusedInput.push(r),a=a.slice(a.indexOf(o)+o.length),d+=o.length),zo[s]?(o?c(t).empty=!1:c(t).unusedTokens.push(s),$(s,o,t)):t._strict&&!o&&c(t).unusedTokens.push(s);c(t).charsLeftOver=h-d,a.length>0&&c(t).unusedInput.push(a),t._a[pn]<=12&&!0===c(t).bigHour&&t._a[pn]>0&&(c(t).bigHour=void 0),c(t).parsedDateParts=t._a.slice(0),c(t).meridiem=t._meridiem,t._a[pn]=ye(t._locale,t._a[pn],t._meridiem),ae(t),ne(t)}function ye(t,e,i){var o;return null==i?e:null!=t.meridiemHour?t.meridiemHour(e,i):null!=t.isPM?(o=t.isPM(i),o&&e<12&&(e+=12),o||12!==e||(e=0),e):e}function be(t){var e,i,o,n,s;if(0===t._f.length)return c(t).invalidFormat=!0,void(t._d=new Date(NaN));for(n=0;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ue(){if(!s(this._isDSTShifted))return this._isDSTShifted;var t={};if(g(t,this),t=xe(t),t._a){var e=t._isUTC?u(t._a):ke(t._a);this._isDSTShifted=this.isValid()&&w(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function qe(){return!!this.isValid()&&!this._isUTC}function Xe(){return!!this.isValid()&&this._isUTC}function Ze(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ke(t,e){var i,o,n,s=t,a=null;return Ne(t)?s={ms:t._milliseconds,d:t._days,M:t._months}:r(t)?(s={},e?s[e]=t:s.milliseconds=t):(a=Jn.exec(t))?(i="-"===a[1]?-1:1,s={y:0,d:_(a[un])*i,h:_(a[pn])*i,m:_(a[cn])*i,s:_(a[mn])*i,ms:_(Ae(1e3*a[fn]))*i}):(a=$n.exec(t))?(i="-"===a[1]?-1:(a[1],1),s={y:Je(a[2],i),M:Je(a[3],i),w:Je(a[4],i),d:Je(a[5],i),h:Je(a[6],i),m:Je(a[7],i),s:Je(a[8],i)}):null==s?s={}:"object"==typeof s&&("from"in s||"to"in s)&&(n=Qe(ke(s.from),ke(s.to)),s={},s.ms=n.milliseconds,s.M=n.months),o=new Ie(s),Ne(t)&&d(t,"_locale")&&(o._locale=t._locale),o}function Je(t,e){var i=t&&parseFloat(t.replace(",","."));return(isNaN(i)?0:i)*e}function $e(t,e){var i={milliseconds:0,months:0};return i.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(i.months,"M").isAfter(e)&&--i.months,i.milliseconds=+e-+t.clone().add(i.months,"M"),i}function Qe(t,e){var i;return t.isValid()&&e.isValid()?(e=Fe(e,t),t.isBefore(e)?i=$e(t,e):(i=$e(e,t),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function ti(t,e){return function(i,o){var n,s;return null===o||isNaN(+o)||(S(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=i,i=o,o=s),i="string"==typeof i?+i:i,n=Ke(i,o),ei(this,n,t),this}}function ei(t,i,o,n){var s=i._milliseconds,r=Ae(i._days),a=Ae(i._months);t.isValid()&&(n=null==n||n,a&&ct(t,ot(t,"Month")+a*o),r&&nt(t,"Date",ot(t,"Date")+r*o),s&&t._d.setTime(t._d.valueOf()+s*o),n&&e.updateOffset(t,r||a))}function ii(t,e){var i=t.diff(e,"days",!0);return i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse"}function oi(t,i){var o=t||ke(),n=Fe(o,this).startOf("day"),s=e.calendarFormat(this,n)||"sameElse",r=i&&(k(i[s])?i[s].call(this,o):i[s]);return this.format(r||this.localeData().calendar(s,this,ke(o)))}function ni(){return new v(this)}function si(t,e){var i=y(t)?t:ke(t);return!(!this.isValid()||!i.isValid())&&(e=L(s(e)?"millisecond":e),"millisecond"===e?this.valueOf()>i.valueOf():i.valueOf()9999?V(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):k(Date.prototype.toISOString)?this.toDate().toISOString():V(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function fi(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var i="["+t+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=e+'[")]';return this.format(i+o+"-MM-DD[T]HH:mm:ss.SSS"+n)}function gi(t){t||(t=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var i=V(this,t);return this.localeData().postformat(i)}function vi(t,e){return this.isValid()&&(y(t)&&t.isValid()||ke(t).isValid())?Ke({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function yi(t){return this.from(ke(),t)}function bi(t,e){return this.isValid()&&(y(t)&&t.isValid()||ke(t).isValid())?Ke({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function _i(t){return this.to(ke(),t)}function wi(t){var e;return void 0===t?this._locale._abbr:(e=ie(t),null!=e&&(this._locale=e),this)}function xi(){return this._locale}function Di(t){switch(t=L(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function Si(t){return void 0===(t=L(t))||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function ki(){return this._d.valueOf()-6e4*(this._offset||0)}function Ci(){return Math.floor(this.valueOf()/1e3)}function Ti(){return new Date(this.valueOf())}function Mi(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function Oi(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function Ei(){return this.isValid()?this.toISOString():null}function Pi(){return m(this)}function Ii(){return l({},c(this))}function Ni(){return c(this).overflow}function Ai(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Ri(t,e){G(0,[t,t.length],0,e)}function Li(t){return Yi.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Fi(t){return Yi.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function Hi(){return St(this.year(),1,4)}function ji(){var t=this.localeData()._week;return St(this.year(),t.dow,t.doy)}function Yi(t,e,i,o,n){var s;return null==t?Dt(this,o,n).year:(s=St(t,o,n),e>s&&(e=s),Gi.call(this,t,e,i,o,n))}function Gi(t,e,i,o,n){var s=xt(t,e,i,o,n),r=_t(s.year,0,s.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}function zi(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Wi(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Vi(t,e){e[fn]=_(1e3*("0."+t))}function Bi(){return this._isUTC?"UTC":""}function Ui(){return this._isUTC?"Coordinated Universal Time":""}function qi(t){return ke(1e3*t)}function Xi(){return ke.apply(null,arguments).parseZone()}function Zi(t){return t}function Ki(t,e,i,o){var n=ie(),s=u().set(o,e);return n[i](s,t)}function Ji(t,e,i){if(r(t)&&(e=t,t=void 0),t=t||"",null!=e)return Ki(t,e,i,"month");var o,n=[];for(o=0;o<12;o++)n[o]=Ki(t,o,i,"month");return n}function $i(t,e,i,o){"boolean"==typeof t?(r(e)&&(i=e,e=void 0),e=e||""):(e=t,i=e,t=!1,r(e)&&(i=e,e=void 0),e=e||"");var n=ie(),s=t?n._week.dow:0;if(null!=i)return Ki(e,(i+s)%7,o,"day");var a,h=[];for(a=0;a<7;a++)h[a]=Ki(e,(a+s)%7,o,"day");return h}function Qi(t,e){return Ji(t,e,"months")}function to(t,e){return Ji(t,e,"monthsShort")}function eo(t,e,i){return $i(t,e,i,"weekdays")}function io(t,e,i){return $i(t,e,i,"weekdaysShort")}function oo(t,e,i){return $i(t,e,i,"weekdaysMin")}function no(){var t=this._data;return this._milliseconds=ds(this._milliseconds),this._days=ds(this._days),this._months=ds(this._months),t.milliseconds=ds(t.milliseconds),t.seconds=ds(t.seconds),t.minutes=ds(t.minutes),t.hours=ds(t.hours),t.months=ds(t.months),t.years=ds(t.years),this}function so(t,e,i,o){var n=Ke(e,i);return t._milliseconds+=o*n._milliseconds,t._days+=o*n._days,t._months+=o*n._months,t._bubble()}function ro(t,e){return so(this,t,e,1)}function ao(t,e){return so(this,t,e,-1)}function ho(t){return t<0?Math.floor(t):Math.ceil(t)}function lo(){var t,e,i,o,n,s=this._milliseconds,r=this._days,a=this._months,h=this._data;return s>=0&&r>=0&&a>=0||s<=0&&r<=0&&a<=0||(s+=864e5*ho(po(a)+r),r=0,a=0),h.milliseconds=s%1e3,t=b(s/1e3),h.seconds=t%60,e=b(t/60),h.minutes=e%60,i=b(e/60),h.hours=i%24,r+=b(i/24),n=b(uo(r)),a+=n,r-=ho(po(n)),o=b(a/12),a%=12,h.days=r,h.months=a,h.years=o,this}function uo(t){return 4800*t/146097}function po(t){return 146097*t/4800}function co(t){if(!this.isValid())return NaN;var e,i,o=this._milliseconds;if("month"===(t=L(t))||"year"===t)return e=this._days+o/864e5,i=this._months+uo(e),"month"===t?i:i/12;switch(e=this._days+Math.round(po(this._months)),t){case"week":return e/7+o/6048e5;case"day":return e+o/864e5;case"hour":return 24*e+o/36e5;case"minute":return 1440*e+o/6e4;case"second":return 86400*e+o/1e3;case"millisecond":return Math.floor(864e5*e)+o;default:throw new Error("Unknown unit "+t)}}function mo(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12):NaN}function fo(t){return function(){return this.as(t)}}function go(){return Ke(this)}function vo(t){return t=L(t),this.isValid()?this[t+"s"]():NaN}function yo(t){return function(){return this.isValid()?this._data[t]:NaN}}function bo(){return b(this.days()/7)}function _o(t,e,i,o,n){return n.relativeTime(e||1,!!i,t,o)}function wo(t,e,i){var o=Ke(t).abs(),n=ks(o.as("s")),s=ks(o.as("m")),r=ks(o.as("h")),a=ks(o.as("d")),h=ks(o.as("M")),d=ks(o.as("y")),l=n<=Cs.ss&&["s",n]||n0,l[4]=i,_o.apply(null,l)}function xo(t){return void 0===t?ks:"function"==typeof t&&(ks=t,!0)}function Do(t,e){return void 0!==Cs[t]&&(void 0===e?Cs[t]:(Cs[t]=e,"s"===t&&(Cs.ss=e-1),!0))}function So(t){if(!this.isValid())return this.localeData().invalidDate();var e=this.localeData(),i=wo(this,!t,e);return t&&(i=e.pastFuture(+this,i)),e.postformat(i)}function ko(t){return(t>0)-(t<0)||+t}function Co(){if(!this.isValid())return this.localeData().invalidDate();var t,e,i,o=Ts(this._milliseconds)/1e3,n=Ts(this._days),s=Ts(this._months);t=b(o/60),e=b(t/60),o%=60,t%=60,i=b(s/12),s%=12;var r=i,a=s,h=n,d=e,l=t,u=o?o.toFixed(3).replace(/\.?0+$/,""):"",p=this.asSeconds();if(!p)return"P0D";var c=p<0?"-":"",m=ko(this._months)!==ko(p)?"-":"",f=ko(this._days)!==ko(p)?"-":"",g=ko(this._milliseconds)!==ko(p)?"-":"";return c+"P"+(r?m+r+"Y":"")+(a?m+a+"M":"")+(h?f+h+"D":"")+(d||l||u?"T":"")+(d?g+d+"H":"")+(l?g+l+"M":"")+(u?g+u+"S":"")}var To,Mo;Mo=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),i=e.length>>>0,o=0;o68?1900:2e3)};var yn,bn=it("FullYear",!0);yn=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;ethis?this:t:f()}),Xn=function(){return Date.now?Date.now():+new Date},Zn=["year","quarter","month","week","day","hour","minute","second","millisecond"];Re("Z",":"),Re("ZZ",""),U("Z",nn),U("ZZ",nn),K(["Z","ZZ"],function(t,e,i){i._useUTC=!0,i._tzm=Le(nn,t)});var Kn=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var Jn=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,$n=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;Ke.fn=Ie.prototype,Ke.invalid=Pe;var Qn=ti(1,"add"),ts=ti(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var es=D("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ri("gggg","weekYear"),Ri("ggggg","weekYear"),Ri("GGGG","isoWeekYear"),Ri("GGGGG","isoWeekYear"),R("weekYear","gg"),R("isoWeekYear","GG"),H("weekYear",1),H("isoWeekYear",1),U("G",en),U("g",en),U("GG",Xo,Vo),U("gg",Xo,Vo),U("GGGG",$o,Uo),U("gggg",$o,Uo),U("GGGGG",Qo,qo),U("ggggg",Qo,qo),J(["gggg","ggggg","GGGG","GGGGG"],function(t,e,i,o){e[o.substr(0,2)]=_(t)}),J(["gg","GG"],function(t,i,o,n){i[n]=e.parseTwoDigitYear(t)}),G("Q",0,"Qo","quarter"),R("quarter","Q"),H("quarter",7),U("Q",Wo),K("Q",function(t,e){e[ln]=3*(_(t)-1)}),G("D",["DD",2],"Do","date"),R("date","D"),H("date",9),U("D",Xo),U("DD",Xo,Vo),U("Do",function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient}),K(["D","DD"],un),K("Do",function(t,e){e[un]=_(t.match(Xo)[0],10)});var is=it("Date",!0);G("DDD",["DDDD",3],"DDDo","dayOfYear"),R("dayOfYear","DDD"),H("dayOfYear",4),U("DDD",Jo),U("DDDD",Bo),K(["DDD","DDDD"],function(t,e,i){i._dayOfYear=_(t)}),G("m",["mm",2],0,"minute"),R("minute","m"),H("minute",14),U("m",Xo),U("mm",Xo,Vo),K(["m","mm"],cn);var os=it("Minutes",!1);G("s",["ss",2],0,"second"),R("second","s"),H("second",15),U("s",Xo),U("ss",Xo,Vo),K(["s","ss"],mn);var ns=it("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),G(0,["SSS",3],0,"millisecond"),G(0,["SSSS",4],0,function(){return 10*this.millisecond()}),G(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),G(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),G(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),G(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),G(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),R("millisecond","ms"),H("millisecond",16),U("S",Jo,Wo),U("SS",Jo,Vo),U("SSS",Jo,Bo);var ss;for(ss="SSSS";ss.length<=9;ss+="S")U(ss,tn);for(ss="S";ss.length<=9;ss+="S")K(ss,Vi);var rs=it("Milliseconds",!1);G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");var as=v.prototype;as.add=Qn,as.calendar=oi,as.clone=ni,as.diff=ui,as.endOf=Si,as.format=gi,as.from=vi,as.fromNow=yi,as.to=bi,as.toNow=_i,as.get=st,as.invalidAt=Ni,as.isAfter=si,as.isBefore=ri,as.isBetween=ai,as.isSame=hi,as.isSameOrAfter=di,as.isSameOrBefore=li,as.isValid=Pi,as.lang=es,as.locale=wi,as.localeData=xi,as.max=qn,as.min=Un,as.parsingFlags=Ii,as.set=rt,as.startOf=Di,as.subtract=ts,as.toArray=Mi,as.toObject=Oi,as.toDate=Ti,as.toISOString=mi,as.inspect=fi,as.toJSON=Ei,as.toString=ci,as.unix=Ci,as.valueOf=ki,as.creationData=Ai,as.year=bn,as.isLeapYear=et,as.weekYear=Li,as.isoWeekYear=Fi,as.quarter=as.quarters=zi,as.month=mt,as.daysInMonth=ft,as.week=as.weeks=Mt,as.isoWeek=as.isoWeeks=Ot,as.weeksInYear=ji,as.isoWeeksInYear=Hi,as.date=is,as.day=as.days=Ft,as.weekday=Ht,as.isoWeekday=jt,as.dayOfYear=Wi,as.hour=as.hours=An,as.minute=as.minutes=os,as.second=as.seconds=ns,as.millisecond=as.milliseconds=rs,as.utcOffset=je,as.utc=Ge,as.local=ze,as.parseZone=We,as.hasAlignedHourOffset=Ve,as.isDST=Be,as.isLocal=qe,as.isUtcOffset=Xe,as.isUtc=Ze,as.isUTC=Ze,as.zoneAbbr=Bi,as.zoneName=Ui,as.dates=D("dates accessor is deprecated. Use date instead.",is),as.months=D("months accessor is deprecated. Use month instead",mt),as.years=D("years accessor is deprecated. Use year instead",bn),as.zone=D("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Ye),as.isDSTShifted=D("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ue);var hs=M.prototype;hs.calendar=O,hs.longDateFormat=E,hs.invalidDate=P,hs.ordinal=I,hs.preparse=Zi,hs.postformat=Zi,hs.relativeTime=N,hs.pastFuture=A,hs.set=C,hs.months=dt,hs.monthsShort=lt,hs.monthsParse=pt,hs.monthsRegex=vt,hs.monthsShortRegex=gt,hs.week=kt,hs.firstDayOfYear=Tt,hs.firstDayOfWeek=Ct,hs.weekdays=It,hs.weekdaysMin=At,hs.weekdaysShort=Nt,hs.weekdaysParse=Lt,hs.weekdaysRegex=Yt,hs.weekdaysShortRegex=Gt,hs.weekdaysMinRegex=zt,hs.isPM=Xt,hs.meridiem=Zt,Qt("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===_(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),e.lang=D("moment.lang is deprecated. Use moment.locale instead.",Qt),e.langData=D("moment.langData is deprecated. Use moment.localeData instead.",ie);var ds=Math.abs,ls=fo("ms"),us=fo("s"),ps=fo("m"),cs=fo("h"),ms=fo("d"),fs=fo("w"),gs=fo("M"),vs=fo("y"),ys=yo("milliseconds"),bs=yo("seconds"),_s=yo("minutes"),ws=yo("hours"),xs=yo("days"),Ds=yo("months"),Ss=yo("years"),ks=Math.round,Cs={ss:44,s:45,m:45,h:22,d:26,M:11},Ts=Math.abs,Ms=Ie.prototype;return Ms.isValid=Ee,Ms.abs=no,Ms.add=ro,Ms.subtract=ao,Ms.as=co,Ms.asMilliseconds=ls,Ms.asSeconds=us,Ms.asMinutes=ps,Ms.asHours=cs,Ms.asDays=ms,Ms.asWeeks=fs,Ms.asMonths=gs,Ms.asYears=vs,Ms.valueOf=mo,Ms._bubble=lo,Ms.clone=go,Ms.get=vo,Ms.milliseconds=ys,Ms.seconds=bs,Ms.minutes=_s,Ms.hours=ws,Ms.days=xs,Ms.weeks=bo,Ms.months=Ds,Ms.years=Ss,Ms.humanize=So,Ms.toISOString=Co,Ms.toString=Co,Ms.toJSON=Co,Ms.locale=wi,Ms.localeData=xi,Ms.toIsoString=D("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Co),Ms.lang=es,G("X",0,0,"unix"),G("x",0,0,"valueOf"),U("x",en),U("X",sn),K("X",function(t,e,i){i._d=new Date(1e3*parseFloat(t,10))}),K("x",function(t,e,i){i._d=new Date(_(t))}),e.version="2.19.1",function(t){To=t}(ke),e.fn=as,e.min=Te,e.max=Me,e.now=Xn,e.utc=u,e.unix=qi,e.months=Qi,e.isDate=a,e.locale=Qt,e.invalid=f,e.duration=Ke,e.isMoment=y,e.weekdays=eo,e.parseZone=Xi,e.localeData=ie,e.isDuration=Ne,e.monthsShort=to,e.weekdaysMin=oo,e.defineLocale=te,e.updateLocale=ee,e.locales=oe,e.weekdaysShort=io,e.normalizeUnits=L,e.relativeTimeRounding=xo,e.relativeTimeThreshold=Do,e.calendarFormat=ii,e.prototype=as,e})}).call(e,i(124)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){function i(t){throw new Error("Cannot find module '"+t+"'.")}i.keys=function(){return[]},i.resolve=i,t.exports=i,i.id=125},function(t,e,i){(function(e){function i(t,e,i){var o=e&&i||0,n=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){n<16&&(e[o+n++]=u[t])});n<16;)e[o+n++]=0;return e}function o(t,e){var i=e||0,o=l;return o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+"-"+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]+o[t[i++]]}function n(t,e,i){var n=e&&i||0,s=e||[];t=t||{};var r=void 0!==t.clockseq?t.clockseq:f,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),h=void 0!==t.nsecs?t.nsecs:v+1,d=a-g+(h-v)/1e4;if(d<0&&void 0===t.clockseq&&(r=r+1&16383),(d<0||a>g)&&void 0===t.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");g=a,v=h,f=r,a+=122192928e5;var l=(1e4*(268435455&a)+h)%4294967296;s[n++]=l>>>24&255,s[n++]=l>>>16&255,s[n++]=l>>>8&255,s[n++]=255&l;var u=a/4294967296*1e4&268435455;s[n++]=u>>>8&255,s[n++]=255&u,s[n++]=u>>>24&15|16,s[n++]=u>>>16&255,s[n++]=r>>>8|128,s[n++]=255&r;for(var p=t.node||m,c=0;c<6;c++)s[n+c]=p[c];return e||o(s)}function s(t,e,i){var n=e&&i||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var s=t.random||(t.rng||r)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var a=0;a<16;a++)e[n+a]=s[a];return e||o(s)}var r,a="undefined"!=typeof window?window:void 0!==e?e:null;if(a&&a.crypto&&crypto.getRandomValues){var h=new Uint8Array(16);r=function(){return crypto.getRandomValues(h),h}}if(!r){var d=new Array(16);r=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),d[e]=t>>>((3&e)<<3)&255;return d}}for(var l=[],u={},p=0;p<256;p++)l[p]=(p+256).toString(16).substr(1),u[l[p]]=p;var c=r(),m=[1|c[0],c[1],c[2],c[3],c[4],c[5]],f=16383&(c[6]<<8|c[7]),g=0,v=0,y=s;y.v1=n,y.v4=s,y.parse=i,y.unparse=o,t.exports=y}).call(e,i(127))},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var o=i(2),n=o.JSON||(o.JSON={stringify:JSON.stringify});t.exports=function(t){return n.stringify.apply(n,arguments)}},function(t,e,i){function o(t,e,i,n){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!(Array.isArray(i)||i instanceof d||i instanceof l)&&i instanceof Object){var s=n;n=i,i=s}n&&n.throttleRedraw&&console.warn('Timeline option "throttleRedraw" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release.');var r=this;if(this.defaultOptions={start:null,end:null,autoResize:!0,orientation:{axis:"bottom",item:"bottom"},moment:a,width:null,height:null,maxHeight:null,minHeight:null},this.options=h.deepExtend({},this.defaultOptions),this._create(t),!n||n&&void 0===n.rtl){this.dom.root.style.visibility="hidden";for(var p,f=this.dom.root;!p&&f;)p=window.getComputedStyle(f,null).direction,f=f.parentElement;this.options.rtl=p&&"rtl"==p.toLowerCase()}else this.options.rtl=n.rtl;this.options.rollingMode=n&&n.rollingMode,this.options.onInitialDrawComplete=n&&n.onInitialDrawComplete,this.components=[],this.body={dom:this.dom,domProps:this.props,emitter:{on:this.on.bind(this),off:this.off.bind(this),emit:this.emit.bind(this)},hiddenDates:[],util:{getScale:function(){return r.timeAxis.step.scale},getStep:function(){return r.timeAxis.step.step},toScreen:r._toScreen.bind(r),toGlobalScreen:r._toGlobalScreen.bind(r),toTime:r._toTime.bind(r),toGlobalTime:r._toGlobalTime.bind(r)}},this.range=new u(this.body,this.options),this.components.push(this.range),this.body.range=this.range,this.timeAxis=new c(this.body,this.options),this.timeAxis2=null,this.components.push(this.timeAxis),this.currentTime=new m(this.body,this.options),this.components.push(this.currentTime),this.itemSet=new g(this.body,this.options),this.components.push(this.itemSet),this.itemsData=null,this.groupsData=null,this.dom.root.onclick=function(t){r.emit("click",r.getEventProperties(t))},this.dom.root.ondblclick=function(t){r.emit("doubleClick",r.getEventProperties(t))},this.dom.root.oncontextmenu=function(t){r.emit("contextmenu",r.getEventProperties(t))},this.dom.root.onmouseover=function(t){r.emit("mouseOver",r.getEventProperties(t))},window.PointerEvent?(this.dom.root.onpointerdown=function(t){r.emit("mouseDown",r.getEventProperties(t))},this.dom.root.onpointermove=function(t){r.emit("mouseMove",r.getEventProperties(t))},this.dom.root.onpointerup=function(t){r.emit("mouseUp",r.getEventProperties(t))}):(this.dom.root.onmousemove=function(t){r.emit("mouseMove",r.getEventProperties(t))},this.dom.root.onmousedown=function(t){r.emit("mouseDown",r.getEventProperties(t))},this.dom.root.onmouseup=function(t){r.emit("mouseUp",r.getEventProperties(t))}),this.initialFitDone=!1,this.on("changed",function(){if(null!=this.itemsData&&!this.options.rollingMode){if(!r.initialFitDone)if(r.initialFitDone=!0,void 0!=r.options.start||void 0!=r.options.end){if(void 0==r.options.start||void 0==r.options.end)var t=r.getItemRange();var e=void 0!=r.options.start?r.options.start:t.min,i=void 0!=r.options.end?r.options.end:t.max;r.setWindow(e,i,{animation:!1})}else r.fit({animation:!1});!r.initialDrawDone&&r.initialRangeChangeDone&&(r.initialDrawDone=!0,r.dom.root.style.visibility="visible",r.options.onInitialDrawComplete&&setTimeout(function(){return r.options.onInitialDrawComplete()},0))}}),n&&this.setOptions(n),i&&this.setGroups(i),e&&this.setItems(e),this._redraw()}function n(t){return h.convert(t.data.start,"Date").valueOf()}function s(t){var e=void 0!=t.data.end?t.data.end:t.data.start;return h.convert(e,"Date").valueOf()}function r(t,e){var i=t.props.leftContainer.height,o=t.props.left.height,n=e.parent,s=n.top,r=!0,a=t.timeAxis.options.orientation.axis,h=function(){return"bottom"==a?n.height-e.top-e.height:e.top},d=-1*t._getScrollTop(),l=s+h(),u=e.height;return ld+i?s+=h()+u-i+t.itemSet.options.margin.item.vertical:r=!1,s=Math.min(s,o-i),{shouldScroll:r,scrollOffset:s,itemTop:l}}var a=i(3),h=i(0),d=i(15),l=i(20),u=i(47),p=i(48),c=i(28),m=i(50),f=i(29),g=i(70),v=i(32).printStyle,y=i(75).allOptions,b=i(75).configureOptions,_=i(76).default,w=i(32).default;o.prototype=new p,o.prototype._createConfigurator=function(){return new _(this,this.dom.container,b)},o.prototype.redraw=function(){this.itemSet&&this.itemSet.markDirty({refreshItems:!0}),this._redraw()},o.prototype.setOptions=function(t){if(!0===w.validate(t,y)&&console.log("%cErrors have been found in the supplied options object.",v),p.prototype.setOptions.call(this,t),"type"in t&&t.type!==this.options.type){this.options.type=t.type;var e=this.itemsData;if(e){var i=this.getSelection();this.setItems(null),this.setItems(e),this.setSelection(i)}}},o.prototype.setItems=function(t){var e;e=t?t instanceof d||t instanceof l?t:new d(t,{type:{start:"Date",end:"Date"}}):null,this.itemsData=e,this.itemSet&&this.itemSet.setItems(e)},o.prototype.setGroups=function(t){var e;if(t){var i=function(t){return!1!==t.visible};e=t instanceof d||t instanceof l?new l(t,{filter:i}):new d(t.filter(i))}else e=null;this.groupsData=e,this.itemSet.setGroups(e)},o.prototype.setData=function(t){t&&t.groups&&this.setGroups(t.groups),t&&t.items&&this.setItems(t.items)},o.prototype.setSelection=function(t,e){this.itemSet&&this.itemSet.setSelection(t),e&&e.focus&&this.focus(t,e)},o.prototype.getSelection=function(){return this.itemSet&&this.itemSet.getSelection()||[]},o.prototype.focus=function(t,e){if(this.itemsData&&void 0!=t){var i=Array.isArray(t)?t:[t],o=this.itemsData.getDataSet().get(i,{type:{start:"Date",end:"Date"}}),n=null,s=null;if(o.forEach(function(t){var e=t.start.valueOf(),i="end"in t?t.end.valueOf():t.start.valueOf();(null===n||es)&&(s=i)}),null!==n&&null!==s){var a=this,h=this.itemSet.items[i[0]],d=-1*this._getScrollTop(),l=null,u=function(t,e,i){var o=r(a,h);if(l||(l=o),l.itemTop!=o.itemTop||l.shouldScroll){l.itemTop!=o.itemTop&&o.shouldScroll&&(l=o,d=-1*a._getScrollTop());var n=d,s=l.scrollOffset,u=i?s:n+(s-n)*t;a._setScrollTop(-u),e||a._redraw()}},p=function(){var t=r(a,h);t.shouldScroll&&t.itemTop!=l.itemTop&&(a._setScrollTop(-t.scrollOffset),a._redraw())},c=function(){p(),setTimeout(p,100)},m=(n+s)/2,f=Math.max(this.range.end-this.range.start,1.1*(s-n)),g=!e||void 0===e.animation||e.animation;g||(l={shouldScroll:!1,scrollOffset:-1,itemTop:-1}),this.range.setRange(m-f/2,m+f/2,{animation:g},c,u)}}},o.prototype.fit=function(t,e){var i,o=!t||void 0===t.animation||t.animation,n=this.itemsData&&this.itemsData.getDataSet();1===n.length&&void 0===n.get()[0].end?(i=this.getDataRange(),this.moveTo(i.min.valueOf(),{animation:o},e)):(i=this.getItemRange(),this.range.setRange(i.min,i.max,{animation:o},e))},o.prototype.getItemRange=function(){var t=this.getDataRange(),e=null!==t.min?t.min.valueOf():null,i=null!==t.max?t.max.valueOf():null,o=null,r=null;if(null!=e&&null!=i){var a=i-e;a<=0&&(a=10);var d=a/this.props.center.width,l={},u=0;h.forEach(this.itemSet.items,function(t,e){if(t.groupShowing){l[e]=t.redraw(!0),u=l[e].length}});if(u>0)for(var p=0;pi&&(i=h,r=t)}.bind(this)),o&&r){var c=o.getWidthLeft()+10,m=r.getWidthRight()+10,f=this.props.center.width-c-m;f>0&&(this.options.rtl?(e=n(o)-m*a/f,i=s(r)+c*a/f):(e=n(o)-c*a/f,i=s(r)+m*a/f))}}return{min:null!=e?new Date(e):null,max:null!=i?new Date(i):null}},o.prototype.getDataRange=function(){var t=null,e=null,i=this.itemsData&&this.itemsData.getDataSet();return i&&i.forEach(function(i){var o=h.convert(i.start,"Date").valueOf(),n=h.convert(void 0!=i.end?i.end:i.start,"Date").valueOf();(null===t||oe)&&(e=n)}),{min:null!=t?new Date(t):null,max:null!=e?new Date(e):null}},o.prototype.getEventProperties=function(t){var e,i=t.center?t.center.x:t.clientX,o=t.center?t.center.y:t.clientY;e=this.options.rtl?h.getAbsoluteRight(this.dom.centerContainer)-i:i-h.getAbsoluteLeft(this.dom.centerContainer);var n=o-h.getAbsoluteTop(this.dom.centerContainer),s=this.itemSet.itemFromTarget(t),r=this.itemSet.groupFromTarget(t),a=f.customTimeFromTarget(t),d=this.itemSet.options.snap||null,l=this.body.util.getScale(),u=this.body.util.getStep(),p=this._toTime(e),c=d?d(p,l,u):p,m=h.getTarget(t),g=null;return null!=s?g="item":null!=a?g="custom-time":h.hasParent(m,this.timeAxis.dom.foreground)?g="axis":this.timeAxis2&&h.hasParent(m,this.timeAxis2.dom.foreground)?g="axis":h.hasParent(m,this.itemSet.dom.labelSet)?g="group-label":h.hasParent(m,this.currentTime.bar)?g="current-time":h.hasParent(m,this.dom.center)&&(g="background"),{event:t,item:s?s.id:null,group:r?r.groupId:null,what:g,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:e,y:n,time:p,snappedTime:c}},o.prototype.toggleRollingMode=function(){this.range.rolling?this.range.stopRolling():(void 0==this.options.rollingMode&&this.setOptions(this.options),this.range.startRolling())},t.exports=o},function(t,e,i){var o,n,s;!function(i){n=[],o=i,void 0!==(s="function"==typeof o?o.apply(e,n):o)&&(t.exports=s)}(function(){var t=null;return function e(i,o){function n(t){return t.match(/[^ ]+/g)}function s(e){if("hammer.input"!==e.type){if(e.srcEvent._handled||(e.srcEvent._handled={}),e.srcEvent._handled[e.type])return;e.srcEvent._handled[e.type]=!0}var i=!1;e.stopPropagation=function(){i=!0};var o=e.srcEvent.stopPropagation.bind(e.srcEvent);"function"==typeof o&&(e.srcEvent.stopPropagation=function(){o(),e.stopPropagation()}),e.firstTarget=t;for(var n=t;n&&!i;){var s=n.hammer;if(s)for(var r,a=0;a0?d._handlers[t]=o:(i.off(t,s),delete d._handlers[t]))}),d},d.emit=function(e,o){t=o.target,i.emit(e,o)},d.destroy=function(){var t=i.element.hammer,e=t.indexOf(d);-1!==e&&t.splice(e,1),t.length||delete i.element.hammer,d._handlers={},i.destroy()},d}})},function(t,e,i){var o;/*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license */ +!function(n,s,r,a){function h(t,e,i){return setTimeout(c(t,i),e)}function d(t,e,i){return!!Array.isArray(t)&&(l(t,i[e],i),!0)}function l(t,e,i){var o;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==a)for(o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",s=n.console&&(n.console.warn||n.console.log);return s&&s.call(n.console,o,i),t.apply(this,arguments)}}function p(t,e,i){var o,n=e.prototype;o=t.prototype=Object.create(n),o.constructor=t,o._super=n,i&&mt(o,i)}function c(t,e){return function(){return t.apply(e,arguments)}}function m(t,e){return typeof t==vt?t.apply(e?e[0]||a:a,e):t}function f(t,e){return t===a?e:t}function g(t,e,i){l(_(e),function(e){t.addEventListener(e,i,!1)})}function v(t,e,i){l(_(e),function(e){t.removeEventListener(e,i,!1)})}function y(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function b(t,e){return t.indexOf(e)>-1}function _(t){return t.trim().split(/\s+/g)}function w(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var o=0;oi[e]}):o.sort()),o}function S(t,e){for(var i,o,n=e[0].toUpperCase()+e.slice(1),s=0;s1&&!i.firstMultiple?i.firstMultiple=N(e):1===n&&(i.firstMultiple=!1);var s=i.firstInput,r=i.firstMultiple,a=r?r.center:s.center,h=e.center=A(o);e.timeStamp=_t(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=H(a,h),e.distance=F(a,h),P(i,e),e.offsetDirection=L(e.deltaX,e.deltaY);var d=R(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=d.x,e.overallVelocityY=d.y,e.overallVelocity=bt(d.x)>bt(d.y)?d.x:d.y,e.scale=r?Y(r.pointers,o):1,e.rotation=r?j(r.pointers,o):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,I(i,e);var l=t.element;y(e.srcEvent.target,l)&&(l=e.srcEvent.target),e.target=l}function P(t,e){var i=e.center,o=t.offsetDelta||{},n=t.prevDelta||{},s=t.prevInput||{};e.eventType!==Ot&&s.eventType!==Pt||(n=t.prevDelta={x:s.deltaX||0,y:s.deltaY||0},o=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=n.x+(i.x-o.x),e.deltaY=n.y+(i.y-o.y)}function I(t,e){var i,o,n,s,r=t.lastInterval||e,h=e.timeStamp-r.timeStamp;if(e.eventType!=It&&(h>Mt||r.velocity===a)){var d=e.deltaX-r.deltaX,l=e.deltaY-r.deltaY,u=R(h,d,l);o=u.x,n=u.y,i=bt(u.x)>bt(u.y)?u.x:u.y,s=L(d,l),t.lastInterval=e}else i=r.velocity,o=r.velocityX,n=r.velocityY,s=r.direction;e.velocity=i,e.velocityX=o,e.velocityY=n,e.direction=s}function N(t){for(var e=[],i=0;i=bt(e)?t<0?At:Rt:e<0?Lt:Ft}function F(t,e,i){i||(i=Gt);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return Math.sqrt(o*o+n*n)}function H(t,e,i){i||(i=Gt);var o=e[i[0]]-t[i[0]],n=e[i[1]]-t[i[1]];return 180*Math.atan2(n,o)/Math.PI}function j(t,e){return H(e[1],e[0],zt)+H(t[1],t[0],zt)}function Y(t,e){return F(e[0],e[1],zt)/F(t[0],t[1],zt)}function G(){this.evEl=Vt,this.evWin=Bt,this.pressed=!1,T.apply(this,arguments)}function z(){this.evEl=Xt,this.evWin=Zt,T.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function W(){this.evTarget=Jt,this.evWin=$t,this.started=!1,T.apply(this,arguments)}function V(t,e){var i=x(t.touches),o=x(t.changedTouches);return e&(Pt|It)&&(i=D(i.concat(o),"identifier",!0)),[i,o]}function B(){this.evTarget=te,this.targetIds={},T.apply(this,arguments)}function U(t,e){var i=x(t.touches),o=this.targetIds;if(e&(Ot|Et)&&1===i.length)return o[i[0].identifier]=!0,[i,i];var n,s,r=x(t.changedTouches),a=[],h=this.target;if(s=i.filter(function(t){return y(t.target,h)}),e===Ot)for(n=0;n-1&&o.splice(t,1)};setTimeout(n,ee)}}function K(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,o=0;o-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){i.manager.emit(e,t)}var i=this,o=this.state;o=me&&e(i.options.event+tt(o))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&n&e.direction},attrTest:function(t){return ot.prototype.attrTest.call(this,t)&&(this.state&pe||!(this.state&pe)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=et(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),p(st,ot,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ae]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&pe)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),p(rt,Q,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[se]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distancee.time;if(this._input=t,!o||!i||t.eventType&(Pt|It)&&!n)this.reset();else if(t.eventType&Ot)this.reset(),this._timer=h(function(){this.state=fe,this.tryEmit()},e.time,this);else if(t.eventType&Pt)return fe;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===fe&&(t&&t.eventType&Pt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=_t(),this.manager.emit(this.options.event,this._input)))}}),p(at,ot,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ae]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&pe)}}),p(ht,ot,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ht|jt,pointers:1},getTouchAction:function(){return nt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(Ht|jt)?e=t.overallVelocity:i&Ht?e=t.overallVelocityX:i&jt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&bt(e)>this.options.velocity&&t.eventType&Pt},emit:function(t){var e=et(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),p(dt,Q,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[re]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,o=t.distancen-this.padding&&(a=!0),s=a?this.x-i:this.x,r=h?this.y-e:this.y}else r=this.y-e,r+e+this.padding>o&&(r=o-e-this.padding),rn&&(s=n-i-this.padding),s0&&void 0!==arguments[0]?arguments[0]:1;(0,a.default)(this,t),this.pixelRatio=e,this.generated=!1,this.centerCoordinates={x:144.5,y:144.5},this.r=289*.49,this.color={r:255,g:255,b:255,a:1},this.hueCircle=void 0,this.initialColor={r:255,g:255,b:255,a:1},this.previousColor=void 0,this.applied=!1,this.updateCallback=function(){},this.closeCallback=function(){},this._create()}return(0,d.default)(t,[{key:"insertTo",value:function(t){void 0!==this.hammer&&(this.hammer.destroy(),this.hammer=void 0),this.container=t,this.container.appendChild(this.frame),this._bindHammer(),this._setSize()}},{key:"setUpdateCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker update callback is not a function.");this.updateCallback=t}},{key:"setCloseCallback",value:function(t){if("function"!=typeof t)throw new Error("Function attempted to set as colorPicker closing callback is not a function.");this.closeCallback=t}},{key:"_isColorString",value:function(t){var e={black:"#000000",navy:"#000080",darkblue:"#00008B",mediumblue:"#0000CD",blue:"#0000FF",darkgreen:"#006400",green:"#008000",teal:"#008080",darkcyan:"#008B8B",deepskyblue:"#00BFFF",darkturquoise:"#00CED1",mediumspringgreen:"#00FA9A",lime:"#00FF00",springgreen:"#00FF7F",aqua:"#00FFFF",cyan:"#00FFFF",midnightblue:"#191970",dodgerblue:"#1E90FF",lightseagreen:"#20B2AA",forestgreen:"#228B22",seagreen:"#2E8B57",darkslategray:"#2F4F4F",limegreen:"#32CD32",mediumseagreen:"#3CB371",turquoise:"#40E0D0",royalblue:"#4169E1",steelblue:"#4682B4",darkslateblue:"#483D8B",mediumturquoise:"#48D1CC",indigo:"#4B0082",darkolivegreen:"#556B2F",cadetblue:"#5F9EA0",cornflowerblue:"#6495ED",mediumaquamarine:"#66CDAA",dimgray:"#696969",slateblue:"#6A5ACD",olivedrab:"#6B8E23",slategray:"#708090",lightslategray:"#778899",mediumslateblue:"#7B68EE",lawngreen:"#7CFC00",chartreuse:"#7FFF00",aquamarine:"#7FFFD4",maroon:"#800000",purple:"#800080",olive:"#808000",gray:"#808080",skyblue:"#87CEEB",lightskyblue:"#87CEFA",blueviolet:"#8A2BE2",darkred:"#8B0000",darkmagenta:"#8B008B",saddlebrown:"#8B4513",darkseagreen:"#8FBC8F",lightgreen:"#90EE90",mediumpurple:"#9370D8",darkviolet:"#9400D3",palegreen:"#98FB98",darkorchid:"#9932CC",yellowgreen:"#9ACD32",sienna:"#A0522D",brown:"#A52A2A",darkgray:"#A9A9A9",lightblue:"#ADD8E6",greenyellow:"#ADFF2F",paleturquoise:"#AFEEEE",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",firebrick:"#B22222",darkgoldenrod:"#B8860B",mediumorchid:"#BA55D3",rosybrown:"#BC8F8F",darkkhaki:"#BDB76B",silver:"#C0C0C0",mediumvioletred:"#C71585",indianred:"#CD5C5C",peru:"#CD853F",chocolate:"#D2691E",tan:"#D2B48C",lightgrey:"#D3D3D3",palevioletred:"#D87093",thistle:"#D8BFD8",orchid:"#DA70D6",goldenrod:"#DAA520",crimson:"#DC143C",gainsboro:"#DCDCDC",plum:"#DDA0DD",burlywood:"#DEB887",lightcyan:"#E0FFFF",lavender:"#E6E6FA",darksalmon:"#E9967A",violet:"#EE82EE",palegoldenrod:"#EEE8AA",lightcoral:"#F08080",khaki:"#F0E68C",aliceblue:"#F0F8FF",honeydew:"#F0FFF0",azure:"#F0FFFF",sandybrown:"#F4A460",wheat:"#F5DEB3",beige:"#F5F5DC",whitesmoke:"#F5F5F5",mintcream:"#F5FFFA",ghostwhite:"#F8F8FF",salmon:"#FA8072",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lightgoldenrodyellow:"#FAFAD2",oldlace:"#FDF5E6",red:"#FF0000",fuchsia:"#FF00FF",magenta:"#FF00FF",deeppink:"#FF1493",orangered:"#FF4500",tomato:"#FF6347",hotpink:"#FF69B4",coral:"#FF7F50",darkorange:"#FF8C00",lightsalmon:"#FFA07A",orange:"#FFA500",lightpink:"#FFB6C1",pink:"#FFC0CB",gold:"#FFD700",peachpuff:"#FFDAB9",navajowhite:"#FFDEAD",moccasin:"#FFE4B5",bisque:"#FFE4C4",mistyrose:"#FFE4E1",blanchedalmond:"#FFEBCD",papayawhip:"#FFEFD5",lavenderblush:"#FFF0F5",seashell:"#FFF5EE",cornsilk:"#FFF8DC",lemonchiffon:"#FFFACD",floralwhite:"#FFFAF0",snow:"#FFFAFA",yellow:"#FFFF00",lightyellow:"#FFFFE0",ivory:"#FFFFF0",white:"#FFFFFF"};if("string"==typeof t)return e[t]}},{key:"setColor",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("none"!==t){var i=void 0,o=this._isColorString(t);if(void 0!==o&&(t=o),!0===p.isString(t)){if(!0===p.isValidRGB(t)){var n=t.substr(4).substr(0,t.length-5).split(",");i={r:n[0],g:n[1],b:n[2],a:1}}else if(!0===p.isValidRGBA(t)){var r=t.substr(5).substr(0,t.length-6).split(",");i={r:r[0],g:r[1],b:r[2],a:r[3]}}else if(!0===p.isValidHex(t)){var a=p.hexToRGB(t);i={r:a.r,g:a.g,b:a.b,a:1}}}else if(t instanceof Object&&void 0!==t.r&&void 0!==t.g&&void 0!==t.b){var h=void 0!==t.a?t.a:"1.0";i={r:t.r,g:t.g,b:t.b,a:h}}if(void 0===i)throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: "+(0,s.default)(t));this._setColor(i,e)}}},{key:"show",value:function(){void 0!==this.closeCallback&&(this.closeCallback(),this.closeCallback=void 0),this.applied=!1,this.frame.style.display="block",this._generateHueCircle()}},{key:"_hide",value:function(){var t=this;!0===(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.previousColor=p.extend({},this.color)),!0===this.applied&&this.updateCallback(this.initialColor),this.frame.style.display="none",setTimeout(function(){void 0!==t.closeCallback&&(t.closeCallback(),t.closeCallback=void 0)},0)}},{key:"_save",value:function(){this.updateCallback(this.color),this.applied=!1,this._hide()}},{key:"_apply",value:function(){this.applied=!0,this.updateCallback(this.color),this._updatePicker(this.color)}},{key:"_loadLast",value:function(){void 0!==this.previousColor?this.setColor(this.previousColor,!1):alert("There is no last color to load...")}},{key:"_setColor",value:function(t){!0===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(this.initialColor=p.extend({},t)),this.color=t;var e=p.RGBToHSV(t.r,t.g,t.b),i=2*Math.PI,o=this.r*e.s,n=this.centerCoordinates.x+o*Math.sin(i*e.h),s=this.centerCoordinates.y+o*Math.cos(i*e.h);this.colorPickerSelector.style.left=n-.5*this.colorPickerSelector.clientWidth+"px",this.colorPickerSelector.style.top=s-.5*this.colorPickerSelector.clientHeight+"px",this._updatePicker(t)}},{key:"_setOpacity",value:function(t){this.color.a=t/100,this._updatePicker(this.color)}},{key:"_setBrightness",value:function(t){var e=p.RGBToHSV(this.color.r,this.color.g,this.color.b);e.v=t/100;var i=p.HSVToRGB(e.h,e.s,e.v);i.a=this.color.a,this.color=i,this._updatePicker()}},{key:"_updatePicker",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.color,e=p.RGBToHSV(t.r,t.g,t.b),i=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||1)),i.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var o=this.colorPickerCanvas.clientWidth,n=this.colorPickerCanvas.clientHeight;i.clearRect(0,0,o,n),i.putImageData(this.hueCircle,0,0),i.fillStyle="rgba(0,0,0,"+(1-e.v)+")",i.circle(this.centerCoordinates.x,this.centerCoordinates.y,this.r),i.fill(),this.brightnessRange.value=100*e.v,this.opacityRange.value=100*t.a,this.initialColorDiv.style.backgroundColor="rgba("+this.initialColor.r+","+this.initialColor.g+","+this.initialColor.b+","+this.initialColor.a+")",this.newColorDiv.style.backgroundColor="rgba("+this.color.r+","+this.color.g+","+this.color.b+","+this.color.a+")"}},{key:"_setSize",value:function(){this.colorPickerCanvas.style.width="100%",this.colorPickerCanvas.style.height="100%",this.colorPickerCanvas.width=289*this.pixelRatio,this.colorPickerCanvas.height=289*this.pixelRatio}},{key:"_create",value:function(){if(this.frame=document.createElement("div"),this.frame.className="vis-color-picker",this.colorPickerDiv=document.createElement("div"),this.colorPickerSelector=document.createElement("div"),this.colorPickerSelector.className="vis-selector",this.colorPickerDiv.appendChild(this.colorPickerSelector),this.colorPickerCanvas=document.createElement("canvas"),this.colorPickerDiv.appendChild(this.colorPickerCanvas),this.colorPickerCanvas.getContext){var t=this.colorPickerCanvas.getContext("2d");this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1),this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}else{var e=document.createElement("DIV");e.style.color="red",e.style.fontWeight="bold",e.style.padding="10px",e.innerHTML="Error: your browser does not support HTML canvas",this.colorPickerCanvas.appendChild(e)}this.colorPickerDiv.className="vis-color",this.opacityDiv=document.createElement("div"),this.opacityDiv.className="vis-opacity",this.brightnessDiv=document.createElement("div"),this.brightnessDiv.className="vis-brightness",this.arrowDiv=document.createElement("div"),this.arrowDiv.className="vis-arrow",this.opacityRange=document.createElement("input");try{this.opacityRange.type="range",this.opacityRange.min="0",this.opacityRange.max="100"}catch(t){}this.opacityRange.value="100",this.opacityRange.className="vis-range",this.brightnessRange=document.createElement("input");try{this.brightnessRange.type="range",this.brightnessRange.min="0",this.brightnessRange.max="100"}catch(t){}this.brightnessRange.value="100",this.brightnessRange.className="vis-range",this.opacityDiv.appendChild(this.opacityRange),this.brightnessDiv.appendChild(this.brightnessRange);var i=this;this.opacityRange.onchange=function(){i._setOpacity(this.value)},this.opacityRange.oninput=function(){i._setOpacity(this.value)},this.brightnessRange.onchange=function(){i._setBrightness(this.value)},this.brightnessRange.oninput=function(){i._setBrightness(this.value)},this.brightnessLabel=document.createElement("div"),this.brightnessLabel.className="vis-label vis-brightness",this.brightnessLabel.innerHTML="brightness:",this.opacityLabel=document.createElement("div"),this.opacityLabel.className="vis-label vis-opacity",this.opacityLabel.innerHTML="opacity:",this.newColorDiv=document.createElement("div"),this.newColorDiv.className="vis-new-color",this.newColorDiv.innerHTML="new",this.initialColorDiv=document.createElement("div"),this.initialColorDiv.className="vis-initial-color",this.initialColorDiv.innerHTML="initial",this.cancelButton=document.createElement("div"),this.cancelButton.className="vis-button vis-cancel",this.cancelButton.innerHTML="cancel",this.cancelButton.onclick=this._hide.bind(this,!1),this.applyButton=document.createElement("div"),this.applyButton.className="vis-button vis-apply",this.applyButton.innerHTML="apply",this.applyButton.onclick=this._apply.bind(this),this.saveButton=document.createElement("div"),this.saveButton.className="vis-button vis-save",this.saveButton.innerHTML="save",this.saveButton.onclick=this._save.bind(this),this.loadButton=document.createElement("div"),this.loadButton.className="vis-button vis-load",this.loadButton.innerHTML="load last",this.loadButton.onclick=this._loadLast.bind(this),this.frame.appendChild(this.colorPickerDiv),this.frame.appendChild(this.arrowDiv),this.frame.appendChild(this.brightnessLabel),this.frame.appendChild(this.brightnessDiv),this.frame.appendChild(this.opacityLabel),this.frame.appendChild(this.opacityDiv),this.frame.appendChild(this.newColorDiv),this.frame.appendChild(this.initialColorDiv),this.frame.appendChild(this.cancelButton),this.frame.appendChild(this.applyButton),this.frame.appendChild(this.saveButton),this.frame.appendChild(this.loadButton)}},{key:"_bindHammer",value:function(){var t=this;this.drag={},this.pinch={},this.hammer=new l(this.colorPickerCanvas),this.hammer.get("pinch").set({enable:!0}),u.onTouch(this.hammer,function(e){t._moveSelector(e)}),this.hammer.on("tap",function(e){t._moveSelector(e)}),this.hammer.on("panstart",function(e){t._moveSelector(e)}),this.hammer.on("panmove",function(e){t._moveSelector(e)}),this.hammer.on("panend",function(e){t._moveSelector(e)})}},{key:"_generateHueCircle",value:function(){if(!1===this.generated){var t=this.colorPickerCanvas.getContext("2d");void 0===this.pixelRation&&(this.pixelRatio=(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)),t.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0);var e=this.colorPickerCanvas.clientWidth,i=this.colorPickerCanvas.clientHeight;t.clearRect(0,0,e,i);var o=void 0,n=void 0,s=void 0,r=void 0;this.centerCoordinates={x:.5*e,y:.5*i},this.r=.49*e;var a=2*Math.PI/360,h=1/this.r,d=void 0;for(s=0;s<360;s++)for(r=0;rr?r:t,e=null==e?r:e0&&l.push(u.screenToValue(n)),!c.hidden&&this.itemsData.length>0&&l.push(c.screenToValue(n)),{event:t,what:d,pageX:t.srcEvent?t.srcEvent.pageX:t.pageX,pageY:t.srcEvent?t.srcEvent.pageY:t.pageY,x:o,y:n,time:r,value:l}},o.prototype._createConfigurator=function(){return new v(this,this.dom.container,g)},t.exports=o}])}); \ No newline at end of file diff --git a/dist/vis.js b/dist/vis.js index e9026974..01faf1a6 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -4,8 +4,8 @@ * * A dynamic, browser-based visualization library. * - * @version 4.20.1 - * @date 2017-07-02 + * @version 4.21.0 + * @date 2017-10-12 * * @license * Copyright (C) 2011-2017 Almende B.V, http://almende.com @@ -38,53076 +38,59899 @@ return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; - +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { - +/******/ /******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) +/******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; - +/******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} /******/ }; - +/******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - +/******/ /******/ // Flag the module as loaded -/******/ module.loaded = true; - +/******/ module.l = true; +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } - - +/******/ +/******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; - +/******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; - +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; - +/******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(0); +/******/ return __webpack_require__(__webpack_require__.s = 123); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - var util = __webpack_require__(1); +"use strict"; - // Graph3d - util.extend(exports, __webpack_require__(87)); - // Timeline & Graph2d - util.extend(exports, __webpack_require__(117)); +exports.__esModule = true; - // Network - util.extend(exports, __webpack_require__(159)); +exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - var _getIterator2 = __webpack_require__(2); - var _getIterator3 = _interopRequireDefault(_getIterator2); +exports.__esModule = true; - var _create = __webpack_require__(55); +var _defineProperty = __webpack_require__(169); - var _create2 = _interopRequireDefault(_create); +var _defineProperty2 = _interopRequireDefault(_defineProperty); - var _keys = __webpack_require__(58); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var _keys2 = _interopRequireDefault(_keys); +exports.default = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + (0, _defineProperty2.default)(target, descriptor.key, descriptor); + } + } - var _typeof2 = __webpack_require__(62); + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); - var _typeof3 = _interopRequireDefault(_typeof2); +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +"use strict"; - // utility functions - // first check if moment.js is already loaded in the browser window, if so, - // use this instance. Else, load via commonjs. +var _getIterator2 = __webpack_require__(77); +var _getIterator3 = _interopRequireDefault(_getIterator2); - var moment = __webpack_require__(82); - var uuid = __webpack_require__(86); +var _create = __webpack_require__(29); - /** - * Test whether given object is a number - * @param {*} object - * @return {Boolean} isNumber - */ - exports.isNumber = function (object) { - return object instanceof Number || typeof object == 'number'; - }; +var _create2 = _interopRequireDefault(_create); - /** - * Remove everything in the DOM object - * @param DOMobject - */ - exports.recursiveDOMDelete = function (DOMobject) { - if (DOMobject) { - while (DOMobject.hasChildNodes() === true) { - exports.recursiveDOMDelete(DOMobject.firstChild); - DOMobject.removeChild(DOMobject.firstChild); - } - } - }; +var _keys = __webpack_require__(8); - /** - * this function gives you a range between 0 and 1 based on the min and max values in the set, the total sum of all values and the current value. - * - * @param min - * @param max - * @param total - * @param value - * @returns {number} - */ - exports.giveRange = function (min, max, total, value) { - if (max == min) { - return 0.5; - } else { - var scale = 1 / (max - min); - return Math.max(0, (value - min) * scale); +var _keys2 = _interopRequireDefault(_keys); + +var _typeof2 = __webpack_require__(6); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +// utility functions + +// first check if moment.js is already loaded in the browser window, if so, +// use this instance. Else, load via commonjs. + + +var moment = __webpack_require__(9); +var uuid = __webpack_require__(157); + +/** + * Test whether given object is a number + * @param {*} object + * @return {Boolean} isNumber + */ +exports.isNumber = function (object) { + return object instanceof Number || typeof object == 'number'; +}; + +/** + * Remove everything in the DOM object + * @param {Element} DOMobject + */ +exports.recursiveDOMDelete = function (DOMobject) { + if (DOMobject) { + while (DOMobject.hasChildNodes() === true) { + exports.recursiveDOMDelete(DOMobject.firstChild); + DOMobject.removeChild(DOMobject.firstChild); } - }; + } +}; - /** - * Test whether given object is a string - * @param {*} object - * @return {Boolean} isString - */ - exports.isString = function (object) { - return object instanceof String || typeof object == 'string'; - }; +/** + * this function gives you a range between 0 and 1 based on the min and max values in the set, the total sum of all values and the current value. + * + * @param {number} min + * @param {number} max + * @param {number} total + * @param {number} value + * @returns {number} + */ +exports.giveRange = function (min, max, total, value) { + if (max == min) { + return 0.5; + } else { + var scale = 1 / (max - min); + return Math.max(0, (value - min) * scale); + } +}; - /** - * Test whether given object is a Date, or a String containing a Date - * @param {Date | String} object - * @return {Boolean} isDate - */ - exports.isDate = function (object) { - if (object instanceof Date) { +/** + * Test whether given object is a string + * @param {*} object + * @return {Boolean} isString + */ +exports.isString = function (object) { + return object instanceof String || typeof object == 'string'; +}; + +/** + * Test whether given object is a Date, or a String containing a Date + * @param {Date | String} object + * @return {Boolean} isDate + */ +exports.isDate = function (object) { + if (object instanceof Date) { + return true; + } else if (exports.isString(object)) { + // test whether this string contains a date + var match = ASPDateRegex.exec(object); + if (match) { + return true; + } else if (!isNaN(Date.parse(object))) { return true; - } else if (exports.isString(object)) { - // test whether this string contains a date - var match = ASPDateRegex.exec(object); - if (match) { - return true; - } else if (!isNaN(Date.parse(object))) { - return true; - } } + } - return false; - }; + return false; +}; - /** - * Create a semi UUID - * source: http://stackoverflow.com/a/105074/1262753 - * @return {String} uuid - */ - exports.randomUUID = function () { - return uuid.v4(); - }; +/** + * Create a semi UUID + * source: http://stackoverflow.com/a/105074/1262753 + * @return {string} uuid + */ +exports.randomUUID = function () { + return uuid.v4(); +}; - /** - * assign all keys of an object that are not nested objects to a certain value (used for color objects). - * @param obj - * @param value - */ - exports.assignAllKeys = function (obj, value) { - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - if ((0, _typeof3['default'])(obj[prop]) !== 'object') { - obj[prop] = value; - } +/** + * assign all keys of an object that are not nested objects to a certain value (used for color objects). + * @param {object} obj + * @param {number} value + */ +exports.assignAllKeys = function (obj, value) { + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + if ((0, _typeof3['default'])(obj[prop]) !== 'object') { + obj[prop] = value; } } - }; + } +}; - /** - * Fill an object with a possibly partially defined other object. Only copies values if the a object has an object requiring values. - * That means an object is not created on a property if only the b object has it. - * @param obj - * @param value - */ - exports.fillIfDefined = function (a, b) { - var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - for (var prop in a) { - if (b[prop] !== undefined) { - if ((0, _typeof3['default'])(b[prop]) !== 'object') { - if ((b[prop] === undefined || b[prop] === null) && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } else { - if ((0, _typeof3['default'])(a[prop]) === 'object') { - exports.fillIfDefined(a[prop], b[prop], allowDeletion); - } +/** + * Copy property from b to a if property present in a. + * If property in b explicitly set to null, delete it if `allowDeletion` set. + * + * Internal helper routine, should not be exported. Not added to `exports` for that reason. + * + * @param {object} a target object + * @param {object} b source object + * @param {string} prop name of property to copy to a + * @param {boolean} allowDeletion if true, delete property in a if explicitly set to null in b + * @private + */ +function copyOrDelete(a, b, prop, allowDeletion) { + var doDeletion = false; + if (allowDeletion === true) { + doDeletion = b[prop] === null && a[prop] !== undefined; + } + + if (doDeletion) { + delete a[prop]; + } else { + a[prop] = b[prop]; // Remember, this is a reference copy! + } +} + +/** + * Fill an object with a possibly partially defined other object. + * + * Only copies values for the properties already present in a. + * That means an object is not created on a property if only the b object has it. + * + * @param {object} a + * @param {object} b + * @param {boolean} [allowDeletion=false] if true, delete properties in a that are explicitly set to null in b + */ +exports.fillIfDefined = function (a, b) { + var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + // NOTE: iteration of properties of a + // NOTE: prototype properties iterated over as well + for (var prop in a) { + if (b[prop] !== undefined) { + if (b[prop] === null || (0, _typeof3['default'])(b[prop]) !== 'object') { + // Note: typeof null === 'object' + copyOrDelete(a, b, prop, allowDeletion); + } else { + if ((0, _typeof3['default'])(a[prop]) === 'object') { + exports.fillIfDefined(a[prop], b[prop], allowDeletion); } } } - }; + } +}; - /** - * Extend object a with the properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Object} a - * @param {... Object} b - * @return {Object} a - */ - exports.protoExtend = function (a, b) { - for (var i = 1; i < arguments.length; i++) { - var other = arguments[i]; - for (var prop in other) { +/** + * Extend object a with the properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Object} a + * @param {...Object} b + * @return {Object} a + */ +exports.extend = function (a, b) { + // eslint-disable-line no-unused-vars + for (var i = 1; i < arguments.length; i++) { + var other = arguments[i]; + for (var prop in other) { + if (other.hasOwnProperty(prop)) { a[prop] = other[prop]; } } - return a; - }; + } + return a; +}; - /** - * Extend object a with the properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Object} a - * @param {... Object} b - * @return {Object} a - */ - exports.extend = function (a, b) { - for (var i = 1; i < arguments.length; i++) { - var other = arguments[i]; - for (var prop in other) { - if (other.hasOwnProperty(prop)) { - a[prop] = other[prop]; - } +/** + * Extend object a with selected properties of object b or a series of objects + * Only properties with defined values are copied + * @param {Array.} props + * @param {Object} a + * @param {Object} b + * @return {Object} a + */ +exports.selectiveExtend = function (props, a, b) { + // eslint-disable-line no-unused-vars + if (!Array.isArray(props)) { + throw new Error('Array with property names expected as first argument'); + } + + for (var i = 2; i < arguments.length; i++) { + var other = arguments[i]; + + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (other && other.hasOwnProperty(prop)) { + a[prop] = other[prop]; } } - return a; - }; - - /** - * Extend object a with selected properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Array.} props - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - exports.selectiveExtend = function (props, a, b) { - if (!Array.isArray(props)) { - throw new Error('Array with property names expected as first argument'); - } - - for (var i = 2; i < arguments.length; i++) { - var other = arguments[i]; + } + return a; +}; - for (var p = 0; p < props.length; p++) { - var prop = props[p]; - if (other && other.hasOwnProperty(prop)) { - a[prop] = other[prop]; +/** + * Extend object a with selected properties of object b. + * Only properties with defined values are copied. + * + * **Note:** Previous version of this routine implied that multiple source objects + * could be used; however, the implementation was **wrong**. + * Since multiple (>1) sources weren't used anywhere in the `vis.js` code, + * this has been removed + * + * @param {Array.} props names of first-level properties to copy over + * @param {object} a target object + * @param {object} b source object + * @param {boolean} [allowDeletion=false] if true, delete property in a if explicitly set to null in b + * @returns {Object} a + */ +exports.selectiveDeepExtend = function (props, a, b) { + var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + // TODO: add support for Arrays to deepExtend + if (Array.isArray(b)) { + throw new TypeError('Arrays are not supported by deepExtend'); + } + + for (var p = 0; p < props.length; p++) { + var prop = props[p]; + if (b.hasOwnProperty(prop)) { + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + exports.deepExtend(a[prop], b[prop], false, allowDeletion); + } else { + copyOrDelete(a, b, prop, allowDeletion); } + } else if (Array.isArray(b[prop])) { + throw new TypeError('Arrays are not supported by deepExtend'); + } else { + copyOrDelete(a, b, prop, allowDeletion); } } - return a; - }; + } + return a; +}; - /** - * Extend object a with selected properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Array.} props - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - exports.selectiveDeepExtend = function (props, a, b) { - var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - - // TODO: add support for Arrays to deepExtend - if (Array.isArray(b)) { - throw new TypeError('Arrays are not supported by deepExtend'); - } - for (var i = 2; i < arguments.length; i++) { - var other = arguments[i]; - for (var p = 0; p < props.length; p++) { - var prop = props[p]; - if (other.hasOwnProperty(prop)) { - if (b[prop] && b[prop].constructor === Object) { - if (a[prop] === undefined) { - a[prop] = {}; - } - if (a[prop].constructor === Object) { - exports.deepExtend(a[prop], b[prop], false, allowDeletion); - } else { - if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - } else if (Array.isArray(b[prop])) { - throw new TypeError('Arrays are not supported by deepExtend'); - } else { - if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - } +/** + * Extend object `a` with properties of object `b`, ignoring properties which are explicitly + * specified to be excluded. + * + * The properties of `b` are considered for copying. + * Properties which are themselves objects are are also extended. + * Only properties with defined values are copied + * + * @param {Array.} propsToExclude names of properties which should *not* be copied + * @param {Object} a object to extend + * @param {Object} b object to take properties from for extension + * @param {boolean} [allowDeletion=false] if true, delete properties in a that are explicitly set to null in b + * @return {Object} a + */ +exports.selectiveNotDeepExtend = function (propsToExclude, a, b) { + var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + // TODO: add support for Arrays to deepExtend + // NOTE: array properties have an else-below; apparently, there is a problem here. + if (Array.isArray(b)) { + throw new TypeError('Arrays are not supported by deepExtend'); + } + + for (var prop in b) { + if (!b.hasOwnProperty(prop)) continue; // Handle local properties only + if (propsToExclude.indexOf(prop) !== -1) continue; // In exclusion list, skip + + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + exports.deepExtend(a[prop], b[prop]); // NOTE: allowDeletion not propagated! + } else { + copyOrDelete(a, b, prop, allowDeletion); } - } - return a; - }; - - /** - * Extend object a with selected properties of object b or a series of objects - * Only properties with defined values are copied - * @param {Array.} props - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - exports.selectiveNotDeepExtend = function (props, a, b) { - var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - - // TODO: add support for Arrays to deepExtend - if (Array.isArray(b)) { - throw new TypeError('Arrays are not supported by deepExtend'); - } - for (var prop in b) { - if (b.hasOwnProperty(prop)) { - if (props.indexOf(prop) == -1) { - if (b[prop] && b[prop].constructor === Object) { - if (a[prop] === undefined) { - a[prop] = {}; - } - if (a[prop].constructor === Object) { - exports.deepExtend(a[prop], b[prop]); - } else { - if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - } else if (Array.isArray(b[prop])) { - a[prop] = []; - for (var i = 0; i < b[prop].length; i++) { - a[prop].push(b[prop][i]); - } - } else { - if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - } + } else if (Array.isArray(b[prop])) { + a[prop] = []; + for (var i = 0; i < b[prop].length; i++) { + a[prop].push(b[prop][i]); } + } else { + copyOrDelete(a, b, prop, allowDeletion); } - return a; - }; + } - /** - * Deep extend an object a with the properties of object b - * @param {Object} a - * @param {Object} b - * @param [Boolean] protoExtend --> optional parameter. If true, the prototype values will also be extended. - * (ie. the options objects that inherit from others will also get the inherited options) - * @param [Boolean] global --> optional parameter. If true, the values of fields that are null will not deleted - * @returns {Object} - */ - exports.deepExtend = function (a, b, protoExtend, allowDeletion) { - for (var prop in b) { - if (b.hasOwnProperty(prop) || protoExtend === true) { - if (b[prop] && b[prop].constructor === Object) { - if (a[prop] === undefined) { - a[prop] = {}; - } - if (a[prop].constructor === Object) { - exports.deepExtend(a[prop], b[prop], protoExtend); - } else { - if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - } else if (Array.isArray(b[prop])) { - a[prop] = []; - for (var i = 0; i < b[prop].length; i++) { - a[prop].push(b[prop][i]); - } + return a; +}; + +/** + * Deep extend an object a with the properties of object b + * + * @param {Object} a + * @param {Object} b + * @param {boolean} [protoExtend=false] If true, the prototype values will also be extended. + * (ie. the options objects that inherit from others will also get the inherited options) + * @param {boolean} [allowDeletion=false] If true, the values of fields that are null will be deleted + * @returns {Object} + */ +exports.deepExtend = function (a, b) { + var protoExtend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + for (var prop in b) { + if (b.hasOwnProperty(prop) || protoExtend === true) { + if (b[prop] && b[prop].constructor === Object) { + if (a[prop] === undefined) { + a[prop] = {}; + } + if (a[prop].constructor === Object) { + exports.deepExtend(a[prop], b[prop], protoExtend); // NOTE: allowDeletion not propagated! } else { - if (b[prop] === null && a[prop] !== undefined && allowDeletion === true) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } + copyOrDelete(a, b, prop, allowDeletion); + } + } else if (Array.isArray(b[prop])) { + a[prop] = []; + for (var i = 0; i < b[prop].length; i++) { + a[prop].push(b[prop][i]); } + } else { + copyOrDelete(a, b, prop, allowDeletion); } } - return a; - }; + } + return a; +}; - /** - * Test whether all elements in two arrays are equal. - * @param {Array} a - * @param {Array} b - * @return {boolean} Returns true if both arrays have the same length and same - * elements. - */ - exports.equalArray = function (a, b) { - if (a.length != b.length) return false; +/** + * Test whether all elements in two arrays are equal. + * @param {Array} a + * @param {Array} b + * @return {boolean} Returns true if both arrays have the same length and same + * elements. + */ +exports.equalArray = function (a, b) { + if (a.length != b.length) return false; - for (var i = 0, len = a.length; i < len; i++) { - if (a[i] != b[i]) return false; - } + for (var i = 0, len = a.length; i < len; i++) { + if (a[i] != b[i]) return false; + } - return true; - }; + return true; +}; - /** - * Convert an object to another type - * @param {Boolean | Number | String | Date | Moment | Null | undefined} object - * @param {String | undefined} type Name of the type. Available types: - * 'Boolean', 'Number', 'String', - * 'Date', 'Moment', ISODate', 'ASPDate'. - * @return {*} object - * @throws Error - */ - exports.convert = function (object, type) { - var match; +/** + * Convert an object to another type + * @param {boolean | number | string | Date | Moment | Null | undefined} object + * @param {string | undefined} type Name of the type. Available types: + * 'Boolean', 'Number', 'String', + * 'Date', 'Moment', ISODate', 'ASPDate'. + * @return {*} object + * @throws Error + */ +exports.convert = function (object, type) { + var match; + + if (object === undefined) { + return undefined; + } + if (object === null) { + return null; + } - if (object === undefined) { - return undefined; - } - if (object === null) { - return null; - } + if (!type) { + return object; + } + if (!(typeof type === 'string') && !(type instanceof String)) { + throw new Error('Type must be a string'); + } - if (!type) { - return object; - } - if (!(typeof type === 'string') && !(type instanceof String)) { - throw new Error('Type must be a string'); - } + //noinspection FallthroughInSwitchStatementJS + switch (type) { + case 'boolean': + case 'Boolean': + return Boolean(object); - //noinspection FallthroughInSwitchStatementJS - switch (type) { - case 'boolean': - case 'Boolean': - return Boolean(object); - - case 'number': - case 'Number': - if (exports.isString(object) && !isNaN(Date.parse(object))) { - return moment(object).valueOf(); - } else { - return Number(object.valueOf()); - } - case 'string': - case 'String': - return String(object); + case 'number': + case 'Number': + if (exports.isString(object) && !isNaN(Date.parse(object))) { + return moment(object).valueOf(); + } else { + return Number(object.valueOf()); + } + case 'string': + case 'String': + return String(object); - case 'Date': - if (exports.isNumber(object)) { - return new Date(object); - } - if (object instanceof Date) { - return new Date(object.valueOf()); - } else if (moment.isMoment(object)) { - return new Date(object.valueOf()); - } - if (exports.isString(object)) { - match = ASPDateRegex.exec(object); - if (match) { - // object is an ASP date - return new Date(Number(match[1])); // parse number - } else { - return moment(new Date(object)).toDate(); // parse string - } + case 'Date': + if (exports.isNumber(object)) { + return new Date(object); + } + if (object instanceof Date) { + return new Date(object.valueOf()); + } else if (moment.isMoment(object)) { + return new Date(object.valueOf()); + } + if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])); // parse number } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); + return moment(new Date(object)).toDate(); // parse string } + } else { + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); + } - case 'Moment': - if (exports.isNumber(object)) { - return moment(object); - } - if (object instanceof Date) { - return moment(object.valueOf()); - } else if (moment.isMoment(object)) { - return moment(object); - } - if (exports.isString(object)) { - match = ASPDateRegex.exec(object); - if (match) { - // object is an ASP date - return moment(Number(match[1])); // parse number - } else { - return moment(object); // parse string - } + case 'Moment': + if (exports.isNumber(object)) { + return moment(object); + } + if (object instanceof Date) { + return moment(object.valueOf()); + } else if (moment.isMoment(object)) { + return moment(object); + } + if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return moment(Number(match[1])); // parse number } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); - } - - case 'ISODate': - if (exports.isNumber(object)) { - return new Date(object); - } else if (object instanceof Date) { - return object.toISOString(); - } else if (moment.isMoment(object)) { - return object.toDate().toISOString(); - } else if (exports.isString(object)) { - match = ASPDateRegex.exec(object); - if (match) { - // object is an ASP date - return new Date(Number(match[1])).toISOString(); // parse number - } else { - return moment(object).format(); // ISO 8601 - } + return moment(object); // parse string + } + } else { + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); + } + + case 'ISODate': + if (exports.isNumber(object)) { + return new Date(object); + } else if (object instanceof Date) { + return object.toISOString(); + } else if (moment.isMoment(object)) { + return object.toDate().toISOString(); + } else if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + if (match) { + // object is an ASP date + return new Date(Number(match[1])).toISOString(); // parse number } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ISODate'); - } - - case 'ASPDate': - if (exports.isNumber(object)) { - return '/Date(' + object + ')/'; - } else if (object instanceof Date) { - return '/Date(' + object.valueOf() + ')/'; - } else if (exports.isString(object)) { - match = ASPDateRegex.exec(object); - var value; - if (match) { - // object is an ASP date - value = new Date(Number(match[1])).valueOf(); // parse number - } else { - value = new Date(object).valueOf(); // parse string - } - return '/Date(' + value + ')/'; + return moment(object).format(); // ISO 8601 + } + } else { + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ISODate'); + } + + case 'ASPDate': + if (exports.isNumber(object)) { + return '/Date(' + object + ')/'; + } else if (object instanceof Date) { + return '/Date(' + object.valueOf() + ')/'; + } else if (exports.isString(object)) { + match = ASPDateRegex.exec(object); + var value; + if (match) { + // object is an ASP date + value = new Date(Number(match[1])).valueOf(); // parse number } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ASPDate'); + value = new Date(object).valueOf(); // parse string } + return '/Date(' + value + ')/'; + } else { + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ASPDate'); + } - default: - throw new Error('Unknown type "' + type + '"'); - } - }; - - // parse ASP.Net Date pattern, - // for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' - // code from http://momentjs.com/ - var ASPDateRegex = /^\/?Date\((\-?\d+)/i; + default: + throw new Error('Unknown type "' + type + '"'); + } +}; - /** - * Get the type of an object, for example exports.getType([]) returns 'Array' - * @param {*} object - * @return {String} type - */ - exports.getType = function (object) { - var type = typeof object === 'undefined' ? 'undefined' : (0, _typeof3['default'])(object); +// parse ASP.Net Date pattern, +// for example '/Date(1198908717056)/' or '/Date(1198908717056-0700)/' +// code from http://momentjs.com/ +var ASPDateRegex = /^\/?Date\((\-?\d+)/i; - if (type == 'object') { - if (object === null) { - return 'null'; - } - if (object instanceof Boolean) { - return 'Boolean'; - } - if (object instanceof Number) { - return 'Number'; - } - if (object instanceof String) { - return 'String'; - } - if (Array.isArray(object)) { - return 'Array'; - } - if (object instanceof Date) { - return 'Date'; - } - return 'Object'; - } else if (type == 'number') { - return 'Number'; - } else if (type == 'boolean') { +/** + * Get the type of an object, for example exports.getType([]) returns 'Array' + * @param {*} object + * @return {string} type + */ +exports.getType = function (object) { + var type = typeof object === 'undefined' ? 'undefined' : (0, _typeof3['default'])(object); + + if (type == 'object') { + if (object === null) { + return 'null'; + } + if (object instanceof Boolean) { return 'Boolean'; - } else if (type == 'string') { + } + if (object instanceof Number) { + return 'Number'; + } + if (object instanceof String) { return 'String'; - } else if (type === undefined) { - return 'undefined'; } + if (Array.isArray(object)) { + return 'Array'; + } + if (object instanceof Date) { + return 'Date'; + } + return 'Object'; + } else if (type == 'number') { + return 'Number'; + } else if (type == 'boolean') { + return 'Boolean'; + } else if (type == 'string') { + return 'String'; + } else if (type === undefined) { + return 'undefined'; + } - return type; - }; + return type; +}; - /** - * Used to extend an array and copy it. This is used to propagate paths recursively. - * - * @param arr - * @param newValue - * @returns {Array} - */ - exports.copyAndExtendArray = function (arr, newValue) { - var newArr = []; - for (var i = 0; i < arr.length; i++) { - newArr.push(arr[i]); - } - newArr.push(newValue); - return newArr; - }; - - /** - * Used to extend an array and copy it. This is used to propagate paths recursively. - * - * @param arr - * @param newValue - * @returns {Array} - */ - exports.copyArray = function (arr) { - var newArr = []; - for (var i = 0; i < arr.length; i++) { - newArr.push(arr[i]); - } - return newArr; - }; +/** + * Used to extend an array and copy it. This is used to propagate paths recursively. + * + * @param {Array} arr + * @param {*} newValue + * @returns {Array} + */ +exports.copyAndExtendArray = function (arr, newValue) { + var newArr = []; + for (var i = 0; i < arr.length; i++) { + newArr.push(arr[i]); + } + newArr.push(newValue); + return newArr; +}; - /** - * Retrieve the absolute left value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {number} left The absolute left position of this element - * in the browser page. - */ - exports.getAbsoluteLeft = function (elem) { - return elem.getBoundingClientRect().left; - }; +/** + * Used to extend an array and copy it. This is used to propagate paths recursively. + * + * @param {Array} arr + * @returns {Array} + */ +exports.copyArray = function (arr) { + var newArr = []; + for (var i = 0; i < arr.length; i++) { + newArr.push(arr[i]); + } + return newArr; +}; - exports.getAbsoluteRight = function (elem) { - return elem.getBoundingClientRect().right; - }; +/** + * Retrieve the absolute left value of a DOM element + * @param {Element} elem A dom element, for example a div + * @return {number} left The absolute left position of this element + * in the browser page. + */ +exports.getAbsoluteLeft = function (elem) { + return elem.getBoundingClientRect().left; +}; + +exports.getAbsoluteRight = function (elem) { + return elem.getBoundingClientRect().right; +}; - /** - * Retrieve the absolute top value of a DOM element - * @param {Element} elem A dom element, for example a div - * @return {number} top The absolute top position of this element - * in the browser page. - */ - exports.getAbsoluteTop = function (elem) { - return elem.getBoundingClientRect().top; - }; +/** + * Retrieve the absolute top value of a DOM element + * @param {Element} elem A dom element, for example a div + * @return {number} top The absolute top position of this element + * in the browser page. + */ +exports.getAbsoluteTop = function (elem) { + return elem.getBoundingClientRect().top; +}; - /** - * add a className to the given elements style - * @param {Element} elem - * @param {String} className - */ - exports.addClassName = function (elem, classNames) { - var classes = elem.className.split(' '); - var newClasses = classNames.split(' '); - classes = classes.concat(newClasses.filter(function (className) { - return classes.indexOf(className) < 0; - })); - elem.className = classes.join(' '); - }; +/** + * add a className to the given elements style + * @param {Element} elem + * @param {string} classNames + */ +exports.addClassName = function (elem, classNames) { + var classes = elem.className.split(' '); + var newClasses = classNames.split(' '); + classes = classes.concat(newClasses.filter(function (className) { + return classes.indexOf(className) < 0; + })); + elem.className = classes.join(' '); +}; - /** - * add a className to the given elements style - * @param {Element} elem - * @param {String} className - */ - exports.removeClassName = function (elem, classNames) { - var classes = elem.className.split(' '); - var oldClasses = classNames.split(' '); - classes = classes.filter(function (className) { - return oldClasses.indexOf(className) < 0; - }); - elem.className = classes.join(' '); - }; +/** + * add a className to the given elements style + * @param {Element} elem + * @param {string} classNames + */ +exports.removeClassName = function (elem, classNames) { + var classes = elem.className.split(' '); + var oldClasses = classNames.split(' '); + classes = classes.filter(function (className) { + return oldClasses.indexOf(className) < 0; + }); + elem.className = classes.join(' '); +}; - /** - * For each method for both arrays and objects. - * In case of an array, the built-in Array.forEach() is applied. - * In case of an Object, the method loops over all properties of the object. - * @param {Object | Array} object An Object or Array - * @param {function} callback Callback method, called for each item in - * the object or array with three parameters: - * callback(value, index, object) - */ - exports.forEach = function (object, callback) { - var i, len; - if (Array.isArray(object)) { - // array - for (i = 0, len = object.length; i < len; i++) { +/** + * For each method for both arrays and objects. + * In case of an array, the built-in Array.forEach() is applied. (**No, it's not!**) + * In case of an Object, the method loops over all properties of the object. + * @param {Object | Array} object An Object or Array + * @param {function} callback Callback method, called for each item in + * the object or array with three parameters: + * callback(value, index, object) + */ +exports.forEach = function (object, callback) { + var i, len; + if (Array.isArray(object)) { + // array + for (i = 0, len = object.length; i < len; i++) { + callback(object[i], i, object); + } + } else { + // object + for (i in object) { + if (object.hasOwnProperty(i)) { callback(object[i], i, object); } - } else { - // object - for (i in object) { - if (object.hasOwnProperty(i)) { - callback(object[i], i, object); - } - } - } - }; - - /** - * Convert an object into an array: all objects properties are put into the - * array. The resulting array is unordered. - * @param {Object} object - * @param {Array} array - */ - exports.toArray = function (object) { - var array = []; - - for (var prop in object) { - if (object.hasOwnProperty(prop)) array.push(object[prop]); } + } +}; - return array; - }; - - /** - * Update a property in an object - * @param {Object} object - * @param {String} key - * @param {*} value - * @return {Boolean} changed - */ - exports.updateProperty = function (object, key, value) { - if (object[key] !== value) { - object[key] = value; - return true; - } else { - return false; - } - }; +/** + * Convert an object into an array: all objects properties are put into the + * array. The resulting array is unordered. + * @param {Object} object + * @returns {Array} array + */ +exports.toArray = function (object) { + var array = []; - /** - * Throttle the given function to be only executed once per animation frame - * @param {function} fn - * @returns {function} Returns the throttled function - */ - exports.throttle = function (fn) { - var scheduled = false; - - return function throttled() { - if (!scheduled) { - scheduled = true; - requestAnimationFrame(function () { - scheduled = false; - fn(); - }); - } - }; - }; + for (var prop in object) { + if (object.hasOwnProperty(prop)) array.push(object[prop]); + } - /** - * Add and event listener. Works for all browsers - * @param {Element} element An html element - * @param {string} action The action, for example "click", - * without the prefix "on" - * @param {function} listener The callback function to be executed - * @param {boolean} [useCapture] - */ - exports.addEventListener = function (element, action, listener, useCapture) { - if (element.addEventListener) { - if (useCapture === undefined) useCapture = false; + return array; +}; - if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { - action = "DOMMouseScroll"; // For Firefox - } +/** + * Update a property in an object + * @param {Object} object + * @param {string} key + * @param {*} value + * @return {Boolean} changed + */ +exports.updateProperty = function (object, key, value) { + if (object[key] !== value) { + object[key] = value; + return true; + } else { + return false; + } +}; - element.addEventListener(action, listener, useCapture); - } else { - element.attachEvent("on" + action, listener); // IE browsers +/** + * Throttle the given function to be only executed once per animation frame + * @param {function} fn + * @returns {function} Returns the throttled function + */ +exports.throttle = function (fn) { + var scheduled = false; + + return function throttled() { + if (!scheduled) { + scheduled = true; + requestAnimationFrame(function () { + scheduled = false; + fn(); + }); } }; +}; - /** - * Remove an event listener from an element - * @param {Element} element An html dom element - * @param {string} action The name of the event, for example "mousedown" - * @param {function} listener The listener function - * @param {boolean} [useCapture] - */ - exports.removeEventListener = function (element, action, listener, useCapture) { - if (element.removeEventListener) { - // non-IE browsers - if (useCapture === undefined) useCapture = false; +/** + * Add and event listener. Works for all browsers + * @param {Element} element An html element + * @param {string} action The action, for example "click", + * without the prefix "on" + * @param {function} listener The callback function to be executed + * @param {boolean} [useCapture] + */ +exports.addEventListener = function (element, action, listener, useCapture) { + if (element.addEventListener) { + if (useCapture === undefined) useCapture = false; + + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox + } + + element.addEventListener(action, listener, useCapture); + } else { + element.attachEvent("on" + action, listener); // IE browsers + } +}; - if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { - action = "DOMMouseScroll"; // For Firefox - } +/** + * Remove an event listener from an element + * @param {Element} element An html dom element + * @param {string} action The name of the event, for example "mousedown" + * @param {function} listener The listener function + * @param {boolean} [useCapture] + */ +exports.removeEventListener = function (element, action, listener, useCapture) { + if (element.removeEventListener) { + // non-IE browsers + if (useCapture === undefined) useCapture = false; + + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox + } + + element.removeEventListener(action, listener, useCapture); + } else { + // IE browsers + element.detachEvent("on" + action, listener); + } +}; - element.removeEventListener(action, listener, useCapture); - } else { - // IE browsers - element.detachEvent("on" + action, listener); - } - }; +/** + * Cancels the event if it is cancelable, without stopping further propagation of the event. + * @param {Event} event + */ +exports.preventDefault = function (event) { + if (!event) event = window.event; + + if (event.preventDefault) { + event.preventDefault(); // non-IE browsers + } else { + event.returnValue = false; // IE browsers + } +}; - /** - * Cancels the event if it is cancelable, without stopping further propagation of the event. - */ - exports.preventDefault = function (event) { - if (!event) event = window.event; +/** + * Get HTML element which is the target of the event + * @param {Event} event + * @return {Element} target element + */ +exports.getTarget = function (event) { + // code from http://www.quirksmode.org/js/events_properties.html + if (!event) { + event = window.event; + } - if (event.preventDefault) { - event.preventDefault(); // non-IE browsers - } else { - event.returnValue = false; // IE browsers - } - }; + var target; - /** - * Get HTML element which is the target of the event - * @param {Event} event - * @return {Element} target element - */ - exports.getTarget = function (event) { - // code from http://www.quirksmode.org/js/events_properties.html - if (!event) { - event = window.event; - } + if (event.target) { + target = event.target; + } else if (event.srcElement) { + target = event.srcElement; + } - var target; + if (target.nodeType != undefined && target.nodeType == 3) { + // defeat Safari bug + target = target.parentNode; + } - if (event.target) { - target = event.target; - } else if (event.srcElement) { - target = event.srcElement; - } + return target; +}; - if (target.nodeType != undefined && target.nodeType == 3) { - // defeat Safari bug - target = target.parentNode; +/** + * Check if given element contains given parent somewhere in the DOM tree + * @param {Element} element + * @param {Element} parent + * @returns {boolean} + */ +exports.hasParent = function (element, parent) { + var e = element; + + while (e) { + if (e === parent) { + return true; } + e = e.parentNode; + } - return target; - }; - - /** - * Check if given element contains given parent somewhere in the DOM tree - * @param {Element} element - * @param {Element} parent - */ - exports.hasParent = function (element, parent) { - var e = element; - - while (e) { - if (e === parent) { - return true; - } - e = e.parentNode; - } + return false; +}; - return false; - }; +exports.option = {}; - exports.option = {}; +/** + * Convert a value into a boolean + * @param {Boolean | function | undefined} value + * @param {boolean} [defaultValue] + * @returns {Boolean} bool + */ +exports.option.asBoolean = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - /** - * Convert a value into a boolean - * @param {Boolean | function | undefined} value - * @param {Boolean} [defaultValue] - * @returns {Boolean} bool - */ - exports.option.asBoolean = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + if (value != null) { + return value != false; + } - if (value != null) { - return value != false; - } + return defaultValue || null; +}; - return defaultValue || null; - }; +/** + * Convert a value into a number + * @param {Boolean | function | undefined} value + * @param {number} [defaultValue] + * @returns {number} number + */ +exports.option.asNumber = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - /** - * Convert a value into a number - * @param {Boolean | function | undefined} value - * @param {Number} [defaultValue] - * @returns {Number} number - */ - exports.option.asNumber = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + if (value != null) { + return Number(value) || defaultValue || null; + } - if (value != null) { - return Number(value) || defaultValue || null; - } + return defaultValue || null; +}; - return defaultValue || null; - }; +/** + * Convert a value into a string + * @param {string | function | undefined} value + * @param {string} [defaultValue] + * @returns {String} str + */ +exports.option.asString = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - /** - * Convert a value into a string - * @param {String | function | undefined} value - * @param {String} [defaultValue] - * @returns {String} str - */ - exports.option.asString = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } + if (value != null) { + return String(value); + } - if (value != null) { - return String(value); - } + return defaultValue || null; +}; +/** + * Convert a size or location into a string with pixels or a percentage + * @param {string | number | function | undefined} value + * @param {string} [defaultValue] + * @returns {String} size + */ +exports.option.asSize = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } + + if (exports.isString(value)) { + return value; + } else if (exports.isNumber(value)) { + return value + 'px'; + } else { return defaultValue || null; - }; - - /** - * Convert a size or location into a string with pixels or a percentage - * @param {String | Number | function | undefined} value - * @param {String} [defaultValue] - * @returns {String} size - */ - exports.option.asSize = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } - - if (exports.isString(value)) { - return value; - } else if (exports.isNumber(value)) { - return value + 'px'; - } else { - return defaultValue || null; - } - }; + } +}; - /** - * Convert a value into a DOM element - * @param {HTMLElement | function | undefined} value - * @param {HTMLElement} [defaultValue] - * @returns {HTMLElement | null} dom - */ - exports.option.asElement = function (value, defaultValue) { - if (typeof value == 'function') { - value = value(); - } +/** + * Convert a value into a DOM element + * @param {HTMLElement | function | undefined} value + * @param {HTMLElement} [defaultValue] + * @returns {HTMLElement | null} dom + */ +exports.option.asElement = function (value, defaultValue) { + if (typeof value == 'function') { + value = value(); + } - return value || defaultValue || null; - }; + return value || defaultValue || null; +}; - /** - * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb - * - * @param {String} hex - * @returns {{r: *, g: *, b: *}} | 255 range - */ - exports.hexToRGB = function (hex) { - // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") - var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; - hex = hex.replace(shorthandRegex, function (m, r, g, b) { - return r + r + g + g + b + b; - }); - var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null; - }; +/** + * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb + * + * @param {string} hex + * @returns {{r: *, g: *, b: *}} | 255 range + */ +exports.hexToRGB = function (hex) { + // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") + var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; + hex = hex.replace(shorthandRegex, function (m, r, g, b) { + return r + r + g + g + b + b; + }); + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null; +}; - /** - * This function takes color in hex format or rgb() or rgba() format and overrides the opacity. Returns rgba() string. - * @param color - * @param opacity - * @returns {*} - */ - exports.overrideOpacity = function (color, opacity) { - if (color.indexOf("rgba") != -1) { +/** + * This function takes color in hex format or rgb() or rgba() format and overrides the opacity. Returns rgba() string. + * @param {string} color + * @param {number} opacity + * @returns {String} + */ +exports.overrideOpacity = function (color, opacity) { + var rgb; + if (color.indexOf("rgba") != -1) { + return color; + } else if (color.indexOf("rgb") != -1) { + rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(","); + return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")"; + } else { + rgb = exports.hexToRGB(color); + if (rgb == null) { return color; - } else if (color.indexOf("rgb") != -1) { - var rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(","); - return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")"; } else { - var rgb = exports.hexToRGB(color); - if (rgb == null) { - return color; - } else { - return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + opacity + ")"; - } + return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + opacity + ")"; } - }; + } +}; - /** - * - * @param red 0 -- 255 - * @param green 0 -- 255 - * @param blue 0 -- 255 - * @returns {string} - * @constructor - */ - exports.RGBToHex = function (red, green, blue) { - return "#" + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1); - }; +/** + * + * @param {number} red 0 -- 255 + * @param {number} green 0 -- 255 + * @param {number} blue 0 -- 255 + * @returns {String} + * @constructor + */ +exports.RGBToHex = function (red, green, blue) { + return "#" + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1); +}; - /** - * Parse a color property into an object with border, background, and - * highlight colors - * @param {Object | String} color - * @return {Object} colorObject - */ - exports.parseColor = function (color) { - var c; - if (exports.isString(color) === true) { - if (exports.isValidRGB(color) === true) { - var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) { - return parseInt(value); - }); - color = exports.RGBToHex(rgb[0], rgb[1], rgb[2]); - } - if (exports.isValidHex(color) === true) { - var hsv = exports.hexToHSV(color); - var lighterColorHSV = { h: hsv.h, s: hsv.s * 0.8, v: Math.min(1, hsv.v * 1.02) }; - var darkerColorHSV = { h: hsv.h, s: Math.min(1, hsv.s * 1.25), v: hsv.v * 0.8 }; - var darkerColorHex = exports.HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v); - var lighterColorHex = exports.HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v); - c = { +/** + * Parse a color property into an object with border, background, and + * highlight colors + * @param {Object | String} color + * @return {Object} colorObject + */ +exports.parseColor = function (color) { + var c; + if (exports.isString(color) === true) { + if (exports.isValidRGB(color) === true) { + var rgb = color.substr(4).substr(0, color.length - 5).split(',').map(function (value) { + return parseInt(value); + }); + color = exports.RGBToHex(rgb[0], rgb[1], rgb[2]); + } + if (exports.isValidHex(color) === true) { + var hsv = exports.hexToHSV(color); + var lighterColorHSV = { h: hsv.h, s: hsv.s * 0.8, v: Math.min(1, hsv.v * 1.02) }; + var darkerColorHSV = { h: hsv.h, s: Math.min(1, hsv.s * 1.25), v: hsv.v * 0.8 }; + var darkerColorHex = exports.HSVToHex(darkerColorHSV.h, darkerColorHSV.s, darkerColorHSV.v); + var lighterColorHex = exports.HSVToHex(lighterColorHSV.h, lighterColorHSV.s, lighterColorHSV.v); + c = { + background: color, + border: darkerColorHex, + highlight: { + background: lighterColorHex, + border: darkerColorHex + }, + hover: { + background: lighterColorHex, + border: darkerColorHex + } + }; + } else { + c = { + background: color, + border: color, + highlight: { background: color, - border: darkerColorHex, - highlight: { - background: lighterColorHex, - border: darkerColorHex - }, - hover: { - background: lighterColorHex, - border: darkerColorHex - } - }; - } else { - c = { + border: color + }, + hover: { background: color, - border: color, - highlight: { - background: color, - border: color - }, - hover: { - background: color, - border: color - } - }; - } + border: color + } + }; + } + } else { + c = {}; + c.background = color.background || undefined; + c.border = color.border || undefined; + + if (exports.isString(color.highlight)) { + c.highlight = { + border: color.highlight, + background: color.highlight + }; } else { - c = {}; - c.background = color.background || undefined; - c.border = color.border || undefined; - - if (exports.isString(color.highlight)) { - c.highlight = { - border: color.highlight, - background: color.highlight - }; - } else { - c.highlight = {}; - c.highlight.background = color.highlight && color.highlight.background || undefined; - c.highlight.border = color.highlight && color.highlight.border || undefined; - } + c.highlight = {}; + c.highlight.background = color.highlight && color.highlight.background || undefined; + c.highlight.border = color.highlight && color.highlight.border || undefined; + } - if (exports.isString(color.hover)) { - c.hover = { - border: color.hover, - background: color.hover - }; - } else { - c.hover = {}; - c.hover.background = color.hover && color.hover.background || undefined; - c.hover.border = color.hover && color.hover.border || undefined; - } + if (exports.isString(color.hover)) { + c.hover = { + border: color.hover, + background: color.hover + }; + } else { + c.hover = {}; + c.hover.background = color.hover && color.hover.background || undefined; + c.hover.border = color.hover && color.hover.border || undefined; } + } - return c; - }; + return c; +}; - /** - * http://www.javascripter.net/faq/rgb2hsv.htm - * - * @param red - * @param green - * @param blue - * @returns {*} - * @constructor - */ - exports.RGBToHSV = function (red, green, blue) { - red = red / 255;green = green / 255;blue = blue / 255; - var minRGB = Math.min(red, Math.min(green, blue)); - var maxRGB = Math.max(red, Math.max(green, blue)); - - // Black-gray-white - if (minRGB == maxRGB) { - return { h: 0, s: 0, v: minRGB }; - } - - // Colors other than black-gray-white: - var d = red == minRGB ? green - blue : blue == minRGB ? red - green : blue - red; - var h = red == minRGB ? 3 : blue == minRGB ? 1 : 5; - var hue = 60 * (h - d / (maxRGB - minRGB)) / 360; - var saturation = (maxRGB - minRGB) / maxRGB; - var value = maxRGB; - return { h: hue, s: saturation, v: value }; - }; +/** + * http://www.javascripter.net/faq/rgb2hsv.htm + * + * @param {number} red + * @param {number} green + * @param {number} blue + * @returns {{h: number, s: number, v: number}} + * @constructor + */ +exports.RGBToHSV = function (red, green, blue) { + red = red / 255;green = green / 255;blue = blue / 255; + var minRGB = Math.min(red, Math.min(green, blue)); + var maxRGB = Math.max(red, Math.max(green, blue)); + + // Black-gray-white + if (minRGB == maxRGB) { + return { h: 0, s: 0, v: minRGB }; + } + + // Colors other than black-gray-white: + var d = red == minRGB ? green - blue : blue == minRGB ? red - green : blue - red; + var h = red == minRGB ? 3 : blue == minRGB ? 1 : 5; + var hue = 60 * (h - d / (maxRGB - minRGB)) / 360; + var saturation = (maxRGB - minRGB) / maxRGB; + var value = maxRGB; + return { h: hue, s: saturation, v: value }; +}; + +var cssUtil = { + // split a string with css styles into an object with key/values + split: function split(cssText) { + var styles = {}; + + cssText.split(';').forEach(function (style) { + if (style.trim() != '') { + var parts = style.split(':'); + var key = parts[0].trim(); + var value = parts[1].trim(); + styles[key] = value; + } + }); - var cssUtil = { - // split a string with css styles into an object with key/values - split: function split(cssText) { - var styles = {}; + return styles; + }, - cssText.split(';').forEach(function (style) { - if (style.trim() != '') { - var parts = style.split(':'); - var key = parts[0].trim(); - var value = parts[1].trim(); - styles[key] = value; - } - }); + // build a css text string from an object with key/values + join: function join(styles) { + return (0, _keys2['default'])(styles).map(function (key) { + return key + ': ' + styles[key]; + }).join('; '); + } +}; - return styles; - }, +/** + * Append a string with css styles to an element + * @param {Element} element + * @param {string} cssText + */ +exports.addCssText = function (element, cssText) { + var currentStyles = cssUtil.split(element.style.cssText); + var newStyles = cssUtil.split(cssText); + var styles = exports.extend(currentStyles, newStyles); + + element.style.cssText = cssUtil.join(styles); +}; - // build a css text string from an object with key/values - join: function join(styles) { - return (0, _keys2['default'])(styles).map(function (key) { - return key + ': ' + styles[key]; - }).join('; '); - } - }; +/** + * Remove a string with css styles from an element + * @param {Element} element + * @param {string} cssText + */ +exports.removeCssText = function (element, cssText) { + var styles = cssUtil.split(element.style.cssText); + var removeStyles = cssUtil.split(cssText); - /** - * Append a string with css styles to an element - * @param {Element} element - * @param {String} cssText - */ - exports.addCssText = function (element, cssText) { - var currentStyles = cssUtil.split(element.style.cssText); - var newStyles = cssUtil.split(cssText); - var styles = exports.extend(currentStyles, newStyles); + for (var key in removeStyles) { + if (removeStyles.hasOwnProperty(key)) { + delete styles[key]; + } + } - element.style.cssText = cssUtil.join(styles); - }; + element.style.cssText = cssUtil.join(styles); +}; - /** - * Remove a string with css styles from an element - * @param {Element} element - * @param {String} cssText - */ - exports.removeCssText = function (element, cssText) { - var styles = cssUtil.split(element.style.cssText); - var removeStyles = cssUtil.split(cssText); +/** + * https://gist.github.com/mjijackson/5311256 + * @param {number} h + * @param {number} s + * @param {number} v + * @returns {{r: number, g: number, b: number}} + * @constructor + */ +exports.HSVToRGB = function (h, s, v) { + var r, g, b; + + var i = Math.floor(h * 6); + var f = h * 6 - i; + var p = v * (1 - s); + var q = v * (1 - f * s); + var t = v * (1 - (1 - f) * s); + + switch (i % 6) { + case 0: + r = v, g = t, b = p;break; + case 1: + r = q, g = v, b = p;break; + case 2: + r = p, g = v, b = t;break; + case 3: + r = p, g = q, b = v;break; + case 4: + r = t, g = p, b = v;break; + case 5: + r = v, g = p, b = q;break; + } + + return { r: Math.floor(r * 255), g: Math.floor(g * 255), b: Math.floor(b * 255) }; +}; + +exports.HSVToHex = function (h, s, v) { + var rgb = exports.HSVToRGB(h, s, v); + return exports.RGBToHex(rgb.r, rgb.g, rgb.b); +}; + +exports.hexToHSV = function (hex) { + var rgb = exports.hexToRGB(hex); + return exports.RGBToHSV(rgb.r, rgb.g, rgb.b); +}; + +exports.isValidHex = function (hex) { + var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); + return isOk; +}; + +exports.isValidRGB = function (rgb) { + rgb = rgb.replace(" ", ""); + var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb); + return isOk; +}; +exports.isValidRGBA = function (rgba) { + rgba = rgba.replace(" ", ""); + var isOk = /rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(rgba); + return isOk; +}; - for (var key in removeStyles) { - if (removeStyles.hasOwnProperty(key)) { - delete styles[key]; - } - } +/** + * This recursively redirects the prototype of JSON objects to the referenceObject + * This is used for default options. + * + * @param {Array.} fields + * @param {Object} referenceObject + * @returns {*} + */ +exports.selectiveBridgeObject = function (fields, referenceObject) { + if (referenceObject !== null && (typeof referenceObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(referenceObject)) === "object") { + // !!! typeof null === 'object' + var objectTo = (0, _create2['default'])(referenceObject); + for (var i = 0; i < fields.length; i++) { + if (referenceObject.hasOwnProperty(fields[i])) { + if ((0, _typeof3['default'])(referenceObject[fields[i]]) == "object") { + objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]); + } + } + } + return objectTo; + } else { + return null; + } +}; - element.style.cssText = cssUtil.join(styles); - }; +/** + * This recursively redirects the prototype of JSON objects to the referenceObject + * This is used for default options. + * + * @param {Object} referenceObject + * @returns {*} + */ +exports.bridgeObject = function (referenceObject) { + if (referenceObject !== null && (typeof referenceObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(referenceObject)) === "object") { + // !!! typeof null === 'object' + var objectTo = (0, _create2['default'])(referenceObject); + if (referenceObject instanceof Element) { + // Avoid bridging DOM objects + objectTo = referenceObject; + } else { + objectTo = (0, _create2['default'])(referenceObject); + for (var i in referenceObject) { + if (referenceObject.hasOwnProperty(i)) { + if ((0, _typeof3['default'])(referenceObject[i]) == "object") { + objectTo[i] = exports.bridgeObject(referenceObject[i]); + } + } + } + } + return objectTo; + } else { + return null; + } +}; - /** - * https://gist.github.com/mjijackson/5311256 - * @param h - * @param s - * @param v - * @returns {{r: number, g: number, b: number}} - * @constructor - */ - exports.HSVToRGB = function (h, s, v) { - var r, g, b; - - var i = Math.floor(h * 6); - var f = h * 6 - i; - var p = v * (1 - s); - var q = v * (1 - f * s); - var t = v * (1 - (1 - f) * s); - - switch (i % 6) { - case 0: - r = v, g = t, b = p;break; - case 1: - r = q, g = v, b = p;break; - case 2: - r = p, g = v, b = t;break; - case 3: - r = p, g = q, b = v;break; - case 4: - r = t, g = p, b = v;break; - case 5: - r = v, g = p, b = q;break; +/** + * This method provides a stable sort implementation, very fast for presorted data + * + * @param {Array} a the array + * @param {function} compare an order comparator + * @returns {Array} + */ +exports.insertSort = function (a, compare) { + for (var i = 0; i < a.length; i++) { + var k = a[i]; + for (var j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) { + a[j] = a[j - 1]; } + a[j] = k; + } + return a; +}; - return { r: Math.floor(r * 255), g: Math.floor(g * 255), b: Math.floor(b * 255) }; - }; +/** + * This is used to set the options of subobjects in the options object. + * + * A requirement of these subobjects is that they have an 'enabled' element + * which is optional for the user but mandatory for the program. + * + * The added value here of the merge is that option 'enabled' is set as required. + * + * + * @param {object} mergeTarget | either this.options or the options used for the groups. + * @param {object} options | options + * @param {string} option | option key in the options argument + * @param {object} globalOptions | global options, passed in to determine value of option 'enabled' + */ +exports.mergeOptions = function (mergeTarget, options, option) { + var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - exports.HSVToHex = function (h, s, v) { - var rgb = exports.HSVToRGB(h, s, v); - return exports.RGBToHex(rgb.r, rgb.g, rgb.b); + // Local helpers + var isPresent = function isPresent(obj) { + return obj !== null && obj !== undefined; }; - exports.hexToHSV = function (hex) { - var rgb = exports.hexToRGB(hex); - return exports.RGBToHSV(rgb.r, rgb.g, rgb.b); + var isObject = function isObject(obj) { + return obj !== null && (typeof obj === 'undefined' ? 'undefined' : (0, _typeof3['default'])(obj)) === 'object'; }; - exports.isValidHex = function (hex) { - var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); - return isOk; + // https://stackoverflow.com/a/34491287/1223531 + var isEmpty = function isEmpty(obj) { + for (var x in obj) { + if (obj.hasOwnProperty(x)) return false; + } + return true; }; - exports.isValidRGB = function (rgb) { - rgb = rgb.replace(" ", ""); - var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb); - return isOk; - }; - exports.isValidRGBA = function (rgba) { - rgba = rgba.replace(" ", ""); - var isOk = /rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(rgba); - return isOk; - }; + // Guards + if (!isObject(mergeTarget)) { + throw new Error('Parameter mergeTarget must be an object'); + } - /** - * This recursively redirects the prototype of JSON objects to the referenceObject - * This is used for default options. - * - * @param referenceObject - * @returns {*} - */ - exports.selectiveBridgeObject = function (fields, referenceObject) { - if ((typeof referenceObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(referenceObject)) == "object") { - var objectTo = (0, _create2['default'])(referenceObject); - for (var i = 0; i < fields.length; i++) { - if (referenceObject.hasOwnProperty(fields[i])) { - if ((0, _typeof3['default'])(referenceObject[fields[i]]) == "object") { - objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]); - } - } - } - return objectTo; - } else { - return null; - } - }; + if (!isObject(options)) { + throw new Error('Parameter options must be an object'); + } - /** - * This recursively redirects the prototype of JSON objects to the referenceObject - * This is used for default options. - * - * @param referenceObject - * @returns {*} - */ - exports.bridgeObject = function (referenceObject) { - if ((typeof referenceObject === 'undefined' ? 'undefined' : (0, _typeof3['default'])(referenceObject)) == "object") { - var objectTo = (0, _create2['default'])(referenceObject); - for (var i in referenceObject) { - if (referenceObject.hasOwnProperty(i)) { - if ((0, _typeof3['default'])(referenceObject[i]) == "object") { - objectTo[i] = exports.bridgeObject(referenceObject[i]); - } - } - } - return objectTo; - } else { - return null; + if (!isPresent(option)) { + throw new Error('Parameter option must have a value'); + } + + if (!isObject(globalOptions)) { + throw new Error('Parameter globalOptions must be an object'); + } + + // + // Actual merge routine, separated from main logic + // Only a single level of options is merged. Deeper levels are ref'd. This may actually be an issue. + // + var doMerge = function doMerge(target, options, option) { + if (!isObject(target[option])) { + target[option] = {}; } - }; - /** - * This method provides a stable sort implementation, very fast for presorted data - * - * @param a the array - * @param a order comparator - * @returns {the array} - */ - exports.insertSort = function (a, compare) { - for (var i = 0; i < a.length; i++) { - var k = a[i]; - for (var j = i; j > 0 && compare(k, a[j - 1]) < 0; j--) { - a[j] = a[j - 1]; + var src = options[option]; + var dst = target[option]; + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + dst[prop] = src[prop]; } - a[j] = k; } - return a; }; - /** - * this is used to set the options of subobjects in the options object. A requirement of these subobjects - * is that they have an 'enabled' element which is optional for the user but mandatory for the program. - * - * @param [object] mergeTarget | this is either this.options or the options used for the groups. - * @param [object] options | options - * @param [String] option | this is the option key in the options argument - */ - exports.mergeOptions = function (mergeTarget, options, option) { - var allowDeletion = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var globalOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; + // Local initialization + var srcOption = options[option]; + var globalPassed = isObject(globalOptions) && !isEmpty(globalOptions); + var globalOption = globalPassed ? globalOptions[option] : undefined; + var globalEnabled = globalOption ? globalOption.enabled : undefined; - if (options[option] === null) { - mergeTarget[option] = (0, _create2['default'])(globalOptions[option]); - } else { - if (options[option] !== undefined) { - if (typeof options[option] === 'boolean') { - mergeTarget[option].enabled = options[option]; - } else { - if (options[option].enabled === undefined) { - mergeTarget[option].enabled = true; - } - for (var prop in options[option]) { - if (options[option].hasOwnProperty(prop)) { - mergeTarget[option][prop] = options[option][prop]; - } - } - } - } + ///////////////////////////////////////// + // Main routine + ///////////////////////////////////////// + if (srcOption === undefined) { + return; // Nothing to do + } + + if (typeof srcOption === 'boolean') { + if (!isObject(mergeTarget[option])) { + mergeTarget[option] = {}; } - }; - /** - * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses - * this function will then iterate in both directions over this sorted list to find all visible items. - * - * @param {Item[]} orderedItems | Items ordered by start - * @param {function} comparator | -1 is lower, 0 is equal, 1 is higher - * @param {String} field - * @param {String} field2 - * @returns {number} - * @private - */ - exports.binarySearchCustom = function (orderedItems, comparator, field, field2) { - var maxIterations = 10000; - var iteration = 0; - var low = 0; - var high = orderedItems.length - 1; - - while (low <= high && iteration < maxIterations) { - var middle = Math.floor((low + high) / 2); - - var item = orderedItems[middle]; - var value = field2 === undefined ? item[field] : item[field][field2]; - - var searchResult = comparator(value); - if (searchResult == 0) { - // jihaa, found a visible item! - return middle; - } else if (searchResult == -1) { - // it is too small --> increase low - low = middle + 1; - } else { - // it is too big --> decrease high - high = middle - 1; - } + mergeTarget[option].enabled = srcOption; + return; + } - iteration++; + if (srcOption === null && !isObject(mergeTarget[option])) { + // If possible, explicit copy from globals + if (isPresent(globalOption)) { + mergeTarget[option] = (0, _create2['default'])(globalOption); + } else { + return; // Nothing to do } + } - return -1; - }; + if (!isObject(srcOption)) { + return; + } - /** - * This function does a binary search for a specific value in a sorted array. If it does not exist but is in between of - * two values, we return either the one before or the one after, depending on user input - * If it is found, we return the index, else -1. - * - * @param {Array} orderedItems - * @param {{start: number, end: number}} target - * @param {String} field - * @param {String} sidePreference 'before' or 'after' - * @param {function} comparator an optional comparator, returning -1,0,1 for <,==,>. - * @returns {number} - * @private - */ - exports.binarySearchValue = function (orderedItems, target, field, sidePreference, comparator) { - var maxIterations = 10000; - var iteration = 0; - var low = 0; - var high = orderedItems.length - 1; - var prevValue, value, nextValue, middle; - - var comparator = comparator != undefined ? comparator : function (a, b) { - return a == b ? 0 : a < b ? -1 : 1; - }; + // + // Ensure that 'enabled' is properly set. It is required internally + // Note that the value from options will always overwrite the existing value + // + var enabled = true; // default value - while (low <= high && iteration < maxIterations) { - // get a new guess - middle = Math.floor(0.5 * (high + low)); - prevValue = orderedItems[Math.max(0, middle - 1)][field]; - value = orderedItems[middle][field]; - nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field]; - - if (comparator(value, target) == 0) { - // we found the target - return middle; - } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) { - // target is in between of the previous and the current - return sidePreference == 'before' ? Math.max(0, middle - 1) : middle; - } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) { - // target is in between of the current and the next - return sidePreference == 'before' ? middle : Math.min(orderedItems.length - 1, middle + 1); - } else { - // didnt find the target, we need to change our boundaries. - if (comparator(value, target) < 0) { - // it is too small --> increase low - low = middle + 1; - } else { - // it is too big --> decrease high - high = middle - 1; - } - } - iteration++; + if (srcOption.enabled !== undefined) { + enabled = srcOption.enabled; + } else { + // Take from globals, if present + if (globalEnabled !== undefined) { + enabled = globalOption.enabled; } + } - // didnt find anything. Return -1. - return -1; - }; + doMerge(mergeTarget, options, option); + mergeTarget[option].enabled = enabled; +}; - /* - * Easing Functions - inspired from http://gizma.com/easing/ - * only considering the t value for the range [0, 1] => [0, 1] - * https://gist.github.com/gre/1650294 - */ - exports.easingFunctions = { - // no easing, no acceleration - linear: function linear(t) { - return t; - }, - // accelerating from zero velocity - easeInQuad: function easeInQuad(t) { - return t * t; - }, - // decelerating to zero velocity - easeOutQuad: function easeOutQuad(t) { - return t * (2 - t); - }, - // acceleration until halfway, then deceleration - easeInOutQuad: function easeInOutQuad(t) { - return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t; - }, - // accelerating from zero velocity - easeInCubic: function easeInCubic(t) { - return t * t * t; - }, - // decelerating to zero velocity - easeOutCubic: function easeOutCubic(t) { - return --t * t * t + 1; - }, - // acceleration until halfway, then deceleration - easeInOutCubic: function easeInOutCubic(t) { - return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; - }, - // accelerating from zero velocity - easeInQuart: function easeInQuart(t) { - return t * t * t * t; - }, - // decelerating to zero velocity - easeOutQuart: function easeOutQuart(t) { - return 1 - --t * t * t * t; - }, - // acceleration until halfway, then deceleration - easeInOutQuart: function easeInOutQuart(t) { - return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t; - }, - // accelerating from zero velocity - easeInQuint: function easeInQuint(t) { - return t * t * t * t * t; - }, - // decelerating to zero velocity - easeOutQuint: function easeOutQuint(t) { - return 1 + --t * t * t * t * t; - }, - // acceleration until halfway, then deceleration - easeInOutQuint: function easeInOutQuint(t) { - return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t; +/** + * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses + * this function will then iterate in both directions over this sorted list to find all visible items. + * + * @param {Item[]} orderedItems | Items ordered by start + * @param {function} comparator | -1 is lower, 0 is equal, 1 is higher + * @param {string} field + * @param {string} field2 + * @returns {number} + * @private + */ +exports.binarySearchCustom = function (orderedItems, comparator, field, field2) { + var maxIterations = 10000; + var iteration = 0; + var low = 0; + var high = orderedItems.length - 1; + + while (low <= high && iteration < maxIterations) { + var middle = Math.floor((low + high) / 2); + + var item = orderedItems[middle]; + var value = field2 === undefined ? item[field] : item[field][field2]; + + var searchResult = comparator(value); + if (searchResult == 0) { + // jihaa, found a visible item! + return middle; + } else if (searchResult == -1) { + // it is too small --> increase low + low = middle + 1; + } else { + // it is too big --> decrease high + high = middle - 1; } - }; - exports.getScrollBarWidth = function () { - var inner = document.createElement('p'); - inner.style.width = "100%"; - inner.style.height = "200px"; - - var outer = document.createElement('div'); - outer.style.position = "absolute"; - outer.style.top = "0px"; - outer.style.left = "0px"; - outer.style.visibility = "hidden"; - outer.style.width = "200px"; - outer.style.height = "150px"; - outer.style.overflow = "hidden"; - outer.appendChild(inner); - - document.body.appendChild(outer); - var w1 = inner.offsetWidth; - outer.style.overflow = 'scroll'; - var w2 = inner.offsetWidth; - if (w1 == w2) w2 = outer.clientWidth; - - document.body.removeChild(outer); - - return w1 - w2; - }; + iteration++; + } - exports.topMost = function (pile, accessors) { - var candidate = void 0; - if (!Array.isArray(accessors)) { - accessors = [accessors]; - } - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + return -1; +}; - try { - for (var _iterator = (0, _getIterator3['default'])(pile), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var member = _step.value; - - if (member) { - candidate = member[accessors[0]]; - for (var i = 1; i < accessors.length; i++) { - if (candidate) { - candidate = candidate[accessors[i]]; - } else { - continue; - } - } - if (typeof candidate != 'undefined') { - break; +/** + * This function does a binary search for a specific value in a sorted array. If it does not exist but is in between of + * two values, we return either the one before or the one after, depending on user input + * If it is found, we return the index, else -1. + * + * @param {Array} orderedItems + * @param {{start: number, end: number}} target + * @param {string} field + * @param {string} sidePreference 'before' or 'after' + * @param {function} comparator an optional comparator, returning -1,0,1 for <,==,>. + * @returns {number} + * @private + */ +exports.binarySearchValue = function (orderedItems, target, field, sidePreference, comparator) { + var maxIterations = 10000; + var iteration = 0; + var low = 0; + var high = orderedItems.length - 1; + var prevValue, value, nextValue, middle; + + comparator = comparator != undefined ? comparator : function (a, b) { + return a == b ? 0 : a < b ? -1 : 1; + }; + + while (low <= high && iteration < maxIterations) { + // get a new guess + middle = Math.floor(0.5 * (high + low)); + prevValue = orderedItems[Math.max(0, middle - 1)][field]; + value = orderedItems[middle][field]; + nextValue = orderedItems[Math.min(orderedItems.length - 1, middle + 1)][field]; + + if (comparator(value, target) == 0) { + // we found the target + return middle; + } else if (comparator(prevValue, target) < 0 && comparator(value, target) > 0) { + // target is in between of the previous and the current + return sidePreference == 'before' ? Math.max(0, middle - 1) : middle; + } else if (comparator(value, target) < 0 && comparator(nextValue, target) > 0) { + // target is in between of the current and the next + return sidePreference == 'before' ? middle : Math.min(orderedItems.length - 1, middle + 1); + } else { + // didnt find the target, we need to change our boundaries. + if (comparator(value, target) < 0) { + // it is too small --> increase low + low = middle + 1; + } else { + // it is too big --> decrease high + high = middle - 1; + } + } + iteration++; + } + + // didnt find anything. Return -1. + return -1; +}; + +/* + * Easing Functions - inspired from http://gizma.com/easing/ + * only considering the t value for the range [0, 1] => [0, 1] + * https://gist.github.com/gre/1650294 + */ +exports.easingFunctions = { + // no easing, no acceleration + linear: function linear(t) { + return t; + }, + // accelerating from zero velocity + easeInQuad: function easeInQuad(t) { + return t * t; + }, + // decelerating to zero velocity + easeOutQuad: function easeOutQuad(t) { + return t * (2 - t); + }, + // acceleration until halfway, then deceleration + easeInOutQuad: function easeInOutQuad(t) { + return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t; + }, + // accelerating from zero velocity + easeInCubic: function easeInCubic(t) { + return t * t * t; + }, + // decelerating to zero velocity + easeOutCubic: function easeOutCubic(t) { + return --t * t * t + 1; + }, + // acceleration until halfway, then deceleration + easeInOutCubic: function easeInOutCubic(t) { + return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; + }, + // accelerating from zero velocity + easeInQuart: function easeInQuart(t) { + return t * t * t * t; + }, + // decelerating to zero velocity + easeOutQuart: function easeOutQuart(t) { + return 1 - --t * t * t * t; + }, + // acceleration until halfway, then deceleration + easeInOutQuart: function easeInOutQuart(t) { + return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t; + }, + // accelerating from zero velocity + easeInQuint: function easeInQuint(t) { + return t * t * t * t * t; + }, + // decelerating to zero velocity + easeOutQuint: function easeOutQuint(t) { + return 1 + --t * t * t * t * t; + }, + // acceleration until halfway, then deceleration + easeInOutQuint: function easeInOutQuint(t) { + return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t; + } +}; + +exports.getScrollBarWidth = function () { + var inner = document.createElement('p'); + inner.style.width = "100%"; + inner.style.height = "200px"; + + var outer = document.createElement('div'); + outer.style.position = "absolute"; + outer.style.top = "0px"; + outer.style.left = "0px"; + outer.style.visibility = "hidden"; + outer.style.width = "200px"; + outer.style.height = "150px"; + outer.style.overflow = "hidden"; + outer.appendChild(inner); + + document.body.appendChild(outer); + var w1 = inner.offsetWidth; + outer.style.overflow = 'scroll'; + var w2 = inner.offsetWidth; + if (w1 == w2) w2 = outer.clientWidth; + + document.body.removeChild(outer); + + return w1 - w2; +}; + +exports.topMost = function (pile, accessors) { + var candidate = void 0; + if (!Array.isArray(accessors)) { + accessors = [accessors]; + } + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + + try { + for (var _iterator = (0, _getIterator3['default'])(pile), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var member = _step.value; + + if (member) { + candidate = member[accessors[0]]; + for (var i = 1; i < accessors.length; i++) { + if (candidate) { + candidate = candidate[accessors[i]]; + } else { + continue; } } + if (typeof candidate != 'undefined') { + break; + } + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; } finally { - try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } + if (_didIteratorError) { + throw _iteratorError; } } + } - return candidate; - }; - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(3), __esModule: true }; + return candidate; +}; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(4); - __webpack_require__(50); - module.exports = __webpack_require__(52); +module.exports = { "default": __webpack_require__(194), __esModule: true }; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(5); - var global = __webpack_require__(16) - , hide = __webpack_require__(20) - , Iterators = __webpack_require__(8) - , TO_STRING_TAG = __webpack_require__(47)('toStringTag'); +"use strict"; - for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ - var NAME = collections[i] - , Collection = global[NAME] - , proto = Collection && Collection.prototype; - if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = Iterators.Array; + +exports.__esModule = true; + +var _typeof2 = __webpack_require__(6); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } + return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; +}; + /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - var addToUnscopables = __webpack_require__(6) - , step = __webpack_require__(7) - , Iterators = __webpack_require__(8) - , toIObject = __webpack_require__(9); - - // 22.1.3.4 Array.prototype.entries() - // 22.1.3.13 Array.prototype.keys() - // 22.1.3.29 Array.prototype.values() - // 22.1.3.30 Array.prototype[@@iterator]() - module.exports = __webpack_require__(13)(Array, 'Array', function(iterated, kind){ - this._t = toIObject(iterated); // target - this._i = 0; // next index - this._k = kind; // kind - // 22.1.5.2.1 %ArrayIteratorPrototype%.next() - }, function(){ - var O = this._t - , kind = this._k - , index = this._i++; - if(!O || index >= O.length){ - this._t = undefined; - return step(1); - } - if(kind == 'keys' )return step(0, index); - if(kind == 'values')return step(0, O[index]); - return step(0, [index, O[index]]); - }, 'values'); - - // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) - Iterators.Arguments = Iterators.Array; - - addToUnscopables('keys'); - addToUnscopables('values'); - addToUnscopables('entries'); +"use strict"; -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - module.exports = function(){ /* empty */ }; +exports.__esModule = true; -/***/ }), -/* 7 */ -/***/ (function(module, exports) { +var _setPrototypeOf = __webpack_require__(196); - module.exports = function(done, value){ - return {value: value, done: !!done}; - }; +var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); -/***/ }), -/* 8 */ -/***/ (function(module, exports) { +var _create = __webpack_require__(29); - module.exports = {}; +var _create2 = _interopRequireDefault(_create); -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { +var _typeof2 = __webpack_require__(6); - // to indexed object, toObject with fallback for non-array-like ES3 strings - var IObject = __webpack_require__(10) - , defined = __webpack_require__(12); - module.exports = function(it){ - return IObject(defined(it)); - }; +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); + } + + subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; +}; /***/ }), -/* 10 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { - // fallback for non-array-like ES3 and non-enumerable old V8 strings - var cof = __webpack_require__(11); - module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ - return cof(it) == 'String' ? it.split('') : Object(it); - }; +"use strict"; -/***/ }), -/* 11 */ -/***/ (function(module, exports) { - var toString = {}.toString; +exports.__esModule = true; - module.exports = function(it){ - return toString.call(it).slice(8, -1); - }; +var _iterator = __webpack_require__(142); -/***/ }), -/* 12 */ -/***/ (function(module, exports) { +var _iterator2 = _interopRequireDefault(_iterator); - // 7.2.1 RequireObjectCoercible(argument) - module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); - return it; - }; +var _symbol = __webpack_require__(144); -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { +var _symbol2 = _interopRequireDefault(_symbol); - 'use strict'; - var LIBRARY = __webpack_require__(14) - , $export = __webpack_require__(15) - , redefine = __webpack_require__(30) - , hide = __webpack_require__(20) - , has = __webpack_require__(31) - , Iterators = __webpack_require__(8) - , $iterCreate = __webpack_require__(32) - , setToStringTag = __webpack_require__(46) - , getPrototypeOf = __webpack_require__(48) - , ITERATOR = __webpack_require__(47)('iterator') - , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` - , FF_ITERATOR = '@@iterator' - , KEYS = 'keys' - , VALUES = 'values'; - - var returnThis = function(){ return this; }; - - module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ - $iterCreate(Constructor, NAME, next); - var getMethod = function(kind){ - if(!BUGGY && kind in proto)return proto[kind]; - switch(kind){ - case KEYS: return function keys(){ return new Constructor(this, kind); }; - case VALUES: return function values(){ return new Constructor(this, kind); }; - } return function entries(){ return new Constructor(this, kind); }; - }; - var TAG = NAME + ' Iterator' - , DEF_VALUES = DEFAULT == VALUES - , VALUES_BUG = false - , proto = Base.prototype - , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] - , $default = $native || getMethod(DEFAULT) - , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined - , $anyNative = NAME == 'Array' ? proto.entries || $native : $native - , methods, key, IteratorPrototype; - // Fix native - if($anyNative){ - IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); - if(IteratorPrototype !== Object.prototype){ - // Set @@toStringTag to native iterators - setToStringTag(IteratorPrototype, TAG, true); - // fix for some old engines - if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); - } - } - // fix Array#{values, @@iterator}.name in V8 / FF - if(DEF_VALUES && $native && $native.name !== VALUES){ - VALUES_BUG = true; - $default = function values(){ return $native.call(this); }; - } - // Define iterator - if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ - hide(proto, ITERATOR, $default); - } - // Plug for library - Iterators[NAME] = $default; - Iterators[TAG] = returnThis; - if(DEFAULT){ - methods = { - values: DEF_VALUES ? $default : getMethod(VALUES), - keys: IS_SET ? $default : getMethod(KEYS), - entries: $entries - }; - if(FORCED)for(key in methods){ - if(!(key in proto))redefine(proto, key, methods[key]); - } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); - } - return methods; - }; +var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; }; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof(obj); +} : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); +}; /***/ }), -/* 14 */ +/* 7 */ /***/ (function(module, exports) { - module.exports = true; +var core = module.exports = { version: '2.5.1' }; +if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef + /***/ }), -/* 15 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { - var global = __webpack_require__(16) - , core = __webpack_require__(17) - , ctx = __webpack_require__(18) - , hide = __webpack_require__(20) - , PROTOTYPE = 'prototype'; - - var $export = function(type, name, source){ - var IS_FORCED = type & $export.F - , IS_GLOBAL = type & $export.G - , IS_STATIC = type & $export.S - , IS_PROTO = type & $export.P - , IS_BIND = type & $export.B - , IS_WRAP = type & $export.W - , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) - , expProto = exports[PROTOTYPE] - , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] - , key, own, out; - if(IS_GLOBAL)source = name; - for(key in source){ - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - if(own && key in exports)continue; - // export native or passed - out = own ? target[key] : source[key]; - // prevent global pollution for namespaces - exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] - // bind timers to global for call from export context - : IS_BIND && own ? ctx(out, global) - // wrap global constructors for prevent change them in library - : IS_WRAP && target[key] == out ? (function(C){ - var F = function(a, b, c){ - if(this instanceof C){ - switch(arguments.length){ - case 0: return new C; - case 1: return new C(a); - case 2: return new C(a, b); - } return new C(a, b, c); - } return C.apply(this, arguments); - }; - F[PROTOTYPE] = C[PROTOTYPE]; - return F; - // make static versions for prototype methods - })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; - // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% - if(IS_PROTO){ - (exports.virtual || (exports.virtual = {}))[key] = out; - // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% - if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); - } - } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - $export.U = 64; // safe - $export.R = 128; // real proto method for `library` - module.exports = $export; +module.exports = { "default": __webpack_require__(140), __esModule: true }; /***/ }), -/* 16 */ -/***/ (function(module, exports) { +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef +"use strict"; -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - var core = module.exports = {version: '2.4.0'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef +// first check if moment.js is already loaded in the browser window, if so, +// use this instance. Else, load via commonjs. +module.exports = typeof window !== 'undefined' && window['moment'] || __webpack_require__(154); /***/ }), -/* 18 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { - // optional / simple context binding - var aFunction = __webpack_require__(19); - module.exports = function(fn, that, length){ - aFunction(fn); - if(that === undefined)return fn; - switch(length){ - case 1: return function(a){ - return fn.call(that, a); - }; - case 2: return function(a, b){ - return fn.call(that, a, b); - }; - case 3: return function(a, b, c){ - return fn.call(that, a, b, c); +"use strict"; + + +/** + * Setup a mock hammer.js object, for unit testing. + * + * Inspiration: https://github.com/uber/deck.gl/pull/658 + * + * @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}} + */ +function hammerMock() { + var noop = function noop() {}; + + return { + on: noop, + off: noop, + destroy: noop, + emit: noop, + + get: function get(m) { + //eslint-disable-line no-unused-vars + return { + set: noop }; } - return function(/* ...args */){ - return fn.apply(that, arguments); - }; }; +} -/***/ }), -/* 19 */ -/***/ (function(module, exports) { - - module.exports = function(it){ - if(typeof it != 'function')throw TypeError(it + ' is not a function!'); - return it; +if (typeof window !== 'undefined') { + var propagating = __webpack_require__(175); + var Hammer = window['Hammer'] || __webpack_require__(176); + module.exports = propagating(Hammer, { + preventDefault: 'mouse' + }); +} else { + module.exports = function () { + // hammer.js is only available in a browser, not in node.js. Replacing it with a mock object. + return hammerMock(); }; +} /***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - - var dP = __webpack_require__(21) - , createDesc = __webpack_require__(29); - module.exports = __webpack_require__(25) ? function(object, key, value){ - return dP.f(object, key, createDesc(1, value)); - } : function(object, key, value){ - object[key] = value; - return object; - }; - -/***/ }), -/* 21 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { - var anObject = __webpack_require__(22) - , IE8_DOM_DEFINE = __webpack_require__(24) - , toPrimitive = __webpack_require__(28) - , dP = Object.defineProperty; - - exports.f = __webpack_require__(25) ? Object.defineProperty : function defineProperty(O, P, Attributes){ - anObject(O); - P = toPrimitive(P, true); - anObject(Attributes); - if(IE8_DOM_DEFINE)try { - return dP(O, P, Attributes); - } catch(e){ /* empty */ } - if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); - if('value' in Attributes)O[P] = Attributes.value; - return O; - }; +"use strict"; -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - var isObject = __webpack_require__(23); - module.exports = function(it){ - if(!isObject(it))throw TypeError(it + ' is not an object!'); - return it; - }; +var _stringify = __webpack_require__(19); -/***/ }), -/* 23 */ -/***/ (function(module, exports) { +var _stringify2 = _interopRequireDefault(_stringify); - module.exports = function(it){ - return typeof it === 'object' ? it !== null : typeof it === 'function'; - }; +var _typeof2 = __webpack_require__(6); -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { +var _typeof3 = _interopRequireDefault(_typeof2); - module.exports = !__webpack_require__(25) && !__webpack_require__(26)(function(){ - return Object.defineProperty(__webpack_require__(27)('div'), 'a', {get: function(){ return 7; }}).a != 7; - }); +var _keys = __webpack_require__(8); -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { +var _keys2 = _interopRequireDefault(_keys); - // Thank's IE8 for his funny defineProperty - module.exports = !__webpack_require__(26)(function(){ - return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; - }); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -/***/ }), -/* 26 */ -/***/ (function(module, exports) { +var util = __webpack_require__(2); +var Queue = __webpack_require__(43); - module.exports = function(exec){ - try { - return !!exec(); - } catch(e){ - return true; +/** + * DataSet + * // TODO: add a DataSet constructor DataSet(data, options) + * + * Usage: + * var dataSet = new DataSet({ + * fieldId: '_id', + * type: { + * // ... + * } + * }); + * + * dataSet.add(item); + * dataSet.add(data); + * dataSet.update(item); + * dataSet.update(data); + * dataSet.remove(id); + * dataSet.remove(ids); + * var data = dataSet.get(); + * var data = dataSet.get(id); + * var data = dataSet.get(ids); + * var data = dataSet.get(ids, options, data); + * dataSet.clear(); + * + * A data set can: + * - add/remove/update data + * - gives triggers upon changes in the data + * - can import/export data in various data formats + * + * @param {Array} [data] Optional array with initial data + * @param {Object} [options] Available options: + * {string} fieldId Field name of the id in the + * items, 'id' by default. + * {Object.} addedIds Array with the ids of the added items + */ +DataSet.prototype.add = function (data, senderId) { + var addedIds = [], + id, + me = this; + + if (Array.isArray(data)) { + // Array + for (var i = 0, len = data.length; i < len; i++) { + id = me._addItem(data[i]); + addedIds.push(id); + } + } else if (data && (typeof data === 'undefined' ? 'undefined' : (0, _typeof3['default'])(data)) === 'object') { + // Single item + id = me._addItem(data); + addedIds.push(id); + } else { + throw new Error('Unknown dataType'); + } -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { + if (addedIds.length) { + this._trigger('add', { items: addedIds }, senderId); + } - // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - var anObject = __webpack_require__(22) - , dPs = __webpack_require__(34) - , enumBugKeys = __webpack_require__(44) - , IE_PROTO = __webpack_require__(41)('IE_PROTO') - , Empty = function(){ /* empty */ } - , PROTOTYPE = 'prototype'; - - // Create object with fake `null` prototype: use iframe Object with cleared prototype - var createDict = function(){ - // Thrash, waste and sodomy: IE GC bug - var iframe = __webpack_require__(27)('iframe') - , i = enumBugKeys.length - , lt = '<' - , gt = '>' - , iframeDocument; - iframe.style.display = 'none'; - __webpack_require__(45).appendChild(iframe); - iframe.src = 'javascript:'; // eslint-disable-line no-script-url - // createDict = iframe.contentWindow.Object; - // html.removeChild(iframe); - iframeDocument = iframe.contentWindow.document; - iframeDocument.open(); - iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); - iframeDocument.close(); - createDict = iframeDocument.F; - while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; - return createDict(); - }; + return addedIds; +}; - module.exports = Object.create || function create(O, Properties){ - var result; - if(O !== null){ - Empty[PROTOTYPE] = anObject(O); - result = new Empty; - Empty[PROTOTYPE] = null; - // add "__proto__" for Object.getPrototypeOf polyfill - result[IE_PROTO] = O; - } else result = createDict(); - return Properties === undefined ? result : dPs(result, Properties); +/** + * Update existing items. When an item does not exist, it will be created + * @param {Object | Array} data + * @param {string} [senderId] Optional sender id + * @return {Array.} updatedIds The ids of the added or updated items + * @throws {Error} Unknown Datatype + */ +DataSet.prototype.update = function (data, senderId) { + var addedIds = []; + var updatedIds = []; + var oldData = []; + var updatedData = []; + var me = this; + var fieldId = me._fieldId; + + var addOrUpdate = function addOrUpdate(item) { + var id = item[fieldId]; + if (me._data[id]) { + var oldItem = util.extend({}, me._data[id]); + // update item + id = me._updateItem(item); + updatedIds.push(id); + updatedData.push(item); + oldData.push(oldItem); + } else { + // add new item + id = me._addItem(item); + addedIds.push(id); + } }; + if (Array.isArray(data)) { + // Array + for (var i = 0, len = data.length; i < len; i++) { + if (data[i] && (0, _typeof3['default'])(data[i]) === 'object') { + addOrUpdate(data[i]); + } else { + console.warn('Ignoring input item, which is not an object at index ' + i); + } + } + } else if (data && (typeof data === 'undefined' ? 'undefined' : (0, _typeof3['default'])(data)) === 'object') { + // Single item + addOrUpdate(data); + } else { + throw new Error('Unknown dataType'); + } -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { + if (addedIds.length) { + this._trigger('add', { items: addedIds }, senderId); + } + if (updatedIds.length) { + var props = { items: updatedIds, oldData: oldData, data: updatedData }; + // TODO: remove deprecated property 'data' some day + //Object.defineProperty(props, 'data', { + // 'get': (function() { + // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data'); + // return updatedData; + // }).bind(this) + //}); + this._trigger('update', props, senderId); + } - var dP = __webpack_require__(21) - , anObject = __webpack_require__(22) - , getKeys = __webpack_require__(35); - - module.exports = __webpack_require__(25) ? Object.defineProperties : function defineProperties(O, Properties){ - anObject(O); - var keys = getKeys(Properties) - , length = keys.length - , i = 0 - , P; - while(length > i)dP.f(O, P = keys[i++], Properties[P]); - return O; - }; + return addedIds.concat(updatedIds); +}; -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Get a data item or multiple items. + * + * Usage: + * + * get() + * get(options: Object) + * + * get(id: number | string) + * get(id: number | string, options: Object) + * + * get(ids: number[] | string[]) + * get(ids: number[] | string[], options: Object) + * + * Where: + * + * {number | string} id The id of an item + * {number[] | string{}} ids An array with ids of items + * {Object} options An Object with options. Available options: + * {string} [returnType] Type of data to be returned. + * Can be 'Array' (default) or 'Object'. + * {Object.} [type] + * {string[]} [fields] field names to be returned + * {function} [filter] filter items + * {string | function} [order] Order the items by a field name or custom sort function. + * @param {Array} args + * @returns {DataSet} + * @throws Error + */ +DataSet.prototype.get = function (args) { + // eslint-disable-line no-unused-vars + var me = this; + + // parse the arguments + var id, ids, options; + var firstType = util.getType(arguments[0]); + if (firstType == 'String' || firstType == 'Number') { + // get(id [, options]) + id = arguments[0]; + options = arguments[1]; + } else if (firstType == 'Array') { + // get(ids [, options]) + ids = arguments[0]; + options = arguments[1]; + } else { + // get([, options]) + options = arguments[0]; + } - // 19.1.2.14 / 15.2.3.14 Object.keys(O) - var $keys = __webpack_require__(36) - , enumBugKeys = __webpack_require__(44); + // determine the return type + var returnType; + if (options && options.returnType) { + var allowedValues = ['Array', 'Object']; + returnType = allowedValues.indexOf(options.returnType) == -1 ? 'Array' : options.returnType; + } else { + returnType = 'Array'; + } + + // build options + var type = options && options.type || this._options.type; + var filter = options && options.filter; + var items = [], + item, + itemIds, + itemId, + i, + len; + + // convert items + if (id != undefined) { + // return a single item + item = me._getItem(id, type); + if (item && filter && !filter(item)) { + item = null; + } + } else if (ids != undefined) { + // return a subset of items + for (i = 0, len = ids.length; i < len; i++) { + item = me._getItem(ids[i], type); + if (!filter || filter(item)) { + items.push(item); + } + } + } else { + // return all items + itemIds = (0, _keys2['default'])(this._data); + for (i = 0, len = itemIds.length; i < len; i++) { + itemId = itemIds[i]; + item = me._getItem(itemId, type); + if (!filter || filter(item)) { + items.push(item); + } + } + } - module.exports = Object.keys || function keys(O){ - return $keys(O, enumBugKeys); - }; + // order the results + if (options && options.order && id == undefined) { + this._sort(items, options.order); + } -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { + // filter fields of the items + if (options && options.fields) { + var fields = options.fields; + if (id != undefined) { + item = this._filterFields(item, fields); + } else { + for (i = 0, len = items.length; i < len; i++) { + items[i] = this._filterFields(items[i], fields); + } + } + } - var has = __webpack_require__(31) - , toIObject = __webpack_require__(9) - , arrayIndexOf = __webpack_require__(37)(false) - , IE_PROTO = __webpack_require__(41)('IE_PROTO'); - - module.exports = function(object, names){ - var O = toIObject(object) - , i = 0 - , result = [] - , key; - for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); - // Don't enum bug & hidden keys - while(names.length > i)if(has(O, key = names[i++])){ - ~arrayIndexOf(result, key) || result.push(key); + // return the results + if (returnType == 'Object') { + var result = {}, + resultant; + for (i = 0, len = items.length; i < len; i++) { + resultant = items[i]; + result[resultant.id] = resultant; } return result; - }; + } else { + if (id != undefined) { + // a single item + return item; + } else { + // just return our array + return items; + } + } +}; -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Get ids of all items or from a filtered set of items. + * @param {Object} [options] An Object with options. Available options: + * {function} [filter] filter items + * {string | function} [order] Order the items by + * a field name or custom sort function. + * @return {Array.} ids + */ +DataSet.prototype.getIds = function (options) { + var data = this._data, + filter = options && options.filter, + order = options && options.order, + type = options && options.type || this._options.type, + itemIds = (0, _keys2['default'])(data), + i, + len, + id, + item, + items, + ids = []; - // false -> Array#indexOf - // true -> Array#includes - var toIObject = __webpack_require__(9) - , toLength = __webpack_require__(38) - , toIndex = __webpack_require__(40); - module.exports = function(IS_INCLUDES){ - return function($this, el, fromIndex){ - var O = toIObject($this) - , length = toLength(O.length) - , index = toIndex(fromIndex, length) - , value; - // Array#includes uses SameValueZero equality algorithm - if(IS_INCLUDES && el != el)while(length > index){ - value = O[index++]; - if(value != value)return true; - // Array#toIndex ignores holes, Array#includes - not - } else for(;length > index; index++)if(IS_INCLUDES || index in O){ - if(O[index] === el)return IS_INCLUDES || index || 0; - } return !IS_INCLUDES && -1; - }; - }; + if (filter) { + // get filtered items + if (order) { + // create ordered list + items = []; + for (i = 0, len = itemIds.length; i < len; i++) { + id = itemIds[i]; + item = this._getItem(id, type); + if (filter(item)) { + items.push(item); + } + } -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { + this._sort(items, order); - // 7.1.15 ToLength - var toInteger = __webpack_require__(39) - , min = Math.min; - module.exports = function(it){ - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 - }; + for (i = 0, len = items.length; i < len; i++) { + ids.push(items[i][this._fieldId]); + } + } else { + // create unordered list + for (i = 0, len = itemIds.length; i < len; i++) { + id = itemIds[i]; + item = this._getItem(id, type); + if (filter(item)) { + ids.push(item[this._fieldId]); + } + } + } + } else { + // get all items + if (order) { + // create an ordered list + items = []; + for (i = 0, len = itemIds.length; i < len; i++) { + id = itemIds[i]; + items.push(data[id]); + } -/***/ }), -/* 39 */ -/***/ (function(module, exports) { + this._sort(items, order); - // 7.1.4 ToInteger - var ceil = Math.ceil - , floor = Math.floor; - module.exports = function(it){ - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); - }; + for (i = 0, len = items.length; i < len; i++) { + ids.push(items[i][this._fieldId]); + } + } else { + // create unordered list + for (i = 0, len = itemIds.length; i < len; i++) { + id = itemIds[i]; + item = data[id]; + ids.push(item[this._fieldId]); + } + } + } -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { + return ids; +}; - var toInteger = __webpack_require__(39) - , max = Math.max - , min = Math.min; - module.exports = function(index, length){ - index = toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); - }; +/** + * Returns the DataSet itself. Is overwritten for example by the DataView, + * which returns the DataSet it is connected to instead. + * @returns {DataSet} + */ +DataSet.prototype.getDataSet = function () { + return this; +}; -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Execute a callback function for every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {string[]} [fields] filter fields + * {function} [filter] filter items + * {string | function} [order] Order the items by + * a field name or custom sort function. + */ +DataSet.prototype.forEach = function (callback, options) { + var filter = options && options.filter, + type = options && options.type || this._options.type, + data = this._data, + itemIds = (0, _keys2['default'])(data), + i, + len, + item, + id; + + if (options && options.order) { + // execute forEach on ordered list + var items = this.get(options); + + for (i = 0, len = items.length; i < len; i++) { + item = items[i]; + id = item[this._fieldId]; + callback(item, id); + } + } else { + // unordered + for (i = 0, len = itemIds.length; i < len; i++) { + id = itemIds[i]; + item = this._getItem(id, type); + if (!filter || filter(item)) { + callback(item, id); + } + } + } +}; - var shared = __webpack_require__(42)('keys') - , uid = __webpack_require__(43); - module.exports = function(key){ - return shared[key] || (shared[key] = uid(key)); - }; +/** + * Map every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {string[]} [fields] filter fields + * {function} [filter] filter items + * {string | function} [order] Order the items by + * a field name or custom sort function. + * @return {Object[]} mappedItems + */ +DataSet.prototype.map = function (callback, options) { + var filter = options && options.filter, + type = options && options.type || this._options.type, + mappedItems = [], + data = this._data, + itemIds = (0, _keys2['default'])(data), + i, + len, + id, + item; + + // convert and filter items + for (i = 0, len = itemIds.length; i < len; i++) { + id = itemIds[i]; + item = this._getItem(id, type); + if (!filter || filter(item)) { + mappedItems.push(callback(item, id)); + } + } + + // order items + if (options && options.order) { + this._sort(mappedItems, options.order); + } + + return mappedItems; +}; -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Filter the fields of an item + * @param {Object | null} item + * @param {string[]} fields Field names + * @return {Object | null} filteredItem or null if no item is provided + * @private + */ +DataSet.prototype._filterFields = function (item, fields) { + if (!item) { + // item is null + return item; + } + + var filteredItem = {}, + itemFields = (0, _keys2['default'])(item), + len = itemFields.length, + i, + field; + + if (Array.isArray(fields)) { + for (i = 0; i < len; i++) { + field = itemFields[i]; + if (fields.indexOf(field) != -1) { + filteredItem[field] = item[field]; + } + } + } else { + for (i = 0; i < len; i++) { + field = itemFields[i]; + if (fields.hasOwnProperty(field)) { + filteredItem[fields[field]] = item[field]; + } + } + } - var global = __webpack_require__(16) - , SHARED = '__core-js_shared__' - , store = global[SHARED] || (global[SHARED] = {}); - module.exports = function(key){ - return store[key] || (store[key] = {}); - }; + return filteredItem; +}; -/***/ }), -/* 43 */ -/***/ (function(module, exports) { +/** + * Sort the provided array with items + * @param {Object[]} items + * @param {string | function} order A field name or custom sort function. + * @private + */ +DataSet.prototype._sort = function (items, order) { + if (util.isString(order)) { + // order by provided field name + var name = order; // field name + items.sort(function (a, b) { + var av = a[name]; + var bv = b[name]; + return av > bv ? 1 : av < bv ? -1 : 0; + }); + } else if (typeof order === 'function') { + // order by sort function + items.sort(order); + } + // TODO: extend order by an Object {field:string, direction:string} + // where direction can be 'asc' or 'desc' + else { + throw new TypeError('Order must be a function or a string'); + } +}; - var id = 0 - , px = Math.random(); - module.exports = function(key){ - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); - }; +/** + * Remove an object by pointer or by id + * @param {string | number | Object | Array.} id Object or id, or an array with + * objects or ids to be removed + * @param {string} [senderId] Optional sender id + * @return {Array.} removedIds + */ +DataSet.prototype.remove = function (id, senderId) { + var removedIds = [], + removedItems = [], + ids = [], + i, + len, + itemId, + item; + + // force everything to be an array for simplicity + ids = Array.isArray(id) ? id : [id]; + + for (i = 0, len = ids.length; i < len; i++) { + item = this._remove(ids[i]); + if (item) { + itemId = item[this._fieldId]; + if (itemId != undefined) { + removedIds.push(itemId); + removedItems.push(item); + } + } + } -/***/ }), -/* 44 */ -/***/ (function(module, exports) { + if (removedIds.length) { + this._trigger('remove', { items: removedIds, oldData: removedItems }, senderId); + } - // IE 8- don't enum bug keys - module.exports = ( - 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' - ).split(','); + return removedIds; +}; -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(16).document && document.documentElement; - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Remove an item by its id + * @param {number | string | Object} id id or item + * @returns {number | string | null} id + * @private + */ +DataSet.prototype._remove = function (id) { + var item, ident; + + // confirm the id to use based on the args type + if (util.isNumber(id) || util.isString(id)) { + ident = id; + } else if (id && (typeof id === 'undefined' ? 'undefined' : (0, _typeof3['default'])(id)) === 'object') { + ident = id[this._fieldId]; // look for the identifier field using _fieldId + } + + // do the remove if the item is found + if (ident !== undefined && this._data[ident]) { + item = this._data[ident]; + delete this._data[ident]; + this.length--; + return item; + } + return null; +}; - var def = __webpack_require__(21).f - , has = __webpack_require__(31) - , TAG = __webpack_require__(47)('toStringTag'); +/** + * Clear the data + * @param {string} [senderId] Optional sender id + * @return {Array.} removedIds The ids of all removed items + */ +DataSet.prototype.clear = function (senderId) { + var i, len; + var ids = (0, _keys2['default'])(this._data); + var items = []; - module.exports = function(it, tag, stat){ - if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); - }; + for (i = 0, len = ids.length; i < len; i++) { + items.push(this._data[ids[i]]); + } -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { + this._data = {}; + this.length = 0; - var store = __webpack_require__(42)('wks') - , uid = __webpack_require__(43) - , Symbol = __webpack_require__(16).Symbol - , USE_SYMBOL = typeof Symbol == 'function'; + this._trigger('remove', { items: ids, oldData: items }, senderId); - var $exports = module.exports = function(name){ - return store[name] || (store[name] = - USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); - }; + return ids; +}; - $exports.store = store; +/** + * Find the item with maximum value of a specified field + * @param {string} field + * @return {Object | null} item Item containing max value, or null if no items + */ +DataSet.prototype.max = function (field) { + var data = this._data, + itemIds = (0, _keys2['default'])(data), + max = null, + maxField = null, + i, + len; + + for (i = 0, len = itemIds.length; i < len; i++) { + var id = itemIds[i]; + var item = data[id]; + var itemField = item[field]; + if (itemField != null && (!max || itemField > maxField)) { + max = item; + maxField = itemField; + } + } + + return max; +}; -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Find the item with minimum value of a specified field + * @param {string} field + * @return {Object | null} item Item containing max value, or null if no items + */ +DataSet.prototype.min = function (field) { + var data = this._data, + itemIds = (0, _keys2['default'])(data), + min = null, + minField = null, + i, + len; + + for (i = 0, len = itemIds.length; i < len; i++) { + var id = itemIds[i]; + var item = data[id]; + var itemField = item[field]; + if (itemField != null && (!min || itemField < minField)) { + min = item; + minField = itemField; + } + } + + return min; +}; - // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) - var has = __webpack_require__(31) - , toObject = __webpack_require__(49) - , IE_PROTO = __webpack_require__(41)('IE_PROTO') - , ObjectProto = Object.prototype; - - module.exports = Object.getPrototypeOf || function(O){ - O = toObject(O); - if(has(O, IE_PROTO))return O[IE_PROTO]; - if(typeof O.constructor == 'function' && O instanceof O.constructor){ - return O.constructor.prototype; - } return O instanceof Object ? ObjectProto : null; - }; +/** + * Find all distinct values of a specified field + * @param {string} field + * @return {Array} values Array containing all distinct values. If data items + * do not contain the specified field are ignored. + * The returned array is unordered. + */ +DataSet.prototype.distinct = function (field) { + var data = this._data; + var itemIds = (0, _keys2['default'])(data); + var values = []; + var fieldType = this._options.type && this._options.type[field] || null; + var count = 0; + var i, j, len; + + for (i = 0, len = itemIds.length; i < len; i++) { + var id = itemIds[i]; + var item = data[id]; + var value = item[field]; + var exists = false; + for (j = 0; j < count; j++) { + if (values[j] == value) { + exists = true; + break; + } + } + if (!exists && value !== undefined) { + values[count] = value; + count++; + } + } -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { + if (fieldType) { + for (i = 0, len = values.length; i < len; i++) { + values[i] = util.convert(values[i], fieldType); + } + } - // 7.1.13 ToObject(argument) - var defined = __webpack_require__(12); - module.exports = function(it){ - return Object(defined(it)); - }; + return values; +}; -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Add a single item. Will fail when an item with the same id already exists. + * @param {Object} item + * @return {string} id + * @private + */ +DataSet.prototype._addItem = function (item) { + var id = item[this._fieldId]; + + if (id != undefined) { + // check whether this id is already taken + if (this._data[id]) { + // item already exists + throw new Error('Cannot add item: item with id ' + id + ' already exists'); + } + } else { + // generate an id + id = util.randomUUID(); + item[this._fieldId] = id; + } - 'use strict'; - var $at = __webpack_require__(51)(true); - - // 21.1.3.27 String.prototype[@@iterator]() - __webpack_require__(13)(String, 'String', function(iterated){ - this._t = String(iterated); // target - this._i = 0; // next index - // 21.1.5.2.1 %StringIteratorPrototype%.next() - }, function(){ - var O = this._t - , index = this._i - , point; - if(index >= O.length)return {value: undefined, done: true}; - point = $at(O, index); - this._i += point.length; - return {value: point, done: false}; - }); + var d = {}, + fields = (0, _keys2['default'])(item), + i, + len; + for (i = 0, len = fields.length; i < len; i++) { + var field = fields[i]; + var fieldType = this._type[field]; // type may be undefined + d[field] = util.convert(item[field], fieldType); + } + this._data[id] = d; + this.length++; -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { + return id; +}; - var toInteger = __webpack_require__(39) - , defined = __webpack_require__(12); - // true -> String#at - // false -> String#codePointAt - module.exports = function(TO_STRING){ - return function(that, pos){ - var s = String(defined(that)) - , i = toInteger(pos) - , l = s.length - , a, b; - if(i < 0 || i >= l)return TO_STRING ? '' : undefined; - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; - }; +/** + * Get an item. Fields can be converted to a specific type + * @param {string} id + * @param {Object.} [types] field types to convert + * @return {Object | null} item + * @private + */ +DataSet.prototype._getItem = function (id, types) { + var field, value, i, len; + + // get the item from the dataset + var raw = this._data[id]; + if (!raw) { + return null; + } -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { + // convert the items field types + var converted = {}, + fields = (0, _keys2['default'])(raw); - var anObject = __webpack_require__(22) - , get = __webpack_require__(53); - module.exports = __webpack_require__(17).getIterator = function(it){ - var iterFn = get(it); - if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); - return anObject(iterFn.call(it)); - }; + if (types) { + for (i = 0, len = fields.length; i < len; i++) { + field = fields[i]; + value = raw[field]; + converted[field] = util.convert(value, types[field]); + } + } else { + // no field types specified, no converting needed + for (i = 0, len = fields.length; i < len; i++) { + field = fields[i]; + value = raw[field]; + converted[field] = value; + } + } -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { + if (!converted[this._fieldId]) { + converted[this._fieldId] = raw.id; + } - var classof = __webpack_require__(54) - , ITERATOR = __webpack_require__(47)('iterator') - , Iterators = __webpack_require__(8); - module.exports = __webpack_require__(17).getIteratorMethod = function(it){ - if(it != undefined)return it[ITERATOR] - || it['@@iterator'] - || Iterators[classof(it)]; - }; + return converted; +}; -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Update a single item: merge with existing item. + * Will fail when the item has no id, or when there does not exist an item + * with the same id. + * @param {Object} item + * @return {string} id + * @private + */ +DataSet.prototype._updateItem = function (item) { + var id = item[this._fieldId]; + if (id == undefined) { + throw new Error('Cannot update item: item has no id (item: ' + (0, _stringify2['default'])(item) + ')'); + } + var d = this._data[id]; + if (!d) { + // item doesn't exist + throw new Error('Cannot update item: no item with id ' + id + ' found'); + } - // getting tag from 19.1.3.6 Object.prototype.toString() - var cof = __webpack_require__(11) - , TAG = __webpack_require__(47)('toStringTag') - // ES3 wrong here - , ARG = cof(function(){ return arguments; }()) == 'Arguments'; + // merge with current item + var fields = (0, _keys2['default'])(item); + for (var i = 0, len = fields.length; i < len; i++) { + var field = fields[i]; + var fieldType = this._type[field]; // type may be undefined + d[field] = util.convert(item[field], fieldType); + } - // fallback for IE11 Script Access Denied error - var tryGet = function(it, key){ - try { - return it[key]; - } catch(e){ /* empty */ } - }; + return id; +}; - module.exports = function(it){ - var O, T, B; - return it === undefined ? 'Undefined' : it === null ? 'Null' - // @@toStringTag case - : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T - // builtinTag case - : ARG ? cof(O) - // ES3 arguments fallback - : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; - }; +module.exports = DataSet; /***/ }), -/* 55 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(56), __esModule: true }; +"use strict"; -/***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { - __webpack_require__(57); - var $Object = __webpack_require__(17).Object; - module.exports = function create(P, D){ - return $Object.create(P, D); - }; +var _keys = __webpack_require__(8); -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { +var _keys2 = _interopRequireDefault(_keys); - var $export = __webpack_require__(15) - // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) - $export($export.S, 'Object', {create: __webpack_require__(33)}); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { +var util = __webpack_require__(2); +var DataSet = __webpack_require__(11); - module.exports = { "default": __webpack_require__(59), __esModule: true }; +/** + * DataView + * + * a dataview offers a filtered view on a dataset or an other dataview. + * + * @param {DataSet | DataView} data + * @param {Object} [options] Available options: see method get + * + * @constructor DataView + */ +function DataView(data, options) { + this._data = null; + this._ids = {}; // ids of the items currently in memory (just contains a boolean true) + this.length = 0; // number of items in the DataView + this._options = options || {}; + this._fieldId = 'id'; // name of the field containing id + this._subscribers = {}; // event subscribers -/***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { + var me = this; + this.listener = function () { + me._onEvent.apply(me, arguments); + }; - __webpack_require__(60); - module.exports = __webpack_require__(17).Object.keys; + this.setData(data); +} -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { +// TODO: implement a function .config() to dynamically update things like configured filter +// and trigger changes accordingly - // 19.1.2.14 Object.keys(O) - var toObject = __webpack_require__(49) - , $keys = __webpack_require__(35); +/** + * Set a data source for the view + * @param {DataSet | DataView} data + */ +DataView.prototype.setData = function (data) { + var ids, id, i, len, items; - __webpack_require__(61)('keys', function(){ - return function keys(it){ - return $keys(toObject(it)); - }; - }); + if (this._data) { + // unsubscribe from current dataset + if (this._data.off) { + this._data.off('*', this.listener); + } -/***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { + // trigger a remove of all items in memory + ids = this._data.getIds({ filter: this._options && this._options.filter }); + items = []; - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(15) - , core = __webpack_require__(17) - , fails = __webpack_require__(26); - module.exports = function(KEY, exec){ - var fn = (core.Object || {})[KEY] || Object[KEY] - , exp = {}; - exp[KEY] = exec(fn); - $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; + for (i = 0, len = ids.length; i < len; i++) { + items.push(this._data._data[ids[i]]); + } -/***/ }), -/* 62 */ -/***/ (function(module, exports, __webpack_require__) { + this._ids = {}; + this.length = 0; + this._trigger('remove', { items: ids, oldData: items }); + } + + this._data = data; - "use strict"; + if (this._data) { + // update fieldId + this._fieldId = this._options.fieldId || this._data && this._data.options && this._data.options.fieldId || 'id'; - exports.__esModule = true; + // trigger an add of all added items + ids = this._data.getIds({ filter: this._options && this._options.filter }); + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + this._ids[id] = true; + } + this.length = ids.length; + this._trigger('add', { items: ids }); - var _iterator = __webpack_require__(63); + // subscribe to new dataset + if (this._data.on) { + this._data.on('*', this.listener); + } + } +}; - var _iterator2 = _interopRequireDefault(_iterator); +/** + * Refresh the DataView. Useful when the DataView has a filter function + * containing a variable parameter. + */ +DataView.prototype.refresh = function () { + var id, i, len; + var ids = this._data.getIds({ filter: this._options && this._options.filter }), + oldIds = (0, _keys2['default'])(this._ids), + newIds = {}, + addedIds = [], + removedIds = [], + removedItems = []; + + // check for additions + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + newIds[id] = true; + if (!this._ids[id]) { + addedIds.push(id); + this._ids[id] = true; + } + } - var _symbol = __webpack_require__(66); + // check for removals + for (i = 0, len = oldIds.length; i < len; i++) { + id = oldIds[i]; + if (!newIds[id]) { + removedIds.push(id); + removedItems.push(this._data._data[id]); + delete this._ids[id]; + } + } - var _symbol2 = _interopRequireDefault(_symbol); + this.length += addedIds.length - removedIds.length; - var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; }; + // trigger events + if (addedIds.length) { + this._trigger('add', { items: addedIds }); + } + if (removedIds.length) { + this._trigger('remove', { items: removedIds, oldData: removedItems }); + } +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Get data from the data view + * + * Usage: + * + * get() + * get(options: Object) + * get(options: Object, data: Array | DataTable) + * + * get(id: Number) + * get(id: Number, options: Object) + * get(id: Number, options: Object, data: Array | DataTable) + * + * get(ids: Number[]) + * get(ids: Number[], options: Object) + * get(ids: Number[], options: Object, data: Array | DataTable) + * + * Where: + * + * {number | string} id The id of an item + * {number[] | string{}} ids An array with ids of items + * {Object} options An Object with options. Available options: + * {string} [type] Type of data to be returned. Can + * be 'DataTable' or 'Array' (default) + * {Object.} [convert] + * {string[]} [fields] field names to be returned + * {function} [filter] filter items + * {string | function} [order] Order the items by + * a field name or custom sort function. + * {Array | DataTable} [data] If provided, items will be appended to this + * array or table. Required in case of Google + * DataTable. + * @param {Array} args + * @return {DataSet|DataView} + */ +DataView.prototype.get = function (args) { + // eslint-disable-line no-unused-vars + var me = this; + + // parse the arguments + var ids, options, data; + var firstType = util.getType(arguments[0]); + if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') { + // get(id(s) [, options] [, data]) + ids = arguments[0]; // can be a single id or an array with ids + options = arguments[1]; + data = arguments[2]; + } else { + // get([, options] [, data]) + options = arguments[0]; + data = arguments[1]; + } - exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { - return typeof obj === "undefined" ? "undefined" : _typeof(obj); - } : function (obj) { - return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); - }; + // extend the options with the default options and provided options + var viewOptions = util.extend({}, this._options, options); -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { + // create a combined filter method when needed + if (this._options.filter && options && options.filter) { + viewOptions.filter = function (item) { + return me._options.filter(item) && options.filter(item); + }; + } - module.exports = { "default": __webpack_require__(64), __esModule: true }; + // build up the call to the linked data set + var getArguments = []; + if (ids != undefined) { + getArguments.push(ids); + } + getArguments.push(viewOptions); + getArguments.push(data); -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { + return this._data && this._data.get.apply(this._data, getArguments); +}; - __webpack_require__(50); - __webpack_require__(4); - module.exports = __webpack_require__(65).f('iterator'); +/** + * Get ids of all items or from a filtered set of items. + * @param {Object} [options] An Object with options. Available options: + * {function} [filter] filter items + * {string | function} [order] Order the items by + * a field name or custom sort function. + * @return {Array.} ids + */ +DataView.prototype.getIds = function (options) { + var ids; + + if (this._data) { + var defaultFilter = this._options.filter; + var filter; + + if (options && options.filter) { + if (defaultFilter) { + filter = function filter(item) { + return defaultFilter(item) && options.filter(item); + }; + } else { + filter = options.filter; + } + } else { + filter = defaultFilter; + } -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { + ids = this._data.getIds({ + filter: filter, + order: options && options.order + }); + } else { + ids = []; + } - exports.f = __webpack_require__(47); + return ids; +}; -/***/ }), -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Map every item in the dataset. + * @param {function} callback + * @param {Object} [options] Available options: + * {Object.} [type] + * {string[]} [fields] filter fields + * {function} [filter] filter items + * {string | function} [order] Order the items by + * a field name or custom sort function. + * @return {Object[]} mappedItems + */ +DataView.prototype.map = function (callback, options) { + var mappedItems = []; + if (this._data) { + var defaultFilter = this._options.filter; + var filter; + + if (options && options.filter) { + if (defaultFilter) { + filter = function filter(item) { + return defaultFilter(item) && options.filter(item); + }; + } else { + filter = options.filter; + } + } else { + filter = defaultFilter; + } - module.exports = { "default": __webpack_require__(67), __esModule: true }; + mappedItems = this._data.map(callback, { + filter: filter, + order: options && options.order + }); + } else { + mappedItems = []; + } -/***/ }), -/* 67 */ -/***/ (function(module, exports, __webpack_require__) { + return mappedItems; +}; - __webpack_require__(68); - __webpack_require__(79); - __webpack_require__(80); - __webpack_require__(81); - module.exports = __webpack_require__(17).Symbol; +/** + * Get the DataSet to which this DataView is connected. In case there is a chain + * of multiple DataViews, the root DataSet of this chain is returned. + * @return {DataSet} dataSet + */ +DataView.prototype.getDataSet = function () { + var dataSet = this; + while (dataSet instanceof DataView) { + dataSet = dataSet._data; + } + return dataSet || null; +}; -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Event listener. Will propagate all events from the connected data set to + * the subscribers of the DataView, but will filter the items and only trigger + * when there are changes in the filtered data set. + * @param {string} event + * @param {Object | null} params + * @param {string} senderId + * @private + */ +DataView.prototype._onEvent = function (event, params, senderId) { + var i, len, id, item; + var ids = params && params.items; + var addedIds = [], + updatedIds = [], + removedIds = [], + oldItems = [], + updatedItems = [], + removedItems = []; + + if (ids && this._data) { + switch (event) { + case 'add': + // filter the ids of the added items + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + item = this.get(id); + if (item) { + this._ids[id] = true; + addedIds.push(id); + } + } - 'use strict'; - // ECMAScript 6 symbols shim - var global = __webpack_require__(16) - , has = __webpack_require__(31) - , DESCRIPTORS = __webpack_require__(25) - , $export = __webpack_require__(15) - , redefine = __webpack_require__(30) - , META = __webpack_require__(69).KEY - , $fails = __webpack_require__(26) - , shared = __webpack_require__(42) - , setToStringTag = __webpack_require__(46) - , uid = __webpack_require__(43) - , wks = __webpack_require__(47) - , wksExt = __webpack_require__(65) - , wksDefine = __webpack_require__(70) - , keyOf = __webpack_require__(71) - , enumKeys = __webpack_require__(72) - , isArray = __webpack_require__(75) - , anObject = __webpack_require__(22) - , toIObject = __webpack_require__(9) - , toPrimitive = __webpack_require__(28) - , createDesc = __webpack_require__(29) - , _create = __webpack_require__(33) - , gOPNExt = __webpack_require__(76) - , $GOPD = __webpack_require__(78) - , $DP = __webpack_require__(21) - , $keys = __webpack_require__(35) - , gOPD = $GOPD.f - , dP = $DP.f - , gOPN = gOPNExt.f - , $Symbol = global.Symbol - , $JSON = global.JSON - , _stringify = $JSON && $JSON.stringify - , PROTOTYPE = 'prototype' - , HIDDEN = wks('_hidden') - , TO_PRIMITIVE = wks('toPrimitive') - , isEnum = {}.propertyIsEnumerable - , SymbolRegistry = shared('symbol-registry') - , AllSymbols = shared('symbols') - , OPSymbols = shared('op-symbols') - , ObjectProto = Object[PROTOTYPE] - , USE_NATIVE = typeof $Symbol == 'function' - , QObject = global.QObject; - // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 - var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; - - // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 - var setSymbolDesc = DESCRIPTORS && $fails(function(){ - return _create(dP({}, 'a', { - get: function(){ return dP(this, 'a', {value: 7}).a; } - })).a != 7; - }) ? function(it, key, D){ - var protoDesc = gOPD(ObjectProto, key); - if(protoDesc)delete ObjectProto[key]; - dP(it, key, D); - if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); - } : dP; - - var wrap = function(tag){ - var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); - sym._k = tag; - return sym; - }; + break; - var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ - return typeof it == 'symbol'; - } : function(it){ - return it instanceof $Symbol; - }; + case 'update': + // determine the event from the views viewpoint: an updated + // item can be added, updated, or removed from this view. + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + item = this.get(id); - var $defineProperty = function defineProperty(it, key, D){ - if(it === ObjectProto)$defineProperty(OPSymbols, key, D); - anObject(it); - key = toPrimitive(key, true); - anObject(D); - if(has(AllSymbols, key)){ - if(!D.enumerable){ - if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); - it[HIDDEN][key] = true; - } else { - if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; - D = _create(D, {enumerable: createDesc(0, false)}); - } return setSymbolDesc(it, key, D); - } return dP(it, key, D); - }; - var $defineProperties = function defineProperties(it, P){ - anObject(it); - var keys = enumKeys(P = toIObject(P)) - , i = 0 - , l = keys.length - , key; - while(l > i)$defineProperty(it, key = keys[i++], P[key]); - return it; - }; - var $create = function create(it, P){ - return P === undefined ? _create(it) : $defineProperties(_create(it), P); - }; - var $propertyIsEnumerable = function propertyIsEnumerable(key){ - var E = isEnum.call(this, key = toPrimitive(key, true)); - if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; - return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; - }; - var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ - it = toIObject(it); - key = toPrimitive(key, true); - if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; - var D = gOPD(it, key); - if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; - return D; - }; - var $getOwnPropertyNames = function getOwnPropertyNames(it){ - var names = gOPN(toIObject(it)) - , result = [] - , i = 0 - , key; - while(names.length > i){ - if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); - } return result; - }; - var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ - var IS_OP = it === ObjectProto - , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) - , result = [] - , i = 0 - , key; - while(names.length > i){ - if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); - } return result; - }; + if (item) { + if (this._ids[id]) { + updatedIds.push(id); + updatedItems.push(params.data[i]); + oldItems.push(params.oldData[i]); + } else { + this._ids[id] = true; + addedIds.push(id); + } + } else { + if (this._ids[id]) { + delete this._ids[id]; + removedIds.push(id); + removedItems.push(params.oldData[i]); + } else { + // nothing interesting for me :-( + } + } + } - // 19.4.1.1 Symbol([description]) - if(!USE_NATIVE){ - $Symbol = function Symbol(){ - if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); - var tag = uid(arguments.length > 0 ? arguments[0] : undefined); - var $set = function(value){ - if(this === ObjectProto)$set.call(OPSymbols, value); - if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; - setSymbolDesc(this, tag, createDesc(1, value)); - }; - if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); - return wrap(tag); - }; - redefine($Symbol[PROTOTYPE], 'toString', function toString(){ - return this._k; - }); + break; - $GOPD.f = $getOwnPropertyDescriptor; - $DP.f = $defineProperty; - __webpack_require__(77).f = gOPNExt.f = $getOwnPropertyNames; - __webpack_require__(74).f = $propertyIsEnumerable; - __webpack_require__(73).f = $getOwnPropertySymbols; + case 'remove': + // filter the ids of the removed items + for (i = 0, len = ids.length; i < len; i++) { + id = ids[i]; + if (this._ids[id]) { + delete this._ids[id]; + removedIds.push(id); + removedItems.push(params.oldData[i]); + } + } - if(DESCRIPTORS && !__webpack_require__(14)){ - redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + break; } - wksExt.f = function(name){ - return wrap(wks(name)); + this.length += addedIds.length - removedIds.length; + + if (addedIds.length) { + this._trigger('add', { items: addedIds }, senderId); + } + if (updatedIds.length) { + this._trigger('update', { items: updatedIds, oldData: oldItems, data: updatedItems }, senderId); + } + if (removedIds.length) { + this._trigger('remove', { items: removedIds, oldData: removedItems }, senderId); } } +}; - $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); - - for(var symbols = ( - // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 - 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' - ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); +// copy subscription functionality from DataSet +DataView.prototype.on = DataSet.prototype.on; +DataView.prototype.off = DataSet.prototype.off; +DataView.prototype._trigger = DataSet.prototype._trigger; - for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); +// TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5) +DataView.prototype.subscribe = DataView.prototype.on; +DataView.prototype.unsubscribe = DataView.prototype.off; - $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { - // 19.4.2.1 Symbol.for(key) - 'for': function(key){ - return has(SymbolRegistry, key += '') - ? SymbolRegistry[key] - : SymbolRegistry[key] = $Symbol(key); - }, - // 19.4.2.5 Symbol.keyFor(sym) - keyFor: function keyFor(key){ - if(isSymbol(key))return keyOf(SymbolRegistry, key); - throw TypeError(key + ' is not a symbol!'); - }, - useSetter: function(){ setter = true; }, - useSimple: function(){ setter = false; } - }); +module.exports = DataView; - $export($export.S + $export.F * !USE_NATIVE, 'Object', { - // 19.1.2.2 Object.create(O [, Properties]) - create: $create, - // 19.1.2.4 Object.defineProperty(O, P, Attributes) - defineProperty: $defineProperty, - // 19.1.2.3 Object.defineProperties(O, Properties) - defineProperties: $defineProperties, - // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) - getOwnPropertyDescriptor: $getOwnPropertyDescriptor, - // 19.1.2.7 Object.getOwnPropertyNames(O) - getOwnPropertyNames: $getOwnPropertyNames, - // 19.1.2.8 Object.getOwnPropertySymbols(O) - getOwnPropertySymbols: $getOwnPropertySymbols - }); +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { - // 24.3.2 JSON.stringify(value [, replacer [, space]]) - $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ - var S = $Symbol(); - // MS Edge converts symbol values to JSON as {} - // WebKit converts symbol values to JSON as null - // V8 throws on boxed symbols - return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; - })), 'JSON', { - stringify: function stringify(it){ - if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined - var args = [it] - , i = 1 - , replacer, $replacer; - while(arguments.length > i)args.push(arguments[i++]); - replacer = args[1]; - if(typeof replacer == 'function')$replacer = replacer; - if($replacer || !isArray(replacer))replacer = function(key, value){ - if($replacer)value = $replacer.call(this, key, value); - if(!isSymbol(value))return value; - }; - args[1] = replacer; - return _stringify.apply($JSON, args); - } - }); +var store = __webpack_require__(57)('wks'); +var uid = __webpack_require__(40); +var Symbol = __webpack_require__(18).Symbol; +var USE_SYMBOL = typeof Symbol == 'function'; - // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) - $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(20)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); - // 19.4.3.5 Symbol.prototype[@@toStringTag] - setToStringTag($Symbol, 'Symbol'); - // 20.2.1.9 Math[@@toStringTag] - setToStringTag(Math, 'Math', true); - // 24.3.3 JSON[@@toStringTag] - setToStringTag(global.JSON, 'JSON', true); +var $exports = module.exports = function (name) { + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { +$exports.store = store; - var META = __webpack_require__(43)('meta') - , isObject = __webpack_require__(23) - , has = __webpack_require__(31) - , setDesc = __webpack_require__(21).f - , id = 0; - var isExtensible = Object.isExtensible || function(){ - return true; - }; - var FREEZE = !__webpack_require__(26)(function(){ - return isExtensible(Object.preventExtensions({})); - }); - var setMeta = function(it){ - setDesc(it, META, {value: { - i: 'O' + ++id, // object ID - w: {} // weak collections IDs - }}); - }; - var fastKey = function(it, create){ - // return primitive with prefix - if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if(!has(it, META)){ - // can't set metadata to uncaught frozen object - if(!isExtensible(it))return 'F'; - // not necessary to add metadata - if(!create)return 'E'; - // add missing metadata - setMeta(it); - // return object ID - } return it[META].i; - }; - var getWeak = function(it, create){ - if(!has(it, META)){ - // can't set metadata to uncaught frozen object - if(!isExtensible(it))return true; - // not necessary to add metadata - if(!create)return false; - // add missing metadata - setMeta(it); - // return hash weak collections IDs - } return it[META].w; - }; - // add metadata on freeze-family methods calling - var onFreeze = function(it){ - if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); - return it; - }; - var meta = module.exports = { - KEY: META, - NEED: false, - fastKey: fastKey, - getWeak: getWeak, - onFreeze: onFreeze - }; /***/ }), -/* 70 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { - var global = __webpack_require__(16) - , core = __webpack_require__(17) - , LIBRARY = __webpack_require__(14) - , wksExt = __webpack_require__(65) - , defineProperty = __webpack_require__(21).f; - module.exports = function(name){ - var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); - if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); - }; +"use strict"; -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { - var getKeys = __webpack_require__(35) - , toIObject = __webpack_require__(9); - module.exports = function(object, el){ - var O = toIObject(object) - , keys = getKeys(O) - , length = keys.length - , index = 0 - , key; - while(length > index)if(O[key = keys[index++]] === el)return key; - }; +// DOM utility methods -/***/ }), -/* 72 */ -/***/ (function(module, exports, __webpack_require__) { - - // all enumerable object keys, includes symbols - var getKeys = __webpack_require__(35) - , gOPS = __webpack_require__(73) - , pIE = __webpack_require__(74); - module.exports = function(it){ - var result = getKeys(it) - , getSymbols = gOPS.f; - if(getSymbols){ - var symbols = getSymbols(it) - , isEnum = pIE.f - , i = 0 - , key; - while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); - } return result; - }; +/** + * this prepares the JSON container for allocating SVG elements + * @param {Object} JSONcontainer + * @private + */ +exports.prepareElements = function (JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; + JSONcontainer[elementType].used = []; + } + } +}; -/***/ }), -/* 73 */ -/***/ (function(module, exports) { +/** + * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from + * which to remove the redundant elements. + * + * @param {Object} JSONcontainer + * @private + */ +exports.cleanupElements = function (JSONcontainer) { + // cleanup the redundant svgElements; + for (var elementType in JSONcontainer) { + if (JSONcontainer.hasOwnProperty(elementType)) { + if (JSONcontainer[elementType].redundant) { + for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { + JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]); + } + JSONcontainer[elementType].redundant = []; + } + } + } +}; - exports.f = Object.getOwnPropertySymbols; +/** + * Ensures that all elements are removed first up so they can be recreated cleanly + * @param {Object} JSONcontainer + */ +exports.resetElements = function (JSONcontainer) { + exports.prepareElements(JSONcontainer); + exports.cleanupElements(JSONcontainer); + exports.prepareElements(JSONcontainer); +}; -/***/ }), -/* 74 */ -/***/ (function(module, exports) { +/** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param {string} elementType + * @param {Object} JSONcontainer + * @param {Object} svgContainer + * @returns {Element} + * @private + */ +exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) { + var element; + // allocate SVG element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { + // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } else { + // create a new element and add it to the SVG + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + svgContainer.appendChild(element); + } + } else { + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. + element = document.createElementNS('http://www.w3.org/2000/svg', elementType); + JSONcontainer[elementType] = { used: [], redundant: [] }; + svgContainer.appendChild(element); + } + JSONcontainer[elementType].used.push(element); + return element; +}; - exports.f = {}.propertyIsEnumerable; +/** + * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer + * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. + * + * @param {string} elementType + * @param {Object} JSONcontainer + * @param {Element} DOMContainer + * @param {Element} insertBefore + * @returns {*} + */ +exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) { + var element; + // allocate DOM element, if it doesnt yet exist, create one. + if (JSONcontainer.hasOwnProperty(elementType)) { + // this element has been created before + // check if there is an redundant element + if (JSONcontainer[elementType].redundant.length > 0) { + element = JSONcontainer[elementType].redundant[0]; + JSONcontainer[elementType].redundant.shift(); + } else { + // create a new element and add it to the SVG + element = document.createElement(elementType); + if (insertBefore !== undefined) { + DOMContainer.insertBefore(element, insertBefore); + } else { + DOMContainer.appendChild(element); + } + } + } else { + // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. + element = document.createElement(elementType); + JSONcontainer[elementType] = { used: [], redundant: [] }; + if (insertBefore !== undefined) { + DOMContainer.insertBefore(element, insertBefore); + } else { + DOMContainer.appendChild(element); + } + } + JSONcontainer[elementType].used.push(element); + return element; +}; -/***/ }), -/* 75 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Draw a point object. This is a separate function because it can also be called by the legend. + * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions + * as well. + * + * @param {number} x + * @param {number} y + * @param {Object} groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' } + * @param {Object} JSONcontainer + * @param {Object} svgContainer + * @param {Object} labelObj + * @returns {vis.PointItem} + */ +exports.drawPoint = function (x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) { + var point; + if (groupTemplate.style == 'circle') { + point = exports.getSVGElement('circle', JSONcontainer, svgContainer); + point.setAttributeNS(null, "cx", x); + point.setAttributeNS(null, "cy", y); + point.setAttributeNS(null, "r", 0.5 * groupTemplate.size); + } else { + point = exports.getSVGElement('rect', JSONcontainer, svgContainer); + point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size); + point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size); + point.setAttributeNS(null, "width", groupTemplate.size); + point.setAttributeNS(null, "height", groupTemplate.size); + } - // 7.2.2 IsArray(argument) - var cof = __webpack_require__(11); - module.exports = Array.isArray || function isArray(arg){ - return cof(arg) == 'Array'; - }; + if (groupTemplate.styles !== undefined) { + point.setAttributeNS(null, "style", groupTemplate.styles); + } + point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); + //handle label -/***/ }), -/* 76 */ -/***/ (function(module, exports, __webpack_require__) { - // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window - var toIObject = __webpack_require__(9) - , gOPN = __webpack_require__(77).f - , toString = {}.toString; + if (labelObj) { + var label = exports.getSVGElement('text', JSONcontainer, svgContainer); + if (labelObj.xOffset) { + x = x + labelObj.xOffset; + } - var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames - ? Object.getOwnPropertyNames(window) : []; + if (labelObj.yOffset) { + y = y + labelObj.yOffset; + } + if (labelObj.content) { + label.textContent = labelObj.content; + } - var getWindowNames = function(it){ - try { - return gOPN(it); - } catch(e){ - return windowNames.slice(); + if (labelObj.className) { + label.setAttributeNS(null, "class", labelObj.className + " vis-label"); } - }; + label.setAttributeNS(null, "x", x); + label.setAttributeNS(null, "y", y); + } - module.exports.f = function getOwnPropertyNames(it){ - return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); - }; + return point; +}; +/** + * draw a bar SVG element centered on the X coordinate + * + * @param {number} x + * @param {number} y + * @param {number} width + * @param {number} height + * @param {string} className + * @param {Object} JSONcontainer + * @param {Object} svgContainer + * @param {string} style + */ +exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) { + if (height != 0) { + if (height < 0) { + height *= -1; + y -= height; + } + var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer); + rect.setAttributeNS(null, "x", x - 0.5 * width); + rect.setAttributeNS(null, "y", y); + rect.setAttributeNS(null, "width", width); + rect.setAttributeNS(null, "height", height); + rect.setAttributeNS(null, "class", className); + if (style) { + rect.setAttributeNS(null, "style", style); + } + } +}; /***/ }), -/* 77 */ +/* 15 */ /***/ (function(module, exports, __webpack_require__) { - // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) - var $keys = __webpack_require__(36) - , hiddenKeys = __webpack_require__(44).concat('length', 'prototype'); - - exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ - return $keys(O, hiddenKeys); - }; - -/***/ }), -/* 78 */ -/***/ (function(module, exports, __webpack_require__) { +"use strict"; - var pIE = __webpack_require__(74) - , createDesc = __webpack_require__(29) - , toIObject = __webpack_require__(9) - , toPrimitive = __webpack_require__(28) - , has = __webpack_require__(31) - , IE8_DOM_DEFINE = __webpack_require__(24) - , gOPD = Object.getOwnPropertyDescriptor; - - exports.f = __webpack_require__(25) ? gOPD : function getOwnPropertyDescriptor(O, P){ - O = toIObject(O); - P = toPrimitive(P, true); - if(IE8_DOM_DEFINE)try { - return gOPD(O, P); - } catch(e){ /* empty */ } - if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); - }; -/***/ }), -/* 79 */ -/***/ (function(module, exports) { +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.printStyle = undefined; - +var _stringify = __webpack_require__(19); -/***/ }), -/* 80 */ -/***/ (function(module, exports, __webpack_require__) { +var _stringify2 = _interopRequireDefault(_stringify); - __webpack_require__(70)('asyncIterator'); +var _typeof2 = __webpack_require__(6); -/***/ }), -/* 81 */ -/***/ (function(module, exports, __webpack_require__) { +var _typeof3 = _interopRequireDefault(_typeof2); - __webpack_require__(70)('observable'); +var _keys = __webpack_require__(8); -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { +var _keys2 = _interopRequireDefault(_keys); - 'use strict'; +var _classCallCheck2 = __webpack_require__(0); - // first check if moment.js is already loaded in the browser window, if so, - // use this instance. Else, load via commonjs. - module.exports = typeof window !== 'undefined' && window['moment'] || __webpack_require__(83); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -/***/ }), -/* 83 */ -/***/ (function(module, exports, __webpack_require__) { +var _createClass2 = __webpack_require__(1); - /* WEBPACK VAR INJECTION */(function(module) {//! moment.js - //! version : 2.18.1 - //! authors : Tim Wood, Iskren Chernev, Moment.js contributors - //! license : MIT - //! momentjs.com +var _createClass3 = _interopRequireDefault(_createClass2); - ;(function (global, factory) { - true ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() - }(this, (function () { 'use strict'; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var hookCallback; +var util = __webpack_require__(2); - function hooks () { - return hookCallback.apply(null, arguments); - } +var errorFound = false; +var allOptions = void 0; +var printStyle = 'background: #FFeeee; color: #dd0000'; +/** + * Used to validate options. + */ - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback (callback) { - hookCallback = callback; +var Validator = function () { + /** + * @ignore + */ + function Validator() { + (0, _classCallCheck3['default'])(this, Validator); } - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } + /** + * Main function to be called + * @param {Object} options + * @param {Object} referenceOptions + * @param {Object} subObject + * @returns {boolean} + * @static + */ - function isObject(input) { - // IE8 will treat undefined and null as object if it wasn't for - // input != null - return input != null && Object.prototype.toString.call(input) === '[object Object]'; - } - function isObjectEmpty(obj) { - var k; - for (k in obj) { - // even if its not own property I'd still call it non-empty - return false; + (0, _createClass3['default'])(Validator, null, [{ + key: 'validate', + value: function validate(options, referenceOptions, subObject) { + errorFound = false; + allOptions = referenceOptions; + var usedOptions = referenceOptions; + if (subObject !== undefined) { + usedOptions = referenceOptions[subObject]; } - return true; - } + Validator.parse(options, usedOptions, []); + return errorFound; + } - function isUndefined(input) { - return input === void 0; - } + /** + * Will traverse an object recursively and check every value + * @param {Object} options + * @param {Object} referenceOptions + * @param {array} path | where to look for the actual option + * @static + */ - function isNumber(input) { - return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; - } + }, { + key: 'parse', + value: function parse(options, referenceOptions, path) { + for (var option in options) { + if (options.hasOwnProperty(option)) { + Validator.check(option, options, referenceOptions, path); + } + } + } - function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; - } + /** + * Check every value. If the value is an object, call the parse function on that object. + * @param {string} option + * @param {Object} options + * @param {Object} referenceOptions + * @param {array} path | where to look for the actual option + * @static + */ - function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); + }, { + key: 'check', + value: function check(option, options, referenceOptions, path) { + if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) { + Validator.getSuggestion(option, referenceOptions, path); + return; } - return res; - } - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } + var referenceOption = option; + var is_object = true; - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } + if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) { + // NOTE: This only triggers if the __any__ is in the top level of the options object. + // THAT'S A REALLY BAD PLACE TO ALLOW IT!!!! + // TODO: Examine if needed, remove if possible + + // __any__ is a wildcard. Any value is accepted and will be further analysed by reference. + referenceOption = '__any__'; - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; + // if the any-subgroup is not a predefined object in the configurator, + // we do not look deeper into the object. + is_object = Validator.getType(options[option]) === 'object'; + } else { + // Since all options in the reference are objects, we can check whether + // they are supposed to be the object to look for the __type__ field. + // if this is an object, we check if the correct type has been supplied to account for shorthand options. } - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; + var refOptionObj = referenceOptions[referenceOption]; + if (is_object && refOptionObj.__type__ !== undefined) { + refOptionObj = refOptionObj.__type__; } - return a; - } + Validator.checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path); + } - function createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } + /** + * + * @param {string} option | the option property + * @param {Object} options | The supplied options object + * @param {Object} referenceOptions | The reference options containing all options and their allowed formats + * @param {string} referenceOption | Usually this is the same as option, except when handling an __any__ tag. + * @param {string} refOptionObj | This is the type object from the reference options + * @param {Array} path | where in the object is the option + * @static + */ - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso : false, - parsedDateParts : [], - meridiem : null, - rfc2822 : false, - weekdayMismatch : false + }, { + key: 'checkFields', + value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) { + var log = function log(message) { + console.log('%c' + message + Validator.printLocation(path, option), printStyle); }; - } - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); + var optionType = Validator.getType(options[option]); + var refOptionType = refOptionObj[optionType]; + + if (refOptionType !== undefined) { + // if the type is correct, we check if it is supposed to be one of a few select values + if (Validator.getType(refOptionType) === 'array' && refOptionType.indexOf(options[option]) === -1) { + log('Invalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". '); + errorFound = true; + } else if (optionType === 'object' && referenceOption !== "__any__") { + path = util.copyAndExtendArray(path, option); + Validator.parse(options[option], referenceOptions[referenceOption], path); + } + } else if (refOptionObj['any'] === undefined) { + // type of the field is incorrect and the field cannot be any + log('Invalid type received for "' + option + '". Expected: ' + Validator.print((0, _keys2['default'])(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"'); + errorFound = true; } - return m._pf; - } + } - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; + /** + * + * @param {Object|boolean|number|string|Array.|Date|Node|Moment|undefined|null} object + * @returns {string} + * @static + */ - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } + }, { + key: 'getType', + value: function getType(object) { + var type = typeof object === 'undefined' ? 'undefined' : (0, _typeof3['default'])(object); - return false; - }; - } + if (type === 'object') { + if (object === null) { + return 'null'; + } + if (object instanceof Boolean) { + return 'boolean'; + } + if (object instanceof Number) { + return 'number'; + } + if (object instanceof String) { + return 'string'; + } + if (Array.isArray(object)) { + return 'array'; + } + if (object instanceof Date) { + return 'date'; + } + if (object.nodeType !== undefined) { + return 'dom'; + } + if (object._isAMomentObject === true) { + return 'moment'; + } + return 'object'; + } else if (type === 'number') { + return 'number'; + } else if (type === 'boolean') { + return 'boolean'; + } else if (type === 'string') { + return 'string'; + } else if (type === undefined) { + return 'undefined'; + } + return type; + } - var some$1 = some; + /** + * @param {string} option + * @param {Object} options + * @param {Array.} path + * @static + */ - function isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some$1.call(flags.parsedDateParts, function (i) { - return i != null; - }); - var isNowValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); - - if (m._strict) { - isNowValid = isNowValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - - if (Object.isFrozen == null || !Object.isFrozen(m)) { - m._isValid = isNowValid; - } - else { - return isNowValid; - } + }, { + key: 'getSuggestion', + value: function getSuggestion(option, options, path) { + var localSearch = Validator.findInOptions(option, options, path, false); + var globalSearch = Validator.findInOptions(option, allOptions, [], true); + + var localSearchThreshold = 8; + var globalSearchThreshold = 4; + + var msg = void 0; + if (localSearch.indexMatch !== undefined) { + msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n'; + } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) { + msg = ' in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was misplaced? Matching option found at: ' + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, ''); + } else if (localSearch.distance <= localSearchThreshold) { + msg = '. Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option); + } else { + msg = '. Did you mean one of these: ' + Validator.print((0, _keys2['default'])(options)) + Validator.printLocation(path, option); } - return m._isValid; - } - function createInvalid (flags) { - var m = createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } + console.log('%cUnknown option detected: "' + option + '"' + msg, printStyle); + errorFound = true; + } - return m; - } + /** + * traverse the options in search for a match. + * @param {string} option + * @param {Object} options + * @param {Array} path | where to look for the actual option + * @param {boolean} [recursive=false] + * @returns {{closestMatch: string, path: Array, distance: number}} + * @static + */ - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = hooks.momentProperties = []; + }, { + key: 'findInOptions', + value: function findInOptions(option, options, path) { + var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + + var min = 1e9; + var closestMatch = ''; + var closestMatchPath = []; + var lowerCaseOption = option.toLowerCase(); + var indexMatch = undefined; + for (var op in options) { + // eslint-disable-line guard-for-in + var distance = void 0; + if (options[op].__type__ !== undefined && recursive === true) { + var result = Validator.findInOptions(option, options[op], util.copyAndExtendArray(path, op)); + if (min > result.distance) { + closestMatch = result.closestMatch; + closestMatchPath = result.path; + min = result.distance; + indexMatch = result.indexMatch; + } + } else { + if (op.toLowerCase().indexOf(lowerCaseOption) !== -1) { + indexMatch = op; + } + distance = Validator.levenshteinDistance(option, op); + if (min > distance) { + closestMatch = op; + closestMatchPath = util.copyArray(path); + min = distance; + } + } + } + return { closestMatch: closestMatch, path: closestMatchPath, distance: min, indexMatch: indexMatch }; + } - function copyConfig(to, from) { - var i, prop, val; + /** + * @param {Array.} path + * @param {Object} option + * @param {string} prefix + * @returns {String} + * @static + */ - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; - } - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - if (!isUndefined(from._offset)) { - to._offset = from._offset; + }, { + key: 'printLocation', + value: function printLocation(path, option) { + var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Problem value found at: \n'; + + var str = '\n\n' + prefix + 'options = {\n'; + for (var i = 0; i < path.length; i++) { + for (var j = 0; j < i + 1; j++) { + str += ' '; + } + str += path[i] + ': {\n'; } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); + for (var _j = 0; _j < path.length + 1; _j++) { + str += ' '; } - if (!isUndefined(from._locale)) { - to._locale = from._locale; + str += option + '\n'; + for (var _i = 0; _i < path.length + 1; _i++) { + for (var _j2 = 0; _j2 < path.length - _i; _j2++) { + str += ' '; + } + str += '}\n'; } + return str + '\n\n'; + } - if (momentProperties.length > 0) { - for (i = 0; i < momentProperties.length; i++) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } + /** + * @param {Object} options + * @returns {String} + * @static + */ - return to; - } + }, { + key: 'print', + value: function print(options) { + return (0, _stringify2['default'])(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', '); + } - var updateInProgress = false; + /** + * Compute the edit distance between the two given strings + * http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript + * + * Copyright (c) 2011 Andrei Mackenzie + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * @param {string} a + * @param {string} b + * @returns {Array.>}} + * @static + */ - // Moment prototype object - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - if (!this.isValid()) { - this._d = new Date(NaN); - } - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - hooks.updateOffset(this); - updateInProgress = false; - } - } + }, { + key: 'levenshteinDistance', + value: function levenshteinDistance(a, b) { + if (a.length === 0) return b.length; + if (b.length === 0) return a.length; - function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); - } + var matrix = []; - function absFloor (number) { - if (number < 0) { - // -0 -> 0 - return Math.ceil(number) || 0; - } else { - return Math.floor(number); + // increment along the first column of each row + var i; + for (i = 0; i <= b.length; i++) { + matrix[i] = [i]; } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); + // increment each column in the first row + var j; + for (j = 0; j <= a.length; j++) { + matrix[0][j] = j; } - return value; - } - - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; + // Fill in the rest of the matrix + for (i = 1; i <= b.length; i++) { + for (j = 1; j <= a.length; j++) { + if (b.charAt(i - 1) == a.charAt(j - 1)) { + matrix[i][j] = matrix[i - 1][j - 1]; + } else { + matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution + Math.min(matrix[i][j - 1] + 1, // insertion + matrix[i - 1][j] + 1)); // deletion } + } } - return diffs + lengthDiff; - } - function warn(msg) { - if (hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } + return matrix[b.length][a.length]; + } + }]); + return Validator; +}(); - function deprecate(msg, fn) { - var firstTime = true; +exports['default'] = Validator; +exports.printStyle = printStyle; - return extend(function () { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(null, msg); - } - if (firstTime) { - var args = []; - var arg; - for (var i = 0; i < arguments.length; i++) { - arg = ''; - if (typeof arguments[i] === 'object') { - arg += '\n[' + i + '] '; - for (var key in arguments[0]) { - arg += key + ': ' + arguments[0][key] + ', '; - } - arg = arg.slice(0, -2); // Remove trailing comma and space - } else { - arg = arguments[i]; - } - args.push(arg); - } - warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { - var deprecations = {}; +"use strict"; - function deprecateSimple(name, msg) { - if (hooks.deprecationHandler != null) { - hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - hooks.suppressDeprecationWarnings = false; - hooks.deprecationHandler = null; +var util = __webpack_require__(2); - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } +/** + * Prototype for visual components + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body] + * @param {Object} [options] + */ +function Component(body, options) { + // eslint-disable-line no-unused-vars + this.options = null; + this.props = null; +} - function set (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. - // TODO: Remove "ordinalParse" fallback in next major release. - this._dayOfMonthOrdinalParseLenient = new RegExp( - (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + - '|' + (/\d{1,2}/).source); - } - - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - for (prop in parentConfig) { - if (hasOwnProp(parentConfig, prop) && - !hasOwnProp(childConfig, prop) && - isObject(parentConfig[prop])) { - // make sure changes to properties don't modify parent config - res[prop] = extend({}, res[prop]); - } - } - return res; +/** + * Set options for the component. The new options will be merged into the + * current options. + * @param {Object} options + */ +Component.prototype.setOptions = function (options) { + if (options) { + util.extend(this.options, options); } +}; - function Locale(config) { - if (config != null) { - this.set(config); - } - } +/** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ +Component.prototype.redraw = function () { + // should be implemented by the component + return false; +}; - var keys; +/** + * Destroy the component. Cleanup DOM and event listeners + */ +Component.prototype.destroy = function () { + // should be implemented by the component +}; - if (Object.keys) { - keys = Object.keys; - } else { - keys = function (obj) { - var i, res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; - } +/** + * Test whether the component is resized since the last time _isResized() was + * called. + * @return {Boolean} Returns true if the component is resized + * @protected + */ +Component.prototype._isResized = function () { + var resized = this.props._previousWidth !== this.props.width || this.props._previousHeight !== this.props.height; - var keys$1 = keys; + this.props._previousWidth = this.props.width; + this.props._previousHeight = this.props.height; - var defaultCalendar = { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }; + return resized; +}; - function calendar (key, mom, now) { - var output = this._calendar[key] || this._calendar['sameElse']; - return isFunction(output) ? output.call(mom, now) : output; - } +module.exports = Component; - var defaultLongDateFormat = { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }; +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { - function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; +var global = __webpack_require__(18); +var core = __webpack_require__(7); +var ctx = __webpack_require__(80); +var hide = __webpack_require__(26); +var PROTOTYPE = 'prototype'; + +var $export = function (type, name, source) { + var IS_FORCED = type & $export.F; + var IS_GLOBAL = type & $export.G; + var IS_STATIC = type & $export.S; + var IS_PROTO = type & $export.P; + var IS_BIND = type & $export.B; + var IS_WRAP = type & $export.W; + var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); + var expProto = exports[PROTOTYPE]; + var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; + var key, own, out; + if (IS_GLOBAL) source = name; + for (key in source) { + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if (own && key in exports) continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function (C) { + var F = function (a, b, c) { + if (this instanceof C) { + switch (arguments.length) { + case 0: return new C(); + case 1: return new C(a); + case 2: return new C(a, b); + } return new C(a, b, c); + } return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if (IS_PROTO) { + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); + } + } +}; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; - if (format || !formatUpper) { - return format; - } - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); +/***/ }), +/* 18 */ +/***/ (function(module, exports) { - return this._longDateFormat[key]; - } +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self + // eslint-disable-next-line no-new-func + : Function('return this')(); +if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef - var defaultInvalidDate = 'Invalid date'; - function invalidDate () { - return this._invalidDate; - } +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { - var defaultOrdinal = '%d'; - var defaultDayOfMonthOrdinalParse = /\d{1,2}/; +module.exports = { "default": __webpack_require__(160), __esModule: true }; - function ordinal (number) { - return this._ordinal.replace('%d', number); - } +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { - var defaultRelativeTime = { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - ss : '%d seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }; +var anObject = __webpack_require__(27); +var IE8_DOM_DEFINE = __webpack_require__(81); +var toPrimitive = __webpack_require__(53); +var dP = Object.defineProperty; - function relativeTime (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (isFunction(output)) ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); - } +exports.f = __webpack_require__(21) ? Object.defineProperty : function defineProperty(O, P, Attributes) { + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if (IE8_DOM_DEFINE) try { + return dP(O, P, Attributes); + } catch (e) { /* empty */ } + if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); + if ('value' in Attributes) O[P] = Attributes.value; + return O; +}; - function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - var aliases = {}; +/***/ }), +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { - function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } +// Thank's IE8 for his funny defineProperty +module.exports = !__webpack_require__(28)(function () { + return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; +}); - function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; - } - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; +/***/ }), +/* 22 */ +/***/ (function(module, exports) { - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function (it, key) { + return hasOwnProperty.call(it, key); +}; - return normalizedInput; - } - var priorities = {}; +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { - function addUnitPriority(unit, priority) { - priorities[unit] = priority; - } +"use strict"; - function getPrioritizedUnits(unitsObj) { - var units = []; - for (var u in unitsObj) { - units.push({unit: u, priority: priorities[u]}); - } - units.sort(function (a, b) { - return a.priority - b.priority; - }); - return units; - } - function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - set$1(this, unit, value); - hooks.updateOffset(this, keepTime); - return this; - } else { - return get(this, unit); - } - }; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - function get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; - } +var _typeof2 = __webpack_require__(6); - function set$1 (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } - } +var _typeof3 = _interopRequireDefault(_typeof2); - // MOMENTS +var _classCallCheck2 = __webpack_require__(0); - function stringGet (units) { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](); - } - return this; - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _createClass2 = __webpack_require__(1); - function stringSet (units, value) { - if (typeof units === 'object') { - units = normalizeObjectUnits(units); - var prioritized = getPrioritizedUnits(units); - for (var i = 0; i < prioritized.length; i++) { - this[prioritized[i].unit](units[prioritized[i].unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; - } +var _createClass3 = _interopRequireDefault(_createClass2); - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/** + * The Base class for all Nodes. + */ +var NodeBase = function () { + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function NodeBase(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, NodeBase); + + this.body = body; + this.labelModule = labelModule; + this.setOptions(options); + this.top = undefined; + this.left = undefined; + this.height = undefined; + this.width = undefined; + this.radius = undefined; + this.margin = undefined; + this.refreshNeeded = true; + this.boundingBox = { top: 0, left: 0, right: 0, bottom: 0 }; } - var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; + /** + * + * @param {Object} options + */ - var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - var formatFunctions = {}; + (0, _createClass3['default'])(NodeBase, [{ + key: 'setOptions', + value: function setOptions(options) { + this.options = options; + } - var formatTokenFunctions = {}; + /** + * + * @param {Label} labelModule + * @private + */ - // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - function addFormatToken (token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; - } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; + }, { + key: '_setMargins', + value: function _setMargins(labelModule) { + this.margin = {}; + if (this.options.margin) { + if ((0, _typeof3['default'])(this.options.margin) == 'object') { + this.margin.top = this.options.margin.top; + this.margin.right = this.options.margin.right; + this.margin.bottom = this.options.margin.bottom; + this.margin.left = this.options.margin.left; + } else { + this.margin.top = this.options.margin; + this.margin.right = this.options.margin; + this.margin.bottom = this.options.margin; + this.margin.left = this.options.margin; + } } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; + labelModule.adjustSizes(this.margin); + } + + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + * @private + */ + + }, { + key: '_distanceToBorder', + value: function _distanceToBorder(ctx, angle) { + var borderWidth = this.options.borderWidth; + this.resize(ctx); + return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; + } + + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ + + }, { + key: 'enableShadow', + value: function enableShadow(ctx, values) { + if (values.shadow) { + ctx.shadowColor = values.shadowColor; + ctx.shadowBlur = values.shadowSize; + ctx.shadowOffsetX = values.shadowX; + ctx.shadowOffsetY = values.shadowY; } - } + } + + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); + }, { + key: 'disableShadow', + value: function disableShadow(ctx, values) { + if (values.shadow) { + ctx.shadowColor = 'rgba(0,0,0,0)'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; } - return input.replace(/\\/g, ''); - } + } - function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); + }, { + key: 'enableBorderDashes', + value: function enableBorderDashes(ctx, values) { + if (values.borderDashes !== false) { + if (ctx.setLineDash !== undefined) { + var dashes = values.borderDashes; + if (dashes === true) { + dashes = [5, 15]; } + ctx.setLineDash(dashes); + } else { + console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); + this.options.shapeProperties.borderDashes = false; + values.borderDashes = false; + } } + } - return function (mom) { - var output = '', i; - for (i = 0; i < length; i++) { - output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; - } - return output; - }; - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); + }, { + key: 'disableBorderDashes', + value: function disableBorderDashes(ctx, values) { + if (values.borderDashes !== false) { + if (ctx.setLineDash !== undefined) { + ctx.setLineDash([0]); + } else { + console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); + this.options.shapeProperties.borderDashes = false; + values.borderDashes = false; + } } + } - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); + /** + * Determine if the shape of a node needs to be recalculated. + * + * @param {boolean} selected + * @param {boolean} hover + * @returns {boolean} + * @protected + */ - return formatFunctions[format](m); - } + }, { + key: 'needsRefresh', + value: function needsRefresh(selected, hover) { + if (this.refreshNeeded === true) { + // This is probably not the best location to reset this member. + // However, in the current logic, it is the most convenient one. + this.refreshNeeded = false; + return true; + } - function expandFormat(format, locale) { - var i = 5; + return this.width === undefined || this.labelModule.differentState(selected, hover); + } - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } + }, { + key: 'initContextForDraw', + value: function initContextForDraw(ctx, values) { + var borderWidth = values.borderWidth / this.body.view.scale; - return format; - } + ctx.lineWidth = Math.min(this.width, borderWidth); + ctx.strokeStyle = values.borderColor; + ctx.fillStyle = values.color; + } - var match1 = /\d/; // 0 - 9 - var match2 = /\d\d/; // 00 - 99 - var match3 = /\d{3}/; // 000 - 999 - var match4 = /\d{4}/; // 0000 - 9999 - var match6 = /[+-]?\d{6}/; // -999999 - 999999 - var match1to2 = /\d\d?/; // 0 - 99 - var match3to4 = /\d\d\d\d?/; // 999 - 9999 - var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 - var match1to3 = /\d{1,3}/; // 0 - 999 - var match1to4 = /\d{1,4}/; // 0 - 9999 - var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - var matchUnsigned = /\d+/; // 0 - inf - var matchSigned = /[+-]?\d+/; // -inf - inf + }, { + key: 'performStroke', + value: function performStroke(ctx, values) { + var borderWidth = values.borderWidth / this.body.view.scale; + + //draw dashed border if enabled, save and restore is required for firefox not to crash on unix. + ctx.save(); + // if borders are zero width, they will be drawn with width 1 by default. This prevents that + if (borderWidth > 0) { + this.enableBorderDashes(ctx, values); + //draw the border + ctx.stroke(); + //disable dashed border for other elements + this.disableBorderDashes(ctx, values); + } + ctx.restore(); + } - var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z - var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 + }, { + key: 'performFill', + value: function performFill(ctx, values) { + // draw shadow if enabled + this.enableShadow(ctx, values); + // draw the background + ctx.fill(); + // disable shadows for other elements. + this.disableShadow(ctx, values); - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months - var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; + this.performStroke(ctx, values); + } + /** + * + * @param {number} margin + * @private + */ - var regexes = {}; + }, { + key: '_addBoundingBoxMargin', + value: function _addBoundingBoxMargin(margin) { + this.boundingBox.left -= margin; + this.boundingBox.top -= margin; + this.boundingBox.bottom += margin; + this.boundingBox.right += margin; + } - function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; - } + /** + * Actual implementation of this method call. + * + * Doing it like this makes it easier to override + * in the child classes. + * + * @param {number} x width + * @param {number} y height + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + * @private + */ - function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); + }, { + key: '_updateBoundingBox', + value: function _updateBoundingBox(x, y, ctx, selected, hover) { + if (ctx !== undefined) { + this.resize(ctx, selected, hover); } - return regexes[token](config._strict, config._locale); - } + this.left = x - this.width / 2; + this.top = y - this.height / 2; - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); - } + this.boundingBox.left = this.left; + this.boundingBox.top = this.top; + this.boundingBox.bottom = this.top + this.height; + this.boundingBox.right = this.left + this.width; + } - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } + /** + * Default implementation of this method call. + * This acts as a stub which can be overridden. + * + * @param {number} x width + * @param {number} y height + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + */ - var tokens = {}; + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y, ctx, selected, hover) { + this._updateBoundingBox(x, y, ctx, selected, hover); + } - function addParseToken (token, callback) { - var i, func = callback; - if (typeof token === 'string') { - token = [token]; - } - if (isNumber(callback)) { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } - } + /** + * Determine the dimensions to use for nodes with an internal label + * + * Currently, these are: Circle, Ellipse, Database, Box + * The other nodes have external labels, and will not call this method + * + * If there is no label, decent default values are supplied. + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [selected] + * @param {boolean} [hover] + * @returns {{width:number, height:number}} + */ - function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } + }, { + key: 'getDimensionsFromLabel', + value: function getDimensionsFromLabel(ctx, selected, hover) { + // NOTE: previously 'textSize' was not put in 'this' for Ellipse + // TODO: examine the consequences. + this.textSize = this.labelModule.getTextSize(ctx, selected, hover); + var width = this.textSize.width; + var height = this.textSize.height; - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); + var DEFAULT_SIZE = 14; + if (width === 0) { + // This happens when there is no label text set + width = DEFAULT_SIZE; // use a decent default + height = DEFAULT_SIZE; // if width zero, then height also always zero } - } - var YEAR = 0; - var MONTH = 1; - var DATE = 2; - var HOUR = 3; - var MINUTE = 4; - var SECOND = 5; - var MILLISECOND = 6; - var WEEK = 7; - var WEEKDAY = 8; + return { width: width, height: height }; + } + }]); + return NodeBase; +}(); - var indexOf; +exports['default'] = NodeBase; - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { - var indexOf$1 = indexOf; +"use strict"; - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); - } - // FORMATTING +Object.defineProperty(exports, "__esModule", { + value: true +}); - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); +var _getPrototypeOf = __webpack_require__(3); - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); +var _classCallCheck2 = __webpack_require__(0); - // ALIASES +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - addUnitAlias('month', 'M'); +var _createClass2 = __webpack_require__(1); - // PRIORITY +var _createClass3 = _interopRequireDefault(_createClass2); - addUnitPriority('month', 8); +var _possibleConstructorReturn2 = __webpack_require__(4); - // PARSING +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); +var _inherits2 = __webpack_require__(5); - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; - }); +var _inherits3 = _interopRequireDefault(_inherits2); - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); +var _NodeBase2 = __webpack_require__(23); - // LOCALES +var _NodeBase3 = _interopRequireDefault(_NodeBase2); - var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; - var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); - function localeMonths (m, format) { - if (!m) { - return isArray(this._months) ? this._months : - this._months['standalone']; - } - return isArray(this._months) ? this._months[m.month()] : - this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); - function localeMonthsShort (m, format) { - if (!m) { - return isArray(this._monthsShort) ? this._monthsShort : - this._monthsShort['standalone']; - } - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : - this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; +/** + * Base class for constructing Node/Cluster Shapes. + * + * @extends NodeBase + */ +var ShapeBase = function (_NodeBase) { + (0, _inherits3['default'])(ShapeBase, _NodeBase); + + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function ShapeBase(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, ShapeBase); + return (0, _possibleConstructorReturn3['default'])(this, (ShapeBase.__proto__ || (0, _getPrototypeOf2['default'])(ShapeBase)).call(this, options, body, labelModule)); } - function handleStrictParse(monthName, format, strict) { - var i, ii, mom, llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [selected] + * @param {boolean} [hover] + * @param {Object} [values={size: this.options.size}] + */ - if (strict) { - if (format === 'MMM') { - ii = indexOf$1.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf$1.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } - } - function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; + (0, _createClass3['default'])(ShapeBase, [{ + key: 'resize', + value: function resize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; + var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { size: this.options.size }; - if (this._monthsParseExact) { - return handleStrictParse.call(this, monthName, format, strict); + if (this.needsRefresh(selected, hover)) { + this.labelModule.getTextSize(ctx, selected, hover); + var size = 2 * values.size; + this.width = size; + this.height = size; + this.radius = 0.5 * this.width; } + } + + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {string} shape + * @param {number} sizeMultiplier - Unused! TODO: Remove next major release + * @param {number} x + * @param {number} y + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @private + */ - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; + }, { + key: '_drawShape', + value: function _drawShape(ctx, shape, sizeMultiplier, x, y, selected, hover, values) { + this.resize(ctx, selected, hover, values); + this.left = x - this.width / 2; + this.top = y - this.height / 2; + + this.initContextForDraw(ctx, values); + ctx[shape](x, y, values.size); + this.performFill(ctx, values); + + if (this.options.label !== undefined) { + // Need to call following here in order to ensure value for `this.labelModule.size.height` + this.labelModule.calculateLabelSize(ctx, selected, hover, x, y, 'hanging'); + var yLabel = y + 0.5 * this.height + 0.5 * this.labelModule.size.height; + this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging'); } - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } - } - - // MOMENTS - - function setMonth (mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } + this.updateBoundingBox(x, y); + } - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (!isNumber(value)) { - return mom; - } - } - } + /** + * + * @param {number} x + * @param {number} y + */ - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y) { + this.boundingBox.top = y - this.options.size; + this.boundingBox.left = x - this.options.size; + this.boundingBox.right = x + this.options.size; + this.boundingBox.bottom = y + this.options.size; - function getSetMonth (value) { - if (value != null) { - setMonth(this, value); - hooks.updateOffset(this, true); - return this; - } else { - return get(this, 'Month'); + if (this.options.label !== undefined && this.labelModule.size.width > 0) { + this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); + this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); + this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height); } - } + } + }]); + return ShapeBase; +}(_NodeBase3['default']); - function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); - } +exports['default'] = ShapeBase; - var defaultMonthsShortRegex = matchWord; - function monthsShortRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - if (!hasOwnProp(this, '_monthsShortRegex')) { - this._monthsShortRegex = defaultMonthsShortRegex; - } - return this._monthsShortStrictRegex && isStrict ? - this._monthsShortStrictRegex : this._monthsShortRegex; - } - } +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { - var defaultMonthsRegex = matchWord; - function monthsRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - if (!hasOwnProp(this, '_monthsRegex')) { - this._monthsRegex = defaultMonthsRegex; - } - return this._monthsStrictRegex && isStrict ? - this._monthsStrictRegex : this._monthsRegex; - } - } +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = __webpack_require__(78); +var defined = __webpack_require__(51); +module.exports = function (it) { + return IObject(defined(it)); +}; - function computeMonthsParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - var shortPieces = [], longPieces = [], mixedPieces = [], - i, mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - } - for (i = 0; i < 24; i++) { - mixedPieces[i] = regexEscape(mixedPieces[i]); - } +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - } +var dP = __webpack_require__(20); +var createDesc = __webpack_require__(39); +module.exports = __webpack_require__(21) ? function (object, key, value) { + return dP.f(object, key, createDesc(1, value)); +} : function (object, key, value) { + object[key] = value; + return object; +}; - // FORMATTING - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; - }); +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); +var isObject = __webpack_require__(32); +module.exports = function (it) { + if (!isObject(it)) throw TypeError(it + ' is not an object!'); + return it; +}; - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - // ALIASES +/***/ }), +/* 28 */ +/***/ (function(module, exports) { - addUnitAlias('year', 'y'); +module.exports = function (exec) { + try { + return !!exec(); + } catch (e) { + return true; + } +}; - // PRIORITIES - addUnitPriority('year', 1); +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { - // PARSING +module.exports = { "default": __webpack_require__(138), __esModule: true }; - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); - }); +"use strict"; - // HELPERS - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } +exports.__esModule = true; - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } +var _isIterable2 = __webpack_require__(188); - // HOOKS +var _isIterable3 = _interopRequireDefault(_isIterable2); - hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; +var _getIterator2 = __webpack_require__(77); - // MOMENTS +var _getIterator3 = _interopRequireDefault(_getIterator2); - var getSetYear = makeGetSet('FullYear', true); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function getIsLeapYear () { - return isLeapYear(this.year()); - } +exports.default = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; - function createDate (y, m, d, h, M, s, ms) { - // can't just apply() to create a date: - // https://stackoverflow.com/q/181348 - var date = new Date(y, m, d, h, M, s, ms); + try { + for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); - // the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); + if (i && _arr.length === i) break; } - return date; + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; } - function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if ((0, _isIterable3.default)(Object(arr))) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; +}(); - // the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; - } +/***/ }), +/* 31 */ +/***/ (function(module, exports) { - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; +module.exports = {}; - return -fwdlw + fwd - 1; - } - // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, resDayOfYear; +/***/ }), +/* 32 */ +/***/ (function(module, exports) { - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } +module.exports = function (it) { + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; - return { - year: resYear, - dayOfYear: resDayOfYear - }; - } - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, resYear; +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = __webpack_require__(84); +var enumBugKeys = __webpack_require__(58); - return { - week: resWeek, - year: resYear - }; - } +module.exports = Object.keys || function keys(O) { + return $keys(O, enumBugKeys); +}; - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } - // FORMATTING +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); +"use strict"; - // ALIASES - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); +/** + * @prototype Point3d + * @param {number} [x] + * @param {number} [y] + * @param {number} [z] + */ +function Point3d(x, y, z) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; + this.z = z !== undefined ? z : 0; +} - // PRIORITIES +/** + * Subtract the two provided points, returns a-b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a-b + */ +Point3d.subtract = function (a, b) { + var sub = new Point3d(); + sub.x = a.x - b.x; + sub.y = a.y - b.y; + sub.z = a.z - b.z; + return sub; +}; - addUnitPriority('week', 5); - addUnitPriority('isoWeek', 5); +/** + * Add the two provided points, returns a+b + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} a+b + */ +Point3d.add = function (a, b) { + var sum = new Point3d(); + sum.x = a.x + b.x; + sum.y = a.y + b.y; + sum.z = a.z + b.z; + return sum; +}; - // PARSING +/** + * Calculate the average of two 3d points + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} The average, (a+b)/2 + */ +Point3d.avg = function (a, b) { + return new Point3d((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2); +}; - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); +/** + * Calculate the cross product of the two provided points, returns axb + * Documentation: http://en.wikipedia.org/wiki/Cross_product + * @param {Point3d} a + * @param {Point3d} b + * @return {Point3d} cross product axb + */ +Point3d.crossProduct = function (a, b) { + var crossproduct = new Point3d(); + + crossproduct.x = a.y * b.z - a.z * b.y; + crossproduct.y = a.z * b.x - a.x * b.z; + crossproduct.z = a.x * b.y - a.y * b.x; + + return crossproduct; +}; - addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - }); +/** + * Rtrieve the length of the vector (or the distance from this point to the origin + * @return {number} length + */ +Point3d.prototype.length = function () { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); +}; - // HELPERS +module.exports = Point3d; - // LOCALES +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { - function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } +"use strict"; +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; +/** + * Created by Alex on 11/6/2014. + */ + +// https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60 +// if the module has no dependencies, the above pattern can be simplified to +(function (root, factory) { + if (true) { + // AMD. Register as an anonymous module. + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(); + } else { + // Browser globals (root is window) + root.keycharm = factory(); + } +}(this, function () { + + function keycharm(options) { + var preventDefault = options && options.preventDefault || false; + + var container = options && options.container || window; + + var _exportFunctions = {}; + var _bound = {keydown:{}, keyup:{}}; + var _keys = {}; + var i; + + // a - z + for (i = 97; i <= 122; i++) {_keys[String.fromCharCode(i)] = {code:65 + (i - 97), shift: false};} + // A - Z + for (i = 65; i <= 90; i++) {_keys[String.fromCharCode(i)] = {code:i, shift: true};} + // 0 - 9 + for (i = 0; i <= 9; i++) {_keys['' + i] = {code:48 + i, shift: false};} + // F1 - F12 + for (i = 1; i <= 12; i++) {_keys['F' + i] = {code:111 + i, shift: false};} + // num0 - num9 + for (i = 0; i <= 9; i++) {_keys['num' + i] = {code:96 + i, shift: false};} + + // numpad misc + _keys['num*'] = {code:106, shift: false}; + _keys['num+'] = {code:107, shift: false}; + _keys['num-'] = {code:109, shift: false}; + _keys['num/'] = {code:111, shift: false}; + _keys['num.'] = {code:110, shift: false}; + // arrows + _keys['left'] = {code:37, shift: false}; + _keys['up'] = {code:38, shift: false}; + _keys['right'] = {code:39, shift: false}; + _keys['down'] = {code:40, shift: false}; + // extra keys + _keys['space'] = {code:32, shift: false}; + _keys['enter'] = {code:13, shift: false}; + _keys['shift'] = {code:16, shift: undefined}; + _keys['esc'] = {code:27, shift: false}; + _keys['backspace'] = {code:8, shift: false}; + _keys['tab'] = {code:9, shift: false}; + _keys['ctrl'] = {code:17, shift: false}; + _keys['alt'] = {code:18, shift: false}; + _keys['delete'] = {code:46, shift: false}; + _keys['pageup'] = {code:33, shift: false}; + _keys['pagedown'] = {code:34, shift: false}; + // symbols + _keys['='] = {code:187, shift: false}; + _keys['-'] = {code:189, shift: false}; + _keys[']'] = {code:221, shift: false}; + _keys['['] = {code:219, shift: false}; + + + + var down = function(event) {handleEvent(event,'keydown');}; + var up = function(event) {handleEvent(event,'keyup');}; + + // handle the actualy bound key with the event + var handleEvent = function(event,type) { + if (_bound[type][event.keyCode] !== undefined) { + var bound = _bound[type][event.keyCode]; + for (var i = 0; i < bound.length; i++) { + if (bound[i].shift === undefined) { + bound[i].fn(event); + } + else if (bound[i].shift == true && event.shiftKey == true) { + bound[i].fn(event); + } + else if (bound[i].shift == false && event.shiftKey == false) { + bound[i].fn(event); + } + } + + if (preventDefault == true) { + event.preventDefault(); + } + } + }; + + // bind a key to a callback + _exportFunctions.bind = function(key, callback, type) { + if (type === undefined) { + type = 'keydown'; + } + if (_keys[key] === undefined) { + throw new Error("unsupported key: " + key); + } + if (_bound[type][_keys[key].code] === undefined) { + _bound[type][_keys[key].code] = []; + } + _bound[type][_keys[key].code].push({fn:callback, shift:_keys[key].shift}); + }; + + + // bind all keys to a call back (demo purposes) + _exportFunctions.bindAll = function(callback, type) { + if (type === undefined) { + type = 'keydown'; + } + for (var key in _keys) { + if (_keys.hasOwnProperty(key)) { + _exportFunctions.bind(key,callback,type); + } + } + }; + + // get the key label from an event + _exportFunctions.getKey = function(event) { + for (var key in _keys) { + if (_keys.hasOwnProperty(key)) { + if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) { + return key; + } + else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) { + return key; + } + else if (event.keyCode == _keys[key].code && key == 'shift') { + return key; + } + } + } + return "unknown key, currently not supported"; + }; + + // unbind either a specific callback from a key or all of them (by leaving callback undefined) + _exportFunctions.unbind = function(key, callback, type) { + if (type === undefined) { + type = 'keydown'; + } + if (_keys[key] === undefined) { + throw new Error("unsupported key: " + key); + } + if (callback !== undefined) { + var newBindings = []; + var bound = _bound[type][_keys[key].code]; + if (bound !== undefined) { + for (var i = 0; i < bound.length; i++) { + if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) { + newBindings.push(_bound[type][_keys[key].code][i]); + } + } + } + _bound[type][_keys[key].code] = newBindings; + } + else { + _bound[type][_keys[key].code] = []; + } + }; + + // reset all bound variables. + _exportFunctions.reset = function() { + _bound = {keydown:{}, keyup:{}}; + }; + + // unbind all listeners and reset all variables. + _exportFunctions.destroy = function() { + _bound = {keydown:{}, keyup:{}}; + container.removeEventListener('keydown', down, true); + container.removeEventListener('keyup', up, true); + }; + + // create listeners. + container.addEventListener('keydown',down,true); + container.addEventListener('keyup',up,true); + + // return the public functions. + return _exportFunctions; + } + + return keycharm; +})); + + - var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - }; - function localeFirstDayOfWeek () { - return this._week.dow; - } +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { - function localeFirstDayOfYear () { - return this._week.doy; - } +"use strict"; - // MOMENTS - function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); +/** + * used in Core to convert the options into a volatile variable + * + * @param {function} moment + * @param {Object} body + * @param {Array | Object} hiddenDates + * @returns {number} + */ +exports.convertHiddenOptions = function (moment, body, hiddenDates) { + if (hiddenDates && !Array.isArray(hiddenDates)) { + return exports.convertHiddenOptions(moment, body, [hiddenDates]); + } + + body.hiddenDates = []; + if (hiddenDates) { + if (Array.isArray(hiddenDates) == true) { + for (var i = 0; i < hiddenDates.length; i++) { + if (hiddenDates[i].repeat === undefined) { + var dateItem = {}; + dateItem.start = moment(hiddenDates[i].start).toDate().valueOf(); + dateItem.end = moment(hiddenDates[i].end).toDate().valueOf(); + body.hiddenDates.push(dateItem); + } + } + body.hiddenDates.sort(function (a, b) { + return a.start - b.start; + }); // sort by start time + } } +}; - function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); +/** + * create new entrees for the repeating hidden dates + * + * @param {function} moment + * @param {Object} body + * @param {Array | Object} hiddenDates + * @returns {null} + */ +exports.updateHiddenDates = function (moment, body, hiddenDates) { + if (hiddenDates && !Array.isArray(hiddenDates)) { + return exports.updateHiddenDates(moment, body, [hiddenDates]); } - // FORMATTING + if (hiddenDates && body.domProps.centerContainer.width !== undefined) { + exports.convertHiddenOptions(moment, body, hiddenDates); - addFormatToken('d', 0, 'do', 'day'); + var start = moment(body.range.start); + var end = moment(body.range.end); - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); + var totalRange = body.range.end - body.range.start; + var pixelTime = totalRange / body.domProps.centerContainer.width; - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); + for (var i = 0; i < hiddenDates.length; i++) { + if (hiddenDates[i].repeat !== undefined) { + var startDate = moment(hiddenDates[i].start); + var endDate = moment(hiddenDates[i].end); - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); + if (startDate._d == "Invalid Date") { + throw new Error("Supplied start date is not valid: " + hiddenDates[i].start); + } + if (endDate._d == "Invalid Date") { + throw new Error("Supplied end date is not valid: " + hiddenDates[i].end); + } - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); + var duration = endDate - startDate; + if (duration >= 4 * pixelTime) { - // ALIASES + var offset = 0; + var runUntil = end.clone(); + switch (hiddenDates[i].repeat) { + case "daily": + // case of time + if (startDate.day() != endDate.day()) { + offset = 1; + } + startDate.dayOfYear(start.dayOfYear()); + startDate.year(start.year()); + startDate.subtract(7, 'days'); - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); + endDate.dayOfYear(start.dayOfYear()); + endDate.year(start.year()); + endDate.subtract(7 - offset, 'days'); - // PRIORITY - addUnitPriority('day', 11); - addUnitPriority('weekday', 11); - addUnitPriority('isoWeekday', 11); + runUntil.add(1, 'weeks'); + break; + case "weekly": + var dayOffset = endDate.diff(startDate, 'days'); + var day = startDate.day(); - // PARSING + // set the start date to the range.start + startDate.date(start.date()); + startDate.month(start.month()); + startDate.year(start.year()); + endDate = startDate.clone(); - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); + // force + startDate.day(day); + endDate.day(day); + endDate.add(dayOffset, 'days'); - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } - }); + startDate.subtract(1, 'weeks'); + endDate.subtract(1, 'weeks'); - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); + runUntil.add(1, 'weeks'); + break; + case "monthly": + if (startDate.month() != endDate.month()) { + offset = 1; + } + startDate.month(start.month()); + startDate.year(start.year()); + startDate.subtract(1, 'months'); - // HELPERS + endDate.month(start.month()); + endDate.year(start.year()); + endDate.subtract(1, 'months'); + endDate.add(offset, 'months'); - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } + runUntil.add(1, 'months'); + break; + case "yearly": + if (startDate.year() != endDate.year()) { + offset = 1; + } + startDate.year(start.year()); + startDate.subtract(1, 'years'); + endDate.year(start.year()); + endDate.subtract(1, 'years'); + endDate.add(offset, 'years'); - if (!isNaN(input)) { - return parseInt(input, 10); + runUntil.add(1, 'years'); + break; + default: + console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat); + return; + } + while (startDate < runUntil) { + body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() }); + switch (hiddenDates[i].repeat) { + case "daily": + startDate.add(1, 'days'); + endDate.add(1, 'days'); + break; + case "weekly": + startDate.add(1, 'weeks'); + endDate.add(1, 'weeks'); + break; + case "monthly": + startDate.add(1, 'months'); + endDate.add(1, 'months'); + break; + case "yearly": + startDate.add(1, 'y'); + endDate.add(1, 'y'); + break; + default: + console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat); + return; + } + } + body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() }); + } } + } + // remove duplicates, merge where possible + exports.removeDuplicates(body); + // ensure the new positions are not on hidden dates + var startHidden = exports.isHidden(body.range.start, body.hiddenDates); + var endHidden = exports.isHidden(body.range.end, body.hiddenDates); + var rangeStart = body.range.start; + var rangeEnd = body.range.end; + if (startHidden.hidden == true) { + rangeStart = body.range.startToFront == true ? startHidden.startDate - 1 : startHidden.endDate + 1; + } + if (endHidden.hidden == true) { + rangeEnd = body.range.endToFront == true ? endHidden.startDate - 1 : endHidden.endDate + 1; + } + if (startHidden.hidden == true || endHidden.hidden == true) { + body.range._applyRange(rangeStart, rangeEnd); + } + } +}; - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; +/** + * remove duplicates from the hidden dates list. Duplicates are evil. They mess everything up. + * Scales with N^2 + * + * @param {Object} body + */ +exports.removeDuplicates = function (body) { + var hiddenDates = body.hiddenDates; + var safeDates = []; + for (var i = 0; i < hiddenDates.length; i++) { + for (var j = 0; j < hiddenDates.length; j++) { + if (i != j && hiddenDates[j].remove != true && hiddenDates[i].remove != true) { + // j inside i + if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { + hiddenDates[j].remove = true; + } + // j start inside i + else if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].start <= hiddenDates[i].end) { + hiddenDates[i].end = hiddenDates[j].end; + hiddenDates[j].remove = true; + } + // j end inside i + else if (hiddenDates[j].end >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { + hiddenDates[i].start = hiddenDates[j].start; + hiddenDates[j].remove = true; + } } + } + } - return null; + for (i = 0; i < hiddenDates.length; i++) { + if (hiddenDates[i].remove !== true) { + safeDates.push(hiddenDates[i]); + } } - function parseIsoWeekday(input, locale) { - if (typeof input === 'string') { - return locale.weekdaysParse(input) % 7 || 7; - } - return isNaN(input) ? null : input; + body.hiddenDates = safeDates; + body.hiddenDates.sort(function (a, b) { + return a.start - b.start; + }); // sort by start time +}; + +exports.printDates = function (dates) { + for (var i = 0; i < dates.length; i++) { + console.log(i, new Date(dates[i].start), new Date(dates[i].end), dates[i].start, dates[i].end, dates[i].remove); } +}; - // LOCALES +/** + * Used in TimeStep to avoid the hidden times. + * @param {function} moment + * @param {TimeStep} timeStep + * @param {Date} previousTime + */ +exports.stepOverHiddenDates = function (moment, timeStep, previousTime) { + var stepInHidden = false; + var currentValue = timeStep.current.valueOf(); + for (var i = 0; i < timeStep.hiddenDates.length; i++) { + var startDate = timeStep.hiddenDates[i].start; + var endDate = timeStep.hiddenDates[i].end; + if (currentValue >= startDate && currentValue < endDate) { + stepInHidden = true; + break; + } + } + + if (stepInHidden == true && currentValue < timeStep._end.valueOf() && currentValue != previousTime) { + var prevValue = moment(previousTime); + var newValue = moment(endDate); + //check if the next step should be major + if (prevValue.year() != newValue.year()) { + timeStep.switchedYear = true; + } else if (prevValue.month() != newValue.month()) { + timeStep.switchedMonth = true; + } else if (prevValue.dayOfYear() != newValue.dayOfYear()) { + timeStep.switchedDay = true; + } + + timeStep.current = newValue; + } +}; + +///** +// * Used in TimeStep to avoid the hidden times. +// * @param timeStep +// * @param previousTime +// */ +//exports.checkFirstStep = function(timeStep) { +// var stepInHidden = false; +// var currentValue = timeStep.current.valueOf(); +// for (var i = 0; i < timeStep.hiddenDates.length; i++) { +// var startDate = timeStep.hiddenDates[i].start; +// var endDate = timeStep.hiddenDates[i].end; +// if (currentValue >= startDate && currentValue < endDate) { +// stepInHidden = true; +// break; +// } +// } +// +// if (stepInHidden == true && currentValue <= timeStep._end.valueOf()) { +// var newValue = moment(endDate); +// timeStep.current = newValue.toDate(); +// } +//}; - var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); - function localeWeekdays (m, format) { - if (!m) { - return isArray(this._weekdays) ? this._weekdays : - this._weekdays['standalone']; - } - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; +/** + * replaces the Core toScreen methods + * + * @param {vis.Core} Core + * @param {Date} time + * @param {number} width + * @returns {number} + */ +exports.toScreen = function (Core, time, width) { + var conversion; + if (Core.body.hiddenDates.length == 0) { + conversion = Core.range.conversion(width); + return (time.valueOf() - conversion.offset) * conversion.scale; + } else { + var hidden = exports.isHidden(time, Core.body.hiddenDates); + if (hidden.hidden == true) { + time = hidden.startDate; + } + + var duration = exports.getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end); + if (time < Core.range.start) { + conversion = Core.range.conversion(width, duration); + var hiddenBeforeStart = exports.getHiddenDurationBeforeStart(Core.body.hiddenDates, time, conversion.offset); + time = Core.options.moment(time).toDate().valueOf(); + time = time + hiddenBeforeStart; + return -(conversion.offset - time.valueOf()) * conversion.scale; + } else if (time > Core.range.end) { + var rangeAfterEnd = { start: Core.range.start, end: time }; + time = exports.correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, rangeAfterEnd, time); + conversion = Core.range.conversion(width, duration); + return (time.valueOf() - conversion.offset) * conversion.scale; + } else { + time = exports.correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, Core.range, time); + conversion = Core.range.conversion(width, duration); + return (time.valueOf() - conversion.offset) * conversion.scale; + } } +}; + +/** + * Replaces the core toTime methods + * + * @param {vis.Core} Core + * @param {number} x + * @param {number} width + * @returns {Date} + */ +exports.toTime = function (Core, x, width) { + if (Core.body.hiddenDates.length == 0) { + var conversion = Core.range.conversion(width); + return new Date(x / conversion.scale + conversion.offset); + } else { + var hiddenDuration = exports.getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end); + var totalDuration = Core.range.end - Core.range.start - hiddenDuration; + var partialDuration = totalDuration * x / width; + var accumulatedHiddenDuration = exports.getAccumulatedHiddenDuration(Core.body.hiddenDates, Core.range, partialDuration); - var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); - function localeWeekdaysShort (m) { - return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; + return new Date(accumulatedHiddenDuration + partialDuration + Core.range.start); } +}; + +/** + * Support function + * + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {number} start + * @param {number} end + * @returns {number} + */ +exports.getHiddenDurationBetween = function (hiddenDates, start, end) { + var duration = 0; + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + // if time after the cutout, and the + if (startDate >= start && endDate < end) { + duration += endDate - startDate; + } + } + return duration; +}; + +/** + * Support function + * + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {number} start + * @param {number} end + * @returns {number} + */ +exports.getHiddenDurationBeforeStart = function (hiddenDates, start, end) { + var duration = 0; + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; - var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); - function localeWeekdaysMin (m) { - return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; + if (startDate >= start && endDate <= end) { + duration += endDate - startDate; + } } + return duration; +}; - function handleStrictParse$1(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; +/** + * Support function + * @param {function} moment + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {{start: number, end: number}} range + * @param {Date} time + * @returns {number} + */ +exports.correctTimeForHidden = function (moment, hiddenDates, range, time) { + time = moment(time).toDate().valueOf(); + time -= exports.getHiddenDurationBefore(moment, hiddenDates, range, time); + return time; +}; + +exports.getHiddenDurationBefore = function (moment, hiddenDates, range, time) { + var timeOffset = 0; + time = moment(time).toDate().valueOf(); + + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + // if time after the cutout, and the + if (startDate >= range.start && endDate < range.end) { + if (time >= endDate) { + timeOffset += endDate - startDate; + } + } + } + return timeOffset; +}; - for (i = 0; i < 7; ++i) { - mom = createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } +/** + * sum the duration from start to finish, including the hidden duration, + * until the required amount has been reached, return the accumulated hidden duration + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {{start: number, end: number}} range + * @param {number} [requiredDuration=0] + * @returns {number} + */ +exports.getAccumulatedHiddenDuration = function (hiddenDates, range, requiredDuration) { + var hiddenDuration = 0; + var duration = 0; + var previousPoint = range.start; + //exports.printDates(hiddenDates) + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; + // if time after the cutout, and the + if (startDate >= range.start && endDate < range.end) { + duration += startDate - previousPoint; + previousPoint = endDate; + if (duration >= requiredDuration) { + break; + } else { + hiddenDuration += endDate - startDate; } + } + } - if (strict) { - if (format === 'dddd') { - ii = indexOf$1.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } + return hiddenDuration; +}; + +/** + * used to step over to either side of a hidden block. Correction is disabled on tablets, might be set to true + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @param {Date} time + * @param {number} direction + * @param {boolean} correctionEnabled + * @returns {Date|number} + */ +exports.snapAwayFromHidden = function (hiddenDates, time, direction, correctionEnabled) { + var isHidden = exports.isHidden(time, hiddenDates); + if (isHidden.hidden == true) { + if (direction < 0) { + if (correctionEnabled == true) { + return isHidden.startDate - (isHidden.endDate - time) - 1; } else { - if (format === 'dddd') { - ii = indexOf$1.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf$1.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf$1.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } + return isHidden.startDate - 1; } + } else { + if (correctionEnabled == true) { + return isHidden.endDate + (time - isHidden.startDate) + 1; + } else { + return isHidden.endDate + 1; + } + } + } else { + return time; } +}; - function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return handleStrictParse$1.call(this, weekdayName, format, strict); - } +/** + * Check if a time is hidden + * + * @param {Date} time + * @param {Array.<{start: Window.start, end: *}>} hiddenDates + * @returns {{hidden: boolean, startDate: Window.start, endDate: *}} + */ +exports.isHidden = function (time, hiddenDates) { + for (var i = 0; i < hiddenDates.length; i++) { + var startDate = hiddenDates[i].start; + var endDate = hiddenDates[i].end; - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } + if (time >= startDate && time < endDate) { + // if the start is entering a hidden zone + return { hidden: true, startDate: startDate, endDate: endDate }; + } + } + return { hidden: false, startDate: startDate, endDate: endDate }; +}; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { - mom = createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); - } - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - } +"use strict"; - // MOMENTS - function getSetDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } +/** + * Register a touch event, taking place before a gesture + * @param {Hammer} hammer A hammer instance + * @param {function} callback Callback, called as callback(event) + */ +exports.onTouch = function (hammer, callback) { + callback.inputHandler = function (event) { + if (event.isFirst) { + callback(event); + } + }; - function getSetLocaleDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } + hammer.on('hammer.input', callback.inputHandler); +}; - function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } +/** + * Register a release event, taking place after a gesture + * @param {Hammer} hammer A hammer instance + * @param {function} callback Callback, called as callback(event) + * @returns {*} + */ +exports.onRelease = function (hammer, callback) { + callback.inputHandler = function (event) { + if (event.isFinal) { + callback(event); + } + }; - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. + return hammer.on('hammer.input', callback.inputHandler); +}; - if (input != null) { - var weekday = parseIsoWeekday(input, this.localeData()); - return this.day(this.day() % 7 ? weekday : weekday - 7); - } else { - return this.day() || 7; - } - } +/** + * Unregister a touch event, taking place before a gesture + * @param {Hammer} hammer A hammer instance + * @param {function} callback Callback, called as callback(event) + */ +exports.offTouch = function (hammer, callback) { + hammer.off('hammer.input', callback.inputHandler); +}; - var defaultWeekdaysRegex = matchWord; - function weekdaysRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysRegex')) { - this._weekdaysRegex = defaultWeekdaysRegex; - } - return this._weekdaysStrictRegex && isStrict ? - this._weekdaysStrictRegex : this._weekdaysRegex; - } - } +/** + * Unregister a release event, taking place before a gesture + * @param {Hammer} hammer A hammer instance + * @param {function} callback Callback, called as callback(event) + */ +exports.offRelease = exports.offTouch; - var defaultWeekdaysShortRegex = matchWord; - function weekdaysShortRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysShortRegex')) { - this._weekdaysShortRegex = defaultWeekdaysShortRegex; - } - return this._weekdaysShortStrictRegex && isStrict ? - this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } - } +/** + * Hack the PinchRecognizer such that it doesn't prevent default behavior + * for vertical panning. + * + * Yeah ... this is quite a hack ... see https://github.com/hammerjs/hammer.js/issues/932 + * + * @param {Hammer.Pinch} pinchRecognizer + * @return {Hammer.Pinch} returns the pinchRecognizer + */ +exports.disablePreventDefaultVertically = function (pinchRecognizer) { + var TOUCH_ACTION_PAN_Y = 'pan-y'; - var defaultWeekdaysMinRegex = matchWord; - function weekdaysMinRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysMinRegex')) { - this._weekdaysMinRegex = defaultWeekdaysMinRegex; - } - return this._weekdaysMinStrictRegex && isStrict ? - this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } - } + pinchRecognizer.getTouchAction = function () { + // default method returns [TOUCH_ACTION_NONE] + return [TOUCH_ACTION_PAN_Y]; + }; + return pinchRecognizer; +}; - function computeWeekdaysParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { - var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], - i, mom, minp, shortp, longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } +"use strict"; - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); - } +var _typeof2 = __webpack_require__(6); - // FORMATTING +var _typeof3 = _interopRequireDefault(_typeof2); - function hFormat() { - return this.hours() % 12 || 12; - } +var _keys = __webpack_require__(8); - function kFormat() { - return this.hours() || 24; - } +var _keys2 = _interopRequireDefault(_keys); - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); +var Hammer = __webpack_require__(10); +var util = __webpack_require__(2); +var moment = __webpack_require__(9); - addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); +/** + * @constructor Item + * @param {Object} data Object containing (optional) parameters type, + * start, end, content, group, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} options Configuration options + * // TODO: describe available options + */ +function Item(data, conversion, options) { + this.id = null; + this.parent = null; + this.data = data; + this.dom = null; + this.conversion = conversion || {}; + this.options = options || {}; + this.selected = false; + this.displayed = false; + this.groupShowing = true; + this.dirty = true; + + this.top = null; + this.right = null; + this.left = null; + this.width = null; + this.height = null; + + this.editable = null; + this._updateEditStatus(); +} + +Item.prototype.stack = true; - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); +/** + * Select current item + */ +Item.prototype.select = function () { + this.selected = true; + this.dirty = true; + if (this.displayed) this.redraw(); +}; - addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); +/** + * Unselect current item + */ +Item.prototype.unselect = function () { + this.selected = false; + this.dirty = true; + if (this.displayed) this.redraw(); +}; - function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); +/** + * Set data for the item. Existing data will be updated. The id should not + * be changed. When the item is displayed, it will be redrawn immediately. + * @param {Object} data + */ +Item.prototype.setData = function (data) { + var groupChanged = data.group != undefined && this.data.group != data.group; + if (groupChanged && this.parent != null) { + this.parent.itemSet._moveToGroup(this, data.group); } - meridiem('a', true); - meridiem('A', false); + if (this.parent) { + this.parent.stackDirty = true; + } - // ALIASES + var subGroupChanged = data.subgroup != undefined && this.data.subgroup != data.subgroup; + if (subGroupChanged && this.parent != null) { + this.parent.changeSubgroup(this, this.data.subgroup, data.subgroup); + } - addUnitAlias('hour', 'h'); + this.data = data; + this._updateEditStatus(); + this.dirty = true; + if (this.displayed) this.redraw(); +}; - // PRIORITY - addUnitPriority('hour', 13); +/** + * Set a parent for the item + * @param {Group} parent + */ +Item.prototype.setParent = function (parent) { + if (this.displayed) { + this.hide(); + this.parent = parent; + if (this.parent) { + this.show(); + } + } else { + this.parent = parent; + } +}; - // PARSING +/** + * Check whether this item is visible inside given range + * @param {vis.Range} range with a timestamp for start and end + * @returns {boolean} True if visible + */ +Item.prototype.isVisible = function (range) { + // eslint-disable-line no-unused-vars + return false; +}; - function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; - } +/** + * Show the Item in the DOM (when not already visible) + * @return {Boolean} changed + */ +Item.prototype.show = function () { + return false; +}; - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('k', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - addRegexToken('kk', match1to2, match2); +/** + * Hide the Item from the DOM (when visible) + * @return {Boolean} changed + */ +Item.prototype.hide = function () { + return false; +}; - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); +/** + * Repaint the item + */ +Item.prototype.redraw = function () { + // should be implemented by the item +}; - addParseToken(['H', 'HH'], HOUR); - addParseToken(['k', 'kk'], function (input, array, config) { - var kInput = toInt(input); - array[HOUR] = kInput === 24 ? 0 : kInput; - }); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); +/** + * Reposition the Item horizontally + */ +Item.prototype.repositionX = function () { + // should be implemented by the item +}; - // LOCALES +/** + * Reposition the Item vertically + */ +Item.prototype.repositionY = function () { + // should be implemented by the item +}; - function localeIsPM (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); - } +/** + * Repaint a drag area on the center of the item when the item is selected + * @protected + */ +Item.prototype._repaintDragCenter = function () { + if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) { + var me = this; + // create and show drag area + var dragCenter = document.createElement('div'); + dragCenter.className = 'vis-drag-center'; + dragCenter.dragCenterItem = this; + var hammer = new Hammer(dragCenter); + + hammer.on('tap', function (event) { + me.parent.itemSet.body.emitter.emit('click', { + event: event, + item: me.id + }); + }); + hammer.on('doubletap', function (event) { + event.stopPropagation(); + me.parent.itemSet._onUpdateItem(me); + me.parent.itemSet.body.emitter.emit('doubleClick', { + event: event, + item: me.id + }); + }); - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; - function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; + if (this.dom.box) { + if (this.dom.dragLeft) { + this.dom.box.insertBefore(dragCenter, this.dom.dragLeft); } else { - return isLower ? 'am' : 'AM'; + this.dom.box.appendChild(dragCenter); } - } + } else if (this.dom.point) { + this.dom.point.appendChild(dragCenter); + } + this.dom.dragCenter = dragCenter; + } else if (!this.selected && this.dom.dragCenter) { + // delete drag area + if (this.dom.dragCenter.parentNode) { + this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter); + } + this.dom.dragCenter = null; + } +}; - // MOMENTS +/** + * Repaint a delete button on the top right of the item when the item is selected + * @param {HTMLElement} anchor + * @protected + */ +Item.prototype._repaintDeleteButton = function (anchor) { + var editable = (this.options.editable.overrideItems || this.editable == null) && this.options.editable.remove || !this.options.editable.overrideItems && this.editable != null && this.editable.remove; + + if (this.selected && editable && !this.dom.deleteButton) { + // create and show button + var me = this; - // Setting the hour should keep the time, because the user explicitly - // specified which hour he wants. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - var getSetHour = makeGetSet('Hours', true); + var deleteButton = document.createElement('div'); - // months - // week - // weekdays - // meridiem - var baseConfig = { - calendar: defaultCalendar, - longDateFormat: defaultLongDateFormat, - invalidDate: defaultInvalidDate, - ordinal: defaultOrdinal, - dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, - relativeTime: defaultRelativeTime, + if (this.options.rtl) { + deleteButton.className = 'vis-delete-rtl'; + } else { + deleteButton.className = 'vis-delete'; + } + deleteButton.title = 'Delete this item'; - months: defaultLocaleMonths, - monthsShort: defaultLocaleMonthsShort, + // TODO: be able to destroy the delete button + new Hammer(deleteButton).on('tap', function (event) { + event.stopPropagation(); + me.parent.removeFromDataSet(me); + }); - week: defaultLocaleWeek, + anchor.appendChild(deleteButton); + this.dom.deleteButton = deleteButton; + } else if (!this.selected && this.dom.deleteButton) { + // remove button + if (this.dom.deleteButton.parentNode) { + this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton); + } + this.dom.deleteButton = null; + } +}; - weekdays: defaultLocaleWeekdays, - weekdaysMin: defaultLocaleWeekdaysMin, - weekdaysShort: defaultLocaleWeekdaysShort, +/** + * Repaint a onChange tooltip on the top right of the item when the item is selected + * @param {HTMLElement} anchor + * @protected + */ +Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) { + if (!this.options.tooltipOnItemUpdateTime) return; - meridiemParse: defaultLocaleMeridiemParse - }; + var editable = (this.options.editable.updateTime || this.data.editable === true) && this.data.editable !== false; - // internal storage for locale config files - var locales = {}; - var localeFamilies = {}; - var globalLocale; - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; - } + if (this.selected && editable && !this.dom.onItemUpdateTimeTooltip) { + var onItemUpdateTimeTooltip = document.createElement('div'); - function loadLocale(name) { - var oldLocale = null; - // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && (typeof module !== 'undefined') && - module && module.exports) { - try { - oldLocale = globalLocale._abbr; - !(function webpackMissingModule() { var e = new Error("Cannot find module \"./locale\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; + onItemUpdateTimeTooltip.className = 'vis-onUpdateTime-tooltip'; + anchor.appendChild(onItemUpdateTimeTooltip); + this.dom.onItemUpdateTimeTooltip = onItemUpdateTimeTooltip; + } else if (!this.selected && this.dom.onItemUpdateTimeTooltip) { + // remove button + if (this.dom.onItemUpdateTimeTooltip.parentNode) { + this.dom.onItemUpdateTimeTooltip.parentNode.removeChild(this.dom.onItemUpdateTimeTooltip); + } + this.dom.onItemUpdateTimeTooltip = null; } - // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - function getSetGlobalLocale (key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = getLocale(key); - } - else { - data = defineLocale(key, values); - } + // position onChange tooltip + if (this.dom.onItemUpdateTimeTooltip) { - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } + // only show when editing + this.dom.onItemUpdateTimeTooltip.style.visibility = this.parent.itemSet.touchParams.itemIsDragging ? 'visible' : 'hidden'; - return globalLocale._abbr; - } + // position relative to item's content + if (this.options.rtl) { + this.dom.onItemUpdateTimeTooltip.style.right = this.dom.content.style.right; + } else { + this.dom.onItemUpdateTimeTooltip.style.left = this.dom.content.style.left; + } - function defineLocale (name, config) { - if (config !== null) { - var parentConfig = baseConfig; - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale ' + - 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); - parentConfig = locales[name]._config; - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - parentConfig = locales[config.parentLocale]._config; - } else { - if (!localeFamilies[config.parentLocale]) { - localeFamilies[config.parentLocale] = []; - } - localeFamilies[config.parentLocale].push({ - name: name, - config: config - }); - return null; - } - } - locales[name] = new Locale(mergeConfigs(parentConfig, config)); + // position above or below the item depending on the item's position in the window + var tooltipOffset = 50; // TODO: should be tooltip height (depends on template) + var scrollTop = this.parent.itemSet.body.domProps.scrollTop; - if (localeFamilies[name]) { - localeFamilies[name].forEach(function (x) { - defineLocale(x.name, x.config); - }); - } + // TODO: this.top for orientation:true is actually the items distance from the bottom... + // (should be this.bottom) + var itemDistanceFromTop; + if (this.options.orientation.item == 'top') { + itemDistanceFromTop = this.top; + } else { + itemDistanceFromTop = this.parent.height - this.top - this.height; + } + var isCloseToTop = itemDistanceFromTop + this.parent.top - tooltipOffset < -scrollTop; - // backwards compat for now: also set the locale - // make sure we set the locale AFTER all child locales have been - // created, so we won't end up with the child locale set. - getSetGlobalLocale(name); + if (isCloseToTop) { + this.dom.onItemUpdateTimeTooltip.style.bottom = ""; + this.dom.onItemUpdateTimeTooltip.style.top = this.height + 2 + "px"; + } else { + this.dom.onItemUpdateTimeTooltip.style.top = ""; + this.dom.onItemUpdateTimeTooltip.style.bottom = this.height + 2 + "px"; + } + // handle tooltip content + var content; + var templateFunction; - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; + if (this.options.tooltipOnItemUpdateTime && this.options.tooltipOnItemUpdateTime.template) { + templateFunction = this.options.tooltipOnItemUpdateTime.template.bind(this); + content = templateFunction(this.data); + } else { + content = 'start: ' + moment(this.data.start).format('MM/DD/YYYY hh:mm'); + if (this.data.end) { + content += '
end: ' + moment(this.data.end).format('MM/DD/YYYY hh:mm'); } + } + this.dom.onItemUpdateTimeTooltip.innerHTML = content; } +}; - function updateLocale(name, config) { - if (config != null) { - var locale, parentConfig = baseConfig; - // MERGE - if (locales[name] != null) { - parentConfig = locales[name]._config; - } - config = mergeConfigs(parentConfig, config); - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; +/** + * Set HTML contents for the item + * @param {Element} element HTML element to fill with the contents + * @private + */ +Item.prototype._updateContents = function (element) { + var content; + var changed; + var templateFunction; + var itemVisibleFrameContent; + var visibleFrameTemplateFunction; + var itemData = this.parent.itemSet.itemsData.get(this.id); // get a clone of the data from the dataset + + var frameElement = this.dom.box || this.dom.point; + var itemVisibleFrameContentElement = frameElement.getElementsByClassName('vis-item-visible-frame')[0]; + + if (this.options.visibleFrameTemplate) { + visibleFrameTemplateFunction = this.options.visibleFrameTemplate.bind(this); + itemVisibleFrameContent = visibleFrameTemplateFunction(itemData, frameElement); + } else { + itemVisibleFrameContent = ''; + } - // backwards compat for now: also set the locale - getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } + if (itemVisibleFrameContentElement) { + if (itemVisibleFrameContent instanceof Object && !(itemVisibleFrameContent instanceof Element)) { + visibleFrameTemplateFunction(itemData, itemVisibleFrameContentElement); + } else { + changed = this._contentToString(this.itemVisibleFrameContent) !== this._contentToString(itemVisibleFrameContent); + if (changed) { + // only replace the content when changed + if (itemVisibleFrameContent instanceof Element) { + itemVisibleFrameContentElement.innerHTML = ''; + itemVisibleFrameContentElement.appendChild(itemVisibleFrameContent); + } else if (itemVisibleFrameContent != undefined) { + itemVisibleFrameContentElement.innerHTML = itemVisibleFrameContent; + } else { + if (!(this.data.type == 'background' && this.data.content === undefined)) { + throw new Error('Property "content" missing in item ' + this.id); } + } + + this.itemVisibleFrameContent = itemVisibleFrameContent; } - return locales[name]; + } } - // returns locale data - function getLocale (key) { - var locale; + if (this.options.template) { + templateFunction = this.options.template.bind(this); + content = templateFunction(itemData, element, this.data); + } else { + content = this.data.content; + } - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; + if (content instanceof Object && !(content instanceof Element)) { + templateFunction(itemData, element); + } else { + changed = this._contentToString(this.content) !== this._contentToString(content); + if (changed) { + // only replace the content when changed + if (content instanceof Element) { + element.innerHTML = ''; + element.appendChild(content); + } else if (content != undefined) { + element.innerHTML = content; + } else { + if (!(this.data.type == 'background' && this.data.content === undefined)) { + throw new Error('Property "content" missing in item ' + this.id); + } } + this.content = content; + } + } +}; - if (!key) { - return globalLocale; - } +/** + * Process dataAttributes timeline option and set as data- attributes on dom.content + * @param {Element} element HTML element to which the attributes will be attached + * @private + */ +Item.prototype._updateDataAttributes = function (element) { + if (this.options.dataAttributes && this.options.dataAttributes.length > 0) { + var attributes = []; + + if (Array.isArray(this.options.dataAttributes)) { + attributes = this.options.dataAttributes; + } else if (this.options.dataAttributes == 'all') { + attributes = (0, _keys2['default'])(this.data); + } else { + return; + } - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } + for (var i = 0; i < attributes.length; i++) { + var name = attributes[i]; + var value = this.data[name]; - return chooseLocale(key); + if (value != null) { + element.setAttribute('data-' + name, value); + } else { + element.removeAttribute('data-' + name); + } + } } +}; - function listLocales() { - return keys$1(locales); +/** + * Update custom styles of the element + * @param {Element} element + * @private + */ +Item.prototype._updateStyle = function (element) { + // remove old styles + if (this.style) { + util.removeCssText(element, this.style); + this.style = null; } - function checkOverflow (m) { - var overflow; - var a = m._a; - - if (a && getParsingFlags(m).overflow === -2) { - overflow = - a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : - a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : - a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : - a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : - a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : - a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : - -1; + // append new styles + if (this.data.style) { + util.addCssText(element, this.data.style); + this.style = this.data.style; + } +}; - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } +/** + * Stringify the items contents + * @param {string | Element | undefined} content + * @returns {string | undefined} + * @private + */ +Item.prototype._contentToString = function (content) { + if (typeof content === 'string') return content; + if (content && 'outerHTML' in content) return content.outerHTML; + return content; +}; - getParsingFlags(m).overflow = overflow; +/** + * Update the editability of this item. + */ +Item.prototype._updateEditStatus = function () { + if (this.options) { + if (typeof this.options.editable === 'boolean') { + this.editable = { + updateTime: this.options.editable, + updateGroup: this.options.editable, + remove: this.options.editable + }; + } else if ((0, _typeof3['default'])(this.options.editable) === 'object') { + this.editable = {}; + util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.options.editable); + } + } + // Item data overrides, except if options.editable.overrideItems is set. + if (!this.options || !this.options.editable || this.options.editable.overrideItems !== true) { + if (this.data) { + if (typeof this.data.editable === 'boolean') { + this.editable = { + updateTime: this.data.editable, + updateGroup: this.data.editable, + remove: this.data.editable + }; + } else if ((0, _typeof3['default'])(this.data.editable) === 'object') { + // TODO: in vis.js 5.0, we should change this to not reset options from the timeline configuration. + // Basically just remove the next line... + this.editable = {}; + util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.data.editable); } - - return m; + } } +}; - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; - var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; +/** + * Return the width of the item left from its start date + * @return {number} + */ +Item.prototype.getWidthLeft = function () { + return 0; +}; - var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; +/** + * Return the width of the item right from the max of its start and end date + * @return {number} + */ +Item.prototype.getWidthRight = function () { + return 0; +}; - var isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/] - ]; +/** + * Return the title of the item + * @return {string | undefined} + */ +Item.prototype.getTitle = function () { + return this.data.title; +}; - // iso time formats and regexes - var isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/] - ]; +module.exports = Item; - var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; +/***/ }), +/* 39 */ +/***/ (function(module, exports) { - // date from iso format - function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; +module.exports = function (bitmap, value) { + return { + enumerable: !(bitmap & 1), + configurable: !(bitmap & 2), + writable: !(bitmap & 4), + value: value + }; +}; - if (match) { - getParsingFlags(config).iso = true; - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - if (dateFormat == null) { - config._isValid = false; - return; - } - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - if (timeFormat == null) { - config._isValid = false; - return; - } - } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } - } - - // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 - var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/; - - // date and time from ref 2822 format - function configFromRFC2822(config) { - var string, match, dayFormat, - dateFormat, timeFormat, tzFormat; - var timezones = { - ' GMT': ' +0000', - ' EDT': ' -0400', - ' EST': ' -0500', - ' CDT': ' -0500', - ' CST': ' -0600', - ' MDT': ' -0600', - ' MST': ' -0700', - ' PDT': ' -0700', - ' PST': ' -0800' - }; - var military = 'YXWVUTSRQPONZABCDEFGHIKLM'; - var timezone, timezoneIndex; - - string = config._i - .replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace - .replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space - .replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces - match = basicRfcRegex.exec(string); - - if (match) { - dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : ''; - dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY '); - timeFormat = 'HH:mm' + (match[4] ? ':ss' : ''); - - // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. - if (match[1]) { // day of week given - var momentDate = new Date(match[2]); - var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()]; - - if (match[1].substr(0,3) !== momentDay) { - getParsingFlags(config).weekdayMismatch = true; - config._isValid = false; - return; - } - } +/***/ }), +/* 40 */ +/***/ (function(module, exports) { - switch (match[5].length) { - case 2: // military - if (timezoneIndex === 0) { - timezone = ' +0000'; - } else { - timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12; - timezone = ((timezoneIndex < 0) ? ' -' : ' +') + - (('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00'; - } - break; - case 4: // Zone - timezone = timezones[match[5]]; - break; - default: // UT or +/-9999 - timezone = timezones[' GMT']; - } - match[5] = timezone; - config._i = match.splice(1).join(''); - tzFormat = ' ZZ'; - config._f = dayFormat + dateFormat + timeFormat + tzFormat; - configFromStringAndFormat(config); - getParsingFlags(config).rfc2822 = true; - } else { - config._isValid = false; - } - } +var id = 0; +var px = Math.random(); +module.exports = function (key) { + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; - // date from iso format or fallback - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } - - configFromRFC2822(config); - if (config._isValid === false) { - delete config._isValid; - } else { - return; - } - - // Final attempt, use Input Fallback - hooks.createFromInputFallback(config); - } - - hooks.createFromInputFallback = deprecate( - 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + - 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + - 'discouraged and will be removed in an upcoming major release. Please refer to ' + - 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } - ); - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } - - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { - if (config._d) { - return; - } +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(51); +module.exports = function (it) { + return Object(defined(it)); +}; - currentDate = currentDateArray(config); - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } +/***/ }), +/* 42 */ +/***/ (function(module, exports) { - //if the day of the year is set, figure out what it is - if (config._dayOfYear != null) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); +exports.f = {}.propertyIsEnumerable; - if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { - getParsingFlags(config)._overflowDayOfYear = true; - } - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } +"use strict"; - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } +/** + * A queue + * @param {Object} options + * Available options: + * - delay: number When provided, the queue will be flushed + * automatically after an inactivity of this delay + * in milliseconds. + * Default value is null. + * - max: number When the queue exceeds the given maximum number + * of entries, the queue is flushed automatically. + * Default value of max is Infinity. + * @constructor Queue + */ +function Queue(options) { + // options + this.delay = null; + this.max = Infinity; + + // properties + this._queue = []; + this._timeout = null; + this._extended = null; + + this.setOptions(options); +} - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } +/** + * Update the configuration of the queue + * @param {Object} options + * Available options: + * - delay: number When provided, the queue will be flushed + * automatically after an inactivity of this delay + * in milliseconds. + * Default value is null. + * - max: number When the queue exceeds the given maximum number + * of entries, the queue is flushed automatically. + * Default value of max is Infinity. + */ +Queue.prototype.setOptions = function (options) { + if (options && typeof options.delay !== 'undefined') { + this.delay = options.delay; + } + if (options && typeof options.max !== 'undefined') { + this.max = options.max; + } + + this._flushIfNeeded(); +}; - if (config._nextDay) { - config._a[HOUR] = 24; - } +/** + * Extend an object with queuing functionality. + * The object will be extended with a function flush, and the methods provided + * in options.replace will be replaced with queued ones. + * @param {Object} object + * @param {Object} options + * Available options: + * - replace: Array. + * A list with method names of the methods + * on the object to be replaced with queued ones. + * - delay: number When provided, the queue will be flushed + * automatically after an inactivity of this delay + * in milliseconds. + * Default value is null. + * - max: number When the queue exceeds the given maximum number + * of entries, the queue is flushed automatically. + * Default value of max is Infinity. + * @return {Queue} Returns the created queue + */ +Queue.extend = function (object, options) { + var queue = new Queue(options); + + if (object.flush !== undefined) { + throw new Error('Target object already has a property flush'); + } + object.flush = function () { + queue.flush(); + }; + + var methods = [{ + name: 'flush', + original: undefined + }]; + + if (options && options.replace) { + for (var i = 0; i < options.replace.length; i++) { + var name = options.replace[i]; + methods.push({ + name: name, + original: object[name] + }); + queue.replace(object, name); + } } - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; + queue._extended = { + object: object, + methods: methods + }; - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; + return queue; +}; - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } +/** + * Destroy the queue. The queue will first flush all queued actions, and in + * case it has extended an object, will restore the original object. + */ +Queue.prototype.destroy = function () { + this.flush(); + + if (this._extended) { + var object = this._extended.object; + var methods = this._extended.methods; + for (var i = 0; i < methods.length; i++) { + var method = methods[i]; + if (method.original) { + object[method.name] = method.original; } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; + delete object[method.name]; + } + } + this._extended = null; + } +}; - var curWeek = weekOfYear(createLocal(), dow, doy); +/** + * Replace a method on an object with a queued version + * @param {Object} object Object having the method + * @param {string} method The method name + */ +Queue.prototype.replace = function (object, method) { + var me = this; + var original = object[method]; + if (!original) { + throw new Error('Method ' + method + ' undefined'); + } + + object[method] = function () { + // create an Array with the arguments + var args = []; + for (var i = 0; i < arguments.length; i++) { + args[i] = arguments[i]; + } + + // add this call to the queue + me.queue({ + args: args, + fn: original, + context: this + }); + }; +}; - weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); +/** + * Queue a call + * @param {function | {fn: function, args: Array} | {fn: function, args: Array, context: Object}} entry + */ +Queue.prototype.queue = function (entry) { + if (typeof entry === 'function') { + this._queue.push({ fn: entry }); + } else { + this._queue.push(entry); + } - // Default to current week. - week = defaults(w.w, curWeek.week); + this._flushIfNeeded(); +}; - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } +/** + * Check whether the queue needs to be flushed + * @private + */ +Queue.prototype._flushIfNeeded = function () { + // flush when the maximum is exceeded. + if (this._queue.length > this.max) { + this.flush(); } - // constant that refers to the ISO standard - hooks.ISO_8601 = function () {}; - - // constant that refers to the RFC 2822 form - hooks.RFC_2822 = function () {}; + // flush after a period of inactivity when a delay is configured + clearTimeout(this._timeout); + if (this.queue.length > 0 && typeof this.delay === 'number') { + var me = this; + this._timeout = setTimeout(function () { + me.flush(); + }, this.delay); + } +}; - // date from string and format string - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === hooks.ISO_8601) { - configFromISO(config); - return; - } - if (config._f === hooks.RFC_2822) { - configFromRFC2822(config); - return; - } - config._a = []; - getParsingFlags(config).empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } - else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } +/** + * Flush all queued calls + */ +Queue.prototype.flush = function () { + while (this._queue.length > 0) { + var entry = this._queue.shift(); + entry.fn.apply(entry.context || entry.fn, entry.args || []); + } +}; - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } +module.exports = Queue; - // clear _12h flag if hour is <= 12 - if (config._a[HOUR] <= 12 && - getParsingFlags(config).bigHour === true && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } +/***/ }), +/* 44 */ +/***/ (function(module, exports) { - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - configFromArray(config); - checkOverflow(config); +/** + * Expose `Emitter`. + */ + +module.exports = Emitter; + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks[event] = this._callbacks[event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + var self = this; + this._callbacks = this._callbacks || {}; + + function on() { + self.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; } + // specific event + var callbacks = this._callbacks[event]; + if (!callbacks) return this; - function meridiemFixWrap (locale, hour, meridiem) { - var isPm; + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks[event]; + return this; + } - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } } + return this; +}; - // date from string and array of format strings - function configFromStringAndArray(config) { - var tempConfig, - bestMoment, +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ - scoreToBeat, - i, - currentScore; +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks[event]; - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); + return this; +}; - if (!isValid(tempConfig)) { - continue; - } +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks[event] || []; +}; - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ - getParsingFlags(tempConfig).score = currentScore; +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - extend(config, bestMoment || tempConfig); - } +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { - function configFromObject(config) { - if (config._d) { - return; - } +"use strict"; - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - configFromArray(config); - } +var _typeof2 = __webpack_require__(6); - function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } +var _typeof3 = _interopRequireDefault(_typeof2); - return res; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - function prepareConfig (config) { - var input = config._i, - format = config._f; +var util = __webpack_require__(2); +var Component = __webpack_require__(16); +var TimeStep = __webpack_require__(66); +var DateUtil = __webpack_require__(36); +var moment = __webpack_require__(9); - config._locale = config._locale || getLocale(config._l); +/** + * A horizontal time axis + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See TimeAxis.setOptions for the available + * options. + * @constructor TimeAxis + * @extends Component + */ +function TimeAxis(body, options) { + this.dom = { + foreground: null, + lines: [], + majorTexts: [], + minorTexts: [], + redundant: { + lines: [], + majorTexts: [], + minorTexts: [] + } + }; + this.props = { + range: { + start: 0, + end: 0, + minimumStep: 0 + }, + lineTop: 0 + }; - if (input === null || (format === undefined && input === '')) { - return createInvalid({nullInput: true}); - } + this.defaultOptions = { + orientation: { + axis: 'bottom' + }, // axis orientation: 'top' or 'bottom' + showMinorLabels: true, + showMajorLabels: true, + maxMinorChars: 7, + format: TimeStep.FORMAT, + moment: moment, + timeAxis: null + }; + this.options = util.extend({}, this.defaultOptions); - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } + this.body = body; - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isDate(input)) { - config._d = input; - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (format) { - configFromStringAndFormat(config); - } else { - configFromInput(config); - } + // create the HTML DOM + this._create(); - if (!isValid(config)) { - config._d = null; - } + this.setOptions(options); +} - return config; - } +TimeAxis.prototype = new Component(); - function configFromInput(config) { - var input = config._i; - if (isUndefined(input)) { - config._d = new Date(hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (isObject(input)) { - configFromObject(config); - } else if (isNumber(input)) { - // from milliseconds - config._d = new Date(input); +/** + * Set options for the TimeAxis. + * Parameters will be merged in current options. + * @param {Object} options Available options: + * {string} [orientation.axis] + * {boolean} [showMinorLabels] + * {boolean} [showMajorLabels] + */ +TimeAxis.prototype.setOptions = function (options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['showMinorLabels', 'showMajorLabels', 'maxMinorChars', 'hiddenDates', 'timeAxis', 'moment', 'rtl'], this.options, options); + + // deep copy the format options + util.selectiveDeepExtend(['format'], this.options, options); + + if ('orientation' in options) { + if (typeof options.orientation === 'string') { + this.options.orientation.axis = options.orientation; + } else if ((0, _typeof3['default'])(options.orientation) === 'object' && 'axis' in options.orientation) { + this.options.orientation.axis = options.orientation.axis; + } + } + + // apply locale to moment.js + // TODO: not so nice, this is applied globally to moment.js + if ('locale' in options) { + if (typeof moment.locale === 'function') { + // moment.js 2.8.1+ + moment.locale(options.locale); } else { - hooks.createFromInputFallback(config); + moment.lang(options.locale); } + } } +}; - function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - - if (locale === true || locale === false) { - strict = locale; - locale = undefined; - } +/** + * Create the HTML DOM for the TimeAxis + */ +TimeAxis.prototype._create = function () { + this.dom.foreground = document.createElement('div'); + this.dom.background = document.createElement('div'); - if ((isObject(input) && isObjectEmpty(input)) || - (isArray(input) && input.length === 0)) { - input = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; + this.dom.foreground.className = 'vis-time-axis vis-foreground'; + this.dom.background.className = 'vis-time-axis vis-background'; +}; - return createFromConfig(c); +/** + * Destroy the TimeAxis + */ +TimeAxis.prototype.destroy = function () { + // remove from DOM + if (this.dom.foreground.parentNode) { + this.dom.foreground.parentNode.removeChild(this.dom.foreground); } - - function createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); + if (this.dom.background.parentNode) { + this.dom.background.parentNode.removeChild(this.dom.background); } - var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', - function () { - var other = createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return createInvalid(); - } - } - ); - - var prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', - function () { - var other = createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return createInvalid(); - } - } - ); + this.body = null; +}; - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return createLocal(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - return res; +/** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ +TimeAxis.prototype.redraw = function () { + var props = this.props; + var foreground = this.dom.foreground; + var background = this.dom.background; + + // determine the correct parent DOM element (depending on option orientation) + var parent = this.options.orientation.axis == 'top' ? this.body.dom.top : this.body.dom.bottom; + var parentChanged = foreground.parentNode !== parent; + + // calculate character width and height + this._calculateCharSize(); + + // TODO: recalculate sizes only needed when parent is resized or options is changed + var showMinorLabels = this.options.showMinorLabels && this.options.orientation.axis !== 'none'; + var showMajorLabels = this.options.showMajorLabels && this.options.orientation.axis !== 'none'; + + // determine the width and height of the elemens for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; + props.height = props.minorLabelHeight + props.majorLabelHeight; + props.width = foreground.offsetWidth; + + props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - (this.options.orientation.axis == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height); + props.minorLineWidth = 1; // TODO: really calculate width + props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight; + props.majorLineWidth = 1; // TODO: really calculate width + + // take foreground and background offline while updating (is almost twice as fast) + var foregroundNextSibling = foreground.nextSibling; + var backgroundNextSibling = background.nextSibling; + foreground.parentNode && foreground.parentNode.removeChild(foreground); + background.parentNode && background.parentNode.removeChild(background); + + foreground.style.height = this.props.height + 'px'; + + this._repaintLabels(); + + // put DOM online again (at the same place) + if (foregroundNextSibling) { + parent.insertBefore(foreground, foregroundNextSibling); + } else { + parent.appendChild(foreground); } - - // TODO: Use [].sort instead? - function min () { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); + if (backgroundNextSibling) { + this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling); + } else { + this.body.dom.backgroundVertical.appendChild(background); } + return this._isResized() || parentChanged; +}; - function max () { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); - } +/** + * Repaint major and minor text labels and vertical grid lines + * @private + */ +TimeAxis.prototype._repaintLabels = function () { + var orientation = this.options.orientation.axis; + + // calculate range and step (step such that we have space for 7 characters per label) + var start = util.convert(this.body.range.start, 'Number'); + var end = util.convert(this.body.range.end, 'Number'); + var timeLabelsize = this.body.util.toTime((this.props.minorCharWidth || 10) * this.options.maxMinorChars).valueOf(); + var minimumStep = timeLabelsize - DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this.body.range, timeLabelsize); + minimumStep -= this.body.util.toTime(0).valueOf(); + + var step = new TimeStep(new Date(start), new Date(end), minimumStep, this.body.hiddenDates, this.options); + step.setMoment(this.options.moment); + if (this.options.format) { + step.setFormat(this.options.format); + } + if (this.options.timeAxis) { + step.setScale(this.options.timeAxis); + } + this.step = step; + + // Move all DOM elements to a "redundant" list, where they + // can be picked for re-use, and clear the lists with lines and texts. + // At the end of the function _repaintLabels, left over elements will be cleaned up + var dom = this.dom; + dom.redundant.lines = dom.lines; + dom.redundant.majorTexts = dom.majorTexts; + dom.redundant.minorTexts = dom.minorTexts; + dom.lines = []; + dom.majorTexts = []; + dom.minorTexts = []; + + var current; // eslint-disable-line no-unused-vars + var next; + var x; + var xNext; + var isMajor; + var nextIsMajor; // eslint-disable-line no-unused-vars + var showMinorGrid; + var width = 0, + prevWidth; + var line; + var labelMinor; + var xFirstMajorLabel = undefined; + var count = 0; + var MAX = 1000; + var className; + + step.start(); + next = step.getCurrent(); + xNext = this.body.util.toScreen(next); + while (step.hasNext() && count < MAX) { + count++; + + isMajor = step.isMajor(); + className = step.getClassName(); + labelMinor = step.getLabelMinor(); + + current = next; + x = xNext; + + step.next(); + next = step.getCurrent(); + nextIsMajor = step.isMajor(); + xNext = this.body.util.toScreen(next); - var now = function () { - return Date.now ? Date.now() : +(new Date()); - }; + prevWidth = width; + width = xNext - x; + switch (step.scale) { + case 'week': + showMinorGrid = true;break; + default: + showMinorGrid = width >= prevWidth * 0.4;break; // prevent displaying of the 31th of the month on a scale of 5 days + } - var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; + if (this.options.showMinorLabels && showMinorGrid) { + var label = this._repaintMinorText(x, labelMinor, orientation, className); + label.style.width = width + 'px'; // set width to prevent overflow + } - function isDurationValid(m) { - for (var key in m) { - if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) { - return false; - } + if (isMajor && this.options.showMajorLabels) { + if (x > 0) { + if (xFirstMajorLabel == undefined) { + xFirstMajorLabel = x; + } + label = this._repaintMajorText(x, step.getLabelMajor(), orientation, className); } - - var unitHasDecimal = false; - for (var i = 0; i < ordering.length; ++i) { - if (m[ordering[i]]) { - if (unitHasDecimal) { - return false; // only allow non-integers for smallest unit - } - if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { - unitHasDecimal = true; - } - } + line = this._repaintMajorLine(x, width, orientation, className); + } else { + // minor line + if (showMinorGrid) { + line = this._repaintMinorLine(x, width, orientation, className); + } else { + if (line) { + // adjust the width of the previous grid + line.style.width = parseInt(line.style.width) + width + 'px'; + } } - - return true; - } - - function isValid$1() { - return this._isValid; + } } - function createInvalid$1() { - return createDuration(NaN); + if (count === MAX && !warnedForOverflow) { + console.warn('Something is wrong with the Timeline scale. Limited drawing of grid lines to ' + MAX + ' lines.'); + warnedForOverflow = true; } - function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; + // create a major label on the left when needed + if (this.options.showMajorLabels) { + var leftTime = this.body.util.toTime(0), + leftText = step.getLabelMajor(leftTime), + widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; // upper bound estimation - this._isValid = isDurationValid(normalizedInput); - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - - this._data = {}; + if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) { + this._repaintMajorText(0, leftText, orientation, className); + } + } - this._locale = getLocale(); + // Cleanup leftover DOM elements from the redundant list + util.forEach(this.dom.redundant, function (arr) { + while (arr.length) { + var elem = arr.pop(); + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + } + }); +}; - this._bubble(); +/** + * Create a minor label for the axis at position x + * @param {number} x + * @param {string} text + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the HTML element of the created label + * @private + */ +TimeAxis.prototype._repaintMinorText = function (x, text, orientation, className) { + // reuse redundant label + var label = this.dom.redundant.minorTexts.shift(); + + if (!label) { + // create new label + var content = document.createTextNode(''); + label = document.createElement('div'); + label.appendChild(content); + this.dom.foreground.appendChild(label); + } + this.dom.minorTexts.push(label); + label.innerHTML = text; + + label.style.top = orientation == 'top' ? this.props.majorLabelHeight + 'px' : '0'; + + if (this.options.rtl) { + label.style.left = ""; + label.style.right = x + 'px'; + } else { + label.style.left = x + 'px'; } + label.className = 'vis-text vis-minor ' + className; + //label.title = title; // TODO: this is a heavy operation - function isDuration (obj) { - return obj instanceof Duration; - } + return label; +}; - function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } +/** + * Create a Major label for the axis at position x + * @param {number} x + * @param {string} text + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the HTML element of the created label + * @private + */ +TimeAxis.prototype._repaintMajorText = function (x, text, orientation, className) { + // reuse redundant label + var label = this.dom.redundant.majorTexts.shift(); + + if (!label) { + // create label + var content = document.createElement('div'); + label = document.createElement('div'); + label.appendChild(content); + this.dom.foreground.appendChild(label); + } + + label.childNodes[0].innerHTML = text; + label.className = 'vis-text vis-major ' + className; + //label.title = title; // TODO: this is a heavy operation + + label.style.top = orientation == 'top' ? '0' : this.props.minorLabelHeight + 'px'; + if (this.options.rtl) { + label.style.left = ""; + label.style.right = x + 'px'; + } else { + label.style.left = x + 'px'; } - // FORMATTING + this.dom.majorTexts.push(label); + return label; +}; - function offset (token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); - }); +/** + * Create a minor line for the axis at position x + * @param {number} x + * @param {number} width + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the created line + * @private + */ +TimeAxis.prototype._repaintMinorLine = function (x, width, orientation, className) { + // reuse redundant line + var line = this.dom.redundant.lines.shift(); + if (!line) { + // create vertical line + line = document.createElement('div'); + this.dom.background.appendChild(line); + } + this.dom.lines.push(line); + + var props = this.props; + if (orientation == 'top') { + line.style.top = props.majorLabelHeight + 'px'; + } else { + line.style.top = this.body.domProps.top.height + 'px'; } + line.style.height = props.minorLineHeight + 'px'; + if (this.options.rtl) { + line.style.left = ""; + line.style.right = x - props.minorLineWidth / 2 + 'px'; + line.className = 'vis-grid vis-vertical-rtl vis-minor ' + className; + } else { + line.style.left = x - props.minorLineWidth / 2 + 'px'; + line.className = 'vis-grid vis-vertical vis-minor ' + className; + } + line.style.width = width + 'px'; - offset('Z', ':'); - offset('ZZ', ''); - - // PARSING + return line; +}; - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); +/** + * Create a Major line for the axis at position x + * @param {number} x + * @param {number} width + * @param {string} orientation "top" or "bottom" (default) + * @param {string} className + * @return {Element} Returns the created line + * @private + */ +TimeAxis.prototype._repaintMajorLine = function (x, width, orientation, className) { + // reuse redundant line + var line = this.dom.redundant.lines.shift(); + if (!line) { + // create vertical line + line = document.createElement('div'); + this.dom.background.appendChild(line); + } + this.dom.lines.push(line); + + var props = this.props; + if (orientation == 'top') { + line.style.top = '0'; + } else { + line.style.top = this.body.domProps.top.height + 'px'; + } - // HELPERS + if (this.options.rtl) { + line.style.left = ""; + line.style.right = x - props.majorLineWidth / 2 + 'px'; + line.className = 'vis-grid vis-vertical-rtl vis-major ' + className; + } else { + line.style.left = x - props.majorLineWidth / 2 + 'px'; + line.className = 'vis-grid vis-vertical vis-major ' + className; + } - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; + line.style.height = props.majorLineHeight + 'px'; + line.style.width = width + 'px'; - function offsetFromString(matcher, string) { - var matches = (string || '').match(matcher); + return line; +}; - if (matches === null) { - return null; - } +/** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ +TimeAxis.prototype._calculateCharSize = function () { + // Note: We calculate char size with every redraw. Size may change, for + // example when any of the timelines parents had display:none for example. - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); + // determine the char width and height on the minor axis + if (!this.dom.measureCharMinor) { + this.dom.measureCharMinor = document.createElement('DIV'); + this.dom.measureCharMinor.className = 'vis-text vis-minor vis-measure'; + this.dom.measureCharMinor.style.position = 'absolute'; - return minutes === 0 ? - 0 : - parts[0] === '+' ? minutes : -minutes; + this.dom.measureCharMinor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMinor); } + this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight; + this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth; - // Return a moment from input, that is local/utc/zone equivalent to model. - function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - hooks.updateOffset(res, false); - return res; - } else { - return createLocal(input).local(); - } - } + // determine the char width and height on the major axis + if (!this.dom.measureCharMajor) { + this.dom.measureCharMajor = document.createElement('DIV'); + this.dom.measureCharMajor.className = 'vis-text vis-major vis-measure'; + this.dom.measureCharMajor.style.position = 'absolute'; - function getDateOffset (m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; + this.dom.measureCharMajor.appendChild(document.createTextNode('0')); + this.dom.foreground.appendChild(this.dom.measureCharMajor); } + this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight; + this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth; +}; - // HOOKS +var warnedForOverflow = false; - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - hooks.updateOffset = function () {}; +module.exports = TimeAxis; - // MOMENTS +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - function getSetOffset (input, keepLocalTime, keepMinutes) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - if (input === null) { - return this; - } - } else if (Math.abs(input) < 16 && !keepMinutes) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - addSubtract(this, createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } +"use strict"; - function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - this.utcOffset(input, keepLocalTime); +var Hammer = __webpack_require__(10); +var util = __webpack_require__(2); +var Component = __webpack_require__(16); +var moment = __webpack_require__(9); +var locales = __webpack_require__(98); - return this; - } else { - return -this.utcOffset(); - } +/** + * A custom time bar + * @param {{range: Range, dom: Object}} body + * @param {Object} [options] Available parameters: + * {number | string} id + * {string} locales + * {string} locale + * @constructor CustomTime + * @extends Component + */ +function CustomTime(body, options) { + this.body = body; + + // default options + this.defaultOptions = { + moment: moment, + locales: locales, + locale: 'en', + id: undefined, + title: undefined + }; + this.options = util.extend({}, this.defaultOptions); + + if (options && options.time) { + this.customTime = options.time; + } else { + this.customTime = new Date(); } - function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } + this.eventParams = {}; // stores state parameters while dragging the bar - function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; + this.setOptions(options); - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; - } + // create the DOM + this._create(); +} - function setOffsetToParsedOffset () { - if (this._tzm != null) { - this.utcOffset(this._tzm, false, true); - } else if (typeof this._i === 'string') { - var tZone = offsetFromString(matchOffset, this._i); - if (tZone != null) { - this.utcOffset(tZone); - } - else { - this.utcOffset(0, true); - } - } - return this; - } +CustomTime.prototype = new Component(); - function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? createLocal(input).utcOffset() : 0; +/** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {number | string} id + * {string} locales + * {string} locale + */ +CustomTime.prototype.setOptions = function (options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['moment', 'locale', 'locales', 'id'], this.options, options); + } +}; + +/** + * Create the DOM for the custom time + * @private + */ +CustomTime.prototype._create = function () { + var bar = document.createElement('div'); + bar['custom-time'] = this; + bar.className = 'vis-custom-time ' + (this.options.id || ''); + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + this.bar = bar; + + var drag = document.createElement('div'); + drag.style.position = 'relative'; + drag.style.top = '0px'; + drag.style.left = '-10px'; + drag.style.height = '100%'; + drag.style.width = '20px'; - return (this.utcOffset() - input) % 60 === 0; + /** + * + * @param {WheelEvent} e + */ + function onMouseWheel(e) { + this.body.range._onMouseWheel(e); } - function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); + if (drag.addEventListener) { + // IE9, Chrome, Safari, Opera + drag.addEventListener("mousewheel", onMouseWheel.bind(this), false); + // Firefox + drag.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false); + } else { + // IE 6/7/8 + drag.attachEvent("onmousewheel", onMouseWheel.bind(this)); } - function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } + bar.appendChild(drag); + // attach event listeners + this.hammer = new Hammer(drag); + this.hammer.on('panstart', this._onDragStart.bind(this)); + this.hammer.on('panmove', this._onDrag.bind(this)); + this.hammer.on('panend', this._onDragEnd.bind(this)); + this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL }); +}; - var c = {}; +/** + * Destroy the CustomTime bar + */ +CustomTime.prototype.destroy = function () { + this.hide(); - copyConfig(c, this); - c = prepareConfig(c); + this.hammer.destroy(); + this.hammer = null; - if (c._a) { - var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } + this.body = null; +}; - return this._isDSTShifted; +/** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ +CustomTime.prototype.redraw = function () { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); } - function isLocal () { - return this.isValid() ? !this._isUTC : false; - } + var x = this.body.util.toScreen(this.customTime); - function isUtcOffset () { - return this.isValid() ? this._isUTC : false; + var locale = this.options.locales[this.options.locale]; + if (!locale) { + if (!this.warned) { + console.log('WARNING: options.locales[\'' + this.options.locale + '\'] not found. See http://visjs.org/docs/timeline/#Localization'); + this.warned = true; + } + locale = this.options.locales['en']; // fall back on english when not available } - function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; + var title = this.options.title; + // To hide the title completely use empty string ''. + if (title === undefined) { + title = locale.time + ': ' + this.options.moment(this.customTime).format('dddd, MMMM Do YYYY, H:mm:ss'); + title = title.charAt(0).toUpperCase() + title.substring(1); + } else if (typeof title === "function") { + title = title.call(this.customTime); } - // ASP.NET json date format regex - var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; - - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; + this.bar.style.left = x + 'px'; + this.bar.title = title; - function createDuration (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; + return false; +}; - if (isDuration(input)) { - duration = { - ms : input._milliseconds, - d : input._days, - M : input._months - }; - } else if (isNumber(input)) { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : 0, - d : toInt(match[DATE]) * sign, - h : toInt(match[HOUR]) * sign, - m : toInt(match[MINUTE]) * sign, - s : toInt(match[SECOND]) * sign, - ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : parseIso(match[2], sign), - M : parseIso(match[3], sign), - w : parseIso(match[4], sign), - d : parseIso(match[5], sign), - h : parseIso(match[6], sign), - m : parseIso(match[7], sign), - s : parseIso(match[8], sign) - }; - } else if (duration == null) {// checks for null or undefined - duration = {}; - } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); +/** + * Remove the CustomTime from the DOM + */ +CustomTime.prototype.hide = function () { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } +}; - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } +/** + * Set custom time. + * @param {Date | number | string} time + */ +CustomTime.prototype.setCustomTime = function (time) { + this.customTime = util.convert(time, 'Date'); + this.redraw(); +}; - ret = new Duration(duration); +/** + * Retrieve the current custom time. + * @return {Date} customTime + */ +CustomTime.prototype.getCustomTime = function () { + return new Date(this.customTime.valueOf()); +}; - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } +/** + * Set custom title. + * @param {Date | number | string} title + */ +CustomTime.prototype.setCustomTitle = function (title) { + this.options.title = title; +}; - return ret; - } +/** + * Start moving horizontally + * @param {Event} event + * @private + */ +CustomTime.prototype._onDragStart = function (event) { + this.eventParams.dragging = true; + this.eventParams.customTime = this.customTime; - createDuration.fn = Duration.prototype; - createDuration.invalid = createInvalid$1; + event.stopPropagation(); +}; - function parseIso (inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - } +/** + * Perform moving operating. + * @param {Event} event + * @private + */ +CustomTime.prototype._onDrag = function (event) { + if (!this.eventParams.dragging) return; + + var x = this.body.util.toScreen(this.eventParams.customTime) + event.deltaX; + var time = this.body.util.toTime(x); + + this.setCustomTime(time); + + // fire a timechange event + this.body.emitter.emit('timechange', { + id: this.options.id, + time: new Date(this.customTime.valueOf()), + event: event + }); - function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; + event.stopPropagation(); +}; - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } +/** + * Stop moving operating. + * @param {Event} event + * @private + */ +CustomTime.prototype._onDragEnd = function (event) { + if (!this.eventParams.dragging) return; + + // fire a timechanged event + this.body.emitter.emit('timechanged', { + id: this.options.id, + time: new Date(this.customTime.valueOf()), + event: event + }); - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); + event.stopPropagation(); +}; - return res; +/** + * Find a custom time from an event target: + * searches for the attribute 'custom-time' in the event target's element tree + * @param {Event} event + * @return {CustomTime | null} customTime + */ +CustomTime.customTimeFromTarget = function (event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('custom-time')) { + return target['custom-time']; + } + target = target.parentNode; } - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } + return null; +}; - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } +module.exports = CustomTime; - return res; - } +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { - // TODO: remove 'name' arg after deprecation is removed - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + - 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); - tmp = val; val = period; period = tmp; - } +"use strict"; - val = typeof val === 'string' ? +val : val; - dur = createDuration(val, period); - addSubtract(this, dur, direction); - return this; - }; - } - function addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); +Object.defineProperty(exports, "__esModule", { + value: true +}); - if (!mom.isValid()) { - // No op - return; - } +var _classCallCheck2 = __webpack_require__(0); - updateOffset = updateOffset == null ? true : updateOffset; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - hooks.updateOffset(mom, days || months); - } - } +var _createClass2 = __webpack_require__(1); - var add = createAdder(1, 'add'); - var subtract = createAdder(-1, 'subtract'); +var _createClass3 = _interopRequireDefault(_createClass2); - function getCalendarFormat(myMoment, now) { - var diff = myMoment.diff(now, 'days', true); - return diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - function calendar$1 (time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - format = hooks.calendarFormat(this, sod) || 'sameElse'; +var util = __webpack_require__(2); - var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); +var Label = __webpack_require__(117)['default']; +var ComponentUtil = __webpack_require__(48)['default']; +var Box = __webpack_require__(193)['default']; +var Circle = __webpack_require__(200)['default']; +var CircularImage = __webpack_require__(201)['default']; +var Database = __webpack_require__(202)['default']; +var Diamond = __webpack_require__(203)['default']; +var Dot = __webpack_require__(204)['default']; +var Ellipse = __webpack_require__(205)['default']; +var Icon = __webpack_require__(206)['default']; +var Image = __webpack_require__(207)['default']; +var Square = __webpack_require__(208)['default']; +var Hexagon = __webpack_require__(209)['default']; +var Star = __webpack_require__(210)['default']; +var Text = __webpack_require__(211)['default']; +var Triangle = __webpack_require__(212)['default']; +var TriangleDown = __webpack_require__(213)['default']; - return this.format(output || this.localeData().calendar(format, this, createLocal(now))); - } +var _require = __webpack_require__(15), + printStyle = _require.printStyle; - function clone () { - return new Moment(this); - } +/** + * A node. A node can be connected to other nodes via one or multiple edges. + */ - function isAfter (input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - function isBefore (input, units) { - var localInput = isMoment(input) ? input : createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } +var Node = function () { + /** + * + * @param {object} options An object containing options for the node. All + * options are optional, except for the id. + * {number} id Id of the node. Required + * {string} label Text label for the node + * {number} x Horizontal position of the node + * {number} y Vertical position of the node + * {string} shape Node shape + * {string} image An image url + * {string} title A title text, can be HTML + * {anytype} group A group name or number + * + * @param {Object} body Shared state of current network instance + * @param {Network.Images} imagelist A list with images. Only needed when the node has an image + * @param {Groups} grouplist A list with groups. Needed for retrieving group options + * @param {Object} globalOptions Current global node options; these serve as defaults for the node instance + * @param {Object} defaultOptions Global default options for nodes; note that this is also the prototype + * for parameter `globalOptions`. + */ + function Node(options, body, imagelist, grouplist, globalOptions, defaultOptions) { + (0, _classCallCheck3['default'])(this, Node); + + this.options = util.bridgeObject(globalOptions); + this.globalOptions = globalOptions; + this.defaultOptions = defaultOptions; + this.body = body; - function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); - } + this.edges = []; // all edges connected to this node - function isSame (input, units) { - var localInput = isMoment(input) ? input : createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units || 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } - } + // set defaults for the options + this.id = undefined; + this.imagelist = imagelist; + this.grouplist = grouplist; - function isSameOrAfter (input, units) { - return this.isSame(input, units) || this.isAfter(input,units); - } + // state options + this.x = undefined; + this.y = undefined; + this.baseSize = this.options.size; + this.baseFontSize = this.options.font.size; + this.predefinedPosition = false; // used to check if initial fit should just take the range or approximate + this.selected = false; + this.hover = false; - function isSameOrBefore (input, units) { - return this.isSame(input, units) || this.isBefore(input,units); + this.labelModule = new Label(this.body, this.options, false /* Not edge label */); + this.setOptions(options); } - function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - - if (!this.isValid()) { - return NaN; - } + /** + * Attach a edge to the node + * @param {Edge} edge + */ - that = cloneWithOffset(input, this); - if (!that.isValid()) { - return NaN; + (0, _createClass3['default'])(Node, [{ + key: 'attachEdge', + value: function attachEdge(edge) { + if (this.edges.indexOf(edge) === -1) { + this.edges.push(edge); } + } - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); + /** + * Detach a edge from the node + * + * @param {Edge} edge + */ - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - return asFloat ? output : absFloor(output); - } - - function monthDiff (a, b) { - // difference in months - var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); + }, { + key: 'detachEdge', + value: function detachEdge(edge) { + var index = this.edges.indexOf(edge); + if (index != -1) { + this.edges.splice(index, 1); } + } - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; - } - - hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString () { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } + /** + * Set or overwrite options for the node + * + * @param {Object} options an object with options + * @returns {null|boolean} + */ - function toISOString() { - if (!this.isValid()) { - return null; + }, { + key: 'setOptions', + value: function setOptions(options) { + var currentShape = this.options.shape; + if (!options) { + return; // Note that the return value will be 'undefined'! This is OK. } - var m = this.clone().utc(); - if (m.year() < 0 || m.year() > 9999) { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - /** - * Return a human readable representation of a moment that can - * also be evaluated to get a new moment which is the same - * - * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects - */ - function inspect () { - if (!this.isValid()) { - return 'moment.invalid(/* ' + this._i + ' */)'; + // basic options + if (options.id !== undefined) { + this.id = options.id; } - var func = 'moment'; - var zone = ''; - if (!this.isLocal()) { - func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; - zone = 'Z'; + + if (this.id === undefined) { + throw new Error("Node must have an id"); } - var prefix = '[' + func + '("]'; - var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; - var datetime = '-MM-DD[T]HH:mm:ss.SSS'; - var suffix = zone + '[")]'; - return this.format(prefix + year + datetime + suffix); - } + Node.checkMass(options, this.id); - function format (inputString) { - if (!inputString) { - inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; + // set these options locally + // clear x and y positions + if (options.x !== undefined) { + if (options.x === null) { + this.x = undefined;this.predefinedPosition = false; + } else { + this.x = parseInt(options.x);this.predefinedPosition = true; + } } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } - - function from (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - createLocal(time).isValid())) { - return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); + if (options.y !== undefined) { + if (options.y === null) { + this.y = undefined;this.predefinedPosition = false; + } else { + this.y = parseInt(options.y);this.predefinedPosition = true; + } } - } - - function fromNow (withoutSuffix) { - return this.from(createLocal(), withoutSuffix); - } - - function to (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - createLocal(time).isValid())) { - return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); + if (options.size !== undefined) { + this.baseSize = options.size; + } + if (options.value !== undefined) { + options.value = parseFloat(options.value); } - } - function toNow (withoutSuffix) { - return this.to(createLocal(), withoutSuffix); - } + // this transforms all shorthands into fully defined options + Node.parseOptions(this.options, options, true, this.globalOptions, this.grouplist); - // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - function locale (key) { - var newLocaleData; + var pile = [options, this.options, this.defaultOptions]; + this.chooser = ComponentUtil.choosify('node', pile); - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } - } + this._load_images(); + this.updateLabelModule(options); + this.updateShape(currentShape); - var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } - ); + return options.hidden !== undefined || options.physics !== undefined; + } - function localeData () { - return this._locale; - } + /** + * Load the images from the options, for the nodes that need them. + * + * TODO: The imageObj members should be moved to CircularImageBase. + * It's the only place where they are required. + * + * @private + */ - function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); + }, { + key: '_load_images', + value: function _load_images() { + // Don't bother loading for nodes without images + if (this.options.shape !== 'circularImage' && this.options.shape !== 'image') { + return; } - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); + if (this.options.image === undefined) { + throw new Error("Option image must be defined for node type '" + this.options.shape + "'"); } - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); + if (this.imagelist === undefined) { + throw new Error("Internal Error: No images provided"); } - return this; - } + if (typeof this.options.image === 'string') { + this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); + } else { + if (this.options.image.unselected === undefined) { + throw new Error("No unselected image provided"); + } - function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } + this.imageObj = this.imagelist.load(this.options.image.unselected, this.options.brokenImage, this.id); - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; + if (this.options.image.selected !== undefined) { + this.imageObjAlt = this.imagelist.load(this.options.image.selected, this.options.brokenImage, this.id); + } else { + this.imageObjAlt = undefined; + } } + } - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); - } - - function valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); - } - - function unix () { - return Math.floor(this.valueOf() / 1000); - } + /** + * Copy group option values into the node options. + * + * The group options override the global node options, so the copy of group options + * must happen *after* the global node options have been set. + * + * This method must also be called also if the global node options have changed and the group options did not. + * + * @param {Object} parentOptions + * @param {Object} newOptions new values for the options, currently only passed in for check + * @param {Object} groupList + */ - function toDate () { - return new Date(this.valueOf()); - } + }, { + key: 'getFormattingValues', - function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; - } - function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() + /** + * + * @returns {{color: *, borderWidth: *, borderColor: *, size: *, borderDashes: (boolean|Array|allOptions.nodes.shapeProperties.borderDashes|{boolean, array}), borderRadius: (number|allOptions.nodes.shapeProperties.borderRadius|{number}|Array), shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *}} + */ + value: function getFormattingValues() { + var values = { + color: this.options.color.background, + borderWidth: this.options.borderWidth, + borderColor: this.options.color.border, + size: this.options.size, + borderDashes: this.options.shapeProperties.borderDashes, + borderRadius: this.options.shapeProperties.borderRadius, + shadow: this.options.shadow.enabled, + shadowColor: this.options.shadow.color, + shadowSize: this.options.shadow.size, + shadowX: this.options.shadow.x, + shadowY: this.options.shadow.y }; - } + if (this.selected || this.hover) { + if (this.chooser === true) { + if (this.selected) { + values.borderWidth *= 2; + values.color = this.options.color.highlight.background; + values.borderColor = this.options.color.highlight.border; + values.shadow = this.options.shadow.enabled; + } else if (this.hover) { + values.color = this.options.color.hover.background; + values.borderColor = this.options.color.hover.border; + values.shadow = this.options.shadow.enabled; + } + } else if (typeof this.chooser === 'function') { + this.chooser(values, this.options.id, this.selected, this.hover); + if (values.shadow === false) { + if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) { + values.shadow = true; + } + } + } + } else { + values.shadow = this.options.shadow.enabled; + } + return values; + } - function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } + /** + * + * @param {Object} options + */ - function isValid$2 () { - return isValid(this); - } + }, { + key: 'updateLabelModule', + value: function updateLabelModule(options) { + if (this.options.label === undefined || this.options.label === null) { + this.options.label = ''; + } + + Node.updateGroupOptions(this.options, options, this.grouplist); + + // + // Note:The prototype chain for this.options is: + // + // this.options -> NodesHandler.options -> NodesHandler.defaultOptions + // (also: this.globalOptions) + // + // Note that the prototypes are mentioned explicitly in the pile list below; + // WE DON'T WANT THE ORDER OF THE PROTOTYPES!!!! At least, not for font handling of labels. + // This is a good indication that the prototype usage of options is deficient. + // + var currentGroup = this.grouplist.get(this.options.group, false); + var pile = [options, // new options + this.options, // current node options, see comment above for prototype + currentGroup, // group options, if any + this.globalOptions, // Currently set global node options + this.defaultOptions // Default global node options + ]; + this.labelModule.update(this.options, pile); - function parsingFlags () { - return extend({}, getParsingFlags(this)); - } + if (this.labelModule.baseSize !== undefined) { + this.baseFontSize = this.labelModule.baseSize; + } + } - function invalidAt () { - return getParsingFlags(this).overflow; - } + /** + * + * @param {string} currentShape + */ - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; - } + }, { + key: 'updateShape', + value: function updateShape(currentShape) { + if (currentShape === this.options.shape && this.shape) { + this.shape.setOptions(this.options, this.imageObj, this.imageObjAlt); + } else { + // choose draw method depending on the shape + switch (this.options.shape) { + case 'box': + this.shape = new Box(this.options, this.body, this.labelModule); + break; + case 'circle': + this.shape = new Circle(this.options, this.body, this.labelModule); + break; + case 'circularImage': + this.shape = new CircularImage(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); + break; + case 'database': + this.shape = new Database(this.options, this.body, this.labelModule); + break; + case 'diamond': + this.shape = new Diamond(this.options, this.body, this.labelModule); + break; + case 'dot': + this.shape = new Dot(this.options, this.body, this.labelModule); + break; + case 'ellipse': + this.shape = new Ellipse(this.options, this.body, this.labelModule); + break; + case 'icon': + this.shape = new Icon(this.options, this.body, this.labelModule); + break; + case 'image': + this.shape = new Image(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); + break; + case 'square': + this.shape = new Square(this.options, this.body, this.labelModule); + break; + case 'hexagon': + this.shape = new Hexagon(this.options, this.body, this.labelModule); + break; + case 'star': + this.shape = new Star(this.options, this.body, this.labelModule); + break; + case 'text': + this.shape = new Text(this.options, this.body, this.labelModule); + break; + case 'triangle': + this.shape = new Triangle(this.options, this.body, this.labelModule); + break; + case 'triangleDown': + this.shape = new TriangleDown(this.options, this.body, this.labelModule); + break; + default: + this.shape = new Ellipse(this.options, this.body, this.labelModule); + break; + } + } + this.needsRefresh(); + } - // FORMATTING + /** + * select this node + */ - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); + }, { + key: 'select', + value: function select() { + this.selected = true; + this.needsRefresh(); + } - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); + /** + * unselect this node + */ - function addWeekYearFormatToken (token, getter) { - addFormatToken(0, [token, token.length], 0, getter); - } + }, { + key: 'unselect', + value: function unselect() { + this.selected = false; + this.needsRefresh(); + } - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); + /** + * Reset the calculated size of the node, forces it to recalculate its size + */ - // ALIASES + }, { + key: 'needsRefresh', + value: function needsRefresh() { + this.shape.refreshNeeded = true; + } - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); + /** + * get the title of this node. + * @return {string} title The title of the node, or undefined when no title + * has been set. + */ - // PRIORITY + }, { + key: 'getTitle', + value: function getTitle() { + return this.options.title; + } - addUnitPriority('weekYear', 1); - addUnitPriority('isoWeekYear', 1); + /** + * Calculate the distance to the border of the Node + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle Angle in radians + * @returns {number} distance Distance to the border in pixels + */ + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this.shape.distanceToBorder(ctx, angle); + } - // PARSING + /** + * Check if this node has a fixed x and y position + * @return {boolean} true if fixed, false if not + */ - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); + }, { + key: 'isFixed', + value: function isFixed() { + return this.options.fixed.x && this.options.fixed.y; + } - addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); - }); + /** + * check if this node is selecte + * @return {boolean} selected True if node is selected, else false + */ - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = hooks.parseTwoDigitYear(input); - }); + }, { + key: 'isSelected', + value: function isSelected() { + return this.selected; + } - // MOMENTS + /** + * Retrieve the value of the node. Can be undefined + * @return {number} value + */ - function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); - } + }, { + key: 'getValue', + value: function getValue() { + return this.options.value; + } - function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); - } + /** + * Get the current dimensions of the label + * + * @return {rect} + */ - function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); - } + }, { + key: 'getLabelSize', + value: function getLabelSize() { + return this.labelModule.size(); + } - function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } + /** + * Adjust the value range of the node. The node will adjust it's size + * based on its value. + * @param {number} min + * @param {number} max + * @param {number} total + */ - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; + }, { + key: 'setValueRange', + value: function setValueRange(min, max, total) { + if (this.options.value !== undefined) { + var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); + var sizeDiff = this.options.scaling.max - this.options.scaling.min; + if (this.options.scaling.label.enabled === true) { + var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; + this.options.font.size = this.options.scaling.label.min + scale * fontDiff; + } + this.options.size = this.options.scaling.min + scale * sizeDiff; } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); + this.options.size = this.baseSize; + this.options.font.size = this.baseFontSize; } - } - - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; - } - - // FORMATTING + this.updateLabelModule(); + } - addFormatToken('Q', 0, 'Qo', 'quarter'); + /** + * Draw this node in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ - // ALIASES + }, { + key: 'draw', + value: function draw(ctx) { + var values = this.getFormattingValues(); + this.shape.draw(ctx, this.x, this.y, this.selected, this.hover, values); + } - addUnitAlias('quarter', 'Q'); + /** + * Update the bounding box of the shape + * @param {CanvasRenderingContext2D} ctx + */ - // PRIORITY + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(ctx) { + this.shape.updateBoundingBox(this.x, this.y, ctx); + } - addUnitPriority('quarter', 7); + /** + * Recalculate the size of this node in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ - // PARSING + }, { + key: 'resize', + value: function resize(ctx) { + var values = this.getFormattingValues(); + this.shape.resize(ctx, this.selected, this.hover, values); + } - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); + /** + * Determine all visual elements of this node instance, in which the given + * point falls within the bounding shape. + * + * @param {point} point + * @returns {Array.} list with the items which are on the point + */ - // MOMENTS + }, { + key: 'getItemsOnPoint', + value: function getItemsOnPoint(point) { + var ret = []; - function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - } + if (this.labelModule.visible()) { + if (ComponentUtil.pointInRect(this.labelModule.getSize(), point)) { + ret.push({ nodeId: this.id, labelId: 0 }); + } + } - // FORMATTING + if (ComponentUtil.pointInRect(this.shape.boundingBox, point)) { + ret.push({ nodeId: this.id }); + } - addFormatToken('D', ['DD', 2], 'Do', 'date'); + return ret; + } - // ALIASES + /** + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top, right, bottom + * @return {boolean} True if location is located on node + */ - addUnitAlias('date', 'D'); + }, { + key: 'isOverlappingWith', + value: function isOverlappingWith(obj) { + return this.shape.left < obj.right && this.shape.left + this.shape.width > obj.left && this.shape.top < obj.bottom && this.shape.top + this.shape.height > obj.top; + } - // PRIOROITY - addUnitPriority('date', 9); + /** + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top, right, bottom + * @return {boolean} True if location is located on node + */ - // PARSING + }, { + key: 'isBoundingBoxOverlappingWith', + value: function isBoundingBoxOverlappingWith(obj) { + return this.shape.boundingBox.left < obj.right && this.shape.boundingBox.right > obj.left && this.shape.boundingBox.top < obj.bottom && this.shape.boundingBox.bottom > obj.top; + } - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - // TODO: Remove "ordinalParse" fallback in next major release. - return isStrict ? - (locale._dayOfMonthOrdinalParse || locale._ordinalParse) : - locale._dayOfMonthOrdinalParseLenient; - }); + /** + * Check valid values for mass + * + * The mass may not be negative or zero. If it is, reset to 1 + * + * @param {object} options + * @param {Node.id} id + * @static + */ - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); - }); + }], [{ + key: 'updateGroupOptions', + value: function updateGroupOptions(parentOptions, newOptions, groupList) { + if (groupList === undefined) return; // No groups, nothing to do - // MOMENTS + var group = parentOptions.group; - var getSetDayOfMonth = makeGetSet('Date', true); + // paranoia: the selected group is already merged into node options, check. + if (newOptions !== undefined && newOptions.group !== undefined && group !== newOptions.group) { + throw new Error("updateGroupOptions: group values in options don't match."); + } - // FORMATTING + var hasGroup = typeof group === 'number' || typeof group === 'string' && group != ''; + if (!hasGroup) return; // current node has no group, no need to merge - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); + var groupObj = groupList.get(group); - // ALIASES + // Skip merging of group font options into parent; these are required to be distinct for labels + // TODO: It might not be a good idea either to merge the rest of the options, investigate this. + util.selectiveNotDeepExtend(['font'], parentOptions, groupObj); - addUnitAlias('dayOfYear', 'DDD'); + // the color object needs to be completely defined. + // Since groups can partially overwrite the colors, we parse it again, just in case. + parentOptions.color = util.parseColor(parentOptions.color); + } - // PRIORITY - addUnitPriority('dayOfYear', 4); + /** + * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. + * Static so it can also be used by the handler. + * + * @param {Object} parentOptions + * @param {Object} newOptions + * @param {boolean} [allowDeletion=false] + * @param {Object} [globalOptions={}] + * @param {Object} [groupList] + * @static + */ - // PARSING + }, { + key: 'parseOptions', + value: function parseOptions(parentOptions, newOptions) { + var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var groupList = arguments[4]; - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); - // HELPERS + var fields = ['color', 'fixed', 'shadow']; + util.selectiveNotDeepExtend(fields, parentOptions, newOptions, allowDeletion); - // MOMENTS + Node.checkMass(newOptions); - function getSetDayOfYear (input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); - } + // merge the shadow options into the parent. + util.mergeOptions(parentOptions, newOptions, 'shadow', globalOptions); - // FORMATTING + // individual shape newOptions + if (newOptions.color !== undefined && newOptions.color !== null) { + var parsedColor = util.parseColor(newOptions.color); + util.fillIfDefined(parentOptions.color, parsedColor); + } else if (allowDeletion === true && newOptions.color === null) { + parentOptions.color = util.bridgeObject(globalOptions.color); // set the object back to the global options + } - addFormatToken('m', ['mm', 2], 0, 'minute'); + // handle the fixed options + if (newOptions.fixed !== undefined && newOptions.fixed !== null) { + if (typeof newOptions.fixed === 'boolean') { + parentOptions.fixed.x = newOptions.fixed; + parentOptions.fixed.y = newOptions.fixed; + } else { + if (newOptions.fixed.x !== undefined && typeof newOptions.fixed.x === 'boolean') { + parentOptions.fixed.x = newOptions.fixed.x; + } + if (newOptions.fixed.y !== undefined && typeof newOptions.fixed.y === 'boolean') { + parentOptions.fixed.y = newOptions.fixed.y; + } + } + } - // ALIASES + if (allowDeletion === true && newOptions.font === null) { + parentOptions.font = util.bridgeObject(globalOptions.font); // set the object back to the global options + } - addUnitAlias('minute', 'm'); + Node.updateGroupOptions(parentOptions, newOptions, groupList); - // PRIORITY + // handle the scaling options, specifically the label part + if (newOptions.scaling !== undefined) { + util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', globalOptions.scaling); + } + } + }, { + key: 'checkMass', + value: function checkMass(options, id) { + if (options.mass !== undefined && options.mass <= 0) { + var strId = ''; + if (id !== undefined) { + strId = ' in node id: ' + id; + } + console.log('%cNegative or zero mass disallowed' + strId + ', setting mass to 1.', printStyle); + options.mass = 1; + } + } + }]); + return Node; +}(); - addUnitPriority('minute', 14); +exports['default'] = Node; - // PARSING +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); +"use strict"; - // MOMENTS - var getSetMinute = makeGetSet('Minutes', false); +Object.defineProperty(exports, "__esModule", { + value: true +}); - // FORMATTING +var _typeof2 = __webpack_require__(6); - addFormatToken('s', ['ss', 2], 0, 'second'); +var _typeof3 = _interopRequireDefault(_typeof2); - // ALIASES +var _classCallCheck2 = __webpack_require__(0); - addUnitAlias('second', 's'); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // PRIORITY +var _createClass2 = __webpack_require__(1); - addUnitPriority('second', 15); +var _createClass3 = _interopRequireDefault(_createClass2); - // PARSING +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); +/** + * Definitions for param's in jsdoc. + * These are more or less global within Network. Putting them here until I can figure out + * where to really put them + * + * @typedef {string|number} Id + * @typedef {Id} NodeId + * @typedef {Id} EdgeId + * @typedef {Id} LabelId + * + * @typedef {{x: number, y: number}} point + * @typedef {{left: number, top: number, width: number, height: number}} rect + * @typedef {{x: number, y:number, angle: number}} rotationPoint + * - point to rotate around and the angle in radians to rotate. angle == 0 means no rotation + * @typedef {{nodeId:NodeId}} nodeClickItem + * @typedef {{nodeId:NodeId, labelId:LabelId}} nodeLabelClickItem + * @typedef {{edgeId:EdgeId}} edgeClickItem + * @typedef {{edgeId:EdgeId, labelId:LabelId}} edgeLabelClickItem + */ + +var util = __webpack_require__(2); - // MOMENTS +/** + * Helper functions for components + * @class + */ - var getSetSecond = makeGetSet('Seconds', false); +var ComponentUtil = function () { + function ComponentUtil() { + (0, _classCallCheck3['default'])(this, ComponentUtil); + } - // FORMATTING + (0, _createClass3['default'])(ComponentUtil, null, [{ + key: 'choosify', - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); + /** + * Determine values to use for (sub)options of 'chosen'. + * + * This option is either a boolean or an object whose values should be examined further. + * The relevant structures are: + * + * - chosen: + * - chosen: { subOption: } + * + * Where subOption is 'node', 'edge' or 'label'. + * + * The intention of this method appears to be to set a specific priority to the options; + * Since most properties are either bridged or merged into the local options objects, there + * is not much point in handling them separately. + * TODO: examine if 'most' in previous sentence can be replaced with 'all'. In that case, we + * should be able to get rid of this method. + * + * @param {string} subOption option within object 'chosen' to consider; either 'node', 'edge' or 'label' + * @param {Object} pile array of options objects to consider + * + * @return {boolean|function} value for passed subOption of 'chosen' to use + */ + value: function choosify(subOption, pile) { + // allowed values for subOption + var allowed = ['node', 'edge', 'label']; + var value = true; - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); + var chosen = util.topMost(pile, 'chosen'); + if (typeof chosen === 'boolean') { + value = chosen; + } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') { + if (allowed.indexOf(subOption) === -1) { + throw new Error('choosify: subOption \'' + subOption + '\' should be one of ' + "'" + allowed.join("', '") + "'"); + } - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); + var chosenEdge = util.topMost(pile, ['chosen', subOption]); + if (typeof chosenEdge === 'boolean' || typeof chosenEdge === 'function') { + value = chosenEdge; + } + } + return value; + } - // ALIASES + /** + * Check if the point falls within the given rectangle. + * + * @param {rect} rect + * @param {point} point + * @param {rotationPoint} [rotationPoint] if specified, the rotation that applies to the rectangle. + * @returns {boolean} true if point within rectangle, false otherwise + * @static + */ - addUnitAlias('millisecond', 'ms'); + }, { + key: 'pointInRect', + value: function pointInRect(rect, point, rotationPoint) { + if (rect.width <= 0 || rect.height <= 0) { + return false; // early out + } - // PRIORITY + if (rotationPoint !== undefined) { + // Rotate the point the same amount as the rectangle + var tmp = { + x: point.x - rotationPoint.x, + y: point.y - rotationPoint.y + }; - addUnitPriority('millisecond', 16); + if (rotationPoint.angle !== 0) { + // In order to get the coordinates the same, you need to + // rotate in the reverse direction + var angle = -rotationPoint.angle; - // PARSING + var tmp2 = { + x: Math.cos(angle) * tmp.x - Math.sin(angle) * tmp.y, + y: Math.sin(angle) * tmp.x + Math.cos(angle) * tmp.y + }; + point = tmp2; + } else { + point = tmp; + } - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); + // Note that if a rotation is specified, the rectangle coordinates + // are **not* the full canvas coordinates. They are relative to the + // rotationPoint. Hence, the point coordinates need not be translated + // back in this case. + } - var token; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } + var right = rect.x + rect.width; + var bottom = rect.y + rect.width; - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } + return rect.left < point.x && right > point.x && rect.top < point.y && bottom > point.y; + } - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } - // MOMENTS + /** + * Check if given value is acceptable as a label text. + * + * @param {*} text value to check; can be anything at this point + * @returns {boolean} true if valid label value, false otherwise + */ - var getSetMillisecond = makeGetSet('Milliseconds', false); + }, { + key: 'isValidLabel', + value: function isValidLabel(text) { + // Note that this is quite strict: types that *might* be converted to string are disallowed + return typeof text === 'string' && text !== ''; + } + }]); + return ComponentUtil; +}(); - // FORMATTING +exports['default'] = ComponentUtil; - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { - // MOMENTS +__webpack_require__(125); +var global = __webpack_require__(18); +var hide = __webpack_require__(26); +var Iterators = __webpack_require__(31); +var TO_STRING_TAG = __webpack_require__(13)('toStringTag'); - function getZoneAbbr () { - return this._isUTC ? 'UTC' : ''; - } +var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' + + 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' + + 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' + + 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' + + 'TextTrackList,TouchList').split(','); - function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } +for (var i = 0; i < DOMIterables.length; i++) { + var NAME = DOMIterables[i]; + var Collection = global[NAME]; + var proto = Collection && Collection.prototype; + if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; +} - var proto = Moment.prototype; - - proto.add = add; - proto.calendar = calendar$1; - proto.clone = clone; - proto.diff = diff; - proto.endOf = endOf; - proto.format = format; - proto.from = from; - proto.fromNow = fromNow; - proto.to = to; - proto.toNow = toNow; - proto.get = stringGet; - proto.invalidAt = invalidAt; - proto.isAfter = isAfter; - proto.isBefore = isBefore; - proto.isBetween = isBetween; - proto.isSame = isSame; - proto.isSameOrAfter = isSameOrAfter; - proto.isSameOrBefore = isSameOrBefore; - proto.isValid = isValid$2; - proto.lang = lang; - proto.locale = locale; - proto.localeData = localeData; - proto.max = prototypeMax; - proto.min = prototypeMin; - proto.parsingFlags = parsingFlags; - proto.set = stringSet; - proto.startOf = startOf; - proto.subtract = subtract; - proto.toArray = toArray; - proto.toObject = toObject; - proto.toDate = toDate; - proto.toISOString = toISOString; - proto.inspect = inspect; - proto.toJSON = toJSON; - proto.toString = toString; - proto.unix = unix; - proto.valueOf = valueOf; - proto.creationData = creationData; - // Year - proto.year = getSetYear; - proto.isLeapYear = getIsLeapYear; - - // Week Year - proto.weekYear = getSetWeekYear; - proto.isoWeekYear = getSetISOWeekYear; - - // Quarter - proto.quarter = proto.quarters = getSetQuarter; +/***/ }), +/* 50 */ +/***/ (function(module, exports) { - // Month - proto.month = getSetMonth; - proto.daysInMonth = getDaysInMonth; - - // Week - proto.week = proto.weeks = getSetWeek; - proto.isoWeek = proto.isoWeeks = getSetISOWeek; - proto.weeksInYear = getWeeksInYear; - proto.isoWeeksInYear = getISOWeeksInYear; - - // Day - proto.date = getSetDayOfMonth; - proto.day = proto.days = getSetDayOfWeek; - proto.weekday = getSetLocaleDayOfWeek; - proto.isoWeekday = getSetISODayOfWeek; - proto.dayOfYear = getSetDayOfYear; - - // Hour - proto.hour = proto.hours = getSetHour; - - // Minute - proto.minute = proto.minutes = getSetMinute; - - // Second - proto.second = proto.seconds = getSetSecond; - - // Millisecond - proto.millisecond = proto.milliseconds = getSetMillisecond; - - // Offset - proto.utcOffset = getSetOffset; - proto.utc = setOffsetToUTC; - proto.local = setOffsetToLocal; - proto.parseZone = setOffsetToParsedOffset; - proto.hasAlignedHourOffset = hasAlignedHourOffset; - proto.isDST = isDaylightSavingTime; - proto.isLocal = isLocal; - proto.isUtcOffset = isUtcOffset; - proto.isUtc = isUtc; - proto.isUTC = isUtc; - - // Timezone - proto.zoneAbbr = getZoneAbbr; - proto.zoneName = getZoneName; - - // Deprecations - proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); - proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); - proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); - proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); - proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); - - function createUnix (input) { - return createLocal(input * 1000); - } - - function createInZone () { - return createLocal.apply(null, arguments).parseZone(); - } - - function preParsePostFormat (string) { - return string; - } - - var proto$1 = Locale.prototype; - - proto$1.calendar = calendar; - proto$1.longDateFormat = longDateFormat; - proto$1.invalidDate = invalidDate; - proto$1.ordinal = ordinal; - proto$1.preparse = preParsePostFormat; - proto$1.postformat = preParsePostFormat; - proto$1.relativeTime = relativeTime; - proto$1.pastFuture = pastFuture; - proto$1.set = set; - - // Month - proto$1.months = localeMonths; - proto$1.monthsShort = localeMonthsShort; - proto$1.monthsParse = localeMonthsParse; - proto$1.monthsRegex = monthsRegex; - proto$1.monthsShortRegex = monthsShortRegex; +var toString = {}.toString; - // Week - proto$1.week = localeWeek; - proto$1.firstDayOfYear = localeFirstDayOfYear; - proto$1.firstDayOfWeek = localeFirstDayOfWeek; +module.exports = function (it) { + return toString.call(it).slice(8, -1); +}; - // Day of Week - proto$1.weekdays = localeWeekdays; - proto$1.weekdaysMin = localeWeekdaysMin; - proto$1.weekdaysShort = localeWeekdaysShort; - proto$1.weekdaysParse = localeWeekdaysParse; - proto$1.weekdaysRegex = weekdaysRegex; - proto$1.weekdaysShortRegex = weekdaysShortRegex; - proto$1.weekdaysMinRegex = weekdaysMinRegex; +/***/ }), +/* 51 */ +/***/ (function(module, exports) { - // Hours - proto$1.isPM = localeIsPM; - proto$1.meridiem = localeMeridiem; +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; - function get$1 (format, index, field, setter) { - var locale = getLocale(); - var utc = createUTC().set(setter, index); - return locale[field](utc, format); - } - function listMonthsImpl (format, index, field) { - if (isNumber(format)) { - index = format; - format = undefined; - } +/***/ }), +/* 52 */ +/***/ (function(module, exports) { - format = format || ''; +module.exports = true; - if (index != null) { - return get$1(format, index, field, 'month'); - } - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = get$1(format, i, field, 'month'); - } - return out; - } +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { - // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - function listWeekdaysImpl (localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (isNumber(format)) { - index = format; - format = undefined; - } +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = __webpack_require__(32); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function (it, S) { + if (!isObject(it)) return it; + var fn, val; + if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; + if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; + throw TypeError("Can't convert object to primitive value"); +}; - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - if (isNumber(format)) { - index = format; - format = undefined; - } +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { - format = format || ''; - } +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = __webpack_require__(27); +var dPs = __webpack_require__(130); +var enumBugKeys = __webpack_require__(58); +var IE_PROTO = __webpack_require__(56)('IE_PROTO'); +var Empty = function () { /* empty */ }; +var PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function () { + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(82)('iframe'); + var i = enumBugKeys.length; + var lt = '<'; + var gt = '>'; + var iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(134).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; + +module.exports = Object.create || function create(O, Properties) { + var result; + if (O !== null) { + Empty[PROTOTYPE] = anObject(O); + result = new Empty(); + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; - var locale = getLocale(), - shift = localeSorted ? locale._week.dow : 0; - if (index != null) { - return get$1(format, (index + shift) % 7, field, 'day'); - } +/***/ }), +/* 55 */ +/***/ (function(module, exports) { - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = get$1(format, (i + shift) % 7, field, 'day'); - } - return out; - } +// 7.1.4 ToInteger +var ceil = Math.ceil; +var floor = Math.floor; +module.exports = function (it) { + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; - function listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); - } - function listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { - function listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } +var shared = __webpack_require__(57)('keys'); +var uid = __webpack_require__(40); +module.exports = function (key) { + return shared[key] || (shared[key] = uid(key)); +}; - function listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - function listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { - getSetGlobalLocale('en', { - dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); +var global = __webpack_require__(18); +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || (global[SHARED] = {}); +module.exports = function (key) { + return store[key] || (store[key] = {}); +}; - // Side effect imports - hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); - hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); - var mathAbs = Math.abs; +/***/ }), +/* 58 */ +/***/ (function(module, exports) { - function abs () { - var data = this._data; +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { - return this; - } +var def = __webpack_require__(20).f; +var has = __webpack_require__(22); +var TAG = __webpack_require__(13)('toStringTag'); - function addSubtract$1 (duration, input, value, direction) { - var other = createDuration(input, value); +module.exports = function (it, tag, stat) { + if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); +}; - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - return duration._bubble(); - } +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { - // supports only 2.0-style add(1, 's') or add(duration) - function add$1 (input, value) { - return addSubtract$1(this, input, value, 1); - } +"use strict"; + +var $at = __webpack_require__(135)(true); + +// 21.1.3.27 String.prototype[@@iterator]() +__webpack_require__(79)(String, 'String', function (iterated) { + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function () { + var O = this._t; + var index = this._i; + var point; + if (index >= O.length) return { value: undefined, done: true }; + point = $at(O, index); + this._i += point.length; + return { value: point, done: false }; +}); - // supports only 2.0-style subtract(1, 's') or subtract(duration) - function subtract$1 (input, value) { - return addSubtract$1(this, input, value, -1); - } - function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { - function bubble () { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; +exports.f = __webpack_require__(13); - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; +var global = __webpack_require__(18); +var core = __webpack_require__(7); +var LIBRARY = __webpack_require__(52); +var wksExt = __webpack_require__(61); +var defineProperty = __webpack_require__(20).f; +module.exports = function (name) { + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); +}; - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - hours = absFloor(minutes / 60); - data.hours = hours % 24; +/***/ }), +/* 63 */ +/***/ (function(module, exports) { - days += absFloor(hours / 24); +exports.f = Object.getOwnPropertySymbols; - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { - data.days = days; - data.months = months; - data.years = years; +"use strict"; - return this; - } - function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; - } +var _keys = __webpack_require__(8); - function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; - } +var _keys2 = _interopRequireDefault(_keys); - function as (units) { - if (!this.isValid()) { - return NaN; - } - var days; - var months; - var milliseconds = this._milliseconds; +var _stringify = __webpack_require__(19); - units = normalizeUnits(units); +var _stringify2 = _interopRequireDefault(_stringify); - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } - } +var _typeof2 = __webpack_require__(6); - // TODO: Use this.as('ms')? - function valueOf$1 () { - if (!this.isValid()) { - return NaN; - } - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); - } +var _typeof3 = _interopRequireDefault(_typeof2); - function makeAs (alias) { - return function () { - return this.as(alias); - }; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var asMilliseconds = makeAs('ms'); - var asSeconds = makeAs('s'); - var asMinutes = makeAs('m'); - var asHours = makeAs('h'); - var asDays = makeAs('d'); - var asWeeks = makeAs('w'); - var asMonths = makeAs('M'); - var asYears = makeAs('y'); +var util = __webpack_require__(2); +var moment = __webpack_require__(9); +var Component = __webpack_require__(16); +var DateUtil = __webpack_require__(36); - function get$2 (units) { - units = normalizeUnits(units); - return this.isValid() ? this[units + 's']() : NaN; - } +/** + * A Range controls a numeric range with a start and end value. + * The Range adjusts the range based on mouse events or programmatic changes, + * and triggers events when the range is changing or has been changed. + * @param {{dom: Object, domProps: Object, emitter: Emitter}} body + * @param {Object} [options] See description at Range.setOptions + * @constructor Range + * @extends Component + */ +function Range(body, options) { + var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0); + var start = now.clone().add(-3, 'days').valueOf(); + var end = now.clone().add(3, 'days').valueOf(); + this.millisecondsPerPixelCache = undefined; + + if (options === undefined) { + this.start = start; + this.end = end; + } else { + this.start = options.start || start; + this.end = options.end || end; + } + + this.rolling = false; + + this.body = body; + this.deltaDifference = 0; + this.scaleOffset = 0; + this.startToFront = false; + this.endToFront = true; + + // default options + this.defaultOptions = { + rtl: false, + start: null, + end: null, + moment: moment, + direction: 'horizontal', // 'horizontal' or 'vertical' + moveable: true, + zoomable: true, + min: null, + max: null, + zoomMin: 10, // milliseconds + zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000, // milliseconds + rollingMode: { + follow: false, + offset: 0.5 + } + }; + this.options = util.extend({}, this.defaultOptions); + this.props = { + touch: {} + }; + this.animationTimer = null; - function makeGetter(name) { - return function () { - return this.isValid() ? this._data[name] : NaN; - }; - } + // drag listeners for dragging + this.body.emitter.on('panstart', this._onDragStart.bind(this)); + this.body.emitter.on('panmove', this._onDrag.bind(this)); + this.body.emitter.on('panend', this._onDragEnd.bind(this)); - var milliseconds = makeGetter('milliseconds'); - var seconds = makeGetter('seconds'); - var minutes = makeGetter('minutes'); - var hours = makeGetter('hours'); - var days = makeGetter('days'); - var months = makeGetter('months'); - var years = makeGetter('years'); + // mouse wheel for zooming + this.body.emitter.on('mousewheel', this._onMouseWheel.bind(this)); - function weeks () { - return absFloor(this.days() / 7); - } + // pinch to zoom + this.body.emitter.on('touch', this._onTouch.bind(this)); + this.body.emitter.on('pinch', this._onPinch.bind(this)); - var round = Math.round; - var thresholds = { - ss: 44, // a few seconds to seconds - s : 45, // seconds to minute - m : 45, // minutes to hour - h : 22, // hours to day - d : 26, // days to month - M : 11 // months to year - }; + // on click of rolling mode button + this.body.dom.rollingModeBtn.addEventListener('click', this.startRolling.bind(this)); - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } - - function relativeTime$1 (posNegDuration, withoutSuffix, locale) { - var duration = createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - - var a = seconds <= thresholds.ss && ['s', seconds] || - seconds < thresholds.s && ['ss', seconds] || - minutes <= 1 && ['m'] || - minutes < thresholds.m && ['mm', minutes] || - hours <= 1 && ['h'] || - hours < thresholds.h && ['hh', hours] || - days <= 1 && ['d'] || - days < thresholds.d && ['dd', days] || - months <= 1 && ['M'] || - months < thresholds.M && ['MM', months] || - years <= 1 && ['y'] || ['yy', years]; - - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); - } - - // This function allows you to set the rounding function for relative time strings - function getSetRelativeTimeRounding (roundingFunction) { - if (roundingFunction === undefined) { - return round; - } - if (typeof(roundingFunction) === 'function') { - round = roundingFunction; - return true; - } - return false; - } + this.setOptions(options); +} - // This function allows you to set a threshold for relative time strings - function getSetRelativeTimeThreshold (threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - if (threshold === 's') { - thresholds.ss = limit - 1; - } - return true; +Range.prototype = new Component(); + +/** + * Set options for the range controller + * @param {Object} options Available options: + * {number | Date | String} start Start date for the range + * {number | Date | String} end End date for the range + * {number} min Minimum value for start + * {number} max Maximum value for end + * {number} zoomMin Set a minimum value for + * (end - start). + * {number} zoomMax Set a maximum value for + * (end - start). + * {boolean} moveable Enable moving of the range + * by dragging. True by default + * {boolean} zoomable Enable zooming of the range + * by pinching/scrolling. True by default + */ +Range.prototype.setOptions = function (options) { + if (options) { + // copy the options that we know + var fields = ['animation', 'direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable', 'moment', 'activate', 'hiddenDates', 'zoomKey', 'rtl', 'showCurrentTime', 'rollingMode', 'horizontalScroll']; + util.selectiveExtend(fields, this.options, options); + + if (options.rollingMode && options.rollingMode.follow) { + this.startRolling(); + } + if ('start' in options || 'end' in options) { + // apply a new range. both start and end are optional + this.setRange(options.start, options.end); + } + } +}; + +/** + * Test whether direction has a valid value + * @param {string} direction 'horizontal' or 'vertical' + */ +function validateDirection(direction) { + if (direction != 'horizontal' && direction != 'vertical') { + throw new TypeError('Unknown direction "' + direction + '". ' + 'Choose "horizontal" or "vertical".'); } +} - function humanize (withSuffix) { - if (!this.isValid()) { - return this.localeData().invalidDate(); - } - - var locale = this.localeData(); - var output = relativeTime$1(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); - } - - var abs$1 = Math.abs; - - function toISOString$1() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - if (!this.isValid()) { - return this.localeData().invalidDate(); - } - - var seconds = abs$1(this._milliseconds) / 1000; - var days = abs$1(this._days); - var months = abs$1(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); - } - - var proto$2 = Duration.prototype; - - proto$2.isValid = isValid$1; - proto$2.abs = abs; - proto$2.add = add$1; - proto$2.subtract = subtract$1; - proto$2.as = as; - proto$2.asMilliseconds = asMilliseconds; - proto$2.asSeconds = asSeconds; - proto$2.asMinutes = asMinutes; - proto$2.asHours = asHours; - proto$2.asDays = asDays; - proto$2.asWeeks = asWeeks; - proto$2.asMonths = asMonths; - proto$2.asYears = asYears; - proto$2.valueOf = valueOf$1; - proto$2._bubble = bubble; - proto$2.get = get$2; - proto$2.milliseconds = milliseconds; - proto$2.seconds = seconds; - proto$2.minutes = minutes; - proto$2.hours = hours; - proto$2.days = days; - proto$2.weeks = weeks; - proto$2.months = months; - proto$2.years = years; - proto$2.humanize = humanize; - proto$2.toISOString = toISOString$1; - proto$2.toString = toISOString$1; - proto$2.toJSON = toISOString$1; - proto$2.locale = locale; - proto$2.localeData = localeData; - - // Deprecations - proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); - proto$2.lang = lang; - - // Side effect imports - - // FORMATTING - - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); - - // PARSING - - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); +/** + * Start auto refreshing the current time bar + */ +Range.prototype.startRolling = function () { + var me = this; - // Side effect imports - - - hooks.version = '2.18.1'; - - setHookCallback(createLocal); - - hooks.fn = proto; - hooks.min = min; - hooks.max = max; - hooks.now = now; - hooks.utc = createUTC; - hooks.unix = createUnix; - hooks.months = listMonths; - hooks.isDate = isDate; - hooks.locale = getSetGlobalLocale; - hooks.invalid = createInvalid; - hooks.duration = createDuration; - hooks.isMoment = isMoment; - hooks.weekdays = listWeekdays; - hooks.parseZone = createInZone; - hooks.localeData = getLocale; - hooks.isDuration = isDuration; - hooks.monthsShort = listMonthsShort; - hooks.weekdaysMin = listWeekdaysMin; - hooks.defineLocale = defineLocale; - hooks.updateLocale = updateLocale; - hooks.locales = listLocales; - hooks.weekdaysShort = listWeekdaysShort; - hooks.normalizeUnits = normalizeUnits; - hooks.relativeTimeRounding = getSetRelativeTimeRounding; - hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; - hooks.calendarFormat = getCalendarFormat; - hooks.prototype = proto; - - return hooks; - - }))); - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(84)(module))) + /** + * Updates the current time. + */ + function update() { + me.stopRolling(); + me.rolling = true; -/***/ }), -/* 84 */ -/***/ (function(module, exports) { + var interval = me.end - me.start; + var t = util.convert(new Date(), 'Date').valueOf(); - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } + var start = t - interval * me.options.rollingMode.offset; + var end = t + interval * (1 - me.options.rollingMode.offset); + var options = { + animation: false + }; + me.setRange(start, end, options); -/***/ }), -/* 85 */ -/***/ (function(module, exports) { + // determine interval to refresh + var scale = me.conversion(me.body.domProps.center.width).scale; + interval = 1 / scale / 10; + if (interval < 30) interval = 30; + if (interval > 1000) interval = 1000; - function webpackContext(req) { - throw new Error("Cannot find module '" + req + "'."); + me.body.dom.rollingModeBtn.style.visibility = "hidden"; + // start a renderTimer to adjust for the new time + me.currentTimeTimer = setTimeout(update, interval); } - webpackContext.keys = function() { return []; }; - webpackContext.resolve = webpackContext; - module.exports = webpackContext; - webpackContext.id = 85; + update(); +}; -/***/ }), -/* 86 */ -/***/ (function(module, exports) { +/** + * Stop auto refreshing the current time bar + */ +Range.prototype.stopRolling = function () { + if (this.currentTimeTimer !== undefined) { + clearTimeout(this.currentTimeTimer); + this.rolling = false; + this.body.dom.rollingModeBtn.style.visibility = "visible"; + } +}; + +/** + * Set a new start and end range + * @param {Date | number | string} [start] + * @param {Date | number | string} [end] + * @param {Object} options Available options: + * {boolean | {duration: number, easingFunction: string}} [animation=false] + * If true, the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * {boolean} [byUser=false] + * {Event} event Mouse event + * @param {Function} callback a callback function to be executed at the end of this function + * @param {Function} frameCallback a callback function executed each frame of the range animation. + * The callback will be passed three parameters: + * {number} easeCoefficient an easing coefficent + * {boolean} willDraw If true the caller will redraw after the callback completes + * {boolean} done If true then animation is ending after the current frame + */ + +Range.prototype.setRange = function (start, end, options, callback, frameCallback) { + if (!options) { + options = {}; + } + if (options.byUser !== true) { + options.byUser = false; + } + var me = this; + var finalStart = start != undefined ? util.convert(start, 'Date').valueOf() : null; + var finalEnd = end != undefined ? util.convert(end, 'Date').valueOf() : null; + this._cancelAnimation(); + this.millisecondsPerPixelCache = undefined; + + if (options.animation) { + // true or an Object + var initStart = this.start; + var initEnd = this.end; + var duration = (0, _typeof3['default'])(options.animation) === 'object' && 'duration' in options.animation ? options.animation.duration : 500; + var easingName = (0, _typeof3['default'])(options.animation) === 'object' && 'easingFunction' in options.animation ? options.animation.easingFunction : 'easeInOutQuad'; + var easingFunction = util.easingFunctions[easingName]; + if (!easingFunction) { + throw new Error('Unknown easing function ' + (0, _stringify2['default'])(easingName) + '. ' + 'Choose from: ' + (0, _keys2['default'])(util.easingFunctions).join(', ')); + } + + var initTime = new Date().valueOf(); + var anyChanged = false; + + var next = function next() { + if (!me.props.touch.dragging) { + var now = new Date().valueOf(); + var time = now - initTime; + var ease = easingFunction(time / duration); + var done = time > duration; + var s = done || finalStart === null ? finalStart : initStart + (finalStart - initStart) * ease; + var e = done || finalEnd === null ? finalEnd : initEnd + (finalEnd - initEnd) * ease; + + changed = me._applyRange(s, e); + DateUtil.updateHiddenDates(me.options.moment, me.body, me.options.hiddenDates); + anyChanged = anyChanged || changed; - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + var params = { + start: new Date(me.start), + end: new Date(me.end), + byUser: options.byUser, + event: options.event + }; - var _rng; + if (frameCallback) { + frameCallback(ease, changed, done); + } - var globalVar = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null; + if (changed) { + me.body.emitter.emit('rangechange', params); + } - if (globalVar && globalVar.crypto && crypto.getRandomValues) { - // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto - // Moderately fast, high quality - var _rnds8 = new Uint8Array(16); - _rng = function whatwgRNG() { - crypto.getRandomValues(_rnds8); - return _rnds8; + if (done) { + if (anyChanged) { + me.body.emitter.emit('rangechanged', params); + if (callback) { + return callback(); + } + } + } else { + // animate with as high as possible frame rate, leave 20 ms in between + // each to prevent the browser from blocking + me.animationTimer = setTimeout(next, 20); + } + } }; - } - if (!_rng) { - // Math.random()-based (RNG) - // - // If all else fails, use Math.random(). It's fast, but is of unspecified - // quality. - var _rnds = new Array(16); - _rng = function _rng() { - for (var i = 0, r; i < 16; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000; - _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; + return next(); + } else { + var changed = this._applyRange(finalStart, finalEnd); + DateUtil.updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates); + if (changed) { + var params = { + start: new Date(this.start), + end: new Date(this.end), + byUser: options.byUser, + event: options.event + }; + + this.body.emitter.emit('rangechange', params); + clearTimeout(me.timeoutID); + me.timeoutID = setTimeout(function () { + me.body.emitter.emit('rangechanged', params); + }, 200); + if (callback) { + return callback(); } + } + } +}; - return _rnds; - }; +/** + * Get the number of milliseconds per pixel. + * + * @returns {undefined|number} + */ +Range.prototype.getMillisecondsPerPixel = function () { + if (this.millisecondsPerPixelCache === undefined) { + this.millisecondsPerPixelCache = (this.end - this.start) / this.body.dom.center.clientWidth; } + return this.millisecondsPerPixelCache; +}; - // uuid.js - // - // Copyright (c) 2010-2012 Robert Kieffer - // MIT License - http://opensource.org/licenses/mit-license.php +/** + * Stop an animation + * @private + */ +Range.prototype._cancelAnimation = function () { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + } +}; - // Unique ID creation requires a high quality random # generator. We feature - // detect to determine the best RNG source, normalizing to a function that - // returns 128-bits of randomness, since that's what's usually required +/** + * Set a new start and end range. This method is the same as setRange, but + * does not trigger a range change and range changed event, and it returns + * true when the range is changed + * @param {number} [start] + * @param {number} [end] + * @return {boolean} changed + * @private + */ +Range.prototype._applyRange = function (start, end) { + var newStart = start != null ? util.convert(start, 'Date').valueOf() : this.start, + newEnd = end != null ? util.convert(end, 'Date').valueOf() : this.end, + max = this.options.max != null ? util.convert(this.options.max, 'Date').valueOf() : null, + min = this.options.min != null ? util.convert(this.options.min, 'Date').valueOf() : null, + diff; - //var _rng = require('./rng'); + // check for valid number + if (isNaN(newStart) || newStart === null) { + throw new Error('Invalid start "' + start + '"'); + } + if (isNaN(newEnd) || newEnd === null) { + throw new Error('Invalid end "' + end + '"'); + } - // Maps for number <-> hex string conversion - var _byteToHex = []; - var _hexToByte = {}; - for (var i = 0; i < 256; i++) { - _byteToHex[i] = (i + 0x100).toString(16).substr(1); - _hexToByte[_byteToHex[i]] = i; + // prevent end < start + if (newEnd < newStart) { + newEnd = newStart; } - // **`parse()` - Parse a UUID into it's component bytes** - function parse(s, buf, offset) { - var i = buf && offset || 0, - ii = 0; + // prevent start < min + if (min !== null) { + if (newStart < min) { + diff = min - newStart; + newStart += diff; + newEnd += diff; - buf = buf || []; - s.toLowerCase().replace(/[0-9a-f]{2}/g, function (oct) { - if (ii < 16) { - // Don't overflow! - buf[i + ii++] = _hexToByte[oct]; + // prevent end > max + if (max != null) { + if (newEnd > max) { + newEnd = max; + } } - }); - - // Zero out remaining bytes if string was short - while (ii < 16) { - buf[i + ii++] = 0; } - - return buf; } - // **`unparse()` - Convert UUID byte array (ala parse()) into a string** - function unparse(buf, offset) { - var i = offset || 0, - bth = _byteToHex; - return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; + // prevent end > max + if (max !== null) { + if (newEnd > max) { + diff = newEnd - max; + newStart -= diff; + newEnd -= diff; + + // prevent start < min + if (min != null) { + if (newStart < min) { + newStart = min; + } + } + } } - // **`v1()` - Generate time-based UUID** - // - // Inspired by https://github.com/LiosK/UUID.js - // and http://docs.python.org/library/uuid.html + // prevent (end-start) < zoomMin + if (this.options.zoomMin !== null) { + var zoomMin = parseFloat(this.options.zoomMin); + if (zoomMin < 0) { + zoomMin = 0; + } + if (newEnd - newStart < zoomMin) { + // compensate for a scale of 0.5 ms + var compensation = 0.5; + if (this.end - this.start === zoomMin && newStart >= this.start - compensation && newEnd <= this.end) { + // ignore this action, we are already zoomed to the minimum + newStart = this.start; + newEnd = this.end; + } else { + // zoom to the minimum + diff = zoomMin - (newEnd - newStart); + newStart -= diff / 2; + newEnd += diff / 2; + } + } + } - // random #'s we need to init node and clockseq - var _seedBytes = _rng(); + // prevent (end-start) > zoomMax + if (this.options.zoomMax !== null) { + var zoomMax = parseFloat(this.options.zoomMax); + if (zoomMax < 0) { + zoomMax = 0; + } - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - var _nodeId = [_seedBytes[0] | 0x01, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]]; + if (newEnd - newStart > zoomMax) { + if (this.end - this.start === zoomMax && newStart < this.start && newEnd > this.end) { + // ignore this action, we are already zoomed to the maximum + newStart = this.start; + newEnd = this.end; + } else { + // zoom to the maximum + diff = newEnd - newStart - zoomMax; + newStart += diff / 2; + newEnd -= diff / 2; + } + } + } - // Per 4.2.2, randomize (14 bit) clockseq - var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; + var changed = this.start != newStart || this.end != newEnd; - // Previous uuid creation time - var _lastMSecs = 0, - _lastNSecs = 0; + // if the new range does NOT overlap with the old range, emit checkRangedItems to avoid not showing ranged items (ranged meaning has end time, not necessarily of type Range) + if (!(newStart >= this.start && newStart <= this.end || newEnd >= this.start && newEnd <= this.end) && !(this.start >= newStart && this.start <= newEnd || this.end >= newStart && this.end <= newEnd)) { + this.body.emitter.emit('checkRangedItems'); + } - // See https://github.com/broofa/node-uuid for API details - function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; + this.start = newStart; + this.end = newEnd; + return changed; +}; - options = options || {}; +/** + * Retrieve the current range. + * @return {Object} An object with start and end properties + */ +Range.prototype.getRange = function () { + return { + start: this.start, + end: this.end + }; +}; - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; +/** + * Calculate the conversion offset and scale for current range, based on + * the provided width + * @param {number} width + * @param {number} [totalHidden=0] + * @returns {{offset: number, scale: number}} conversion + */ +Range.prototype.conversion = function (width, totalHidden) { + return Range.conversion(this.start, this.end, width, totalHidden); +}; - // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); +/** + * Static method to calculate the conversion offset and scale for a range, + * based on the provided start, end, and width + * @param {number} start + * @param {number} end + * @param {number} width + * @param {number} [totalHidden=0] + * @returns {{offset: number, scale: number}} conversion + */ +Range.conversion = function (start, end, width, totalHidden) { + if (totalHidden === undefined) { + totalHidden = 0; + } + if (width != 0 && end - start != 0) { + return { + offset: start, + scale: width / (end - start - totalHidden) + }; + } else { + return { + offset: 0, + scale: 1 + }; + } +}; - // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; +/** + * Start dragging horizontally or vertically + * @param {Event} event + * @private + */ +Range.prototype._onDragStart = function (event) { + this.deltaDifference = 0; + this.previousDelta = 0; - // Time since last uuid creation (in msecs) - var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; + // only allow dragging when configured as movable + if (!this.options.moveable) return; - // Per 4.2.1.2, Bump clockseq on clock regression - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } + // only start dragging when the mouse is inside the current range + if (!this._isInsideRange(event)) return; - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; - // Per 4.2.1.2 Throw error if too many uuids are requested - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } + this.stopRolling(); - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; + this.props.touch.start = this.start; + this.props.touch.end = this.end; + this.props.touch.dragging = true; - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - msecs += 12219292800000; + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'move'; + } +}; - // `time_low` - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; +/** + * Perform dragging operation + * @param {Event} event + * @private + */ +Range.prototype._onDrag = function (event) { + if (!event) return; + + if (!this.props.touch.dragging) return; + + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // TODO: this may be redundant in hammerjs2 + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + + var direction = this.options.direction; + validateDirection(direction); + var delta = direction == 'horizontal' ? event.deltaX : event.deltaY; + delta -= this.deltaDifference; + var interval = this.props.touch.end - this.props.touch.start; + + // normalize dragging speed if cutout is in between. + var duration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); + interval -= duration; + + var width = direction == 'horizontal' ? this.body.domProps.center.width : this.body.domProps.center.height; + var diffRange; + if (this.options.rtl) { + diffRange = delta / width * interval; + } else { + diffRange = -delta / width * interval; + } - // `time_mid` - var tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; + var newStart = this.props.touch.start + diffRange; + var newEnd = this.props.touch.end + diffRange; - // `time_high_and_version` - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - b[i++] = tmh >>> 16 & 0xff; + // snapping times away from hidden zones + var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, this.previousDelta - delta, true); + var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, this.previousDelta - delta, true); + if (safeStart != newStart || safeEnd != newEnd) { + this.deltaDifference += delta; + this.props.touch.start = safeStart; + this.props.touch.end = safeEnd; + this._onDrag(event); + return; + } - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - b[i++] = clockseq >>> 8 | 0x80; + this.previousDelta = delta; + this._applyRange(newStart, newEnd); - // `clock_seq_low` - b[i++] = clockseq & 0xff; + var startDate = new Date(this.start); + var endDate = new Date(this.end); - // `node` - var node = options.node || _nodeId; - for (var n = 0; n < 6; n++) { - b[i + n] = node[n]; - } + // fire a rangechange event + this.body.emitter.emit('rangechange', { + start: startDate, + end: endDate, + byUser: true, + event: event + }); - return buf ? buf : unparse(b); - } + // fire a panmove event + this.body.emitter.emit('panmove'); +}; - // **`v4()` - Generate random UUID** +/** + * Stop dragging operation + * @param {event} event + * @private + */ +Range.prototype._onDragEnd = function (event) { + if (!this.props.touch.dragging) return; + + // only allow dragging when configured as movable + if (!this.options.moveable) return; + + // TODO: this may be redundant in hammerjs2 + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.props.touch.allowDragging) return; + + this.props.touch.dragging = false; + if (this.body.dom.root) { + this.body.dom.root.style.cursor = 'auto'; + } + + // fire a rangechanged event + this.body.emitter.emit('rangechanged', { + start: new Date(this.start), + end: new Date(this.end), + byUser: true, + event: event + }); +}; - // See https://github.com/broofa/node-uuid for API details - function v4(options, buf, offset) { - // Deprecated - 'format' argument, as supported in v1.2 - var i = buf && offset || 0; +/** + * Event handler for mouse wheel event, used to zoom + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {Event} event + * @private + */ +Range.prototype._onMouseWheel = function (event) { + // retrieve delta + var delta = 0; + if (event.wheelDelta) { + /* IE/Opera. */ + delta = event.wheelDelta / 120; + } else if (event.detail) { + /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail / 3; + } + + // don't allow zoom when the according key is pressed and the zoomKey option or not zoomable but movable + if (this.options.zoomKey && !event[this.options.zoomKey] && this.options.zoomable || !this.options.zoomable && this.options.moveable) { + return; + } + + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; + + // only zoom when the mouse is inside the current range + if (!this._isInsideRange(event)) return; + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + // perform the zoom action. Delta is normally 1 or -1 + + // adjust a negative delta such that zooming in with delta 0.1 + // equals zooming out with a delta -0.1 + var scale; + if (delta < 0) { + scale = 1 - delta / 5; + } else { + scale = 1 / (1 + delta / 5); + } - if (typeof options == 'string') { - buf = options == 'binary' ? new Array(16) : null; - options = null; + // calculate center, the date to zoom around + var pointerDate; + if (this.rolling) { + pointerDate = this.start + (this.end - this.start) * this.options.rollingMode.offset; + } else { + var pointer = this.getPointer({ x: event.clientX, y: event.clientY }, this.body.dom.center); + pointerDate = this._pointerToDate(pointer); } - options = options || {}; + this.zoom(scale, pointerDate, delta, event); + + // Prevent default actions caused by mouse wheel + // (else the page and timeline both scroll) + event.preventDefault(); + } +}; - var rnds = options.random || (options.rng || _rng)(); +/** + * Start of a touch gesture + * @param {Event} event + * @private + */ +Range.prototype._onTouch = function (event) { + // eslint-disable-line no-unused-vars + this.props.touch.start = this.start; + this.props.touch.end = this.end; + this.props.touch.allowDragging = true; + this.props.touch.center = null; + this.scaleOffset = 0; + this.deltaDifference = 0; + // Disable the browser default handling of this event. + util.preventDefault(event); +}; - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; +/** + * Handle pinch event + * @param {Event} event + * @private + */ +Range.prototype._onPinch = function (event) { + // only allow zooming when configured as zoomable and moveable + if (!(this.options.zoomable && this.options.moveable)) return; - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ii++) { - buf[i + ii] = rnds[ii]; - } - } + // Disable the browser default handling of this event. + util.preventDefault(event); - return buf || unparse(rnds); + this.props.touch.allowDragging = false; + + if (!this.props.touch.center) { + this.props.touch.center = this.getPointer(event.center, this.body.dom.center); } - // Export public API - var uuid = v4; - uuid.v1 = v1; - uuid.v4 = v4; - uuid.parse = parse; - uuid.unparse = unparse; + this.stopRolling(); - module.exports = uuid; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + var scale = 1 / (event.scale + this.scaleOffset); + var centerDate = this._pointerToDate(this.props.touch.center); -/***/ }), -/* 87 */ -/***/ (function(module, exports, __webpack_require__) { + var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); + var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, centerDate); + var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; - 'use strict'; + // calculate new start and end + var newStart = centerDate - hiddenDurationBefore + (this.props.touch.start - (centerDate - hiddenDurationBefore)) * scale; + var newEnd = centerDate + hiddenDurationAfter + (this.props.touch.end - (centerDate + hiddenDurationAfter)) * scale; - // utils - exports.util = __webpack_require__(1); - exports.DOMutil = __webpack_require__(88); - - // data - exports.DataSet = __webpack_require__(89); - exports.DataView = __webpack_require__(93); - exports.Queue = __webpack_require__(92); - - // Graph3d - exports.Graph3d = __webpack_require__(94); - exports.graph3d = { - Camera: __webpack_require__(102), - Filter: __webpack_require__(107), - Point2d: __webpack_require__(101), - Point3d: __webpack_require__(100), - Slider: __webpack_require__(108), - StepNumber: __webpack_require__(109) - }; + // snapping times away from hidden zones + this.startToFront = 1 - scale <= 0; // used to do the right auto correction with periodic hidden times + this.endToFront = scale - 1 <= 0; // used to do the right auto correction with periodic hidden times - // bundled external libraries - exports.moment = __webpack_require__(82); - exports.Hammer = __webpack_require__(113); - exports.keycharm = __webpack_require__(116); + var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true); + var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true); + if (safeStart != newStart || safeEnd != newEnd) { + this.props.touch.start = safeStart; + this.props.touch.end = safeEnd; + this.scaleOffset = 1 - event.scale; + newStart = safeStart; + newEnd = safeEnd; + } -/***/ }), -/* 88 */ -/***/ (function(module, exports) { + var options = { + animation: false, + byUser: true, + event: event + }; + this.setRange(newStart, newEnd, options); - 'use strict'; + this.startToFront = false; // revert to default + this.endToFront = true; // revert to default +}; - // DOM utility methods +/** + * Test whether the mouse from a mouse event is inside the visible window, + * between the current start and end date + * @param {Object} event + * @return {boolean} Returns true when inside the visible window + * @private + */ +Range.prototype._isInsideRange = function (event) { + // calculate the time where the mouse is, check whether inside + // and no scroll action should happen. + var clientX = event.center ? event.center.x : event.clientX; + var x; + if (this.options.rtl) { + x = clientX - util.getAbsoluteLeft(this.body.dom.centerContainer); + } else { + x = util.getAbsoluteRight(this.body.dom.centerContainer) - clientX; + } + var time = this.body.util.toTime(x); - /** - * this prepares the JSON container for allocating SVG elements - * @param JSONcontainer - * @private - */ - exports.prepareElements = function (JSONcontainer) { - // cleanup the redundant svgElements; - for (var elementType in JSONcontainer) { - if (JSONcontainer.hasOwnProperty(elementType)) { - JSONcontainer[elementType].redundant = JSONcontainer[elementType].used; - JSONcontainer[elementType].used = []; - } - } - }; + return time >= this.start && time <= this.end; +}; - /** - * this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from - * which to remove the redundant elements. - * - * @param JSONcontainer - * @private - */ - exports.cleanupElements = function (JSONcontainer) { - // cleanup the redundant svgElements; - for (var elementType in JSONcontainer) { - if (JSONcontainer.hasOwnProperty(elementType)) { - if (JSONcontainer[elementType].redundant) { - for (var i = 0; i < JSONcontainer[elementType].redundant.length; i++) { - JSONcontainer[elementType].redundant[i].parentNode.removeChild(JSONcontainer[elementType].redundant[i]); - } - JSONcontainer[elementType].redundant = []; - } - } - } - }; +/** + * Helper function to calculate the center date for zooming + * @param {{x: number, y: number}} pointer + * @return {number} date + * @private + */ +Range.prototype._pointerToDate = function (pointer) { + var conversion; + var direction = this.options.direction; + + validateDirection(direction); + + if (direction == 'horizontal') { + return this.body.util.toTime(pointer.x).valueOf(); + } else { + var height = this.body.domProps.center.height; + conversion = this.conversion(height); + return pointer.y / conversion.scale + conversion.offset; + } +}; - /** - * Ensures that all elements are removed first up so they can be recreated cleanly - * @param JSONcontainer - */ - exports.resetElements = function (JSONcontainer) { - exports.prepareElements(JSONcontainer); - exports.cleanupElements(JSONcontainer); - exports.prepareElements(JSONcontainer); - }; +/** + * Get the pointer location relative to the location of the dom element + * @param {{x: number, y: number}} touch + * @param {Element} element HTML DOM element + * @return {{x: number, y: number}} pointer + * @private + */ +Range.prototype.getPointer = function (touch, element) { + if (this.options.rtl) { + return { + x: util.getAbsoluteRight(element) - touch.x, + y: touch.y - util.getAbsoluteTop(element) + }; + } else { + return { + x: touch.x - util.getAbsoluteLeft(element), + y: touch.y - util.getAbsoluteTop(element) + }; + } +}; - /** - * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer - * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. - * - * @param elementType - * @param JSONcontainer - * @param svgContainer - * @returns {*} - * @private - */ - exports.getSVGElement = function (elementType, JSONcontainer, svgContainer) { - var element; - // allocate SVG element, if it doesnt yet exist, create one. - if (JSONcontainer.hasOwnProperty(elementType)) { - // this element has been created before - // check if there is an redundant element - if (JSONcontainer[elementType].redundant.length > 0) { - element = JSONcontainer[elementType].redundant[0]; - JSONcontainer[elementType].redundant.shift(); - } else { - // create a new element and add it to the SVG - element = document.createElementNS('http://www.w3.org/2000/svg', elementType); - svgContainer.appendChild(element); - } - } else { - // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. - element = document.createElementNS('http://www.w3.org/2000/svg', elementType); - JSONcontainer[elementType] = { used: [], redundant: [] }; - svgContainer.appendChild(element); - } - JSONcontainer[elementType].used.push(element); - return element; - }; +/** + * Zoom the range the given scale in or out. Start and end date will + * be adjusted, and the timeline will be redrawn. You can optionally give a + * date around which to zoom. + * For example, try scale = 0.9 or 1.1 + * @param {number} scale Scaling factor. Values above 1 will zoom out, + * values below 1 will zoom in. + * @param {number} [center] Value representing a date around which will + * be zoomed. + * @param {number} delta + * @param {Event} event + */ +Range.prototype.zoom = function (scale, center, delta, event) { + // if centerDate is not provided, take it half between start Date and end Date + if (center == null) { + center = (this.start + this.end) / 2; + } + + var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); + var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, center); + var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; + + // calculate new start and end + var newStart = center - hiddenDurationBefore + (this.start - (center - hiddenDurationBefore)) * scale; + var newEnd = center + hiddenDurationAfter + (this.end - (center + hiddenDurationAfter)) * scale; + + // snapping times away from hidden zones + this.startToFront = delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times + this.endToFront = -delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times + var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, delta, true); + var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, -delta, true); + if (safeStart != newStart || safeEnd != newEnd) { + newStart = safeStart; + newEnd = safeEnd; + } + + var options = { + animation: false, + byUser: true, + event: event + }; + this.setRange(newStart, newEnd, options); + + this.startToFront = false; // revert to default + this.endToFront = true; // revert to default +}; - /** - * Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer - * the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this. - * - * @param elementType - * @param JSONcontainer - * @param DOMContainer - * @returns {*} - * @private - */ - exports.getDOMElement = function (elementType, JSONcontainer, DOMContainer, insertBefore) { - var element; - // allocate DOM element, if it doesnt yet exist, create one. - if (JSONcontainer.hasOwnProperty(elementType)) { - // this element has been created before - // check if there is an redundant element - if (JSONcontainer[elementType].redundant.length > 0) { - element = JSONcontainer[elementType].redundant[0]; - JSONcontainer[elementType].redundant.shift(); - } else { - // create a new element and add it to the SVG - element = document.createElement(elementType); - if (insertBefore !== undefined) { - DOMContainer.insertBefore(element, insertBefore); - } else { - DOMContainer.appendChild(element); - } - } - } else { - // create a new element and add it to the SVG, also create a new object in the svgElements to keep track of it. - element = document.createElement(elementType); - JSONcontainer[elementType] = { used: [], redundant: [] }; - if (insertBefore !== undefined) { - DOMContainer.insertBefore(element, insertBefore); - } else { - DOMContainer.appendChild(element); - } - } - JSONcontainer[elementType].used.push(element); - return element; - }; +/** + * Move the range with a given delta to the left or right. Start and end + * value will be adjusted. For example, try delta = 0.1 or -0.1 + * @param {number} delta Moving amount. Positive value will move right, + * negative value will move left + */ +Range.prototype.move = function (delta) { + // zoom start Date and end Date relative to the centerDate + var diff = this.end - this.start; - /** - * Draw a point object. This is a separate function because it can also be called by the legend. - * The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions - * as well. - * - * @param x - * @param y - * @param groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' } - * @param JSONcontainer - * @param svgContainer - * @param labelObj - * @returns {*} - */ - exports.drawPoint = function (x, y, groupTemplate, JSONcontainer, svgContainer, labelObj) { - var point; - if (groupTemplate.style == 'circle') { - point = exports.getSVGElement('circle', JSONcontainer, svgContainer); - point.setAttributeNS(null, "cx", x); - point.setAttributeNS(null, "cy", y); - point.setAttributeNS(null, "r", 0.5 * groupTemplate.size); - } else { - point = exports.getSVGElement('rect', JSONcontainer, svgContainer); - point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size); - point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size); - point.setAttributeNS(null, "width", groupTemplate.size); - point.setAttributeNS(null, "height", groupTemplate.size); - } + // apply new values + var newStart = this.start + diff * delta; + var newEnd = this.end + diff * delta; - if (groupTemplate.styles !== undefined) { - point.setAttributeNS(null, "style", groupTemplate.styles); - } - point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); - //handle label + // TODO: reckon with min and max range + this.start = newStart; + this.end = newEnd; +}; - if (labelObj) { - var label = exports.getSVGElement('text', JSONcontainer, svgContainer); - if (labelObj.xOffset) { - x = x + labelObj.xOffset; - } +/** + * Move the range to a new center point + * @param {number} moveTo New center point of the range + */ +Range.prototype.moveTo = function (moveTo) { + var center = (this.start + this.end) / 2; - if (labelObj.yOffset) { - y = y + labelObj.yOffset; - } - if (labelObj.content) { - label.textContent = labelObj.content; - } + var diff = center - moveTo; - if (labelObj.className) { - label.setAttributeNS(null, "class", labelObj.className + " vis-label"); - } - label.setAttributeNS(null, "x", x); - label.setAttributeNS(null, "y", y); - } + // calculate new start and end + var newStart = this.start - diff; + var newEnd = this.end - diff; - return point; + var options = { + animation: false, + byUser: true, + event: null }; + this.setRange(newStart, newEnd, options); +}; - /** - * draw a bar SVG element centered on the X coordinate - * - * @param x - * @param y - * @param className - */ - exports.drawBar = function (x, y, width, height, className, JSONcontainer, svgContainer, style) { - if (height != 0) { - if (height < 0) { - height *= -1; - y -= height; - } - var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer); - rect.setAttributeNS(null, "x", x - 0.5 * width); - rect.setAttributeNS(null, "y", y); - rect.setAttributeNS(null, "width", width); - rect.setAttributeNS(null, "height", height); - rect.setAttributeNS(null, "class", className); - if (style) { - rect.setAttributeNS(null, "style", style); - } - } - }; +module.exports = Range; /***/ }), -/* 89 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; + - var _stringify = __webpack_require__(90); +var _stringify = __webpack_require__(19); - var _stringify2 = _interopRequireDefault(_stringify); +var _stringify2 = _interopRequireDefault(_stringify); - var _typeof2 = __webpack_require__(62); +var _typeof2 = __webpack_require__(6); - var _typeof3 = _interopRequireDefault(_typeof2); +var _typeof3 = _interopRequireDefault(_typeof2); - var _keys = __webpack_require__(58); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var Emitter = __webpack_require__(44); +var Hammer = __webpack_require__(10); +var hammerUtil = __webpack_require__(37); +var util = __webpack_require__(2); +var TimeAxis = __webpack_require__(45); +var Activator = __webpack_require__(97); +var DateUtil = __webpack_require__(36); +var CustomTime = __webpack_require__(46); + +/** + * Create a timeline visualization + * @constructor Core + */ +function Core() {} + +// turn Core into an event emitter +Emitter(Core.prototype); + +/** + * Create the main DOM for the Core: a root panel containing left, right, + * top, bottom, content, and background panel. + * @param {Element} container The container element where the Core will + * be attached. + * @protected + */ +Core.prototype._create = function (container) { + this.dom = {}; + + this.dom.container = container; + + this.dom.root = document.createElement('div'); + this.dom.background = document.createElement('div'); + this.dom.backgroundVertical = document.createElement('div'); + this.dom.backgroundHorizontal = document.createElement('div'); + this.dom.centerContainer = document.createElement('div'); + this.dom.leftContainer = document.createElement('div'); + this.dom.rightContainer = document.createElement('div'); + this.dom.center = document.createElement('div'); + this.dom.left = document.createElement('div'); + this.dom.right = document.createElement('div'); + this.dom.top = document.createElement('div'); + this.dom.bottom = document.createElement('div'); + this.dom.shadowTop = document.createElement('div'); + this.dom.shadowBottom = document.createElement('div'); + this.dom.shadowTopLeft = document.createElement('div'); + this.dom.shadowBottomLeft = document.createElement('div'); + this.dom.shadowTopRight = document.createElement('div'); + this.dom.shadowBottomRight = document.createElement('div'); + this.dom.rollingModeBtn = document.createElement('div'); + + this.dom.root.className = 'vis-timeline'; + this.dom.background.className = 'vis-panel vis-background'; + this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical'; + this.dom.backgroundHorizontal.className = 'vis-panel vis-background vis-horizontal'; + this.dom.centerContainer.className = 'vis-panel vis-center'; + this.dom.leftContainer.className = 'vis-panel vis-left'; + this.dom.rightContainer.className = 'vis-panel vis-right'; + this.dom.top.className = 'vis-panel vis-top'; + this.dom.bottom.className = 'vis-panel vis-bottom'; + this.dom.left.className = 'vis-content'; + this.dom.center.className = 'vis-content'; + this.dom.right.className = 'vis-content'; + this.dom.shadowTop.className = 'vis-shadow vis-top'; + this.dom.shadowBottom.className = 'vis-shadow vis-bottom'; + this.dom.shadowTopLeft.className = 'vis-shadow vis-top'; + this.dom.shadowBottomLeft.className = 'vis-shadow vis-bottom'; + this.dom.shadowTopRight.className = 'vis-shadow vis-top'; + this.dom.shadowBottomRight.className = 'vis-shadow vis-bottom'; + this.dom.rollingModeBtn.className = 'vis-rolling-mode-btn'; + + this.dom.root.appendChild(this.dom.background); + this.dom.root.appendChild(this.dom.backgroundVertical); + this.dom.root.appendChild(this.dom.backgroundHorizontal); + this.dom.root.appendChild(this.dom.centerContainer); + this.dom.root.appendChild(this.dom.leftContainer); + this.dom.root.appendChild(this.dom.rightContainer); + this.dom.root.appendChild(this.dom.top); + this.dom.root.appendChild(this.dom.bottom); + this.dom.root.appendChild(this.dom.bottom); + this.dom.root.appendChild(this.dom.rollingModeBtn); + + this.dom.centerContainer.appendChild(this.dom.center); + this.dom.leftContainer.appendChild(this.dom.left); + this.dom.rightContainer.appendChild(this.dom.right); + this.dom.centerContainer.appendChild(this.dom.shadowTop); + this.dom.centerContainer.appendChild(this.dom.shadowBottom); + this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); + this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); + this.dom.rightContainer.appendChild(this.dom.shadowTopRight); + this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); + + // size properties of each of the panels + this.props = { + root: {}, + background: {}, + centerContainer: {}, + leftContainer: {}, + rightContainer: {}, + center: {}, + left: {}, + right: {}, + top: {}, + bottom: {}, + border: {}, + scrollTop: 0, + scrollTopMin: 0 + }; + + this.on('rangechange', function () { + if (this.initialDrawDone === true) { + this._redraw(); + } + }.bind(this)); + this.on('rangechanged', function () { + if (!this.initialRangeChangeDone) { + this.initialRangeChangeDone = true; + } + }.bind(this)); + this.on('touch', this._onTouch.bind(this)); + this.on('panmove', this._onDrag.bind(this)); + + var me = this; + this._origRedraw = this._redraw.bind(this); + this._redraw = util.throttle(this._origRedraw); + + this.on('_change', function (properties) { + if (me.itemSet && me.itemSet.initialItemSetDrawn && properties && properties.queue == true) { + me._redraw(); + } else { + me._origRedraw(); + } + }); - var _keys2 = _interopRequireDefault(_keys); + // create event listeners for all interesting events, these events will be + // emitted via emitter + this.hammer = new Hammer(this.dom.root); + var pinchRecognizer = this.hammer.get('pinch').set({ enable: true }); + hammerUtil.disablePreventDefaultVertically(pinchRecognizer); + this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL }); + this.listeners = {}; + + var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend' + // TODO: cleanup + //'touch', 'pinch', + //'tap', 'doubletap', 'hold', + //'dragstart', 'drag', 'dragend', + //'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox + ]; + events.forEach(function (type) { + var listener = function listener(event) { + if (me.isActive()) { + me.emit(type, event); + } + }; + me.hammer.on(type, listener); + me.listeners[type] = listener; + }); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + // emulate a touch event (emitted before the start of a pan, pinch, tap, or press) + hammerUtil.onTouch(this.hammer, function (event) { + me.emit('touch', event); + }.bind(this)); - var util = __webpack_require__(1); - var Queue = __webpack_require__(92); + // emulate a release event (emitted after a pan, pinch, tap, or press) + hammerUtil.onRelease(this.hammer, function (event) { + me.emit('release', event); + }.bind(this)); /** - * DataSet - * - * Usage: - * var dataSet = new DataSet({ - * fieldId: '_id', - * type: { - * // ... - * } - * }); - * - * dataSet.add(item); - * dataSet.add(data); - * dataSet.update(item); - * dataSet.update(data); - * dataSet.remove(id); - * dataSet.remove(ids); - * var data = dataSet.get(); - * var data = dataSet.get(id); - * var data = dataSet.get(ids); - * var data = dataSet.get(ids, options, data); - * dataSet.clear(); * - * A data set can: - * - add/remove/update data - * - gives triggers upon changes in the data - * - can import/export data in various data formats - * - * @param {Array} [data] Optional array with initial data - * @param {Object} [options] Available options: - * {String} fieldId Field name of the id in the - * items, 'id' by default. - * {Object.= Math.abs(deltaX)) { + var current = this.props.scrollTop; + var adjusted = current + deltaY; + + if (this.isActive()) { + this._setScrollTop(adjusted); + this._redraw(); + this.emit('scroll', event); } + } else if (this.options.horizontalScroll) { + var delta = Math.abs(deltaX) >= Math.abs(deltaY) ? deltaX : deltaY; + + // calculate a single scroll jump relative to the range scale + var diff = delta / 120 * (this.range.end - this.range.start) / 20; + // calculate new start and end + var newStart = this.range.start + diff; + var newEnd = this.range.end + diff; + + var options = { + animation: false, + byUser: true, + event: event + }; + this.range.setRange(newStart, newEnd, options); } - }; + } + + if (this.dom.centerContainer.addEventListener) { + // IE9, Chrome, Safari, Opera + this.dom.centerContainer.addEventListener("mousewheel", onMouseWheel.bind(this), false); + // Firefox + this.dom.centerContainer.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false); + } else { + // IE 6/7/8 + this.dom.centerContainer.attachEvent("onmousewheel", onMouseWheel.bind(this)); + } /** - * Subscribe to an event, add an event listener - * @param {String} event Event name. Available events: 'put', 'update', - * 'remove' - * @param {function} callback Callback method. Called with three parameters: - * {String} event - * {Object | null} params - * {String | Number} senderId + * + * @param {scroll} event */ - DataSet.prototype.on = function (event, callback) { - var subscribers = this._subscribers[event]; - if (!subscribers) { - subscribers = []; - this._subscribers[event] = subscribers; + function onMouseScrollSide(event) { + if (!me.options.verticalScroll) return; + event.preventDefault(); + if (me.isActive()) { + var adjusted = -event.target.scrollTop; + me._setScrollTop(adjusted); + me._redraw(); + me.emit('scrollSide', event); } + } - subscribers.push({ - callback: callback - }); - }; + this.dom.left.parentNode.addEventListener('scroll', onMouseScrollSide.bind(this)); + this.dom.right.parentNode.addEventListener('scroll', onMouseScrollSide.bind(this)); - // TODO: remove this deprecated function some day (replaced with `on` since version 0.5, deprecated since v4.0) - DataSet.prototype.subscribe = function () { - throw new Error('DataSet.subscribe is deprecated. Use DataSet.on instead.'); - }; + var itemAddedToTimeline = false; /** - * Unsubscribe from an event, remove an event listener - * @param {String} event - * @param {function} callback + * + * @param {dragover} event + * @returns {boolean} */ - DataSet.prototype.off = function (event, callback) { - var subscribers = this._subscribers[event]; - if (subscribers) { - this._subscribers[event] = subscribers.filter(function (listener) { - return listener.callback != callback; - }); + function handleDragOver(event) { + if (event.preventDefault) { + event.preventDefault(); // Necessary. Allows us to drop. } - }; - // TODO: remove this deprecated function some day (replaced with `on` since version 0.5, deprecated since v4.0) - DataSet.prototype.unsubscribe = function () { - throw new Error('DataSet.unsubscribe is deprecated. Use DataSet.off instead.'); - }; + // make sure your target is a vis element + if (!event.target.className.indexOf("vis") > -1) return; + + // make sure only one item is added every time you're over the timeline + if (itemAddedToTimeline) return; + + event.dataTransfer.dropEffect = 'move'; + itemAddedToTimeline = true; + return false; + } /** - * Trigger an event - * @param {String} event - * @param {Object | null} params - * @param {String} [senderId] Optional id of the sender. - * @private + * + * @param {drop} event + * @returns {boolean} */ - DataSet.prototype._trigger = function (event, params, senderId) { - if (event == '*') { - throw new Error('Cannot trigger event *'); + function handleDrop(event) { + // prevent redirect to blank page - Firefox + if (event.preventDefault) { + event.preventDefault(); } - - var subscribers = []; - if (event in this._subscribers) { - subscribers = subscribers.concat(this._subscribers[event]); + if (event.stopPropagation) { + event.stopPropagation(); } - if ('*' in this._subscribers) { - subscribers = subscribers.concat(this._subscribers['*']); + // return when dropping non-vis items + try { + var itemData = JSON.parse(event.dataTransfer.getData("text")); + if (!itemData || !itemData.content) return; + } catch (err) { + return false; } - for (var i = 0, len = subscribers.length; i < len; i++) { - var subscriber = subscribers[i]; - if (subscriber.callback) { - subscriber.callback(event, params, senderId || null); - } - } - }; + itemAddedToTimeline = false; + event.center = { + x: event.clientX, + y: event.clientY + }; - /** - * Add data. - * Adding an item will fail when there already is an item with the same id. - * @param {Object | Array} data - * @param {String} [senderId] Optional sender id - * @return {Array} addedIds Array with the ids of the added items - */ - DataSet.prototype.add = function (data, senderId) { - var addedIds = [], - id, - me = this; - - if (Array.isArray(data)) { - // Array - for (var i = 0, len = data.length; i < len; i++) { - id = me._addItem(data[i]); - addedIds.push(id); - } - } else if (data && (typeof data === 'undefined' ? 'undefined' : (0, _typeof3['default'])(data)) === 'object') { - // Single item - id = me._addItem(data); - addedIds.push(id); + if (itemData.target !== 'item') { + me.itemSet._onAddItem(event); } else { - throw new Error('Unknown dataType'); + me.itemSet._onDropObjectOnItem(event); } + me.emit('drop', me.getEventProperties(event)); + return false; + } - if (addedIds.length) { - this._trigger('add', { items: addedIds }, senderId); - } + this.dom.center.addEventListener('dragover', handleDragOver.bind(this), false); + this.dom.center.addEventListener('drop', handleDrop.bind(this), false); - return addedIds; - }; + this.customTimes = []; - /** - * Update existing items. When an item does not exist, it will be created - * @param {Object | Array} data - * @param {String} [senderId] Optional sender id - * @return {Array} updatedIds The ids of the added or updated items - */ - DataSet.prototype.update = function (data, senderId) { - var addedIds = []; - var updatedIds = []; - var oldData = []; - var updatedData = []; - var me = this; - var fieldId = me._fieldId; - - var addOrUpdate = function addOrUpdate(item) { - var id = item[fieldId]; - if (me._data[id]) { - var oldItem = util.extend({}, me._data[id]); - // update item - id = me._updateItem(item); - updatedIds.push(id); - updatedData.push(item); - oldData.push(oldItem); - } else { - // add new item - id = me._addItem(item); - addedIds.push(id); - } - }; + // store state information needed for touch events + this.touch = {}; - if (Array.isArray(data)) { - // Array - for (var i = 0, len = data.length; i < len; i++) { - if (data[i] && (0, _typeof3['default'])(data[i]) === 'object') { - addOrUpdate(data[i]); - } else { - console.warn('Ignoring input item, which is not an object at index ' + i); - } - } - } else if (data && (typeof data === 'undefined' ? 'undefined' : (0, _typeof3['default'])(data)) === 'object') { - // Single item - addOrUpdate(data); - } else { - throw new Error('Unknown dataType'); - } + this.redrawCount = 0; + this.initialDrawDone = false; + this.initialRangeChangeDone = false; - if (addedIds.length) { - this._trigger('add', { items: addedIds }, senderId); - } - if (updatedIds.length) { - var props = { items: updatedIds, oldData: oldData, data: updatedData }; - // TODO: remove deprecated property 'data' some day - //Object.defineProperty(props, 'data', { - // 'get': (function() { - // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data'); - // return updatedData; - // }).bind(this) - //}); - this._trigger('update', props, senderId); - } - - return addedIds.concat(updatedIds); - }; - - /** - * Get a data item or multiple items. - * - * Usage: - * - * get() - * get(options: Object) - * - * get(id: Number | String) - * get(id: Number | String, options: Object) - * - * get(ids: Number[] | String[]) - * get(ids: Number[] | String[], options: Object) - * - * Where: - * - * {Number | String} id The id of an item - * {Number[] | String{}} ids An array with ids of items - * {Object} options An Object with options. Available options: - * {String} [returnType] Type of data to be returned. - * Can be 'Array' (default) or 'Object'. - * {Object.} [type] - * {String[]} [fields] field names to be returned - * {function} [filter] filter items - * {String | function} [order] Order the items by a field name or custom sort function. - * @throws Error - */ - DataSet.prototype.get = function (args) { - var me = this; + // attach the root panel to the provided container + if (!container) throw new Error('No container provided'); + container.appendChild(this.dom.root); +}; - // parse the arguments - var id, ids, options; - var firstType = util.getType(arguments[0]); - if (firstType == 'String' || firstType == 'Number') { - // get(id [, options]) - id = arguments[0]; - options = arguments[1]; - } else if (firstType == 'Array') { - // get(ids [, options]) - ids = arguments[0]; - options = arguments[1]; - } else { - // get([, options]) - options = arguments[0]; - } +/** + * Set options. Options will be passed to all components loaded in the Timeline. + * @param {Object} [options] + * {String} orientation + * Vertical orientation for the Timeline, + * can be 'bottom' (default) or 'top'. + * {string | number} width + * Width for the timeline, a number in pixels or + * a css string like '1000px' or '75%'. '100%' by default. + * {string | number} height + * Fixed height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. If undefined, + * The Timeline will automatically size such that + * its contents fit. + * {string | number} minHeight + * Minimum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {string | number} maxHeight + * Maximum height for the Timeline, a number in pixels or + * a css string like '400px' or '75%'. + * {number | Date | string} start + * Start date for the visible window + * {number | Date | string} end + * End date for the visible window + */ +Core.prototype.setOptions = function (options) { + if (options) { + // copy the known options + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', 'locale', 'locales', 'moment', 'rtl', 'zoomKey', 'horizontalScroll', 'verticalScroll']; + util.selectiveExtend(fields, this.options, options); + + this.dom.rollingModeBtn.style.visibility = 'hidden'; - // determine the return type - var returnType; - if (options && options.returnType) { - var allowedValues = ['Array', 'Object']; - returnType = allowedValues.indexOf(options.returnType) == -1 ? 'Array' : options.returnType; - } else { - returnType = 'Array'; + if (this.options.rtl) { + this.dom.container.style.direction = "rtl"; + this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical-rtl'; } - // build options - var type = options && options.type || this._options.type; - var filter = options && options.filter; - var items = [], - item, - itemIds, - itemId, - i, - len; - - // convert items - if (id != undefined) { - // return a single item - item = me._getItem(id, type); - if (item && filter && !filter(item)) { - item = null; - } - } else if (ids != undefined) { - // return a subset of items - for (i = 0, len = ids.length; i < len; i++) { - item = me._getItem(ids[i], type); - if (!filter || filter(item)) { - items.push(item); - } - } - } else { - // return all items - itemIds = (0, _keys2['default'])(this._data); - for (i = 0, len = itemIds.length; i < len; i++) { - itemId = itemIds[i]; - item = me._getItem(itemId, type); - if (!filter || filter(item)) { - items.push(item); - } + if (this.options.verticalScroll) { + if (this.options.rtl) { + this.dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; + } else { + this.dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; } } - // order the results - if (options && options.order && id == undefined) { - this._sort(items, options.order); + if ((0, _typeof3['default'])(this.options.orientation) !== 'object') { + this.options.orientation = { item: undefined, axis: undefined }; } - - // filter fields of the items - if (options && options.fields) { - var fields = options.fields; - if (id != undefined) { - item = this._filterFields(item, fields); - } else { - for (i = 0, len = items.length; i < len; i++) { - items[i] = this._filterFields(items[i], fields); + if ('orientation' in options) { + if (typeof options.orientation === 'string') { + this.options.orientation = { + item: options.orientation, + axis: options.orientation + }; + } else if ((0, _typeof3['default'])(options.orientation) === 'object') { + if ('item' in options.orientation) { + this.options.orientation.item = options.orientation.item; + } + if ('axis' in options.orientation) { + this.options.orientation.axis = options.orientation.axis; } } } - // return the results - if (returnType == 'Object') { - var result = {}, - resultant; - for (i = 0, len = items.length; i < len; i++) { - resultant = items[i]; - result[resultant.id] = resultant; + if (this.options.orientation.axis === 'both') { + if (!this.timeAxis2) { + var timeAxis2 = this.timeAxis2 = new TimeAxis(this.body); + timeAxis2.setOptions = function (options) { + var _options = options ? util.extend({}, options) : {}; + _options.orientation = 'top'; // override the orientation option, always top + TimeAxis.prototype.setOptions.call(timeAxis2, _options); + }; + this.components.push(timeAxis2); } - return result; } else { - if (id != undefined) { - // a single item - return item; - } else { - // just return our array - return items; + if (this.timeAxis2) { + var index = this.components.indexOf(this.timeAxis2); + if (index !== -1) { + this.components.splice(index, 1); + } + this.timeAxis2.destroy(); + this.timeAxis2 = null; } } - }; - - /** - * Get ids of all items or from a filtered set of items. - * @param {Object} [options] An Object with options. Available options: - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Array} ids - */ - DataSet.prototype.getIds = function (options) { - var data = this._data, - filter = options && options.filter, - order = options && options.order, - type = options && options.type || this._options.type, - itemIds = (0, _keys2['default'])(data), - i, - len, - id, - item, - items, - ids = []; - if (filter) { - // get filtered items - if (order) { - // create ordered list - items = []; - for (i = 0, len = itemIds.length; i < len; i++) { - id = itemIds[i]; - item = this._getItem(id, type); - if (filter(item)) { - items.push(item); - } - } + // if the graph2d's drawPoints is a function delegate the callback to the onRender property + if (typeof options.drawPoints == 'function') { + options.drawPoints = { + onRender: options.drawPoints + }; + } - this._sort(items, order); + if ('hiddenDates' in this.options) { + DateUtil.convertHiddenOptions(this.options.moment, this.body, this.options.hiddenDates); + } - for (i = 0, len = items.length; i < len; i++) { - ids.push(items[i][this._fieldId]); + if ('clickToUse' in options) { + if (options.clickToUse) { + if (!this.activator) { + this.activator = new Activator(this.dom.root); } } else { - // create unordered list - for (i = 0, len = itemIds.length; i < len; i++) { - id = itemIds[i]; - item = this._getItem(id, type); - if (filter(item)) { - ids.push(item[this._fieldId]); - } + if (this.activator) { + this.activator.destroy(); + delete this.activator; } } - } else { - // get all items - if (order) { - // create an ordered list - items = []; - for (i = 0, len = itemIds.length; i < len; i++) { - id = itemIds[i]; - items.push(data[id]); - } + } - this._sort(items, order); + if ('showCustomTime' in options) { + throw new Error('Option `showCustomTime` is deprecated. Create a custom time bar via timeline.addCustomTime(time [, id])'); + } - for (i = 0, len = items.length; i < len; i++) { - ids.push(items[i][this._fieldId]); - } - } else { - // create unordered list - for (i = 0, len = itemIds.length; i < len; i++) { - id = itemIds[i]; - item = data[id]; - ids.push(item[this._fieldId]); - } - } + // enable/disable autoResize + this._initAutoResize(); + } + + // propagate options to all components + this.components.forEach(function (component) { + return component.setOptions(options); + }); + + // enable/disable configure + if ('configure' in options) { + if (!this.configurator) { + this.configurator = this._createConfigurator(); } - return ids; - }; + this.configurator.setOptions(options.configure); - /** - * Returns the DataSet itself. Is overwritten for example by the DataView, - * which returns the DataSet it is connected to instead. - */ - DataSet.prototype.getDataSet = function () { - return this; - }; + // collect the settings of all components, and pass them to the configuration system + var appliedOptions = util.deepExtend({}, this.options); + this.components.forEach(function (component) { + util.deepExtend(appliedOptions, component.options); + }); + this.configurator.setModuleOptions({ global: appliedOptions }); + } - /** - * Execute a callback function for every item in the dataset. - * @param {function} callback - * @param {Object} [options] Available options: - * {Object.} [type] - * {String[]} [fields] filter fields - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - */ - DataSet.prototype.forEach = function (callback, options) { - var filter = options && options.filter, - type = options && options.type || this._options.type, - data = this._data, - itemIds = (0, _keys2['default'])(data), - i, - len, - item, - id; + this._redraw(); +}; - if (options && options.order) { - // execute forEach on ordered list - var items = this.get(options); +/** + * Returns true when the Timeline is active. + * @returns {boolean} + */ +Core.prototype.isActive = function () { + return !this.activator || this.activator.active; +}; - for (i = 0, len = items.length; i < len; i++) { - item = items[i]; - id = item[this._fieldId]; - callback(item, id); - } - } else { - // unordered - for (i = 0, len = itemIds.length; i < len; i++) { - id = itemIds[i]; - item = this._getItem(id, type); - if (!filter || filter(item)) { - callback(item, id); - } - } - } - }; +/** + * Destroy the Core, clean up all DOM elements and event listeners. + */ +Core.prototype.destroy = function () { + // unbind datasets + this.setItems(null); + this.setGroups(null); - /** - * Map every item in the dataset. - * @param {function} callback - * @param {Object} [options] Available options: - * {Object.} [type] - * {String[]} [fields] filter fields - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Object[]} mappedItems - */ - DataSet.prototype.map = function (callback, options) { - var filter = options && options.filter, - type = options && options.type || this._options.type, - mappedItems = [], - data = this._data, - itemIds = (0, _keys2['default'])(data), - i, - len, - id, - item; + // remove all event listeners + this.off(); - // convert and filter items - for (i = 0, len = itemIds.length; i < len; i++) { - id = itemIds[i]; - item = this._getItem(id, type); - if (!filter || filter(item)) { - mappedItems.push(callback(item, id)); - } - } + // stop checking for changed size + this._stopAutoResize(); - // order items - if (options && options.order) { - this._sort(mappedItems, options.order); - } + // remove from DOM + if (this.dom.root.parentNode) { + this.dom.root.parentNode.removeChild(this.dom.root); + } + this.dom = null; - return mappedItems; - }; + // remove Activator + if (this.activator) { + this.activator.destroy(); + delete this.activator; + } - /** - * Filter the fields of an item - * @param {Object | null} item - * @param {String[]} fields Field names - * @return {Object | null} filteredItem or null if no item is provided - * @private - */ - DataSet.prototype._filterFields = function (item, fields) { - if (!item) { - // item is null - return item; + // cleanup hammer touch events + for (var event in this.listeners) { + if (this.listeners.hasOwnProperty(event)) { + delete this.listeners[event]; } + } + this.listeners = null; + this.hammer = null; - var filteredItem = {}, - itemFields = (0, _keys2['default'])(item), - len = itemFields.length, - i, - field; + // give all components the opportunity to cleanup + this.components.forEach(function (component) { + return component.destroy(); + }); - if (Array.isArray(fields)) { - for (i = 0; i < len; i++) { - field = itemFields[i]; - if (fields.indexOf(field) != -1) { - filteredItem[field] = item[field]; - } - } - } else { - for (i = 0; i < len; i++) { - field = itemFields[i]; - if (fields.hasOwnProperty(field)) { - filteredItem[fields[field]] = item[field]; - } - } - } + this.body = null; +}; - return filteredItem; - }; +/** + * Set a custom time bar + * @param {Date} time + * @param {number} [id=undefined] Optional id of the custom time bar to be adjusted. + */ +Core.prototype.setCustomTime = function (time, id) { + var customTimes = this.customTimes.filter(function (component) { + return id === component.options.id; + }); - /** - * Sort the provided array with items - * @param {Object[]} items - * @param {String | function} order A field name or custom sort function. - * @private - */ - DataSet.prototype._sort = function (items, order) { - if (util.isString(order)) { - // order by provided field name - var name = order; // field name - items.sort(function (a, b) { - var av = a[name]; - var bv = b[name]; - return av > bv ? 1 : av < bv ? -1 : 0; - }); - } else if (typeof order === 'function') { - // order by sort function - items.sort(order); - } - // TODO: extend order by an Object {field:String, direction:String} - // where direction can be 'asc' or 'desc' - else { - throw new TypeError('Order must be a function or a string'); - } - }; + if (customTimes.length === 0) { + throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); + } - /** - * Remove an object by pointer or by id - * @param {String | Number | Object | Array} id Object or id, or an array with - * objects or ids to be removed - * @param {String} [senderId] Optional sender id - * @return {Array} removedIds - */ - DataSet.prototype.remove = function (id, senderId) { - var removedIds = [], - removedItems = [], - ids = [], - i, - len, - itemId, - item; + if (customTimes.length > 0) { + customTimes[0].setCustomTime(time); + } +}; - // force everything to be an array for simplicity - ids = Array.isArray(id) ? id : [id]; +/** + * Retrieve the current custom time. + * @param {number} [id=undefined] Id of the custom time bar. + * @return {Date | undefined} customTime + */ +Core.prototype.getCustomTime = function (id) { + var customTimes = this.customTimes.filter(function (component) { + return component.options.id === id; + }); - for (i = 0, len = ids.length; i < len; i++) { - item = this._remove(ids[i]); - if (item) { - itemId = item[this._fieldId]; - if (itemId != undefined) { - removedIds.push(itemId); - removedItems.push(item); - } - } - } + if (customTimes.length === 0) { + throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); + } + return customTimes[0].getCustomTime(); +}; - if (removedIds.length) { - this._trigger('remove', { items: removedIds, oldData: removedItems }, senderId); - } +/** + * Set a custom title for the custom time bar. + * @param {string} [title] Custom title + * @param {number} [id=undefined] Id of the custom time bar. + * @returns {*} + */ +Core.prototype.setCustomTimeTitle = function (title, id) { + var customTimes = this.customTimes.filter(function (component) { + return component.options.id === id; + }); - return removedIds; - }; + if (customTimes.length === 0) { + throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); + } + if (customTimes.length > 0) { + return customTimes[0].setCustomTitle(title); + } +}; - /** - * Remove an item by its id - * @param {Number | String | Object} id id or item - * @returns {Number | String | null} id - * @private - */ - DataSet.prototype._remove = function (id) { - var item, ident; +/** + * Retrieve meta information from an event. + * Should be overridden by classes extending Core + * @param {Event} event + * @return {Object} An object with related information. + */ +Core.prototype.getEventProperties = function (event) { + return { event: event }; +}; - // confirm the id to use based on the args type - if (util.isNumber(id) || util.isString(id)) { - ident = id; - } else if (id && (typeof id === 'undefined' ? 'undefined' : (0, _typeof3['default'])(id)) === 'object') { - ident = id[this._fieldId]; // look for the identifier field using _fieldId - } +/** + * Add custom vertical bar + * @param {Date | string | number} [time] A Date, unix timestamp, or + * ISO date string. Time point where + * the new bar should be placed. + * If not provided, `new Date()` will + * be used. + * @param {number | string} [id=undefined] Id of the new bar. Optional + * @return {number | string} Returns the id of the new bar + */ +Core.prototype.addCustomTime = function (time, id) { + var timestamp = time !== undefined ? util.convert(time, 'Date').valueOf() : new Date(); + + var exists = this.customTimes.some(function (customTime) { + return customTime.options.id === id; + }); + if (exists) { + throw new Error('A custom time with id ' + (0, _stringify2['default'])(id) + ' already exists'); + } - // do the remove if the item is found - if (ident !== undefined && this._data[ident]) { - item = this._data[ident]; - delete this._data[ident]; - this.length--; - return item; - } - return null; - }; + var customTime = new CustomTime(this.body, util.extend({}, this.options, { + time: timestamp, + id: id + })); - /** - * Clear the data - * @param {String} [senderId] Optional sender id - * @return {Array} removedIds The ids of all removed items - */ - DataSet.prototype.clear = function (senderId) { - var i, len; - var ids = (0, _keys2['default'])(this._data); - var items = []; + this.customTimes.push(customTime); + this.components.push(customTime); + this._redraw(); - for (i = 0, len = ids.length; i < len; i++) { - items.push(this._data[ids[i]]); - } + return id; +}; - this._data = {}; - this.length = 0; +/** + * Remove previously added custom bar + * @param {int} id ID of the custom bar to be removed + * [at]returns {boolean} True if the bar exists and is removed, false otherwise + */ +Core.prototype.removeCustomTime = function (id) { + var customTimes = this.customTimes.filter(function (bar) { + return bar.options.id === id; + }); - this._trigger('remove', { items: ids, oldData: items }, senderId); + if (customTimes.length === 0) { + throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); + } - return ids; - }; + customTimes.forEach(function (customTime) { + this.customTimes.splice(this.customTimes.indexOf(customTime), 1); + this.components.splice(this.components.indexOf(customTime), 1); + customTime.destroy(); + }.bind(this)); +}; - /** - * Find the item with maximum value of a specified field - * @param {String} field - * @return {Object | null} item Item containing max value, or null if no items - */ - DataSet.prototype.max = function (field) { - var data = this._data, - itemIds = (0, _keys2['default'])(data), - max = null, - maxField = null, - i, - len; +/** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ +Core.prototype.getVisibleItems = function () { + return this.itemSet && this.itemSet.getVisibleItems() || []; +}; - for (i = 0, len = itemIds.length; i < len; i++) { - var id = itemIds[i]; - var item = data[id]; - var itemField = item[field]; - if (itemField != null && (!max || itemField > maxField)) { - max = item; - maxField = itemField; - } - } +/** + * Set Core window such that it fits all items + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ +Core.prototype.fit = function (options, callback) { + var range = this.getDataRange(); + + // skip range set if there is no min and max date + if (range.min === null && range.max === null) { + return; + } + + // apply a margin of 1% left and right of the data + var interval = range.max - range.min; + var min = new Date(range.min.valueOf() - interval * 0.01); + var max = new Date(range.max.valueOf() + interval * 0.01); + var animation = options && options.animation !== undefined ? options.animation : true; + this.range.setRange(min, max, { animation: animation }, callback); +}; - return max; - }; +/** + * Calculate the data range of the items start and end dates + * [at]returns {{min: [Date], max: [Date]}} + * @protected + */ +Core.prototype.getDataRange = function () { + // must be implemented by Timeline and Graph2d + throw new Error('Cannot invoke abstract method getDataRange'); +}; - /** - * Find the item with minimum value of a specified field - * @param {String} field - * @return {Object | null} item Item containing max value, or null if no items - */ - DataSet.prototype.min = function (field) { - var data = this._data, - itemIds = (0, _keys2['default'])(data), - min = null, - minField = null, - i, - len; +/** + * Set the visible window. Both parameters are optional, you can change only + * start or only end. Syntax: + * + * TimeLine.setWindow(start, end) + * TimeLine.setWindow(start, end, options) + * TimeLine.setWindow(range) + * + * Where start and end can be a Date, number, or string, and range is an + * object with properties start and end. + * + * @param {Date | number | string | Object} [start] Start date of visible window + * @param {Date | number | string} [end] End date of visible window + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ +Core.prototype.setWindow = function (start, end, options, callback) { + if (typeof arguments[2] == "function") { + callback = arguments[2]; + options = {}; + } + var animation; + var range; + if (arguments.length == 1) { + range = arguments[0]; + animation = range.animation !== undefined ? range.animation : true; + this.range.setRange(range.start, range.end, { animation: animation }); + } else if (arguments.length == 2 && typeof arguments[1] == "function") { + range = arguments[0]; + callback = arguments[1]; + animation = range.animation !== undefined ? range.animation : true; + this.range.setRange(range.start, range.end, { animation: animation }, callback); + } else { + animation = options && options.animation !== undefined ? options.animation : true; + this.range.setRange(start, end, { animation: animation }, callback); + } +}; - for (i = 0, len = itemIds.length; i < len; i++) { - var id = itemIds[i]; - var item = data[id]; - var itemField = item[field]; - if (itemField != null && (!min || itemField < minField)) { - min = item; - minField = itemField; - } - } +/** + * Move the window such that given time is centered on screen. + * @param {Date | number | string} time + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ +Core.prototype.moveTo = function (time, options, callback) { + if (typeof arguments[1] == "function") { + callback = arguments[1]; + options = {}; + } + var interval = this.range.end - this.range.start; + var t = util.convert(time, 'Date').valueOf(); + + var start = t - interval / 2; + var end = t + interval / 2; + var animation = options && options.animation !== undefined ? options.animation : true; + + this.range.setRange(start, end, { animation: animation }, callback); +}; - return min; +/** + * Get the visible window + * @return {{start: Date, end: Date}} Visible range + */ +Core.prototype.getWindow = function () { + var range = this.range.getRange(); + return { + start: new Date(range.start), + end: new Date(range.end) }; +}; - /** - * Find all distinct values of a specified field - * @param {String} field - * @return {Array} values Array containing all distinct values. If data items - * do not contain the specified field are ignored. - * The returned array is unordered. - */ - DataSet.prototype.distinct = function (field) { - var data = this._data; - var itemIds = (0, _keys2['default'])(data); - var values = []; - var fieldType = this._options.type && this._options.type[field] || null; - var count = 0; - var i, j, len; - - for (i = 0, len = itemIds.length; i < len; i++) { - var id = itemIds[i]; - var item = data[id]; - var value = item[field]; - var exists = false; - for (j = 0; j < count; j++) { - if (values[j] == value) { - exists = true; - break; - } - } - if (!exists && value !== undefined) { - values[count] = value; - count++; - } - } +/** + * Zoom in the window such that given time is centered on screen. + * @param {number} percentage - must be between [0..1] + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ +Core.prototype.zoomIn = function (percentage, options, callback) { + if (!percentage || percentage < 0 || percentage > 1) return; + if (typeof arguments[1] == "function") { + callback = arguments[1]; + options = {}; + } + var range = this.getWindow(); + var start = range.start.valueOf(); + var end = range.end.valueOf(); + var interval = end - start; + var newInterval = interval / (1 + percentage); + var distance = (interval - newInterval) / 2; + var newStart = start + distance; + var newEnd = end - distance; + + this.setWindow(newStart, newEnd, options, callback); +}; - if (fieldType) { - for (i = 0, len = values.length; i < len; i++) { - values[i] = util.convert(values[i], fieldType); - } - } +/** + * Zoom out the window such that given time is centered on screen. + * @param {number} percentage - must be between [0..1] + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] a callback funtion to be executed at the end of this function + */ +Core.prototype.zoomOut = function (percentage, options, callback) { + if (!percentage || percentage < 0 || percentage > 1) return; + if (typeof arguments[1] == "function") { + callback = arguments[1]; + options = {}; + } + var range = this.getWindow(); + var start = range.start.valueOf(); + var end = range.end.valueOf(); + var interval = end - start; + var newStart = start - interval * percentage / 2; + var newEnd = end + interval * percentage / 2; + + this.setWindow(newStart, newEnd, options, callback); +}; - return values; - }; +/** + * Force a redraw. Can be overridden by implementations of Core + * + * Note: this function will be overridden on construction with a trottled version + */ +Core.prototype.redraw = function () { + this._redraw(); +}; - /** - * Add a single item. Will fail when an item with the same id already exists. - * @param {Object} item - * @return {String} id - * @private - */ - DataSet.prototype._addItem = function (item) { - var id = item[this._fieldId]; +/** + * Redraw for internal use. Redraws all components. See also the public + * method redraw. + * @protected + */ +Core.prototype._redraw = function () { + this.redrawCount++; + var resized = false; + var options = this.options; + var props = this.props; + var dom = this.dom; + + if (!dom || !dom.container || dom.root.offsetWidth == 0) return; // when destroyed, or invisible + + DateUtil.updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates); + + // update class names + if (options.orientation == 'top') { + util.addClassName(dom.root, 'vis-top'); + util.removeClassName(dom.root, 'vis-bottom'); + } else { + util.removeClassName(dom.root, 'vis-top'); + util.addClassName(dom.root, 'vis-bottom'); + } + + // update root width and height options + dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); + dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); + dom.root.style.width = util.option.asSize(options.width, ''); + + // calculate border widths + props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; + props.border.right = props.border.left; + props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; + props.border.bottom = props.border.top; + props.borderRootHeight = dom.root.offsetHeight - dom.root.clientHeight; + props.borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; + + // workaround for a bug in IE: the clientWidth of an element with + // a height:0px and overflow:hidden is not calculated and always has value 0 + if (dom.centerContainer.clientHeight === 0) { + props.border.left = props.border.top; + props.border.right = props.border.left; + } + if (dom.root.clientHeight === 0) { + props.borderRootWidth = props.borderRootHeight; + } - if (id != undefined) { - // check whether this id is already taken - if (this._data[id]) { - // item already exists - throw new Error('Cannot add item: item with id ' + id + ' already exists'); - } - } else { - // generate an id - id = util.randomUUID(); - item[this._fieldId] = id; - } + // calculate the heights. If any of the side panels is empty, we set the height to + // minus the border width, such that the border will be invisible + props.center.height = dom.center.offsetHeight; + props.left.height = dom.left.offsetHeight; + props.right.height = dom.right.offsetHeight; + props.top.height = dom.top.clientHeight || -props.border.top; + props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; - var d = {}, - fields = (0, _keys2['default'])(item), - i, - len; - for (i = 0, len = fields.length; i < len; i++) { - var field = fields[i]; - var fieldType = this._type[field]; // type may be undefined - d[field] = util.convert(item[field], fieldType); - } - this._data[id] = d; - this.length++; + // TODO: compensate borders when any of the panels is empty. - return id; - }; + // apply auto height + // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) + var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); + var autoHeight = props.top.height + contentHeight + props.bottom.height + props.borderRootHeight + props.border.top + props.border.bottom; + dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); - /** - * Get an item. Fields can be converted to a specific type - * @param {String} id - * @param {Object.} [types] field types to convert - * @return {Object | null} item - * @private - */ - DataSet.prototype._getItem = function (id, types) { - var field, value, i, len; + // calculate heights of the content panels + props.root.height = dom.root.offsetHeight; + props.background.height = props.root.height - props.borderRootHeight; + var containerHeight = props.root.height - props.top.height - props.bottom.height - props.borderRootHeight; + props.centerContainer.height = containerHeight; + props.leftContainer.height = containerHeight; + props.rightContainer.height = props.leftContainer.height; - // get the item from the dataset - var raw = this._data[id]; - if (!raw) { - return null; - } + // calculate the widths of the panels + props.root.width = dom.root.offsetWidth; + props.background.width = props.root.width - props.borderRootWidth; - // convert the items field types - var converted = {}, - fields = (0, _keys2['default'])(raw); + if (!this.initialDrawDone) { + props.scrollbarWidth = util.getScrollBarWidth(); + } - if (types) { - for (i = 0, len = fields.length; i < len; i++) { - field = fields[i]; - value = raw[field]; - converted[field] = util.convert(value, types[field]); - } + if (options.verticalScroll) { + if (options.rtl) { + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.right.width = dom.rightContainer.clientWidth + props.scrollbarWidth || -props.border.right; } else { - // no field types specified, no converting needed - for (i = 0, len = fields.length; i < len; i++) { - field = fields[i]; - value = raw[field]; - converted[field] = value; - } + props.left.width = dom.leftContainer.clientWidth + props.scrollbarWidth || -props.border.left; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; } + } else { + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; + } - if (!converted[this._fieldId]) { - converted[this._fieldId] = raw.id; - } + this._setDOM(); - return converted; - }; + // update the scrollTop, feasible range for the offset can be changed + // when the height of the Core or of the contents of the center changed + var offset = this._updateScrollTop(); - /** - * Update a single item: merge with existing item. - * Will fail when the item has no id, or when there does not exist an item - * with the same id. - * @param {Object} item - * @return {String} id - * @private - */ - DataSet.prototype._updateItem = function (item) { - var id = item[this._fieldId]; - if (id == undefined) { - throw new Error('Cannot update item: item has no id (item: ' + (0, _stringify2['default'])(item) + ')'); - } - var d = this._data[id]; - if (!d) { - // item doesn't exist - throw new Error('Cannot update item: no item with id ' + id + ' found'); - } + // reposition the scrollable contents + if (options.orientation.item != 'top') { + offset += Math.max(props.centerContainer.height - props.center.height - props.border.top - props.border.bottom, 0); + } + dom.center.style.top = offset + 'px'; - // merge with current item - var fields = (0, _keys2['default'])(item); - for (var i = 0, len = fields.length; i < len; i++) { - var field = fields[i]; - var fieldType = this._type[field]; // type may be undefined - d[field] = util.convert(item[field], fieldType); - } + // show shadows when vertical scrolling is available + var visibilityTop = props.scrollTop == 0 ? 'hidden' : ''; + var visibilityBottom = props.scrollTop == props.scrollTopMin ? 'hidden' : ''; + dom.shadowTop.style.visibility = visibilityTop; + dom.shadowBottom.style.visibility = visibilityBottom; + dom.shadowTopLeft.style.visibility = visibilityTop; + dom.shadowBottomLeft.style.visibility = visibilityBottom; + dom.shadowTopRight.style.visibility = visibilityTop; + dom.shadowBottomRight.style.visibility = visibilityBottom; - return id; - }; + if (options.verticalScroll) { + dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; + dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; - module.exports = DataSet; + dom.shadowTopRight.style.visibility = "hidden"; + dom.shadowBottomRight.style.visibility = "hidden"; + dom.shadowTopLeft.style.visibility = "hidden"; + dom.shadowBottomLeft.style.visibility = "hidden"; -/***/ }), -/* 90 */ -/***/ (function(module, exports, __webpack_require__) { - - module.exports = { "default": __webpack_require__(91), __esModule: true }; - -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { + dom.left.style.top = '0px'; + dom.right.style.top = '0px'; + } - var core = __webpack_require__(17) - , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify}); - module.exports = function stringify(it){ // eslint-disable-line no-unused-vars - return $JSON.stringify.apply($JSON, arguments); - }; + if (!options.verticalScroll || props.center.height < props.centerContainer.height) { + dom.left.style.top = offset + 'px'; + dom.right.style.top = offset + 'px'; + dom.rightContainer.className = dom.rightContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' '); + dom.leftContainer.className = dom.leftContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' '); + props.left.width = dom.leftContainer.clientWidth || -props.border.left; + props.right.width = dom.rightContainer.clientWidth || -props.border.right; + this._setDOM(); + } -/***/ }), -/* 92 */ -/***/ (function(module, exports) { + // enable/disable vertical panning + var contentsOverflow = props.center.height > props.centerContainer.height; + this.hammer.get('pan').set({ + direction: contentsOverflow ? Hammer.DIRECTION_ALL : Hammer.DIRECTION_HORIZONTAL + }); - 'use strict'; + // redraw all components + this.components.forEach(function (component) { + resized = component.redraw() || resized; + }); + var MAX_REDRAW = 5; + if (resized) { + if (this.redrawCount < MAX_REDRAW) { + this.body.emitter.emit('_change'); + return; + } else { + console.log('WARNING: infinite loop in redraw?'); + } + } else { + this.redrawCount = 0; + } - /** - * A queue - * @param {Object} options - * Available options: - * - delay: number When provided, the queue will be flushed - * automatically after an inactivity of this delay - * in milliseconds. - * Default value is null. - * - max: number When the queue exceeds the given maximum number - * of entries, the queue is flushed automatically. - * Default value of max is Infinity. - * @constructor - */ - function Queue(options) { - // options - this.delay = null; - this.max = Infinity; - - // properties - this._queue = []; - this._timeout = null; - this._extended = null; + //Emit public 'changed' event for UI updates, see issue #1592 + this.body.emitter.emit("changed"); +}; + +Core.prototype._setDOM = function () { + var props = this.props; + var dom = this.dom; + + props.leftContainer.width = props.left.width; + props.rightContainer.width = props.right.width; + var centerWidth = props.root.width - props.left.width - props.right.width - props.borderRootWidth; + props.center.width = centerWidth; + props.centerContainer.width = centerWidth; + props.top.width = centerWidth; + props.bottom.width = centerWidth; + + // resize the panels + dom.background.style.height = props.background.height + 'px'; + dom.backgroundVertical.style.height = props.background.height + 'px'; + dom.backgroundHorizontal.style.height = props.centerContainer.height + 'px'; + dom.centerContainer.style.height = props.centerContainer.height + 'px'; + dom.leftContainer.style.height = props.leftContainer.height + 'px'; + dom.rightContainer.style.height = props.rightContainer.height + 'px'; + + dom.background.style.width = props.background.width + 'px'; + dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; + dom.backgroundHorizontal.style.width = props.background.width + 'px'; + dom.centerContainer.style.width = props.center.width + 'px'; + dom.top.style.width = props.top.width + 'px'; + dom.bottom.style.width = props.bottom.width + 'px'; + + // reposition the panels + dom.background.style.left = '0'; + dom.background.style.top = '0'; + dom.backgroundVertical.style.left = props.left.width + props.border.left + 'px'; + dom.backgroundVertical.style.top = '0'; + dom.backgroundHorizontal.style.left = '0'; + dom.backgroundHorizontal.style.top = props.top.height + 'px'; + dom.centerContainer.style.left = props.left.width + 'px'; + dom.centerContainer.style.top = props.top.height + 'px'; + dom.leftContainer.style.left = '0'; + dom.leftContainer.style.top = props.top.height + 'px'; + dom.rightContainer.style.left = props.left.width + props.center.width + 'px'; + dom.rightContainer.style.top = props.top.height + 'px'; + dom.top.style.left = props.left.width + 'px'; + dom.top.style.top = '0'; + dom.bottom.style.left = props.left.width + 'px'; + dom.bottom.style.top = props.top.height + props.centerContainer.height + 'px'; + dom.center.style.left = '0'; + dom.left.style.left = '0'; + dom.right.style.left = '0'; +}; + +// TODO: deprecated since version 1.1.0, remove some day +Core.prototype.repaint = function () { + throw new Error('Function repaint is deprecated. Use redraw instead.'); +}; - this.setOptions(options); +/** + * Set a current time. This can be used for example to ensure that a client's + * time is synchronized with a shared server time. + * Only applicable when option `showCurrentTime` is true. + * @param {Date | string | number} time A Date, unix timestamp, or + * ISO date string. + */ +Core.prototype.setCurrentTime = function (time) { + if (!this.currentTime) { + throw new Error('Option showCurrentTime must be true'); } - /** - * Update the configuration of the queue - * @param {Object} options - * Available options: - * - delay: number When provided, the queue will be flushed - * automatically after an inactivity of this delay - * in milliseconds. - * Default value is null. - * - max: number When the queue exceeds the given maximum number - * of entries, the queue is flushed automatically. - * Default value of max is Infinity. - * @param options - */ - Queue.prototype.setOptions = function (options) { - if (options && typeof options.delay !== 'undefined') { - this.delay = options.delay; - } - if (options && typeof options.max !== 'undefined') { - this.max = options.max; - } - - this._flushIfNeeded(); - }; + this.currentTime.setCurrentTime(time); +}; - /** - * Extend an object with queuing functionality. - * The object will be extended with a function flush, and the methods provided - * in options.replace will be replaced with queued ones. - * @param {Object} object - * @param {Object} options - * Available options: - * - replace: Array. - * A list with method names of the methods - * on the object to be replaced with queued ones. - * - delay: number When provided, the queue will be flushed - * automatically after an inactivity of this delay - * in milliseconds. - * Default value is null. - * - max: number When the queue exceeds the given maximum number - * of entries, the queue is flushed automatically. - * Default value of max is Infinity. - * @return {Queue} Returns the created queue - */ - Queue.extend = function (object, options) { - var queue = new Queue(options); +/** + * Get the current time. + * Only applicable when option `showCurrentTime` is true. + * @return {Date} Returns the current time. + */ +Core.prototype.getCurrentTime = function () { + if (!this.currentTime) { + throw new Error('Option showCurrentTime must be true'); + } - if (object.flush !== undefined) { - throw new Error('Target object already has a property flush'); - } - object.flush = function () { - queue.flush(); - }; + return this.currentTime.getCurrentTime(); +}; - var methods = [{ - name: 'flush', - original: undefined - }]; +/** + * Convert a position on screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @protected + */ +// TODO: move this function to Range +Core.prototype._toTime = function (x) { + return DateUtil.toTime(this, x, this.props.center.width); +}; - if (options && options.replace) { - for (var i = 0; i < options.replace.length; i++) { - var name = options.replace[i]; - methods.push({ - name: name, - original: object[name] - }); - queue.replace(object, name); - } - } +/** + * Convert a position on the global screen (pixels) to a datetime + * @param {int} x Position on the screen in pixels + * @return {Date} time The datetime the corresponds with given position x + * @protected + */ +// TODO: move this function to Range +Core.prototype._toGlobalTime = function (x) { + return DateUtil.toTime(this, x, this.props.root.width); + //var conversion = this.range.conversion(this.props.root.width); + //return new Date(x / conversion.scale + conversion.offset); +}; - queue._extended = { - object: object, - methods: methods - }; +/** + * Convert a datetime (Date object) into a position on the screen + * @param {Date} time A date + * @return {int} x The position on the screen in pixels which corresponds + * with the given date. + * @protected + */ +// TODO: move this function to Range +Core.prototype._toScreen = function (time) { + return DateUtil.toScreen(this, time, this.props.center.width); +}; - return queue; - }; +/** + * Convert a datetime (Date object) into a position on the root + * This is used to get the pixel density estimate for the screen, not the center panel + * @param {Date} time A date + * @return {int} x The position on root in pixels which corresponds + * with the given date. + * @protected + */ +// TODO: move this function to Range +Core.prototype._toGlobalScreen = function (time) { + return DateUtil.toScreen(this, time, this.props.root.width); + //var conversion = this.range.conversion(this.props.root.width); + //return (time.valueOf() - conversion.offset) * conversion.scale; +}; - /** - * Destroy the queue. The queue will first flush all queued actions, and in - * case it has extended an object, will restore the original object. - */ - Queue.prototype.destroy = function () { - this.flush(); +/** + * Initialize watching when option autoResize is true + * @private + */ +Core.prototype._initAutoResize = function () { + if (this.options.autoResize == true) { + this._startAutoResize(); + } else { + this._stopAutoResize(); + } +}; - if (this._extended) { - var object = this._extended.object; - var methods = this._extended.methods; - for (var i = 0; i < methods.length; i++) { - var method = methods[i]; - if (method.original) { - object[method.name] = method.original; - } else { - delete object[method.name]; - } - } - this._extended = null; +/** + * Watch for changes in the size of the container. On resize, the Panel will + * automatically redraw itself. + * @private + */ +Core.prototype._startAutoResize = function () { + var me = this; + + this._stopAutoResize(); + + this._onResize = function () { + if (me.options.autoResize != true) { + // stop watching when the option autoResize is changed to false + me._stopAutoResize(); + return; } - }; - /** - * Replace a method on an object with a queued version - * @param {Object} object Object having the method - * @param {string} method The method name - */ - Queue.prototype.replace = function (object, method) { - var me = this; - var original = object[method]; - if (!original) { - throw new Error('Method ' + method + ' undefined'); - } + if (me.dom.root) { + // check whether the frame is resized + // Note: we compare offsetWidth here, not clientWidth. For some reason, + // IE does not restore the clientWidth from 0 to the actual width after + // changing the timeline's container display style from none to visible + if (me.dom.root.offsetWidth != me.props.lastWidth || me.dom.root.offsetHeight != me.props.lastHeight) { + me.props.lastWidth = me.dom.root.offsetWidth; + me.props.lastHeight = me.dom.root.offsetHeight; + me.props.scrollbarWidth = util.getScrollBarWidth(); - object[method] = function () { - // create an Array with the arguments - var args = []; - for (var i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; + me.body.emitter.emit('_change'); } - - // add this call to the queue - me.queue({ - args: args, - fn: original, - context: this - }); - }; - }; - - /** - * Queue a call - * @param {function | {fn: function, args: Array} | {fn: function, args: Array, context: Object}} entry - */ - Queue.prototype.queue = function (entry) { - if (typeof entry === 'function') { - this._queue.push({ fn: entry }); - } else { - this._queue.push(entry); - } - - this._flushIfNeeded(); - }; - - /** - * Check whether the queue needs to be flushed - * @private - */ - Queue.prototype._flushIfNeeded = function () { - // flush when the maximum is exceeded. - if (this._queue.length > this.max) { - this.flush(); - } - - // flush after a period of inactivity when a delay is configured - clearTimeout(this._timeout); - if (this.queue.length > 0 && typeof this.delay === 'number') { - var me = this; - this._timeout = setTimeout(function () { - me.flush(); - }, this.delay); } }; - /** - * Flush all queued calls - */ - Queue.prototype.flush = function () { - while (this._queue.length > 0) { - var entry = this._queue.shift(); - entry.fn.apply(entry.context || entry.fn, entry.args || []); - } - }; + // add event listener to window resize + util.addEventListener(window, 'resize', this._onResize); - module.exports = Queue; + //Prevent initial unnecessary redraw + if (me.dom.root) { + me.props.lastWidth = me.dom.root.offsetWidth; + me.props.lastHeight = me.dom.root.offsetHeight; + } -/***/ }), -/* 93 */ -/***/ (function(module, exports, __webpack_require__) { + this.watchTimer = setInterval(this._onResize, 1000); +}; - 'use strict'; +/** + * Stop watching for a resize of the frame. + * @private + */ +Core.prototype._stopAutoResize = function () { + if (this.watchTimer) { + clearInterval(this.watchTimer); + this.watchTimer = undefined; + } - var _keys = __webpack_require__(58); + // remove event listener on window.resize + if (this._onResize) { + util.removeEventListener(window, 'resize', this._onResize); + this._onResize = null; + } +}; - var _keys2 = _interopRequireDefault(_keys); +/** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ +Core.prototype._onTouch = function (event) { + // eslint-disable-line no-unused-vars + this.touch.allowDragging = true; + this.touch.initialScrollTop = this.props.scrollTop; +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +/** + * Start moving the timeline vertically + * @param {Event} event + * @private + */ +Core.prototype._onPinch = function (event) { + // eslint-disable-line no-unused-vars + this.touch.allowDragging = false; +}; - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); +/** + * Move the timeline vertically + * @param {Event} event + * @private + */ +Core.prototype._onDrag = function (event) { + if (!event) return; + // refuse to drag when we where pinching to prevent the timeline make a jump + // when releasing the fingers in opposite order from the touch screen + if (!this.touch.allowDragging) return; - /** - * DataView - * - * a dataview offers a filtered view on a dataset or an other dataview. - * - * @param {DataSet | DataView} data - * @param {Object} [options] Available options: see method get - * - * @constructor DataView - */ - function DataView(data, options) { - this._data = null; - this._ids = {}; // ids of the items currently in memory (just contains a boolean true) - this.length = 0; // number of items in the DataView - this._options = options || {}; - this._fieldId = 'id'; // name of the field containing id - this._subscribers = {}; // event subscribers + var delta = event.deltaY; - var me = this; - this.listener = function () { - me._onEvent.apply(me, arguments); - }; + var oldScrollTop = this._getScrollTop(); + var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); - this.setData(data); + if (this.options.verticalScroll) { + this.dom.left.parentNode.scrollTop = -this.props.scrollTop; + this.dom.right.parentNode.scrollTop = -this.props.scrollTop; } - // TODO: implement a function .config() to dynamically update things like configured filter - // and trigger changes accordingly - - /** - * Set a data source for the view - * @param {DataSet | DataView} data - */ - DataView.prototype.setData = function (data) { - var ids, id, i, len, items; - - if (this._data) { - // unsubscribe from current dataset - if (this._data.off) { - this._data.off('*', this.listener); - } - - // trigger a remove of all items in memory - ids = this._data.getIds({ filter: this._options && this._options.filter }); - items = []; + if (newScrollTop != oldScrollTop) { + this.emit("verticalDrag"); + } +}; - for (i = 0, len = ids.length; i < len; i++) { - items.push(this._data._data[ids[i]]); - } +/** + * Apply a scrollTop + * @param {number} scrollTop + * @returns {number} scrollTop Returns the applied scrollTop + * @private + */ +Core.prototype._setScrollTop = function (scrollTop) { + this.props.scrollTop = scrollTop; + this._updateScrollTop(); + return this.props.scrollTop; +}; - this._ids = {}; - this.length = 0; - this._trigger('remove', { items: ids, oldData: items }); +/** + * Update the current scrollTop when the height of the containers has been changed + * @returns {number} scrollTop Returns the applied scrollTop + * @private + */ +Core.prototype._updateScrollTop = function () { + // recalculate the scrollTopMin + var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero + if (scrollTopMin != this.props.scrollTopMin) { + // in case of bottom orientation, change the scrollTop such that the contents + // do not move relative to the time axis at the bottom + if (this.options.orientation.item != 'top') { + this.props.scrollTop += scrollTopMin - this.props.scrollTopMin; } + this.props.scrollTopMin = scrollTopMin; + } - this._data = data; + // limit the scrollTop to the feasible scroll range + if (this.props.scrollTop > 0) this.props.scrollTop = 0; + if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; - if (this._data) { - // update fieldId - this._fieldId = this._options.fieldId || this._data && this._data.options && this._data.options.fieldId || 'id'; + if (this.options.verticalScroll) { + this.dom.left.parentNode.scrollTop = -this.props.scrollTop; + this.dom.right.parentNode.scrollTop = -this.props.scrollTop; + } - // trigger an add of all added items - ids = this._data.getIds({ filter: this._options && this._options.filter }); - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - this._ids[id] = true; - } - this.length = ids.length; - this._trigger('add', { items: ids }); + return this.props.scrollTop; +}; - // subscribe to new dataset - if (this._data.on) { - this._data.on('*', this.listener); - } - } - }; +/** + * Get the current scrollTop + * @returns {number} scrollTop + * @private + */ +Core.prototype._getScrollTop = function () { + return this.props.scrollTop; +}; - /** - * Refresh the DataView. Useful when the DataView has a filter function - * containing a variable parameter. - */ - DataView.prototype.refresh = function () { - var id, i, len; - var ids = this._data.getIds({ filter: this._options && this._options.filter }), - oldIds = (0, _keys2['default'])(this._ids), - newIds = {}, - addedIds = [], - removedIds = [], - removedItems = []; - - // check for additions - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - newIds[id] = true; - if (!this._ids[id]) { - addedIds.push(id); - this._ids[id] = true; - } - } +/** + * Load a configurator + * [at]returns {Object} + * @private + */ +Core.prototype._createConfigurator = function () { + throw new Error('Cannot invoke abstract method _createConfigurator'); +}; - // check for removals - for (i = 0, len = oldIds.length; i < len; i++) { - id = oldIds[i]; - if (!newIds[id]) { - removedIds.push(id); - removedItems.push(this._data._data[id]); - delete this._ids[id]; - } - } +module.exports = Core; - this.length += addedIds.length - removedIds.length; +/***/ }), +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { - // trigger events - if (addedIds.length) { - this._trigger('add', { items: addedIds }); - } - if (removedIds.length) { - this._trigger('remove', { items: removedIds, oldData: removedItems }); - } - }; +"use strict"; - /** - * Get data from the data view - * - * Usage: - * - * get() - * get(options: Object) - * get(options: Object, data: Array | DataTable) - * - * get(id: Number) - * get(id: Number, options: Object) - * get(id: Number, options: Object, data: Array | DataTable) - * - * get(ids: Number[]) - * get(ids: Number[], options: Object) - * get(ids: Number[], options: Object, data: Array | DataTable) - * - * Where: - * - * {Number | String} id The id of an item - * {Number[] | String{}} ids An array with ids of items - * {Object} options An Object with options. Available options: - * {String} [type] Type of data to be returned. Can - * be 'DataTable' or 'Array' (default) - * {Object.} [convert] - * {String[]} [fields] field names to be returned - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * {Array | DataTable} [data] If provided, items will be appended to this - * array or table. Required in case of Google - * DataTable. - * @param args - */ - DataView.prototype.get = function (args) { - var me = this; - // parse the arguments - var ids, options, data; - var firstType = util.getType(arguments[0]); - if (firstType == 'String' || firstType == 'Number' || firstType == 'Array') { - // get(id(s) [, options] [, data]) - ids = arguments[0]; // can be a single id or an array with ids - options = arguments[1]; - data = arguments[2]; - } else { - // get([, options] [, data]) - options = arguments[0]; - data = arguments[1]; - } +var moment = __webpack_require__(9); +var DateUtil = __webpack_require__(36); +var util = __webpack_require__(2); - // extend the options with the default options and provided options - var viewOptions = util.extend({}, this._options, options); +/** + * The class TimeStep is an iterator for dates. You provide a start date and an + * end date. The class itself determines the best scale (step size) based on the + * provided start Date, end Date, and minimumStep. + * + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * + * Alternatively, you can set a scale by hand. + * After creation, you can initialize the class by executing first(). Then you + * can iterate from the start date to the end date via next(). You can check if + * the end date is reached with the function hasNext(). After each step, you can + * retrieve the current date via getCurrent(). + * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours, + * days, to years. + * + * Version: 1.2 + * + * @param {Date} [start] The start date, for example new Date(2010, 9, 21) + * or new Date(2010, 9, 21, 23, 45, 00) + * @param {Date} [end] The end date + * @param {number} [minimumStep] Optional. Minimum step size in milliseconds + * @param {Date|Array.} [hiddenDates] Optional. + * @param {{showMajorLabels: boolean}} [options] Optional. + * @constructor TimeStep + */ +function TimeStep(start, end, minimumStep, hiddenDates, options) { + this.moment = moment; + + // variables + this.current = this.moment(); + this._start = this.moment(); + this._end = this.moment(); + + this.autoScale = true; + this.scale = 'day'; + this.step = 1; + + // initialize the range + this.setRange(start, end, minimumStep); + + // hidden Dates options + this.switchedDay = false; + this.switchedMonth = false; + this.switchedYear = false; + if (Array.isArray(hiddenDates)) { + this.hiddenDates = hiddenDates; + } else if (hiddenDates != undefined) { + this.hiddenDates = [hiddenDates]; + } else { + this.hiddenDates = []; + } + + this.format = TimeStep.FORMAT; // default formatting + this.options = options ? options : {}; +} + +// Time formatting +TimeStep.FORMAT = { + minorLabels: { + millisecond: 'SSS', + second: 's', + minute: 'HH:mm', + hour: 'HH:mm', + weekday: 'ddd D', + day: 'D', + week: 'w', + month: 'MMM', + year: 'YYYY' + }, + majorLabels: { + millisecond: 'HH:mm:ss', + second: 'D MMMM HH:mm', + minute: 'ddd D MMMM', + hour: 'ddd D MMMM', + weekday: 'MMMM YYYY', + day: 'MMMM YYYY', + week: 'MMMM YYYY', + month: 'YYYY', + year: '' + } +}; - // create a combined filter method when needed - if (this._options.filter && options && options.filter) { - viewOptions.filter = function (item) { - return me._options.filter(item) && options.filter(item); - }; - } +/** + * Set custom constructor function for moment. Can be used to set dates + * to UTC or to set a utcOffset. + * @param {function} moment + */ +TimeStep.prototype.setMoment = function (moment) { + this.moment = moment; + + // update the date properties, can have a new utcOffset + this.current = this.moment(this.current.valueOf()); + this._start = this.moment(this._start.valueOf()); + this._end = this.moment(this._end.valueOf()); +}; - // build up the call to the linked data set - var getArguments = []; - if (ids != undefined) { - getArguments.push(ids); - } - getArguments.push(viewOptions); - getArguments.push(data); +/** + * Set custom formatting for the minor an major labels of the TimeStep. + * Both `minorLabels` and `majorLabels` are an Object with properties: + * 'millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'. + * @param {{minorLabels: Object, majorLabels: Object}} format + */ +TimeStep.prototype.setFormat = function (format) { + var defaultFormat = util.deepExtend({}, TimeStep.FORMAT); + this.format = util.deepExtend(defaultFormat, format); +}; - return this._data && this._data.get.apply(this._data, getArguments); - }; +/** + * Set a new range + * If minimumStep is provided, the step size is chosen as close as possible + * to the minimumStep but larger than minimumStep. If minimumStep is not + * provided, the scale is set to 1 DAY. + * The minimumStep should correspond with the onscreen size of about 6 characters + * @param {Date} [start] The start date and time. + * @param {Date} [end] The end date and time. + * @param {int} [minimumStep] Optional. Minimum step size in milliseconds + */ +TimeStep.prototype.setRange = function (start, end, minimumStep) { + if (!(start instanceof Date) || !(end instanceof Date)) { + throw "No legal start or end date in method setRange"; + } - /** - * Get ids of all items or from a filtered set of items. - * @param {Object} [options] An Object with options. Available options: - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Array} ids - */ - DataView.prototype.getIds = function (options) { - var ids; + this._start = start != undefined ? this.moment(start.valueOf()) : new Date(); + this._end = end != undefined ? this.moment(end.valueOf()) : new Date(); - if (this._data) { - var defaultFilter = this._options.filter; - var filter; + if (this.autoScale) { + this.setMinimumStep(minimumStep); + } +}; - if (options && options.filter) { - if (defaultFilter) { - filter = function filter(item) { - return defaultFilter(item) && options.filter(item); - }; - } else { - filter = options.filter; - } - } else { - filter = defaultFilter; - } +/** + * Set the range iterator to the start date. + */ +TimeStep.prototype.start = function () { + this.current = this._start.clone(); + this.roundToMinor(); +}; - ids = this._data.getIds({ - filter: filter, - order: options && options.order - }); - } else { - ids = []; +/** + * Round the current date to the first minor date value + * This must be executed once when the current date is set to start Date + */ +TimeStep.prototype.roundToMinor = function () { + // round to floor + // to prevent year & month scales rounding down to the first day of week we perform this separately + if (this.scale == 'week') { + this.current.weekday(0); + } + // IMPORTANT: we have no breaks in this switch! (this is no bug) + // noinspection FallThroughInSwitchStatementJS + switch (this.scale) { + case 'year': + this.current.year(this.step * Math.floor(this.current.year() / this.step)); + this.current.month(0); + case 'month': + this.current.date(1); // eslint-disable-line no-fallthrough + case 'week': // eslint-disable-line no-fallthrough + case 'day': // eslint-disable-line no-fallthrough + case 'weekday': + this.current.hours(0); // eslint-disable-line no-fallthrough + case 'hour': + this.current.minutes(0); // eslint-disable-line no-fallthrough + case 'minute': + this.current.seconds(0); // eslint-disable-line no-fallthrough + case 'second': + this.current.milliseconds(0); // eslint-disable-line no-fallthrough + //case 'millisecond': // nothing to do for milliseconds + } + + if (this.step != 1) { + // round down to the first minor value that is a multiple of the current step size + switch (this.scale) { + case 'millisecond': + this.current.subtract(this.current.milliseconds() % this.step, 'milliseconds');break; + case 'second': + this.current.subtract(this.current.seconds() % this.step, 'seconds');break; + case 'minute': + this.current.subtract(this.current.minutes() % this.step, 'minutes');break; + case 'hour': + this.current.subtract(this.current.hours() % this.step, 'hours');break; + case 'weekday': // intentional fall through + case 'day': + this.current.subtract((this.current.date() - 1) % this.step, 'day');break; + case 'week': + this.current.subtract(this.current.week() % this.step, 'week');break; + case 'month': + this.current.subtract(this.current.month() % this.step, 'month');break; + case 'year': + this.current.subtract(this.current.year() % this.step, 'year');break; + default: + break; } + } +}; - return ids; - }; +/** + * Check if the there is a next step + * @return {boolean} true if the current date has not passed the end date + */ +TimeStep.prototype.hasNext = function () { + return this.current.valueOf() <= this._end.valueOf(); +}; - /** - * Map every item in the dataset. - * @param {function} callback - * @param {Object} [options] Available options: - * {Object.} [type] - * {String[]} [fields] filter fields - * {function} [filter] filter items - * {String | function} [order] Order the items by - * a field name or custom sort function. - * @return {Object[]} mappedItems - */ - DataView.prototype.map = function (callback, options) { - var mappedItems = []; - if (this._data) { - var defaultFilter = this._options.filter; - var filter; - - if (options && options.filter) { - if (defaultFilter) { - filter = function filter(item) { - return defaultFilter(item) && options.filter(item); - }; +/** + * Do the next step + */ +TimeStep.prototype.next = function () { + var prev = this.current.valueOf(); + + // Two cases, needed to prevent issues with switching daylight savings + // (end of March and end of October) + switch (this.scale) { + case 'millisecond': + this.current.add(this.step, 'millisecond');break; + case 'second': + this.current.add(this.step, 'second');break; + case 'minute': + this.current.add(this.step, 'minute');break; + case 'hour': + this.current.add(this.step, 'hour'); + + if (this.current.month() < 6) { + this.current.subtract(this.current.hours() % this.step, 'hour'); + } else { + if (this.current.hours() % this.step !== 0) { + this.current.add(this.step - this.current.hours() % this.step, 'hour'); + } + } + break; + case 'weekday': // intentional fall through + case 'day': + this.current.add(this.step, 'day');break; + case 'week': + if (this.current.weekday() !== 0) { + // we had a month break not correlating with a week's start before + this.current.weekday(0); // switch back to week cycles + this.current.add(this.step, 'week'); + } else if (this.options.showMajorLabels === false) { + this.current.add(this.step, 'week'); // the default case + } else { + // first day of the week + var nextWeek = this.current.clone(); + nextWeek.add(1, 'week'); + if (nextWeek.isSame(this.current, 'month')) { + // is the first day of the next week in the same month? + this.current.add(this.step, 'week'); // the default case } else { - filter = options.filter; + // inject a step at each first day of the month + this.current.add(this.step, 'week'); + this.current.date(1); } - } else { - filter = defaultFilter; } + break; + case 'month': + this.current.add(this.step, 'month');break; + case 'year': + this.current.add(this.step, 'year');break; + default: + break; + } - mappedItems = this._data.map(callback, { - filter: filter, - order: options && options.order - }); - } else { - mappedItems = []; + if (this.step != 1) { + // round down to the correct major value + switch (this.scale) { + case 'millisecond': + if (this.current.milliseconds() > 0 && this.current.milliseconds() < this.step) this.current.milliseconds(0);break; + case 'second': + if (this.current.seconds() > 0 && this.current.seconds() < this.step) this.current.seconds(0);break; + case 'minute': + if (this.current.minutes() > 0 && this.current.minutes() < this.step) this.current.minutes(0);break; + case 'hour': + if (this.current.hours() > 0 && this.current.hours() < this.step) this.current.hours(0);break; + case 'weekday': // intentional fall through + case 'day': + if (this.current.date() < this.step + 1) this.current.date(1);break; + case 'week': + if (this.current.week() < this.step) this.current.week(1);break; // week numbering starts at 1, not 0 + case 'month': + if (this.current.month() < this.step) this.current.month(0);break; + case 'year': + break; // nothing to do for year + default: + break; } + } - return mappedItems; - }; + // safety mechanism: if current time is still unchanged, move to the end + if (this.current.valueOf() == prev) { + this.current = this._end.clone(); + } - /** - * Get the DataSet to which this DataView is connected. In case there is a chain - * of multiple DataViews, the root DataSet of this chain is returned. - * @return {DataSet} dataSet - */ - DataView.prototype.getDataSet = function () { - var dataSet = this; - while (dataSet instanceof DataView) { - dataSet = dataSet._data; - } - return dataSet || null; - }; + // Reset switches for year, month and day. Will get set to true where appropriate in DateUtil.stepOverHiddenDates + this.switchedDay = false; + this.switchedMonth = false; + this.switchedYear = false; - /** - * Event listener. Will propagate all events from the connected data set to - * the subscribers of the DataView, but will filter the items and only trigger - * when there are changes in the filtered data set. - * @param {String} event - * @param {Object | null} params - * @param {String} senderId - * @private - */ - DataView.prototype._onEvent = function (event, params, senderId) { - var i, len, id, item; - var ids = params && params.items; - var addedIds = [], - updatedIds = [], - removedIds = [], - oldItems = [], - updatedItems = [], - removedItems = []; - - if (ids && this._data) { - switch (event) { - case 'add': - // filter the ids of the added items - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - item = this.get(id); - if (item) { - this._ids[id] = true; - addedIds.push(id); - } - } + DateUtil.stepOverHiddenDates(this.moment, this, prev); +}; - break; +/** + * Get the current datetime + * @return {Moment} current The current date + */ +TimeStep.prototype.getCurrent = function () { + return this.current; +}; - case 'update': - // determine the event from the views viewpoint: an updated - // item can be added, updated, or removed from this view. - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - item = this.get(id); - - if (item) { - if (this._ids[id]) { - updatedIds.push(id); - updatedItems.push(params.data[i]); - oldItems.push(params.oldData[i]); - } else { - this._ids[id] = true; - addedIds.push(id); - } - } else { - if (this._ids[id]) { - delete this._ids[id]; - removedIds.push(id); - removedItems.push(params.oldData[i]); - } else { - // nothing interesting for me :-( - } - } - } +/** + * Set a custom scale. Autoscaling will be disabled. + * For example setScale('minute', 5) will result + * in minor steps of 5 minutes, and major steps of an hour. + * + * @param {{scale: string, step: number}} params + * An object containing two properties: + * - A string 'scale'. Choose from 'millisecond', 'second', + * 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'. + * - A number 'step'. A step size, by default 1. + * Choose for example 1, 2, 5, or 10. + */ +TimeStep.prototype.setScale = function (params) { + if (params && typeof params.scale == 'string') { + this.scale = params.scale; + this.step = params.step > 0 ? params.step : 1; + this.autoScale = false; + } +}; - break; +/** + * Enable or disable autoscaling + * @param {boolean} enable If true, autoascaling is set true + */ +TimeStep.prototype.setAutoScale = function (enable) { + this.autoScale = enable; +}; - case 'remove': - // filter the ids of the removed items - for (i = 0, len = ids.length; i < len; i++) { - id = ids[i]; - if (this._ids[id]) { - delete this._ids[id]; - removedIds.push(id); - removedItems.push(params.oldData[i]); - } - } - - break; - } - - this.length += addedIds.length - removedIds.length; - - if (addedIds.length) { - this._trigger('add', { items: addedIds }, senderId); - } - if (updatedIds.length) { - this._trigger('update', { items: updatedIds, oldData: oldItems, data: updatedItems }, senderId); - } - if (removedIds.length) { - this._trigger('remove', { items: removedIds, oldData: removedItems }, senderId); - } - } - }; - - // copy subscription functionality from DataSet - DataView.prototype.on = DataSet.prototype.on; - DataView.prototype.off = DataSet.prototype.off; - DataView.prototype._trigger = DataSet.prototype._trigger; +/** + * Automatically determine the scale that bests fits the provided minimum step + * @param {number} [minimumStep] The minimum step size in milliseconds + */ +TimeStep.prototype.setMinimumStep = function (minimumStep) { + if (minimumStep == undefined) { + return; + } - // TODO: make these functions deprecated (replaced with `on` and `off` since version 0.5) - DataView.prototype.subscribe = DataView.prototype.on; - DataView.prototype.unsubscribe = DataView.prototype.off; + //var b = asc + ds; - module.exports = DataView; + var stepYear = 1000 * 60 * 60 * 24 * 30 * 12; + var stepMonth = 1000 * 60 * 60 * 24 * 30; + var stepDay = 1000 * 60 * 60 * 24; + var stepHour = 1000 * 60 * 60; + var stepMinute = 1000 * 60; + var stepSecond = 1000; + var stepMillisecond = 1; -/***/ }), -/* 94 */ -/***/ (function(module, exports, __webpack_require__) { + // find the smallest step that is larger than the provided minimumStep + if (stepYear * 1000 > minimumStep) { + this.scale = 'year';this.step = 1000; + } + if (stepYear * 500 > minimumStep) { + this.scale = 'year';this.step = 500; + } + if (stepYear * 100 > minimumStep) { + this.scale = 'year';this.step = 100; + } + if (stepYear * 50 > minimumStep) { + this.scale = 'year';this.step = 50; + } + if (stepYear * 10 > minimumStep) { + this.scale = 'year';this.step = 10; + } + if (stepYear * 5 > minimumStep) { + this.scale = 'year';this.step = 5; + } + if (stepYear > minimumStep) { + this.scale = 'year';this.step = 1; + } + if (stepMonth * 3 > minimumStep) { + this.scale = 'month';this.step = 3; + } + if (stepMonth > minimumStep) { + this.scale = 'month';this.step = 1; + } + if (stepDay * 5 > minimumStep) { + this.scale = 'day';this.step = 5; + } + if (stepDay * 2 > minimumStep) { + this.scale = 'day';this.step = 2; + } + if (stepDay > minimumStep) { + this.scale = 'day';this.step = 1; + } + if (stepDay / 2 > minimumStep) { + this.scale = 'weekday';this.step = 1; + } + if (stepHour * 4 > minimumStep) { + this.scale = 'hour';this.step = 4; + } + if (stepHour > minimumStep) { + this.scale = 'hour';this.step = 1; + } + if (stepMinute * 15 > minimumStep) { + this.scale = 'minute';this.step = 15; + } + if (stepMinute * 10 > minimumStep) { + this.scale = 'minute';this.step = 10; + } + if (stepMinute * 5 > minimumStep) { + this.scale = 'minute';this.step = 5; + } + if (stepMinute > minimumStep) { + this.scale = 'minute';this.step = 1; + } + if (stepSecond * 15 > minimumStep) { + this.scale = 'second';this.step = 15; + } + if (stepSecond * 10 > minimumStep) { + this.scale = 'second';this.step = 10; + } + if (stepSecond * 5 > minimumStep) { + this.scale = 'second';this.step = 5; + } + if (stepSecond > minimumStep) { + this.scale = 'second';this.step = 1; + } + if (stepMillisecond * 200 > minimumStep) { + this.scale = 'millisecond';this.step = 200; + } + if (stepMillisecond * 100 > minimumStep) { + this.scale = 'millisecond';this.step = 100; + } + if (stepMillisecond * 50 > minimumStep) { + this.scale = 'millisecond';this.step = 50; + } + if (stepMillisecond * 10 > minimumStep) { + this.scale = 'millisecond';this.step = 10; + } + if (stepMillisecond * 5 > minimumStep) { + this.scale = 'millisecond';this.step = 5; + } + if (stepMillisecond > minimumStep) { + this.scale = 'millisecond';this.step = 1; + } +}; - 'use strict'; +/** + * Snap a date to a rounded value. + * The snap intervals are dependent on the current scale and step. + * Static function + * @param {Date} date the date to be snapped. + * @param {string} scale Current scale, can be 'millisecond', 'second', + * 'minute', 'hour', 'weekday, 'day', 'week', 'month', 'year'. + * @param {number} step Current step (1, 2, 4, 5, ... + * @return {Date} snappedDate + */ +TimeStep.snap = function (date, scale, step) { + var clone = moment(date); + + if (scale == 'year') { + var year = clone.year() + Math.round(clone.month() / 12); + clone.year(Math.round(year / step) * step); + clone.month(0); + clone.date(0); + clone.hours(0); + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'month') { + if (clone.date() > 15) { + clone.date(1); + clone.add(1, 'month'); + // important: first set Date to 1, after that change the month. + } else { + clone.date(1); + } + + clone.hours(0); + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'week') { + if (clone.weekday() > 2) { + // doing it the momentjs locale aware way + clone.weekday(0); + clone.add(1, 'week'); + } else { + clone.weekday(0); + } - var _assign = __webpack_require__(95); + clone.hours(0); + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'day') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 5: + case 2: + clone.hours(Math.round(clone.hours() / 24) * 24);break; + default: + clone.hours(Math.round(clone.hours() / 12) * 12);break; + } + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'weekday') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 5: + case 2: + clone.hours(Math.round(clone.hours() / 12) * 12);break; + default: + clone.hours(Math.round(clone.hours() / 6) * 6);break; + } + clone.minutes(0); + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'hour') { + switch (step) { + case 4: + clone.minutes(Math.round(clone.minutes() / 60) * 60);break; + default: + clone.minutes(Math.round(clone.minutes() / 30) * 30);break; + } + clone.seconds(0); + clone.milliseconds(0); + } else if (scale == 'minute') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 15: + case 10: + clone.minutes(Math.round(clone.minutes() / 5) * 5); + clone.seconds(0); + break; + case 5: + clone.seconds(Math.round(clone.seconds() / 60) * 60);break; + default: + clone.seconds(Math.round(clone.seconds() / 30) * 30);break; + } + clone.milliseconds(0); + } else if (scale == 'second') { + //noinspection FallthroughInSwitchStatementJS + switch (step) { + case 15: + case 10: + clone.seconds(Math.round(clone.seconds() / 5) * 5); + clone.milliseconds(0); + break; + case 5: + clone.milliseconds(Math.round(clone.milliseconds() / 1000) * 1000);break; + default: + clone.milliseconds(Math.round(clone.milliseconds() / 500) * 500);break; + } + } else if (scale == 'millisecond') { + var _step = step > 5 ? step / 2 : 1; + clone.milliseconds(Math.round(clone.milliseconds() / _step) * _step); + } - var _assign2 = _interopRequireDefault(_assign); + return clone; +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +/** + * Check if the current value is a major value (for example when the step + * is DAY, a major value is each first day of the MONTH) + * @return {boolean} true if current date is major, else false. + */ +TimeStep.prototype.isMajor = function () { + if (this.switchedYear == true) { + switch (this.scale) { + case 'year': + case 'month': + case 'week': + case 'weekday': + case 'day': + case 'hour': + case 'minute': + case 'second': + case 'millisecond': + return true; + default: + return false; + } + } else if (this.switchedMonth == true) { + switch (this.scale) { + case 'week': + case 'weekday': + case 'day': + case 'hour': + case 'minute': + case 'second': + case 'millisecond': + return true; + default: + return false; + } + } else if (this.switchedDay == true) { + switch (this.scale) { + case 'millisecond': + case 'second': + case 'minute': + case 'hour': + return true; + default: + return false; + } + } - var Emitter = __webpack_require__(99); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var util = __webpack_require__(1); - var Point3d = __webpack_require__(100); - var Point2d = __webpack_require__(101); - var Camera = __webpack_require__(102); - var Filter = __webpack_require__(107); - var Slider = __webpack_require__(108); - var StepNumber = __webpack_require__(109); - var Range = __webpack_require__(110); - var Settings = __webpack_require__(111); - var DataGroup = __webpack_require__(112); + var date = this.moment(this.current); + switch (this.scale) { + case 'millisecond': + return date.milliseconds() == 0; + case 'second': + return date.seconds() == 0; + case 'minute': + return date.hours() == 0 && date.minutes() == 0; + case 'hour': + return date.hours() == 0; + case 'weekday': // intentional fall through + case 'day': + return date.date() == 1; + case 'week': + return date.date() == 1; + case 'month': + return date.month() == 0; + case 'year': + return false; + default: + return false; + } +}; - /// enumerate the available styles - Graph3d.STYLE = Settings.STYLE; +/** + * Returns formatted text for the minor axislabel, depending on the current + * date and the scale. For example when scale is MINUTE, the current time is + * formatted as "hh:mm". + * @param {Date} [date=this.current] custom date. if not provided, current date is taken + * @returns {String} + */ +TimeStep.prototype.getLabelMinor = function (date) { + if (date == undefined) { + date = this.current; + } + if (date instanceof Date) { + date = this.moment(date); + } - /** - * Following label is used in the settings to describe values which should be - * determined by the code while running, from the current data and graph style. - * - * Using 'undefined' directly achieves the same thing, but this is more - * descriptive by describing the intent. - */ - var autoByDefault = undefined; + if (typeof this.format.minorLabels === "function") { + return this.format.minorLabels(date, this.scale, this.step); + } - /** - * Default values for option settings. - * - * These are the values used when a Graph3d instance is initialized without - * custom settings. - * - * If a field is not in this list, a default value of 'autoByDefault' is assumed, - * which is just an alias for 'undefined'. - */ - var DEFAULTS = { - width: '400px', - height: '400px', - filterLabel: 'time', - legendLabel: 'value', - xLabel: 'x', - yLabel: 'y', - zLabel: 'z', - xValueLabel: function xValueLabel(v) { - return v; - }, - yValueLabel: function yValueLabel(v) { - return v; - }, - zValueLabel: function zValueLabel(v) { - return v; - }, - showXAxis: true, - showYAxis: true, - showZAxis: true, - showGrid: true, - showPerspective: true, - showShadow: false, - keepAspectRatio: true, - verticalRatio: 0.5, // 0.1 to 1.0, where 1.0 results in a 'cube' - - dotSizeRatio: 0.02, // size of the dots as a fraction of the graph width - dotSizeMinFraction: 0.5, // size of min-value dot as a fraction of dotSizeRatio - dotSizeMaxFraction: 2.5, // size of max-value dot as a fraction of dotSizeRatio - - showAnimationControls: autoByDefault, - animationInterval: 1000, // milliseconds - animationPreload: false, - animationAutoStart: autoByDefault, - - axisColor: '#4D4D4D', - gridColor: '#D3D3D3', - xCenter: '55%', - yCenter: '50%', - - style: Graph3d.STYLE.DOT, - tooltip: false, - - tooltipStyle: { - content: { - padding: '10px', - border: '1px solid #4d4d4d', - color: '#1a1a1a', - background: 'rgba(255,255,255,0.7)', - borderRadius: '2px', - boxShadow: '5px 5px 10px rgba(128,128,128,0.5)' - }, - line: { - height: '40px', - width: '0', - borderLeft: '1px solid #4d4d4d' - }, - dot: { - height: '0', - width: '0', - border: '5px solid #4d4d4d', - borderRadius: '5px' + var format = this.format.minorLabels[this.scale]; + // noinspection FallThroughInSwitchStatementJS + switch (this.scale) { + case 'week': + if (this.isMajor() && date.weekday() !== 0) { + return ""; } - }, - - showLegend: autoByDefault, // determined by graph style - backgroundColor: autoByDefault, - - dataColor: { - fill: '#7DC1FF', - stroke: '#3267D2', - strokeWidth: 1 // px - }, + default: + // eslint-disable-line no-fallthrough + return format && format.length > 0 ? this.moment(date).format(format) : ''; + } +}; - cameraPosition: { - horizontal: 1.0, - vertical: 0.5, - distance: 1.7 - }, +/** + * Returns formatted text for the major axis label, depending on the current + * date and the scale. For example when scale is MINUTE, the major scale is + * hours, and the hour will be formatted as "hh". + * @param {Date} [date=this.current] custom date. if not provided, current date is taken + * @returns {String} + */ +TimeStep.prototype.getLabelMajor = function (date) { + if (date == undefined) { + date = this.current; + } + if (date instanceof Date) { + date = this.moment(date); + } - xBarWidth: autoByDefault, - yBarWidth: autoByDefault, - valueMin: autoByDefault, - valueMax: autoByDefault, - xMin: autoByDefault, - xMax: autoByDefault, - xStep: autoByDefault, - yMin: autoByDefault, - yMax: autoByDefault, - yStep: autoByDefault, - zMin: autoByDefault, - zMax: autoByDefault, - zStep: autoByDefault - }; + if (typeof this.format.majorLabels === "function") { + return this.format.majorLabels(date, this.scale, this.step); + } - // ----------------------------------------------------------------------------- - // Class Graph3d - // ----------------------------------------------------------------------------- + var format = this.format.majorLabels[this.scale]; + return format && format.length > 0 ? this.moment(date).format(format) : ''; +}; +TimeStep.prototype.getClassName = function () { + var _moment = this.moment; + var m = this.moment(this.current); + var current = m.locale ? m.locale('en') : m.lang('en'); // old versions of moment have .lang() function + var step = this.step; + var classNames = []; /** - * @constructor Graph3d - * Graph3d displays data in 3d. * - * Graph3d is developed in javascript as a Google Visualization Chart. - * - * @param {Element} container The DOM element in which the Graph3d will - * be created. Normally a div element. - * @param {DataSet | DataView | Array} [data] - * @param {Object} [options] + * @param {number} value + * @returns {String} */ - function Graph3d(container, data, options) { - if (!(this instanceof Graph3d)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } - - // create variables and set default values - this.containerElement = container; - - this.dataGroup = new DataGroup(); - this.dataPoints = null; // The table with point objects - - // create a frame and canvas - this.create(); - - Settings.setDefaults(DEFAULTS, this); - - // the column indexes - this.colX = undefined; - this.colY = undefined; - this.colZ = undefined; - this.colValue = undefined; - this.colFilter = undefined; - - // TODO: customize axis range - - // apply options (also when undefined) - this.setOptions(options); - - // apply data - if (data) { - this.setData(data); - } + function even(value) { + return value / step % 2 == 0 ? ' vis-even' : ' vis-odd'; } - // Extend Graph3d with an Emitter mixin - Emitter(Graph3d.prototype); - /** - * Calculate the scaling values, dependent on the range in x, y, and z direction + * + * @param {Date} date + * @returns {String} */ - Graph3d.prototype._setScale = function () { - this.scale = new Point3d(1 / this.xRange.range(), 1 / this.yRange.range(), 1 / this.zRange.range()); - - // keep aspect ration between x and y scale if desired - if (this.keepAspectRatio) { - if (this.scale.x < this.scale.y) { - //noinspection JSSuspiciousNameCombination - this.scale.y = this.scale.x; - } else { - //noinspection JSSuspiciousNameCombination - this.scale.x = this.scale.y; - } + function today(date) { + if (date.isSame(new Date(), 'day')) { + return ' vis-today'; } - - // scale the vertical axis - this.scale.z *= this.verticalRatio; - // TODO: can this be automated? verticalRatio? - - // determine scale for (optional) value - if (this.valueRange !== undefined) { - this.scale.value = 1 / this.valueRange.range(); + if (date.isSame(_moment().add(1, 'day'), 'day')) { + return ' vis-tomorrow'; } - - // position the camera arm - var xCenter = this.xRange.center() * this.scale.x; - var yCenter = this.yRange.center() * this.scale.y; - var zCenter = this.zRange.center() * this.scale.z; - this.camera.setArmLocation(xCenter, yCenter, zCenter); - }; + if (date.isSame(_moment().add(-1, 'day'), 'day')) { + return ' vis-yesterday'; + } + return ''; + } /** - * Convert a 3D location to a 2D location on screen - * Source: ttp://en.wikipedia.org/wiki/3D_projection * - * @param {Point3d} point3d A 3D point with parameters x, y, z - * @returns {Point2d} point2d A 2D point with parameters x, y + * @param {Date} date + * @returns {String} */ - Graph3d.prototype._convert3Dto2D = function (point3d) { - var translation = this._convertPointToTranslation(point3d); - return this._convertTranslationToScreen(translation); - }; + function currentWeek(date) { + return date.isSame(new Date(), 'week') ? ' vis-current-week' : ''; + } /** - * Convert a 3D location its translation seen from the camera - * Source: http://en.wikipedia.org/wiki/3D_projection * - * @param {Point3d} point3d A 3D point with parameters x, y, z - * @returns {Point3d} translation A 3D point with parameters x, y, z This is - * the translation of the point, seen from the - * camera. + * @param {Date} date + * @returns {String} */ - Graph3d.prototype._convertPointToTranslation = function (point3d) { - var cameraLocation = this.camera.getCameraLocation(), - cameraRotation = this.camera.getCameraRotation(), - ax = point3d.x * this.scale.x, - ay = point3d.y * this.scale.y, - az = point3d.z * this.scale.z, - cx = cameraLocation.x, - cy = cameraLocation.y, - cz = cameraLocation.z, - - - // calculate angles - sinTx = Math.sin(cameraRotation.x), - cosTx = Math.cos(cameraRotation.x), - sinTy = Math.sin(cameraRotation.y), - cosTy = Math.cos(cameraRotation.y), - sinTz = Math.sin(cameraRotation.z), - cosTz = Math.cos(cameraRotation.z), - - - // calculate translation - dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz), - dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax - cx)), - dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax - cx)); - - return new Point3d(dx, dy, dz); - }; + function currentMonth(date) { + return date.isSame(new Date(), 'month') ? ' vis-current-month' : ''; + } /** - * Convert a translation point to a point on the screen * - * @param {Point3d} translation A 3D point with parameters x, y, z This is - * the translation of the point, seen from the - * camera. - * @returns {Point2d} point2d A 2D point with parameters x, y + * @param {Date} date + * @returns {String} */ - Graph3d.prototype._convertTranslationToScreen = function (translation) { - var ex = this.eye.x, - ey = this.eye.y, - ez = this.eye.z, - dx = translation.x, - dy = translation.y, - dz = translation.z; - - // calculate position on screen from translation - var bx; - var by; - if (this.showPerspective) { - bx = (dx - ex) * (ez / dz); - by = (dy - ey) * (ez / dz); - } else { - bx = dx * -(ez / this.camera.getArmLength()); - by = dy * -(ez / this.camera.getArmLength()); - } + function currentYear(date) { + return date.isSame(new Date(), 'year') ? ' vis-current-year' : ''; + } + + switch (this.scale) { + case 'millisecond': + classNames.push(today(current)); + classNames.push(even(current.milliseconds())); + break; + case 'second': + classNames.push(today(current)); + classNames.push(even(current.seconds())); + break; + case 'minute': + classNames.push(today(current)); + classNames.push(even(current.minutes())); + break; + case 'hour': + classNames.push('vis-h' + current.hours() + (this.step == 4 ? '-h' + (current.hours() + 4) : '')); + classNames.push(today(current)); + classNames.push(even(current.hours())); + break; + case 'weekday': + classNames.push('vis-' + current.format('dddd').toLowerCase()); + classNames.push(today(current)); + classNames.push(currentWeek(current)); + classNames.push(even(current.date())); + break; + case 'day': + classNames.push('vis-day' + current.date()); + classNames.push('vis-' + current.format('MMMM').toLowerCase()); + classNames.push(today(current)); + classNames.push(currentMonth(current)); + classNames.push(this.step <= 2 ? today(current) : ''); + classNames.push(this.step <= 2 ? 'vis-' + current.format('dddd').toLowerCase() : ''); + classNames.push(even(current.date() - 1)); + break; + case 'week': + classNames.push('vis-week' + current.format('w')); + classNames.push(currentWeek(current)); + classNames.push(even(current.week())); + break; + case 'month': + classNames.push('vis-' + current.format('MMMM').toLowerCase()); + classNames.push(currentMonth(current)); + classNames.push(even(current.month())); + break; + case 'year': + classNames.push('vis-year' + current.year()); + classNames.push(currentYear(current)); + classNames.push(even(current.year())); + break; + } + return classNames.filter(String).join(" "); +}; + +module.exports = TimeStep; - // shift and scale the point to the center of the screen - // use the width of the graph to scale both horizontally and vertically. - return new Point2d(this.currentXCenter + bx * this.frame.canvas.clientWidth, this.currentYCenter - by * this.frame.canvas.clientWidth); - }; +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Calculate the translations and screen positions of all points - */ - Graph3d.prototype._calcTranslations = function (points) { - for (var i = 0; i < points.length; i++) { - var point = points[i]; - point.trans = this._convertPointToTranslation(point.point); - point.screen = this._convertTranslationToScreen(point.trans); +"use strict"; - // calculate the translation of the point at the bottom (needed for sorting) - var transBottom = this._convertPointToTranslation(point.bottom); - point.dist = this.showPerspective ? transBottom.length() : -transBottom.z; - } - // sort the points on depth of their (x,y) position (not on z) - var sortDepth = function sortDepth(a, b) { - return b.dist - a.dist; - }; - points.sort(sortDepth); +var util = __webpack_require__(2); +var Component = __webpack_require__(16); +var moment = __webpack_require__(9); +var locales = __webpack_require__(98); + +/** + * A current time bar + * @param {{range: Range, dom: Object, domProps: Object}} body + * @param {Object} [options] Available parameters: + * {Boolean} [showCurrentTime] + * @constructor CurrentTime + * @extends Component + */ +function CurrentTime(body, options) { + this.body = body; + + // default options + this.defaultOptions = { + rtl: false, + showCurrentTime: true, + + moment: moment, + locales: locales, + locale: 'en' }; + this.options = util.extend({}, this.defaultOptions); + this.offset = 0; - /** - * Check if the state is consistent for the use of the value field. - * - * Throws if a problem is detected. - */ - Graph3d.prototype._checkValueField = function (data) { + this._create(); - var hasValueField = this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.DOTSIZE; + this.setOptions(options); +} - if (!hasValueField) { - return; // No need to check further - } +CurrentTime.prototype = new Component(); - // Following field must be present for the current graph style - if (this.colValue === undefined) { - throw new Error('Expected data to have ' + ' field \'style\' ' + ' for graph style \'' + this.style + '\''); - } +/** + * Create the HTML DOM for the current time bar + * @private + */ +CurrentTime.prototype._create = function () { + var bar = document.createElement('div'); + bar.className = 'vis-current-time'; + bar.style.position = 'absolute'; + bar.style.top = '0px'; + bar.style.height = '100%'; + + this.bar = bar; +}; + +/** + * Destroy the CurrentTime bar + */ +CurrentTime.prototype.destroy = function () { + this.options.showCurrentTime = false; + this.redraw(); // will remove the bar from the DOM and stop refreshing + + this.body = null; +}; + +/** + * Set options for the component. Options will be merged in current options. + * @param {Object} options Available parameters: + * {boolean} [showCurrentTime] + */ +CurrentTime.prototype.setOptions = function (options) { + if (options) { + // copy all options that we know + util.selectiveExtend(['rtl', 'showCurrentTime', 'moment', 'locale', 'locales'], this.options, options); + } +}; + +/** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ +CurrentTime.prototype.redraw = function () { + if (this.options.showCurrentTime) { + var parent = this.body.dom.backgroundVertical; + if (this.bar.parentNode != parent) { + // attach to the dom + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + parent.appendChild(this.bar); - // The data must also contain this field. - // Note that only first data element is checked. - if (data[0][this.colValue] === undefined) { - throw new Error('Expected data to have ' + ' field \'' + this.colValue + '\' ' + ' for graph style \'' + this.style + '\''); + this.start(); } - }; - Graph3d.prototype._initializeData = function (rawData, style) { - this.dataGroup.initializeData(this, rawData, style); - - // Transfer min/max values to the Graph3d instance. - // TODO: later on, all min/maxes of all datagroups will be combined here - this.xRange = this.dataGroup.xRange; - this.yRange = this.dataGroup.yRange; - this.zRange = this.dataGroup.zRange; - this.valueRange = this.dataGroup.valueRange; - - // Values currently needed but which need to be sorted out for - // the multiple graph case. - this.xStep = this.dataGroup.xStep; - this.yStep = this.dataGroup.yStep; - this.zStep = this.dataGroup.zStep; - this.xBarWidth = this.dataGroup.xBarWidth; - this.yBarWidth = this.dataGroup.yBarWidth; - this.colX = this.dataGroup.colX; - this.colY = this.dataGroup.colY; - this.colZ = this.dataGroup.colZ; - this.colValue = this.dataGroup.colValue; - - // Check if a filter column is provided - var data = this.dataGroup.getDataTable(); - - if (data[0].hasOwnProperty('filter')) { - // Only set this field if it's actually present - this.colFilter = 'filter'; + var now = this.options.moment(new Date().valueOf() + this.offset); + var x = this.body.util.toScreen(now); - var me = this; - if (this.dataFilter === undefined) { - this.dataFilter = new Filter(this.dataGroup, this.colFilter, this); - this.dataFilter.setOnLoadCallback(function () { - me.redraw(); - }); + var locale = this.options.locales[this.options.locale]; + if (!locale) { + if (!this.warned) { + console.log('WARNING: options.locales[\'' + this.options.locale + '\'] not found. See http://visjs.org/docs/timeline/#Localization'); + this.warned = true; } + locale = this.options.locales['en']; // fall back on english when not available } + var title = locale.current + ' ' + locale.time + ': ' + now.format('dddd, MMMM Do YYYY, H:mm:ss'); + title = title.charAt(0).toUpperCase() + title.substring(1); - // set the scale dependent on the ranges. - this._setScale(); - }; + if (this.options.rtl) { + this.bar.style.right = x + 'px'; + } else { + this.bar.style.left = x + 'px'; + } + this.bar.title = title; + } else { + // remove the line from the DOM + if (this.bar.parentNode) { + this.bar.parentNode.removeChild(this.bar); + } + this.stop(); + } + + return false; +}; + +/** + * Start auto refreshing the current time bar + */ +CurrentTime.prototype.start = function () { + var me = this; /** - * Return all data values as a list of Point3d objects + * Updates the current time. */ - Graph3d.prototype.getDataPoints = function (data) { - var dataPoints = []; + function update() { + me.stop(); - for (var i = 0; i < data.length; i++) { - var point = new Point3d(); - point.x = data[i][this.colX] || 0; - point.y = data[i][this.colY] || 0; - point.z = data[i][this.colZ] || 0; - point.data = data[i]; + // determine interval to refresh + var scale = me.body.range.conversion(me.body.domProps.center.width).scale; + var interval = 1 / scale / 10; + if (interval < 30) interval = 30; + if (interval > 1000) interval = 1000; - if (this.colValue !== undefined) { - point.value = data[i][this.colValue] || 0; - } + me.redraw(); + me.body.emitter.emit('currentTimeTick'); - var obj = {}; - obj.point = point; - obj.bottom = new Point3d(point.x, point.y, this.zRange.min); - obj.trans = undefined; - obj.screen = undefined; + // start a renderTimer to adjust for the new time + me.currentTimeTimer = setTimeout(update, interval); + } - dataPoints.push(obj); - } + update(); +}; - return dataPoints; - }; +/** + * Stop auto refreshing the current time bar + */ +CurrentTime.prototype.stop = function () { + if (this.currentTimeTimer !== undefined) { + clearTimeout(this.currentTimeTimer); + delete this.currentTimeTimer; + } +}; - /** - * Filter the data based on the current filter - * - * @param {Array} data - * @returns {Array} dataPoints Array with point objects which can be drawn on - * screen - */ - Graph3d.prototype._getDataPoints = function (data) { - // TODO: store the created matrix dataPoints in the filters instead of - // reloading each time. - var x, y, i, z, obj, point; +/** + * Set a current time. This can be used for example to ensure that a client's + * time is synchronized with a shared server time. + * @param {Date | string | number} time A Date, unix timestamp, or + * ISO date string. + */ +CurrentTime.prototype.setCurrentTime = function (time) { + var t = util.convert(time, 'Date').valueOf(); + var now = new Date().valueOf(); + this.offset = t - now; + this.redraw(); +}; - var dataPoints = []; +/** + * Get the current time. + * @return {Date} Returns the current time. + */ +CurrentTime.prototype.getCurrentTime = function () { + return new Date(new Date().valueOf() + this.offset); +}; - if (this.style === Graph3d.STYLE.GRID || this.style === Graph3d.STYLE.SURFACE) { - // copy all values from the data table to a matrix - // the provided values are supposed to form a grid of (x,y) positions +module.exports = CurrentTime; - // create two lists with all present x and y values - var dataX = this.dataGroup.getDistinctValues(this.colX, data); - var dataY = this.dataGroup.getDistinctValues(this.colY, data); +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { - dataPoints = this.getDataPoints(data); +"use strict"; - // create a grid, a 2d matrix, with all values. - var dataMatrix = []; // temporary data matrix - for (i = 0; i < dataPoints.length; i++) { - obj = dataPoints[i]; - // TODO: implement Array().indexOf() for Internet Explorer - var xIndex = dataX.indexOf(obj.point.x); - var yIndex = dataY.indexOf(obj.point.y); +var _keys = __webpack_require__(8); - if (dataMatrix[xIndex] === undefined) { - dataMatrix[xIndex] = []; - } +var _keys2 = _interopRequireDefault(_keys); - dataMatrix[xIndex][yIndex] = obj; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // fill in the pointers to the neighbors. - for (x = 0; x < dataMatrix.length; x++) { - for (y = 0; y < dataMatrix[x].length; y++) { - if (dataMatrix[x][y]) { - dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined; - dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined; - dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined; - } - } - } +var util = __webpack_require__(2); +var stack = __webpack_require__(100); + +/** + * @param {number | string} groupId + * @param {Object} data + * @param {ItemSet} itemSet + * @constructor Group + */ +function Group(groupId, data, itemSet) { + this.groupId = groupId; + this.subgroups = {}; + this.subgroupStack = {}; + this.subgroupStackAll = false; + this.doInnerStack = false; + this.subgroupIndex = 0; + this.subgroupOrderer = data && data.subgroupOrder; + this.itemSet = itemSet; + this.isVisible = null; + this.stackDirty = true; // if true, items will be restacked on next redraw + + if (data && data.nestedGroups) { + this.nestedGroups = data.nestedGroups; + if (data.showNested == false) { + this.showNested = false; } else { - // 'dot', 'dot-line', etc. - this._checkValueField(data); - dataPoints = this.getDataPoints(data); + this.showNested = true; + } + } - if (this.style === Graph3d.STYLE.LINE) { - // Add next member points for line drawing - for (i = 0; i < dataPoints.length; i++) { - if (i > 0) { - dataPoints[i - 1].pointNext = dataPoints[i];; - } - } + if (data && data.subgroupStack) { + if (typeof data.subgroupStack === "boolean") { + this.doInnerStack = data.subgroupStack; + this.subgroupStackAll = data.subgroupStack; + } else { + // We might be doing stacking on specific sub groups, but only + // if at least one is set to do stacking + for (var key in data.subgroupStack) { + this.subgroupStack[key] = data.subgroupStack[key]; + this.doInnerStack = this.doInnerStack || data.subgroupStack[key]; } } + } - return dataPoints; - }; + this.nestedInGroup = null; - /** - * Create the main frame for the Graph3d. - * - * This function is executed once when a Graph3d object is created. The frame - * contains a canvas, and this canvas contains all objects like the axis and - * nodes. - */ - Graph3d.prototype.create = function () { - // remove all elements from the container element. - while (this.containerElement.hasChildNodes()) { - this.containerElement.removeChild(this.containerElement.firstChild); + this.dom = {}; + this.props = { + label: { + width: 0, + height: 0 } + }; + this.className = null; - this.frame = document.createElement('div'); - this.frame.style.position = 'relative'; - this.frame.style.overflow = 'hidden'; - - // create the graph canvas (HTML canvas element) - this.frame.canvas = document.createElement('canvas'); - this.frame.canvas.style.position = 'relative'; - this.frame.appendChild(this.frame.canvas); - //if (!this.frame.canvas.getContext) { - { - var noCanvas = document.createElement('DIV'); - noCanvas.style.color = 'red'; - noCanvas.style.fontWeight = 'bold'; - noCanvas.style.padding = '10px'; - noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; - this.frame.canvas.appendChild(noCanvas); - } - - this.frame.filter = document.createElement('div'); - this.frame.filter.style.position = 'absolute'; - this.frame.filter.style.bottom = '0px'; - this.frame.filter.style.left = '0px'; - this.frame.filter.style.width = '100%'; - this.frame.appendChild(this.frame.filter); - - // add event listeners to handle moving and zooming the contents - var me = this; - var onmousedown = function onmousedown(event) { - me._onMouseDown(event); - }; - var ontouchstart = function ontouchstart(event) { - me._onTouchStart(event); - }; - var onmousewheel = function onmousewheel(event) { - me._onWheel(event); - }; - var ontooltip = function ontooltip(event) { - me._onTooltip(event); - }; - var onclick = function onclick(event) { - me._onClick(event); - }; - // TODO: these events are never cleaned up... can give a 'memory leakage' - - util.addEventListener(this.frame.canvas, 'mousedown', onmousedown); - util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart); - util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel); - util.addEventListener(this.frame.canvas, 'mousemove', ontooltip); - util.addEventListener(this.frame.canvas, 'click', onclick); - - // add the new graph to the container element - this.containerElement.appendChild(this.frame); + this.items = {}; // items filtered by groupId of this group + this.visibleItems = []; // items currently visible in window + this.itemsInRange = []; // items currently in range + this.orderedItems = { + byStart: [], + byEnd: [] }; + this.checkRangedItems = false; // needed to refresh the ranged items if the window is programatically changed with NO overlap. + var me = this; + this.itemSet.body.emitter.on("checkRangedItems", function () { + me.checkRangedItems = true; + }); - /** - * Set a new size for the graph - */ - Graph3d.prototype._setSize = function (width, height) { - this.frame.style.width = width; - this.frame.style.height = height; + this._create(); - this._resizeCanvas(); - }; + this.setData(data); +} - /** - * Resize the canvas to the current size of the frame - */ - Graph3d.prototype._resizeCanvas = function () { - this.frame.canvas.style.width = '100%'; - this.frame.canvas.style.height = '100%'; +/** + * Create DOM elements for the group + * @private + */ +Group.prototype._create = function () { + var label = document.createElement('div'); + if (this.itemSet.options.groupEditable.order) { + label.className = 'vis-label draggable'; + } else { + label.className = 'vis-label'; + } + this.dom.label = label; - this.frame.canvas.width = this.frame.canvas.clientWidth; - this.frame.canvas.height = this.frame.canvas.clientHeight; + var inner = document.createElement('div'); + inner.className = 'vis-inner'; + label.appendChild(inner); + this.dom.inner = inner; - // adjust with for margin - this.frame.filter.style.width = this.frame.canvas.clientWidth - 2 * 10 + 'px'; - }; + var foreground = document.createElement('div'); + foreground.className = 'vis-group'; + foreground['timeline-group'] = this; + this.dom.foreground = foreground; - /** - * Start animation - */ - Graph3d.prototype.animationStart = function () { - if (!this.frame.filter || !this.frame.filter.slider) throw new Error('No animation available'); + this.dom.background = document.createElement('div'); + this.dom.background.className = 'vis-group'; - this.frame.filter.slider.play(); - }; + this.dom.axis = document.createElement('div'); + this.dom.axis.className = 'vis-group'; - /** - * Stop animation - */ - Graph3d.prototype.animationStop = function () { - if (!this.frame.filter || !this.frame.filter.slider) return; + // create a hidden marker to detect when the Timelines container is attached + // to the DOM, or the style of a parent of the Timeline is changed from + // display:none is changed to visible. + this.dom.marker = document.createElement('div'); + this.dom.marker.style.visibility = 'hidden'; + this.dom.marker.style.position = 'absolute'; + this.dom.marker.innerHTML = ''; + this.dom.background.appendChild(this.dom.marker); +}; - this.frame.filter.slider.stop(); - }; +/** + * Set the group data for this group + * @param {Object} data Group data, can contain properties content and className + */ +Group.prototype.setData = function (data) { + // update contents + var content; + var templateFunction; + + if (this.itemSet.options && this.itemSet.options.groupTemplate) { + templateFunction = this.itemSet.options.groupTemplate.bind(this); + content = templateFunction(data, this.dom.inner); + } else { + content = data && data.content; + } - /** - * Resize the center position based on the current values in this.xCenter - * and this.yCenter (which are strings with a percentage or a value - * in pixels). The center positions are the variables this.currentXCenter - * and this.currentYCenter - */ - Graph3d.prototype._resizeCenter = function () { - // calculate the horizontal center position - if (this.xCenter.charAt(this.xCenter.length - 1) === '%') { - this.currentXCenter = parseFloat(this.xCenter) / 100 * this.frame.canvas.clientWidth; - } else { - this.currentXCenter = parseFloat(this.xCenter); // supposed to be in px + if (content instanceof Element) { + this.dom.inner.appendChild(content); + while (this.dom.inner.firstChild) { + this.dom.inner.removeChild(this.dom.inner.firstChild); } + this.dom.inner.appendChild(content); + } else if (content instanceof Object) { + templateFunction(data, this.dom.inner); + } else if (content !== undefined && content !== null) { + this.dom.inner.innerHTML = content; + } else { + this.dom.inner.innerHTML = this.groupId || ''; // groupId can be null + } - // calculate the vertical center position - if (this.yCenter.charAt(this.yCenter.length - 1) === '%') { - this.currentYCenter = parseFloat(this.yCenter) / 100 * (this.frame.canvas.clientHeight - this.frame.filter.clientHeight); - } else { - this.currentYCenter = parseFloat(this.yCenter); // supposed to be in px - } - }; + // update title + this.dom.label.title = data && data.title || ''; + if (!this.dom.inner.firstChild) { + util.addClassName(this.dom.inner, 'vis-hidden'); + } else { + util.removeClassName(this.dom.inner, 'vis-hidden'); + } - /** - * Retrieve the current camera rotation - * - * @returns {object} An object with parameters horizontal, vertical, and - * distance - */ - Graph3d.prototype.getCameraPosition = function () { - var pos = this.camera.getArmRotation(); - pos.distance = this.camera.getArmLength(); - return pos; - }; + if (data && data.nestedGroups) { + if (!this.nestedGroups || this.nestedGroups != data.nestedGroups) { + this.nestedGroups = data.nestedGroups; + } - /** - * Load data into the 3D Graph - */ - Graph3d.prototype._readData = function (data) { - // read the data - this._initializeData(data, this.style); + if (data.showNested !== undefined || this.showNested === undefined) { + if (data.showNested == false) { + this.showNested = false; + } else { + this.showNested = true; + } + } - if (this.dataFilter) { - // apply filtering - this.dataPoints = this.dataFilter._getDataPoints(); + util.addClassName(this.dom.label, 'vis-nesting-group'); + var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'; + if (this.showNested) { + util.removeClassName(this.dom.label, collapsedDirClassName); + util.addClassName(this.dom.label, 'expanded'); } else { - // no filtering. load all data - this.dataPoints = this._getDataPoints(this.dataGroup.getDataTable()); + util.removeClassName(this.dom.label, 'expanded'); + util.addClassName(this.dom.label, collapsedDirClassName); } + } else if (this.nestedGroups) { + this.nestedGroups = null; + collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'; + util.removeClassName(this.dom.label, collapsedDirClassName); + util.removeClassName(this.dom.label, 'expanded'); + util.removeClassName(this.dom.label, 'vis-nesting-group'); + } - // draw the filter - this._redrawFilter(); - }; - - /** - * Replace the dataset of the Graph3d - * - * @param {Array | DataSet | DataView} data - */ - Graph3d.prototype.setData = function (data) { - this._readData(data); - this.redraw(); + if (data && data.nestedInGroup) { + util.addClassName(this.dom.label, 'vis-nested-group'); + if (this.itemSet.options && this.itemSet.options.rtl) { + this.dom.inner.style.paddingRight = '30px'; + } else { + this.dom.inner.style.paddingLeft = '30px'; + } + } - // start animation when option is true - if (this.animationAutoStart && this.dataFilter) { - this.animationStart(); + // update className + var className = data && data.className || null; + if (className != this.className) { + if (this.className) { + util.removeClassName(this.dom.label, this.className); + util.removeClassName(this.dom.foreground, this.className); + util.removeClassName(this.dom.background, this.className); + util.removeClassName(this.dom.axis, this.className); } - }; + util.addClassName(this.dom.label, className); + util.addClassName(this.dom.foreground, className); + util.addClassName(this.dom.background, className); + util.addClassName(this.dom.axis, className); + this.className = className; + } - /** - * Update the options. Options will be merged with current options - * - * @param {Object} options - */ - Graph3d.prototype.setOptions = function (options) { - var cameraPosition = undefined; + // update style + if (this.style) { + util.removeCssText(this.dom.label, this.style); + this.style = null; + } + if (data && data.style) { + util.addCssText(this.dom.label, data.style); + this.style = data.style; + } +}; - this.animationStop(); +/** + * Get the width of the group label + * @return {number} width + */ +Group.prototype.getLabelWidth = function () { + return this.props.label.width; +}; + +Group.prototype._didMarkerHeightChange = function () { + var markerHeight = this.dom.marker.clientHeight; + if (markerHeight != this.lastMarkerHeight) { + this.lastMarkerHeight = markerHeight; + var redrawQueue = {}; + var redrawQueueLength = 0; + + util.forEach(this.items, function (item, key) { + item.dirty = true; + if (item.displayed) { + var returnQueue = true; + redrawQueue[key] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[key].length; + } + }); - Settings.setOptions(options, this); + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + // redraw all regular items + for (var i = 0; i < redrawQueueLength; i++) { + util.forEach(redrawQueue, function (fns) { + fns[i](); + }); + } + } + return true; + } +}; - this.setPointDrawingMethod(); - this._setSize(this.width, this.height); +Group.prototype._calculateGroupSizeAndPosition = function () { + var offsetTop = this.dom.foreground.offsetTop; + var offsetLeft = this.dom.foreground.offsetLeft; + var offsetWidth = this.dom.foreground.offsetWidth; + this.top = offsetTop; + this.right = offsetLeft; + this.width = offsetWidth; +}; - // re-load the data - this.dataGroup.reload(); +Group.prototype._redrawItems = function (forceRestack, lastIsVisible, margin, range) { + var restack = forceRestack || this.stackDirty || this.isVisible && !lastIsVisible; - // start animation when option is true - if (this.animationAutoStart && this.dataFilter) { - this.animationStart(); - } - }; + // if restacking, reposition visible items vertically + if (restack) { + var visibleSubgroups = {}; + var subgroup = null; - /** - * Determine which point drawing method to use for the current graph style. - */ - Graph3d.prototype.setPointDrawingMethod = function () { - var method = undefined; + if (typeof this.itemSet.options.order === 'function') { + // a custom order function + // brute force restack of all items - switch (this.style) { - case Graph3d.STYLE.BAR: - method = Graph3d.prototype._redrawBarGraphPoint; - break; - case Graph3d.STYLE.BARCOLOR: - method = Graph3d.prototype._redrawBarColorGraphPoint; - break; - case Graph3d.STYLE.BARSIZE: - method = Graph3d.prototype._redrawBarSizeGraphPoint; - break; - case Graph3d.STYLE.DOT: - method = Graph3d.prototype._redrawDotGraphPoint; - break; - case Graph3d.STYLE.DOTLINE: - method = Graph3d.prototype._redrawDotLineGraphPoint; - break; - case Graph3d.STYLE.DOTCOLOR: - method = Graph3d.prototype._redrawDotColorGraphPoint; - break; - case Graph3d.STYLE.DOTSIZE: - method = Graph3d.prototype._redrawDotSizeGraphPoint; - break; - case Graph3d.STYLE.SURFACE: - method = Graph3d.prototype._redrawSurfaceGraphPoint; - break; - case Graph3d.STYLE.GRID: - method = Graph3d.prototype._redrawGridGraphPoint; - break; - case Graph3d.STYLE.LINE: - method = Graph3d.prototype._redrawLineGraphPoint; - break; - default: - throw new Error('Can not determine point drawing method ' + 'for graph style \'' + this.style + '\''); - } + // show all items + var me = this; + var limitSize = false; - this._pointDrawingMethod = method; - }; + var redrawQueue = {}; + var redrawQueueLength = 0; - /** - * Redraw the Graph. - */ - Graph3d.prototype.redraw = function () { - if (this.dataPoints === undefined) { - throw new Error('Graph data not initialized'); - } + util.forEach(this.items, function (item, key) { + if (!item.displayed) { + var returnQueue = true; + redrawQueue[key] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[key].length; + me.visibleItems.push(item); + } + }); - this._resizeCanvas(); - this._resizeCenter(); - this._redrawSlider(); - this._redrawClear(); - this._redrawAxis(); + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + // redraw all regular items + for (var i = 0; i < redrawQueueLength; i++) { + util.forEach(redrawQueue, function (fns) { + fns[i](); + }); + } + } - this._redrawDataGraph(); + util.forEach(this.items, function (item) { + item.repositionX(limitSize); + }); - this._redrawInfo(); - this._redrawLegend(); - }; + if (this.doInnerStack && this.itemSet.options.stackSubgroups) { + // Order the items within each subgroup + for (subgroup in this.subgroups) { + visibleSubgroups[subgroup] = this.subgroups[subgroup].items.slice().sort(function (a, b) { + return me.itemSet.options.order(a.data, b.data); + }); + } - /** - * Get drawing context without exposing canvas - */ - Graph3d.prototype._getContext = function () { - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); + stack.stackSubgroupsWithInnerStack(visibleSubgroups, margin, this.subgroups); + } else { + // order all items and force a restacking + var customOrderedItems = this.orderedItems.byStart.slice().sort(function (a, b) { + return me.itemSet.options.order(a.data, b.data); + }); + stack.stack(customOrderedItems, margin, true /* restack=true */); + } - ctx.lineJoin = 'round'; - ctx.lineCap = 'round'; + this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); + } else { + // no custom order function, lazy stacking + this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); - return ctx; - }; + if (this.itemSet.options.stack) { + if (this.doInnerStack && this.itemSet.options.stackSubgroups) { + for (subgroup in this.subgroups) { + visibleSubgroups[subgroup] = this.subgroups[subgroup].items; + } - /** - * Clear the canvas before redrawing - */ - Graph3d.prototype._redrawClear = function () { - var canvas = this.frame.canvas; - var ctx = canvas.getContext('2d'); + stack.stackSubgroupsWithInnerStack(visibleSubgroups, margin, this.subgroups); + } else { + // TODO: ugly way to access options... + stack.stack(this.visibleItems, margin, true /* restack=true */); + } + } else { + // no stacking + stack.nostack(this.visibleItems, margin, this.subgroups, this.itemSet.options.stackSubgroups); + } + } - ctx.clearRect(0, 0, canvas.width, canvas.height); - }; + this.stackDirty = false; + } +}; - Graph3d.prototype._dotSize = function () { - return this.frame.clientWidth * this.dotSizeRatio; - }; +Group.prototype._didResize = function (resized, height) { + resized = util.updateProperty(this, 'height', height) || resized; + // recalculate size of label + var labelWidth = this.dom.inner.clientWidth; + var labelHeight = this.dom.inner.clientHeight; + resized = util.updateProperty(this.props.label, 'width', labelWidth) || resized; + resized = util.updateProperty(this.props.label, 'height', labelHeight) || resized; + return resized; +}; - /** - * Get legend width - */ - Graph3d.prototype._getLegendWidth = function () { - var width; +Group.prototype._applyGroupHeight = function (height) { + this.dom.background.style.height = height + 'px'; + this.dom.foreground.style.height = height + 'px'; + this.dom.label.style.height = height + 'px'; +}; - if (this.style === Graph3d.STYLE.DOTSIZE) { - var dotSize = this._dotSize(); - //width = dotSize / 2 + dotSize * 2; - width = dotSize * this.dotSizeMaxFraction; - } else if (this.style === Graph3d.STYLE.BARSIZE) { - width = this.xBarWidth; - } else { - width = 20; +// update vertical position of items after they are re-stacked and the height of the group is calculated +Group.prototype._updateItemsVerticalPosition = function (margin) { + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(margin); + if (!this.isVisible && this.groupId != "__background__") { + if (item.displayed) item.hide(); } - return width; - }; - - /** - * Redraw the legend based on size, dot color, or surface height - */ - Graph3d.prototype._redrawLegend = function () { + } +}; - //Return without drawing anything, if no legend is specified - if (this.showLegend !== true) { - return; +/** + * Repaint this group + * @param {{start: number, end: number}} range + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @param {boolean} [forceRestack=false] Force restacking of all items + * @param {boolean} [returnQueue=false] return the queue or if the group resized + * @return {boolean} Returns true if the group is resized or the redraw queue if returnQueue=true + */ +Group.prototype.redraw = function (range, margin, forceRestack, returnQueue) { + var resized = false; + var lastIsVisible = this.isVisible; + var height; + + var queue = [ + // force recalculation of the height of the items when the marker height changed + // (due to the Timeline being attached to the DOM or changed from display:none to visible) + function () { + forceRestack = this._didMarkerHeightChange.bind(this); + }.bind(this), + + // recalculate the height of the subgroups + this._updateSubGroupHeights.bind(this, margin), + + // calculate actual size and position + this._calculateGroupSizeAndPosition.bind(this), + + // check if group is visible + function () { + this.isVisible = this._isGroupVisible.bind(this)(range, margin); + }.bind(this), + + // redraw Items if needed + function () { + this._redrawItems.bind(this)(forceRestack, lastIsVisible, margin, range); + }.bind(this), + + // update subgroups + this._updateSubgroupsSizes.bind(this), + + // recalculate the height of the group + function () { + height = this._calculateHeight.bind(this)(margin); + }.bind(this), + + // calculate actual size and position again + this._calculateGroupSizeAndPosition.bind(this), + + // check if resized + function () { + resized = this._didResize.bind(this)(resized, height); + }.bind(this), + + // apply group height + function () { + this._applyGroupHeight.bind(this)(height); + }.bind(this), + + // update vertical position of items after they are re-stacked and the height of the group is calculated + function () { + this._updateItemsVerticalPosition.bind(this)(margin); + }.bind(this), function () { + if (!this.isVisible && this.height) { + resized = false; } + return resized; + }]; - // Do not draw legend when graph style does not support - if (this.style === Graph3d.STYLE.LINE || this.style === Graph3d.STYLE.BARSIZE //TODO add legend support for BARSIZE - ) { - return; + if (returnQueue) { + return queue; + } else { + var result; + queue.forEach(function (fn) { + result = fn(); + }); + return result; + } +}; + +/** + * recalculate the height of the subgroups + * + * @param {{item: vis.Item}} margin + * @private + */ +Group.prototype._updateSubGroupHeights = function (margin) { + if ((0, _keys2['default'])(this.subgroups).length > 0) { + var me = this; + + this.resetSubgroups(); + + util.forEach(this.visibleItems, function (item) { + if (item.data.subgroup !== undefined) { + me.subgroups[item.data.subgroup].height = Math.max(me.subgroups[item.data.subgroup].height, item.height + margin.item.vertical); + me.subgroups[item.data.subgroup].visible = true; } + }); + } +}; - // Legend types - size and color. Determine if size legend. - var isSizeLegend = this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTSIZE; +/** + * check if group is visible + * + * @param {vis.Range} range + * @param {{axis: vis.DataAxis}} margin + * @returns {boolean} is visible + * @private + */ +Group.prototype._isGroupVisible = function (range, margin) { + return this.top <= range.body.domProps.centerContainer.height - range.body.domProps.scrollTop + margin.axis && this.top + this.height + margin.axis >= -range.body.domProps.scrollTop; +}; - // Legend is either tracking z values or style values. This flag if false means use z values. - var isValueLegend = this.style === Graph3d.STYLE.DOTSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.BARCOLOR; +/** + * recalculate the height of the group + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @returns {number} Returns the height + * @private + */ +Group.prototype._calculateHeight = function (margin) { + // recalculate the height of the group + var height; + var itemsInRange = this.visibleItems; + if (itemsInRange.length > 0) { + var min = itemsInRange[0].top; + var max = itemsInRange[0].top + itemsInRange[0].height; + util.forEach(itemsInRange, function (item) { + min = Math.min(min, item.top); + max = Math.max(max, item.top + item.height); + }); + if (min > margin.axis) { + // there is an empty gap between the lowest item and the axis + var offset = min - margin.axis; + max -= offset; + util.forEach(itemsInRange, function (item) { + item.top -= offset; + }); + } + height = max + margin.item.vertical / 2; + } else { + height = 0; + } + height = Math.max(height, this.props.label.height); - var height = Math.max(this.frame.clientHeight * 0.25, 100); - var top = this.margin; - var width = this._getLegendWidth(); // px - overwritten by size legend - var right = this.frame.clientWidth - this.margin; - var left = right - width; - var bottom = top + height; + return height; +}; - var ctx = this._getContext(); - ctx.lineWidth = 1; - ctx.font = '14px arial'; // TODO: put in options +/** + * Show this group: attach to the DOM + */ +Group.prototype.show = function () { + if (!this.dom.label.parentNode) { + this.itemSet.dom.labelSet.appendChild(this.dom.label); + } - if (isSizeLegend === false) { - // draw the color bar - var ymin = 0; - var ymax = height; // Todo: make height customizable - var y; + if (!this.dom.foreground.parentNode) { + this.itemSet.dom.foreground.appendChild(this.dom.foreground); + } - for (y = ymin; y < ymax; y++) { - var f = (y - ymin) / (ymax - ymin); - var hue = f * 240; - var color = this._hsv2rgb(hue, 1, 1); + if (!this.dom.background.parentNode) { + this.itemSet.dom.background.appendChild(this.dom.background); + } - ctx.strokeStyle = color; - ctx.beginPath(); - ctx.moveTo(left, top + y); - ctx.lineTo(right, top + y); - ctx.stroke(); - } - ctx.strokeStyle = this.axisColor; - ctx.strokeRect(left, top, width, height); - } else { + if (!this.dom.axis.parentNode) { + this.itemSet.dom.axis.appendChild(this.dom.axis); + } +}; - // draw the size legend box - var widthMin; - if (this.style === Graph3d.STYLE.DOTSIZE) { - // Get the proportion to max and min right - widthMin = width * (this.dotSizeMinFraction / this.dotSizeMaxFraction); - } else if (this.style === Graph3d.STYLE.BARSIZE) { - //widthMin = this.xBarWidth * 0.2 this is wrong - barwidth measures in terms of xvalues - } - ctx.strokeStyle = this.axisColor; - ctx.fillStyle = this.dataColor.fill; - ctx.beginPath(); - ctx.moveTo(left, top); - ctx.lineTo(right, top); - ctx.lineTo(left + widthMin, bottom); - ctx.lineTo(left, bottom); - ctx.closePath(); - ctx.fill(); - ctx.stroke(); - } +/** + * Hide this group: remove from the DOM + */ +Group.prototype.hide = function () { + var label = this.dom.label; + if (label.parentNode) { + label.parentNode.removeChild(label); + } - // print value text along the legend edge - var gridLineLen = 5; // px + var foreground = this.dom.foreground; + if (foreground.parentNode) { + foreground.parentNode.removeChild(foreground); + } - var legendMin = isValueLegend ? this.valueRange.min : this.zRange.min; - var legendMax = isValueLegend ? this.valueRange.max : this.zRange.max; - var step = new StepNumber(legendMin, legendMax, (legendMax - legendMin) / 5, true); - step.start(true); + var background = this.dom.background; + if (background.parentNode) { + background.parentNode.removeChild(background); + } - var y; - var from; - var to; - while (!step.end()) { - y = bottom - (step.getCurrent() - legendMin) / (legendMax - legendMin) * height; - from = new Point2d(left - gridLineLen, y); - to = new Point2d(left, y); - this._line(ctx, from, to); + var axis = this.dom.axis; + if (axis.parentNode) { + axis.parentNode.removeChild(axis); + } +}; - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - ctx.fillStyle = this.axisColor; - ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y); +/** + * Add an item to the group + * @param {Item} item + */ +Group.prototype.add = function (item) { + this.items[item.id] = item; + item.setParent(this); + this.stackDirty = true; + // add to + if (item.data.subgroup !== undefined) { + this._addToSubgroup(item); + this.orderSubgroups(); + } - step.next(); - } + if (this.visibleItems.indexOf(item) == -1) { + var range = this.itemSet.body.range; // TODO: not nice accessing the range like this + this._checkIfVisible(item, this.visibleItems, range); + } +}; + +Group.prototype._addToSubgroup = function (item, subgroupId) { + subgroupId = subgroupId || item.data.subgroup; + if (subgroupId != undefined && this.subgroups[subgroupId] === undefined) { + this.subgroups[subgroupId] = { + height: 0, + top: 0, + start: item.data.start, + end: item.data.end || item.data.start, + visible: false, + index: this.subgroupIndex, + items: [], + stack: this.subgroupStackAll || this.subgroupStack[subgroupId] || false + }; + this.subgroupIndex++; + } - ctx.textAlign = 'right'; - ctx.textBaseline = 'top'; - var label = this.legendLabel; - ctx.fillText(label, right, bottom + this.margin); - }; + if (new Date(item.data.start) < new Date(this.subgroups[subgroupId].start)) { + this.subgroups[subgroupId].start = item.data.start; + } - /** - * Redraw the filter - */ - Graph3d.prototype._redrawFilter = function () { - this.frame.filter.innerHTML = ''; + var itemEnd = item.data.end || item.data.start; + if (new Date(itemEnd) > new Date(this.subgroups[subgroupId].end)) { + this.subgroups[subgroupId].end = itemEnd; + } - if (this.dataFilter) { - var options = { - 'visible': this.showAnimationControls - }; - var slider = new Slider(this.frame.filter, options); - this.frame.filter.slider = slider; + this.subgroups[subgroupId].items.push(item); +}; - // TODO: css here is not nice here... - this.frame.filter.style.padding = '10px'; - //this.frame.filter.style.backgroundColor = '#EFEFEF'; +Group.prototype._updateSubgroupsSizes = function () { + var me = this; + if (me.subgroups) { + for (var subgroup in me.subgroups) { + var initialEnd = me.subgroups[subgroup].items[0].data.end || me.subgroups[subgroup].items[0].data.start; + var newStart = me.subgroups[subgroup].items[0].data.start; + var newEnd = initialEnd - 1; - slider.setValues(this.dataFilter.values); - slider.setPlayInterval(this.animationInterval); + me.subgroups[subgroup].items.forEach(function (item) { + if (new Date(item.data.start) < new Date(newStart)) { + newStart = item.data.start; + } - // create an event handler - var me = this; - var onchange = function onchange() { - var index = slider.getIndex(); + var itemEnd = item.data.end || item.data.start; + if (new Date(itemEnd) > new Date(newEnd)) { + newEnd = itemEnd; + } + }); - me.dataFilter.selectValue(index); - me.dataPoints = me.dataFilter._getDataPoints(); + me.subgroups[subgroup].start = newStart; + me.subgroups[subgroup].end = new Date(newEnd - 1); // -1 to compensate for colliding end to start subgroups; + } + } +}; - me.redraw(); - }; - slider.setOnChangeCallback(onchange); - } else { - this.frame.filter.slider = undefined; +Group.prototype.orderSubgroups = function () { + if (this.subgroupOrderer !== undefined) { + var sortArray = []; + var subgroup; + if (typeof this.subgroupOrderer == 'string') { + for (subgroup in this.subgroups) { + sortArray.push({ subgroup: subgroup, sortField: this.subgroups[subgroup].items[0].data[this.subgroupOrderer] }); + } + sortArray.sort(function (a, b) { + return a.sortField - b.sortField; + }); + } else if (typeof this.subgroupOrderer == 'function') { + for (subgroup in this.subgroups) { + sortArray.push(this.subgroups[subgroup].items[0].data); + } + sortArray.sort(this.subgroupOrderer); } - }; - /** - * Redraw the slider - */ - Graph3d.prototype._redrawSlider = function () { - if (this.frame.filter.slider !== undefined) { - this.frame.filter.slider.redraw(); + if (sortArray.length > 0) { + for (var i = 0; i < sortArray.length; i++) { + this.subgroups[sortArray[i].subgroup].index = i; + } } - }; + } +}; - /** - * Redraw common information - */ - Graph3d.prototype._redrawInfo = function () { - if (this.dataFilter) { - var ctx = this._getContext(); +Group.prototype.resetSubgroups = function () { + for (var subgroup in this.subgroups) { + if (this.subgroups.hasOwnProperty(subgroup)) { + this.subgroups[subgroup].visible = false; + this.subgroups[subgroup].height = 0; + } + } +}; - ctx.font = '14px arial'; // TODO: put in options - ctx.lineStyle = 'gray'; - ctx.fillStyle = 'gray'; - ctx.textAlign = 'left'; - ctx.textBaseline = 'top'; - - var x = this.margin; - var y = this.margin; - ctx.fillText(this.dataFilter.getLabel() + ': ' + this.dataFilter.getSelectedValue(), x, y); +/** + * Remove an item from the group + * @param {Item} item + */ +Group.prototype.remove = function (item) { + delete this.items[item.id]; + item.setParent(null); + this.stackDirty = true; + + // remove from visible items + var index = this.visibleItems.indexOf(item); + if (index != -1) this.visibleItems.splice(index, 1); + + if (item.data.subgroup !== undefined) { + this._removeFromSubgroup(item); + this.orderSubgroups(); + } +}; + +Group.prototype._removeFromSubgroup = function (item, subgroupId) { + subgroupId = subgroupId || item.data.subgroup; + if (subgroupId != undefined) { + var subgroup = this.subgroups[subgroupId]; + if (subgroup) { + var itemIndex = subgroup.items.indexOf(item); + // Check the item is actually in this subgroup. How should items not in the group be handled? + if (itemIndex >= 0) { + subgroup.items.splice(itemIndex, 1); + if (!subgroup.items.length) { + delete this.subgroups[subgroupId]; + } else { + this._updateSubgroupsSizes(); + } + } } - }; + } +}; - /** - * Draw a line between 2d points 'from' and 'to'. - * - * If stroke style specified, set that as well. - */ - Graph3d.prototype._line = function (ctx, from, to, strokeStyle) { - if (strokeStyle !== undefined) { - ctx.strokeStyle = strokeStyle; - } +/** + * Remove an item from the corresponding DataSet + * @param {Item} item + */ +Group.prototype.removeFromDataSet = function (item) { + this.itemSet.removeItem(item.id); +}; - ctx.beginPath(); - ctx.moveTo(from.x, from.y); - ctx.lineTo(to.x, to.y); - ctx.stroke(); - }; +/** + * Reorder the items + */ +Group.prototype.order = function () { + var array = util.toArray(this.items); + var startArray = []; + var endArray = []; - Graph3d.prototype.drawAxisLabelX = function (ctx, point3d, text, armAngle, yMargin) { - if (yMargin === undefined) { - yMargin = 0; + for (var i = 0; i < array.length; i++) { + if (array[i].data.end !== undefined) { + endArray.push(array[i]); } + startArray.push(array[i]); + } + this.orderedItems = { + byStart: startArray, + byEnd: endArray + }; - var point2d = this._convert3Dto2D(point3d); + stack.orderByStart(this.orderedItems.byStart); + stack.orderByEnd(this.orderedItems.byEnd); +}; - if (Math.cos(armAngle * 2) > 0) { - ctx.textAlign = 'center'; - ctx.textBaseline = 'top'; - point2d.y += yMargin; - } else if (Math.sin(armAngle * 2) < 0) { - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; +/** + * Update the visible items + * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date + * @param {Item[]} oldVisibleItems The previously visible items. + * @param {{start: number, end: number}} range Visible range + * @return {Item[]} visibleItems The new visible items. + * @private + */ +Group.prototype._updateItemsInRange = function (orderedItems, oldVisibleItems, range) { + var visibleItems = []; + var visibleItemsLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems + + var interval = (range.end - range.start) / 4; + var lowerBound = range.start - interval; + var upperBound = range.end + interval; + + // this function is used to do the binary search. + var searchFunction = function searchFunction(value) { + if (value < lowerBound) { + return -1; + } else if (value <= upperBound) { + return 0; } else { - ctx.textAlign = 'left'; - ctx.textBaseline = 'middle'; + return 1; } - - ctx.fillStyle = this.axisColor; - ctx.fillText(text, point2d.x, point2d.y); }; - Graph3d.prototype.drawAxisLabelY = function (ctx, point3d, text, armAngle, yMargin) { - if (yMargin === undefined) { - yMargin = 0; + // first check if the items that were in view previously are still in view. + // IMPORTANT: this handles the case for the items with startdate before the window and enddate after the window! + // also cleans up invisible items. + if (oldVisibleItems.length > 0) { + for (var i = 0; i < oldVisibleItems.length; i++) { + this._checkIfVisibleWithReference(oldVisibleItems[i], visibleItems, visibleItemsLookup, range); } + } - var point2d = this._convert3Dto2D(point3d); - - if (Math.cos(armAngle * 2) < 0) { - ctx.textAlign = 'center'; - ctx.textBaseline = 'top'; - point2d.y += yMargin; - } else if (Math.sin(armAngle * 2) > 0) { - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - } else { - ctx.textAlign = 'left'; - ctx.textBaseline = 'middle'; - } + // we do a binary search for the items that have only start values. + var initialPosByStart = util.binarySearchCustom(orderedItems.byStart, searchFunction, 'data', 'start'); - ctx.fillStyle = this.axisColor; - ctx.fillText(text, point2d.x, point2d.y); - }; + // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the start values. + this._traceVisible(initialPosByStart, orderedItems.byStart, visibleItems, visibleItemsLookup, function (item) { + return item.data.start < lowerBound || item.data.start > upperBound; + }); - Graph3d.prototype.drawAxisLabelZ = function (ctx, point3d, text, offset) { - if (offset === undefined) { - offset = 0; + // if the window has changed programmatically without overlapping the old window, the ranged items with start < lowerBound and end > upperbound are not shown. + // We therefore have to brute force check all items in the byEnd list + if (this.checkRangedItems == true) { + this.checkRangedItems = false; + for (i = 0; i < orderedItems.byEnd.length; i++) { + this._checkIfVisibleWithReference(orderedItems.byEnd[i], visibleItems, visibleItemsLookup, range); } + } else { + // we do a binary search for the items that have defined end times. + var initialPosByEnd = util.binarySearchCustom(orderedItems.byEnd, searchFunction, 'data', 'end'); - var point2d = this._convert3Dto2D(point3d); - ctx.textAlign = 'right'; - ctx.textBaseline = 'middle'; - ctx.fillStyle = this.axisColor; - ctx.fillText(text, point2d.x - offset, point2d.y); - }; - - /** - - - /** - * Draw a line between 2d points 'from' and 'to'. - * - * If stroke style specified, set that as well. - */ - Graph3d.prototype._line3d = function (ctx, from, to, strokeStyle) { - var from2d = this._convert3Dto2D(from); - var to2d = this._convert3Dto2D(to); + // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the end values. + this._traceVisible(initialPosByEnd, orderedItems.byEnd, visibleItems, visibleItemsLookup, function (item) { + return item.data.end < lowerBound || item.data.end > upperBound; + }); + } - this._line(ctx, from2d, to2d, strokeStyle); - }; + var redrawQueue = {}; + var redrawQueueLength = 0; - /** - * Redraw the axis - */ - Graph3d.prototype._redrawAxis = function () { - var ctx = this._getContext(), - from, - to, - step, - prettyStep, - text, - xText, - yText, - zText, - offset, - xOffset, - yOffset; - - // TODO: get the actual rendered style of the containerElement - //ctx.font = this.containerElement.style.font; - ctx.font = 24 / this.camera.getArmLength() + 'px arial'; - - // calculate the length for the short grid lines - var gridLenX = 0.025 / this.scale.x; - var gridLenY = 0.025 / this.scale.y; - var textMargin = 5 / this.camera.getArmLength(); // px - var armAngle = this.camera.getArmRotation().horizontal; - var armVector = new Point2d(Math.cos(armAngle), Math.sin(armAngle)); - - var xRange = this.xRange; - var yRange = this.yRange; - var zRange = this.zRange; - - // draw x-grid lines - ctx.lineWidth = 1; - prettyStep = this.defaultXStep === undefined; - step = new StepNumber(xRange.min, xRange.max, this.xStep, prettyStep); - step.start(true); + for (i = 0; i < visibleItems.length; i++) { + var item = visibleItems[i]; + if (!item.displayed) { + var returnQueue = true; + redrawQueue[i] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[i].length; + } + } - while (!step.end()) { - var x = step.getCurrent(); + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + // redraw all regular items + for (var j = 0; j < redrawQueueLength; j++) { + util.forEach(redrawQueue, function (fns) { + fns[j](); + }); + } + } - if (this.showGrid) { - from = new Point3d(x, yRange.min, zRange.min); - to = new Point3d(x, yRange.max, zRange.min); - this._line3d(ctx, from, to, this.gridColor); - } else if (this.showXAxis) { - from = new Point3d(x, yRange.min, zRange.min); - to = new Point3d(x, yRange.min + gridLenX, zRange.min); - this._line3d(ctx, from, to, this.axisColor); + for (i = 0; i < visibleItems.length; i++) { + visibleItems[i].repositionX(); + } + return visibleItems; +}; - from = new Point3d(x, yRange.max, zRange.min); - to = new Point3d(x, yRange.max - gridLenX, zRange.min); - this._line3d(ctx, from, to, this.axisColor); +Group.prototype._traceVisible = function (initialPos, items, visibleItems, visibleItemsLookup, breakCondition) { + if (initialPos != -1) { + var i, item; + for (i = initialPos; i >= 0; i--) { + item = items[i]; + if (breakCondition(item)) { + break; + } else { + if (visibleItemsLookup[item.id] === undefined) { + visibleItemsLookup[item.id] = true; + visibleItems.push(item); + } } + } - if (this.showXAxis) { - yText = armVector.x > 0 ? yRange.min : yRange.max; - var point3d = new Point3d(x, yText, zRange.min); - var msg = ' ' + this.xValueLabel(x) + ' '; - this.drawAxisLabelX(ctx, point3d, msg, armAngle, textMargin); + for (i = initialPos + 1; i < items.length; i++) { + item = items[i]; + if (breakCondition(item)) { + break; + } else { + if (visibleItemsLookup[item.id] === undefined) { + visibleItemsLookup[item.id] = true; + visibleItems.push(item); + } } + } + } +}; - step.next(); +/** + * this function is very similar to the _checkIfInvisible() but it does not + * return booleans, hides the item if it should not be seen and always adds to + * the visibleItems. + * this one is for brute forcing and hiding. + * + * @param {Item} item + * @param {Array} visibleItems + * @param {{start:number, end:number}} range + * @private + */ +Group.prototype._checkIfVisible = function (item, visibleItems, range) { + if (item.isVisible(range)) { + if (!item.displayed) item.show(); + // reposition item horizontally + item.repositionX(); + visibleItems.push(item); + } else { + if (item.displayed) item.hide(); + } +}; + +/** + * this function is very similar to the _checkIfInvisible() but it does not + * return booleans, hides the item if it should not be seen and always adds to + * the visibleItems. + * this one is for brute forcing and hiding. + * + * @param {Item} item + * @param {Array.} visibleItems + * @param {Object} visibleItemsLookup + * @param {{start:number, end:number}} range + * @private + */ +Group.prototype._checkIfVisibleWithReference = function (item, visibleItems, visibleItemsLookup, range) { + if (item.isVisible(range)) { + if (visibleItemsLookup[item.id] === undefined) { + visibleItemsLookup[item.id] = true; + visibleItems.push(item); } + } else { + if (item.displayed) item.hide(); + } +}; - // draw y-grid lines - ctx.lineWidth = 1; - prettyStep = this.defaultYStep === undefined; - step = new StepNumber(yRange.min, yRange.max, this.yStep, prettyStep); - step.start(true); +Group.prototype.changeSubgroup = function (item, oldSubgroup, newSubgroup) { + this._removeFromSubgroup(item, oldSubgroup); + this._addToSubgroup(item, newSubgroup); + this.orderSubgroups(); +}; - while (!step.end()) { - var y = step.getCurrent(); +module.exports = Group; - if (this.showGrid) { - from = new Point3d(xRange.min, y, zRange.min); - to = new Point3d(xRange.max, y, zRange.min); - this._line3d(ctx, from, to, this.gridColor); - } else if (this.showYAxis) { - from = new Point3d(xRange.min, y, zRange.min); - to = new Point3d(xRange.min + gridLenY, y, zRange.min); - this._line3d(ctx, from, to, this.axisColor); +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { - from = new Point3d(xRange.max, y, zRange.min); - to = new Point3d(xRange.max - gridLenY, y, zRange.min); - this._line3d(ctx, from, to, this.axisColor); - } +"use strict"; - if (this.showYAxis) { - xText = armVector.y > 0 ? xRange.min : xRange.max; - point3d = new Point3d(xText, y, zRange.min); - var msg = ' ' + this.yValueLabel(y) + ' '; - this.drawAxisLabelY(ctx, point3d, msg, armAngle, textMargin); - } - step.next(); - } +var _create = __webpack_require__(29); - // draw z-grid lines and axis - if (this.showZAxis) { - ctx.lineWidth = 1; - prettyStep = this.defaultZStep === undefined; - step = new StepNumber(zRange.min, zRange.max, this.zStep, prettyStep); - step.start(true); +var _create2 = _interopRequireDefault(_create); - xText = armVector.x > 0 ? xRange.min : xRange.max; - yText = armVector.y < 0 ? yRange.min : yRange.max; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - while (!step.end()) { - var z = step.getCurrent(); +var Group = __webpack_require__(68); - // TODO: make z-grid lines really 3d? - var from3d = new Point3d(xText, yText, z); - var from2d = this._convert3Dto2D(from3d); - to = new Point2d(from2d.x - textMargin, from2d.y); - this._line(ctx, from2d, to, this.axisColor); +/** + * @constructor BackgroundGroup + * @param {number | string} groupId + * @param {Object} data + * @param {ItemSet} itemSet + * @extends Group + */ +function BackgroundGroup(groupId, data, itemSet) { + Group.call(this, groupId, data, itemSet); + + this.width = 0; + this.height = 0; + this.top = 0; + this.left = 0; +} + +BackgroundGroup.prototype = (0, _create2['default'])(Group.prototype); - var msg = this.zValueLabel(z) + ' '; - this.drawAxisLabelZ(ctx, from3d, msg, 5); +/** + * Repaint this group + * @param {{start: number, end: number}} range + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * @param {boolean} [forceRestack=false] Force restacking of all items + * @return {boolean} Returns true if the group is resized + */ +BackgroundGroup.prototype.redraw = function (range, margin, forceRestack) { + // eslint-disable-line no-unused-vars + var resized = false; - step.next(); - } + this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); - ctx.lineWidth = 1; - from = new Point3d(xText, yText, zRange.min); - to = new Point3d(xText, yText, zRange.max); - this._line3d(ctx, from, to, this.axisColor); - } + // calculate actual size + this.width = this.dom.background.offsetWidth; - // draw x-axis - if (this.showXAxis) { - var xMin2d; - var xMax2d; - ctx.lineWidth = 1; + // apply new height (just always zero for BackgroundGroup + this.dom.background.style.height = '0'; - // line at yMin - xMin2d = new Point3d(xRange.min, yRange.min, zRange.min); - xMax2d = new Point3d(xRange.max, yRange.min, zRange.min); - this._line3d(ctx, xMin2d, xMax2d, this.axisColor); - // line at ymax - xMin2d = new Point3d(xRange.min, yRange.max, zRange.min); - xMax2d = new Point3d(xRange.max, yRange.max, zRange.min); - this._line3d(ctx, xMin2d, xMax2d, this.axisColor); - } + // update vertical position of items after they are re-stacked and the height of the group is calculated + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(margin); + } - // draw y-axis - if (this.showYAxis) { - ctx.lineWidth = 1; - // line at xMin - from = new Point3d(xRange.min, yRange.min, zRange.min); - to = new Point3d(xRange.min, yRange.max, zRange.min); - this._line3d(ctx, from, to, this.axisColor); - // line at xMax - from = new Point3d(xRange.max, yRange.min, zRange.min); - to = new Point3d(xRange.max, yRange.max, zRange.min); - this._line3d(ctx, from, to, this.axisColor); - } + return resized; +}; - // draw x-label - var xLabel = this.xLabel; - if (xLabel.length > 0 && this.showXAxis) { - yOffset = 0.1 / this.scale.y; - xText = (xRange.max + 3 * xRange.min) / 4; - yText = armVector.x > 0 ? yRange.min - yOffset : yRange.max + yOffset; - text = new Point3d(xText, yText, zRange.min); - this.drawAxisLabelX(ctx, text, xLabel, armAngle); - } +/** + * Show this group: attach to the DOM + */ +BackgroundGroup.prototype.show = function () { + if (!this.dom.background.parentNode) { + this.itemSet.dom.background.appendChild(this.dom.background); + } +}; - // draw y-label - var yLabel = this.yLabel; - if (yLabel.length > 0 && this.showYAxis) { - xOffset = 0.1 / this.scale.x; - xText = armVector.y > 0 ? xRange.min - xOffset : xRange.max + xOffset; - yText = (yRange.max + 3 * yRange.min) / 4; - text = new Point3d(xText, yText, zRange.min); +module.exports = BackgroundGroup; + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; - this.drawAxisLabelY(ctx, text, yLabel, armAngle); - } - // draw z-label - var zLabel = this.zLabel; - if (zLabel.length > 0 && this.showZAxis) { - offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis? - xText = armVector.x > 0 ? xRange.min : xRange.max; - yText = armVector.y < 0 ? yRange.min : yRange.max; - zText = (zRange.max + 3 * zRange.min) / 4; - text = new Point3d(xText, yText, zText); +var Item = __webpack_require__(38); - this.drawAxisLabelZ(ctx, text, zLabel, offset); +/** + * @constructor RangeItem + * @extends Item + * @param {Object} data Object containing parameters start, end + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe options + */ +function RangeItem(data, conversion, options) { + this.props = { + content: { + width: 0 } }; + this.overflow = false; // if contents can overflow (css styling), this flag is set to true + this.options = options; + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data.id); + } + if (data.end == undefined) { + throw new Error('Property "end" missing in item ' + data.id); + } + } - /** - * Calculate the color based on the given value. - * @param {Number} H Hue, a value be between 0 and 360 - * @param {Number} S Saturation, a value between 0 and 1 - * @param {Number} V Value, a value between 0 and 1 - */ - Graph3d.prototype._hsv2rgb = function (H, S, V) { - var R, G, B, C, Hi, X; - - C = V * S; - Hi = Math.floor(H / 60); // hi = 0,1,2,3,4,5 - X = C * (1 - Math.abs(H / 60 % 2 - 1)); - - switch (Hi) { - case 0: - R = C;G = X;B = 0;break; - case 1: - R = X;G = C;B = 0;break; - case 2: - R = 0;G = C;B = X;break; - case 3: - R = 0;G = X;B = C;break; - case 4: - R = X;G = 0;B = C;break; - case 5: - R = C;G = 0;B = X;break; + Item.call(this, data, conversion, options); +} - default: - R = 0;G = 0;B = 0;break; - } +RangeItem.prototype = new Item(null, null, null); - return 'RGB(' + parseInt(R * 255) + ',' + parseInt(G * 255) + ',' + parseInt(B * 255) + ')'; - }; +RangeItem.prototype.baseClassName = 'vis-item vis-range'; - Graph3d.prototype._getStrokeWidth = function (point) { - if (point !== undefined) { - if (this.showPerspective) { - return 1 / -point.trans.z * this.dataColor.strokeWidth; - } else { - return -(this.eye.z / this.camera.getArmLength()) * this.dataColor.strokeWidth; - } - } +/** + * Check whether this item is visible inside given range + * + * @param {vis.Range} range with a timestamp for start and end + * @returns {boolean} True if visible + */ +RangeItem.prototype.isVisible = function (range) { + // determine visibility + return this.data.start < range.end && this.data.end > range.start; +}; + +RangeItem.prototype._createDomElement = function () { + if (!this.dom) { + // create DOM + this.dom = {}; - return this.dataColor.strokeWidth; - }; + // background box + this.dom.box = document.createElement('div'); + // className is updated in redraw() - // ----------------------------------------------------------------------------- - // Drawing primitives for the graphs - // ----------------------------------------------------------------------------- + // frame box (to prevent the item contents from overflowing) + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'vis-item-overflow'; + this.dom.box.appendChild(this.dom.frame); + // visible frame box (showing the frame that is always visible) + this.dom.visibleFrame = document.createElement('div'); + this.dom.visibleFrame.className = 'vis-item-visible-frame'; + this.dom.box.appendChild(this.dom.visibleFrame); - /** - * Draw a bar element in the view with the given properties. - */ - Graph3d.prototype._redrawBar = function (ctx, point, xWidth, yWidth, color, borderColor) { - var i, j, surface; + // contents box + this.dom.content = document.createElement('div'); + this.dom.content.className = 'vis-item-content'; + this.dom.frame.appendChild(this.dom.content); - // calculate all corner points - var me = this; - var point3d = point.point; - var zMin = this.zRange.min; - var top = [{ point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, point3d.z) }, { point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, point3d.z) }, { point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, point3d.z) }, { point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, point3d.z) }]; - var bottom = [{ point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, zMin) }, { point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, zMin) }, { point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, zMin) }, { point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, zMin) }]; - - // calculate screen location of the points - top.forEach(function (obj) { - obj.screen = me._convert3Dto2D(obj.point); - }); - bottom.forEach(function (obj) { - obj.screen = me._convert3Dto2D(obj.point); - }); + // attach this item as attribute + this.dom.box['timeline-item'] = this; - // create five sides, calculate both corner points and center points - var surfaces = [{ corners: top, center: Point3d.avg(bottom[0].point, bottom[2].point) }, { corners: [top[0], top[1], bottom[1], bottom[0]], center: Point3d.avg(bottom[1].point, bottom[0].point) }, { corners: [top[1], top[2], bottom[2], bottom[1]], center: Point3d.avg(bottom[2].point, bottom[1].point) }, { corners: [top[2], top[3], bottom[3], bottom[2]], center: Point3d.avg(bottom[3].point, bottom[2].point) }, { corners: [top[3], top[0], bottom[0], bottom[3]], center: Point3d.avg(bottom[0].point, bottom[3].point) }]; - point.surfaces = surfaces; + this.dirty = true; + } +}; - // calculate the distance of each of the surface centers to the camera - for (j = 0; j < surfaces.length; j++) { - surface = surfaces[j]; - var transCenter = this._convertPointToTranslation(surface.center); - surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z; - // TODO: this dept calculation doesn't work 100% of the cases due to perspective, - // but the current solution is fast/simple and works in 99.9% of all cases - // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9}) +RangeItem.prototype._appendDomElement = function () { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw item: parent has no foreground container element'); } + foreground.appendChild(this.dom.box); + } + this.displayed = true; +}; - // order the surfaces by their (translated) depth - surfaces.sort(function (a, b) { - var diff = b.dist - a.dist; - if (diff) return diff; +RangeItem.prototype._updateDirtyDomComponents = function () { + // update dirty DOM. An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.box); + this._updateStyle(this.dom.box); - // if equal depth, sort the top surface last - if (a.corners === top) return 1; - if (b.corners === top) return -1; + var editable = this.editable.updateTime || this.editable.updateGroup; - // both are equal - return 0; - }); + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); + this.dom.box.className = this.baseClassName + className; + + // turn off max-width to be able to calculate the real width + // this causes an extra browser repaint/reflow, but so be it + this.dom.content.style.maxWidth = 'none'; + } +}; - // draw the ordered surfaces - ctx.lineWidth = this._getStrokeWidth(point); - ctx.strokeStyle = borderColor; - ctx.fillStyle = color; - // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside - for (j = 2; j < surfaces.length; j++) { - surface = surfaces[j]; - this._polygon(ctx, surface.corners); +RangeItem.prototype._getDomComponentsSizes = function () { + // determine from css whether this box has overflow + this.overflow = window.getComputedStyle(this.dom.frame).overflow !== 'hidden'; + return { + content: { + width: this.dom.content.offsetWidth + }, + box: { + height: this.dom.box.offsetHeight } }; +}; - /** - * Draw a polygon using the passed points and fill it with the passed style and stroke. - * - * @param points an array of points. - * @param fillStyle optional; the fill style to set - * @param strokeStyle optional; the stroke style to set - */ - Graph3d.prototype._polygon = function (ctx, points, fillStyle, strokeStyle) { - if (points.length < 2) { - return; - } +RangeItem.prototype._updateDomComponentsSizes = function (sizes) { + this.props.content.width = sizes.content.width; + this.height = sizes.box.height; + this.dom.content.style.maxWidth = ''; + this.dirty = false; +}; + +RangeItem.prototype._repaintDomAdditionals = function () { + this._repaintOnItemUpdateTimeTooltip(this.dom.box); + this._repaintDeleteButton(this.dom.box); + this._repaintDragCenter(); + this._repaintDragLeft(); + this._repaintDragRight(); +}; - if (fillStyle !== undefined) { - ctx.fillStyle = fillStyle; +/** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw queue if returnQueue=true + */ +RangeItem.prototype.redraw = function (returnQueue) { + var sizes; + var queue = [ + // create item DOM + this._createDomElement.bind(this), + + // append DOM to parent DOM + this._appendDomElement.bind(this), + + // update dirty DOM + this._updateDirtyDomComponents.bind(this), function () { + if (this.dirty) { + sizes = this._getDomComponentsSizes.bind(this)(); } - if (strokeStyle !== undefined) { - ctx.strokeStyle = strokeStyle; + }.bind(this), function () { + if (this.dirty) { + this._updateDomComponentsSizes.bind(this)(sizes); } - ctx.beginPath(); - ctx.moveTo(points[0].screen.x, points[0].screen.y); + }.bind(this), - for (var i = 1; i < points.length; ++i) { - var point = points[i]; - ctx.lineTo(point.screen.x, point.screen.y); - } + // repaint DOM additionals + this._repaintDomAdditionals.bind(this)]; - ctx.closePath(); - ctx.fill(); - ctx.stroke(); // TODO: only draw stroke when strokeWidth > 0 - }; + if (returnQueue) { + return queue; + } else { + var result; + queue.forEach(function (fn) { + result = fn(); + }); + return result; + } +}; - /** - * @param size optional; if not specified use value from 'this._dotSize()` - */ - Graph3d.prototype._drawCircle = function (ctx, point, color, borderColor, size) { - var radius = this._calcRadius(point, size); +/** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + */ +RangeItem.prototype.show = function () { + if (!this.displayed) { + this.redraw(); + } +}; - ctx.lineWidth = this._getStrokeWidth(point); - ctx.strokeStyle = borderColor; - ctx.fillStyle = color; - ctx.beginPath(); - ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI * 2, true); - ctx.fill(); - ctx.stroke(); - }; +/** + * Hide the item from the DOM (when visible) + */ +RangeItem.prototype.hide = function () { + if (this.displayed) { + var box = this.dom.box; - /** - * Determine the colors for the 'regular' graph styles. - */ - Graph3d.prototype._getColorsRegular = function (point) { - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - var hue = (1 - (point.point.z - this.zRange.min) * this.scale.z / this.verticalRatio) * 240; - var color = this._hsv2rgb(hue, 1, 1); - var borderColor = this._hsv2rgb(hue, 1, 0.8); + if (box.parentNode) { + box.parentNode.removeChild(box); + } - return { - fill: color, - border: borderColor - }; - }; + this.displayed = false; + } +}; - /** - * Get the colors for the 'color' graph styles. - * These styles are currently: 'bar-color' and 'dot-color' - * Color may be set as a string representation of HTML color, like #ff00ff, - * or calculated from a number, for example, distance from this point - * The first option is useful when we have some pre-given legend, to which we have to adjust ourselves - * The second option is useful when we are interested in automatically setting the color, from some value, - * using some color scale - */ - Graph3d.prototype._getColorsColor = function (point) { - // calculate the color based on the value - var color, borderColor; +/** + * Reposition the item horizontally + * @param {boolean} [limitSize=true] If true (default), the width of the range + * item will be limited, as the browser cannot + * display very wide divs. This means though + * that the applied left and width may + * not correspond to the ranges start and end + * @Override + */ +RangeItem.prototype.repositionX = function (limitSize) { + var parentWidth = this.parent.width; + var start = this.conversion.toScreen(this.data.start); + var end = this.conversion.toScreen(this.data.end); + var align = this.data.align === undefined ? this.options.align : this.data.align; + var contentStartPosition; + var contentWidth; + + // limit the width of the range, as browsers cannot draw very wide divs + // unless limitSize: false is explicitly set in item data + if (this.data.limitSize !== false && (limitSize === undefined || limitSize === true)) { + if (start < -parentWidth) { + start = -parentWidth; + } + if (end > 2 * parentWidth) { + end = 2 * parentWidth; + } + } + + // add 0.5 to compensate floating-point values rounding + var boxWidth = Math.max(end - start + 0.5, 1); + + if (this.overflow) { + if (this.options.rtl) { + this.right = start; + } else { + this.left = start; + } + this.width = boxWidth + this.props.content.width; + contentWidth = this.props.content.width; - if (typeof point.point.value === "string") { - color = point.point.value; - borderColor = point.point.value; + // Note: The calculation of width is an optimistic calculation, giving + // a width which will not change when moving the Timeline + // So no re-stacking needed, which is nicer for the eye; + } else { + if (this.options.rtl) { + this.right = start; } else { - var hue = (1 - (point.point.value - this.valueRange.min) * this.scale.value) * 240; - color = this._hsv2rgb(hue, 1, 1); - borderColor = this._hsv2rgb(hue, 1, 0.8); + this.left = start; } - return { - fill: color, - border: borderColor - }; - }; + this.width = boxWidth; + contentWidth = Math.min(end - start, this.props.content.width); + } - /** - * Get the colors for the 'size' graph styles. - * These styles are currently: 'bar-size' and 'dot-size' - */ - Graph3d.prototype._getColorsSize = function () { - return { - fill: this.dataColor.fill, - border: this.dataColor.stroke - }; - }; + if (this.options.rtl) { + this.dom.box.style.right = this.right + 'px'; + } else { + this.dom.box.style.left = this.left + 'px'; + } + this.dom.box.style.width = boxWidth + 'px'; - /** - * Determine the size of a point on-screen, as determined by the - * distance to the camera. - * - * @param size the size that needs to be translated to screen coordinates. - * optional; if not passed, use the default point size. - */ - Graph3d.prototype._calcRadius = function (point, size) { - if (size === undefined) { - size = this._dotSize(); - } + switch (align) { + case 'left': + if (this.options.rtl) { + this.dom.content.style.right = '0'; + } else { + this.dom.content.style.left = '0'; + } + break; - var radius; - if (this.showPerspective) { - radius = size / -point.trans.z; - } else { - radius = size * -(this.eye.z / this.camera.getArmLength()); - } - if (radius < 0) { - radius = 0; - } + case 'right': + if (this.options.rtl) { + this.dom.content.style.right = Math.max(boxWidth - contentWidth, 0) + 'px'; + } else { + this.dom.content.style.left = Math.max(boxWidth - contentWidth, 0) + 'px'; + } + break; - return radius; - }; + case 'center': + if (this.options.rtl) { + this.dom.content.style.right = Math.max((boxWidth - contentWidth) / 2, 0) + 'px'; + } else { + this.dom.content.style.left = Math.max((boxWidth - contentWidth) / 2, 0) + 'px'; + } - // ----------------------------------------------------------------------------- - // Methods for drawing points per graph style. - // ----------------------------------------------------------------------------- + break; + default: + // 'auto' + // when range exceeds left of the window, position the contents at the left of the visible area + if (this.overflow) { + if (end > 0) { + contentStartPosition = Math.max(-start, 0); + } else { + contentStartPosition = -contentWidth; // ensure it's not visible anymore + } + } else { + if (start < 0) { + contentStartPosition = -start; + } else { + contentStartPosition = 0; + } + } + if (this.options.rtl) { + this.dom.content.style.right = contentStartPosition + 'px'; + } else { + this.dom.content.style.left = contentStartPosition + 'px'; + this.dom.content.style.width = 'calc(100% - ' + contentStartPosition + 'px)'; + } + } +}; - /** - * Draw single datapoint for graph style 'bar'. - */ - Graph3d.prototype._redrawBarGraphPoint = function (ctx, point) { - var xWidth = this.xBarWidth / 2; - var yWidth = this.yBarWidth / 2; - var colors = this._getColorsRegular(point); +/** + * Reposition the item vertically + * @Override + */ +RangeItem.prototype.repositionY = function () { + var orientation = this.options.orientation.item; + var box = this.dom.box; + + if (orientation == 'top') { + box.style.top = this.top + 'px'; + } else { + box.style.top = this.parent.height - this.top - this.height + 'px'; + } +}; - this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border); - }; +/** + * Repaint a drag area on the left side of the range when the range is selected + * @protected + */ +RangeItem.prototype._repaintDragLeft = function () { + if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.options.editable.updateTime && !this.dom.dragLeft) { + // create and show drag area + var dragLeft = document.createElement('div'); + dragLeft.className = 'vis-drag-left'; + dragLeft.dragLeftItem = this; + + this.dom.box.appendChild(dragLeft); + this.dom.dragLeft = dragLeft; + } else if (!this.selected && !this.options.itemsAlwaysDraggable.range && this.dom.dragLeft) { + // delete drag area + if (this.dom.dragLeft.parentNode) { + this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft); + } + this.dom.dragLeft = null; + } +}; - /** - * Draw single datapoint for graph style 'bar-color'. - */ - Graph3d.prototype._redrawBarColorGraphPoint = function (ctx, point) { - var xWidth = this.xBarWidth / 2; - var yWidth = this.yBarWidth / 2; - var colors = this._getColorsColor(point); +/** + * Repaint a drag area on the right side of the range when the range is selected + * @protected + */ +RangeItem.prototype._repaintDragRight = function () { + if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.options.editable.updateTime && !this.dom.dragRight) { + // create and show drag area + var dragRight = document.createElement('div'); + dragRight.className = 'vis-drag-right'; + dragRight.dragRightItem = this; - this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border); - }; + this.dom.box.appendChild(dragRight); + this.dom.dragRight = dragRight; + } else if (!this.selected && !this.options.itemsAlwaysDraggable.range && this.dom.dragRight) { + // delete drag area + if (this.dom.dragRight.parentNode) { + this.dom.dragRight.parentNode.removeChild(this.dom.dragRight); + } + this.dom.dragRight = null; + } +}; - /** - * Draw single datapoint for graph style 'bar-size'. - */ - Graph3d.prototype._redrawBarSizeGraphPoint = function (ctx, point) { - // calculate size for the bar - var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range(); - var xWidth = this.xBarWidth / 2 * (fraction * 0.8 + 0.2); - var yWidth = this.yBarWidth / 2 * (fraction * 0.8 + 0.2); +module.exports = RangeItem; - var colors = this._getColorsSize(); +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { - this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border); - }; +"use strict"; - /** - * Draw single datapoint for graph style 'dot'. - */ - Graph3d.prototype._redrawDotGraphPoint = function (ctx, point) { - var colors = this._getColorsRegular(point); - this._drawCircle(ctx, point, colors.fill, colors.border); - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * Draw single datapoint for graph style 'dot-line'. - */ - Graph3d.prototype._redrawDotLineGraphPoint = function (ctx, point) { - // draw a vertical line from the XY-plane to the graph value - var from = this._convert3Dto2D(point.bottom); - ctx.lineWidth = 1; - this._line(ctx, from, point.screen, this.gridColor); +var _stringify = __webpack_require__(19); - this._redrawDotGraphPoint(ctx, point); - }; +var _stringify2 = _interopRequireDefault(_stringify); - /** - * Draw single datapoint for graph style 'dot-color'. - */ - Graph3d.prototype._redrawDotColorGraphPoint = function (ctx, point) { - var colors = this._getColorsColor(point); +var _typeof2 = __webpack_require__(6); - this._drawCircle(ctx, point, colors.fill, colors.border); - }; +var _typeof3 = _interopRequireDefault(_typeof2); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var util = __webpack_require__(2); + +var ColorPicker = __webpack_require__(179)['default']; + +/** + * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. + * Boolean options are recognised as Boolean + * Number options should be written as array: [default value, min value, max value, stepsize] + * Colors should be written as array: ['color', '#ffffff'] + * Strings with should be written as array: [option1, option2, option3, ..] + * + * The options are matched with their counterparts in each of the modules and the values used in the configuration are + */ +var Configurator = function () { /** - * Draw single datapoint for graph style 'dot-size'. + * @param {Object} parentModule | the location where parentModule.setOptions() can be called + * @param {Object} defaultContainer | the default container of the module + * @param {Object} configureOptions | the fully configured and predefined options set found in allOptions.js + * @param {number} pixelRatio | canvas pixel ratio */ - Graph3d.prototype._redrawDotSizeGraphPoint = function (ctx, point) { - var dotSize = this._dotSize(); - var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range(); + function Configurator(parentModule, defaultContainer, configureOptions) { + var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + (0, _classCallCheck3['default'])(this, Configurator); - var sizeMin = dotSize * this.dotSizeMinFraction; - var sizeRange = dotSize * this.dotSizeMaxFraction - sizeMin; - var size = sizeMin + sizeRange * fraction; + this.parent = parentModule; + this.changedOptions = []; + this.container = defaultContainer; + this.allowCreation = false; - var colors = this._getColorsSize(); + this.options = {}; + this.initialized = false; + this.popupCounter = 0; + this.defaultOptions = { + enabled: false, + filter: true, + container: undefined, + showButton: true + }; + util.extend(this.options, this.defaultOptions); - this._drawCircle(ctx, point, colors.fill, colors.border, size); - }; + this.configureOptions = configureOptions; + this.moduleOptions = {}; + this.domElements = []; + this.popupDiv = {}; + this.popupLimit = 5; + this.popupHistory = {}; + this.colorPicker = new ColorPicker(pixelRatio); + this.wrapper = undefined; + } /** - * Draw single datapoint for graph style 'surface'. + * refresh all options. + * Because all modules parse their options by themselves, we just use their options. We copy them here. + * + * @param {Object} options */ - Graph3d.prototype._redrawSurfaceGraphPoint = function (ctx, point) { - var right = point.pointRight; - var top = point.pointTop; - var cross = point.pointCross; - if (point === undefined || right === undefined || top === undefined || cross === undefined) { - return; - } - var topSideVisible = true; - var fillStyle; - var strokeStyle; - var lineWidth; + (0, _createClass3['default'])(Configurator, [{ + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + // reset the popup history because the indices may have been changed. + this.popupHistory = {}; + this._removePopup(); - if (this.showGrayBottom || this.showShadow) { - // calculate the cross product of the two vectors from center - // to left and right, in order to know whether we are looking at the - // bottom or at the top side. We can also use the cross product - // for calculating light intensity - var aDiff = Point3d.subtract(cross.trans, point.trans); - var bDiff = Point3d.subtract(top.trans, right.trans); - var crossproduct = Point3d.crossProduct(aDiff, bDiff); - var len = crossproduct.length(); - // FIXME: there is a bug with determining the surface side (shadow or colored) + var enabled = true; + if (typeof options === 'string') { + this.options.filter = options; + } else if (options instanceof Array) { + this.options.filter = options.join(); + } else if ((typeof options === 'undefined' ? 'undefined' : (0, _typeof3['default'])(options)) === 'object') { + if (options.container !== undefined) { + this.options.container = options.container; + } + if (options.filter !== undefined) { + this.options.filter = options.filter; + } + if (options.showButton !== undefined) { + this.options.showButton = options.showButton; + } + if (options.enabled !== undefined) { + enabled = options.enabled; + } + } else if (typeof options === 'boolean') { + this.options.filter = true; + enabled = options; + } else if (typeof options === 'function') { + this.options.filter = options; + enabled = true; + } + if (this.options.filter === false) { + enabled = false; + } - topSideVisible = crossproduct.z > 0; + this.options.enabled = enabled; + } + this._clean(); } - if (topSideVisible) { - - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - var zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4; - var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240; - var s = 1; // saturation - var v; + /** + * + * @param {Object} moduleOptions + */ - if (this.showShadow) { - v = Math.min(1 + crossproduct.x / len / 2, 1); // value. TODO: scale - fillStyle = this._hsv2rgb(h, s, v); - strokeStyle = fillStyle; - } else { - v = 1; - fillStyle = this._hsv2rgb(h, s, v); - strokeStyle = this.axisColor; // TODO: should be customizable + }, { + key: 'setModuleOptions', + value: function setModuleOptions(moduleOptions) { + this.moduleOptions = moduleOptions; + if (this.options.enabled === true) { + this._clean(); + if (this.options.container !== undefined) { + this.container = this.options.container; + } + this._create(); } - } else { - fillStyle = 'gray'; - strokeStyle = this.axisColor; } - ctx.lineWidth = this._getStrokeWidth(point); - // TODO: only draw stroke when strokeWidth > 0 + /** + * Create all DOM elements + * @private + */ - var points = [point, right, cross, top]; - this._polygon(ctx, points, fillStyle, strokeStyle); - }; + }, { + key: '_create', + value: function _create() { + var _this = this; - /** - * Helper method for _redrawGridGraphPoint() - */ - Graph3d.prototype._drawGridLine = function (ctx, from, to) { - if (from === undefined || to === undefined) { - return; - } + this._clean(); + this.changedOptions = []; - // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 - var zAvg = (from.point.z + to.point.z) / 2; - var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240; + var filter = this.options.filter; + var counter = 0; + var show = false; + for (var option in this.configureOptions) { + if (this.configureOptions.hasOwnProperty(option)) { + this.allowCreation = false; + show = false; + if (typeof filter === 'function') { + show = filter(option, []); + show = show || this._handleObject(this.configureOptions[option], [option], true); + } else if (filter === true || filter.indexOf(option) !== -1) { + show = true; + } - ctx.lineWidth = this._getStrokeWidth(from) * 2; - ctx.strokeStyle = this._hsv2rgb(h, 1, 1); - this._line(ctx, from.screen, to.screen); - }; + if (show !== false) { + this.allowCreation = true; - /** - * Draw single datapoint for graph style 'Grid'. - */ - Graph3d.prototype._redrawGridGraphPoint = function (ctx, point) { - this._drawGridLine(ctx, point, point.pointRight); - this._drawGridLine(ctx, point, point.pointTop); - }; + // linebreak between categories + if (counter > 0) { + this._makeItem([]); + } + // a header for the category + this._makeHeader(option); - /** - * Draw single datapoint for graph style 'line'. - */ - Graph3d.prototype._redrawLineGraphPoint = function (ctx, point) { - if (point.pointNext === undefined) { - return; - } + // get the sub options + this._handleObject(this.configureOptions[option], [option]); + } + counter++; + } + } - ctx.lineWidth = this._getStrokeWidth(point); - ctx.strokeStyle = this.dataColor.stroke; + if (this.options.showButton === true) { + var generateButton = document.createElement('div'); + generateButton.className = 'vis-configuration vis-config-button'; + generateButton.innerHTML = 'generate options'; + generateButton.onclick = function () { + _this._printOptions(); + }; + generateButton.onmouseover = function () { + generateButton.className = 'vis-configuration vis-config-button hover'; + }; + generateButton.onmouseout = function () { + generateButton.className = 'vis-configuration vis-config-button'; + }; - this._line(ctx, point.screen, point.pointNext.screen); - }; + this.optionsContainer = document.createElement('div'); + this.optionsContainer.className = 'vis-configuration vis-config-option-container'; - /** - * Draw all datapoints for currently selected graph style. - * - */ - Graph3d.prototype._redrawDataGraph = function () { - var ctx = this._getContext(); - var i; + this.domElements.push(this.optionsContainer); + this.domElements.push(generateButton); + } - if (this.dataPoints === undefined || this.dataPoints.length <= 0) return; // TODO: throw exception? + this._push(); + //~ this.colorPicker.insertTo(this.container); + } - this._calcTranslations(this.dataPoints); + /** + * draw all DOM elements on the screen + * @private + */ - for (i = 0; i < this.dataPoints.length; i++) { - var point = this.dataPoints[i]; + }, { + key: '_push', + value: function _push() { + this.wrapper = document.createElement('div'); + this.wrapper.className = 'vis-configuration-wrapper'; + this.container.appendChild(this.wrapper); + for (var i = 0; i < this.domElements.length; i++) { + this.wrapper.appendChild(this.domElements[i]); + } - // Using call() ensures that the correct context is used - this._pointDrawingMethod.call(this, ctx, point); + this._showPopupIfNeeded(); } - }; - - // ----------------------------------------------------------------------------- - // End methods for drawing points per graph style. - // ----------------------------------------------------------------------------- - /** - * Store startX, startY and startOffset for mouse operations - * - * @param {Event} event The event that occurred - */ - Graph3d.prototype._storeMousePosition = function (event) { - // get mouse position (different code for IE and all other browsers) - this.startMouseX = getMouseX(event); - this.startMouseY = getMouseY(event); + /** + * delete all DOM elements + * @private + */ - this._startCameraOffset = this.camera.getOffset(); - }; + }, { + key: '_clean', + value: function _clean() { + for (var i = 0; i < this.domElements.length; i++) { + this.wrapper.removeChild(this.domElements[i]); + } - /** - * Start a moving operation inside the provided parent element - * @param {Event} event The event that occurred (required for - * retrieving the mouse position) - */ - Graph3d.prototype._onMouseDown = function (event) { - event = event || window.event; + if (this.wrapper !== undefined) { + this.container.removeChild(this.wrapper); + this.wrapper = undefined; + } + this.domElements = []; - // check if mouse is still down (may be up when focus is lost for example - // in an iframe) - if (this.leftButtonDown) { - this._onMouseUp(event); + this._removePopup(); } - // only react on left mouse button down - this.leftButtonDown = event.which ? event.which === 1 : event.button === 1; - if (!this.leftButtonDown && !this.touchDown) return; - - this._storeMousePosition(event); + /** + * get the value from the actualOptions if it exists + * @param {array} path | where to look for the actual option + * @returns {*} + * @private + */ - this.startStart = new Date(this.start); - this.startEnd = new Date(this.end); - this.startArmRotation = this.camera.getArmRotation(); + }, { + key: '_getValue', + value: function _getValue(path) { + var base = this.moduleOptions; + for (var i = 0; i < path.length; i++) { + if (base[path[i]] !== undefined) { + base = base[path[i]]; + } else { + base = undefined; + break; + } + } + return base; + } - this.frame.style.cursor = 'move'; + /** + * all option elements are wrapped in an item + * @param {Array} path | where to look for the actual option + * @param {Array.} domElements + * @returns {number} + * @private + */ - // add event listeners to handle moving the contents - // we store the function onmousemove and onmouseup in the graph, so we can - // remove the eventlisteners lateron in the function mouseUp() - var me = this; - this.onmousemove = function (event) { - me._onMouseMove(event); - }; - this.onmouseup = function (event) { - me._onMouseUp(event); - }; - util.addEventListener(document, 'mousemove', me.onmousemove); - util.addEventListener(document, 'mouseup', me.onmouseup); - util.preventDefault(event); - }; + }, { + key: '_makeItem', + value: function _makeItem(path) { + if (this.allowCreation === true) { + var item = document.createElement('div'); + item.className = 'vis-configuration vis-config-item vis-config-s' + path.length; - /** - * Perform moving operating. - * This function activated from within the funcion Graph.mouseDown(). - * @param {Event} event Well, eehh, the event - */ - Graph3d.prototype._onMouseMove = function (event) { - this.moving = true; - event = event || window.event; + for (var _len = arguments.length, domElements = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + domElements[_key - 1] = arguments[_key]; + } - // calculate change in mouse position - var diffX = parseFloat(getMouseX(event)) - this.startMouseX; - var diffY = parseFloat(getMouseY(event)) - this.startMouseY; + domElements.forEach(function (element) { + item.appendChild(element); + }); + this.domElements.push(item); + return this.domElements.length; + } + return 0; + } - // move with ctrl or rotate by other - if (event && event.ctrlKey === true) { - // calculate change in mouse position - var scaleX = this.frame.clientWidth * 0.5; - var scaleY = this.frame.clientHeight * 0.5; + /** + * header for major subjects + * @param {string} name + * @private + */ - var offXNew = (this._startCameraOffset.x || 0) - diffX / scaleX * this.camera.armLength * 0.8; - var offYNew = (this._startCameraOffset.y || 0) + diffY / scaleY * this.camera.armLength * 0.8; + }, { + key: '_makeHeader', + value: function _makeHeader(name) { + var div = document.createElement('div'); + div.className = 'vis-configuration vis-config-header'; + div.innerHTML = name; + this._makeItem([], div); + } - this.camera.setOffset(offXNew, offYNew); - this._storeMousePosition(event); - } else { - var horizontalNew = this.startArmRotation.horizontal + diffX / 200; - var verticalNew = this.startArmRotation.vertical + diffY / 200; + /** + * make a label, if it is an object label, it gets different styling. + * @param {string} name + * @param {array} path | where to look for the actual option + * @param {string} objectLabel + * @returns {HTMLElement} + * @private + */ - var snapAngle = 4; // degrees - var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); + }, { + key: '_makeLabel', + value: function _makeLabel(name, path) { + var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc... - // the -0.001 is to take care that the vertical axis is always drawn at the left front corner - if (Math.abs(Math.sin(horizontalNew)) < snapValue) { - horizontalNew = Math.round(horizontalNew / Math.PI) * Math.PI - 0.001; - } - if (Math.abs(Math.cos(horizontalNew)) < snapValue) { - horizontalNew = (Math.round(horizontalNew / Math.PI - 0.5) + 0.5) * Math.PI - 0.001; + var div = document.createElement('div'); + div.className = 'vis-configuration vis-config-label vis-config-s' + path.length; + if (objectLabel === true) { + div.innerHTML = '' + name + ':'; + } else { + div.innerHTML = name + ':'; } + return div; + } + + /** + * make a dropdown list for multiple possible string optoins + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ - // snap vertically to nice angles - if (Math.abs(Math.sin(verticalNew)) < snapValue) { - verticalNew = Math.round(verticalNew / Math.PI) * Math.PI; + }, { + key: '_makeDropdown', + value: function _makeDropdown(arr, value, path) { + var select = document.createElement('select'); + select.className = 'vis-configuration vis-config-select'; + var selectedValue = 0; + if (value !== undefined) { + if (arr.indexOf(value) !== -1) { + selectedValue = arr.indexOf(value); + } } - if (Math.abs(Math.cos(verticalNew)) < snapValue) { - verticalNew = (Math.round(verticalNew / Math.PI - 0.5) + 0.5) * Math.PI; + + for (var i = 0; i < arr.length; i++) { + var option = document.createElement('option'); + option.value = arr[i]; + if (i === selectedValue) { + option.selected = 'selected'; + } + option.innerHTML = arr[i]; + select.appendChild(option); } - this.camera.setArmRotation(horizontalNew, verticalNew); + + var me = this; + select.onchange = function () { + me._update(this.value, path); + }; + + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, select); } - this.redraw(); + /** + * make a range object for numeric options + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ - // fire a cameraPositionChange event - var parameters = this.getCameraPosition(); - this.emit('cameraPositionChange', parameters); + }, { + key: '_makeRange', + value: function _makeRange(arr, value, path) { + var defaultValue = arr[0]; + var min = arr[1]; + var max = arr[2]; + var step = arr[3]; + var range = document.createElement('input'); + range.className = 'vis-configuration vis-config-range'; + try { + range.type = 'range'; // not supported on IE9 + range.min = min; + range.max = max; + } + // TODO: Add some error handling and remove this lint exception + catch (err) {} // eslint-disable-line no-empty + range.step = step; + + // set up the popup settings in case they are needed. + var popupString = ''; + var popupValue = 0; + + if (value !== undefined) { + var factor = 1.20; + if (value < 0 && value * factor < min) { + range.min = Math.ceil(value * factor); + popupValue = range.min; + popupString = 'range increased'; + } else if (value / factor < min) { + range.min = Math.ceil(value / factor); + popupValue = range.min; + popupString = 'range increased'; + } + if (value * factor > max && max !== 1) { + range.max = Math.ceil(value * factor); + popupValue = range.max; + popupString = 'range increased'; + } + range.value = value; + } else { + range.value = defaultValue; + } - util.preventDefault(event); - }; + var input = document.createElement('input'); + input.className = 'vis-configuration vis-config-rangeinput'; + input.value = range.value; - /** - * Stop moving operating. - * This function activated from within the funcion Graph.mouseDown(). - * @param {event} event The event - */ - Graph3d.prototype._onMouseUp = function (event) { - this.frame.style.cursor = 'auto'; - this.leftButtonDown = false; - - // remove event listeners here - util.removeEventListener(document, 'mousemove', this.onmousemove); - util.removeEventListener(document, 'mouseup', this.onmouseup); - util.preventDefault(event); - }; + var me = this; + range.onchange = function () { + input.value = this.value;me._update(Number(this.value), path); + }; + range.oninput = function () { + input.value = this.value; + }; - /** - * @param {event} event The event - */ - Graph3d.prototype._onClick = function (event) { - if (!this.onclick_callback) return; - if (!this.moving) { - var boundingRect = this.frame.getBoundingClientRect(); - var mouseX = getMouseX(event) - boundingRect.left; - var mouseY = getMouseY(event) - boundingRect.top; - var dataPoint = this._dataPointFromXY(mouseX, mouseY); - if (dataPoint) this.onclick_callback(dataPoint.point.data); - } else { - // disable onclick callback, if it came immediately after rotate/pan - this.moving = false; + var label = this._makeLabel(path[path.length - 1], path); + var itemIndex = this._makeItem(path, label, range, input); + + // if a popup is needed AND it has not been shown for this value, show it. + if (popupString !== '' && this.popupHistory[itemIndex] !== popupValue) { + this.popupHistory[itemIndex] = popupValue; + this._setupPopup(popupString, itemIndex); + } } - util.preventDefault(event); - }; - /** - * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point - * @param {Event} event A mouse move event - */ - Graph3d.prototype._onTooltip = function (event) { - var delay = 300; // ms - var boundingRect = this.frame.getBoundingClientRect(); - var mouseX = getMouseX(event) - boundingRect.left; - var mouseY = getMouseY(event) - boundingRect.top; + /** + * prepare the popup + * @param {string} string + * @param {number} index + * @private + */ - if (!this.showTooltip) { - return; + }, { + key: '_setupPopup', + value: function _setupPopup(string, index) { + var _this2 = this; + + if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) { + var div = document.createElement("div"); + div.id = "vis-configuration-popup"; + div.className = "vis-configuration-popup"; + div.innerHTML = string; + div.onclick = function () { + _this2._removePopup(); + }; + this.popupCounter += 1; + this.popupDiv = { html: div, index: index }; + } } - if (this.tooltipTimeout) { - clearTimeout(this.tooltipTimeout); + /** + * remove the popup from the dom + * @private + */ + + }, { + key: '_removePopup', + value: function _removePopup() { + if (this.popupDiv.html !== undefined) { + this.popupDiv.html.parentNode.removeChild(this.popupDiv.html); + clearTimeout(this.popupDiv.hideTimeout); + clearTimeout(this.popupDiv.deleteTimeout); + this.popupDiv = {}; + } } - // (delayed) display of a tooltip only if no mouse button is down - if (this.leftButtonDown) { - this._hideTooltip(); - return; + /** + * Show the popup if it is needed. + * @private + */ + + }, { + key: '_showPopupIfNeeded', + value: function _showPopupIfNeeded() { + var _this3 = this; + + if (this.popupDiv.html !== undefined) { + var correspondingElement = this.domElements[this.popupDiv.index]; + var rect = correspondingElement.getBoundingClientRect(); + this.popupDiv.html.style.left = rect.left + "px"; + this.popupDiv.html.style.top = rect.top - 30 + "px"; // 30 is the height; + document.body.appendChild(this.popupDiv.html); + this.popupDiv.hideTimeout = setTimeout(function () { + _this3.popupDiv.html.style.opacity = 0; + }, 1500); + this.popupDiv.deleteTimeout = setTimeout(function () { + _this3._removePopup(); + }, 1800); + } } - if (this.tooltip && this.tooltip.dataPoint) { - // tooltip is currently visible - var dataPoint = this._dataPointFromXY(mouseX, mouseY); - if (dataPoint !== this.tooltip.dataPoint) { - // datapoint changed - if (dataPoint) { - this._showTooltip(dataPoint); - } else { - this._hideTooltip(); + /** + * make a checkbox for boolean options. + * @param {number} defaultValue + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ + + }, { + key: '_makeCheckbox', + value: function _makeCheckbox(defaultValue, value, path) { + var checkbox = document.createElement('input'); + checkbox.type = 'checkbox'; + checkbox.className = 'vis-configuration vis-config-checkbox'; + checkbox.checked = defaultValue; + if (value !== undefined) { + checkbox.checked = value; + if (value !== defaultValue) { + if ((typeof defaultValue === 'undefined' ? 'undefined' : (0, _typeof3['default'])(defaultValue)) === 'object') { + if (value !== defaultValue.enabled) { + this.changedOptions.push({ path: path, value: value }); + } + } else { + this.changedOptions.push({ path: path, value: value }); + } } } - } else { - // tooltip is currently not visible + var me = this; - this.tooltipTimeout = setTimeout(function () { - me.tooltipTimeout = null; + checkbox.onchange = function () { + me._update(this.checked, path); + }; - // show a tooltip if we have a data point - var dataPoint = me._dataPointFromXY(mouseX, mouseY); - if (dataPoint) { - me._showTooltip(dataPoint); - } - }, delay); + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, checkbox); } - }; - /** - * Event handler for touchstart event on mobile devices - */ - Graph3d.prototype._onTouchStart = function (event) { - this.touchDown = true; + /** + * make a text input field for string options. + * @param {number} defaultValue + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ - var me = this; - this.ontouchmove = function (event) { - me._onTouchMove(event); - }; - this.ontouchend = function (event) { - me._onTouchEnd(event); - }; - util.addEventListener(document, 'touchmove', me.ontouchmove); - util.addEventListener(document, 'touchend', me.ontouchend); + }, { + key: '_makeTextInput', + value: function _makeTextInput(defaultValue, value, path) { + var checkbox = document.createElement('input'); + checkbox.type = 'text'; + checkbox.className = 'vis-configuration vis-config-text'; + checkbox.value = value; + if (value !== defaultValue) { + this.changedOptions.push({ path: path, value: value }); + } - this._onMouseDown(event); - }; + var me = this; + checkbox.onchange = function () { + me._update(this.value, path); + }; - /** - * Event handler for touchmove event on mobile devices - */ - Graph3d.prototype._onTouchMove = function (event) { - this._onMouseMove(event); - }; + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, checkbox); + } - /** - * Event handler for touchend event on mobile devices - */ - Graph3d.prototype._onTouchEnd = function (event) { - this.touchDown = false; + /** + * make a color field with a color picker for color fields + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ - util.removeEventListener(document, 'touchmove', this.ontouchmove); - util.removeEventListener(document, 'touchend', this.ontouchend); + }, { + key: '_makeColorField', + value: function _makeColorField(arr, value, path) { + var _this4 = this; - this._onMouseUp(event); - }; + var defaultColor = arr[1]; + var div = document.createElement('div'); + value = value === undefined ? defaultColor : value; - /** - * Event handler for mouse wheel event, used to zoom the graph - * Code from http://adomas.org/javascript-mouse-wheel/ - * @param {event} event The event - */ - Graph3d.prototype._onWheel = function (event) { - if (!event) /* For IE. */ - event = window.event; - - // retrieve delta - var delta = 0; - if (event.wheelDelta) { - /* IE/Opera. */ - delta = event.wheelDelta / 120; - } else if (event.detail) { - /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail / 3; - } - - // If delta is nonzero, handle it. - // Basically, delta is now positive if wheel was scrolled up, - // and negative, if wheel was scrolled down. - if (delta) { - var oldLength = this.camera.getArmLength(); - var newLength = oldLength * (1 - delta / 10); - - this.camera.setArmLength(newLength); - this.redraw(); + if (value !== 'none') { + div.className = 'vis-configuration vis-config-colorBlock'; + div.style.backgroundColor = value; + } else { + div.className = 'vis-configuration vis-config-colorBlock none'; + } + + value = value === undefined ? defaultColor : value; + div.onclick = function () { + _this4._showColorPicker(value, div, path); + }; - this._hideTooltip(); + var label = this._makeLabel(path[path.length - 1], path); + this._makeItem(path, label, div); } - // fire a cameraPositionChange event - var parameters = this.getCameraPosition(); - this.emit('cameraPositionChange', parameters); + /** + * used by the color buttons to call the color picker. + * @param {number} value + * @param {HTMLElement} div + * @param {array} path | where to look for the actual option + * @private + */ - // Prevent default actions caused by mouse wheel. - // That might be ugly, but we handle scrolls somehow - // anyway, so don't bother here.. - util.preventDefault(event); - }; + }, { + key: '_showColorPicker', + value: function _showColorPicker(value, div, path) { + var _this5 = this; - /** - * Test whether a point lies inside given 2D triangle - * - * @param {Point2d} point - * @param {Point2d[]} triangle - * @returns {boolean} true if given point lies inside or on the edge of the - * triangle, false otherwise - * @private - */ - Graph3d.prototype._insideTriangle = function (point, triangle) { - var a = triangle[0], - b = triangle[1], - c = triangle[2]; + // clear the callback from this div + div.onclick = function () {}; - function sign(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; - } + this.colorPicker.insertTo(div); + this.colorPicker.show(); - var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x)); - var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x)); - var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x)); + this.colorPicker.setColor(value); + this.colorPicker.setUpdateCallback(function (color) { + var colorString = 'rgba(' + color.r + ',' + color.g + ',' + color.b + ',' + color.a + ')'; + div.style.backgroundColor = colorString; + _this5._update(colorString, path); + }); - // each of the three signs must be either equal to each other or zero - return (as == 0 || bs == 0 || as == bs) && (bs == 0 || cs == 0 || bs == cs) && (as == 0 || cs == 0 || as == cs); - }; + // on close of the colorpicker, restore the callback. + this.colorPicker.setCloseCallback(function () { + div.onclick = function () { + _this5._showColorPicker(value, div, path); + }; + }); + } - /** - * Find a data point close to given screen position (x, y) - * - * @param {Number} x - * @param {Number} y - * @returns {Object | null} The closest data point or null if not close to any - * data point - * @private - */ - Graph3d.prototype._dataPointFromXY = function (x, y) { - var i, - distMax = 100, - // px - dataPoint = null, - closestDataPoint = null, - closestDist = null, - center = new Point2d(x, y); - - if (this.style === Graph3d.STYLE.BAR || this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE) { - // the data points are ordered from far away to closest - for (i = this.dataPoints.length - 1; i >= 0; i--) { - dataPoint = this.dataPoints[i]; - var surfaces = dataPoint.surfaces; - if (surfaces) { - for (var s = surfaces.length - 1; s >= 0; s--) { - // split each surface in two triangles, and see if the center point is inside one of these - var surface = surfaces[s]; - var corners = surface.corners; - var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen]; - var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen]; - if (this._insideTriangle(center, triangle1) || this._insideTriangle(center, triangle2)) { - // return immediately at the first hit - return dataPoint; + /** + * parse an object and draw the correct items + * @param {Object} obj + * @param {array} [path=[]] | where to look for the actual option + * @param {boolean} [checkOnly=false] + * @returns {boolean} + * @private + */ + + }, { + key: '_handleObject', + value: function _handleObject(obj) { + var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + var show = false; + var filter = this.options.filter; + var visibleInSet = false; + for (var subObj in obj) { + if (obj.hasOwnProperty(subObj)) { + show = true; + var item = obj[subObj]; + var newPath = util.copyAndExtendArray(path, subObj); + if (typeof filter === 'function') { + show = filter(subObj, path); + + // if needed we must go deeper into the object. + if (show === false) { + if (!(item instanceof Array) && typeof item !== 'string' && typeof item !== 'boolean' && item instanceof Object) { + this.allowCreation = false; + show = this._handleObject(item, newPath, true); + this.allowCreation = checkOnly === false; + } } } - } - } - } else { - // find the closest data point, using distance to the center of the point on 2d screen - for (i = 0; i < this.dataPoints.length; i++) { - dataPoint = this.dataPoints[i]; - var point = dataPoint.screen; - if (point) { - var distX = Math.abs(x - point.x); - var distY = Math.abs(y - point.y); - var dist = Math.sqrt(distX * distX + distY * distY); - if ((closestDist === null || dist < closestDist) && dist < distMax) { - closestDist = dist; - closestDataPoint = dataPoint; + if (show !== false) { + visibleInSet = true; + var value = this._getValue(newPath); + + if (item instanceof Array) { + this._handleArray(item, value, newPath); + } else if (typeof item === 'string') { + this._makeTextInput(item, value, newPath); + } else if (typeof item === 'boolean') { + this._makeCheckbox(item, value, newPath); + } else if (item instanceof Object) { + // collapse the physics options that are not enabled + var draw = true; + if (path.indexOf('physics') !== -1) { + if (this.moduleOptions.physics.solver !== subObj) { + draw = false; + } + } + + if (draw === true) { + // initially collapse options with an disabled enabled option. + if (item.enabled !== undefined) { + var enabledPath = util.copyAndExtendArray(newPath, 'enabled'); + var enabledValue = this._getValue(enabledPath); + if (enabledValue === true) { + var label = this._makeLabel(subObj, newPath, true); + this._makeItem(newPath, label); + visibleInSet = this._handleObject(item, newPath) || visibleInSet; + } else { + this._makeCheckbox(item, enabledValue, newPath); + } + } else { + var _label = this._makeLabel(subObj, newPath, true); + this._makeItem(newPath, _label); + visibleInSet = this._handleObject(item, newPath) || visibleInSet; + } + } + } else { + console.error('dont know how to handle', item, subObj, newPath); + } } } } + return visibleInSet; } - return closestDataPoint; - }; - - /** - * Determine if the given style has bars - * - * @param {number} style the style to check - * @returns {boolean} true if bar style, false otherwise - */ - Graph3d.prototype.hasBars = function (style) { - return style == Graph3d.STYLE.BAR || style == Graph3d.STYLE.BARCOLOR || style == Graph3d.STYLE.BARSIZE; - }; - - /** - * Display a tooltip for given data point - * @param {Object} dataPoint - * @private - */ - Graph3d.prototype._showTooltip = function (dataPoint) { - var content, line, dot; - - if (!this.tooltip) { - content = document.createElement('div'); - (0, _assign2['default'])(content.style, {}, this.tooltipStyle.content); - content.style.position = 'absolute'; - - line = document.createElement('div'); - (0, _assign2['default'])(line.style, {}, this.tooltipStyle.line); - line.style.position = 'absolute'; - - dot = document.createElement('div'); - (0, _assign2['default'])(dot.style, {}, this.tooltipStyle.dot); - dot.style.position = 'absolute'; + /** + * handle the array type of option + * @param {Array.} arr + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ - this.tooltip = { - dataPoint: null, - dom: { - content: content, - line: line, - dot: dot + }, { + key: '_handleArray', + value: function _handleArray(arr, value, path) { + if (typeof arr[0] === 'string' && arr[0] === 'color') { + this._makeColorField(arr, value, path); + if (arr[1] !== value) { + this.changedOptions.push({ path: path, value: value }); } - }; - } else { - content = this.tooltip.dom.content; - line = this.tooltip.dom.line; - dot = this.tooltip.dom.dot; - } - - this._hideTooltip(); - - this.tooltip.dataPoint = dataPoint; - if (typeof this.showTooltip === 'function') { - content.innerHTML = this.showTooltip(dataPoint.point); - } else { - content.innerHTML = '' + '' + '' + '' + '
' + this.xLabel + ':' + dataPoint.point.x + '
' + this.yLabel + ':' + dataPoint.point.y + '
' + this.zLabel + ':' + dataPoint.point.z + '
'; - } - - content.style.left = '0'; - content.style.top = '0'; - this.frame.appendChild(content); - this.frame.appendChild(line); - this.frame.appendChild(dot); - - // calculate sizes - var contentWidth = content.offsetWidth; - var contentHeight = content.offsetHeight; - var lineHeight = line.offsetHeight; - var dotWidth = dot.offsetWidth; - var dotHeight = dot.offsetHeight; - - var left = dataPoint.screen.x - contentWidth / 2; - left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth); - - line.style.left = dataPoint.screen.x + 'px'; - line.style.top = dataPoint.screen.y - lineHeight + 'px'; - content.style.left = left + 'px'; - content.style.top = dataPoint.screen.y - lineHeight - contentHeight + 'px'; - dot.style.left = dataPoint.screen.x - dotWidth / 2 + 'px'; - dot.style.top = dataPoint.screen.y - dotHeight / 2 + 'px'; - }; - - /** - * Hide the tooltip when displayed - * @private - */ - Graph3d.prototype._hideTooltip = function () { - if (this.tooltip) { - this.tooltip.dataPoint = null; - - for (var prop in this.tooltip.dom) { - if (this.tooltip.dom.hasOwnProperty(prop)) { - var elem = this.tooltip.dom[prop]; - if (elem && elem.parentNode) { - elem.parentNode.removeChild(elem); - } + } else if (typeof arr[0] === 'string') { + this._makeDropdown(arr, value, path); + if (arr[0] !== value) { + this.changedOptions.push({ path: path, value: value }); + } + } else if (typeof arr[0] === 'number') { + this._makeRange(arr, value, path); + if (arr[0] !== value) { + this.changedOptions.push({ path: path, value: Number(value) }); } } } - }; - /**--------------------------------------------------------------------------**/ + /** + * called to update the network with the new settings. + * @param {number} value + * @param {array} path | where to look for the actual option + * @private + */ - /** - * Get the horizontal mouse position from a mouse event - * - * @param {Event} event - * @returns {Number} mouse x - */ - function getMouseX(event) { - if ('clientX' in event) return event.clientX; - return event.targetTouches[0] && event.targetTouches[0].clientX || 0; - } + }, { + key: '_update', + value: function _update(value, path) { + var options = this._constructOptions(value, path); - /** - * Get the vertical mouse position from a mouse event - * - * @param {Event} event - * @returns {Number} mouse y - */ - function getMouseY(event) { - if ('clientY' in event) return event.clientY; - return event.targetTouches[0] && event.targetTouches[0].clientY || 0; - } + if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) { + this.parent.body.emitter.emit("configChange", options); + } + this.initialized = true; + this.parent.setOptions(options); + } - // ----------------------------------------------------------------------------- - // Public methods for specific settings - // ----------------------------------------------------------------------------- + /** + * + * @param {string|Boolean} value + * @param {Array.} path + * @param {{}} optionsObj + * @returns {{}} + * @private + */ - /** - * Set the rotation and distance of the camera - * - * @param {Object} pos An object with the camera position - * @param {?Number} pos.horizontal The horizontal rotation, between 0 and 2*PI. - * Optional, can be left undefined. - * @param {?Number} pos.vertical The vertical rotation, between 0 and 0.5*PI. - * if vertical=0.5*PI, the graph is shown from - * the top. Optional, can be left undefined. - * @param {?Number} pos.distance The (normalized) distance of the camera to the - * center of the graph, a value between 0.71 and - * 5.0. Optional, can be left undefined. - */ - Graph3d.prototype.setCameraPosition = function (pos) { - Settings.setCameraPosition(pos, this); - this.redraw(); - }; + }, { + key: '_constructOptions', + value: function _constructOptions(value, path) { + var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - /** - * Set a new size for the graph - * - * @param {string} width Width in pixels or percentage (for example '800px' - * or '50%') - * @param {string} height Height in pixels or percentage (for example '400px' - * or '30%') - */ - Graph3d.prototype.setSize = function (width, height) { - this._setSize(width, height); - this.redraw(); - }; + var pointer = optionsObj; - // ----------------------------------------------------------------------------- - // End public methods for specific settings - // ----------------------------------------------------------------------------- + // when dropdown boxes can be string or boolean, we typecast it into correct types + value = value === 'true' ? true : value; + value = value === 'false' ? false : value; + for (var i = 0; i < path.length; i++) { + if (path[i] !== 'global') { + if (pointer[path[i]] === undefined) { + pointer[path[i]] = {}; + } + if (i !== path.length - 1) { + pointer = pointer[path[i]]; + } else { + pointer[path[i]] = value; + } + } + } + return optionsObj; + } - module.exports = Graph3d; + /** + * @private + */ -/***/ }), -/* 95 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: '_printOptions', + value: function _printOptions() { + var options = this.getOptions(); + this.optionsContainer.innerHTML = '
var options = ' + (0, _stringify2['default'])(options, null, 2) + '
'; + } - module.exports = { "default": __webpack_require__(96), __esModule: true }; + /** + * + * @returns {{}} options + */ -/***/ }), -/* 96 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'getOptions', + value: function getOptions() { + var options = {}; + for (var i = 0; i < this.changedOptions.length; i++) { + this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options); + } + return options; + } + }]); + return Configurator; +}(); - __webpack_require__(97); - module.exports = __webpack_require__(17).Object.assign; +exports['default'] = Configurator; /***/ }), -/* 97 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { - // 19.1.3.1 Object.assign(target, source) - var $export = __webpack_require__(15); - - $export($export.S + $export.F, 'Object', {assign: __webpack_require__(98)}); - -/***/ }), -/* 98 */ -/***/ (function(module, exports, __webpack_require__) { +"use strict"; - 'use strict'; - // 19.1.2.1 Object.assign(target, source, ...) - var getKeys = __webpack_require__(35) - , gOPS = __webpack_require__(73) - , pIE = __webpack_require__(74) - , toObject = __webpack_require__(49) - , IObject = __webpack_require__(10) - , $assign = Object.assign; - - // should work with symbols and should have deterministic property order (V8 bug) - module.exports = !$assign || __webpack_require__(26)(function(){ - var A = {} - , B = {} - , S = Symbol() - , K = 'abcdefghijklmnopqrst'; - A[S] = 7; - K.split('').forEach(function(k){ B[k] = k; }); - return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; - }) ? function assign(target, source){ // eslint-disable-line no-unused-vars - var T = toObject(target) - , aLen = arguments.length - , index = 1 - , getSymbols = gOPS.f - , isEnum = pIE.f; - while(aLen > index){ - var S = IObject(arguments[index++]) - , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) - , length = keys.length - , j = 0 - , key; - while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; - } return T; - } : $assign; -/***/ }), -/* 99 */ -/***/ (function(module, exports) { +var _typeof2 = __webpack_require__(6); - - /** - * Expose `Emitter`. - */ +var _typeof3 = _interopRequireDefault(_typeof2); - module.exports = Emitter; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Initialize a new `Emitter`. - * - * @api public - */ +var DOMutil = __webpack_require__(14); - function Emitter(obj) { - if (obj) return mixin(obj); - }; +/** + * + * @param {number | string} groupId + * @param {Object} options // TODO: Describe options + * + * @constructor Points + */ +function Points(groupId, options) {} // eslint-disable-line no-unused-vars - /** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; +/** + * draw the data points + * + * @param {Array} dataset + * @param {GraphGroup} group + * @param {Object} framework | SVG DOM element + * @param {number} [offset] + */ +Points.draw = function (dataset, group, framework, offset) { + offset = offset || 0; + var callback = getCallback(framework, group); + + for (var i = 0; i < dataset.length; i++) { + if (!callback) { + // draw the point the simple way. + DOMutil.drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group), framework.svgElements, framework.svg, dataset[i].label); + } else { + var callbackResult = callback(dataset[i], group); // result might be true, false or an object + if (callbackResult === true || (typeof callbackResult === 'undefined' ? 'undefined' : (0, _typeof3['default'])(callbackResult)) === 'object') { + DOMutil.drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group, callbackResult), framework.svgElements, framework.svg, dataset[i].label); + } } - return obj; } +}; - /** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.on = - Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks[event] = this._callbacks[event] || []) - .push(fn); - return this; - }; - - /** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ +Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { + var fillHeight = iconHeight * 0.5; - Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; + var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); - function on() { - self.off(event, on); - fn.apply(this, arguments); - } + //Don't call callback on icon + DOMutil.drawPoint(x + 0.5 * iconWidth, y, getGroupTemplate(group), framework.svgElements, framework.svg); +}; - on.fn = fn; - this.on(event, on); - return this; - }; +/** + * + * @param {vis.Group} group + * @param {any} callbackResult + * @returns {{style: *, styles: (*|string), size: *, className: *}} + */ +function getGroupTemplate(group, callbackResult) { + callbackResult = typeof callbackResult === 'undefined' ? {} : callbackResult; + return { + style: callbackResult.style || group.options.drawPoints.style, + styles: callbackResult.styles || group.options.drawPoints.styles, + size: callbackResult.size || group.options.drawPoints.size, + className: callbackResult.className || group.className + }; +} - /** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ +/** + * + * @param {Object} framework | SVG DOM element + * @param {vis.Group} group + * @returns {function} + */ +function getCallback(framework, group) { + var callback = undefined; + // check for the graph2d onRender + if (framework.options && framework.options.drawPoints && framework.options.drawPoints.onRender && typeof framework.options.drawPoints.onRender == 'function') { + callback = framework.options.drawPoints.onRender; + } - Emitter.prototype.off = - Emitter.prototype.removeListener = - Emitter.prototype.removeAllListeners = - Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; + // override it with the group onRender if defined + if (group.group.options && group.group.options.drawPoints && group.group.options.drawPoints.onRender && typeof group.group.options.drawPoints.onRender == 'function') { + callback = group.group.options.drawPoints.onRender; + } + return callback; +} - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } +module.exports = Points; - // specific event - var callbacks = this._callbacks[event]; - if (!callbacks) return this; +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks[event]; - return this; - } +"use strict"; - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; - }; - /** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); - Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks[event]; +var _getPrototypeOf = __webpack_require__(3); - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - return this; - }; +var _classCallCheck2 = __webpack_require__(0); - /** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks[event] || []; - }; +var _createClass2 = __webpack_require__(1); - /** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ +var _createClass3 = _interopRequireDefault(_createClass2); - Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; - }; +var _possibleConstructorReturn2 = __webpack_require__(4); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -/***/ }), -/* 100 */ -/***/ (function(module, exports) { +var _inherits2 = __webpack_require__(5); - "use strict"; +var _inherits3 = _interopRequireDefault(_inherits2); - /** - * @prototype Point3d - * @param {Number} [x] - * @param {Number} [y] - * @param {Number} [z] - */ - function Point3d(x, y, z) { - this.x = x !== undefined ? x : 0; - this.y = y !== undefined ? y : 0; - this.z = z !== undefined ? z : 0; - }; +var _NodeBase2 = __webpack_require__(23); - /** - * Subtract the two provided points, returns a-b - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} a-b - */ - Point3d.subtract = function (a, b) { - var sub = new Point3d(); - sub.x = a.x - b.x; - sub.y = a.y - b.y; - sub.z = a.z - b.z; - return sub; - }; +var _NodeBase3 = _interopRequireDefault(_NodeBase2); - /** - * Add the two provided points, returns a+b - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} a+b - */ - Point3d.add = function (a, b) { - var sum = new Point3d(); - sum.x = a.x + b.x; - sum.y = a.y + b.y; - sum.z = a.z + b.z; - return sum; - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Calculate the average of two 3d points - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} The average, (a+b)/2 - */ - Point3d.avg = function (a, b) { - return new Point3d((a.x + b.x) / 2, (a.y + b.y) / 2, (a.z + b.z) / 2); - }; +/** + * NOTE: This is a bad base class + * + * Child classes are: + * + * Image - uses *only* image methods + * Circle - uses *only* _drawRawCircle + * CircleImage - uses all + * + * TODO: Refactor, move _drawRawCircle to different module, derive Circle from NodeBase + * Rename this to ImageBase + * Consolidate common code in Image and CircleImage to base class + * + * @extends NodeBase + */ +var CircleImageBase = function (_NodeBase) { + (0, _inherits3['default'])(CircleImageBase, _NodeBase); /** - * Calculate the cross product of the two provided points, returns axb - * Documentation: http://en.wikipedia.org/wiki/Cross_product - * @param {Point3d} a - * @param {Point3d} b - * @return {Point3d} cross product axb + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule */ - Point3d.crossProduct = function (a, b) { - var crossproduct = new Point3d(); + function CircleImageBase(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, CircleImageBase); - crossproduct.x = a.y * b.z - a.z * b.y; - crossproduct.y = a.z * b.x - a.x * b.z; - crossproduct.z = a.x * b.y - a.y * b.x; + var _this = (0, _possibleConstructorReturn3['default'])(this, (CircleImageBase.__proto__ || (0, _getPrototypeOf2['default'])(CircleImageBase)).call(this, options, body, labelModule)); - return crossproduct; - }; + _this.labelOffset = 0; + _this.selected = false; + return _this; + } /** - * Rtrieve the length of the vector (or the distance from this point to the origin - * @return {Number} length + * + * @param {Object} options + * @param {Object} [imageObj] + * @param {Object} [imageObjAlt] */ - Point3d.prototype.length = function () { - return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - }; - - module.exports = Point3d; -/***/ }), -/* 101 */ -/***/ (function(module, exports) { - "use strict"; + (0, _createClass3['default'])(CircleImageBase, [{ + key: 'setOptions', + value: function setOptions(options, imageObj, imageObjAlt) { + this.options = options; - /** - * @prototype Point2d - * @param {Number} [x] - * @param {Number} [y] - */ - function Point2d(x, y) { - this.x = x !== undefined ? x : 0; - this.y = y !== undefined ? y : 0; - } + if (!(imageObj === undefined && imageObjAlt === undefined)) { + this.setImages(imageObj, imageObjAlt); + } + } - module.exports = Point2d; + /** + * Set the images for this node. + * + * The images can be updated after the initial setting of options; + * therefore, this method needs to be reentrant. + * + * For correct working in error cases, it is necessary to properly set + * field 'nodes.brokenImage' in the options. + * + * @param {Image} imageObj required; main image to show for this node + * @param {Image|undefined} imageObjAlt optional; image to show when node is selected + */ -/***/ }), -/* 102 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'setImages', + value: function setImages(imageObj, imageObjAlt) { + if (imageObjAlt && this.selected) { + this.imageObj = imageObjAlt; + this.imageObjAlt = imageObj; + } else { + this.imageObj = imageObj; + this.imageObjAlt = imageObjAlt; + } + } - 'use strict'; + /** + * Set selection and switch between the base and the selected image. + * + * Do the switch only if imageObjAlt exists. + * + * @param {boolean} selected value of new selected state for current node + */ - var _sign = __webpack_require__(103); + }, { + key: 'switchImages', + value: function switchImages(selected) { + var selection_changed = selected && !this.selected || !selected && this.selected; + this.selected = selected; // Remember new selection - var _sign2 = _interopRequireDefault(_sign); + if (this.imageObjAlt !== undefined && selection_changed) { + var imageTmp = this.imageObj; + this.imageObj = this.imageObjAlt; + this.imageObjAlt = imageTmp; + } + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * Adjust the node dimensions for a loaded image. + * + * Pre: this.imageObj is valid + */ - var Point3d = __webpack_require__(100); + }, { + key: '_resizeImage', + value: function _resizeImage() { + var width, height; - /** - * @class Camera - * The camera is mounted on a (virtual) camera arm. The camera arm can rotate - * The camera is always looking in the direction of the origin of the arm. - * This way, the camera always rotates around one fixed point, the location - * of the camera arm. - * - * Documentation: - * http://en.wikipedia.org/wiki/3D_projection - */ - function Camera() { - this.armLocation = new Point3d(); - this.armRotation = {}; - this.armRotation.horizontal = 0; - this.armRotation.vertical = 0; - this.armLength = 1.7; - this.cameraOffset = new Point3d(); - this.offsetMultiplier = 0.6; - - this.cameraLocation = new Point3d(); - this.cameraRotation = new Point3d(0.5 * Math.PI, 0, 0); + if (this.options.shapeProperties.useImageSize === false) { + // Use the size property + var ratio_width = 1; + var ratio_height = 1; - this.calculateCameraOrientation(); - } + // Only calculate the proper ratio if both width and height not zero + if (this.imageObj.width && this.imageObj.height) { + if (this.imageObj.width > this.imageObj.height) { + ratio_width = this.imageObj.width / this.imageObj.height; + } else { + ratio_height = this.imageObj.height / this.imageObj.width; + } + } - /** - * Set offset camera in camera coordinates - * @param {Number} x offset by camera horisontal - * @param {Number} y offset by camera vertical - */ - Camera.prototype.setOffset = function (x, y) { - var abs = Math.abs, - sign = _sign2['default'], - mul = this.offsetMultiplier, - border = this.armLength * mul; + width = this.options.size * 2 * ratio_width; + height = this.options.size * 2 * ratio_height; + } else { + // Use the image size + width = this.imageObj.width; + height = this.imageObj.height; + } - if (abs(x) > border) { - x = sign(x) * border; - } - if (abs(y) > border) { - y = sign(y) * border; + this.width = width; + this.height = height; + this.radius = 0.5 * this.width; } - this.cameraOffset.x = x; - this.cameraOffset.y = y; - this.calculateCameraOrientation(); - }; - /** - * Get camera offset by horizontal and vertical - * @return {Point3d} x - horizontal offset, y - vertical offset, z - not used - */ - Camera.prototype.getOffset = function (x, y) { - return this.cameraOffset; - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @private + */ - /** - * Set the location (origin) of the arm - * @param {Number} x Normalized value of x - * @param {Number} y Normalized value of y - * @param {Number} z Normalized value of z - */ - Camera.prototype.setArmLocation = function (x, y, z) { - this.armLocation.x = x; - this.armLocation.y = y; - this.armLocation.z = z; + }, { + key: '_drawRawCircle', + value: function _drawRawCircle(ctx, x, y, values) { + this.initContextForDraw(ctx, values); + ctx.circle(x, y, values.size); + this.performFill(ctx, values); + } - this.calculateCameraOrientation(); - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @private + */ - /** - * Set the rotation of the camera arm - * @param {Number} horizontal The horizontal rotation, between 0 and 2*PI. - * Optional, can be left undefined. - * @param {Number} vertical The vertical rotation, between 0 and 0.5*PI - * if vertical=0.5*PI, the graph is shown from the - * top. Optional, can be left undefined. - */ - Camera.prototype.setArmRotation = function (horizontal, vertical) { - if (horizontal !== undefined) { - this.armRotation.horizontal = horizontal; - } + }, { + key: '_drawImageAtPosition', + value: function _drawImageAtPosition(ctx, values) { + if (this.imageObj.width != 0) { + // draw the image + ctx.globalAlpha = 1.0; - if (vertical !== undefined) { - this.armRotation.vertical = vertical; - if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; - if (this.armRotation.vertical > 0.5 * Math.PI) this.armRotation.vertical = 0.5 * Math.PI; - } + // draw shadow if enabled + this.enableShadow(ctx, values); + + var factor = 1; + if (this.options.shapeProperties.interpolation === true) { + factor = this.imageObj.width / this.width / this.body.view.scale; + } + + this.imageObj.drawImageAtPosition(ctx, factor, this.left, this.top, this.width, this.height); - if (horizontal !== undefined || vertical !== undefined) { - this.calculateCameraOrientation(); + // disable shadows for other elements. + this.disableShadow(ctx, values); + } } - }; - /** - * Retrieve the current arm rotation - * @return {object} An object with parameters horizontal and vertical - */ - Camera.prototype.getArmRotation = function () { - var rot = {}; - rot.horizontal = this.armRotation.horizontal; - rot.vertical = this.armRotation.vertical; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @private + */ - return rot; - }; + }, { + key: '_drawImageLabel', + value: function _drawImageLabel(ctx, x, y, selected, hover) { + var yLabel; + var offset = 0; - /** - * Set the (normalized) length of the camera arm. - * @param {Number} length A length between 0.71 and 5.0 - */ - Camera.prototype.setArmLength = function (length) { - if (length === undefined) return; + if (this.height !== undefined) { + offset = this.height * 0.5; + var labelDimensions = this.labelModule.getTextSize(ctx, selected, hover); + if (labelDimensions.lineCount >= 1) { + offset += labelDimensions.height / 2; + } + } - this.armLength = length; + yLabel = y + offset; - // Radius must be larger than the corner of the graph, - // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the - // graph - if (this.armLength < 0.71) this.armLength = 0.71; - if (this.armLength > 5.0) this.armLength = 5.0; + if (this.options.label) { + this.labelOffset = offset; + } + this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging'); + } + }]); + return CircleImageBase; +}(_NodeBase3['default']); - this.setOffset(this.cameraOffset.x, this.cameraOffset.y); - this.calculateCameraOrientation(); - }; +exports['default'] = CircleImageBase; - /** - * Retrieve the arm length - * @return {Number} length - */ - Camera.prototype.getArmLength = function () { - return this.armLength; - }; +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Retrieve the camera location - * @return {Point3d} cameraLocation - */ - Camera.prototype.getCameraLocation = function () { - return this.cameraLocation; - }; +"use strict"; - /** - * Retrieve the camera rotation - * @return {Point3d} cameraRotation - */ - Camera.prototype.getCameraRotation = function () { - return this.cameraRotation; - }; - /** - * Calculate the location and rotation of the camera based on the - * position and orientation of the camera arm - */ - Camera.prototype.calculateCameraOrientation = function () { - // calculate location of the camera - this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); - this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); - this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); - - // calculate rotation of the camera - this.cameraRotation.x = Math.PI / 2 - this.armRotation.vertical; - this.cameraRotation.y = 0; - this.cameraRotation.z = -this.armRotation.horizontal; - - var xa = this.cameraRotation.x; - var ya = this.cameraRotation.y; - var za = this.cameraRotation.z; - var dx = this.cameraOffset.x; - var dy = this.cameraOffset.y; - var sin = Math.sin, - cos = Math.cos; - - this.cameraLocation.x = this.cameraLocation.x + dx * cos(za) + dy * -sin(za) * cos(xa); - this.cameraLocation.y = this.cameraLocation.y + dx * sin(za) + dy * cos(za) * cos(xa); - this.cameraLocation.z = this.cameraLocation.z + dy * sin(xa); - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - module.exports = Camera; +var _stringify = __webpack_require__(19); -/***/ }), -/* 103 */ -/***/ (function(module, exports, __webpack_require__) { +var _stringify2 = _interopRequireDefault(_stringify); - module.exports = { "default": __webpack_require__(104), __esModule: true }; +var _typeof2 = __webpack_require__(6); -/***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { +var _typeof3 = _interopRequireDefault(_typeof2); - __webpack_require__(105); - module.exports = __webpack_require__(17).Math.sign; +var _create = __webpack_require__(29); -/***/ }), -/* 105 */ -/***/ (function(module, exports, __webpack_require__) { +var _create2 = _interopRequireDefault(_create); - // 20.2.2.28 Math.sign(x) - var $export = __webpack_require__(15); +var _classCallCheck2 = __webpack_require__(0); - $export($export.S, 'Math', {sign: __webpack_require__(106)}); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -/***/ }), -/* 106 */ -/***/ (function(module, exports) { +var _createClass2 = __webpack_require__(1); - // 20.2.2.28 Math.sign(x) - module.exports = Math.sign || function sign(x){ - return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; - }; +var _createClass3 = _interopRequireDefault(_createClass2); -/***/ }), -/* 107 */ -/***/ (function(module, exports, __webpack_require__) { +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - 'use strict'; +var util = __webpack_require__(2); +var Label = __webpack_require__(117)['default']; +var ComponentUtil = __webpack_require__(48)['default']; +var CubicBezierEdge = __webpack_require__(215)['default']; +var BezierEdgeDynamic = __webpack_require__(217)['default']; +var BezierEdgeStatic = __webpack_require__(218)['default']; +var StraightEdge = __webpack_require__(219)['default']; - var DataView = __webpack_require__(93); +/** + * An edge connects two nodes and has a specific direction. + */ +var Edge = function () { /** - * @class Filter - * - * @param {DataGroup} dataGroup the data group - * @param {Number} column The index of the column to be filtered - * @param {Graph} graph The graph + * @param {Object} options values specific to this edge, must contain at least 'from' and 'to' + * @param {Object} body shared state from Network instance + * @param {Object} globalOptions options from the EdgesHandler instance + * @param {Object} defaultOptions default options from the EdgeHandler instance. Value and reference are constant */ - function Filter(dataGroup, column, graph) { - this.data = dataGroup.getDataSet(); - this.column = column; - this.graph = graph; // the parent graph - - this.index = undefined; - this.value = undefined; + function Edge(options, body, globalOptions, defaultOptions) { + (0, _classCallCheck3['default'])(this, Edge); - // read all distinct values and select the first one - this.values = dataGroup.getDistinctValues(this.column); - - if (this.values.length > 0) { - this.selectValue(0); + if (body === undefined) { + throw new Error("No body provided"); } - // create an array with the filtered datapoints. this will be loaded afterwards - this.dataPoints = []; + // Since globalOptions is constant in values as well as reference, + // Following needs to be done only once. - this.loaded = false; - this.onLoadCallback = undefined; + this.options = util.bridgeObject(globalOptions); + this.globalOptions = globalOptions; + this.defaultOptions = defaultOptions; + this.body = body; - if (graph.animationPreload) { - this.loaded = false; - this.loadInBackground(); - } else { - this.loaded = true; - } - }; + // initialize variables + this.id = undefined; + this.fromId = undefined; + this.toId = undefined; + this.selected = false; + this.hover = false; + this.labelDirty = true; - /** - * Return the label - * @return {string} label - */ - Filter.prototype.isLoaded = function () { - return this.loaded; - }; + this.baseWidth = this.options.width; + this.baseFontSize = this.options.font.size; - /** - * Return the loaded progress - * @return {Number} percentage between 0 and 100 - */ - Filter.prototype.getLoadedProgress = function () { - var len = this.values.length; + this.from = undefined; // a node + this.to = undefined; // a node - var i = 0; - while (this.dataPoints[i]) { - i++; - } + this.edgeType = undefined; - return Math.round(i / len * 100); - }; + this.connected = false; - /** - * Return the label - * @return {string} label - */ - Filter.prototype.getLabel = function () { - return this.graph.filterLabel; - }; + this.labelModule = new Label(this.body, this.options, true /* It's an edge label */); + this.setOptions(options); + } /** - * Return the columnIndex of the filter - * @return {Number} columnIndex + * Set or overwrite options for the edge + * @param {Object} options an object with options + * @returns {null|boolean} null if no options, boolean if date changed */ - Filter.prototype.getColumn = function () { - return this.column; - }; - /** - * Return the currently selected value. Returns undefined if there is no selection - * @return {*} value - */ - Filter.prototype.getSelectedValue = function () { - if (this.index === undefined) return undefined; - return this.values[this.index]; - }; + (0, _createClass3['default'])(Edge, [{ + key: 'setOptions', + value: function setOptions(options) { + if (!options) { + return; + } - /** - * Retrieve all values of the filter - * @return {Array} values - */ - Filter.prototype.getValues = function () { - return this.values; - }; + Edge.parseOptions(this.options, options, true, this.globalOptions); - /** - * Retrieve one value of the filter - * @param {Number} index - * @return {*} value - */ - Filter.prototype.getValue = function (index) { - if (index >= this.values.length) throw new Error('Index out of range'); + if (options.id !== undefined) { + this.id = options.id; + } + if (options.from !== undefined) { + this.fromId = options.from; + } + if (options.to !== undefined) { + this.toId = options.to; + } + if (options.title !== undefined) { + this.title = options.title; + } + if (options.value !== undefined) { + options.value = parseFloat(options.value); + } - return this.values[index]; - }; + var pile = [options, this.options, this.defaultOptions]; + this.chooser = ComponentUtil.choosify('edge', pile); - /** - * Retrieve the (filtered) dataPoints for the currently selected filter index - * @param {Number} [index] (optional) - * @return {Array} dataPoints - */ - Filter.prototype._getDataPoints = function (index) { - if (index === undefined) index = this.index; + // update label Module + this.updateLabelModule(options); - if (index === undefined) return []; + var dataChanged = this.updateEdgeType(); - var dataPoints; - if (this.dataPoints[index]) { - dataPoints = this.dataPoints[index]; - } else { - var f = {}; - f.column = this.column; - f.value = this.values[index]; + // if anything has been updates, reset the selection width and the hover width + this._setInteractionWidths(); - var dataView = new DataView(this.data, { filter: function filter(item) { - return item[f.column] == f.value; - } }).get(); - dataPoints = this.graph._getDataPoints(dataView); + // A node is connected when it has a from and to node that both exist in the network.body.nodes. + this.connect(); - this.dataPoints[index] = dataPoints; + if (options.hidden !== undefined || options.physics !== undefined) { + dataChanged = true; + } + + return dataChanged; } - return dataPoints; - }; + /** + * + * @param {Object} parentOptions + * @param {Object} newOptions + * @param {boolean} [allowDeletion=false] + * @param {Object} [globalOptions={}] + * @param {boolean} [copyFromGlobals=false] + */ - /** - * Set a callback function when the filter is fully loaded. - */ - Filter.prototype.setOnLoadCallback = function (callback) { - this.onLoadCallback = callback; - }; + }, { + key: 'getFormattingValues', - /** - * Add a value to the list with available values for this filter - * No double entries will be created. - * @param {Number} index - */ - Filter.prototype.selectValue = function (index) { - if (index >= this.values.length) throw new Error('Index out of range'); - this.index = index; - this.value = this.values[index]; - }; + /** + * + * @returns {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} + */ + value: function getFormattingValues() { + var toArrow = this.options.arrows.to === true || this.options.arrows.to.enabled === true; + var fromArrow = this.options.arrows.from === true || this.options.arrows.from.enabled === true; + var middleArrow = this.options.arrows.middle === true || this.options.arrows.middle.enabled === true; + var inheritsColor = this.options.color.inherit; + var values = { + toArrow: toArrow, + toArrowScale: this.options.arrows.to.scaleFactor, + toArrowType: this.options.arrows.to.type, + middleArrow: middleArrow, + middleArrowScale: this.options.arrows.middle.scaleFactor, + middleArrowType: this.options.arrows.middle.type, + fromArrow: fromArrow, + fromArrowScale: this.options.arrows.from.scaleFactor, + fromArrowType: this.options.arrows.from.type, + arrowStrikethrough: this.options.arrowStrikethrough, + color: inheritsColor ? undefined : this.options.color.color, + inheritsColor: inheritsColor, + opacity: this.options.color.opacity, + hidden: this.options.hidden, + length: this.options.length, + shadow: this.options.shadow.enabled, + shadowColor: this.options.shadow.color, + shadowSize: this.options.shadow.size, + shadowX: this.options.shadow.x, + shadowY: this.options.shadow.y, + dashes: this.options.dashes, + width: this.options.width + }; + if (this.selected || this.hover) { + if (this.chooser === true) { + if (this.selected) { + var selectedWidth = this.options.selectionWidth; + if (typeof selectedWidth === 'function') { + values.width = selectedWidth(values.width); + } else if (typeof selectedWidth === 'number') { + values.width += selectedWidth; + } + values.width = Math.max(values.width, 0.3 / this.body.view.scale); + values.color = this.options.color.highlight; + values.shadow = this.options.shadow.enabled; + } else if (this.hover) { + var hoverWidth = this.options.hoverWidth; + if (typeof hoverWidth === 'function') { + values.width = hoverWidth(values.width); + } else if (typeof hoverWidth === 'number') { + values.width += hoverWidth; + } + values.width = Math.max(values.width, 0.3 / this.body.view.scale); + values.color = this.options.color.hover; + values.shadow = this.options.shadow.enabled; + } + } else if (typeof this.chooser === 'function') { + this.chooser(values, this.options.id, this.selected, this.hover); + if (values.color !== undefined) { + values.inheritsColor = false; + } + if (values.shadow === false) { + if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) { + values.shadow = true; + } + } + } + } else { + values.shadow = this.options.shadow.enabled; + values.width = Math.max(values.width, 0.3 / this.body.view.scale); + } + return values; + } - /** - * Load all filtered rows in the background one by one - * Start this method without providing an index! - */ - Filter.prototype.loadInBackground = function (index) { - if (index === undefined) index = 0; + /** + * update the options in the label module + * + * @param {Object} options + */ - var frame = this.graph.frame; + }, { + key: 'updateLabelModule', + value: function updateLabelModule(options) { + var pile = [options, this.options, this.globalOptions, // Currently set global edge options + this.defaultOptions]; - if (index < this.values.length) { - var dataPointsTemp = this._getDataPoints(index); - //this.graph.redrawInfo(); // TODO: not neat + this.labelModule.update(this.options, pile); - // create a progress box - if (frame.progress === undefined) { - frame.progress = document.createElement('DIV'); - frame.progress.style.position = 'absolute'; - frame.progress.style.color = 'gray'; - frame.appendChild(frame.progress); + if (this.labelModule.baseSize !== undefined) { + this.baseFontSize = this.labelModule.baseSize; } - var progress = this.getLoadedProgress(); - frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; - // TODO: this is no nice solution... - frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider - frame.progress.style.left = 10 + 'px'; + } - var me = this; - setTimeout(function () { - me.loadInBackground(index + 1); - }, 10); - this.loaded = false; - } else { - this.loaded = true; + /** + * update the edge type, set the options + * @returns {boolean} + */ - // remove the progress box - if (frame.progress !== undefined) { - frame.removeChild(frame.progress); - frame.progress = undefined; + }, { + key: 'updateEdgeType', + value: function updateEdgeType() { + var smooth = this.options.smooth; + var dataChanged = false; + var changeInType = true; + if (this.edgeType !== undefined) { + if (this.edgeType instanceof BezierEdgeDynamic && smooth.enabled === true && smooth.type === 'dynamic' || this.edgeType instanceof CubicBezierEdge && smooth.enabled === true && smooth.type === 'cubicBezier' || this.edgeType instanceof BezierEdgeStatic && smooth.enabled === true && smooth.type !== 'dynamic' && smooth.type !== 'cubicBezier' || this.edgeType instanceof StraightEdge && smooth.type.enabled === false) { + changeInType = false; + } + if (changeInType === true) { + dataChanged = this.cleanup(); + } } - - if (this.onLoadCallback) this.onLoadCallback(); + if (changeInType === true) { + if (smooth.enabled === true) { + if (smooth.type === 'dynamic') { + dataChanged = true; + this.edgeType = new BezierEdgeDynamic(this.options, this.body, this.labelModule); + } else if (smooth.type === 'cubicBezier') { + this.edgeType = new CubicBezierEdge(this.options, this.body, this.labelModule); + } else { + this.edgeType = new BezierEdgeStatic(this.options, this.body, this.labelModule); + } + } else { + this.edgeType = new StraightEdge(this.options, this.body, this.labelModule); + } + } else { + // if nothing changes, we just set the options. + this.edgeType.setOptions(this.options); + } + return dataChanged; } - }; - module.exports = Filter; + /** + * Connect an edge to its nodes + */ -/***/ }), -/* 108 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'connect', + value: function connect() { + this.disconnect(); - 'use strict'; + this.from = this.body.nodes[this.fromId] || undefined; + this.to = this.body.nodes[this.toId] || undefined; + this.connected = this.from !== undefined && this.to !== undefined; - var util = __webpack_require__(1); + if (this.connected === true) { + this.from.attachEdge(this); + this.to.attachEdge(this); + } else { + if (this.from) { + this.from.detachEdge(this); + } + if (this.to) { + this.to.detachEdge(this); + } + } - /** - * @constructor Slider - * - * An html slider control with start/stop/prev/next buttons - * @param {Element} container The element where the slider will be created - * @param {Object} options Available options: - * {boolean} visible If true (default) the - * slider is visible. - */ - function Slider(container, options) { - if (container === undefined) { - throw new Error('No container element defined'); + this.edgeType.connect(); } - this.container = container; - this.visible = options && options.visible != undefined ? options.visible : true; - if (this.visible) { - this.frame = document.createElement('DIV'); - //this.frame.style.backgroundColor = '#E5E5E5'; - this.frame.style.width = '100%'; - this.frame.style.position = 'relative'; - this.container.appendChild(this.frame); + /** + * Disconnect an edge from its nodes + */ - this.frame.prev = document.createElement('INPUT'); - this.frame.prev.type = 'BUTTON'; - this.frame.prev.value = 'Prev'; - this.frame.appendChild(this.frame.prev); - - this.frame.play = document.createElement('INPUT'); - this.frame.play.type = 'BUTTON'; - this.frame.play.value = 'Play'; - this.frame.appendChild(this.frame.play); - - this.frame.next = document.createElement('INPUT'); - this.frame.next.type = 'BUTTON'; - this.frame.next.value = 'Next'; - this.frame.appendChild(this.frame.next); - - this.frame.bar = document.createElement('INPUT'); - this.frame.bar.type = 'BUTTON'; - this.frame.bar.style.position = 'absolute'; - this.frame.bar.style.border = '1px solid red'; - this.frame.bar.style.width = '100px'; - this.frame.bar.style.height = '6px'; - this.frame.bar.style.borderRadius = '2px'; - this.frame.bar.style.MozBorderRadius = '2px'; - this.frame.bar.style.border = '1px solid #7F7F7F'; - this.frame.bar.style.backgroundColor = '#E5E5E5'; - this.frame.appendChild(this.frame.bar); - - this.frame.slide = document.createElement('INPUT'); - this.frame.slide.type = 'BUTTON'; - this.frame.slide.style.margin = '0px'; - this.frame.slide.value = ' '; - this.frame.slide.style.position = 'relative'; - this.frame.slide.style.left = '-100px'; - this.frame.appendChild(this.frame.slide); - - // create events - var me = this; - this.frame.slide.onmousedown = function (event) { - me._onMouseDown(event); - }; - this.frame.prev.onclick = function (event) { - me.prev(event); - }; - this.frame.play.onclick = function (event) { - me.togglePlay(event); - }; - this.frame.next.onclick = function (event) { - me.next(event); - }; + }, { + key: 'disconnect', + value: function disconnect() { + if (this.from) { + this.from.detachEdge(this); + this.from = undefined; + } + if (this.to) { + this.to.detachEdge(this); + this.to = undefined; + } + + this.connected = false; } - this.onChangeCallback = undefined; + /** + * get the title of this edge. + * @return {string} title The title of the edge, or undefined when no title + * has been set. + */ - this.values = []; - this.index = undefined; + }, { + key: 'getTitle', + value: function getTitle() { + return this.title; + } - this.playTimeout = undefined; - this.playInterval = 1000; // milliseconds - this.playLoop = true; - } + /** + * check if this node is selecte + * @return {boolean} selected True if node is selected, else false + */ - /** - * Select the previous index - */ - Slider.prototype.prev = function () { - var index = this.getIndex(); - if (index > 0) { - index--; - this.setIndex(index); + }, { + key: 'isSelected', + value: function isSelected() { + return this.selected; } - }; - /** - * Select the next index - */ - Slider.prototype.next = function () { - var index = this.getIndex(); - if (index < this.values.length - 1) { - index++; - this.setIndex(index); + /** + * Retrieve the value of the edge. Can be undefined + * @return {number} value + */ + + }, { + key: 'getValue', + value: function getValue() { + return this.options.value; } - }; - /** - * Select the next index - */ - Slider.prototype.playNext = function () { - var start = new Date(); + /** + * Adjust the value range of the edge. The edge will adjust it's width + * based on its value. + * @param {number} min + * @param {number} max + * @param {number} total + */ + + }, { + key: 'setValueRange', + value: function setValueRange(min, max, total) { + if (this.options.value !== undefined) { + var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); + var widthDiff = this.options.scaling.max - this.options.scaling.min; + if (this.options.scaling.label.enabled === true) { + var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; + this.options.font.size = this.options.scaling.label.min + scale * fontDiff; + } + this.options.width = this.options.scaling.min + scale * widthDiff; + } else { + this.options.width = this.baseWidth; + this.options.font.size = this.baseFontSize; + } - var index = this.getIndex(); - if (index < this.values.length - 1) { - index++; - this.setIndex(index); - } else if (this.playLoop) { - // jump to the start - index = 0; - this.setIndex(index); + this._setInteractionWidths(); + this.updateLabelModule(); } - var end = new Date(); - var diff = end - start; + /** + * + * @private + */ - // calculate how much time it to to set the index and to execute the callback - // function. - var interval = Math.max(this.playInterval - diff, 0); - // document.title = diff // TODO: cleanup + }, { + key: '_setInteractionWidths', + value: function _setInteractionWidths() { + if (typeof this.options.hoverWidth === 'function') { + this.edgeType.hoverWidth = this.options.hoverWidth(this.options.width); + } else { + this.edgeType.hoverWidth = this.options.hoverWidth + this.options.width; + } + if (typeof this.options.selectionWidth === 'function') { + this.edgeType.selectionWidth = this.options.selectionWidth(this.options.width); + } else { + this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width; + } + } - var me = this; - this.playTimeout = setTimeout(function () { - me.playNext(); - }, interval); - }; + /** + * Redraw a edge + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * @param {CanvasRenderingContext2D} ctx + */ - /** - * Toggle start or stop playing - */ - Slider.prototype.togglePlay = function () { - if (this.playTimeout === undefined) { - this.play(); - } else { - this.stop(); - } - }; + }, { + key: 'draw', + value: function draw(ctx) { + var values = this.getFormattingValues(); + if (values.hidden) { + return; + } - /** - * Start playing - */ - Slider.prototype.play = function () { - // Test whether already playing - if (this.playTimeout) return; + // get the via node from the edge type + var viaNode = this.edgeType.getViaNode(); + var arrowData = {}; - this.playNext(); + // restore edge targets to defaults + this.edgeType.fromPoint = this.edgeType.from; + this.edgeType.toPoint = this.edgeType.to; - if (this.frame) { - this.frame.play.value = 'Stop'; - } - }; + // from and to arrows give a different end point for edges. we set them here + if (values.fromArrow) { + arrowData.from = this.edgeType.getArrowData(ctx, 'from', viaNode, this.selected, this.hover, values); + if (values.arrowStrikethrough === false) this.edgeType.fromPoint = arrowData.from.core; + } + if (values.toArrow) { + arrowData.to = this.edgeType.getArrowData(ctx, 'to', viaNode, this.selected, this.hover, values); + if (values.arrowStrikethrough === false) this.edgeType.toPoint = arrowData.to.core; + } - /** - * Stop playing - */ - Slider.prototype.stop = function () { - clearInterval(this.playTimeout); - this.playTimeout = undefined; + // the middle arrow depends on the line, which can depend on the to and from arrows so we do this one lastly. + if (values.middleArrow) { + arrowData.middle = this.edgeType.getArrowData(ctx, 'middle', viaNode, this.selected, this.hover, values); + } - if (this.frame) { - this.frame.play.value = 'Play'; + // draw everything + this.edgeType.drawLine(ctx, values, this.selected, this.hover, viaNode); + this.drawArrows(ctx, arrowData, values); + this.drawLabel(ctx, viaNode); } - }; - /** - * Set a callback function which will be triggered when the value of the - * slider bar has changed. - */ - Slider.prototype.setOnChangeCallback = function (callback) { - this.onChangeCallback = callback; - }; - - /** - * Set the interval for playing the list - * @param {Number} interval The interval in milliseconds - */ - Slider.prototype.setPlayInterval = function (interval) { - this.playInterval = interval; - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} arrowData + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - /** - * Retrieve the current play interval - * @return {Number} interval The interval in milliseconds - */ - Slider.prototype.getPlayInterval = function (interval) { - return this.playInterval; - }; + }, { + key: 'drawArrows', + value: function drawArrows(ctx, arrowData, values) { + if (values.fromArrow) { + this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.from); + } + if (values.middleArrow) { + this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.middle); + } + if (values.toArrow) { + this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.to); + } + } - /** - * Set looping on or off - * @pararm {boolean} doLoop If true, the slider will jump to the start when - * the end is passed, and will jump to the end - * when the start is passed. - */ - Slider.prototype.setPlayLoop = function (doLoop) { - this.playLoop = doLoop; - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {Node} viaNode + */ - /** - * Execute the onchange callback function - */ - Slider.prototype.onChange = function () { - if (this.onChangeCallback !== undefined) { - this.onChangeCallback(); - } - }; + }, { + key: 'drawLabel', + value: function drawLabel(ctx, viaNode) { + if (this.options.label !== undefined) { + // set style + var node1 = this.from; + var node2 = this.to; - /** - * redraw the slider on the correct place - */ - Slider.prototype.redraw = function () { - if (this.frame) { - // resize the bar - this.frame.bar.style.top = this.frame.clientHeight / 2 - this.frame.bar.offsetHeight / 2 + 'px'; - this.frame.bar.style.width = this.frame.clientWidth - this.frame.prev.clientWidth - this.frame.play.clientWidth - this.frame.next.clientWidth - 30 + 'px'; + if (this.labelModule.differentState(this.selected, this.hover)) { + this.labelModule.getTextSize(ctx, this.selected, this.hover); + } - // position the slider button - var left = this.indexToLeft(this.index); - this.frame.slide.style.left = left + 'px'; - } - }; + if (node1.id != node2.id) { + this.labelModule.pointToSelf = false; + var point = this.edgeType.getPoint(0.5, viaNode); + ctx.save(); - /** - * Set the list with values for the slider - * @param {Array} values A javascript array with values (any type) - */ - Slider.prototype.setValues = function (values) { - this.values = values; + var rotationPoint = this._getRotation(ctx); + if (rotationPoint.angle != 0) { + ctx.translate(rotationPoint.x, rotationPoint.y); + ctx.rotate(rotationPoint.angle); + } - if (this.values.length > 0) this.setIndex(0);else this.index = undefined; - }; + // draw the label + this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover); - /** - * Select a value by its index - * @param {Number} index - */ - Slider.prototype.setIndex = function (index) { - if (index < this.values.length) { - this.index = index; + /* + // Useful debug code: draw a border around the label + // This should **not** be enabled in production! + var size = this.labelModule.getSize();; // ;; intentional so lint catches it + ctx.strokeStyle = "#ff0000"; + ctx.strokeRect(size.left, size.top, size.width, size.height); + // End debug code + */ - this.redraw(); - this.onChange(); - } else { - throw new Error('Index out of range'); + ctx.restore(); + } else { + // Ignore the orientations. + this.labelModule.pointToSelf = true; + var x, y; + var radius = this.options.selfReferenceSize; + if (node1.shape.width > node1.shape.height) { + x = node1.x + node1.shape.width * 0.5; + y = node1.y - radius; + } else { + x = node1.x + radius; + y = node1.y - node1.shape.height * 0.5; + } + point = this._pointOnCircle(x, y, radius, 0.125); + this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover); + } + } } - }; - /** - * retrieve the index of the currently selected vaue - * @return {Number} index - */ - Slider.prototype.getIndex = function () { - return this.index; - }; + /** + * Determine all visual elements of this edge instance, in which the given + * point falls within the bounding shape. + * + * @param {point} point + * @returns {Array.} list with the items which are on the point + */ - /** - * retrieve the currently selected value - * @return {*} value - */ - Slider.prototype.get = function () { - return this.values[this.index]; - }; + }, { + key: 'getItemsOnPoint', + value: function getItemsOnPoint(point) { + var ret = []; - Slider.prototype._onMouseDown = function (event) { - // only react on left mouse button down - var leftButtonDown = event.which ? event.which === 1 : event.button === 1; - if (!leftButtonDown) return; + if (this.labelModule.visible()) { + var rotationPoint = this._getRotation(); + if (ComponentUtil.pointInRect(this.labelModule.getSize(), point, rotationPoint)) { + ret.push({ edgeId: this.id, labelId: 0 }); + } + } - this.startClientX = event.clientX; - this.startSlideX = parseFloat(this.frame.slide.style.left); + var obj = { + left: point.x, + top: point.y + }; - this.frame.style.cursor = 'move'; + if (this.isOverlappingWith(obj)) { + ret.push({ edgeId: this.id }); + } - // add event listeners to handle moving the contents - // we store the function onmousemove and onmouseup in the graph, so we can - // remove the eventlisteners lateron in the function mouseUp() - var me = this; - this.onmousemove = function (event) { - me._onMouseMove(event); - }; - this.onmouseup = function (event) { - me._onMouseUp(event); - }; - util.addEventListener(document, 'mousemove', this.onmousemove); - util.addEventListener(document, 'mouseup', this.onmouseup); - util.preventDefault(event); - }; + return ret; + } - Slider.prototype.leftToIndex = function (left) { - var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10; - var x = left - 3; + /** + * Check if this object is overlapping with the provided object + * @param {Object} obj an object with parameters left, top + * @return {boolean} True if location is located on the edge + */ - var index = Math.round(x / width * (this.values.length - 1)); - if (index < 0) index = 0; - if (index > this.values.length - 1) index = this.values.length - 1; + }, { + key: 'isOverlappingWith', + value: function isOverlappingWith(obj) { + if (this.connected) { + var distMax = 10; + var xFrom = this.from.x; + var yFrom = this.from.y; + var xTo = this.to.x; + var yTo = this.to.y; + var xObj = obj.left; + var yObj = obj.top; + + var dist = this.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj); + + return dist < distMax; + } else { + return false; + } + } - return index; - }; + /** + * Determine the rotation point, if any. + * + * @param {CanvasRenderingContext2D} [ctx] if passed, do a recalculation of the label size + * @returns {rotationPoint} the point to rotate around and the angle in radians to rotate + * @private + */ - Slider.prototype.indexToLeft = function (index) { - var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10; + }, { + key: '_getRotation', + value: function _getRotation(ctx) { + var viaNode = this.edgeType.getViaNode(); + var point = this.edgeType.getPoint(0.5, viaNode); - var x = index / (this.values.length - 1) * width; - var left = x + 3; + if (ctx !== undefined) { + this.labelModule.calculateLabelSize(ctx, this.selected, this.hover, point.x, point.y); + } - return left; - }; + var ret = { + x: point.x, + y: this.labelModule.size.yLine, + angle: 0 + }; - Slider.prototype._onMouseMove = function (event) { - var diff = event.clientX - this.startClientX; - var x = this.startSlideX + diff; + if (!this.labelModule.visible()) { + return ret; // Don't even bother doing the atan2, there's nothing to draw + } - var index = this.leftToIndex(x); + if (this.options.font.align === "horizontal") { + return ret; // No need to calculate angle + } - this.setIndex(index); + var dy = this.from.y - this.to.y; + var dx = this.from.x - this.to.x; + var angle = Math.atan2(dy, dx); // radians - util.preventDefault(); - }; + // rotate so that label is readable + if (angle < -1 && dx < 0 || angle > 0 && dx < 0) { + angle += Math.PI; + } + ret.angle = angle; - Slider.prototype._onMouseUp = function (event) { - this.frame.style.cursor = 'auto'; + return ret; + } - // remove event listeners - util.removeEventListener(document, 'mousemove', this.onmousemove); - util.removeEventListener(document, 'mouseup', this.onmouseup); + /** + * Get a point on a circle + * @param {number} x + * @param {number} y + * @param {number} radius + * @param {number} percentage Value between 0 (line start) and 1 (line end) + * @return {Object} point + * @private + */ - util.preventDefault(); - }; + }, { + key: '_pointOnCircle', + value: function _pointOnCircle(x, y, radius, percentage) { + var angle = percentage * 2 * Math.PI; + return { + x: x + radius * Math.cos(angle), + y: y - radius * Math.sin(angle) + }; + } - module.exports = Slider; + /** + * Sets selected state to true + */ -/***/ }), -/* 109 */ -/***/ (function(module, exports) { + }, { + key: 'select', + value: function select() { + this.selected = true; + } - 'use strict'; + /** + * Sets selected state to false + */ - /** - * @prototype StepNumber - * The class StepNumber is an iterator for Numbers. You provide a start and end - * value, and a best step size. StepNumber itself rounds to fixed values and - * a finds the step that best fits the provided step. - * - * If prettyStep is true, the step size is chosen as close as possible to the - * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... - * - * Example usage: - * var step = new StepNumber(0, 10, 2.5, true); - * step.start(); - * while (!step.end()) { - * alert(step.getCurrent()); - * step.next(); - * } - * - * Version: 1.0 - * - * @param {Number} start The start value - * @param {Number} end The end value - * @param {Number} step Optional. Step size. Must be a positive value. - * @param {boolean} prettyStep Optional. If true, the step size is rounded - * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ - function StepNumber(start, end, step, prettyStep) { - // set default values - this._start = 0; - this._end = 0; - this._step = 1; - this.prettyStep = true; - this.precision = 5; - - this._current = 0; - this.setRange(start, end, step, prettyStep); - }; + }, { + key: 'unselect', + value: function unselect() { + this.selected = false; + } - /** - * Check for input values, to prevent disasters from happening - * - * Source: http://stackoverflow.com/a/1830844 - */ - StepNumber.prototype.isNumeric = function (n) { - return !isNaN(parseFloat(n)) && isFinite(n); - }; + /** + * cleans all required things on delete + * @returns {*} + */ - /** - * Set a new range: start, end and step. - * - * @param {Number} start The start value - * @param {Number} end The end value - * @param {Number} step Optional. Step size. Must be a positive value. - * @param {boolean} prettyStep Optional. If true, the step size is rounded - * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ - StepNumber.prototype.setRange = function (start, end, step, prettyStep) { - if (!this.isNumeric(start)) { - throw new Error('Parameter \'start\' is not numeric; value: ' + start); - } - if (!this.isNumeric(end)) { - throw new Error('Parameter \'end\' is not numeric; value: ' + start); - } - if (!this.isNumeric(step)) { - throw new Error('Parameter \'step\' is not numeric; value: ' + start); + }, { + key: 'cleanup', + value: function cleanup() { + return this.edgeType.cleanup(); } - this._start = start ? start : 0; - this._end = end ? end : 0; + /** + * Remove edge from the list and perform necessary cleanup. + */ - this.setStep(step, prettyStep); - }; + }, { + key: 'remove', + value: function remove() { + this.cleanup(); + this.disconnect(); + delete this.body.edges[this.id]; + } - /** - * Set a new step size - * @param {Number} step New step size. Must be a positive value - * @param {boolean} prettyStep Optional. If true, the provided step is rounded - * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) - */ - StepNumber.prototype.setStep = function (step, prettyStep) { - if (step === undefined || step <= 0) return; + /** + * Check if both connecting nodes exist + * @returns {boolean} + */ - if (prettyStep !== undefined) this.prettyStep = prettyStep; + }, { + key: 'endPointsValid', + value: function endPointsValid() { + return this.body.nodes[this.fromId] !== undefined && this.body.nodes[this.toId] !== undefined; + } + }], [{ + key: 'parseOptions', + value: function parseOptions(parentOptions, newOptions) { + var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var copyFromGlobals = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - if (this.prettyStep === true) this._step = StepNumber.calculatePrettyStep(step);else this._step = step; - }; + var fields = ['arrowStrikethrough', 'id', 'from', 'hidden', 'hoverWidth', 'labelHighlightBold', 'length', 'line', 'opacity', 'physics', 'scaling', 'selectionWidth', 'selfReferenceSize', 'to', 'title', 'value', 'width', 'font', 'chosen', 'widthConstraint']; - /** - * Calculate a nice step size, closest to the desired step size. - * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an - * integer Number. For example 1, 2, 5, 10, 20, 50, etc... - * @param {Number} step Desired step size - * @return {Number} Nice step size - */ - StepNumber.calculatePrettyStep = function (step) { - var log10 = function log10(x) { - return Math.log(x) / Math.LN10; - }; + // only deep extend the items in the field array. These do not have shorthand. + util.selectiveDeepExtend(fields, parentOptions, newOptions, allowDeletion); - // try three steps (multiple of 1, 2, or 5 - var step1 = Math.pow(10, Math.round(log10(step))), - step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), - step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); + // Only copy label if it's a legal value. + if (ComponentUtil.isValidLabel(newOptions.label)) { + parentOptions.label = newOptions.label; + } else { + parentOptions.label = undefined; + } - // choose the best step (closest to minimum step) - var prettyStep = step1; - if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; - if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; + util.mergeOptions(parentOptions, newOptions, 'smooth', globalOptions); + util.mergeOptions(parentOptions, newOptions, 'shadow', globalOptions); - // for safety - if (prettyStep <= 0) { - prettyStep = 1; - } + if (newOptions.dashes !== undefined && newOptions.dashes !== null) { + parentOptions.dashes = newOptions.dashes; + } else if (allowDeletion === true && newOptions.dashes === null) { + parentOptions.dashes = (0, _create2['default'])(globalOptions.dashes); // this sets the pointer of the option back to the global option. + } - return prettyStep; - }; + // set the scaling newOptions + if (newOptions.scaling !== undefined && newOptions.scaling !== null) { + if (newOptions.scaling.min !== undefined) { + parentOptions.scaling.min = newOptions.scaling.min; + } + if (newOptions.scaling.max !== undefined) { + parentOptions.scaling.max = newOptions.scaling.max; + } + util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', globalOptions.scaling); + } else if (allowDeletion === true && newOptions.scaling === null) { + parentOptions.scaling = (0, _create2['default'])(globalOptions.scaling); // this sets the pointer of the option back to the global option. + } - /** - * returns the current value of the step - * @return {Number} current value - */ - StepNumber.prototype.getCurrent = function () { - return parseFloat(this._current.toPrecision(this.precision)); - }; + // handle multiple input cases for arrows + if (newOptions.arrows !== undefined && newOptions.arrows !== null) { + if (typeof newOptions.arrows === 'string') { + var arrows = newOptions.arrows.toLowerCase(); + parentOptions.arrows.to.enabled = arrows.indexOf("to") != -1; + parentOptions.arrows.middle.enabled = arrows.indexOf("middle") != -1; + parentOptions.arrows.from.enabled = arrows.indexOf("from") != -1; + } else if ((0, _typeof3['default'])(newOptions.arrows) === 'object') { + util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'to', globalOptions.arrows); + util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'middle', globalOptions.arrows); + util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'from', globalOptions.arrows); + } else { + throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:" + (0, _stringify2['default'])(newOptions.arrows)); + } + } else if (allowDeletion === true && newOptions.arrows === null) { + parentOptions.arrows = (0, _create2['default'])(globalOptions.arrows); // this sets the pointer of the option back to the global option. + } - /** - * returns the current step size - * @return {Number} current step size - */ - StepNumber.prototype.getStep = function () { - return this._step; - }; + // handle multiple input cases for color + if (newOptions.color !== undefined && newOptions.color !== null) { + var fromColor = newOptions.color; + var toColor = parentOptions.color; - /** - * Set the current to its starting value. - * - * By default, this will be the largest value smaller than start, which - * is a multiple of the step size. - * - * Parameters checkFirst is optional, default false. - * If set to true, move the current value one step if smaller than start. - */ - StepNumber.prototype.start = function (checkFirst) { - if (checkFirst === undefined) { - checkFirst = false; - } + // If passed, fill in values from default options - required in the case of no prototype bridging + if (copyFromGlobals) { + util.deepExtend(toColor, globalOptions.color, false, allowDeletion); + } else { + // Clear local properties - need to do it like this in order to retain prototype bridges + for (var i in toColor) { + if (toColor.hasOwnProperty(i)) { + delete toColor[i]; + } + } + } - this._current = this._start - this._start % this._step; + if (util.isString(toColor)) { + toColor.color = toColor; + toColor.highlight = toColor; + toColor.hover = toColor; + toColor.inherit = false; + if (fromColor.opacity === undefined) { + toColor.opacity = 1.0; // set default + } + } else { + var colorsDefined = false; + if (fromColor.color !== undefined) { + toColor.color = fromColor.color;colorsDefined = true; + } + if (fromColor.highlight !== undefined) { + toColor.highlight = fromColor.highlight;colorsDefined = true; + } + if (fromColor.hover !== undefined) { + toColor.hover = fromColor.hover;colorsDefined = true; + } + if (fromColor.inherit !== undefined) { + toColor.inherit = fromColor.inherit; + } + if (fromColor.opacity !== undefined) { + toColor.opacity = Math.min(1, Math.max(0, fromColor.opacity)); + } - if (checkFirst) { - if (this.getCurrent() < this._start) { - this.next(); + if (colorsDefined === true) { + toColor.inherit = false; + } else { + if (toColor.inherit === undefined) { + toColor.inherit = 'from'; // Set default + } + } + } + } else if (allowDeletion === true && newOptions.color === null) { + parentOptions.color = util.bridgeObject(globalOptions.color); // set the object back to the global options } - } - }; - - /** - * Do a step, add the step size to the current value - */ - StepNumber.prototype.next = function () { - this._current += this._step; - }; - /** - * Returns true whether the end is reached - * @return {boolean} True if the current value has passed the end value. - */ - StepNumber.prototype.end = function () { - return this._current > this._end; - }; + if (allowDeletion === true && newOptions.font === null) { + parentOptions.font = util.bridgeObject(globalOptions.font); // set the object back to the global options + } + } + }]); + return Edge; +}(); - module.exports = StepNumber; +exports['default'] = Edge; /***/ }), -/* 110 */ -/***/ (function(module, exports) { - - 'use strict'; - - /** - * @prototype Range - * - * Helper class to make working with related min and max values easier. - * - * The range is inclusive; a given value is considered part of the range if: - * - * this.min <= value <= this.max - */ - function Range() { - this.min = undefined; - this.max = undefined; - } - - /** - * Adjust the range so that the passed value fits in it. - * - * If the value is outside of the current extremes, adjust - * the min or max so that the value is within the range. - * - * @param {number} value Numeric value to fit in range - */ - Range.prototype.adjust = function (value) { - if (value === undefined) return; +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.min === undefined || this.min > value) { - this.min = value; - } +"use strict"; - if (this.max === undefined || this.max < value) { - this.max = value; - } - }; - /** - * Adjust the current range so that the passed range fits in it. - * - * @param {Range} range Range instance to fit in current instance - */ - Range.prototype.combine = function (range) { - this.add(range.min); - this.add(range.max); - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * Expand the range by the given value - * - * min will be lowered by given value; - * max will be raised by given value - * - * Shrinking by passing a negative value is allowed. - * - * @param {number} val Amount by which to expand or shrink current range with - */ - Range.prototype.expand = function (val) { - if (val === undefined) { - return; - } +var _getPrototypeOf = __webpack_require__(3); - var newMin = this.min - val; - var newMax = this.max + val; +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - // Note that following allows newMin === newMax. - // This should be OK, since method expand() allows this also. - if (newMin > newMax) { - throw new Error('Passed expansion value makes range invalid'); - } +var _classCallCheck2 = __webpack_require__(0); - this.min = newMin; - this.max = newMax; - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * Determine the full range width of current instance. - * - * @returns {num} The calculated width of this range - */ - Range.prototype.range = function () { - return this.max - this.min; - }; +var _createClass2 = __webpack_require__(1); - /** - * Determine the central point of current instance. - * - * @returns {number} the value in the middle of min and max - */ - Range.prototype.center = function () { - return (this.min + this.max) / 2; - }; +var _createClass3 = _interopRequireDefault(_createClass2); - module.exports = Range; +var _possibleConstructorReturn2 = __webpack_require__(4); -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - 'use strict'; +var _inherits2 = __webpack_require__(5); - var _typeof2 = __webpack_require__(62); +var _inherits3 = _interopRequireDefault(_inherits2); - var _typeof3 = _interopRequireDefault(_typeof2); +var _EdgeBase2 = __webpack_require__(118); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _EdgeBase3 = _interopRequireDefault(_EdgeBase2); - //////////////////////////////////////////////////////////////////////////////// - // This modules handles the options for Graph3d. - // - //////////////////////////////////////////////////////////////////////////////// - var util = __webpack_require__(1); - var Camera = __webpack_require__(102); - var Point3d = __webpack_require__(100); - - // enumerate the available styles - var STYLE = { - BAR: 0, - BARCOLOR: 1, - BARSIZE: 2, - DOT: 3, - DOTLINE: 4, - DOTCOLOR: 5, - DOTSIZE: 6, - GRID: 7, - LINE: 8, - SURFACE: 9 - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // The string representations of the styles - var STYLENAME = { - 'dot': STYLE.DOT, - 'dot-line': STYLE.DOTLINE, - 'dot-color': STYLE.DOTCOLOR, - 'dot-size': STYLE.DOTSIZE, - 'line': STYLE.LINE, - 'grid': STYLE.GRID, - 'surface': STYLE.SURFACE, - 'bar': STYLE.BAR, - 'bar-color': STYLE.BARCOLOR, - 'bar-size': STYLE.BARSIZE - }; +/** + * The Base Class for all Bezier edges. Bezier curves are used to model smooth + * gradual curves in paths between nodes. + * + * @extends EdgeBase + */ +var BezierEdgeBase = function (_EdgeBase) { + (0, _inherits3['default'])(BezierEdgeBase, _EdgeBase); /** - * Field names in the options hash which are of relevance to the user. - * - * Specifically, these are the fields which require no special handling, - * and can be directly copied over. + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule */ - var OPTIONKEYS = ['width', 'height', 'filterLabel', 'legendLabel', 'xLabel', 'yLabel', 'zLabel', 'xValueLabel', 'yValueLabel', 'zValueLabel', 'showXAxis', 'showYAxis', 'showZAxis', 'showGrid', 'showPerspective', 'showShadow', 'keepAspectRatio', 'verticalRatio', 'dotSizeRatio', 'dotSizeMinFraction', 'dotSizeMaxFraction', 'showAnimationControls', 'animationInterval', 'animationPreload', 'animationAutoStart', 'axisColor', 'gridColor', 'xCenter', 'yCenter']; + function BezierEdgeBase(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, BezierEdgeBase); + return (0, _possibleConstructorReturn3['default'])(this, (BezierEdgeBase.__proto__ || (0, _getPrototypeOf2['default'])(BezierEdgeBase)).call(this, options, body, labelModule)); + } /** - * Field names in the options hash which are of relevance to the user. + * This function uses binary search to look for the point where the bezier curve crosses the border of the node. * - * Same as OPTIONKEYS, but internally these fields are stored with - * prefix 'default' in the name. + * @param {Node} nearNode + * @param {CanvasRenderingContext2D} ctx + * @param {Node} viaNode + * @returns {*} + * @private */ - var PREFIXEDOPTIONKEYS = ['xBarWidth', 'yBarWidth', 'valueMin', 'valueMax', 'xMin', 'xMax', 'xStep', 'yMin', 'yMax', 'yStep', 'zMin', 'zMax', 'zStep']; - // Placeholder for DEFAULTS reference - var DEFAULTS = undefined; - /** - * Check if given hash is empty. - * - * Source: http://stackoverflow.com/a/679937 - */ - function isEmpty(obj) { - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) return false; - } + (0, _createClass3['default'])(BezierEdgeBase, [{ + key: '_findBorderPositionBezier', + value: function _findBorderPositionBezier(nearNode, ctx) { + var viaNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this._getViaCoordinates(); - return true; - } + var maxIterations = 10; + var iteration = 0; + var low = 0; + var high = 1; + var pos, angle, distanceToBorder, distanceToPoint, difference; + var threshold = 0.2; + var node = this.to; + var from = false; + if (nearNode.id === this.from.id) { + node = this.from; + from = true; + } - /** - * Make first letter of parameter upper case. - * - * Source: http://stackoverflow.com/a/1026087 - */ - function capitalize(str) { - if (str === undefined || str === "" || typeof str != "string") { - return str; - } + while (low <= high && iteration < maxIterations) { + var middle = (low + high) * 0.5; - return str.charAt(0).toUpperCase() + str.slice(1); - } - - /** - * Add a prefix to a field name, taking style guide into account - */ - function prefixFieldName(prefix, fieldName) { - if (prefix === undefined || prefix === "") { - return fieldName; - } + pos = this.getPoint(middle, viaNode); + angle = Math.atan2(node.y - pos.y, node.x - pos.x); + distanceToBorder = node.distanceToBorder(ctx, angle); + distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2)); + difference = distanceToBorder - distanceToPoint; + if (Math.abs(difference) < threshold) { + break; // found + } else if (difference < 0) { + // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. + if (from === false) { + low = middle; + } else { + high = middle; + } + } else { + if (from === false) { + high = middle; + } else { + low = middle; + } + } - return prefix + capitalize(fieldName); - } + iteration++; + } + pos.t = middle; - /** - * Forcibly copy fields from src to dst in a controlled manner. - * - * A given field in dst will always be overwitten. If this field - * is undefined or not present in src, the field in dst will - * be explicitly set to undefined. - * - * The intention here is to be able to reset all option fields. - * - * Only the fields mentioned in array 'fields' will be handled. - * - * @param fields array with names of fields to copy - * @param prefix optional; prefix to use for the target fields. - */ - function forceCopy(src, dst, fields, prefix) { - var srcKey; - var dstKey; + return pos; + } - for (var i in fields) { - srcKey = fields[i]; - dstKey = prefixFieldName(prefix, srcKey); + /** + * Calculate the distance between a point (x3,y3) and a line segment from + * (x1,y1) to (x2,y2). + * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment + * @param {number} x1 from x + * @param {number} y1 from y + * @param {number} x2 to x + * @param {number} y2 to y + * @param {number} x3 point to check x + * @param {number} y3 point to check y + * @param {Node} via + * @returns {number} + * @private + */ - dst[dstKey] = src[srcKey]; + }, { + key: '_getDistanceToBezierEdge', + value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via) { + // x3,y3 is the point + var minDistance = 1e9; + var distance = void 0; + var i = void 0, + t = void 0, + x = void 0, + y = void 0; + var lastX = x1; + var lastY = y1; + for (i = 1; i < 10; i++) { + t = 0.1 * i; + x = Math.pow(1 - t, 2) * x1 + 2 * t * (1 - t) * via.x + Math.pow(t, 2) * x2; + y = Math.pow(1 - t, 2) * y1 + 2 * t * (1 - t) * via.y + Math.pow(t, 2) * y2; + if (i > 0) { + distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3); + minDistance = distance < minDistance ? distance : minDistance; + } + lastX = x; + lastY = y; + } + + return minDistance; } - } - /** - * Copy fields from src to dst in a safe and controlled manner. - * - * Only the fields mentioned in array 'fields' will be copied over, - * and only if these are actually defined. - * - * @param fields array with names of fields to copy - * @param prefix optional; prefix to use for the target fields. - */ - function safeCopy(src, dst, fields, prefix) { - var srcKey; - var dstKey; + /** + * Draw a bezier curve between two nodes + * + * The method accepts zero, one or two control points. + * Passing zero control points just draws a straight line + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} values | options for shadow drawing + * @param {Object|undefined} viaNode1 | first control point for curve drawing + * @param {Object|undefined} viaNode2 | second control point for curve drawing + * + * @protected + */ - for (var i in fields) { - srcKey = fields[i]; - if (src[srcKey] === undefined) continue; + }, { + key: '_bezierCurve', + value: function _bezierCurve(ctx, values, viaNode1, viaNode2) { + var hasNode1 = viaNode1 !== undefined && viaNode1.x !== undefined; + var hasNode2 = viaNode2 !== undefined && viaNode2.x !== undefined; - dstKey = prefixFieldName(prefix, srcKey); + ctx.beginPath(); + ctx.moveTo(this.fromPoint.x, this.fromPoint.y); - dst[dstKey] = src[srcKey]; - } - } + if (hasNode1 && hasNode2) { + ctx.bezierCurveTo(viaNode1.x, viaNode1.y, viaNode2.x, viaNode2.y, this.toPoint.x, this.toPoint.y); + } else if (hasNode1) { + ctx.quadraticCurveTo(viaNode1.x, viaNode1.y, this.toPoint.x, this.toPoint.y); + } else { + // fallback to normal straight edge + ctx.lineTo(this.toPoint.x, this.toPoint.y); + } - /** - * Initialize dst with the values in src. - * - * src is the hash with the default values. - * A reference DEFAULTS to this hash is stored locally for - * further handling. - * - * For now, dst is assumed to be a Graph3d instance. - */ - function setDefaults(src, dst) { - if (src === undefined || isEmpty(src)) { - throw new Error('No DEFAULTS passed'); + // draw shadow if enabled + this.enableShadow(ctx, values); + ctx.stroke(); + this.disableShadow(ctx, values); } - if (dst === undefined) { - throw new Error('No dst passed'); + + /** + * + * @returns {*|{x, y}|{x: undefined, y: undefined}} + */ + + }, { + key: 'getViaNode', + value: function getViaNode() { + return this._getViaCoordinates(); } + }]); + return BezierEdgeBase; +}(_EdgeBase3['default']); - // Remember defaults for future reference - DEFAULTS = src; +exports['default'] = BezierEdgeBase; - // Handle the defaults which can be simply copied over - forceCopy(src, dst, OPTIONKEYS); - forceCopy(src, dst, PREFIXEDOPTIONKEYS, 'default'); +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { - // Handle the more complex ('special') fields - setSpecialSettings(src, dst); +"use strict"; - // Following are internal fields, not part of the user settings - dst.margin = 10; // px - dst.showGrayBottom = false; // TODO: this does not work correctly - dst.showTooltip = false; - dst.onclick_callback = null; - dst.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window? - } - function setOptions(options, dst) { - if (options === undefined) { - return; - } - if (dst === undefined) { - throw new Error('No dst passed'); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - if (DEFAULTS === undefined || isEmpty(DEFAULTS)) { - throw new Error('DEFAULTS not set for module Settings'); - } +var _classCallCheck2 = __webpack_require__(0); - // Handle the parameters which can be simply copied over - safeCopy(options, dst, OPTIONKEYS); - safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default'); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // Handle the more complex ('special') fields - setSpecialSettings(options, dst); - } +var _createClass2 = __webpack_require__(1); - /** - * Special handling for certain parameters - * - * 'Special' here means: setting requires more than a simple copy - */ - function setSpecialSettings(src, dst) { - if (src.backgroundColor !== undefined) { - setBackgroundColor(src.backgroundColor, dst); - } +var _createClass3 = _interopRequireDefault(_createClass2); - setDataColor(src.dataColor, dst); - setStyle(src.style, dst); - setShowLegend(src.showLegend, dst); - setCameraPosition(src.cameraPosition, dst); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - // As special fields go, this is an easy one; just a translation of the name. - // Can't use this.tooltip directly, because that field exists internally - if (src.tooltip !== undefined) { - dst.showTooltip = src.tooltip; - } - if (src.onclick != undefined) { - dst.onclick_callback = src.onclick; - } +var util = __webpack_require__(2); - if (src.tooltipStyle !== undefined) { - util.selectiveDeepExtend(['tooltipStyle'], dst, src); - } +/** + * Utility Class + */ + +var NetworkUtil = function () { + /** + * @ignore + */ + function NetworkUtil() { + (0, _classCallCheck3["default"])(this, NetworkUtil); } /** - * Set the value of setting 'showLegend' + * Find the center position of the network considering the bounding boxes * - * This depends on the value of the style fields, so it must be called - * after the style field has been initialized. + * @param {Array.} allNodes + * @param {Array.} [specificNodes=[]] + * @returns {{minX: number, maxX: number, minY: number, maxY: number}} + * @static */ - function setShowLegend(showLegend, dst) { - if (showLegend === undefined) { - // If the default was auto, make a choice for this field - var isAutoByDefault = DEFAULTS.showLegend === undefined; - if (isAutoByDefault) { - // these styles default to having legends - var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE; - dst.showLegend = isLegendGraphStyle; - } else { - // Leave current value as is - } - } else { - dst.showLegend = showLegend; - } - } + (0, _createClass3["default"])(NetworkUtil, null, [{ + key: "getRange", + value: function getRange(allNodes) { + var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - /** - * Retrieve the style index from given styleName - * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line' - * @return {Number} styleNumber Enumeration value representing the style, or -1 - * when not found - */ - function getStyleNumberByName(styleName) { - var number = STYLENAME[styleName]; + var minY = 1e9, + maxY = -1e9, + minX = 1e9, + maxX = -1e9, + node; + if (specificNodes.length > 0) { + for (var i = 0; i < specificNodes.length; i++) { + node = allNodes[specificNodes[i]]; + if (minX > node.shape.boundingBox.left) { + minX = node.shape.boundingBox.left; + } + if (maxX < node.shape.boundingBox.right) { + maxX = node.shape.boundingBox.right; + } + if (minY > node.shape.boundingBox.top) { + minY = node.shape.boundingBox.top; + } // top is negative, bottom is positive + if (maxY < node.shape.boundingBox.bottom) { + maxY = node.shape.boundingBox.bottom; + } // top is negative, bottom is positive + } + } - if (number === undefined) { - return -1; + if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) { + minY = 0, maxY = 0, minX = 0, maxX = 0; + } + return { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; } - return number; - } + /** + * Find the center position of the network + * + * @param {Array.} allNodes + * @param {Array.} [specificNodes=[]] + * @returns {{minX: number, maxX: number, minY: number, maxY: number}} + * @static + */ - /** - * Check if given number is a valid style number. - * - * @return true if valid, false otherwise - */ - function checkStyleNumber(style) { - var valid = false; + }, { + key: "getRangeCore", + value: function getRangeCore(allNodes) { + var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - for (var n in STYLE) { - if (STYLE[n] === style) { - valid = true; - break; + var minY = 1e9, + maxY = -1e9, + minX = 1e9, + maxX = -1e9, + node; + if (specificNodes.length > 0) { + for (var i = 0; i < specificNodes.length; i++) { + node = allNodes[specificNodes[i]]; + if (minX > node.x) { + minX = node.x; + } + if (maxX < node.x) { + maxX = node.x; + } + if (minY > node.y) { + minY = node.y; + } // top is negative, bottom is positive + if (maxY < node.y) { + maxY = node.y; + } // top is negative, bottom is positive + } + } + + if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) { + minY = 0, maxY = 0, minX = 0, maxX = 0; } + return { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; } - return valid; - } + /** + * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; + * @returns {{x: number, y: number}} + * @static + */ - function setStyle(style, dst) { - if (style === undefined) { - return; // Nothing to do + }, { + key: "findCenter", + value: function findCenter(range) { + return { x: 0.5 * (range.maxX + range.minX), + y: 0.5 * (range.maxY + range.minY) }; } - var styleNumber; - - if (typeof style === 'string') { - styleNumber = getStyleNumberByName(style); + /** + * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes. + * @param {vis.Item} item + * @param {'node'|undefined} type + * @returns {{}} + * @static + */ - if (styleNumber === -1) { - throw new Error('Style \'' + style + '\' is invalid'); - } - } else { - // Do a pedantic check on style number value - if (!checkStyleNumber(style)) { - throw new Error('Style \'' + style + '\' is invalid'); + }, { + key: "cloneOptions", + value: function cloneOptions(item, type) { + var clonedOptions = {}; + if (type === undefined || type === 'node') { + util.deepExtend(clonedOptions, item.options, true); + clonedOptions.x = item.x; + clonedOptions.y = item.y; + clonedOptions.amountOfConnections = item.edges.length; + } else { + util.deepExtend(clonedOptions, item.options, true); } - - styleNumber = style; + return clonedOptions; } + }]); + return NetworkUtil; +}(); - dst.style = styleNumber; - } +exports["default"] = NetworkUtil; - /** - * Set the background styling for the graph - * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor - */ - function setBackgroundColor(backgroundColor, dst) { - var fill = 'white'; - var stroke = 'gray'; - var strokeWidth = 1; - - if (typeof backgroundColor === 'string') { - fill = backgroundColor; - stroke = 'none'; - strokeWidth = 0; - } else if ((typeof backgroundColor === 'undefined' ? 'undefined' : (0, _typeof3['default'])(backgroundColor)) === 'object') { - if (backgroundColor.fill !== undefined) fill = backgroundColor.fill; - if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke; - if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth; - } else { - throw new Error('Unsupported type of backgroundColor'); - } +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { - dst.frame.style.backgroundColor = fill; - dst.frame.style.borderColor = stroke; - dst.frame.style.borderWidth = strokeWidth + 'px'; - dst.frame.style.borderStyle = 'solid'; - } +module.exports = { "default": __webpack_require__(124), __esModule: true }; - function setDataColor(dataColor, dst) { - if (dataColor === undefined) { - return; // Nothing to do - } +/***/ }), +/* 78 */ +/***/ (function(module, exports, __webpack_require__) { - if (dst.dataColor === undefined) { - dst.dataColor = {}; - } +// fallback for non-array-like ES3 and non-enumerable old V8 strings +var cof = __webpack_require__(50); +// eslint-disable-next-line no-prototype-builtins +module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { + return cof(it) == 'String' ? it.split('') : Object(it); +}; - if (typeof dataColor === 'string') { - dst.dataColor.fill = dataColor; - dst.dataColor.stroke = dataColor; - } else { - if (dataColor.fill) { - dst.dataColor.fill = dataColor.fill; - } - if (dataColor.stroke) { - dst.dataColor.stroke = dataColor.stroke; - } - if (dataColor.strokeWidth !== undefined) { - dst.dataColor.strokeWidth = dataColor.strokeWidth; - } - } + +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var LIBRARY = __webpack_require__(52); +var $export = __webpack_require__(17); +var redefine = __webpack_require__(83); +var hide = __webpack_require__(26); +var has = __webpack_require__(22); +var Iterators = __webpack_require__(31); +var $iterCreate = __webpack_require__(129); +var setToStringTag = __webpack_require__(59); +var getPrototypeOf = __webpack_require__(85); +var ITERATOR = __webpack_require__(13)('iterator'); +var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` +var FF_ITERATOR = '@@iterator'; +var KEYS = 'keys'; +var VALUES = 'values'; + +var returnThis = function () { return this; }; + +module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { + $iterCreate(Constructor, NAME, next); + var getMethod = function (kind) { + if (!BUGGY && kind in proto) return proto[kind]; + switch (kind) { + case KEYS: return function keys() { return new Constructor(this, kind); }; + case VALUES: return function values() { return new Constructor(this, kind); }; + } return function entries() { return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator'; + var DEF_VALUES = DEFAULT == VALUES; + var VALUES_BUG = false; + var proto = Base.prototype; + var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; + var $default = $native || getMethod(DEFAULT); + var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; + var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; + var methods, key, IteratorPrototype; + // Fix native + if ($anyNative) { + IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); + if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if (DEF_VALUES && $native && $native.name !== VALUES) { + VALUES_BUG = true; + $default = function values() { return $native.call(this); }; + } + // Define iterator + if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if (DEFAULT) { + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if (FORCED) for (key in methods) { + if (!(key in proto)) redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } + return methods; +}; - function setCameraPosition(cameraPosition, dst) { - var camPos = cameraPosition; - if (camPos === undefined) { - return; - } - if (dst.camera === undefined) { - dst.camera = new Camera(); - } +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { - dst.camera.setArmRotation(camPos.horizontal, camPos.vertical); - dst.camera.setArmLength(camPos.distance); +// optional / simple context binding +var aFunction = __webpack_require__(128); +module.exports = function (fn, that, length) { + aFunction(fn); + if (that === undefined) return fn; + switch (length) { + case 1: return function (a) { + return fn.call(that, a); + }; + case 2: return function (a, b) { + return fn.call(that, a, b); + }; + case 3: return function (a, b, c) { + return fn.call(that, a, b, c); + }; } + return function (/* ...args */) { + return fn.apply(that, arguments); + }; +}; - module.exports.STYLE = STYLE; - module.exports.setDefaults = setDefaults; - module.exports.setOptions = setOptions; - module.exports.setCameraPosition = setCameraPosition; /***/ }), -/* 112 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +module.exports = !__webpack_require__(21) && !__webpack_require__(28)(function () { + return Object.defineProperty(__webpack_require__(82)('div'), 'a', { get: function () { return 7; } }).a != 7; +}); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var Point3d = __webpack_require__(100); - var Range = __webpack_require__(110); - /** - * Creates a container for all data of one specific 3D-graph. - * - * On construction, the container is totally empty; the data - * needs to be initialized with method initializeData(). - * Failure to do so will result in the following exception begin thrown - * on instantiation of Graph3D: - * - * Error: Array, DataSet, or DataView expected - * - * @constructor - */ - function DataGroup() { - this.dataTable = null; // The original data table - } +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Initializes the instance from the passed data. - * - * Calculates minimum and maximum values and column index values. - * - * The graph3d instance is used internally to access the settings for - * the given instance. - * TODO: Pass settings only instead. - * - * @param {Graph3D} graph3d Reference to the calling Graph3D instance. - * @param {Array | DataSet | DataView} rawData The data containing the items for - * the Graph. - * @param {Number} style Style Number - */ - DataGroup.prototype.initializeData = function (graph3d, rawData, style) { - // unsubscribe from the dataTable - if (this.dataSet) { - this.dataSet.off('*', this._onChange); - } +var isObject = __webpack_require__(32); +var document = __webpack_require__(18).document; +// typeof document.createElement is 'object' in old IE +var is = isObject(document) && isObject(document.createElement); +module.exports = function (it) { + return is ? document.createElement(it) : {}; +}; - if (rawData === undefined) return; - if (Array.isArray(rawData)) { - rawData = new DataSet(rawData); - } +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { - var data; - if (rawData instanceof DataSet || rawData instanceof DataView) { - data = rawData.get(); - } else { - throw new Error('Array, DataSet, or DataView expected'); - } +module.exports = __webpack_require__(26); - if (data.length == 0) return; - this.dataSet = rawData; - this.dataTable = data; +/***/ }), +/* 84 */ +/***/ (function(module, exports, __webpack_require__) { - // subscribe to changes in the dataset - var me = this; - this._onChange = function () { - graph3d.setData(me.dataSet); - }; - this.dataSet.on('*', this._onChange); +var has = __webpack_require__(22); +var toIObject = __webpack_require__(25); +var arrayIndexOf = __webpack_require__(131)(false); +var IE_PROTO = __webpack_require__(56)('IE_PROTO'); - // determine the location of x,y,z,value,filter columns - this.colX = 'x'; - this.colY = 'y'; - this.colZ = 'z'; +module.exports = function (object, names) { + var O = toIObject(object); + var i = 0; + var result = []; + var key; + for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while (names.length > i) if (has(O, key = names[i++])) { + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; - var withBars = graph3d.hasBars(style); - // determine barWidth from data - if (withBars) { - if (graph3d.defaultXBarWidth !== undefined) { - this.xBarWidth = graph3d.defaultXBarWidth; - } else { - this.xBarWidth = this.getSmallestDifference(data, this.colX) || 1; - } +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { - if (graph3d.defaultYBarWidth !== undefined) { - this.yBarWidth = graph3d.defaultYBarWidth; - } else { - this.yBarWidth = this.getSmallestDifference(data, this.colY) || 1; - } - } +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) +var has = __webpack_require__(22); +var toObject = __webpack_require__(41); +var IE_PROTO = __webpack_require__(56)('IE_PROTO'); +var ObjectProto = Object.prototype; - // calculate minima and maxima - this._initializeRange(data, this.colX, graph3d, withBars); - this._initializeRange(data, this.colY, graph3d, withBars); - this._initializeRange(data, this.colZ, graph3d, false); +module.exports = Object.getPrototypeOf || function (O) { + O = toObject(O); + if (has(O, IE_PROTO)) return O[IE_PROTO]; + if (typeof O.constructor == 'function' && O instanceof O.constructor) { + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; +}; - if (data[0].hasOwnProperty('style')) { - this.colValue = 'style'; - var valueRange = this.getColumnRange(data, this.colValue); - this._setRangeDefaults(valueRange, graph3d.defaultValueMin, graph3d.defaultValueMax); - this.valueRange = valueRange; - } - }; - /** - * Collect the range settings for the given data column. - * - * This internal method is intended to make the range - * initalization more generic. - * - * TODO: if/when combined settings per axis defined, get rid of this. - * - * @private - * - * @param {'x'|'y'|'z'} column The data column to process - * @param {Graph3D} graph3d Reference to the calling Graph3D instance; - * required for access to settings - */ - DataGroup.prototype._collectRangeSettings = function (column, graph3d) { - var index = ['x', 'y', 'z'].indexOf(column); +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { - if (index == -1) { - throw new Error('Column \'' + column + '\' invalid'); - } +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = __webpack_require__(50); +var TAG = __webpack_require__(13)('toStringTag'); +// ES3 wrong here +var ARG = cof(function () { return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error +var tryGet = function (it, key) { + try { + return it[key]; + } catch (e) { /* empty */ } +}; + +module.exports = function (it) { + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; - var upper = column.toUpperCase(); - return { - barWidth: this[column + 'BarWidth'], - min: graph3d['default' + upper + 'Min'], - max: graph3d['default' + upper + 'Max'], - step: graph3d['default' + upper + 'Step'], - range_label: column + 'Range', // Name of instance field to write to - step_label: column + 'Step' // Name of instance field to write to - }; - }; +/***/ }), +/* 87 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Initializes the settings per given column. - * - * TODO: if/when combined settings per axis defined, rewrite this. - * - * @private - * - * @param {DataSet | DataView} data The data containing the items for the Graph - * @param {'x'|'y'|'z'} column The data column to process - * @param {Graph3D} graph3d Reference to the calling Graph3D instance; - * required for access to settings - * @param {Boolean} withBars True if initializing for bar graph - */ - DataGroup.prototype._initializeRange = function (data, column, graph3d, withBars) { - var NUMSTEPS = 5; - var settings = this._collectRangeSettings(column, graph3d); +// most Object methods by ES6 should accept primitives +var $export = __webpack_require__(17); +var core = __webpack_require__(7); +var fails = __webpack_require__(28); +module.exports = function (KEY, exec) { + var fn = (core.Object || {})[KEY] || Object[KEY]; + var exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); +}; - var range = this.getColumnRange(data, column); - if (withBars && column != 'z') { - // Safeguard for 'z'; it doesn't have a bar width - range.expand(settings.barWidth / 2); - } - this._setRangeDefaults(range, settings.min, settings.max); - this[settings.range_label] = range; - this[settings.step_label] = settings.step !== undefined ? settings.step : range.range() / NUMSTEPS; - }; +/***/ }), +/* 88 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Creates a list with all the different values in the data for the given column. - * - * If no data passed, use the internal data of this instance. - * - * @param {'x'|'y'|'z'} column The data column to process - * @param {DataSet|DataView|undefined} data The data containing the items for the Graph - * - * @returns {Array} All distinct values in the given column data, sorted ascending. - */ - DataGroup.prototype.getDistinctValues = function (column, data) { - if (data === undefined) { - data = this.dataTable; - } +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = __webpack_require__(84); +var hiddenKeys = __webpack_require__(58).concat('length', 'prototype'); - var values = []; +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return $keys(O, hiddenKeys); +}; - for (var i = 0; i < data.length; i++) { - var value = data[i][column] || 0; - if (values.indexOf(value) === -1) { - values.push(value); - } - } - return values.sort(function (a, b) { - return a - b; - }); - }; +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Determine the smallest difference between the values for given - * column in the passed data set. - * - * @param {DataSet|DataView|undefined} data The data containing the items for the Graph - * @param {'x'|'y'|'z'} column The data column to process - * - * @returns {Number|null} Smallest difference value or - * null, if it can't be determined. - */ - DataGroup.prototype.getSmallestDifference = function (data, column) { - var values = this.getDistinctValues(data, column); +var pIE = __webpack_require__(42); +var createDesc = __webpack_require__(39); +var toIObject = __webpack_require__(25); +var toPrimitive = __webpack_require__(53); +var has = __webpack_require__(22); +var IE8_DOM_DEFINE = __webpack_require__(81); +var gOPD = Object.getOwnPropertyDescriptor; - // Get all the distinct diffs - // Array values is assumed to be sorted here - var smallest_diff = null; +exports.f = __webpack_require__(21) ? gOPD : function getOwnPropertyDescriptor(O, P) { + O = toIObject(O); + P = toPrimitive(P, true); + if (IE8_DOM_DEFINE) try { + return gOPD(O, P); + } catch (e) { /* empty */ } + if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); +}; - for (var i = 1; i < values.length; i++) { - var diff = values[i] - values[i - 1]; - if (smallest_diff == null || smallest_diff > diff) { - smallest_diff = diff; - } - } +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { - return smallest_diff; - }; +module.exports = { "default": __webpack_require__(162), __esModule: true }; - /** - * Get the absolute min/max values for the passed data column. - * - * @param {DataSet|DataView|undefined} data The data containing the items for the Graph - * @param {'x'|'y'|'z'} column The data column to process - * - * @returns {Range} A Range instance with min/max members properly set. - */ - DataGroup.prototype.getColumnRange = function (data, column) { - var range = new Range(); +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { - // Adjust the range so that it covers all values in the passed data elements. - for (var i = 0; i < data.length; i++) { - var item = data[i][column]; - range.adjust(item); - } +"use strict"; - return range; - }; - /** - * Determines the number of rows in the current data. - * - * @returns {Number} - */ - DataGroup.prototype.getNumberOfRows = function () { - return this.dataTable.length; - }; +/** + * @prototype Point2d + * @param {number} [x] + * @param {number} [y] + */ +function Point2d(x, y) { + this.x = x !== undefined ? x : 0; + this.y = y !== undefined ? y : 0; +} - /** - * Set default values for range - * - * The default values override the range values, if defined. - * - * Because it's possible that only defaultMin or defaultMax is set, it's better - * to pass in a range already set with the min/max set from the data. Otherwise, - * it's quite hard to process the min/max properly. - */ - DataGroup.prototype._setRangeDefaults = function (range, defaultMin, defaultMax) { - if (defaultMin !== undefined) { - range.min = defaultMin; - } +module.exports = Point2d; - if (defaultMax !== undefined) { - range.max = defaultMax; - } +/***/ }), +/* 92 */ +/***/ (function(module, exports, __webpack_require__) { - // This is the original way that the default min/max values were adjusted. - // TODO: Perhaps it's better if an error is thrown if the values do not agree. - // But this will change the behaviour. - if (range.max <= range.min) range.max = range.min + 1; - }; +"use strict"; - DataGroup.prototype.getDataTable = function () { - return this.dataTable; - }; - DataGroup.prototype.getDataSet = function () { - return this.dataSet; - }; +var util = __webpack_require__(2); - /** - * Reload the data - */ - DataGroup.prototype.reload = function () { - if (this.dataTable) { - this.setData(this.dataTable); - } - }; +/** + * An html slider control with start/stop/prev/next buttons + * + * @constructor Slider + * @param {Element} container The element where the slider will be created + * @param {Object} options Available options: + * {boolean} visible If true (default) the + * slider is visible. + */ +function Slider(container, options) { + if (container === undefined) { + throw new Error('No container element defined'); + } + this.container = container; + this.visible = options && options.visible != undefined ? options.visible : true; + + if (this.visible) { + this.frame = document.createElement('DIV'); + //this.frame.style.backgroundColor = '#E5E5E5'; + this.frame.style.width = '100%'; + this.frame.style.position = 'relative'; + this.container.appendChild(this.frame); + + this.frame.prev = document.createElement('INPUT'); + this.frame.prev.type = 'BUTTON'; + this.frame.prev.value = 'Prev'; + this.frame.appendChild(this.frame.prev); + + this.frame.play = document.createElement('INPUT'); + this.frame.play.type = 'BUTTON'; + this.frame.play.value = 'Play'; + this.frame.appendChild(this.frame.play); + + this.frame.next = document.createElement('INPUT'); + this.frame.next.type = 'BUTTON'; + this.frame.next.value = 'Next'; + this.frame.appendChild(this.frame.next); + + this.frame.bar = document.createElement('INPUT'); + this.frame.bar.type = 'BUTTON'; + this.frame.bar.style.position = 'absolute'; + this.frame.bar.style.border = '1px solid red'; + this.frame.bar.style.width = '100px'; + this.frame.bar.style.height = '6px'; + this.frame.bar.style.borderRadius = '2px'; + this.frame.bar.style.MozBorderRadius = '2px'; + this.frame.bar.style.border = '1px solid #7F7F7F'; + this.frame.bar.style.backgroundColor = '#E5E5E5'; + this.frame.appendChild(this.frame.bar); + + this.frame.slide = document.createElement('INPUT'); + this.frame.slide.type = 'BUTTON'; + this.frame.slide.style.margin = '0px'; + this.frame.slide.value = ' '; + this.frame.slide.style.position = 'relative'; + this.frame.slide.style.left = '-100px'; + this.frame.appendChild(this.frame.slide); + + // create events + var me = this; + this.frame.slide.onmousedown = function (event) { + me._onMouseDown(event); + }; + this.frame.prev.onclick = function (event) { + me.prev(event); + }; + this.frame.play.onclick = function (event) { + me.togglePlay(event); + }; + this.frame.next.onclick = function (event) { + me.next(event); + }; + } - module.exports = DataGroup; + this.onChangeCallback = undefined; -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { + this.values = []; + this.index = undefined; - 'use strict'; + this.playTimeout = undefined; + this.playInterval = 1000; // milliseconds + this.playLoop = true; +} - // Only load hammer.js when in a browser environment - // (loading hammer.js in a node.js environment gives errors) - if (typeof window !== 'undefined') { - var propagating = __webpack_require__(114); - var Hammer = window['Hammer'] || __webpack_require__(115); - module.exports = propagating(Hammer, { - preventDefault: 'mouse' - }); - } else { - module.exports = function () { - throw Error('hammer.js is only available in a browser, not in node.js.'); - }; +/** + * Select the previous index + */ +Slider.prototype.prev = function () { + var index = this.getIndex(); + if (index > 0) { + index--; + this.setIndex(index); } +}; -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict'; - - (function (factory) { - if (true) { - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(); - } else { - // Browser globals (root is window) - window.propagating = factory(); - } - }(function () { - var _firstTarget = null; // singleton, will contain the target element where the touch event started +/** + * Select the next index + */ +Slider.prototype.next = function () { + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } +}; - /** - * Extend an Hammer.js instance with event propagation. - * - * Features: - * - Events emitted by hammer will propagate in order from child to parent - * elements. - * - Events are extended with a function `event.stopPropagation()` to stop - * propagation to parent elements. - * - An option `preventDefault` to stop all default browser behavior. - * - * Usage: - * var hammer = propagatingHammer(new Hammer(element)); - * var hammer = propagatingHammer(new Hammer(element), {preventDefault: true}); - * - * @param {Hammer.Manager} hammer An hammer instance. - * @param {Object} [options] Available options: - * - `preventDefault: true | false | 'mouse' | 'touch' | 'pen'`. - * Enforce preventing the default browser behavior. - * Cannot be set to `false`. - * @return {Hammer.Manager} Returns the same hammer instance with extended - * functionality - */ - return function propagating(hammer, options) { - var _options = options || { - preventDefault: false - }; +/** + * Select the next index + */ +Slider.prototype.playNext = function () { + var start = new Date(); - if (hammer.Manager) { - // This looks like the Hammer constructor. - // Overload the constructors with our own. - var Hammer = hammer; + var index = this.getIndex(); + if (index < this.values.length - 1) { + index++; + this.setIndex(index); + } else if (this.playLoop) { + // jump to the start + index = 0; + this.setIndex(index); + } - var PropagatingHammer = function(element, options) { - var o = Object.create(_options); - if (options) Hammer.assign(o, options); - return propagating(new Hammer(element, o), o); - }; - Hammer.assign(PropagatingHammer, Hammer); + var end = new Date(); + var diff = end - start; - PropagatingHammer.Manager = function (element, options) { - var o = Object.create(_options); - if (options) Hammer.assign(o, options); - return propagating(new Hammer.Manager(element, o), o); - }; + // calculate how much time it to to set the index and to execute the callback + // function. + var interval = Math.max(this.playInterval - diff, 0); + // document.title = diff // TODO: cleanup - return PropagatingHammer; - } + var me = this; + this.playTimeout = setTimeout(function () { + me.playNext(); + }, interval); +}; - // create a wrapper object which will override the functions - // `on`, `off`, `destroy`, and `emit` of the hammer instance - var wrapper = Object.create(hammer); +/** + * Toggle start or stop playing + */ +Slider.prototype.togglePlay = function () { + if (this.playTimeout === undefined) { + this.play(); + } else { + this.stop(); + } +}; - // attach to DOM element - var element = hammer.element; +/** + * Start playing + */ +Slider.prototype.play = function () { + // Test whether already playing + if (this.playTimeout) return; - if(!element.hammer) element.hammer = []; - element.hammer.push(wrapper); + this.playNext(); - // register an event to catch the start of a gesture and store the - // target in a singleton - hammer.on('hammer.input', function (event) { - if (_options.preventDefault === true || (_options.preventDefault === event.pointerType)) { - event.preventDefault(); - } - if (event.isFirst) { - _firstTarget = event.target; - } - }); + if (this.frame) { + this.frame.play.value = 'Stop'; + } +}; - /** @type {Object.>} */ - wrapper._handlers = {}; +/** + * Stop playing + */ +Slider.prototype.stop = function () { + clearInterval(this.playTimeout); + this.playTimeout = undefined; - /** - * Register a handler for one or multiple events - * @param {String} events A space separated string with events - * @param {function} handler A callback function, called as handler(event) - * @returns {Hammer.Manager} Returns the hammer instance - */ - wrapper.on = function (events, handler) { - // register the handler - split(events).forEach(function (event) { - var _handlers = wrapper._handlers[event]; - if (!_handlers) { - wrapper._handlers[event] = _handlers = []; + if (this.frame) { + this.frame.play.value = 'Play'; + } +}; - // register the static, propagated handler - hammer.on(event, propagatedHandler); - } - _handlers.push(handler); - }); +/** + * Set a callback function which will be triggered when the value of the + * slider bar has changed. + * + * @param {function} callback + */ +Slider.prototype.setOnChangeCallback = function (callback) { + this.onChangeCallback = callback; +}; - return wrapper; - }; +/** + * Set the interval for playing the list + * @param {number} interval The interval in milliseconds + */ +Slider.prototype.setPlayInterval = function (interval) { + this.playInterval = interval; +}; - /** - * Unregister a handler for one or multiple events - * @param {String} events A space separated string with events - * @param {function} [handler] Optional. The registered handler. If not - * provided, all handlers for given events - * are removed. - * @returns {Hammer.Manager} Returns the hammer instance - */ - wrapper.off = function (events, handler) { - // unregister the handler - split(events).forEach(function (event) { - var _handlers = wrapper._handlers[event]; - if (_handlers) { - _handlers = handler ? _handlers.filter(function (h) { - return h !== handler; - }) : []; - - if (_handlers.length > 0) { - wrapper._handlers[event] = _handlers; - } - else { - // remove static, propagated handler - hammer.off(event, propagatedHandler); - delete wrapper._handlers[event]; - } - } - }); +/** + * Retrieve the current play interval + * @return {number} interval The interval in milliseconds + */ +Slider.prototype.getPlayInterval = function () { + return this.playInterval; +}; - return wrapper; - }; +/** + * Set looping on or off + * @param {boolean} doLoop If true, the slider will jump to the start when + * the end is passed, and will jump to the end + * when the start is passed. + * + */ +Slider.prototype.setPlayLoop = function (doLoop) { + this.playLoop = doLoop; +}; - /** - * Emit to the event listeners - * @param {string} eventType - * @param {Event} event - */ - wrapper.emit = function(eventType, event) { - _firstTarget = event.target; - hammer.emit(eventType, event); - }; +/** + * Execute the onchange callback function + */ +Slider.prototype.onChange = function () { + if (this.onChangeCallback !== undefined) { + this.onChangeCallback(); + } +}; - wrapper.destroy = function () { - // Detach from DOM element - var hammers = hammer.element.hammer; - var idx = hammers.indexOf(wrapper); - if(idx !== -1) hammers.splice(idx,1); - if(!hammers.length) delete hammer.element.hammer; +/** + * redraw the slider on the correct place + */ +Slider.prototype.redraw = function () { + if (this.frame) { + // resize the bar + this.frame.bar.style.top = this.frame.clientHeight / 2 - this.frame.bar.offsetHeight / 2 + 'px'; + this.frame.bar.style.width = this.frame.clientWidth - this.frame.prev.clientWidth - this.frame.play.clientWidth - this.frame.next.clientWidth - 30 + 'px'; - // clear all handlers - wrapper._handlers = {}; + // position the slider button + var left = this.indexToLeft(this.index); + this.frame.slide.style.left = left + 'px'; + } +}; - // call original hammer destroy - hammer.destroy(); - }; +/** + * Set the list with values for the slider + * @param {Array} values A javascript array with values (any type) + */ +Slider.prototype.setValues = function (values) { + this.values = values; - // split a string with space separated words - function split(events) { - return events.match(/[^ ]+/g); - } + if (this.values.length > 0) this.setIndex(0);else this.index = undefined; +}; - /** - * A static event handler, applying event propagation. - * @param {Object} event - */ - function propagatedHandler(event) { - // let only a single hammer instance handle this event - if (event.type !== 'hammer.input') { - // it is possible that the same srcEvent is used with multiple hammer events, - // we keep track on which events are handled in an object _handled - if (!event.srcEvent._handled) { - event.srcEvent._handled = {}; - } +/** + * Select a value by its index + * @param {number} index + */ +Slider.prototype.setIndex = function (index) { + if (index < this.values.length) { + this.index = index; - if (event.srcEvent._handled[event.type]) { - return; - } - else { - event.srcEvent._handled[event.type] = true; - } - } + this.redraw(); + this.onChange(); + } else { + throw new Error('Index out of range'); + } +}; - // attach a stopPropagation function to the event - var stopped = false; - event.stopPropagation = function () { - stopped = true; - }; +/** + * retrieve the index of the currently selected vaue + * @return {number} index + */ +Slider.prototype.getIndex = function () { + return this.index; +}; - //wrap the srcEvent's stopPropagation to also stop hammer propagation: - var srcStop = event.srcEvent.stopPropagation.bind(event.srcEvent); - if(typeof srcStop == "function") { - event.srcEvent.stopPropagation = function(){ - srcStop(); - event.stopPropagation(); - } - } +/** + * retrieve the currently selected value + * @return {*} value + */ +Slider.prototype.get = function () { + return this.values[this.index]; +}; - // attach firstTarget property to the event - event.firstTarget = _firstTarget; +Slider.prototype._onMouseDown = function (event) { + // only react on left mouse button down + var leftButtonDown = event.which ? event.which === 1 : event.button === 1; + if (!leftButtonDown) return; - // propagate over all elements (until stopped) - var elem = _firstTarget; - while (elem && !stopped) { - var elemHammer = elem.hammer; - if(elemHammer){ - var _handlers; - for(var k = 0; k < elemHammer.length; k++){ - _handlers = elemHammer[k]._handlers[event.type]; - if(_handlers) for (var i = 0; i < _handlers.length && !stopped; i++) { - _handlers[i](event); - } - } - } - elem = elem.parentNode; - } - } + this.startClientX = event.clientX; + this.startSlideX = parseFloat(this.frame.slide.style.left); - return wrapper; - }; - })); + this.frame.style.cursor = 'move'; + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) { + me._onMouseMove(event); + }; + this.onmouseup = function (event) { + me._onMouseUp(event); + }; + util.addEventListener(document, 'mousemove', this.onmousemove); + util.addEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); +}; -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { +Slider.prototype.leftToIndex = function (left) { + var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10; + var x = left - 3; - var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.7 - 2016-04-22 - * http://hammerjs.github.io/ - * - * Copyright (c) 2016 Jorik Tangelder; - * Licensed under the MIT license */ - (function(window, document, exportName, undefined) { - 'use strict'; + var index = Math.round(x / width * (this.values.length - 1)); + if (index < 0) index = 0; + if (index > this.values.length - 1) index = this.values.length - 1; - var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; - var TEST_ELEMENT = document.createElement('div'); + return index; +}; - var TYPE_FUNCTION = 'function'; +Slider.prototype.indexToLeft = function (index) { + var width = parseFloat(this.frame.bar.style.width) - this.frame.slide.clientWidth - 10; - var round = Math.round; - var abs = Math.abs; - var now = Date.now; + var x = index / (this.values.length - 1) * width; + var left = x + 3; - /** - * set a timeout with a given scope - * @param {Function} fn - * @param {Number} timeout - * @param {Object} context - * @returns {number} - */ - function setTimeoutContext(fn, timeout, context) { - return setTimeout(bindFn(fn, context), timeout); - } + return left; +}; - /** - * if the argument is an array, we want to execute the fn on each entry - * if it aint an array we don't want to do a thing. - * this is used by all the methods that accept a single and array argument. - * @param {*|Array} arg - * @param {String} fn - * @param {Object} [context] - * @returns {Boolean} - */ - function invokeArrayArg(arg, fn, context) { - if (Array.isArray(arg)) { - each(arg, context[fn], context); - return true; - } - return false; - } +Slider.prototype._onMouseMove = function (event) { + var diff = event.clientX - this.startClientX; + var x = this.startSlideX + diff; - /** - * walk objects and arrays - * @param {Object} obj - * @param {Function} iterator - * @param {Object} context - */ - function each(obj, iterator, context) { - var i; + var index = this.leftToIndex(x); - if (!obj) { - return; - } + this.setIndex(index); - if (obj.forEach) { - obj.forEach(iterator, context); - } else if (obj.length !== undefined) { - i = 0; - while (i < obj.length) { - iterator.call(context, obj[i], i, obj); - i++; - } - } else { - for (i in obj) { - obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); - } - } - } + util.preventDefault(); +}; - /** - * wrap a method with a deprecation warning and stack trace - * @param {Function} method - * @param {String} name - * @param {String} message - * @returns {Function} A new function wrapping the supplied method. - */ - function deprecate(method, name, message) { - var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n'; - return function() { - var e = new Error('get-stack-trace'); - var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '') - .replace(/^\s+at\s+/gm, '') - .replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; - - var log = window.console && (window.console.warn || window.console.log); - if (log) { - log.call(window.console, deprecationMessage, stack); - } - return method.apply(this, arguments); - }; - } +Slider.prototype._onMouseUp = function (event) { + // eslint-disable-line no-unused-vars + this.frame.style.cursor = 'auto'; - /** - * extend object. - * means that properties in dest will be overwritten by the ones in src. - * @param {Object} target - * @param {...Object} objects_to_assign - * @returns {Object} target - */ - var assign; - if (typeof Object.assign !== 'function') { - assign = function assign(target) { - if (target === undefined || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== undefined && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - }; - } else { - assign = Object.assign; - } + // remove event listeners + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); - /** - * extend object. - * means that properties in dest will be overwritten by the ones in src. - * @param {Object} dest - * @param {Object} src - * @param {Boolean} [merge=false] - * @returns {Object} dest - */ - var extend = deprecate(function extend(dest, src, merge) { - var keys = Object.keys(src); - var i = 0; - while (i < keys.length) { - if (!merge || (merge && dest[keys[i]] === undefined)) { - dest[keys[i]] = src[keys[i]]; - } - i++; - } - return dest; - }, 'extend', 'Use `assign`.'); + util.preventDefault(); +}; - /** - * merge the values from src in the dest. - * means that properties that exist in dest will not be overwritten by src - * @param {Object} dest - * @param {Object} src - * @returns {Object} dest - */ - var merge = deprecate(function merge(dest, src) { - return extend(dest, src, true); - }, 'merge', 'Use `assign`.'); +module.exports = Slider; - /** - * simple class inheritance - * @param {Function} child - * @param {Function} base - * @param {Object} [properties] - */ - function inherit(child, base, properties) { - var baseP = base.prototype, - childP; +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { - childP = child.prototype = Object.create(baseP); - childP.constructor = child; - childP._super = baseP; +"use strict"; - if (properties) { - assign(childP, properties); - } - } - /** - * simple function bind - * @param {Function} fn - * @param {Object} context - * @returns {Function} - */ - function bindFn(fn, context) { - return function boundFn() { - return fn.apply(context, arguments); - }; - } +/** + * @prototype StepNumber + * The class StepNumber is an iterator for Numbers. You provide a start and end + * value, and a best step size. StepNumber itself rounds to fixed values and + * a finds the step that best fits the provided step. + * + * If prettyStep is true, the step size is chosen as close as possible to the + * provided step, but being a round value like 1, 2, 5, 10, 20, 50, .... + * + * Example usage: + * var step = new StepNumber(0, 10, 2.5, true); + * step.start(); + * while (!step.end()) { + * alert(step.getCurrent()); + * step.next(); + * } + * + * Version: 1.0 + * + * @param {number} start The start value + * @param {number} end The end value + * @param {number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ +function StepNumber(start, end, step, prettyStep) { + // set default values + this._start = 0; + this._end = 0; + this._step = 1; + this.prettyStep = true; + this.precision = 5; + + this._current = 0; + this.setRange(start, end, step, prettyStep); +} - /** - * let a boolean value also be a function that must return a boolean - * this first item in args will be used as the context - * @param {Boolean|Function} val - * @param {Array} [args] - * @returns {Boolean} - */ - function boolOrFn(val, args) { - if (typeof val == TYPE_FUNCTION) { - return val.apply(args ? args[0] || undefined : undefined, args); - } - return val; - } +/** + * Check for input values, to prevent disasters from happening + * + * Source: http://stackoverflow.com/a/1830844 + * + * @param {string} n + * @returns {boolean} + */ +StepNumber.prototype.isNumeric = function (n) { + return !isNaN(parseFloat(n)) && isFinite(n); +}; - /** - * use the val2 when val1 is undefined - * @param {*} val1 - * @param {*} val2 - * @returns {*} - */ - function ifUndefined(val1, val2) { - return (val1 === undefined) ? val2 : val1; +/** + * Set a new range: start, end and step. + * + * @param {number} start The start value + * @param {number} end The end value + * @param {number} step Optional. Step size. Must be a positive value. + * @param {boolean} prettyStep Optional. If true, the step size is rounded + * To a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ +StepNumber.prototype.setRange = function (start, end, step, prettyStep) { + if (!this.isNumeric(start)) { + throw new Error('Parameter \'start\' is not numeric; value: ' + start); } - - /** - * addEventListener with multiple events at once - * @param {EventTarget} target - * @param {String} types - * @param {Function} handler - */ - function addEventListeners(target, types, handler) { - each(splitStr(types), function(type) { - target.addEventListener(type, handler, false); - }); + if (!this.isNumeric(end)) { + throw new Error('Parameter \'end\' is not numeric; value: ' + start); } - - /** - * removeEventListener with multiple events at once - * @param {EventTarget} target - * @param {String} types - * @param {Function} handler - */ - function removeEventListeners(target, types, handler) { - each(splitStr(types), function(type) { - target.removeEventListener(type, handler, false); - }); + if (!this.isNumeric(step)) { + throw new Error('Parameter \'step\' is not numeric; value: ' + start); } - /** - * find if a node is in the given parent - * @method hasParent - * @param {HTMLElement} node - * @param {HTMLElement} parent - * @return {Boolean} found - */ - function hasParent(node, parent) { - while (node) { - if (node == parent) { - return true; - } - node = node.parentNode; - } - return false; - } + this._start = start ? start : 0; + this._end = end ? end : 0; - /** - * small indexOf wrapper - * @param {String} str - * @param {String} find - * @returns {Boolean} found - */ - function inStr(str, find) { - return str.indexOf(find) > -1; - } + this.setStep(step, prettyStep); +}; - /** - * split string on whitespace - * @param {String} str - * @returns {Array} words - */ - function splitStr(str) { - return str.trim().split(/\s+/g); - } +/** + * Set a new step size + * @param {number} step New step size. Must be a positive value + * @param {boolean} prettyStep Optional. If true, the provided step is rounded + * to a pretty step size (like 1, 2, 5, 10, 20, 50, ...) + */ +StepNumber.prototype.setStep = function (step, prettyStep) { + if (step === undefined || step <= 0) return; - /** - * find if a array contains the object using indexOf or a simple polyFill - * @param {Array} src - * @param {String} find - * @param {String} [findByKey] - * @return {Boolean|Number} false when not found, or the index - */ - function inArray(src, find, findByKey) { - if (src.indexOf && !findByKey) { - return src.indexOf(find); - } else { - var i = 0; - while (i < src.length) { - if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { - return i; - } - i++; - } - return -1; - } - } + if (prettyStep !== undefined) this.prettyStep = prettyStep; - /** - * convert array-like objects to real arrays - * @param {Object} obj - * @returns {Array} - */ - function toArray(obj) { - return Array.prototype.slice.call(obj, 0); - } + if (this.prettyStep === true) this._step = StepNumber.calculatePrettyStep(step);else this._step = step; +}; - /** - * unique array with objects based on a key (like 'id') or just by the array's value - * @param {Array} src [{id:1},{id:2},{id:1}] - * @param {String} [key] - * @param {Boolean} [sort=False] - * @returns {Array} [{id:1},{id:2}] - */ - function uniqueArray(src, key, sort) { - var results = []; - var values = []; - var i = 0; +/** + * Calculate a nice step size, closest to the desired step size. + * Returns a value in one of the ranges 1*10^n, 2*10^n, or 5*10^n, where n is an + * integer Number. For example 1, 2, 5, 10, 20, 50, etc... + * @param {number} step Desired step size + * @return {number} Nice step size + */ +StepNumber.calculatePrettyStep = function (step) { + var log10 = function log10(x) { + return Math.log(x) / Math.LN10; + }; - while (i < src.length) { - var val = key ? src[i][key] : src[i]; - if (inArray(values, val) < 0) { - results.push(src[i]); - } - values[i] = val; - i++; - } + // try three steps (multiple of 1, 2, or 5 + var step1 = Math.pow(10, Math.round(log10(step))), + step2 = 2 * Math.pow(10, Math.round(log10(step / 2))), + step5 = 5 * Math.pow(10, Math.round(log10(step / 5))); - if (sort) { - if (!key) { - results = results.sort(); - } else { - results = results.sort(function sortUniqueArray(a, b) { - return a[key] > b[key]; - }); - } - } + // choose the best step (closest to minimum step) + var prettyStep = step1; + if (Math.abs(step2 - step) <= Math.abs(prettyStep - step)) prettyStep = step2; + if (Math.abs(step5 - step) <= Math.abs(prettyStep - step)) prettyStep = step5; - return results; + // for safety + if (prettyStep <= 0) { + prettyStep = 1; } - /** - * get the prefixed property - * @param {Object} obj - * @param {String} property - * @returns {String|Undefined} prefixed - */ - function prefixed(obj, property) { - var prefix, prop; - var camelProp = property[0].toUpperCase() + property.slice(1); + return prettyStep; +}; - var i = 0; - while (i < VENDOR_PREFIXES.length) { - prefix = VENDOR_PREFIXES[i]; - prop = (prefix) ? prefix + camelProp : property; +/** + * returns the current value of the step + * @return {number} current value + */ +StepNumber.prototype.getCurrent = function () { + return parseFloat(this._current.toPrecision(this.precision)); +}; - if (prop in obj) { - return prop; - } - i++; - } - return undefined; - } +/** + * returns the current step size + * @return {number} current step size + */ +StepNumber.prototype.getStep = function () { + return this._step; +}; - /** - * get a unique id - * @returns {number} uniqueId - */ - var _uniqueId = 1; - function uniqueId() { - return _uniqueId++; +/** + * Set the current to its starting value. + * + * By default, this will be the largest value smaller than start, which + * is a multiple of the step size. + * + * Parameters checkFirst is optional, default false. + * If set to true, move the current value one step if smaller than start. + * + * @param {boolean} [checkFirst=false] + */ +StepNumber.prototype.start = function (checkFirst) { + if (checkFirst === undefined) { + checkFirst = false; } - /** - * get the window object of an element - * @param {HTMLElement} element - * @returns {DocumentView|Window} - */ - function getWindowForElement(element) { - var doc = element.ownerDocument || element; - return (doc.defaultView || doc.parentWindow || window); - } + this._current = this._start - this._start % this._step; - var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; + if (checkFirst) { + if (this.getCurrent() < this._start) { + this.next(); + } + } +}; - var SUPPORT_TOUCH = ('ontouchstart' in window); - var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; - var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); +/** + * Do a step, add the step size to the current value + */ +StepNumber.prototype.next = function () { + this._current += this._step; +}; - var INPUT_TYPE_TOUCH = 'touch'; - var INPUT_TYPE_PEN = 'pen'; - var INPUT_TYPE_MOUSE = 'mouse'; - var INPUT_TYPE_KINECT = 'kinect'; +/** + * Returns true whether the end is reached + * @return {boolean} True if the current value has passed the end value. + */ +StepNumber.prototype.end = function () { + return this._current > this._end; +}; - var COMPUTE_INTERVAL = 25; +module.exports = StepNumber; - var INPUT_START = 1; - var INPUT_MOVE = 2; - var INPUT_END = 4; - var INPUT_CANCEL = 8; - - var DIRECTION_NONE = 1; - var DIRECTION_LEFT = 2; - var DIRECTION_RIGHT = 4; - var DIRECTION_UP = 8; - var DIRECTION_DOWN = 16; +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { - var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; - var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; - var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; +"use strict"; + + +var _typeof2 = __webpack_require__(6); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +//////////////////////////////////////////////////////////////////////////////// +// This modules handles the options for Graph3d. +// +//////////////////////////////////////////////////////////////////////////////// +var util = __webpack_require__(2); +var Camera = __webpack_require__(95); +var Point3d = __webpack_require__(34); + +// enumerate the available styles +var STYLE = { + BAR: 0, + BARCOLOR: 1, + BARSIZE: 2, + DOT: 3, + DOTLINE: 4, + DOTCOLOR: 5, + DOTSIZE: 6, + GRID: 7, + LINE: 8, + SURFACE: 9 +}; + +// The string representations of the styles +var STYLENAME = { + 'dot': STYLE.DOT, + 'dot-line': STYLE.DOTLINE, + 'dot-color': STYLE.DOTCOLOR, + 'dot-size': STYLE.DOTSIZE, + 'line': STYLE.LINE, + 'grid': STYLE.GRID, + 'surface': STYLE.SURFACE, + 'bar': STYLE.BAR, + 'bar-color': STYLE.BARCOLOR, + 'bar-size': STYLE.BARSIZE +}; - var PROPS_XY = ['x', 'y']; - var PROPS_CLIENT_XY = ['clientX', 'clientY']; +/** + * Field names in the options hash which are of relevance to the user. + * + * Specifically, these are the fields which require no special handling, + * and can be directly copied over. + */ +var OPTIONKEYS = ['width', 'height', 'filterLabel', 'legendLabel', 'xLabel', 'yLabel', 'zLabel', 'xValueLabel', 'yValueLabel', 'zValueLabel', 'showXAxis', 'showYAxis', 'showZAxis', 'showGrid', 'showPerspective', 'showShadow', 'keepAspectRatio', 'verticalRatio', 'dotSizeRatio', 'dotSizeMinFraction', 'dotSizeMaxFraction', 'showAnimationControls', 'animationInterval', 'animationPreload', 'animationAutoStart', 'axisColor', 'gridColor', 'xCenter', 'yCenter']; - /** - * create new input type manager - * @param {Manager} manager - * @param {Function} callback - * @returns {Input} - * @constructor - */ - function Input(manager, callback) { - var self = this; - this.manager = manager; - this.callback = callback; - this.element = manager.element; - this.target = manager.options.inputTarget; - - // smaller wrapper around the handler, for the scope and the enabled state of the manager, - // so when disabled the input events are completely bypassed. - this.domHandler = function(ev) { - if (boolOrFn(manager.options.enable, [manager])) { - self.handler(ev); - } - }; +/** + * Field names in the options hash which are of relevance to the user. + * + * Same as OPTIONKEYS, but internally these fields are stored with + * prefix 'default' in the name. + */ +var PREFIXEDOPTIONKEYS = ['xBarWidth', 'yBarWidth', 'valueMin', 'valueMax', 'xMin', 'xMax', 'xStep', 'yMin', 'yMax', 'yStep', 'zMin', 'zMax', 'zStep']; - this.init(); +// Placeholder for DEFAULTS reference +var DEFAULTS = undefined; +/** + * Check if given hash is empty. + * + * Source: http://stackoverflow.com/a/679937 + * + * @param {object} obj + * @returns {boolean} + */ +function isEmpty(obj) { + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) return false; } - Input.prototype = { - /** - * should handle the inputEvent data and trigger the callback - * @virtual - */ - handler: function() { }, + return true; +} - /** - * bind the events - */ - init: function() { - this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); - this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); - this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); - }, +/** + * Make first letter of parameter upper case. + * + * Source: http://stackoverflow.com/a/1026087 + * + * @param {string} str + * @returns {string} + */ +function capitalize(str) { + if (str === undefined || str === "" || typeof str != "string") { + return str; + } - /** - * unbind the events - */ - destroy: function() { - this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); - this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); - this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); - } - }; + return str.charAt(0).toUpperCase() + str.slice(1); +} - /** - * create new input type manager - * called by the Manager constructor - * @param {Hammer} manager - * @returns {Input} - */ - function createInputInstance(manager) { - var Type; - var inputClass = manager.options.inputClass; - - if (inputClass) { - Type = inputClass; - } else if (SUPPORT_POINTER_EVENTS) { - Type = PointerEventInput; - } else if (SUPPORT_ONLY_TOUCH) { - Type = TouchInput; - } else if (!SUPPORT_TOUCH) { - Type = MouseInput; - } else { - Type = TouchMouseInput; - } - return new (Type)(manager, inputHandler); +/** + * Add a prefix to a field name, taking style guide into account + * + * @param {string} prefix + * @param {string} fieldName + * @returns {string} + */ +function prefixFieldName(prefix, fieldName) { + if (prefix === undefined || prefix === "") { + return fieldName; } - /** - * handle input events - * @param {Manager} manager - * @param {String} eventType - * @param {Object} input - */ - function inputHandler(manager, eventType, input) { - var pointersLen = input.pointers.length; - var changedPointersLen = input.changedPointers.length; - var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); - var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); + return prefix + capitalize(fieldName); +} + +/** + * Forcibly copy fields from src to dst in a controlled manner. + * + * A given field in dst will always be overwitten. If this field + * is undefined or not present in src, the field in dst will + * be explicitly set to undefined. + * + * The intention here is to be able to reset all option fields. + * + * Only the fields mentioned in array 'fields' will be handled. + * + * @param {object} src + * @param {object} dst + * @param {array} fields array with names of fields to copy + * @param {string} [prefix] prefix to use for the target fields. + */ +function forceCopy(src, dst, fields, prefix) { + var srcKey; + var dstKey; - input.isFirst = !!isFirst; - input.isFinal = !!isFinal; + for (var i = 0; i < fields.length; ++i) { + srcKey = fields[i]; + dstKey = prefixFieldName(prefix, srcKey); - if (isFirst) { - manager.session = {}; - } + dst[dstKey] = src[srcKey]; + } +} - // source event is the normalized value of the domEvents - // like 'touchstart, mouseup, pointerdown' - input.eventType = eventType; +/** + * Copy fields from src to dst in a safe and controlled manner. + * + * Only the fields mentioned in array 'fields' will be copied over, + * and only if these are actually defined. + * + * @param {object} src + * @param {object} dst + * @param {array} fields array with names of fields to copy + * @param {string} [prefix] prefix to use for the target fields. + */ +function safeCopy(src, dst, fields, prefix) { + var srcKey; + var dstKey; - // compute scale, rotation etc - computeInputData(manager, input); + for (var i = 0; i < fields.length; ++i) { + srcKey = fields[i]; + if (src[srcKey] === undefined) continue; - // emit secret event - manager.emit('hammer.input', input); + dstKey = prefixFieldName(prefix, srcKey); - manager.recognize(input); - manager.session.prevInput = input; + dst[dstKey] = src[srcKey]; } +} - /** - * extend the data with some usable properties like scale, rotate, velocity etc - * @param {Object} manager - * @param {Object} input - */ - function computeInputData(manager, input) { - var session = manager.session; - var pointers = input.pointers; - var pointersLength = pointers.length; +/** + * Initialize dst with the values in src. + * + * src is the hash with the default values. + * A reference DEFAULTS to this hash is stored locally for + * further handling. + * + * For now, dst is assumed to be a Graph3d instance. + * @param {object} src + * @param {object} dst + */ +function setDefaults(src, dst) { + if (src === undefined || isEmpty(src)) { + throw new Error('No DEFAULTS passed'); + } + if (dst === undefined) { + throw new Error('No dst passed'); + } - // store the first input to calculate the distance and direction - if (!session.firstInput) { - session.firstInput = simpleCloneInputData(input); - } + // Remember defaults for future reference + DEFAULTS = src; - // to compute scale and rotation we need to store the multiple touches - if (pointersLength > 1 && !session.firstMultiple) { - session.firstMultiple = simpleCloneInputData(input); - } else if (pointersLength === 1) { - session.firstMultiple = false; - } + // Handle the defaults which can be simply copied over + forceCopy(src, dst, OPTIONKEYS); + forceCopy(src, dst, PREFIXEDOPTIONKEYS, 'default'); - var firstInput = session.firstInput; - var firstMultiple = session.firstMultiple; - var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; + // Handle the more complex ('special') fields + setSpecialSettings(src, dst); - var center = input.center = getCenter(pointers); - input.timeStamp = now(); - input.deltaTime = input.timeStamp - firstInput.timeStamp; + // Following are internal fields, not part of the user settings + dst.margin = 10; // px + dst.showGrayBottom = false; // TODO: this does not work correctly + dst.showTooltip = false; + dst.onclick_callback = null; + dst.eye = new Point3d(0, 0, -1); // TODO: set eye.z about 3/4 of the width of the window? +} - input.angle = getAngle(offsetCenter, center); - input.distance = getDistance(offsetCenter, center); +/** + * + * @param {object} options + * @param {object} dst + */ +function setOptions(options, dst) { + if (options === undefined) { + return; + } + if (dst === undefined) { + throw new Error('No dst passed'); + } - computeDeltaXY(session, input); - input.offsetDirection = getDirection(input.deltaX, input.deltaY); + if (DEFAULTS === undefined || isEmpty(DEFAULTS)) { + throw new Error('DEFAULTS not set for module Settings'); + } - var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); - input.overallVelocityX = overallVelocity.x; - input.overallVelocityY = overallVelocity.y; - input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y; + // Handle the parameters which can be simply copied over + safeCopy(options, dst, OPTIONKEYS); + safeCopy(options, dst, PREFIXEDOPTIONKEYS, 'default'); - input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; - input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; + // Handle the more complex ('special') fields + setSpecialSettings(options, dst); +} - input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length > - session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers); +/** + * Special handling for certain parameters + * + * 'Special' here means: setting requires more than a simple copy + * + * @param {object} src + * @param {object} dst + */ +function setSpecialSettings(src, dst) { + if (src.backgroundColor !== undefined) { + setBackgroundColor(src.backgroundColor, dst); + } - computeIntervalInputData(session, input); + setDataColor(src.dataColor, dst); + setStyle(src.style, dst); + setShowLegend(src.showLegend, dst); + setCameraPosition(src.cameraPosition, dst); - // find the correct target - var target = manager.element; - if (hasParent(input.srcEvent.target, target)) { - target = input.srcEvent.target; - } - input.target = target; + // As special fields go, this is an easy one; just a translation of the name. + // Can't use this.tooltip directly, because that field exists internally + if (src.tooltip !== undefined) { + dst.showTooltip = src.tooltip; + } + if (src.onclick != undefined) { + dst.onclick_callback = src.onclick; } - function computeDeltaXY(session, input) { - var center = input.center; - var offset = session.offsetDelta || {}; - var prevDelta = session.prevDelta || {}; - var prevInput = session.prevInput || {}; - - if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { - prevDelta = session.prevDelta = { - x: prevInput.deltaX || 0, - y: prevInput.deltaY || 0 - }; + if (src.tooltipStyle !== undefined) { + util.selectiveDeepExtend(['tooltipStyle'], dst, src); + } +} - offset = session.offsetDelta = { - x: center.x, - y: center.y - }; - } +/** + * Set the value of setting 'showLegend' + * + * This depends on the value of the style fields, so it must be called + * after the style field has been initialized. + * + * @param {boolean} showLegend + * @param {object} dst + */ +function setShowLegend(showLegend, dst) { + if (showLegend === undefined) { + // If the default was auto, make a choice for this field + var isAutoByDefault = DEFAULTS.showLegend === undefined; + + if (isAutoByDefault) { + // these styles default to having legends + var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE; + + dst.showLegend = isLegendGraphStyle; + } else { + // Leave current value as is + } + } else { + dst.showLegend = showLegend; + } +} - input.deltaX = prevDelta.x + (center.x - offset.x); - input.deltaY = prevDelta.y + (center.y - offset.y); +/** + * Retrieve the style index from given styleName + * @param {string} styleName Style name such as 'dot', 'grid', 'dot-line' + * @return {number} styleNumber Enumeration value representing the style, or -1 + * when not found + */ +function getStyleNumberByName(styleName) { + var number = STYLENAME[styleName]; + + if (number === undefined) { + return -1; } - /** - * velocity is calculated every x ms - * @param {Object} session - * @param {Object} input - */ - function computeIntervalInputData(session, input) { - var last = session.lastInterval || input, - deltaTime = input.timeStamp - last.timeStamp, - velocity, velocityX, velocityY, direction; - - if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { - var deltaX = input.deltaX - last.deltaX; - var deltaY = input.deltaY - last.deltaY; - - var v = getVelocity(deltaTime, deltaX, deltaY); - velocityX = v.x; - velocityY = v.y; - velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; - direction = getDirection(deltaX, deltaY); - - session.lastInterval = input; - } else { - // use latest velocity info if it doesn't overtake a minimum period - velocity = last.velocity; - velocityX = last.velocityX; - velocityY = last.velocityY; - direction = last.direction; - } + return number; +} + +/** + * Check if given number is a valid style number. + * + * @param {string | number} style + * @return {boolean} true if valid, false otherwise + */ +function checkStyleNumber(style) { + var valid = false; - input.velocity = velocity; - input.velocityX = velocityX; - input.velocityY = velocityY; - input.direction = direction; + for (var n in STYLE) { + if (STYLE[n] === style) { + valid = true; + break; + } } - /** - * create a simple clone from the input used for storage of firstInput and firstMultiple - * @param {Object} input - * @returns {Object} clonedInputData - */ - function simpleCloneInputData(input) { - // make a simple copy of the pointers because we will get a reference if we don't - // we only need clientXY for the calculations - var pointers = []; - var i = 0; - while (i < input.pointers.length) { - pointers[i] = { - clientX: round(input.pointers[i].clientX), - clientY: round(input.pointers[i].clientY) - }; - i++; - } + return valid; +} - return { - timeStamp: now(), - pointers: pointers, - center: getCenter(pointers), - deltaX: input.deltaX, - deltaY: input.deltaY - }; +/** + * + * @param {string | number} style + * @param {Object} dst + */ +function setStyle(style, dst) { + if (style === undefined) { + return; // Nothing to do } - /** - * get the center of all the pointers - * @param {Array} pointers - * @return {Object} center contains `x` and `y` properties - */ - function getCenter(pointers) { - var pointersLength = pointers.length; - - // no need to loop when only one touch - if (pointersLength === 1) { - return { - x: round(pointers[0].clientX), - y: round(pointers[0].clientY) - }; - } + var styleNumber; - var x = 0, y = 0, i = 0; - while (i < pointersLength) { - x += pointers[i].clientX; - y += pointers[i].clientY; - i++; - } + if (typeof style === 'string') { + styleNumber = getStyleNumberByName(style); - return { - x: round(x / pointersLength), - y: round(y / pointersLength) - }; - } + if (styleNumber === -1) { + throw new Error('Style \'' + style + '\' is invalid'); + } + } else { + // Do a pedantic check on style number value + if (!checkStyleNumber(style)) { + throw new Error('Style \'' + style + '\' is invalid'); + } - /** - * calculate the velocity between two points. unit is in px per ms. - * @param {Number} deltaTime - * @param {Number} x - * @param {Number} y - * @return {Object} velocity `x` and `y` - */ - function getVelocity(deltaTime, x, y) { - return { - x: x / deltaTime || 0, - y: y / deltaTime || 0 - }; + styleNumber = style; } - /** - * get the direction between two points - * @param {Number} x - * @param {Number} y - * @return {Number} direction - */ - function getDirection(x, y) { - if (x === y) { - return DIRECTION_NONE; - } + dst.style = styleNumber; +} - if (abs(x) >= abs(y)) { - return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; - } - return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; +/** + * Set the background styling for the graph + * @param {string | {fill: string, stroke: string, strokeWidth: string}} backgroundColor + * @param {Object} dst + */ +function setBackgroundColor(backgroundColor, dst) { + var fill = 'white'; + var stroke = 'gray'; + var strokeWidth = 1; + + if (typeof backgroundColor === 'string') { + fill = backgroundColor; + stroke = 'none'; + strokeWidth = 0; + } else if ((typeof backgroundColor === 'undefined' ? 'undefined' : (0, _typeof3['default'])(backgroundColor)) === 'object') { + if (backgroundColor.fill !== undefined) fill = backgroundColor.fill; + if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke; + if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth; + } else { + throw new Error('Unsupported type of backgroundColor'); } - /** - * calculate the absolute distance between two points - * @param {Object} p1 {x, y} - * @param {Object} p2 {x, y} - * @param {Array} [props] containing x and y keys - * @return {Number} distance - */ - function getDistance(p1, p2, props) { - if (!props) { - props = PROPS_XY; - } - var x = p2[props[0]] - p1[props[0]], - y = p2[props[1]] - p1[props[1]]; + dst.frame.style.backgroundColor = fill; + dst.frame.style.borderColor = stroke; + dst.frame.style.borderWidth = strokeWidth + 'px'; + dst.frame.style.borderStyle = 'solid'; +} - return Math.sqrt((x * x) + (y * y)); +/** + * + * @param {string | Object} dataColor + * @param {Object} dst + */ +function setDataColor(dataColor, dst) { + if (dataColor === undefined) { + return; // Nothing to do } - /** - * calculate the angle between two coordinates - * @param {Object} p1 - * @param {Object} p2 - * @param {Array} [props] containing x and y keys - * @return {Number} angle - */ - function getAngle(p1, p2, props) { - if (!props) { - props = PROPS_XY; - } - var x = p2[props[0]] - p1[props[0]], - y = p2[props[1]] - p1[props[1]]; - return Math.atan2(y, x) * 180 / Math.PI; + if (dst.dataColor === undefined) { + dst.dataColor = {}; } - /** - * calculate the rotation degrees between two pointersets - * @param {Array} start array of pointers - * @param {Array} end array of pointers - * @return {Number} rotation - */ - function getRotation(start, end) { - return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); + if (typeof dataColor === 'string') { + dst.dataColor.fill = dataColor; + dst.dataColor.stroke = dataColor; + } else { + if (dataColor.fill) { + dst.dataColor.fill = dataColor.fill; + } + if (dataColor.stroke) { + dst.dataColor.stroke = dataColor.stroke; + } + if (dataColor.strokeWidth !== undefined) { + dst.dataColor.strokeWidth = dataColor.strokeWidth; + } } +} - /** - * calculate the scale factor between two pointersets - * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out - * @param {Array} start array of pointers - * @param {Array} end array of pointers - * @return {Number} scale - */ - function getScale(start, end) { - return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); +/** + * + * @param {Object} cameraPosition + * @param {Object} dst + */ +function setCameraPosition(cameraPosition, dst) { + var camPos = cameraPosition; + if (camPos === undefined) { + return; } - var MOUSE_INPUT_MAP = { - mousedown: INPUT_START, - mousemove: INPUT_MOVE, - mouseup: INPUT_END - }; + if (dst.camera === undefined) { + dst.camera = new Camera(); + } - var MOUSE_ELEMENT_EVENTS = 'mousedown'; - var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; + dst.camera.setArmRotation(camPos.horizontal, camPos.vertical); + dst.camera.setArmLength(camPos.distance); +} - /** - * Mouse events input - * @constructor - * @extends Input - */ - function MouseInput() { - this.evEl = MOUSE_ELEMENT_EVENTS; - this.evWin = MOUSE_WINDOW_EVENTS; +module.exports.STYLE = STYLE; +module.exports.setDefaults = setDefaults; +module.exports.setOptions = setOptions; +module.exports.setCameraPosition = setCameraPosition; - this.pressed = false; // mousedown state +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { - Input.apply(this, arguments); - } +"use strict"; - inherit(MouseInput, Input, { - /** - * handle mouse events - * @param {Object} ev - */ - handler: function MEhandler(ev) { - var eventType = MOUSE_INPUT_MAP[ev.type]; - // on start we want to have the left mouse button down - if (eventType & INPUT_START && ev.button === 0) { - this.pressed = true; - } +var _sign = __webpack_require__(165); - if (eventType & INPUT_MOVE && ev.which !== 1) { - eventType = INPUT_END; - } +var _sign2 = _interopRequireDefault(_sign); - // mouse must be down - if (!this.pressed) { - return; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - if (eventType & INPUT_END) { - this.pressed = false; - } +var Point3d = __webpack_require__(34); - this.callback(this.manager, eventType, { - pointers: [ev], - changedPointers: [ev], - pointerType: INPUT_TYPE_MOUSE, - srcEvent: ev - }); - } - }); +/** + * The camera is mounted on a (virtual) camera arm. The camera arm can rotate + * The camera is always looking in the direction of the origin of the arm. + * This way, the camera always rotates around one fixed point, the location + * of the camera arm. + * + * Documentation: + * http://en.wikipedia.org/wiki/3D_projection + * @class Camera + */ +function Camera() { + this.armLocation = new Point3d(); + this.armRotation = {}; + this.armRotation.horizontal = 0; + this.armRotation.vertical = 0; + this.armLength = 1.7; + this.cameraOffset = new Point3d(); + this.offsetMultiplier = 0.6; + + this.cameraLocation = new Point3d(); + this.cameraRotation = new Point3d(0.5 * Math.PI, 0, 0); + + this.calculateCameraOrientation(); +} - var POINTER_INPUT_MAP = { - pointerdown: INPUT_START, - pointermove: INPUT_MOVE, - pointerup: INPUT_END, - pointercancel: INPUT_CANCEL, - pointerout: INPUT_CANCEL - }; +/** + * Set offset camera in camera coordinates + * @param {number} x offset by camera horisontal + * @param {number} y offset by camera vertical + */ +Camera.prototype.setOffset = function (x, y) { + var abs = Math.abs, + sign = _sign2['default'], + mul = this.offsetMultiplier, + border = this.armLength * mul; + + if (abs(x) > border) { + x = sign(x) * border; + } + if (abs(y) > border) { + y = sign(y) * border; + } + this.cameraOffset.x = x; + this.cameraOffset.y = y; + this.calculateCameraOrientation(); +}; - // in IE10 the pointer types is defined as an enum - var IE10_POINTER_TYPE_ENUM = { - 2: INPUT_TYPE_TOUCH, - 3: INPUT_TYPE_PEN, - 4: INPUT_TYPE_MOUSE, - 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 - }; +/** + * Get camera offset by horizontal and vertical + * @returns {number} + */ +Camera.prototype.getOffset = function () { + return this.cameraOffset; +}; - var POINTER_ELEMENT_EVENTS = 'pointerdown'; - var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; +/** + * Set the location (origin) of the arm + * @param {number} x Normalized value of x + * @param {number} y Normalized value of y + * @param {number} z Normalized value of z + */ +Camera.prototype.setArmLocation = function (x, y, z) { + this.armLocation.x = x; + this.armLocation.y = y; + this.armLocation.z = z; + + this.calculateCameraOrientation(); +}; - // IE10 has prefixed support, and case-sensitive - if (window.MSPointerEvent && !window.PointerEvent) { - POINTER_ELEMENT_EVENTS = 'MSPointerDown'; - POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; +/** + * Set the rotation of the camera arm + * @param {number} horizontal The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * @param {number} vertical The vertical rotation, between 0 and 0.5*PI + * if vertical=0.5*PI, the graph is shown from the + * top. Optional, can be left undefined. + */ +Camera.prototype.setArmRotation = function (horizontal, vertical) { + if (horizontal !== undefined) { + this.armRotation.horizontal = horizontal; } - /** - * Pointer events input - * @constructor - * @extends Input - */ - function PointerEventInput() { - this.evEl = POINTER_ELEMENT_EVENTS; - this.evWin = POINTER_WINDOW_EVENTS; - - Input.apply(this, arguments); - - this.store = (this.manager.session.pointerEvents = []); + if (vertical !== undefined) { + this.armRotation.vertical = vertical; + if (this.armRotation.vertical < 0) this.armRotation.vertical = 0; + if (this.armRotation.vertical > 0.5 * Math.PI) this.armRotation.vertical = 0.5 * Math.PI; } - inherit(PointerEventInput, Input, { - /** - * handle mouse events - * @param {Object} ev - */ - handler: function PEhandler(ev) { - var store = this.store; - var removePointer = false; + if (horizontal !== undefined || vertical !== undefined) { + this.calculateCameraOrientation(); + } +}; - var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); - var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; - var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; +/** + * Retrieve the current arm rotation + * @return {object} An object with parameters horizontal and vertical + */ +Camera.prototype.getArmRotation = function () { + var rot = {}; + rot.horizontal = this.armRotation.horizontal; + rot.vertical = this.armRotation.vertical; - var isTouch = (pointerType == INPUT_TYPE_TOUCH); + return rot; +}; - // get index of the event in the store - var storeIndex = inArray(store, ev.pointerId, 'pointerId'); +/** + * Set the (normalized) length of the camera arm. + * @param {number} length A length between 0.71 and 5.0 + */ +Camera.prototype.setArmLength = function (length) { + if (length === undefined) return; - // start and mouse must be down - if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { - if (storeIndex < 0) { - store.push(ev); - storeIndex = store.length - 1; - } - } else if (eventType & (INPUT_END | INPUT_CANCEL)) { - removePointer = true; - } + this.armLength = length; - // it not found, so the pointer hasn't been down (so it's probably a hover) - if (storeIndex < 0) { - return; - } + // Radius must be larger than the corner of the graph, + // which has a distance of sqrt(0.5^2+0.5^2) = 0.71 from the center of the + // graph + if (this.armLength < 0.71) this.armLength = 0.71; + if (this.armLength > 5.0) this.armLength = 5.0; - // update the event in the store - store[storeIndex] = ev; + this.setOffset(this.cameraOffset.x, this.cameraOffset.y); + this.calculateCameraOrientation(); +}; - this.callback(this.manager, eventType, { - pointers: store, - changedPointers: [ev], - pointerType: pointerType, - srcEvent: ev - }); +/** + * Retrieve the arm length + * @return {number} length + */ +Camera.prototype.getArmLength = function () { + return this.armLength; +}; - if (removePointer) { - // remove from the store - store.splice(storeIndex, 1); - } - } - }); +/** + * Retrieve the camera location + * @return {Point3d} cameraLocation + */ +Camera.prototype.getCameraLocation = function () { + return this.cameraLocation; +}; - var SINGLE_TOUCH_INPUT_MAP = { - touchstart: INPUT_START, - touchmove: INPUT_MOVE, - touchend: INPUT_END, - touchcancel: INPUT_CANCEL - }; +/** + * Retrieve the camera rotation + * @return {Point3d} cameraRotation + */ +Camera.prototype.getCameraRotation = function () { + return this.cameraRotation; +}; - var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; - var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; +/** + * Calculate the location and rotation of the camera based on the + * position and orientation of the camera arm + */ +Camera.prototype.calculateCameraOrientation = function () { + // calculate location of the camera + this.cameraLocation.x = this.armLocation.x - this.armLength * Math.sin(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.y = this.armLocation.y - this.armLength * Math.cos(this.armRotation.horizontal) * Math.cos(this.armRotation.vertical); + this.cameraLocation.z = this.armLocation.z + this.armLength * Math.sin(this.armRotation.vertical); + + // calculate rotation of the camera + this.cameraRotation.x = Math.PI / 2 - this.armRotation.vertical; + this.cameraRotation.y = 0; + this.cameraRotation.z = -this.armRotation.horizontal; + + var xa = this.cameraRotation.x; + var za = this.cameraRotation.z; + var dx = this.cameraOffset.x; + var dy = this.cameraOffset.y; + var sin = Math.sin, + cos = Math.cos; + + this.cameraLocation.x = this.cameraLocation.x + dx * cos(za) + dy * -sin(za) * cos(xa); + this.cameraLocation.y = this.cameraLocation.y + dx * sin(za) + dy * cos(za) * cos(xa); + this.cameraLocation.z = this.cameraLocation.z + dy * sin(xa); +}; + +module.exports = Camera; - /** - * Touch events input - * @constructor - * @extends Input - */ - function SingleTouchInput() { - this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; - this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; - this.started = false; +/***/ }), +/* 96 */ +/***/ (function(module, exports, __webpack_require__) { - Input.apply(this, arguments); - } +"use strict"; - inherit(SingleTouchInput, Input, { - handler: function TEhandler(ev) { - var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; - // should we handle the touch events? - if (type === INPUT_START) { - this.started = true; - } +var DataView = __webpack_require__(12); - if (!this.started) { - return; - } +/** + * @class Filter + * + * @param {DataGroup} dataGroup the data group + * @param {number} column The index of the column to be filtered + * @param {Graph3d} graph The graph + */ +function Filter(dataGroup, column, graph) { + this.dataGroup = dataGroup; + this.column = column; + this.graph = graph; // the parent graph - var touches = normalizeSingleTouches.call(this, ev, type); + this.index = undefined; + this.value = undefined; - // when done, reset the started state - if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { - this.started = false; - } + // read all distinct values and select the first one + this.values = dataGroup.getDistinctValues(this.column); - this.callback(this.manager, type, { - pointers: touches[0], - changedPointers: touches[1], - pointerType: INPUT_TYPE_TOUCH, - srcEvent: ev - }); - } - }); + if (this.values.length > 0) { + this.selectValue(0); + } - /** - * @this {TouchInput} - * @param {Object} ev - * @param {Number} type flag - * @returns {undefined|Array} [all, changed] - */ - function normalizeSingleTouches(ev, type) { - var all = toArray(ev.touches); - var changed = toArray(ev.changedTouches); + // create an array with the filtered datapoints. this will be loaded afterwards + this.dataPoints = []; - if (type & (INPUT_END | INPUT_CANCEL)) { - all = uniqueArray(all.concat(changed), 'identifier', true); - } + this.loaded = false; + this.onLoadCallback = undefined; - return [all, changed]; + if (graph.animationPreload) { + this.loaded = false; + this.loadInBackground(); + } else { + this.loaded = true; } +} - var TOUCH_INPUT_MAP = { - touchstart: INPUT_START, - touchmove: INPUT_MOVE, - touchend: INPUT_END, - touchcancel: INPUT_CANCEL - }; - - var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; +/** + * Return the label + * @return {string} label + */ +Filter.prototype.isLoaded = function () { + return this.loaded; +}; - /** - * Multi-user touch events input - * @constructor - * @extends Input - */ - function TouchInput() { - this.evTarget = TOUCH_TARGET_EVENTS; - this.targetIds = {}; +/** + * Return the loaded progress + * @return {number} percentage between 0 and 100 + */ +Filter.prototype.getLoadedProgress = function () { + var len = this.values.length; - Input.apply(this, arguments); + var i = 0; + while (this.dataPoints[i]) { + i++; } - inherit(TouchInput, Input, { - handler: function MTEhandler(ev) { - var type = TOUCH_INPUT_MAP[ev.type]; - var touches = getTouches.call(this, ev, type); - if (!touches) { - return; - } + return Math.round(i / len * 100); +}; - this.callback(this.manager, type, { - pointers: touches[0], - changedPointers: touches[1], - pointerType: INPUT_TYPE_TOUCH, - srcEvent: ev - }); - } - }); +/** + * Return the label + * @return {string} label + */ +Filter.prototype.getLabel = function () { + return this.graph.filterLabel; +}; - /** - * @this {TouchInput} - * @param {Object} ev - * @param {Number} type flag - * @returns {undefined|Array} [all, changed] - */ - function getTouches(ev, type) { - var allTouches = toArray(ev.touches); - var targetIds = this.targetIds; +/** + * Return the columnIndex of the filter + * @return {number} columnIndex + */ +Filter.prototype.getColumn = function () { + return this.column; +}; - // when there is only one touch, the process can be simplified - if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { - targetIds[allTouches[0].identifier] = true; - return [allTouches, allTouches]; - } +/** + * Return the currently selected value. Returns undefined if there is no selection + * @return {*} value + */ +Filter.prototype.getSelectedValue = function () { + if (this.index === undefined) return undefined; - var i, - targetTouches, - changedTouches = toArray(ev.changedTouches), - changedTargetTouches = [], - target = this.target; + return this.values[this.index]; +}; - // get target touches from touches - targetTouches = allTouches.filter(function(touch) { - return hasParent(touch.target, target); - }); +/** + * Retrieve all values of the filter + * @return {Array} values + */ +Filter.prototype.getValues = function () { + return this.values; +}; - // collect touches - if (type === INPUT_START) { - i = 0; - while (i < targetTouches.length) { - targetIds[targetTouches[i].identifier] = true; - i++; - } - } +/** + * Retrieve one value of the filter + * @param {number} index + * @return {*} value + */ +Filter.prototype.getValue = function (index) { + if (index >= this.values.length) throw new Error('Index out of range'); - // filter changed touches to only contain touches that exist in the collected target ids - i = 0; - while (i < changedTouches.length) { - if (targetIds[changedTouches[i].identifier]) { - changedTargetTouches.push(changedTouches[i]); - } + return this.values[index]; +}; - // cleanup removed touches - if (type & (INPUT_END | INPUT_CANCEL)) { - delete targetIds[changedTouches[i].identifier]; - } - i++; - } +/** + * Retrieve the (filtered) dataPoints for the currently selected filter index + * @param {number} [index] (optional) + * @return {Array} dataPoints + */ +Filter.prototype._getDataPoints = function (index) { + if (index === undefined) index = this.index; + + if (index === undefined) return []; + + var dataPoints; + if (this.dataPoints[index]) { + dataPoints = this.dataPoints[index]; + } else { + var f = {}; + f.column = this.column; + f.value = this.values[index]; - if (!changedTargetTouches.length) { - return; - } + var dataView = new DataView(this.dataGroup.getDataSet(), { filter: function filter(item) { + return item[f.column] == f.value; + } }).get(); + dataPoints = this.dataGroup._getDataPoints(dataView); - return [ - // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' - uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), - changedTargetTouches - ]; + this.dataPoints[index] = dataPoints; } - /** - * Combined touch and mouse input - * - * Touch has a higher priority then mouse, and while touching no mouse events are allowed. - * This because touch devices also emit mouse events while doing a touch. - * - * @constructor - * @extends Input - */ + return dataPoints; +}; + +/** + * Set a callback function when the filter is fully loaded. + * + * @param {function} callback + */ +Filter.prototype.setOnLoadCallback = function (callback) { + this.onLoadCallback = callback; +}; + +/** + * Add a value to the list with available values for this filter + * No double entries will be created. + * @param {number} index + */ +Filter.prototype.selectValue = function (index) { + if (index >= this.values.length) throw new Error('Index out of range'); + + this.index = index; + this.value = this.values[index]; +}; - var DEDUP_TIMEOUT = 2500; - var DEDUP_DISTANCE = 25; +/** + * Load all filtered rows in the background one by one + * Start this method without providing an index! + * + * @param {number} [index=0] + */ +Filter.prototype.loadInBackground = function (index) { + if (index === undefined) index = 0; + + var frame = this.graph.frame; + + if (index < this.values.length) { + // create a progress box + if (frame.progress === undefined) { + frame.progress = document.createElement('DIV'); + frame.progress.style.position = 'absolute'; + frame.progress.style.color = 'gray'; + frame.appendChild(frame.progress); + } + var progress = this.getLoadedProgress(); + frame.progress.innerHTML = 'Loading animation... ' + progress + '%'; + // TODO: this is no nice solution... + frame.progress.style.bottom = 60 + 'px'; // TODO: use height of slider + frame.progress.style.left = 10 + 'px'; - function TouchMouseInput() { - Input.apply(this, arguments); + var me = this; + setTimeout(function () { + me.loadInBackground(index + 1); + }, 10); + this.loaded = false; + } else { + this.loaded = true; - var handler = bindFn(this.handler, this); - this.touch = new TouchInput(this.manager, handler); - this.mouse = new MouseInput(this.manager, handler); + // remove the progress box + if (frame.progress !== undefined) { + frame.removeChild(frame.progress); + frame.progress = undefined; + } - this.primaryTouch = null; - this.lastTouches = []; + if (this.onLoadCallback) this.onLoadCallback(); } +}; - inherit(TouchMouseInput, Input, { - /** - * handle mouse and touch events - * @param {Hammer} manager - * @param {String} inputEvent - * @param {Object} inputData - */ - handler: function TMEhandler(manager, inputEvent, inputData) { - var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), - isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); +module.exports = Filter; - if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { - return; - } +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { - // when we're in a touch event, record touches to de-dupe synthetic mouse event - if (isTouch) { - recordTouches.call(this, inputEvent, inputData); - } else if (isMouse && isSyntheticEvent.call(this, inputData)) { - return; - } +"use strict"; - this.callback(manager, inputEvent, inputData); - }, - /** - * remove the event listeners - */ - destroy: function destroy() { - this.touch.destroy(); - this.mouse.destroy(); - } - }); - - function recordTouches(eventType, eventData) { - if (eventType & INPUT_START) { - this.primaryTouch = eventData.changedPointers[0].identifier; - setLastTouch.call(this, eventData); - } else if (eventType & (INPUT_END | INPUT_CANCEL)) { - setLastTouch.call(this, eventData); - } - } +var keycharm = __webpack_require__(35); +var Emitter = __webpack_require__(44); +var Hammer = __webpack_require__(10); +var util = __webpack_require__(2); - function setLastTouch(eventData) { - var touch = eventData.changedPointers[0]; +/** + * Turn an element into an clickToUse element. + * When not active, the element has a transparent overlay. When the overlay is + * clicked, the mode is changed to active. + * When active, the element is displayed with a blue border around it, and + * the interactive contents of the element can be used. When clicked outside + * the element, the elements mode is changed to inactive. + * @param {Element} container + * @constructor Activator + */ +function Activator(container) { + this.active = false; + + this.dom = { + container: container + }; + + this.dom.overlay = document.createElement('div'); + this.dom.overlay.className = 'vis-overlay'; + + this.dom.container.appendChild(this.dom.overlay); + + this.hammer = Hammer(this.dom.overlay); + this.hammer.on('tap', this._onTapOverlay.bind(this)); + + // block all touch events (except tap) + var me = this; + var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend']; + events.forEach(function (event) { + me.hammer.on(event, function (event) { + event.stopPropagation(); + }); + }); - if (touch.identifier === this.primaryTouch) { - var lastTouch = {x: touch.clientX, y: touch.clientY}; - this.lastTouches.push(lastTouch); - var lts = this.lastTouches; - var removeLastTouch = function() { - var i = lts.indexOf(lastTouch); - if (i > -1) { - lts.splice(i, 1); - } - }; - setTimeout(removeLastTouch, DEDUP_TIMEOUT); + // attach a click event to the window, in order to deactivate when clicking outside the timeline + if (document && document.body) { + this.onClick = function (event) { + if (!_hasParent(event.target, container)) { + me.deactivate(); } + }; + document.body.addEventListener('click', this.onClick); } - function isSyntheticEvent(eventData) { - var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY; - for (var i = 0; i < this.lastTouches.length; i++) { - var t = this.lastTouches[i]; - var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y); - if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { - return true; - } - } - return false; + if (this.keycharm !== undefined) { + this.keycharm.destroy(); } + this.keycharm = keycharm(); - var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); - var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; - - // magical touchAction value - var TOUCH_ACTION_COMPUTE = 'compute'; - var TOUCH_ACTION_AUTO = 'auto'; - var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented - var TOUCH_ACTION_NONE = 'none'; - var TOUCH_ACTION_PAN_X = 'pan-x'; - var TOUCH_ACTION_PAN_Y = 'pan-y'; - var TOUCH_ACTION_MAP = getTouchActionProps(); - - /** - * Touch Action - * sets the touchAction property or uses the js alternative - * @param {Manager} manager - * @param {String} value - * @constructor - */ - function TouchAction(manager, value) { - this.manager = manager; - this.set(value); - } + // keycharm listener only bounded when active) + this.escListener = this.deactivate.bind(this); +} - TouchAction.prototype = { - /** - * set the touchAction value on the element or enable the polyfill - * @param {String} value - */ - set: function(value) { - // find out the touch-action by the event handlers - if (value == TOUCH_ACTION_COMPUTE) { - value = this.compute(); - } +// turn into an event emitter +Emitter(Activator.prototype); - if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { - this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; - } - this.actions = value.toLowerCase().trim(); - }, +// The currently active activator +Activator.current = null; - /** - * just re-set the touchAction value - */ - update: function() { - this.set(this.manager.options.touchAction); - }, +/** + * Destroy the activator. Cleans up all created DOM and event listeners + */ +Activator.prototype.destroy = function () { + this.deactivate(); - /** - * compute the value for the touchAction property based on the recognizer's settings - * @returns {String} value - */ - compute: function() { - var actions = []; - each(this.manager.recognizers, function(recognizer) { - if (boolOrFn(recognizer.options.enable, [recognizer])) { - actions = actions.concat(recognizer.getTouchAction()); - } - }); - return cleanTouchActions(actions.join(' ')); - }, + // remove dom + this.dom.overlay.parentNode.removeChild(this.dom.overlay); - /** - * this method is called on each input cycle and provides the preventing of the browser behavior - * @param {Object} input - */ - preventDefaults: function(input) { - var srcEvent = input.srcEvent; - var direction = input.offsetDirection; + // remove global event listener + if (this.onClick) { + document.body.removeEventListener('click', this.onClick); + } - // if the touch action did prevented once this session - if (this.manager.session.prevented) { - srcEvent.preventDefault(); - return; - } + // cleanup hammer instances + this.hammer.destroy(); + this.hammer = null; + // FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory) +}; - var actions = this.actions; - var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; - var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; - var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; +/** + * Activate the element + * Overlay is hidden, element is decorated with a blue shadow border + */ +Activator.prototype.activate = function () { + // we allow only one active activator at a time + if (Activator.current) { + Activator.current.deactivate(); + } + Activator.current = this; - if (hasNone) { - //do not prevent defaults if this is a tap gesture + this.active = true; + this.dom.overlay.style.display = 'none'; + util.addClassName(this.dom.container, 'vis-active'); - var isTapPointer = input.pointers.length === 1; - var isTapMovement = input.distance < 2; - var isTapTouchTime = input.deltaTime < 250; + this.emit('change'); + this.emit('activate'); - if (isTapPointer && isTapMovement && isTapTouchTime) { - return; - } - } + // ugly hack: bind ESC after emitting the events, as the Network rebinds all + // keyboard events on a 'change' event + this.keycharm.bind('esc', this.escListener); +}; - if (hasPanX && hasPanY) { - // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent - return; - } +/** + * Deactivate the element + * Overlay is displayed on top of the element + */ +Activator.prototype.deactivate = function () { + this.active = false; + this.dom.overlay.style.display = ''; + util.removeClassName(this.dom.container, 'vis-active'); + this.keycharm.unbind('esc', this.escListener); + + this.emit('change'); + this.emit('deactivate'); +}; - if (hasNone || - (hasPanY && direction & DIRECTION_HORIZONTAL) || - (hasPanX && direction & DIRECTION_VERTICAL)) { - return this.preventSrc(srcEvent); - } - }, +/** + * Handle a tap event: activate the container + * @param {Event} event The event + * @private + */ +Activator.prototype._onTapOverlay = function (event) { + // activate the container + this.activate(); + event.stopPropagation(); +}; - /** - * call preventDefault to prevent the browser's default behavior (scrolling in most cases) - * @param {Object} srcEvent - */ - preventSrc: function(srcEvent) { - this.manager.session.prevented = true; - srcEvent.preventDefault(); - } - }; +/** + * Test whether the element has the requested parent element somewhere in + * its chain of parent nodes. + * @param {HTMLElement} element + * @param {HTMLElement} parent + * @returns {boolean} Returns true when the parent is found somewhere in the + * chain of parent nodes. + * @private + */ +function _hasParent(element, parent) { + while (element) { + if (element === parent) { + return true; + } + element = element.parentNode; + } + return false; +} - /** - * when the touchActions are collected they are not a valid value, so we need to clean things up. * - * @param {String} actions - * @returns {*} - */ - function cleanTouchActions(actions) { - // none - if (inStr(actions, TOUCH_ACTION_NONE)) { - return TOUCH_ACTION_NONE; - } +module.exports = Activator; - var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); - var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); +/***/ }), +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { - // if both pan-x and pan-y are set (different recognizers - // for different directions, e.g. horizontal pan but vertical swipe?) - // we need none (as otherwise with pan-x pan-y combined none of these - // recognizers will work, since the browser would handle all panning - if (hasPanX && hasPanY) { - return TOUCH_ACTION_NONE; - } +"use strict"; + + +// English +exports['en'] = { + current: 'current', + time: 'time' +}; +exports['en_EN'] = exports['en']; +exports['en_US'] = exports['en']; + +// Italiano +exports['it'] = { + current: 'attuale', + time: 'tempo' +}; +exports['it_IT'] = exports['it']; +exports['it_CH'] = exports['it']; + +// Dutch +exports['nl'] = { + current: 'huidige', + time: 'tijd' +}; +exports['nl_NL'] = exports['nl']; +exports['nl_BE'] = exports['nl']; + +// German +exports['de'] = { + current: 'Aktuelle', + time: 'Zeit' +}; +exports['de_DE'] = exports['de']; + +// French +exports['fr'] = { + current: 'actuel', + time: 'heure' +}; +exports['fr_FR'] = exports['fr']; +exports['fr_CA'] = exports['fr']; +exports['fr_BE'] = exports['fr']; + +// Espanol +exports['es'] = { + current: 'corriente', + time: 'hora' +}; +exports['es_ES'] = exports['es']; - // pan-x OR pan-y - if (hasPanX || hasPanY) { - return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; - } +/***/ }), +/* 99 */ +/***/ (function(module, exports, __webpack_require__) { - // manipulation - if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { - return TOUCH_ACTION_MANIPULATION; - } +"use strict"; - return TOUCH_ACTION_AUTO; - } - function getTouchActionProps() { - if (!NATIVE_TOUCH_ACTION) { - return false; - } - var touchMap = {}; - var cssSupports = window.CSS && window.CSS.supports; - ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) { +var _create = __webpack_require__(29); - // If css.supports is not supported but there is native touch-action assume it supports - // all values. This is the case for IE 10 and 11. - touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true; - }); - return touchMap; - } +var _create2 = _interopRequireDefault(_create); - /** - * Recognizer flow explained; * - * All recognizers have the initial state of POSSIBLE when a input session starts. - * The definition of a input session is from the first input until the last input, with all it's movement in it. * - * Example session for mouse-input: mousedown -> mousemove -> mouseup - * - * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed - * which determines with state it should be. - * - * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to - * POSSIBLE to give it another change on the next cycle. - * - * Possible - * | - * +-----+---------------+ - * | | - * +-----+-----+ | - * | | | - * Failed Cancelled | - * +-------+------+ - * | | - * Recognized Began - * | - * Changed - * | - * Ended/Recognized - */ - var STATE_POSSIBLE = 1; - var STATE_BEGAN = 2; - var STATE_CHANGED = 4; - var STATE_ENDED = 8; - var STATE_RECOGNIZED = STATE_ENDED; - var STATE_CANCELLED = 16; - var STATE_FAILED = 32; +var _typeof2 = __webpack_require__(6); - /** - * Recognizer - * Every recognizer needs to extend from this class. - * @constructor - * @param {Object} options - */ - function Recognizer(options) { - this.options = assign({}, this.defaults, options || {}); +var _typeof3 = _interopRequireDefault(_typeof2); - this.id = uniqueId(); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - this.manager = null; +var Hammer = __webpack_require__(10); +var util = __webpack_require__(2); +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var TimeStep = __webpack_require__(66); +var Component = __webpack_require__(16); +var Group = __webpack_require__(68); +var BackgroundGroup = __webpack_require__(69); +var BoxItem = __webpack_require__(101); +var PointItem = __webpack_require__(102); +var RangeItem = __webpack_require__(70); +var BackgroundItem = __webpack_require__(103); +var Popup = __webpack_require__(104)['default']; - // default is enable true - this.options.enable = ifUndefined(this.options.enable, true); +var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items +var BACKGROUND = '__background__'; // reserved group id for background items without group - this.state = STATE_POSSIBLE; +/** + * An ItemSet holds a set of items and ranges which can be displayed in a + * range. The width is determined by the parent of the ItemSet, and the height + * is determined by the size of the items. + * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body + * @param {Object} [options] See ItemSet.setOptions for the available options. + * @constructor ItemSet + * @extends Component + */ +function ItemSet(body, options) { + this.body = body; + this.defaultOptions = { + type: null, // 'box', 'point', 'range', 'background' + orientation: { + item: 'bottom' // item orientation: 'top' or 'bottom' + }, + align: 'auto', // alignment of box items + stack: true, + stackSubgroups: true, + groupOrderSwap: function groupOrderSwap(fromGroup, toGroup, groups) { + // eslint-disable-line no-unused-vars + var targetOrder = toGroup.order; + toGroup.order = fromGroup.order; + fromGroup.order = targetOrder; + }, + groupOrder: 'order', - this.simultaneous = {}; - this.requireFail = []; - } + selectable: true, + multiselect: false, + itemsAlwaysDraggable: { + item: false, + range: false + }, - Recognizer.prototype = { - /** - * @virtual - * @type {Object} - */ - defaults: {}, + editable: { + updateTime: false, + updateGroup: false, + add: false, + remove: false, + overrideItems: false + }, - /** - * set options - * @param {Object} options - * @return {Recognizer} - */ - set: function(options) { - assign(this.options, options); + groupEditable: { + order: false, + add: false, + remove: false + }, - // also update the touchAction, in case something changed about the directions/enabled state - this.manager && this.manager.touchAction.update(); - return this; - }, + snap: TimeStep.snap, - /** - * recognize simultaneous with an other recognizer. - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - recognizeWith: function(otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { - return this; - } + // Only called when `objectData.target === 'item'. + onDropObjectOnItem: function onDropObjectOnItem(objectData, item, callback) { + callback(item); + }, + onAdd: function onAdd(item, callback) { + callback(item); + }, + onUpdate: function onUpdate(item, callback) { + callback(item); + }, + onMove: function onMove(item, callback) { + callback(item); + }, + onRemove: function onRemove(item, callback) { + callback(item); + }, + onMoving: function onMoving(item, callback) { + callback(item); + }, + onAddGroup: function onAddGroup(item, callback) { + callback(item); + }, + onMoveGroup: function onMoveGroup(item, callback) { + callback(item); + }, + onRemoveGroup: function onRemoveGroup(item, callback) { + callback(item); + }, - var simultaneous = this.simultaneous; - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - if (!simultaneous[otherRecognizer.id]) { - simultaneous[otherRecognizer.id] = otherRecognizer; - otherRecognizer.recognizeWith(this); - } - return this; + margin: { + item: { + horizontal: 10, + vertical: 10 }, + axis: 20 + }, - /** - * drop the simultaneous link. it doesnt remove the link on the other recognizer. - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - dropRecognizeWith: function(otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { - return this; - } + showTooltips: true, - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - delete this.simultaneous[otherRecognizer.id]; - return this; - }, + tooltip: { + followMouse: false, + overflowMethod: 'flip' + }, - /** - * recognizer can only run when an other is failing - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - requireFailure: function(otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { - return this; - } + tooltipOnItemUpdateTime: false + }; - var requireFail = this.requireFail; - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - if (inArray(requireFail, otherRecognizer) === -1) { - requireFail.push(otherRecognizer); - otherRecognizer.requireFailure(this); - } - return this; - }, + // options is shared by this ItemSet and all its items + this.options = util.extend({}, this.defaultOptions); + this.options.rtl = options.rtl; - /** - * drop the requireFailure link. it does not remove the link on the other recognizer. - * @param {Recognizer} otherRecognizer - * @returns {Recognizer} this - */ - dropRequireFailure: function(otherRecognizer) { - if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { - return this; - } + // options for getting items from the DataSet with the correct type + this.itemOptions = { + type: { start: 'Date', end: 'Date' } + }; - otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); - var index = inArray(this.requireFail, otherRecognizer); - if (index > -1) { - this.requireFail.splice(index, 1); - } - return this; - }, + this.conversion = { + toScreen: body.util.toScreen, + toTime: body.util.toTime + }; + this.dom = {}; + this.props = {}; + this.hammer = null; - /** - * has require failures boolean - * @returns {boolean} - */ - hasRequireFailures: function() { - return this.requireFail.length > 0; - }, + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - /** - * if the recognizer can recognize simultaneous with an other recognizer - * @param {Recognizer} otherRecognizer - * @returns {Boolean} - */ - canRecognizeWith: function(otherRecognizer) { - return !!this.simultaneous[otherRecognizer.id]; - }, + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAdd(params.items); + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdate(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemove(params.items); + } + }; - /** - * You should use `tryEmit` instead of `emit` directly to check - * that all the needed recognizers has failed before emitting. - * @param {Object} input - */ - emit: function(input) { - var self = this; - var state = this.state; + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAddGroups(params.items); - function emit(event) { - self.manager.emit(event, input); + if (me.groupsData && me.groupsData.length > 0) { + var groupsData = me.groupsData.getDataSet(); + groupsData.get().forEach(function (groupData) { + if (groupData.nestedGroups) { + if (groupData.showNested != false) { + groupData.showNested = true; + } + var updatedGroups = []; + groupData.nestedGroups.forEach(function (nestedGroupId) { + var updatedNestedGroup = groupsData.get(nestedGroupId); + if (!updatedNestedGroup) { + return; + } + updatedNestedGroup.nestedInGroup = groupData.id; + if (groupData.showNested == false) { + updatedNestedGroup.visible = false; + } + updatedGroups = updatedGroups.concat(updatedNestedGroup); + }); + groupsData.update(updatedGroups, senderId); } + }); + } + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdateGroups(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemoveGroups(params.items); + } + }; - // 'panstart' and 'panmove' - if (state < STATE_ENDED) { - emit(self.options.event + stateStr(state)); - } + this.items = {}; // object with an Item for every data item + this.groups = {}; // Group object for every group + this.groupIds = []; - emit(self.options.event); // simple 'eventName' events + this.selection = []; // list with the ids of all selected nodes - if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...) - emit(input.additionalEvent); - } + this.popup = null; - // panend and pancancel - if (state >= STATE_ENDED) { - emit(self.options.event + stateStr(state)); - } - }, + this.touchParams = {}; // stores properties while dragging + this.groupTouchParams = {}; + // create the HTML DOM - /** - * Check that all the require failure recognizers has failed, - * if true, it emits a gesture event, - * otherwise, setup the state to FAILED. - * @param {Object} input - */ - tryEmit: function(input) { - if (this.canEmit()) { - return this.emit(input); - } - // it's failing anyway - this.state = STATE_FAILED; - }, + this._create(); - /** - * can we emit? - * @returns {boolean} - */ - canEmit: function() { - var i = 0; - while (i < this.requireFail.length) { - if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { - return false; - } - i++; - } - return true; - }, + this.setOptions(options); +} - /** - * update the recognizer - * @param {Object} inputData - */ - recognize: function(inputData) { - // make a new copy of the inputData - // so we can change the inputData without messing up the other recognizers - var inputDataClone = assign({}, inputData); - - // is is enabled and allow recognizing? - if (!boolOrFn(this.options.enable, [this, inputDataClone])) { - this.reset(); - this.state = STATE_FAILED; - return; - } +ItemSet.prototype = new Component(); - // reset when we've reached the end - if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { - this.state = STATE_POSSIBLE; - } +// available item types will be registered here +ItemSet.types = { + background: BackgroundItem, + box: BoxItem, + range: RangeItem, + point: PointItem +}; - this.state = this.process(inputDataClone); +/** + * Create the HTML DOM for the ItemSet + */ +ItemSet.prototype._create = function () { + var frame = document.createElement('div'); + frame.className = 'vis-itemset'; + frame['timeline-itemset'] = this; + this.dom.frame = frame; + + // create background panel + var background = document.createElement('div'); + background.className = 'vis-background'; + frame.appendChild(background); + this.dom.background = background; + + // create foreground panel + var foreground = document.createElement('div'); + foreground.className = 'vis-foreground'; + frame.appendChild(foreground); + this.dom.foreground = foreground; + + // create axis panel + var axis = document.createElement('div'); + axis.className = 'vis-axis'; + this.dom.axis = axis; + + // create labelset + var labelSet = document.createElement('div'); + labelSet.className = 'vis-labelset'; + this.dom.labelSet = labelSet; + + // create ungrouped Group + this._updateUngrouped(); + + // create background Group + var backgroundGroup = new BackgroundGroup(BACKGROUND, null, this); + backgroundGroup.show(); + this.groups[BACKGROUND] = backgroundGroup; + + // attach event listeners + // Note: we bind to the centerContainer for the case where the height + // of the center container is larger than of the ItemSet, so we + // can click in the empty area to create a new item or deselect an item. + this.hammer = new Hammer(this.body.dom.centerContainer); + + // drag items when selected + this.hammer.on('hammer.input', function (event) { + if (event.isFirst) { + this._onTouch(event); + } + }.bind(this)); + this.hammer.on('panstart', this._onDragStart.bind(this)); + this.hammer.on('panmove', this._onDrag.bind(this)); + this.hammer.on('panend', this._onDragEnd.bind(this)); + this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL }); + + // single select (or unselect) when tapping an item + this.hammer.on('tap', this._onSelectItem.bind(this)); + + // multi select when holding mouse/touch, or on ctrl+click + this.hammer.on('press', this._onMultiSelectItem.bind(this)); + + // add item on doubletap + this.hammer.on('doubletap', this._onAddItem.bind(this)); + + if (this.options.rtl) { + this.groupHammer = new Hammer(this.body.dom.rightContainer); + } else { + this.groupHammer = new Hammer(this.body.dom.leftContainer); + } - // the recognizer has recognized a gesture - // so trigger an event - if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { - this.tryEmit(inputDataClone); - } - }, + this.groupHammer.on('tap', this._onGroupClick.bind(this)); + this.groupHammer.on('panstart', this._onGroupDragStart.bind(this)); + this.groupHammer.on('panmove', this._onGroupDrag.bind(this)); + this.groupHammer.on('panend', this._onGroupDragEnd.bind(this)); + this.groupHammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_VERTICAL }); - /** - * return the state of the recognizer - * the actual recognizing happens in this method - * @virtual - * @param {Object} inputData - * @returns {Const} STATE - */ - process: function(inputData) { }, // jshint ignore:line + this.body.dom.centerContainer.addEventListener('mouseover', this._onMouseOver.bind(this)); + this.body.dom.centerContainer.addEventListener('mouseout', this._onMouseOut.bind(this)); + this.body.dom.centerContainer.addEventListener('mousemove', this._onMouseMove.bind(this)); + // right-click on timeline + this.body.dom.centerContainer.addEventListener('contextmenu', this._onDragEnd.bind(this)); - /** - * return the preferred touch-action - * @virtual - * @returns {Array} - */ - getTouchAction: function() { }, + this.body.dom.centerContainer.addEventListener('mousewheel', this._onMouseWheel.bind(this)); - /** - * called when the gesture isn't allowed to recognize - * like when another is being recognized or it is disabled - * @virtual - */ - reset: function() { } - }; + // attach to the DOM + this.show(); +}; - /** - * get a usable string, used as event postfix - * @param {Const} state - * @returns {String} state - */ - function stateStr(state) { - if (state & STATE_CANCELLED) { - return 'cancel'; - } else if (state & STATE_ENDED) { - return 'end'; - } else if (state & STATE_CHANGED) { - return 'move'; - } else if (state & STATE_BEGAN) { - return 'start'; +/** + * Set options for the ItemSet. Existing options will be extended/overwritten. + * @param {Object} [options] The following options are available: + * {string} type + * Default type for the items. Choose from 'box' + * (default), 'point', 'range', or 'background'. + * The default style can be overwritten by + * individual items. + * {string} align + * Alignment for the items, only applicable for + * BoxItem. Choose 'center' (default), 'left', or + * 'right'. + * {string} orientation.item + * Orientation of the item set. Choose 'top' or + * 'bottom' (default). + * {Function} groupOrder + * A sorting function for ordering groups + * {boolean} stack + * If true (default), items will be stacked on + * top of each other. + * {number} margin.axis + * Margin between the axis and the items in pixels. + * Default is 20. + * {number} margin.item.horizontal + * Horizontal margin between items in pixels. + * Default is 10. + * {number} margin.item.vertical + * Vertical Margin between items in pixels. + * Default is 10. + * {number} margin.item + * Margin between items in pixels in both horizontal + * and vertical direction. Default is 10. + * {number} margin + * Set margin for both axis and items in pixels. + * {boolean} selectable + * If true (default), items can be selected. + * {boolean} multiselect + * If true, multiple items can be selected. + * False by default. + * {boolean} editable + * Set all editable options to true or false + * {boolean} editable.updateTime + * Allow dragging an item to an other moment in time + * {boolean} editable.updateGroup + * Allow dragging an item to an other group + * {boolean} editable.add + * Allow creating new items on double tap + * {boolean} editable.remove + * Allow removing items by clicking the delete button + * top right of a selected item. + * {Function(item: Item, callback: Function)} onAdd + * Callback function triggered when an item is about to be added: + * when the user double taps an empty space in the Timeline. + * {Function(item: Item, callback: Function)} onUpdate + * Callback function fired when an item is about to be updated. + * This function typically has to show a dialog where the user + * change the item. If not implemented, nothing happens. + * {Function(item: Item, callback: Function)} onMove + * Fired when an item has been moved. If not implemented, + * the move action will be accepted. + * {Function(item: Item, callback: Function)} onRemove + * Fired when an item is about to be deleted. + * If not implemented, the item will be always removed. + */ +ItemSet.prototype.setOptions = function (options) { + if (options) { + // copy all options that we know + var fields = ['type', 'rtl', 'align', 'order', 'stack', 'stackSubgroups', 'selectable', 'multiselect', 'multiselectPerGroup', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'visibleFrameTemplate', 'hide', 'snap', 'groupOrderSwap', 'showTooltips', 'tooltip', 'tooltipOnItemUpdateTime']; + util.selectiveExtend(fields, this.options, options); + + if ('itemsAlwaysDraggable' in options) { + if (typeof options.itemsAlwaysDraggable === 'boolean') { + this.options.itemsAlwaysDraggable.item = options.itemsAlwaysDraggable; + this.options.itemsAlwaysDraggable.range = false; + } else if ((0, _typeof3['default'])(options.itemsAlwaysDraggable) === 'object') { + util.selectiveExtend(['item', 'range'], this.options.itemsAlwaysDraggable, options.itemsAlwaysDraggable); + // only allow range always draggable when item is always draggable as well + if (!this.options.itemsAlwaysDraggable.item) { + this.options.itemsAlwaysDraggable.range = false; + } } - return ''; - } + } - /** - * direction cons to string - * @param {Const} direction - * @returns {String} - */ - function directionStr(direction) { - if (direction == DIRECTION_DOWN) { - return 'down'; - } else if (direction == DIRECTION_UP) { - return 'up'; - } else if (direction == DIRECTION_LEFT) { - return 'left'; - } else if (direction == DIRECTION_RIGHT) { - return 'right'; + if ('orientation' in options) { + if (typeof options.orientation === 'string') { + this.options.orientation.item = options.orientation === 'top' ? 'top' : 'bottom'; + } else if ((0, _typeof3['default'])(options.orientation) === 'object' && 'item' in options.orientation) { + this.options.orientation.item = options.orientation.item; } - return ''; - } + } - /** - * get a recognizer by name if it is bound to a manager - * @param {Recognizer|String} otherRecognizer - * @param {Recognizer} recognizer - * @returns {Recognizer} - */ - function getRecognizerByNameIfManager(otherRecognizer, recognizer) { - var manager = recognizer.manager; - if (manager) { - return manager.get(otherRecognizer); + if ('margin' in options) { + if (typeof options.margin === 'number') { + this.options.margin.axis = options.margin; + this.options.margin.item.horizontal = options.margin; + this.options.margin.item.vertical = options.margin; + } else if ((0, _typeof3['default'])(options.margin) === 'object') { + util.selectiveExtend(['axis'], this.options.margin, options.margin); + if ('item' in options.margin) { + if (typeof options.margin.item === 'number') { + this.options.margin.item.horizontal = options.margin.item; + this.options.margin.item.vertical = options.margin.item; + } else if ((0, _typeof3['default'])(options.margin.item) === 'object') { + util.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item); + } + } } - return otherRecognizer; - } - - /** - * This recognizer is just used as a base for the simple attribute recognizers. - * @constructor - * @extends Recognizer - */ - function AttrRecognizer() { - Recognizer.apply(this, arguments); - } + } - inherit(AttrRecognizer, Recognizer, { - /** - * @namespace - * @memberof AttrRecognizer - */ - defaults: { - /** - * @type {Number} - * @default 1 - */ - pointers: 1 - }, + if ('editable' in options) { + if (typeof options.editable === 'boolean') { + this.options.editable.updateTime = options.editable; + this.options.editable.updateGroup = options.editable; + this.options.editable.add = options.editable; + this.options.editable.remove = options.editable; + this.options.editable.overrideItems = false; + } else if ((0, _typeof3['default'])(options.editable) === 'object') { + util.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove', 'overrideItems'], this.options.editable, options.editable); + } + } - /** - * Used to check if it the recognizer receives valid input, like input.distance > 10. - * @memberof AttrRecognizer - * @param {Object} input - * @returns {Boolean} recognized - */ - attrTest: function(input) { - var optionPointers = this.options.pointers; - return optionPointers === 0 || input.pointers.length === optionPointers; - }, + if ('groupEditable' in options) { + if (typeof options.groupEditable === 'boolean') { + this.options.groupEditable.order = options.groupEditable; + this.options.groupEditable.add = options.groupEditable; + this.options.groupEditable.remove = options.groupEditable; + } else if ((0, _typeof3['default'])(options.groupEditable) === 'object') { + util.selectiveExtend(['order', 'add', 'remove'], this.options.groupEditable, options.groupEditable); + } + } - /** - * Process the input and return the state for the recognizer - * @memberof AttrRecognizer - * @param {Object} input - * @returns {*} State - */ - process: function(input) { - var state = this.state; - var eventType = input.eventType; - - var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); - var isValid = this.attrTest(input); - - // on cancel input and we've recognized before, return STATE_CANCELLED - if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { - return state | STATE_CANCELLED; - } else if (isRecognized || isValid) { - if (eventType & INPUT_END) { - return state | STATE_ENDED; - } else if (!(state & STATE_BEGAN)) { - return STATE_BEGAN; - } - return state | STATE_CHANGED; - } - return STATE_FAILED; + // callback functions + var addCallback = function (name) { + var fn = options[name]; + if (fn) { + if (!(fn instanceof Function)) { + throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)'); + } + this.options[name] = fn; } - }); + }.bind(this); + ['onDropObjectOnItem', 'onAdd', 'onUpdate', 'onRemove', 'onMove', 'onMoving', 'onAddGroup', 'onMoveGroup', 'onRemoveGroup'].forEach(addCallback); - /** - * Pan - * Recognized when the pointer is down and moved in the allowed direction. - * @constructor - * @extends AttrRecognizer - */ - function PanRecognizer() { - AttrRecognizer.apply(this, arguments); + // force the itemSet to refresh: options like orientation and margins may be changed + this.markDirty(); + } +}; - this.pX = null; - this.pY = null; +/** + * Mark the ItemSet dirty so it will refresh everything with next redraw. + * Optionally, all items can be marked as dirty and be refreshed. + * @param {{refreshItems: boolean}} [options] + */ +ItemSet.prototype.markDirty = function (options) { + this.groupIds = []; + + if (options && options.refreshItems) { + util.forEach(this.items, function (item) { + item.dirty = true; + if (item.displayed) item.redraw(); + }); } +}; - inherit(PanRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof PanRecognizer - */ - defaults: { - event: 'pan', - threshold: 10, - pointers: 1, - direction: DIRECTION_ALL - }, +/** + * Destroy the ItemSet + */ +ItemSet.prototype.destroy = function () { + this.hide(); + this.setItems(null); + this.setGroups(null); - getTouchAction: function() { - var direction = this.options.direction; - var actions = []; - if (direction & DIRECTION_HORIZONTAL) { - actions.push(TOUCH_ACTION_PAN_Y); - } - if (direction & DIRECTION_VERTICAL) { - actions.push(TOUCH_ACTION_PAN_X); - } - return actions; - }, + this.hammer = null; - directionTest: function(input) { - var options = this.options; - var hasMoved = true; - var distance = input.distance; - var direction = input.direction; - var x = input.deltaX; - var y = input.deltaY; - - // lock to axis? - if (!(direction & options.direction)) { - if (options.direction & DIRECTION_HORIZONTAL) { - direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; - hasMoved = x != this.pX; - distance = Math.abs(input.deltaX); - } else { - direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; - hasMoved = y != this.pY; - distance = Math.abs(input.deltaY); - } - } - input.direction = direction; - return hasMoved && distance > options.threshold && direction & options.direction; - }, + this.body = null; + this.conversion = null; +}; - attrTest: function(input) { - return AttrRecognizer.prototype.attrTest.call(this, input) && - (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); - }, +/** + * Hide the component from the DOM + */ +ItemSet.prototype.hide = function () { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } - emit: function(input) { + // remove the axis with dots + if (this.dom.axis.parentNode) { + this.dom.axis.parentNode.removeChild(this.dom.axis); + } - this.pX = input.deltaX; - this.pY = input.deltaY; + // remove the labelset containing all group labels + if (this.dom.labelSet.parentNode) { + this.dom.labelSet.parentNode.removeChild(this.dom.labelSet); + } +}; - var direction = directionStr(input.direction); +/** + * Show the component in the DOM (when not already visible). + */ +ItemSet.prototype.show = function () { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } - if (direction) { - input.additionalEvent = this.options.event + direction; - } - this._super.emit.call(this, input); - } - }); + // show axis with dots + if (!this.dom.axis.parentNode) { + this.body.dom.backgroundVertical.appendChild(this.dom.axis); + } - /** - * Pinch - * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). - * @constructor - * @extends AttrRecognizer - */ - function PinchRecognizer() { - AttrRecognizer.apply(this, arguments); + // show labelset containing labels + if (!this.dom.labelSet.parentNode) { + if (this.options.rtl) { + this.body.dom.right.appendChild(this.dom.labelSet); + } else { + this.body.dom.left.appendChild(this.dom.labelSet); + } } +}; - inherit(PinchRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof PinchRecognizer - */ - defaults: { - event: 'pinch', - threshold: 0, - pointers: 2 - }, +/** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {string[] | string} [ids] An array with zero or more id's of the items to be + * selected, or a single item id. If ids is undefined + * or an empty array, all items will be unselected. + */ +ItemSet.prototype.setSelection = function (ids) { + var i, ii, id, item; + + if (ids == undefined) ids = []; + if (!Array.isArray(ids)) ids = [ids]; + + // unselect currently selected items + for (i = 0, ii = this.selection.length; i < ii; i++) { + id = this.selection[i]; + item = this.items[id]; + if (item) item.unselect(); + } + + // select items + this.selection = []; + for (i = 0, ii = ids.length; i < ii; i++) { + id = ids[i]; + item = this.items[id]; + if (item) { + this.selection.push(id); + item.select(); + } + } +}; - getTouchAction: function() { - return [TOUCH_ACTION_NONE]; - }, +/** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ +ItemSet.prototype.getSelection = function () { + return this.selection.concat([]); +}; - attrTest: function(input) { - return this._super.attrTest.call(this, input) && - (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); - }, +/** + * Get the id's of the currently visible items. + * @returns {Array} The ids of the visible items + */ +ItemSet.prototype.getVisibleItems = function () { + var range = this.body.range.getRange(); + var right, left; + + if (this.options.rtl) { + right = this.body.util.toScreen(range.start); + left = this.body.util.toScreen(range.end); + } else { + left = this.body.util.toScreen(range.start); + right = this.body.util.toScreen(range.end); + } - emit: function(input) { - if (input.scale !== 1) { - var inOut = input.scale < 1 ? 'in' : 'out'; - input.additionalEvent = this.options.event + inOut; + var ids = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + var rawVisibleItems = group.isVisible ? group.visibleItems : []; + + // filter the "raw" set with visibleItems into a set which is really + // visible by pixels + for (var i = 0; i < rawVisibleItems.length; i++) { + var item = rawVisibleItems[i]; + // TODO: also check whether visible vertically + if (this.options.rtl) { + if (item.right < left && item.right + item.width > right) { + ids.push(item.id); } - this._super.emit.call(this, input); + } else { + if (item.left < right && item.left + item.width > left) { + ids.push(item.id); + } + } } - }); + } + } - /** - * Press - * Recognized when the pointer is down for x ms without any movement. - * @constructor - * @extends Recognizer - */ - function PressRecognizer() { - Recognizer.apply(this, arguments); + return ids; +}; - this._timer = null; - this._input = null; +/** + * Deselect a selected item + * @param {string | number} id + * @private + */ +ItemSet.prototype._deselect = function (id) { + var selection = this.selection; + for (var i = 0, ii = selection.length; i < ii; i++) { + if (selection[i] == id) { + // non-strict comparison! + selection.splice(i, 1); + break; + } } +}; - inherit(PressRecognizer, Recognizer, { - /** - * @namespace - * @memberof PressRecognizer - */ - defaults: { - event: 'press', - pointers: 1, - time: 251, // minimal time of the pointer to be pressed - threshold: 9 // a minimal movement is ok, but keep it low - }, - - getTouchAction: function() { - return [TOUCH_ACTION_AUTO]; - }, - - process: function(input) { - var options = this.options; - var validPointers = input.pointers.length === options.pointers; - var validMovement = input.distance < options.threshold; - var validTime = input.deltaTime > options.time; - - this._input = input; - - // we only allow little movement - // and we've reached an end event, so a tap is possible - if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { - this.reset(); - } else if (input.eventType & INPUT_START) { - this.reset(); - this._timer = setTimeoutContext(function() { - this.state = STATE_RECOGNIZED; - this.tryEmit(); - }, options.time, this); - } else if (input.eventType & INPUT_END) { - return STATE_RECOGNIZED; - } - return STATE_FAILED; - }, - - reset: function() { - clearTimeout(this._timer); - }, +/** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ +ItemSet.prototype.redraw = function () { + var margin = this.options.margin, + range = this.body.range, + asSize = util.option.asSize, + options = this.options, + orientation = options.orientation.item, + resized = false, + frame = this.dom.frame; + + // recalculate absolute position (before redrawing groups) + this.props.top = this.body.domProps.top.height + this.body.domProps.border.top; + + if (this.options.rtl) { + this.props.right = this.body.domProps.right.width + this.body.domProps.border.right; + } else { + this.props.left = this.body.domProps.left.width + this.body.domProps.border.left; + } + + // update class name + frame.className = 'vis-itemset'; + + // reorder the groups (if needed) + resized = this._orderGroups() || resized; + + // check whether zoomed (in that case we need to re-stack everything) + // TODO: would be nicer to get this as a trigger from Range + var visibleInterval = range.end - range.start; + var zoomed = visibleInterval != this.lastVisibleInterval || this.props.width != this.props.lastWidth; + var scrolled = range.start != this.lastRangeStart; + var changedStackOption = options.stack != this.lastStack; + var changedStackSubgroupsOption = options.stackSubgroups != this.lastStackSubgroups; + var forceRestack = zoomed || scrolled || changedStackOption || changedStackSubgroupsOption; + this.lastVisibleInterval = visibleInterval; + this.lastRangeStart = range.start; + this.lastStack = options.stack; + this.lastStackSubgroups = options.stackSubgroups; + + this.props.lastWidth = this.props.width; + + var firstGroup = this._firstGroup(); + var firstMargin = { + item: margin.item, + axis: margin.axis + }; + var nonFirstMargin = { + item: margin.item, + axis: margin.item.vertical / 2 + }; + var height = 0; + var minHeight = margin.axis + margin.item.vertical; + + // redraw the background group + this.groups[BACKGROUND].redraw(range, nonFirstMargin, forceRestack); + + var redrawQueue = {}; + var redrawQueueLength = 0; + + // collect redraw functions + util.forEach(this.groups, function (group, key) { + if (key === BACKGROUND) return; + var groupMargin = group == firstGroup ? firstMargin : nonFirstMargin; + var returnQueue = true; + redrawQueue[key] = group.redraw(range, groupMargin, forceRestack, returnQueue); + redrawQueueLength = redrawQueue[key].length; + }); - emit: function(input) { - if (this.state !== STATE_RECOGNIZED) { - return; - } + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + var redrawResults = {}; - if (input && (input.eventType & INPUT_END)) { - this.manager.emit(this.options.event + 'up', input); - } else { - this._input.timeStamp = now(); - this.manager.emit(this.options.event, this._input); - } - } - }); + for (var i = 0; i < redrawQueueLength; i++) { + util.forEach(redrawQueue, function (fns, key) { + redrawResults[key] = fns[i](); + }); + } - /** - * Rotate - * Recognized when two or more pointer are moving in a circular motion. - * @constructor - * @extends AttrRecognizer - */ - function RotateRecognizer() { - AttrRecognizer.apply(this, arguments); + // redraw all regular groups + util.forEach(this.groups, function (group, key) { + if (key === BACKGROUND) return; + var groupResized = redrawResults[key]; + resized = groupResized || resized; + height += group.height; + }); + height = Math.max(height, minHeight); } - inherit(RotateRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof RotateRecognizer - */ - defaults: { - event: 'rotate', - threshold: 0, - pointers: 2 - }, + height = Math.max(height, minHeight); - getTouchAction: function() { - return [TOUCH_ACTION_NONE]; - }, + // update frame height + frame.style.height = asSize(height); - attrTest: function(input) { - return this._super.attrTest.call(this, input) && - (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); - } - }); + // calculate actual size + this.props.width = frame.offsetWidth; + this.props.height = height; - /** - * Swipe - * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. - * @constructor - * @extends AttrRecognizer - */ - function SwipeRecognizer() { - AttrRecognizer.apply(this, arguments); + // reposition axis + this.dom.axis.style.top = asSize(orientation == 'top' ? this.body.domProps.top.height + this.body.domProps.border.top : this.body.domProps.top.height + this.body.domProps.centerContainer.height); + if (this.options.rtl) { + this.dom.axis.style.right = '0'; + } else { + this.dom.axis.style.left = '0'; } - inherit(SwipeRecognizer, AttrRecognizer, { - /** - * @namespace - * @memberof SwipeRecognizer - */ - defaults: { - event: 'swipe', - threshold: 10, - velocity: 0.3, - direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, - pointers: 1 - }, - - getTouchAction: function() { - return PanRecognizer.prototype.getTouchAction.call(this); - }, - - attrTest: function(input) { - var direction = this.options.direction; - var velocity; + this.initialItemSetDrawn = true; + // check if this component is resized + resized = this._isResized() || resized; - if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { - velocity = input.overallVelocity; - } else if (direction & DIRECTION_HORIZONTAL) { - velocity = input.overallVelocityX; - } else if (direction & DIRECTION_VERTICAL) { - velocity = input.overallVelocityY; - } + return resized; +}; - return this._super.attrTest.call(this, input) && - direction & input.offsetDirection && - input.distance > this.options.threshold && - input.maxPointers == this.options.pointers && - abs(velocity) > this.options.velocity && input.eventType & INPUT_END; - }, +/** + * Get the first group, aligned with the axis + * @return {Group | null} firstGroup + * @private + */ +ItemSet.prototype._firstGroup = function () { + var firstGroupIndex = this.options.orientation.item == 'top' ? 0 : this.groupIds.length - 1; + var firstGroupId = this.groupIds[firstGroupIndex]; + var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED]; + + return firstGroup || null; +}; - emit: function(input) { - var direction = directionStr(input.offsetDirection); - if (direction) { - this.manager.emit(this.options.event + direction, input); - } +/** + * Create or delete the group holding all ungrouped items. This group is used when + * there are no groups specified. + * @protected + */ +ItemSet.prototype._updateUngrouped = function () { + var ungrouped = this.groups[UNGROUPED]; + var item, itemId; + + if (this.groupsData) { + // remove the group holding all ungrouped items + if (ungrouped) { + ungrouped.hide(); + delete this.groups[UNGROUPED]; + + for (itemId in this.items) { + if (this.items.hasOwnProperty(itemId)) { + item = this.items[itemId]; + item.parent && item.parent.remove(item); + var groupId = this._getGroupId(item.data); + var group = this.groups[groupId]; + group && group.add(item) || item.hide(); + } + } + } + } else { + // create a group holding all (unfiltered) items + if (!ungrouped) { + var id = null; + var data = null; + ungrouped = new Group(id, data, this); + this.groups[UNGROUPED] = ungrouped; - this.manager.emit(this.options.event, input); + for (itemId in this.items) { + if (this.items.hasOwnProperty(itemId)) { + item = this.items[itemId]; + ungrouped.add(item); + } } - }); - /** - * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur - * between the given interval and position. The delay option can be used to recognize multi-taps without firing - * a single tap. - * - * The eventData from the emitted event contains the property `tapCount`, which contains the amount of - * multi-taps being recognized. - * @constructor - * @extends Recognizer - */ - function TapRecognizer() { - Recognizer.apply(this, arguments); + ungrouped.show(); + } + } +}; - // previous time and center, - // used for tap counting - this.pTime = false; - this.pCenter = false; +/** + * Get the element for the labelset + * @return {HTMLElement} labelSet + */ +ItemSet.prototype.getLabelSet = function () { + return this.dom.labelSet; +}; - this._timer = null; - this._input = null; - this.count = 0; +/** + * Set items + * @param {vis.DataSet | null} items + */ +ItemSet.prototype.setItems = function (items) { + var me = this, + ids, + oldItemsData = this.itemsData; + + // replace the dataset + if (!items) { + this.itemsData = null; + } else if (items instanceof DataSet || items instanceof DataView) { + this.itemsData = items; + } else { + throw new TypeError('Data must be an instance of DataSet or DataView'); } - inherit(TapRecognizer, Recognizer, { - /** - * @namespace - * @memberof PinchRecognizer - */ - defaults: { - event: 'tap', - pointers: 1, - taps: 1, - interval: 300, // max time between the multi-tap taps - time: 250, // max time of the pointer to be down (like finger on the screen) - threshold: 9, // a minimal movement is ok, but keep it low - posThreshold: 10 // a multi-tap can be a bit off the initial position - }, + if (oldItemsData) { + // unsubscribe from old dataset + util.forEach(this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); - getTouchAction: function() { - return [TOUCH_ACTION_MANIPULATION]; - }, + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } - process: function(input) { - var options = this.options; + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); - var validPointers = input.pointers.length === options.pointers; - var validMovement = input.distance < options.threshold; - var validTouchTime = input.deltaTime < options.time; + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); - this.reset(); + // update the group holding all ungrouped items + this._updateUngrouped(); + } - if ((input.eventType & INPUT_START) && (this.count === 0)) { - return this.failTimeout(); - } + this.body.emitter.emit('_change', { queue: true }); +}; - // we only allow little movement - // and we've reached an end event, so a tap is possible - if (validMovement && validTouchTime && validPointers) { - if (input.eventType != INPUT_END) { - return this.failTimeout(); - } +/** + * Get the current items + * @returns {vis.DataSet | null} + */ +ItemSet.prototype.getItems = function () { + return this.itemsData; +}; - var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; - var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; +/** + * Set groups + * @param {vis.DataSet} groups + */ +ItemSet.prototype.setGroups = function (groups) { + var me = this, + ids; + + // unsubscribe from current dataset + if (this.groupsData) { + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.off(event, callback); + }); - this.pTime = input.timeStamp; - this.pCenter = input.center; + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + this._onRemoveGroups(ids); // note: this will cause a redraw + } - if (!validMultiTap || !validInterval) { - this.count = 1; - } else { - this.count += 1; - } + // replace the dataset + if (!groups) { + this.groupsData = null; + } else if (groups instanceof DataSet || groups instanceof DataView) { + this.groupsData = groups; + } else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } - this._input = input; + if (this.groupsData) { + // go over all groups nesting + var groupsData = this.groupsData; + if (this.groupsData instanceof DataView) { + groupsData = this.groupsData.getDataSet(); + } - // if tap count matches we have recognized it, - // else it has began recognizing... - var tapCount = this.count % options.taps; - if (tapCount === 0) { - // no failing requirements, immediately trigger the tap event - // or wait as long as the multitap interval to trigger - if (!this.hasRequireFailures()) { - return STATE_RECOGNIZED; - } else { - this._timer = setTimeoutContext(function() { - this.state = STATE_RECOGNIZED; - this.tryEmit(); - }, options.interval, this); - return STATE_BEGAN; - } - } + groupsData.get().forEach(function (group) { + if (group.nestedGroups) { + group.nestedGroups.forEach(function (nestedGroupId) { + var updatedNestedGroup = groupsData.get(nestedGroupId); + updatedNestedGroup.nestedInGroup = group.id; + if (group.showNested == false) { + updatedNestedGroup.visible = false; } - return STATE_FAILED; - }, + groupsData.update(updatedNestedGroup); + }); + } + }); - failTimeout: function() { - this._timer = setTimeoutContext(function() { - this.state = STATE_FAILED; - }, this.options.interval, this); - return STATE_FAILED; - }, + // subscribe to new dataset + var id = this.id; + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); - reset: function() { - clearTimeout(this._timer); - }, + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); + } - emit: function() { - if (this.state == STATE_RECOGNIZED) { - this._input.tapCount = this.count; - this.manager.emit(this.options.event, this._input); - } - } - }); + // update the group holding all ungrouped items + this._updateUngrouped(); - /** - * Simple way to create a manager with a default set of recognizers. - * @param {HTMLElement} element - * @param {Object} [options] - * @constructor - */ - function Hammer(element, options) { - options = options || {}; - options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); - return new Manager(element, options); + // update the order of all items in each group + this._order(); + + this.body.emitter.emit('_change', { queue: true }); +}; + +/** + * Get the current groups + * @returns {vis.DataSet | null} groups + */ +ItemSet.prototype.getGroups = function () { + return this.groupsData; +}; + +/** + * Remove an item by its id + * @param {string | number} id + */ +ItemSet.prototype.removeItem = function (id) { + var item = this.itemsData.get(id), + dataset = this.itemsData.getDataSet(); + + if (item) { + // confirm deletion + this.options.onRemove(item, function (item) { + if (item) { + // remove by id here, it is possible that an item has no id defined + // itself, so better not delete by the item itself + dataset.remove(id); + } + }); } +}; - /** - * @const {string} - */ - Hammer.VERSION = '2.0.7'; +/** + * Get the time of an item based on it's data and options.type + * @param {Object} itemData + * @returns {string} Returns the type + * @private + */ +ItemSet.prototype._getType = function (itemData) { + return itemData.type || this.options.type || (itemData.end ? 'range' : 'box'); +}; - /** - * default settings - * @namespace - */ - Hammer.defaults = { - /** - * set if DOM events are being triggered. - * But this is slower and unused by simple implementations, so disabled by default. - * @type {Boolean} - * @default false - */ - domEvents: false, +/** + * Get the group id for an item + * @param {Object} itemData + * @returns {string} Returns the groupId + * @private + */ +ItemSet.prototype._getGroupId = function (itemData) { + var type = this._getType(itemData); + if (type == 'background' && itemData.group == undefined) { + return BACKGROUND; + } else { + return this.groupsData ? itemData.group : UNGROUPED; + } +}; - /** - * The value for the touchAction property/fallback. - * When set to `compute` it will magically set the correct value based on the added recognizers. - * @type {String} - * @default compute - */ - touchAction: TOUCH_ACTION_COMPUTE, +/** + * Handle updated items + * @param {number[]} ids + * @protected + */ +ItemSet.prototype._onUpdate = function (ids) { + var me = this; - /** - * @type {Boolean} - * @default true - */ - enable: true, - - /** - * EXPERIMENTAL FEATURE -- can be removed/changed - * Change the parent input target element. - * If Null, then it is being set the to main element. - * @type {Null|EventTarget} - * @default null - */ - inputTarget: null, + ids.forEach(function (id) { + var itemData = me.itemsData.get(id, me.itemOptions); + var item = me.items[id]; + var type = itemData ? me._getType(itemData) : null; - /** - * force an input class - * @type {Null|Function} - * @default null - */ - inputClass: null, + var constructor = ItemSet.types[type]; + var selected; - /** - * Default recognizer setup when calling `Hammer()` - * When creating a new Manager these will be skipped. - * @type {Array} - */ - preset: [ - // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] - [RotateRecognizer, {enable: false}], - [PinchRecognizer, {enable: false}, ['rotate']], - [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}], - [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']], - [TapRecognizer], - [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']], - [PressRecognizer] - ], - - /** - * Some CSS properties can be used to improve the working of Hammer. - * Add them to this method and they will be set when creating a new Manager. - * @namespace - */ - cssProps: { - /** - * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. - * @type {String} - * @default 'none' - */ - userSelect: 'none', - - /** - * Disable the Windows Phone grippers when pressing an element. - * @type {String} - * @default 'none' - */ - touchSelect: 'none', - - /** - * Disables the default callout shown when you touch and hold a touch target. - * On iOS, when you touch and hold a touch target such as a link, Safari displays - * a callout containing information about the link. This property allows you to disable that callout. - * @type {String} - * @default 'none' - */ - touchCallout: 'none', - - /** - * Specifies whether zooming is enabled. Used by IE10> - * @type {String} - * @default 'none' - */ - contentZooming: 'none', - - /** - * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. - * @type {String} - * @default 'none' - */ - userDrag: 'none', - - /** - * Overrides the highlight color shown when the user taps a link or a JavaScript - * clickable element in iOS. This property obeys the alpha value, if specified. - * @type {String} - * @default 'rgba(0,0,0,0)' - */ - tapHighlightColor: 'rgba(0,0,0,0)' + if (item) { + // update item + if (!constructor || !(item instanceof constructor)) { + // item type has changed, delete the item and recreate it + selected = item.selected; // preserve selection of this item + me._removeItem(item); + item = null; + } else { + me._updateItem(item, itemData); } - }; - - var STOP = 1; - var FORCED_STOP = 2; + } - /** - * Manager - * @param {HTMLElement} element - * @param {Object} [options] - * @constructor - */ - function Manager(element, options) { - this.options = assign({}, Hammer.defaults, options || {}); + if (!item && itemData) { + // create item + if (constructor) { + item = new constructor(itemData, me.conversion, me.options); + item.id = id; // TODO: not so nice setting id afterwards - this.options.inputTarget = this.options.inputTarget || element; + me._addItem(item); + if (selected) { + this.selection.push(id); + item.select(); + } + } else if (type == 'rangeoverflow') { + // TODO: deprecated since version 2.1.0 (or 3.0.0?). cleanup some day + throw new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: ' + '.vis-item.vis-range .vis-item-content {overflow: visible;}'); + } else { + throw new TypeError('Unknown item type "' + type + '"'); + } + } + }.bind(this)); - this.handlers = {}; - this.session = {}; - this.recognizers = []; - this.oldCssProps = {}; + this._order(); + this.body.emitter.emit('_change', { queue: true }); +}; - this.element = element; - this.input = createInputInstance(this); - this.touchAction = new TouchAction(this, this.options.touchAction); +/** + * Handle added items + * @param {number[]} ids + * @protected + */ +ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate; - toggleCssProps(this, true); +/** + * Handle removed items + * @param {number[]} ids + * @protected + */ +ItemSet.prototype._onRemove = function (ids) { + var count = 0; + var me = this; + ids.forEach(function (id) { + var item = me.items[id]; + if (item) { + count++; + me._removeItem(item); + } + }); - each(this.options.recognizers, function(item) { - var recognizer = this.add(new (item[0])(item[1])); - item[2] && recognizer.recognizeWith(item[2]); - item[3] && recognizer.requireFailure(item[3]); - }, this); + if (count) { + // update order + this._order(); + this.body.emitter.emit('_change', { queue: true }); } +}; - Manager.prototype = { - /** - * set options - * @param {Object} options - * @returns {Manager} - */ - set: function(options) { - assign(this.options, options); +/** + * Update the order of item in all groups + * @private + */ +ItemSet.prototype._order = function () { + // reorder the items in all groups + // TODO: optimization: only reorder groups affected by the changed items + util.forEach(this.groups, function (group) { + group.order(); + }); +}; - // Options that need a little more setup - if (options.touchAction) { - this.touchAction.update(); - } - if (options.inputTarget) { - // Clean up existing event listeners and reinitialize - this.input.destroy(); - this.input.target = options.inputTarget; - this.input.init(); - } - return this; - }, +/** + * Handle updated groups + * @param {number[]} ids + * @private + */ +ItemSet.prototype._onUpdateGroups = function (ids) { + this._onAddGroups(ids); +}; - /** - * stop recognizing for this session. - * This session will be discarded, when a new [input]start event is fired. - * When forced, the recognizer cycle is stopped immediately. - * @param {Boolean} [force] - */ - stop: function(force) { - this.session.stopped = force ? FORCED_STOP : STOP; - }, +/** + * Handle changed groups (added or updated) + * @param {number[]} ids + * @private + */ +ItemSet.prototype._onAddGroups = function (ids) { + var me = this; - /** - * run the recognizers! - * called by the inputHandler function on every movement of the pointers (touches) - * it walks through all the recognizers and tries to detect the gesture that is being made - * @param {Object} inputData - */ - recognize: function(inputData) { - var session = this.session; - if (session.stopped) { - return; - } + ids.forEach(function (id) { + var groupData = me.groupsData.get(id); + var group = me.groups[id]; - // run the touch-action polyfill - this.touchAction.preventDefaults(inputData); + if (!group) { + // check for reserved ids + if (id == UNGROUPED || id == BACKGROUND) { + throw new Error('Illegal group id. ' + id + ' is a reserved id.'); + } - var recognizer; - var recognizers = this.recognizers; + var groupOptions = (0, _create2['default'])(me.options); + util.extend(groupOptions, { + height: null + }); - // this holds the recognizer that is being recognized. - // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED - // if no recognizer is detecting a thing, it is set to `null` - var curRecognizer = session.curRecognizer; + group = new Group(id, groupData, me); + me.groups[id] = group; - // reset when the last recognizer is recognized - // or when we're in a new session - if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { - curRecognizer = session.curRecognizer = null; + // add items with this groupId to the new group + for (var itemId in me.items) { + if (me.items.hasOwnProperty(itemId)) { + var item = me.items[itemId]; + if (item.data.group == id) { + group.add(item); } + } + } - var i = 0; - while (i < recognizers.length) { - recognizer = recognizers[i]; - - // find out if we are allowed try to recognize the input for this one. - // 1. allow if the session is NOT forced stopped (see the .stop() method) - // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one - // that is being recognized. - // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. - // this can be setup with the `recognizeWith()` method on the recognizer. - if (session.stopped !== FORCED_STOP && ( // 1 - !curRecognizer || recognizer == curRecognizer || // 2 - recognizer.canRecognizeWith(curRecognizer))) { // 3 - recognizer.recognize(inputData); - } else { - recognizer.reset(); - } + group.order(); + group.show(); + } else { + // update group + group.setData(groupData); + } + }); - // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the - // current active recognizer. but only if we don't already have an active recognizer - if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { - curRecognizer = session.curRecognizer = recognizer; - } - i++; - } - }, + this.body.emitter.emit('_change', { queue: true }); +}; - /** - * get a recognizer by its event name. - * @param {Recognizer|String} recognizer - * @returns {Recognizer|Null} - */ - get: function(recognizer) { - if (recognizer instanceof Recognizer) { - return recognizer; - } +/** + * Handle removed groups + * @param {number[]} ids + * @private + */ +ItemSet.prototype._onRemoveGroups = function (ids) { + var groups = this.groups; + ids.forEach(function (id) { + var group = groups[id]; - var recognizers = this.recognizers; - for (var i = 0; i < recognizers.length; i++) { - if (recognizers[i].options.event == recognizer) { - return recognizers[i]; - } - } - return null; - }, + if (group) { + group.hide(); + delete groups[id]; + } + }); - /** - * add a recognizer to the manager - * existing recognizers with the same event name will be removed - * @param {Recognizer} recognizer - * @returns {Recognizer|Manager} - */ - add: function(recognizer) { - if (invokeArrayArg(recognizer, 'add', this)) { - return this; - } + this.markDirty(); - // remove existing - var existing = this.get(recognizer.options.event); - if (existing) { - this.remove(existing); - } + this.body.emitter.emit('_change', { queue: true }); +}; - this.recognizers.push(recognizer); - recognizer.manager = this; +/** + * Reorder the groups if needed + * @return {boolean} changed + * @private + */ +ItemSet.prototype._orderGroups = function () { + if (this.groupsData) { + // reorder the groups + var groupIds = this.groupsData.getIds({ + order: this.options.groupOrder + }); - this.touchAction.update(); - return recognizer; - }, + groupIds = this._orderNestedGroups(groupIds); - /** - * remove a recognizer by name or instance - * @param {Recognizer|String} recognizer - * @returns {Manager} - */ - remove: function(recognizer) { - if (invokeArrayArg(recognizer, 'remove', this)) { - return this; - } + var changed = !util.equalArray(groupIds, this.groupIds); + if (changed) { + // hide all groups, removes them from the DOM + var groups = this.groups; + groupIds.forEach(function (groupId) { + groups[groupId].hide(); + }); - recognizer = this.get(recognizer); + // show the groups again, attach them to the DOM in correct order + groupIds.forEach(function (groupId) { + groups[groupId].show(); + }); - // let's make sure this recognizer exists - if (recognizer) { - var recognizers = this.recognizers; - var index = inArray(recognizers, recognizer); + this.groupIds = groupIds; + } - if (index !== -1) { - recognizers.splice(index, 1); - this.touchAction.update(); - } - } + return changed; + } else { + return false; + } +}; - return this; - }, +/** + * Reorder the nested groups + * + * @param {Array.} groupIds + * @returns {Array.} + * @private + */ +ItemSet.prototype._orderNestedGroups = function (groupIds) { + var newGroupIdsOrder = []; + + groupIds.forEach(function (groupId) { + var groupData = this.groupsData.get(groupId); + if (!groupData.nestedInGroup) { + newGroupIdsOrder.push(groupId); + } + if (groupData.nestedGroups) { + var nestedGroups = this.groupsData.get({ + filter: function filter(nestedGroup) { + return nestedGroup.nestedInGroup == groupId; + }, + order: this.options.groupOrder + }); + var nestedGroupIds = nestedGroups.map(function (nestedGroup) { + return nestedGroup.id; + }); + newGroupIdsOrder = newGroupIdsOrder.concat(nestedGroupIds); + } + }, this); + return newGroupIdsOrder; +}; - /** - * bind event - * @param {String} events - * @param {Function} handler - * @returns {EventEmitter} this - */ - on: function(events, handler) { - if (events === undefined) { - return; - } - if (handler === undefined) { - return; - } +/** + * Add a new item + * @param {Item} item + * @private + */ +ItemSet.prototype._addItem = function (item) { + this.items[item.id] = item; - var handlers = this.handlers; - each(splitStr(events), function(event) { - handlers[event] = handlers[event] || []; - handlers[event].push(handler); - }); - return this; - }, + // add to group + var groupId = this._getGroupId(item.data); + var group = this.groups[groupId]; - /** - * unbind event, leave emit blank to remove all handlers - * @param {String} events - * @param {Function} [handler] - * @returns {EventEmitter} this - */ - off: function(events, handler) { - if (events === undefined) { - return; - } + if (!group) { + item.groupShowing = false; + } else if (group && group.data && group.data.showNested) { + item.groupShowing = true; + } - var handlers = this.handlers; - each(splitStr(events), function(event) { - if (!handler) { - delete handlers[event]; - } else { - handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); - } - }); - return this; - }, + if (group) group.add(item); +}; - /** - * emit event to the listeners - * @param {String} event - * @param {Object} data - */ - emit: function(event, data) { - // we also want to trigger dom events - if (this.options.domEvents) { - triggerDomEvent(event, data); - } +/** + * Update an existing item + * @param {Item} item + * @param {Object} itemData + * @private + */ +ItemSet.prototype._updateItem = function (item, itemData) { + // update the items data (will redraw the item when displayed) + item.setData(itemData); + + var groupId = this._getGroupId(item.data); + var group = this.groups[groupId]; + if (!group) { + item.groupShowing = false; + } else if (group && group.data && group.data.showNested) { + item.groupShowing = true; + } +}; - // no handlers, so skip it all - var handlers = this.handlers[event] && this.handlers[event].slice(); - if (!handlers || !handlers.length) { - return; - } +/** + * Delete an item from the ItemSet: remove it from the DOM, from the map + * with items, and from the map with visible items, and from the selection + * @param {Item} item + * @private + */ +ItemSet.prototype._removeItem = function (item) { + // remove from DOM + item.hide(); + + // remove from items + delete this.items[item.id]; + + // remove from selection + var index = this.selection.indexOf(item.id); + if (index != -1) this.selection.splice(index, 1); + + // remove from group + item.parent && item.parent.remove(item); +}; - data.type = event; - data.preventDefault = function() { - data.srcEvent.preventDefault(); - }; +/** + * Create an array containing all items being a range (having an end date) + * @param {Array.} array + * @returns {Array} + * @private + */ +ItemSet.prototype._constructByEndArray = function (array) { + var endArray = []; - var i = 0; - while (i < handlers.length) { - handlers[i](data); - i++; - } - }, + for (var i = 0; i < array.length; i++) { + if (array[i] instanceof RangeItem) { + endArray.push(array[i]); + } + } + return endArray; +}; - /** - * destroy the manager and unbinds all events - * it doesn't unbind dom events, that is the user own responsibility - */ - destroy: function() { - this.element && toggleCssProps(this, false); +/** + * Register the clicked item on touch, before dragStart is initiated. + * + * dragStart is initiated from a mousemove event, AFTER the mouse/touch is + * already moving. Therefore, the mouse/touch can sometimes be above an other + * DOM element than the item itself. + * + * @param {Event} event + * @private + */ +ItemSet.prototype._onTouch = function (event) { + // store the touched item, used in _onDragStart + this.touchParams.item = this.itemFromTarget(event); + this.touchParams.dragLeftItem = event.target.dragLeftItem || false; + this.touchParams.dragRightItem = event.target.dragRightItem || false; + this.touchParams.itemProps = null; +}; - this.handlers = {}; - this.session = {}; - this.input.destroy(); - this.element = null; - } - }; +/** + * Given an group id, returns the index it has. + * + * @param {number} groupId + * @returns {number} index / groupId + * @private + */ +ItemSet.prototype._getGroupIndex = function (groupId) { + for (var i = 0; i < this.groupIds.length; i++) { + if (groupId == this.groupIds[i]) return i; + } +}; - /** - * add/remove the css properties as defined in manager.options.cssProps - * @param {Manager} manager - * @param {Boolean} add - */ - function toggleCssProps(manager, add) { - var element = manager.element; - if (!element.style) { - return; - } - var prop; - each(manager.options.cssProps, function(value, name) { - prop = prefixed(element.style, name); - if (add) { - manager.oldCssProps[prop] = element.style[prop]; - element.style[prop] = value; - } else { - element.style[prop] = manager.oldCssProps[prop] || ''; - } - }); - if (!add) { - manager.oldCssProps = {}; - } +/** + * Start dragging the selected events + * @param {Event} event + * @private + */ +ItemSet.prototype._onDragStart = function (event) { + if (this.touchParams.itemIsDragging) { + return; } + var item = this.touchParams.item || null; + var me = this; + var props; - /** - * trigger dom event - * @param {String} event - * @param {Object} data - */ - function triggerDomEvent(event, data) { - var gestureEvent = document.createEvent('Event'); - gestureEvent.initEvent(event, true, true); - gestureEvent.gesture = data; - data.target.dispatchEvent(gestureEvent); - } - - assign(Hammer, { - INPUT_START: INPUT_START, - INPUT_MOVE: INPUT_MOVE, - INPUT_END: INPUT_END, - INPUT_CANCEL: INPUT_CANCEL, - - STATE_POSSIBLE: STATE_POSSIBLE, - STATE_BEGAN: STATE_BEGAN, - STATE_CHANGED: STATE_CHANGED, - STATE_ENDED: STATE_ENDED, - STATE_RECOGNIZED: STATE_RECOGNIZED, - STATE_CANCELLED: STATE_CANCELLED, - STATE_FAILED: STATE_FAILED, - - DIRECTION_NONE: DIRECTION_NONE, - DIRECTION_LEFT: DIRECTION_LEFT, - DIRECTION_RIGHT: DIRECTION_RIGHT, - DIRECTION_UP: DIRECTION_UP, - DIRECTION_DOWN: DIRECTION_DOWN, - DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, - DIRECTION_VERTICAL: DIRECTION_VERTICAL, - DIRECTION_ALL: DIRECTION_ALL, - - Manager: Manager, - Input: Input, - TouchAction: TouchAction, - - TouchInput: TouchInput, - MouseInput: MouseInput, - PointerEventInput: PointerEventInput, - TouchMouseInput: TouchMouseInput, - SingleTouchInput: SingleTouchInput, - - Recognizer: Recognizer, - AttrRecognizer: AttrRecognizer, - Tap: TapRecognizer, - Pan: PanRecognizer, - Swipe: SwipeRecognizer, - Pinch: PinchRecognizer, - Rotate: RotateRecognizer, - Press: PressRecognizer, - - on: addEventListeners, - off: removeEventListeners, - each: each, - merge: merge, - extend: extend, - assign: assign, - inherit: inherit, - bindFn: bindFn, - prefixed: prefixed - }); + if (item && (item.selected || this.options.itemsAlwaysDraggable.item)) { - // this prevents errors when Hammer is loaded in the presence of an AMD - // style loader but by script tag, not by the loader. - var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line - freeGlobal.Hammer = Hammer; + if (this.options.editable.overrideItems && !this.options.editable.updateTime && !this.options.editable.updateGroup) { + return; + } - if (true) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return Hammer; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof module != 'undefined' && module.exports) { - module.exports = Hammer; - } else { - window[exportName] = Hammer; - } + // override options.editable + if (item.editable != null && !item.editable.updateTime && !item.editable.updateGroup && !this.options.editable.overrideItems) { + return; + } - })(window, document, 'Hammer'); + var dragLeftItem = this.touchParams.dragLeftItem; + var dragRightItem = this.touchParams.dragRightItem; + this.touchParams.itemIsDragging = true; + this.touchParams.selectedItem = item; + if (dragLeftItem) { + props = { + item: dragLeftItem, + initialX: event.center.x, + dragLeft: true, + data: this._cloneItemData(item.data) + }; -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { + this.touchParams.itemProps = [props]; + } else if (dragRightItem) { + props = { + item: dragRightItem, + initialX: event.center.x, + dragRight: true, + data: this._cloneItemData(item.data) + }; - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict"; - /** - * Created by Alex on 11/6/2014. - */ - - // https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60 - // if the module has no dependencies, the above pattern can be simplified to - (function (root, factory) { - if (true) { - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(); - } else { - // Browser globals (root is window) - root.keycharm = factory(); - } - }(this, function () { - - function keycharm(options) { - var preventDefault = options && options.preventDefault || false; - - var container = options && options.container || window; - - var _exportFunctions = {}; - var _bound = {keydown:{}, keyup:{}}; - var _keys = {}; - var i; - - // a - z - for (i = 97; i <= 122; i++) {_keys[String.fromCharCode(i)] = {code:65 + (i - 97), shift: false};} - // A - Z - for (i = 65; i <= 90; i++) {_keys[String.fromCharCode(i)] = {code:i, shift: true};} - // 0 - 9 - for (i = 0; i <= 9; i++) {_keys['' + i] = {code:48 + i, shift: false};} - // F1 - F12 - for (i = 1; i <= 12; i++) {_keys['F' + i] = {code:111 + i, shift: false};} - // num0 - num9 - for (i = 0; i <= 9; i++) {_keys['num' + i] = {code:96 + i, shift: false};} - - // numpad misc - _keys['num*'] = {code:106, shift: false}; - _keys['num+'] = {code:107, shift: false}; - _keys['num-'] = {code:109, shift: false}; - _keys['num/'] = {code:111, shift: false}; - _keys['num.'] = {code:110, shift: false}; - // arrows - _keys['left'] = {code:37, shift: false}; - _keys['up'] = {code:38, shift: false}; - _keys['right'] = {code:39, shift: false}; - _keys['down'] = {code:40, shift: false}; - // extra keys - _keys['space'] = {code:32, shift: false}; - _keys['enter'] = {code:13, shift: false}; - _keys['shift'] = {code:16, shift: undefined}; - _keys['esc'] = {code:27, shift: false}; - _keys['backspace'] = {code:8, shift: false}; - _keys['tab'] = {code:9, shift: false}; - _keys['ctrl'] = {code:17, shift: false}; - _keys['alt'] = {code:18, shift: false}; - _keys['delete'] = {code:46, shift: false}; - _keys['pageup'] = {code:33, shift: false}; - _keys['pagedown'] = {code:34, shift: false}; - // symbols - _keys['='] = {code:187, shift: false}; - _keys['-'] = {code:189, shift: false}; - _keys[']'] = {code:221, shift: false}; - _keys['['] = {code:219, shift: false}; - - - - var down = function(event) {handleEvent(event,'keydown');}; - var up = function(event) {handleEvent(event,'keyup');}; - - // handle the actualy bound key with the event - var handleEvent = function(event,type) { - if (_bound[type][event.keyCode] !== undefined) { - var bound = _bound[type][event.keyCode]; - for (var i = 0; i < bound.length; i++) { - if (bound[i].shift === undefined) { - bound[i].fn(event); - } - else if (bound[i].shift == true && event.shiftKey == true) { - bound[i].fn(event); - } - else if (bound[i].shift == false && event.shiftKey == false) { - bound[i].fn(event); - } - } - - if (preventDefault == true) { - event.preventDefault(); - } - } - }; - - // bind a key to a callback - _exportFunctions.bind = function(key, callback, type) { - if (type === undefined) { - type = 'keydown'; - } - if (_keys[key] === undefined) { - throw new Error("unsupported key: " + key); - } - if (_bound[type][_keys[key].code] === undefined) { - _bound[type][_keys[key].code] = []; - } - _bound[type][_keys[key].code].push({fn:callback, shift:_keys[key].shift}); - }; - - - // bind all keys to a call back (demo purposes) - _exportFunctions.bindAll = function(callback, type) { - if (type === undefined) { - type = 'keydown'; - } - for (var key in _keys) { - if (_keys.hasOwnProperty(key)) { - _exportFunctions.bind(key,callback,type); - } - } - }; - - // get the key label from an event - _exportFunctions.getKey = function(event) { - for (var key in _keys) { - if (_keys.hasOwnProperty(key)) { - if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) { - return key; - } - else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) { - return key; - } - else if (event.keyCode == _keys[key].code && key == 'shift') { - return key; - } - } - } - return "unknown key, currently not supported"; - }; - - // unbind either a specific callback from a key or all of them (by leaving callback undefined) - _exportFunctions.unbind = function(key, callback, type) { - if (type === undefined) { - type = 'keydown'; - } - if (_keys[key] === undefined) { - throw new Error("unsupported key: " + key); - } - if (callback !== undefined) { - var newBindings = []; - var bound = _bound[type][_keys[key].code]; - if (bound !== undefined) { - for (var i = 0; i < bound.length; i++) { - if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) { - newBindings.push(_bound[type][_keys[key].code][i]); - } - } - } - _bound[type][_keys[key].code] = newBindings; - } - else { - _bound[type][_keys[key].code] = []; - } - }; - - // reset all bound variables. - _exportFunctions.reset = function() { - _bound = {keydown:{}, keyup:{}}; - }; - - // unbind all listeners and reset all variables. - _exportFunctions.destroy = function() { - _bound = {keydown:{}, keyup:{}}; - container.removeEventListener('keydown', down, true); - container.removeEventListener('keyup', up, true); - }; - - // create listeners. - container.addEventListener('keydown',down,true); - container.addEventListener('keyup',up,true); - - // return the public functions. - return _exportFunctions; - } - - return keycharm; - })); - - + this.touchParams.itemProps = [props]; + } else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) { + // create a new range item when dragging with ctrl key down + this._onDragStartAddItem(event); + } else { + if (this.groupIds.length < 1) { + // Mitigates a race condition if _onDragStart() is + // called after markDirty() without redraw() being called between. + this.redraw(); + } + var baseGroupIndex = this._getGroupIndex(item.data.group); -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { + var itemsToDrag = this.options.itemsAlwaysDraggable.item && !item.selected ? [item.id] : this.getSelection(); - 'use strict'; + this.touchParams.itemProps = itemsToDrag.map(function (id) { + var item = me.items[id]; + var groupIndex = me._getGroupIndex(item.data.group); + return { + item: item, + initialX: event.center.x, + groupOffset: baseGroupIndex - groupIndex, + data: this._cloneItemData(item.data) + }; + }.bind(this)); + } - // utils - exports.util = __webpack_require__(1); - exports.DOMutil = __webpack_require__(88); - - // data - exports.DataSet = __webpack_require__(89); - exports.DataView = __webpack_require__(93); - exports.Queue = __webpack_require__(92); - - // Timeline - exports.Timeline = __webpack_require__(118); - exports.Graph2d = __webpack_require__(149); - exports.timeline = { - Core: __webpack_require__(123), - DateUtil: __webpack_require__(122), - Range: __webpack_require__(119), - stack: __webpack_require__(127), - TimeStep: __webpack_require__(125), - - components: { - items: { - Item: __webpack_require__(129), - BackgroundItem: __webpack_require__(133), - BoxItem: __webpack_require__(131), - PointItem: __webpack_require__(132), - RangeItem: __webpack_require__(128) - }, + event.stopPropagation(); + } else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) { + // create a new range item when dragging with ctrl key down + this._onDragStartAddItem(event); + } +}; - BackgroundGroup: __webpack_require__(130), - Component: __webpack_require__(121), - CurrentTime: __webpack_require__(144), - CustomTime: __webpack_require__(142), - DataAxis: __webpack_require__(151), - DataScale: __webpack_require__(152), - GraphGroup: __webpack_require__(153), - Group: __webpack_require__(126), - ItemSet: __webpack_require__(124), - Legend: __webpack_require__(157), - LineGraph: __webpack_require__(150), - TimeAxis: __webpack_require__(140) - } - }; +/** + * Start creating a new range item by dragging. + * @param {Event} event + * @private + */ +ItemSet.prototype._onDragStartAddItem = function (event) { + var xAbs; + var x; + var snap = this.options.snap || null; + + if (this.options.rtl) { + xAbs = util.getAbsoluteRight(this.dom.frame); + x = xAbs - event.center.x + 10; // plus 10 to compensate for the drag starting as soon as you've moved 10px + } else { + xAbs = util.getAbsoluteLeft(this.dom.frame); + x = event.center.x - xAbs - 10; // minus 10 to compensate for the drag starting as soon as you've moved 10px + } - // bundled external libraries - exports.moment = __webpack_require__(82); - exports.Hammer = __webpack_require__(113); - exports.keycharm = __webpack_require__(116); + var time = this.body.util.toTime(x); + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var start = snap ? snap(time, scale, step) : time; + var end = start; -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { + var itemData = { + type: 'range', + start: start, + end: end, + content: 'new item' + }; - 'use strict'; + var id = util.randomUUID(); + itemData[this.itemsData._fieldId] = id; - var Emitter = __webpack_require__(99); - var Hammer = __webpack_require__(113); - var moment = __webpack_require__(82); - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var Range = __webpack_require__(119); - var Core = __webpack_require__(123); - var TimeAxis = __webpack_require__(140); - var CurrentTime = __webpack_require__(144); - var CustomTime = __webpack_require__(142); - var ItemSet = __webpack_require__(124); - - var printStyle = __webpack_require__(145).printStyle; - var allOptions = __webpack_require__(146).allOptions; - var configureOptions = __webpack_require__(146).configureOptions; - - var Configurator = __webpack_require__(147)['default']; - var Validator = __webpack_require__(145)['default']; + var group = this.groupFromTarget(event); + if (group) { + itemData.group = group.groupId; + } + var newItem = new RangeItem(itemData, this.conversion, this.options); + newItem.id = id; // TODO: not so nice setting id afterwards + newItem.data = this._cloneItemData(itemData); + this._addItem(newItem); + this.touchParams.selectedItem = newItem; - /** - * Create a timeline visualization - * @param {HTMLElement} container - * @param {vis.DataSet | vis.DataView | Array} [items] - * @param {vis.DataSet | vis.DataView | Array} [groups] - * @param {Object} [options] See Timeline.setOptions for the available options. - * @constructor - * @extends Core - */ - function Timeline(container, items, groups, options) { + var props = { + item: newItem, + initialX: event.center.x, + data: newItem.data + }; - if (!(this instanceof Timeline)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } + if (this.options.rtl) { + props.dragLeft = true; + } else { + props.dragRight = true; + } + this.touchParams.itemProps = [props]; - // if the third element is options, the forth is groups (optionally); - if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) { - var forthArgument = options; - options = groups; - groups = forthArgument; - } + event.stopPropagation(); +}; - // TODO: REMOVE THIS in the next MAJOR release - // see https://github.com/almende/vis/issues/2511 - if (options && options.throttleRedraw) { - console.warn("Timeline option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release."); - } +/** + * Drag selected items + * @param {Event} event + * @private + */ +ItemSet.prototype._onDrag = function (event) { + if (this.touchParams.itemProps) { + event.stopPropagation(); var me = this; - this.defaultOptions = { - start: null, - end: null, - autoResize: true, - orientation: { - axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both' - item: 'bottom' // not relevant - }, - moment: moment, - width: null, - height: null, - maxHeight: null, - minHeight: null - }; - this.options = util.deepExtend({}, this.defaultOptions); - - // Create the DOM, props, and emitter - this._create(container); - if (!options || options && typeof options.rtl == "undefined") { - var directionFromDom, - domNode = this.dom.root; - while (!directionFromDom && domNode) { - directionFromDom = window.getComputedStyle(domNode, null).direction; - domNode = domNode.parentElement; - } - this.options.rtl = directionFromDom && directionFromDom.toLowerCase() == "rtl"; + var snap = this.options.snap || null; + var xOffset; + + if (this.options.rtl) { + xOffset = this.body.dom.root.offsetLeft + this.body.domProps.right.width; } else { - this.options.rtl = options.rtl; + xOffset = this.body.dom.root.offsetLeft + this.body.domProps.left.width; } - this.options.rollingMode = options && options.rollingMode; - - // all components listed here will be repainted automatically - this.components = []; - - this.body = { - dom: this.dom, - domProps: this.props, - emitter: { - on: this.on.bind(this), - off: this.off.bind(this), - emit: this.emit.bind(this) - }, - hiddenDates: [], - util: { - getScale: function getScale() { - return me.timeAxis.step.scale; - }, - getStep: function getStep() { - return me.timeAxis.step.step; - }, + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); - toScreen: me._toScreen.bind(me), - toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width - toTime: me._toTime.bind(me), - toGlobalTime: me._toGlobalTime.bind(me) + //only calculate the new group for the item that's actually dragged + var selectedItem = this.touchParams.selectedItem; + var updateGroupAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateGroup || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateGroup; + var newGroupBase = null; + if (updateGroupAllowed && selectedItem) { + if (selectedItem.data.group != undefined) { + // drag from one group to another + var group = me.groupFromTarget(event); + if (group) { + //we know the offset for all items, so the new group for all items + //will be relative to this one. + newGroupBase = this._getGroupIndex(group.groupId); + } } - }; + } - // range - this.range = new Range(this.body, this.options); - this.components.push(this.range); - this.body.range = this.range; + // move + this.touchParams.itemProps.forEach(function (props) { + var current = me.body.util.toTime(event.center.x - xOffset); + var initial = me.body.util.toTime(props.initialX - xOffset); + var offset; + var initialStart; + var initialEnd; + var start; + var end; - // time axis - this.timeAxis = new TimeAxis(this.body, this.options); - this.timeAxis2 = null; // used in case of orientation option 'both' - this.components.push(this.timeAxis); + if (this.options.rtl) { + offset = -(current - initial); // ms + } else { + offset = current - initial; // ms + } - // current time bar - this.currentTime = new CurrentTime(this.body, this.options); - this.components.push(this.currentTime); + var itemData = this._cloneItemData(props.item.data); // clone the data + if (props.item.editable != null && !props.item.editable.updateTime && !props.item.editable.updateGroup && !me.options.editable.overrideItems) { + return; + } - // item set - this.itemSet = new ItemSet(this.body, this.options); - this.components.push(this.itemSet); + var updateTimeAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateTime || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateTime; + if (updateTimeAllowed) { + if (props.dragLeft) { + // drag left side of a range item + if (this.options.rtl) { + if (itemData.end != undefined) { + initialEnd = util.convert(props.data.end, 'Date'); + end = new Date(initialEnd.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.end = snap ? snap(end, scale, step) : end; + } + } else { + if (itemData.start != undefined) { + initialStart = util.convert(props.data.start, 'Date'); + start = new Date(initialStart.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + } + } + } else if (props.dragRight) { + // drag right side of a range item + if (this.options.rtl) { + if (itemData.start != undefined) { + initialStart = util.convert(props.data.start, 'Date'); + start = new Date(initialStart.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + } + } else { + if (itemData.end != undefined) { + initialEnd = util.convert(props.data.end, 'Date'); + end = new Date(initialEnd.valueOf() + offset); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.end = snap ? snap(end, scale, step) : end; + } + } + } else { + // drag both start and end + if (itemData.start != undefined) { - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet + initialStart = util.convert(props.data.start, 'Date').valueOf(); + start = new Date(initialStart + offset); - this.dom.root.onclick = function (event) { - me.emit('click', me.getEventProperties(event)); - }; - this.dom.root.ondblclick = function (event) { - me.emit('doubleClick', me.getEventProperties(event)); - }; - this.dom.root.oncontextmenu = function (event) { - me.emit('contextmenu', me.getEventProperties(event)); - }; - this.dom.root.onmouseover = function (event) { - me.emit('mouseOver', me.getEventProperties(event)); - }; - if (window.PointerEvent) { - this.dom.root.onpointerdown = function (event) { - me.emit('mouseDown', me.getEventProperties(event)); - }; - this.dom.root.onpointermove = function (event) { - me.emit('mouseMove', me.getEventProperties(event)); - }; - this.dom.root.onpointerup = function (event) { - me.emit('mouseUp', me.getEventProperties(event)); - }; - } else { - this.dom.root.onmousemove = function (event) { - me.emit('mouseMove', me.getEventProperties(event)); - }; - this.dom.root.onmousedown = function (event) { - me.emit('mouseDown', me.getEventProperties(event)); - }; - this.dom.root.onmouseup = function (event) { - me.emit('mouseUp', me.getEventProperties(event)); - }; - } + if (itemData.end != undefined) { + initialEnd = util.convert(props.data.end, 'Date'); + var duration = initialEnd.valueOf() - initialStart.valueOf(); - //Single time autoscale/fit - this.fitDone = false; - this.on('changed', function () { - if (this.itemsData == null || this.options.rollingMode) return; - if (!me.fitDone) { - me.fitDone = true; - if (me.options.start != undefined || me.options.end != undefined) { - if (me.options.start == undefined || me.options.end == undefined) { - var range = me.getItemRange(); + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + itemData.end = new Date(itemData.start.valueOf() + duration); + } else { + // TODO: pass a Moment instead of a Date to snap(). (Breaking change) + itemData.start = snap ? snap(start, scale, step) : start; + } } - - var start = me.options.start != undefined ? me.options.start : range.min; - var end = me.options.end != undefined ? me.options.end : range.max; - me.setWindow(start, end, { animation: false }); - } else { - me.fit({ animation: false }); } } - }); - // apply options - if (options) { - this.setOptions(options); - } + if (updateGroupAllowed && !props.dragLeft && !props.dragRight && newGroupBase != null) { + if (itemData.group != undefined) { + var newOffset = newGroupBase - props.groupOffset; - // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! - if (groups) { - this.setGroups(groups); - } + //make sure we stay in bounds + newOffset = Math.max(0, newOffset); + newOffset = Math.min(me.groupIds.length - 1, newOffset); + itemData.group = me.groupIds[newOffset]; + } + } - // create itemset - if (items) { - this.setItems(items); - } + // confirm moving the item + itemData = this._cloneItemData(itemData); // convert start and end to the correct type + me.options.onMoving(itemData, function (itemData) { + if (itemData) { + props.item.setData(this._cloneItemData(itemData, 'Date')); + } + }.bind(this)); + }.bind(this)); - // draw for the first time - this._redraw(); + this.body.emitter.emit('_change'); } +}; - // Extend the functionality from Core - Timeline.prototype = new Core(); +/** + * Move an item to another group + * @param {Item} item + * @param {string | number} groupId + * @private + */ +ItemSet.prototype._moveToGroup = function (item, groupId) { + var group = this.groups[groupId]; + if (group && group.groupId != item.data.group) { + var oldGroup = item.parent; + oldGroup.remove(item); + oldGroup.order(); - /** - * Load a configurator - * @return {Object} - * @private - */ - Timeline.prototype._createConfigurator = function () { - return new Configurator(this, this.dom.container, configureOptions); - }; + item.data.group = group.groupId; - /** - * Force a redraw. The size of all items will be recalculated. - * Can be useful to manually redraw when option autoResize=false and the window - * has been resized, or when the items CSS has been changed. - * - * Note: this function will be overridden on construction with a trottled version - */ - Timeline.prototype.redraw = function () { - this.itemSet && this.itemSet.markDirty({ refreshItems: true }); - this._redraw(); - }; + group.add(item); + group.order(); + } +}; - Timeline.prototype.setOptions = function (options) { - // validate options - var errorFound = Validator.validate(options, allOptions); +/** + * End of dragging selected items + * @param {Event} event + * @private + */ +ItemSet.prototype._onDragEnd = function (event) { + this.touchParams.itemIsDragging = false; + if (this.touchParams.itemProps) { + event.stopPropagation(); - if (errorFound === true) { - console.log('%cErrors have been found in the supplied options object.', printStyle); - } - Core.prototype.setOptions.call(this, options); + var me = this; + var dataset = this.itemsData.getDataSet(); + var itemProps = this.touchParams.itemProps; + this.touchParams.itemProps = null; - if ('type' in options) { - if (options.type !== this.options.type) { - this.options.type = options.type; + itemProps.forEach(function (props) { + var id = props.item.id; + var exists = me.itemsData.get(id, me.itemOptions) != null; - // force recreation of all items - var itemsData = this.itemsData; - if (itemsData) { - var selection = this.getSelection(); - this.setItems(null); // remove all - this.setItems(itemsData); // add all - this.setSelection(selection); // restore selection - } + if (!exists) { + // add a new item + me.options.onAdd(props.item.data, function (itemData) { + me._removeItem(props.item); // remove temporary item + if (itemData) { + me.itemsData.getDataSet().add(itemData); + } + + // force re-stacking of all items next redraw + me.body.emitter.emit('_change'); + }); + } else { + // update existing item + var itemData = this._cloneItemData(props.item.data); // convert start and end to the correct type + me.options.onMove(itemData, function (itemData) { + if (itemData) { + // apply changes + itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined) + dataset.update(itemData); + } else { + // restore original values + props.item.setData(props.data); + + me.body.emitter.emit('_change'); + } + }); } - } - }; + }.bind(this)); + } +}; - /** - * Set items - * @param {vis.DataSet | Array | null} items - */ - Timeline.prototype.setItems = function (items) { - // convert to type DataSet when needed - var newDataSet; - if (!items) { - newDataSet = null; - } else if (items instanceof DataSet || items instanceof DataView) { - newDataSet = items; - } else { - // turn an array into a dataset - newDataSet = new DataSet(items, { - type: { - start: 'Date', - end: 'Date' - } - }); - } +ItemSet.prototype._onGroupClick = function (event) { + var group = this.groupFromTarget(event); - // set items - this.itemsData = newDataSet; - this.itemSet && this.itemSet.setItems(newDataSet); - }; + if (!group || !group.nestedGroups) return; - /** - * Set groups - * @param {vis.DataSet | Array} groups - */ - Timeline.prototype.setGroups = function (groups) { - // convert to type DataSet when needed - var newDataSet; - if (!groups) { - newDataSet = null; - } else { - var filter = function filter(group) { - return group.visible !== false; - }; - if (groups instanceof DataSet || groups instanceof DataView) { - newDataSet = new DataView(groups, { filter: filter }); - } else { - // turn an array into a dataset - newDataSet = new DataSet(groups.filter(filter)); - } - } + var groupsData = this.groupsData.getDataSet(); - this.groupsData = newDataSet; - this.itemSet.setGroups(newDataSet); - }; + var nestingGroup = groupsData.get(group.groupId); + if (nestingGroup.showNested == undefined) { + nestingGroup.showNested = true; + } + nestingGroup.showNested = !nestingGroup.showNested; - /** - * Set both items and groups in one go - * @param {{items: Array | vis.DataSet, groups: Array | vis.DataSet}} data - */ - Timeline.prototype.setData = function (data) { - if (data && data.groups) { - this.setGroups(data.groups); - } + var nestedGroups = groupsData.get(group.nestedGroups).map(function (nestedGroup) { + nestedGroup.visible = nestingGroup.showNested; + return nestedGroup; + }); - if (data && data.items) { - this.setItems(data.items); - } - }; + groupsData.update(nestedGroups.concat(nestingGroup)); - /** - * Set selected items by their id. Replaces the current selection - * Unknown id's are silently ignored. - * @param {string[] | string} [ids] An array with zero or more id's of the items to be - * selected. If ids is an empty array, all items will be - * unselected. - * @param {Object} [options] Available options: - * `focus: boolean` - * If true, focus will be set to the selected item(s) - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * Only applicable when option focus is true. - */ - Timeline.prototype.setSelection = function (ids, options) { - this.itemSet && this.itemSet.setSelection(ids); + if (nestingGroup.showNested) { + util.removeClassName(group.dom.label, 'collapsed'); + util.addClassName(group.dom.label, 'expanded'); + } else { + util.removeClassName(group.dom.label, 'expanded'); + var collapsedDirClassName = this.options.rtl ? 'collapsed-rtl' : 'collapsed'; + util.addClassName(group.dom.label, collapsedDirClassName); + } +}; - if (options && options.focus) { - this.focus(ids, options); - } - }; +ItemSet.prototype._onGroupDragStart = function (event) { + if (this.options.groupEditable.order) { + this.groupTouchParams.group = this.groupFromTarget(event); - /** - * Get the selected items by their id - * @return {Array} ids The ids of the selected items - */ - Timeline.prototype.getSelection = function () { - return this.itemSet && this.itemSet.getSelection() || []; - }; + if (this.groupTouchParams.group) { + event.stopPropagation(); - /** - * Adjust the visible window such that the selected item (or multiple items) - * are centered on screen. - * @param {String | String[]} id An item id or array with item ids - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - */ - Timeline.prototype.focus = function (id, options) { - if (!this.itemsData || id == undefined) return; + this.groupTouchParams.originalOrder = this.groupsData.getIds({ + order: this.options.groupOrder + }); + } + } +}; - var ids = Array.isArray(id) ? id : [id]; +ItemSet.prototype._onGroupDrag = function (event) { + if (this.options.groupEditable.order && this.groupTouchParams.group) { + event.stopPropagation(); - // get the specified item(s) - var itemsData = this.itemsData.getDataSet().get(ids, { - type: { - start: 'Date', - end: 'Date' + var groupsData = this.groupsData; + if (this.groupsData instanceof DataView) { + groupsData = this.groupsData.getDataSet(); + } + // drag from one group to another + var group = this.groupFromTarget(event); + + // try to avoid toggling when groups differ in height + if (group && group.height != this.groupTouchParams.group.height) { + var movingUp = group.top < this.groupTouchParams.group.top; + var clientY = event.center ? event.center.y : event.clientY; + var targetGroupTop = util.getAbsoluteTop(group.dom.foreground); + var draggedGroupHeight = this.groupTouchParams.group.height; + if (movingUp) { + // skip swapping the groups when the dragged group is not below clientY afterwards + if (targetGroupTop + draggedGroupHeight < clientY) { + return; + } + } else { + var targetGroupHeight = group.height; + // skip swapping the groups when the dragged group is not below clientY afterwards + if (targetGroupTop + targetGroupHeight - draggedGroupHeight > clientY) { + return; + } } - }); + } - // calculate minimum start and maximum end of specified items - var start = null; - var end = null; - itemsData.forEach(function (itemData) { - var s = itemData.start.valueOf(); - var e = 'end' in itemData ? itemData.end.valueOf() : itemData.start.valueOf(); + if (group && group != this.groupTouchParams.group) { + var targetGroup = groupsData.get(group.groupId); + var draggedGroup = groupsData.get(this.groupTouchParams.group.groupId); - if (start === null || s < start) { - start = s; + // switch groups + if (draggedGroup && targetGroup) { + this.options.groupOrderSwap(draggedGroup, targetGroup, groupsData); + groupsData.update(draggedGroup); + groupsData.update(targetGroup); } - if (end === null || e > end) { - end = e; - } - }); + // fetch current order of groups + var newOrder = groupsData.getIds({ + order: this.options.groupOrder + }); - if (start !== null && end !== null) { - // calculate the new middle and interval for the window - var middle = (start + end) / 2; - var interval = Math.max(this.range.end - this.range.start, (end - start) * 1.1); + // in case of changes since _onGroupDragStart + if (!util.equalArray(newOrder, this.groupTouchParams.originalOrder)) { + var origOrder = this.groupTouchParams.originalOrder; + var draggedId = this.groupTouchParams.group.groupId; + var numGroups = Math.min(origOrder.length, newOrder.length); + var curPos = 0; + var newOffset = 0; + var orgOffset = 0; + while (curPos < numGroups) { + // as long as the groups are where they should be step down along the groups order + while (curPos + newOffset < numGroups && curPos + orgOffset < numGroups && newOrder[curPos + newOffset] == origOrder[curPos + orgOffset]) { + curPos++; + } + + // all ok + if (curPos + newOffset >= numGroups) { + break; + } - var animation = options && options.animation !== undefined ? options.animation : true; - this.range.setRange(middle - interval / 2, middle + interval / 2, { animation: animation }); - } - }; + // not all ok + // if dragged group was move upwards everything below should have an offset + if (newOrder[curPos + newOffset] == draggedId) { + newOffset = 1; + } + // if dragged group was move downwards everything above should have an offset + else if (origOrder[curPos + orgOffset] == draggedId) { + orgOffset = 1; + } + // found a group (apart from dragged group) that has the wrong position -> switch with the + // group at the position where other one should be, fix index arrays and continue + else { + var slippedPosition = newOrder.indexOf(origOrder[curPos + orgOffset]); + var switchGroup = groupsData.get(newOrder[curPos + newOffset]); + var shouldBeGroup = groupsData.get(origOrder[curPos + orgOffset]); + this.options.groupOrderSwap(switchGroup, shouldBeGroup, groupsData); + groupsData.update(switchGroup); + groupsData.update(shouldBeGroup); - /** - * Set Timeline window such that it fits all items - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - */ - Timeline.prototype.fit = function (options) { - var animation = options && options.animation !== undefined ? options.animation : true; - var range; + var switchGroupId = newOrder[curPos + newOffset]; + newOrder[curPos + newOffset] = origOrder[curPos + orgOffset]; + newOrder[slippedPosition] = switchGroupId; - var dataset = this.itemsData && this.itemsData.getDataSet(); - if (dataset.length === 1 && dataset.get()[0].end === undefined) { - // a single item -> don't fit, just show a range around the item from -4 to +3 days - range = this.getDataRange(); - this.moveTo(range.min.valueOf(), { animation: animation }); - } else { - // exactly fit the items (plus a small margin) - range = this.getItemRange(); - this.range.setRange(range.min, range.max, { animation: animation }); + curPos++; + } + } + } } - }; + } +}; - /** - * Determine the range of the items, taking into account their actual width - * and a margin of 10 pixels on both sides. - * @return {{min: Date | null, max: Date | null}} - */ - Timeline.prototype.getItemRange = function () { - // get a rough approximation for the range based on the items start and end dates - var range = this.getDataRange(); - var min = range.min !== null ? range.min.valueOf() : null; - var max = range.max !== null ? range.max.valueOf() : null; - var minItem = null; - var maxItem = null; - - if (min != null && max != null) { - var getStart = function getStart(item) { - return util.convert(item.data.start, 'Date').valueOf(); - }; +ItemSet.prototype._onGroupDragEnd = function (event) { + if (this.options.groupEditable.order && this.groupTouchParams.group) { + event.stopPropagation(); - var getEnd = function getEnd(item) { - var end = item.data.end != undefined ? item.data.end : item.data.start; - return util.convert(end, 'Date').valueOf(); - }; + // update existing group + var me = this; + var id = me.groupTouchParams.group.groupId; + var dataset = me.groupsData.getDataSet(); + var groupData = util.extend({}, dataset.get(id)); // clone the data + me.options.onMoveGroup(groupData, function (groupData) { + if (groupData) { + // apply changes + groupData[dataset._fieldId] = id; // ensure the group contains its id (can be undefined) + dataset.update(groupData); + } else { - // calculate the date of the left side and right side of the items given + // fetch current order of groups + var newOrder = dataset.getIds({ + order: me.options.groupOrder + }); + // restore original order + if (!util.equalArray(newOrder, me.groupTouchParams.originalOrder)) { + var origOrder = me.groupTouchParams.originalOrder; + var numGroups = Math.min(origOrder.length, newOrder.length); + var curPos = 0; + while (curPos < numGroups) { + // as long as the groups are where they should be step down along the groups order + while (curPos < numGroups && newOrder[curPos] == origOrder[curPos]) { + curPos++; + } - var interval = max - min; // ms - if (interval <= 0) { - interval = 10; - } - var factor = interval / this.props.center.width; + // all ok + if (curPos >= numGroups) { + break; + } - util.forEach(this.itemSet.items, function (item) { - if (item.groupShowing) { - item.show(); - item.repositionX(); - } + // found a group that has the wrong position -> switch with the + // group at the position where other one should be, fix index arrays and continue + var slippedPosition = newOrder.indexOf(origOrder[curPos]); + var switchGroup = dataset.get(newOrder[curPos]); + var shouldBeGroup = dataset.get(origOrder[curPos]); + me.options.groupOrderSwap(switchGroup, shouldBeGroup, dataset); + dataset.update(switchGroup); + dataset.update(shouldBeGroup); - var start = getStart(item); - var end = getEnd(item); + var switchGroupId = newOrder[curPos]; + newOrder[curPos] = origOrder[curPos]; + newOrder[slippedPosition] = switchGroupId; - if (this.options.rtl) { - var startSide = start - (item.getWidthRight() + 10) * factor; - var endSide = end + (item.getWidthLeft() + 10) * factor; - } else { - var startSide = start - (item.getWidthLeft() + 10) * factor; - var endSide = end + (item.getWidthRight() + 10) * factor; + curPos++; + } } + } + }); - if (startSide < min) { - min = startSide; - minItem = item; - } - if (endSide > max) { - max = endSide; - maxItem = item; - } - }.bind(this)); + me.body.emitter.emit('groupDragged', { groupId: id }); + } +}; - if (minItem && maxItem) { - var lhs = minItem.getWidthLeft() + 10; - var rhs = maxItem.getWidthRight() + 10; - var delta = this.props.center.width - lhs - rhs; // px +/** + * Handle selecting/deselecting an item when tapping it + * @param {Event} event + * @private + */ +ItemSet.prototype._onSelectItem = function (event) { + if (!this.options.selectable) return; - if (delta > 0) { - if (this.options.rtl) { - min = getStart(minItem) - rhs * interval / delta; // ms - max = getEnd(maxItem) + lhs * interval / delta; // ms - } else { - min = getStart(minItem) - lhs * interval / delta; // ms - max = getEnd(maxItem) + rhs * interval / delta; // ms - } - } - } - } + var ctrlKey = event.srcEvent && (event.srcEvent.ctrlKey || event.srcEvent.metaKey); + var shiftKey = event.srcEvent && event.srcEvent.shiftKey; + if (ctrlKey || shiftKey) { + this._onMultiSelectItem(event); + return; + } - return { - min: min != null ? new Date(min) : null, - max: max != null ? new Date(max) : null - }; - }; + var oldSelection = this.getSelection(); - /** - * Calculate the data range of the items start and end dates - * @returns {{min: Date | null, max: Date | null}} - */ - Timeline.prototype.getDataRange = function () { - var min = null; - var max = null; + var item = this.itemFromTarget(event); + var selection = item ? [item.id] : []; + this.setSelection(selection); - var dataset = this.itemsData && this.itemsData.getDataSet(); - if (dataset) { - dataset.forEach(function (item) { - var start = util.convert(item.start, 'Date').valueOf(); - var end = util.convert(item.end != undefined ? item.end : item.start, 'Date').valueOf(); - if (min === null || start < min) { - min = start; - } - if (max === null || end > max) { - max = end; - } - }); - } + var newSelection = this.getSelection(); - return { - min: min != null ? new Date(min) : null, - max: max != null ? new Date(max) : null - }; - }; + // emit a select event, + // except when old selection is empty and new selection is still empty + if (newSelection.length > 0 || oldSelection.length > 0) { + this.body.emitter.emit('select', { + items: newSelection, + event: event + }); + } +}; - /** - * Generate Timeline related information from an event - * @param {Event} event - * @return {Object} An object with related information, like on which area - * The event happened, whether clicked on an item, etc. - */ - Timeline.prototype.getEventProperties = function (event) { - var clientX = event.center ? event.center.x : event.clientX; - var clientY = event.center ? event.center.y : event.clientY; - if (this.options.rtl) { - var x = util.getAbsoluteRight(this.dom.centerContainer) - clientX; - } else { - var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer); +/** + * Handle hovering an item + * @param {Event} event + * @private + */ +ItemSet.prototype._onMouseOver = function (event) { + var item = this.itemFromTarget(event); + if (!item) return; + + // Item we just left + var related = this.itemFromRelatedTarget(event); + if (item === related) { + // We haven't changed item, just element in the item + return; + } + + var title = item.getTitle(); + if (this.options.showTooltips && title) { + if (this.popup == null) { + this.popup = new Popup(this.body.dom.root, this.options.tooltip.overflowMethod || 'flip'); + } + + this.popup.setText(title); + var container = this.body.dom.centerContainer; + this.popup.setPosition(event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, event.clientY - util.getAbsoluteTop(container) + container.offsetTop); + this.popup.show(); + } else { + // Hovering over item without a title, hide popup + // Needed instead of _just_ in _onMouseOut due to #2572 + if (this.popup != null) { + this.popup.hide(); } - var y = clientY - util.getAbsoluteTop(this.dom.centerContainer); + } - var item = this.itemSet.itemFromTarget(event); - var group = this.itemSet.groupFromTarget(event); - var customTime = CustomTime.customTimeFromTarget(event); + this.body.emitter.emit('itemover', { + item: item.id, + event: event + }); +}; +ItemSet.prototype._onMouseOut = function (event) { + var item = this.itemFromTarget(event); + if (!item) return; - var snap = this.itemSet.options.snap || null; - var scale = this.body.util.getScale(); - var step = this.body.util.getStep(); - var time = this._toTime(x); - var snappedTime = snap ? snap(time, scale, step) : time; - - var element = util.getTarget(event); - var what = null; - if (item != null) { - what = 'item'; - } else if (customTime != null) { - what = 'custom-time'; - } else if (util.hasParent(element, this.timeAxis.dom.foreground)) { - what = 'axis'; - } else if (this.timeAxis2 && util.hasParent(element, this.timeAxis2.dom.foreground)) { - what = 'axis'; - } else if (util.hasParent(element, this.itemSet.dom.labelSet)) { - what = 'group-label'; - } else if (util.hasParent(element, this.currentTime.bar)) { - what = 'current-time'; - } else if (util.hasParent(element, this.dom.center)) { - what = 'background'; - } + // Item we are going to + var related = this.itemFromRelatedTarget(event); + if (item === related) { + // We aren't changing item, just element in the item + return; + } - return { - event: event, - item: item ? item.id : null, - group: group ? group.groupId : null, - what: what, - pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX, - pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY, - x: x, - y: y, - time: time, - snappedTime: snappedTime - }; - }; + if (this.popup != null) { + this.popup.hide(); + } - /** - * Toggle Timeline rolling mode - */ + this.body.emitter.emit('itemout', { + item: item.id, + event: event + }); +}; +ItemSet.prototype._onMouseMove = function (event) { + var item = this.itemFromTarget(event); + if (!item) return; - Timeline.prototype.toggleRollingMode = function () { - if (this.range.rolling) { - this.range.stopRolling(); - } else { - if (this.options.rollingMode == undefined) { - this.setOptions(this.options); + if (this.options.showTooltips && this.options.tooltip.followMouse) { + if (this.popup) { + if (!this.popup.hidden) { + var container = this.body.dom.centerContainer; + this.popup.setPosition(event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, event.clientY - util.getAbsoluteTop(container) + container.offsetTop); + this.popup.show(); // Redraw } - this.range.startRolling(); } - }; - - module.exports = Timeline; + } +}; -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Handle mousewheel + * @param {Event} event The event + * @private + */ +ItemSet.prototype._onMouseWheel = function (event) { + if (this.touchParams.itemIsDragging) { + this._onDragEnd(event); + } +}; - 'use strict'; +/** + * Handle updates of an item on double tap + * @param {vis.Item} item The item + * @private + */ +ItemSet.prototype._onUpdateItem = function (item) { + if (!this.options.selectable) return; + if (!this.options.editable.add) return; + + var me = this; + + if (item) { + // execute async handler to update the item (or cancel it) + var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset + this.options.onUpdate(itemData, function (itemData) { + if (itemData) { + me.itemsData.getDataSet().update(itemData); + } + }); + } +}; - var _keys = __webpack_require__(58); +/** + * Handle drop event of data on item + * Only called when `objectData.target === 'item'. + * @param {Event} event The event + * @private + */ +ItemSet.prototype._onDropObjectOnItem = function (event) { + var item = this.itemFromTarget(event); + var objectData = JSON.parse(event.dataTransfer.getData("text")); + this.options.onDropObjectOnItem(objectData, item); +}; - var _keys2 = _interopRequireDefault(_keys); +/** + * Handle creation of an item on double tap or drop of a drag event + * @param {Event} event The event + * @private + */ +ItemSet.prototype._onAddItem = function (event) { + if (!this.options.selectable) return; + if (!this.options.editable.add) return; + + var me = this; + var snap = this.options.snap || null; + var xAbs; + var x; + // add item + if (this.options.rtl) { + xAbs = util.getAbsoluteRight(this.dom.frame); + x = xAbs - event.center.x; + } else { + xAbs = util.getAbsoluteLeft(this.dom.frame); + x = event.center.x - xAbs; + } + // var xAbs = util.getAbsoluteLeft(this.dom.frame); + // var x = event.center.x - xAbs; + var start = this.body.util.toTime(x); + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var end; + + var newItemData; + if (event.type == 'drop') { + newItemData = JSON.parse(event.dataTransfer.getData("text")); + newItemData.content = newItemData.content ? newItemData.content : 'new item'; + newItemData.start = newItemData.start ? newItemData.start : snap ? snap(start, scale, step) : start; + newItemData.type = newItemData.type || 'box'; + newItemData[this.itemsData._fieldId] = newItemData.id || util.randomUUID(); + + if (newItemData.type == 'range' && !newItemData.end) { + end = this.body.util.toTime(x + this.props.width / 5); + newItemData.end = snap ? snap(end, scale, step) : end; + } + } else { + newItemData = { + start: snap ? snap(start, scale, step) : start, + content: 'new item' + }; + newItemData[this.itemsData._fieldId] = util.randomUUID(); - var _stringify = __webpack_require__(90); + // when default type is a range, add a default end date to the new item + if (this.options.type === 'range') { + end = this.body.util.toTime(x + this.props.width / 5); + newItemData.end = snap ? snap(end, scale, step) : end; + } + } - var _stringify2 = _interopRequireDefault(_stringify); + var group = this.groupFromTarget(event); + if (group) { + newItemData.group = group.groupId; + } - var _typeof2 = __webpack_require__(62); + // execute async handler to customize (or cancel) adding an item + newItemData = this._cloneItemData(newItemData); // convert start and end to the correct type + this.options.onAdd(newItemData, function (item) { + if (item) { + me.itemsData.getDataSet().add(item); + if (event.type == 'drop') { + me.setSelection([item.id]); + } + // TODO: need to trigger a redraw? + } + }); +}; - var _typeof3 = _interopRequireDefault(_typeof2); +/** + * Handle selecting/deselecting multiple items when holding an item + * @param {Event} event + * @private + */ +ItemSet.prototype._onMultiSelectItem = function (event) { + if (!this.options.selectable) return; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var item = this.itemFromTarget(event); - var util = __webpack_require__(1); - var hammerUtil = __webpack_require__(120); - var moment = __webpack_require__(82); - var Component = __webpack_require__(121); - var DateUtil = __webpack_require__(122); + if (item) { + // multi select items (if allowed) - /** - * @constructor Range - * A Range controls a numeric range with a start and end value. - * The Range adjusts the range based on mouse events or programmatic changes, - * and triggers events when the range is changing or has been changed. - * @param {{dom: Object, domProps: Object, emitter: Emitter}} body - * @param {Object} [options] See description at Range.setOptions - */ - function Range(body, options) { - var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0); - var start = now.clone().add(-3, 'days').valueOf(); - var end = now.clone().add(3, 'days').valueOf(); - this.millisecondsPerPixelCache = undefined; - - if (options === undefined) { - this.start = start; - this.end = end; - } else { - this.start = options.start || start; - this.end = options.end || end; - } + var selection = this.options.multiselect ? this.getSelection() // take current selection + : []; // deselect current selection - this.rolling = false; + var shiftKey = event.srcEvent && event.srcEvent.shiftKey || false; - this.body = body; - this.deltaDifference = 0; - this.scaleOffset = 0; - this.startToFront = false; - this.endToFront = true; + if (shiftKey && this.options.multiselect) { + // select all items between the old selection and the tapped item + var itemGroup = this.itemsData.get(item.id).group; - // default options - this.defaultOptions = { - rtl: false, - start: null, - end: null, - moment: moment, - direction: 'horizontal', // 'horizontal' or 'vertical' - moveable: true, - zoomable: true, - min: null, - max: null, - zoomMin: 10, // milliseconds - zoomMax: 1000 * 60 * 60 * 24 * 365 * 10000, // milliseconds - rollingMode: { - follow: false, - offset: 0.5 + // when filtering get the group of the last selected item + var lastSelectedGroup = undefined; + if (this.options.multiselectPerGroup) { + if (selection.length > 0) { + lastSelectedGroup = this.itemsData.get(selection[0]).group; + } } - }; - this.options = util.extend({}, this.defaultOptions); - this.props = { - touch: {} - }; - this.animationTimer = null; - // drag listeners for dragging - this.body.emitter.on('panstart', this._onDragStart.bind(this)); - this.body.emitter.on('panmove', this._onDrag.bind(this)); - this.body.emitter.on('panend', this._onDragEnd.bind(this)); + // determine the selection range + if (!this.options.multiselectPerGroup || lastSelectedGroup == undefined || lastSelectedGroup == itemGroup) { + selection.push(item.id); + } + var range = ItemSet._getItemRange(this.itemsData.get(selection, this.itemOptions)); - // mouse wheel for zooming - this.body.emitter.on('mousewheel', this._onMouseWheel.bind(this)); + if (!this.options.multiselectPerGroup || lastSelectedGroup == itemGroup) { + // select all items within the selection range + selection = []; + for (var id in this.items) { + if (this.items.hasOwnProperty(id)) { + var _item = this.items[id]; + var start = _item.data.start; + var end = _item.data.end !== undefined ? _item.data.end : start; - // pinch to zoom - this.body.emitter.on('touch', this._onTouch.bind(this)); - this.body.emitter.on('pinch', this._onPinch.bind(this)); + if (start >= range.min && end <= range.max && (!this.options.multiselectPerGroup || lastSelectedGroup == this.itemsData.get(_item.id).group) && !(_item instanceof BackgroundItem)) { + selection.push(_item.id); // do not use id but item.id, id itself is stringified + } + } + } + } + } else { + // add/remove this item from the current selection + var index = selection.indexOf(item.id); + if (index == -1) { + // item is not yet selected -> select it + selection.push(item.id); + } else { + // item is already selected -> deselect it + selection.splice(index, 1); + } + } - // on click of rolling mode button - this.body.dom.rollingModeBtn.addEventListener('click', this.startRolling.bind(this)); + this.setSelection(selection); - this.setOptions(options); + this.body.emitter.emit('select', { + items: this.getSelection(), + event: event + }); } +}; - Range.prototype = new Component(); +/** + * Calculate the time range of a list of items + * @param {Array.} itemsData + * @return {{min: Date, max: Date}} Returns the range of the provided items + * @private + */ +ItemSet._getItemRange = function (itemsData) { + var max = null; + var min = null; - /** - * Set options for the range controller - * @param {Object} options Available options: - * {Number | Date | String} start Start date for the range - * {Number | Date | String} end End date for the range - * {Number} min Minimum value for start - * {Number} max Maximum value for end - * {Number} zoomMin Set a minimum value for - * (end - start). - * {Number} zoomMax Set a maximum value for - * (end - start). - * {Boolean} moveable Enable moving of the range - * by dragging. True by default - * {Boolean} zoomable Enable zooming of the range - * by pinching/scrolling. True by default - */ - Range.prototype.setOptions = function (options) { - if (options) { - // copy the options that we know - var fields = ['animation', 'direction', 'min', 'max', 'zoomMin', 'zoomMax', 'moveable', 'zoomable', 'moment', 'activate', 'hiddenDates', 'zoomKey', 'rtl', 'showCurrentTime', 'rollingMode', 'horizontalScroll']; - util.selectiveExtend(fields, this.options, options); + itemsData.forEach(function (data) { + if (min == null || data.start < min) { + min = data.start; + } - if (options.rollingMode && options.rollingMode.follow) { - this.startRolling(); + if (data.end != undefined) { + if (max == null || data.end > max) { + max = data.end; } - if ('start' in options || 'end' in options) { - // apply a new range. both start and end are optional - this.setRange(options.start, options.end); + } else { + if (max == null || data.start > max) { + max = data.start; } } + }); + + return { + min: min, + max: max }; +}; - /** - * Test whether direction has a valid value - * @param {String} direction 'horizontal' or 'vertical' - */ - function validateDirection(direction) { - if (direction != 'horizontal' && direction != 'vertical') { - throw new TypeError('Unknown direction "' + direction + '". ' + 'Choose "horizontal" or "vertical".'); +/** + * Find an item from an element: + * searches for the attribute 'timeline-item' in the element's tree + * @param {HTMLElement} element + * @return {Item | null} item + */ +ItemSet.prototype.itemFromElement = function (element) { + var cur = element; + while (cur) { + if (cur.hasOwnProperty('timeline-item')) { + return cur['timeline-item']; } + cur = cur.parentNode; } - /** - * Start auto refreshing the current time bar - */ - Range.prototype.startRolling = function () { - var me = this; - - function update() { - me.stopRolling(); - me.rolling = true; + return null; +}; - var interval = me.end - me.start; - var t = util.convert(new Date(), 'Date').valueOf(); +/** + * Find an item from an event target: + * searches for the attribute 'timeline-item' in the event target's element tree + * @param {Event} event + * @return {Item | null} item + */ +ItemSet.prototype.itemFromTarget = function (event) { + return this.itemFromElement(event.target); +}; - var start = t - interval * me.options.rollingMode.offset; - var end = t + interval * (1 - me.options.rollingMode.offset); - var animation = me.options && me.options.animation !== undefined ? me.options.animation : true; +/** + * Find an item from an event's related target: + * searches for the attribute 'timeline-item' in the related target's element tree + * @param {Event} event + * @return {Item | null} item + */ +ItemSet.prototype.itemFromRelatedTarget = function (event) { + return this.itemFromElement(event.relatedTarget); +}; - var options = { - animation: false - }; - me.setRange(start, end, options); +/** + * Find the Group from an event target: + * searches for the attribute 'timeline-group' in the event target's element tree + * @param {Event} event + * @return {Group | null} group + */ +ItemSet.prototype.groupFromTarget = function (event) { + var clientY = event.center ? event.center.y : event.clientY; + var groupIds = this.groupIds; + + if (groupIds.length <= 0 && this.groupsData) { + groupIds = this.groupsData.getIds({ + order: this.options.groupOrder + }); + } - // determine interval to refresh - var scale = me.conversion(me.body.domProps.center.width).scale; - var interval = 1 / scale / 10; - if (interval < 30) interval = 30; - if (interval > 1000) interval = 1000; + for (var i = 0; i < groupIds.length; i++) { + var groupId = groupIds[i]; + var group = this.groups[groupId]; + var foreground = group.dom.foreground; + var top = util.getAbsoluteTop(foreground); + if (clientY > top && clientY < top + foreground.offsetHeight) { + return group; + } - me.body.dom.rollingModeBtn.style.visibility = "hidden"; - // start a renderTimer to adjust for the new time - me.currentTimeTimer = setTimeout(update, interval); + if (this.options.orientation.item === 'top') { + if (i === this.groupIds.length - 1 && clientY > top) { + return group; + } + } else { + if (i === 0 && clientY < top + foreground.offset) { + return group; + } } + } - update(); - }; + return null; +}; - /** - * Stop auto refreshing the current time bar - */ - Range.prototype.stopRolling = function () { - if (this.currentTimeTimer !== undefined) { - clearTimeout(this.currentTimeTimer); - this.rolling = false; - this.body.dom.rollingModeBtn.style.visibility = "visible"; +/** + * Find the ItemSet from an event target: + * searches for the attribute 'timeline-itemset' in the event target's element tree + * @param {Event} event + * @return {ItemSet | null} item + */ +ItemSet.itemSetFromTarget = function (event) { + var target = event.target; + while (target) { + if (target.hasOwnProperty('timeline-itemset')) { + return target['timeline-itemset']; } - }; + target = target.parentNode; + } - /** - * Set a new start and end range - * @param {Date | Number | String} [start] - * @param {Date | Number | String} [end] - * @param {Object} options Available options: - * {Boolean | {duration: number, easingFunction: string}} [animation=false] - * If true, the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * {Boolean} [byUser=false] - * {Event} event Mouse event - * {Function} a callback funtion to be executed at the end of this function - * - */ + return null; +}; - Range.prototype.setRange = function (start, end, options, callback) { - if (!options) { - options = {}; - } - if (options.byUser !== true) { - options.byUser = false; - } - var me = this; - var finalStart = start != undefined ? util.convert(start, 'Date').valueOf() : null; - var finalEnd = end != undefined ? util.convert(end, 'Date').valueOf() : null; - this._cancelAnimation(); - this.millisecondsPerPixelCache = undefined; - - if (options.animation) { - // true or an Object - var initStart = this.start; - var initEnd = this.end; - var duration = (0, _typeof3['default'])(options.animation) === 'object' && 'duration' in options.animation ? options.animation.duration : 500; - var easingName = (0, _typeof3['default'])(options.animation) === 'object' && 'easingFunction' in options.animation ? options.animation.easingFunction : 'easeInOutQuad'; - var easingFunction = util.easingFunctions[easingName]; - if (!easingFunction) { - throw new Error('Unknown easing function ' + (0, _stringify2['default'])(easingName) + '. ' + 'Choose from: ' + (0, _keys2['default'])(util.easingFunctions).join(', ')); - } - - var initTime = new Date().valueOf(); - var anyChanged = false; - - var next = function next() { - if (!me.props.touch.dragging) { - var now = new Date().valueOf(); - var time = now - initTime; - var ease = easingFunction(time / duration); - var done = time > duration; - var s = done || finalStart === null ? finalStart : initStart + (finalStart - initStart) * ease; - var e = done || finalEnd === null ? finalEnd : initEnd + (finalEnd - initEnd) * ease; - - changed = me._applyRange(s, e); - DateUtil.updateHiddenDates(me.options.moment, me.body, me.options.hiddenDates); - anyChanged = anyChanged || changed; - - var params = { - start: new Date(me.start), - end: new Date(me.end), - byUser: options.byUser, - event: options.event - }; +/** + * Clone the data of an item, and "normalize" it: convert the start and end date + * to the type (Date, Moment, ...) configured in the DataSet. If not configured, + * start and end are converted to Date. + * @param {Object} itemData, typically `item.data` + * @param {string} [type] Optional Date type. If not provided, the type from the DataSet is taken + * @return {Object} The cloned object + * @private + */ +ItemSet.prototype._cloneItemData = function (itemData, type) { + var clone = util.extend({}, itemData); - if (changed) { - me.body.emitter.emit('rangechange', params); - } + if (!type) { + // convert start and end date to the type (Date, Moment, ...) configured in the DataSet + type = this.itemsData.getDataSet()._options.type; + } - if (done) { - if (anyChanged) { - me.body.emitter.emit('rangechanged', params); - if (callback) { - return callback(); - } - } - } else { - // animate with as high as possible frame rate, leave 20 ms in between - // each to prevent the browser from blocking - me.animationTimer = setTimeout(next, 20); - } - } - }; + if (clone.start != undefined) { + clone.start = util.convert(clone.start, type && type.start || 'Date'); + } + if (clone.end != undefined) { + clone.end = util.convert(clone.end, type && type.end || 'Date'); + } - return next(); - } else { - var changed = this._applyRange(finalStart, finalEnd); - DateUtil.updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates); - if (changed) { - var params = { - start: new Date(this.start), - end: new Date(this.end), - byUser: options.byUser, - event: options.event - }; + return clone; +}; - this.body.emitter.emit('rangechange', params); - clearTimeout(me.timeoutID); - me.timeoutID = setTimeout(function () { - me.body.emitter.emit('rangechanged', params); - }, 200); - if (callback) { - return callback(); - } - } - } - }; +module.exports = ItemSet; - /** - * Get the number of milliseconds per pixel. - */ - Range.prototype.getMillisecondsPerPixel = function () { - if (this.millisecondsPerPixelCache === undefined) { - this.millisecondsPerPixelCache = (this.end - this.start) / this.body.dom.center.clientWidth; - } - return this.millisecondsPerPixelCache; - }; +/***/ }), +/* 100 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Stop an animation - * @private - */ - Range.prototype._cancelAnimation = function () { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - } - }; +"use strict"; - /** - * Set a new start and end range. This method is the same as setRange, but - * does not trigger a range change and range changed event, and it returns - * true when the range is changed - * @param {Number} [start] - * @param {Number} [end] - * @return {Boolean} changed - * @private - */ - Range.prototype._applyRange = function (start, end) { - var newStart = start != null ? util.convert(start, 'Date').valueOf() : this.start, - newEnd = end != null ? util.convert(end, 'Date').valueOf() : this.end, - max = this.options.max != null ? util.convert(this.options.max, 'Date').valueOf() : null, - min = this.options.min != null ? util.convert(this.options.min, 'Date').valueOf() : null, - diff; - // check for valid number - if (isNaN(newStart) || newStart === null) { - throw new Error('Invalid start "' + start + '"'); - } - if (isNaN(newEnd) || newEnd === null) { - throw new Error('Invalid end "' + end + '"'); - } +// Utility functions for ordering and stacking of items +var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors - // prevent end < start - if (newEnd < newStart) { - newEnd = newStart; - } +/** + * Order items by their start data + * @param {Item[]} items + */ +exports.orderByStart = function (items) { + items.sort(function (a, b) { + return a.data.start - b.data.start; + }); +}; - // prevent start < min - if (min !== null) { - if (newStart < min) { - diff = min - newStart; - newStart += diff; - newEnd += diff; +/** + * Order items by their end date. If they have no end date, their start date + * is used. + * @param {Item[]} items + */ +exports.orderByEnd = function (items) { + items.sort(function (a, b) { + var aTime = 'end' in a.data ? a.data.end : a.data.start, + bTime = 'end' in b.data ? b.data.end : b.data.start; + + return aTime - bTime; + }); +}; - // prevent end > max - if (max != null) { - if (newEnd > max) { - newEnd = max; +/** + * Adjust vertical positions of the items such that they don't overlap each + * other. + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {boolean} [force=false] + * If true, all items will be repositioned. If false (default), only + * items having a top===null will be re-stacked + */ +exports.stack = function (items, margin, force) { + if (force) { + // reset top position of all items + for (var i = 0; i < items.length; i++) { + items[i].top = null; + } + } + + // calculate new, non-overlapping positions + for (var i = 0; i < items.length; i++) { + // eslint-disable-line no-redeclare + var item = items[i]; + if (item.stack && item.top === null) { + // initialize top position + item.top = margin.axis; + + do { + // TODO: optimize checking for overlap. when there is a gap without items, + // you only need to check for items from the next item on, not from zero + var collidingItem = null; + for (var j = 0, jj = items.length; j < jj; j++) { + var other = items[j]; + if (other.top !== null && other !== item && other.stack && exports.collision(item, other, margin.item, other.options.rtl)) { + collidingItem = other; + break; } } - } - } - // prevent end > max - if (max !== null) { - if (newEnd > max) { - diff = newEnd - max; - newStart -= diff; - newEnd -= diff; + if (collidingItem != null) { + // There is a collision. Reposition the items above the colliding element + item.top = collidingItem.top + collidingItem.height + margin.item.vertical; + } + } while (collidingItem); + } + } +}; - // prevent start < min - if (min != null) { - if (newStart < min) { - newStart = min; +/** + * Adjust vertical positions of the items within a single subgroup such that they + * don't overlap each other. + * @param {Item[]} items + * All items withina subgroup + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {subgroup} subgroup + * The subgroup that is being stacked + */ +exports.substack = function (items, margin, subgroup) { + for (var i = 0; i < items.length; i++) { + items[i].top = null; + } + + // Set the initial height + var subgroupHeight = subgroup.height; + + // calculate new, non-overlapping positions + for (i = 0; i < items.length; i++) { + var item = items[i]; + + if (item.stack && item.top === null) { + // initialize top position + item.top = item.baseTop; //margin.axis + item.baseTop; + + do { + // TODO: optimize checking for overlap. when there is a gap without items, + // you only need to check for items from the next item on, not from zero + var collidingItem = null; + for (var j = 0, jj = items.length; j < jj; j++) { + var other = items[j]; + if (other.top !== null && other !== item /*&& other.stack*/ && exports.collision(item, other, margin.item, other.options.rtl)) { + collidingItem = other; + break; } } - } - } - // prevent (end-start) < zoomMin - if (this.options.zoomMin !== null) { - var zoomMin = parseFloat(this.options.zoomMin); - if (zoomMin < 0) { - zoomMin = 0; - } - if (newEnd - newStart < zoomMin) { - // compensate for a scale of 0.5 ms - var compensation = 0.5; - if (this.end - this.start === zoomMin && newStart >= this.start - compensation && newEnd <= this.end) { - // ignore this action, we are already zoomed to the minimum - newStart = this.start; - newEnd = this.end; - } else { - // zoom to the minimum - diff = zoomMin - (newEnd - newStart); - newStart -= diff / 2; - newEnd += diff / 2; + if (collidingItem != null) { + // There is a collision. Reposition the items above the colliding element + item.top = collidingItem.top + collidingItem.height + margin.item.vertical; // + item.baseTop; } - } + + if (item.top + item.height > subgroupHeight) { + subgroupHeight = item.top + item.height; + } + } while (collidingItem); } + } - // prevent (end-start) > zoomMax - if (this.options.zoomMax !== null) { - var zoomMax = parseFloat(this.options.zoomMax); - if (zoomMax < 0) { - zoomMax = 0; - } + // Set the new height + subgroup.height = subgroupHeight - subgroup.top + 0.5 * margin.item.vertical; +}; - if (newEnd - newStart > zoomMax) { - if (this.end - this.start === zoomMax && newStart < this.start && newEnd > this.end) { - // ignore this action, we are already zoomed to the maximum - newStart = this.start; - newEnd = this.end; - } else { - // zoom to the maximum - diff = newEnd - newStart - zoomMax; - newStart += diff / 2; - newEnd -= diff / 2; +/** + * Adjust vertical positions of the items without stacking them + * @param {Item[]} items + * All visible items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {subgroups[]} subgroups + * All subgroups + * @param {boolean} stackSubgroups + */ +exports.nostack = function (items, margin, subgroups, stackSubgroups) { + for (var i = 0; i < items.length; i++) { + if (items[i].data.subgroup == undefined) { + items[i].top = margin.item.vertical; + } else if (items[i].data.subgroup !== undefined && stackSubgroups) { + var newTop = 0; + for (var subgroup in subgroups) { + if (subgroups.hasOwnProperty(subgroup)) { + if (subgroups[subgroup].visible == true && subgroups[subgroup].index < subgroups[items[i].data.subgroup].index) { + newTop += subgroups[subgroup].height; + subgroups[items[i].data.subgroup].top = newTop; + } } } + items[i].top = newTop + 0.5 * margin.item.vertical; } + } + if (!stackSubgroups) { + exports.stackSubgroups(items, margin, subgroups); + } +}; - var changed = this.start != newStart || this.end != newEnd; - - // if the new range does NOT overlap with the old range, emit checkRangedItems to avoid not showing ranged items (ranged meaning has end time, not necessarily of type Range) - if (!(newStart >= this.start && newStart <= this.end || newEnd >= this.start && newEnd <= this.end) && !(this.start >= newStart && this.start <= newEnd || this.end >= newStart && this.end <= newEnd)) { - this.body.emitter.emit('checkRangedItems'); - } +/** + * Adjust vertical positions of the subgroups such that they don't overlap each + * other. + * @param {Array.} items + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin Margins between items and between items and the axis. + * @param {subgroups[]} subgroups + * All subgroups + */ +exports.stackSubgroups = function (items, margin, subgroups) { + for (var subgroup in subgroups) { + if (subgroups.hasOwnProperty(subgroup)) { + + subgroups[subgroup].top = 0; + do { + // TODO: optimize checking for overlap. when there is a gap without items, + // you only need to check for items from the next item on, not from zero + var collidingItem = null; + for (var otherSubgroup in subgroups) { + if (subgroups[otherSubgroup].top !== null && otherSubgroup !== subgroup && subgroups[subgroup].index > subgroups[otherSubgroup].index && exports.collisionByTimes(subgroups[subgroup], subgroups[otherSubgroup])) { + collidingItem = subgroups[otherSubgroup]; + break; + } + } - this.start = newStart; - this.end = newEnd; - return changed; - }; + if (collidingItem != null) { + // There is a collision. Reposition the subgroups above the colliding element + subgroups[subgroup].top = collidingItem.top + collidingItem.height; + } + } while (collidingItem); + } + } + for (var i = 0; i < items.length; i++) { + if (items[i].data.subgroup !== undefined) { + items[i].top = subgroups[items[i].data.subgroup].top + 0.5 * margin.item.vertical; + } + } +}; - /** - * Retrieve the current range. - * @return {Object} An object with start and end properties - */ - Range.prototype.getRange = function () { - return { - start: this.start, - end: this.end - }; - }; +/** + * Adjust vertical positions of the subgroups such that they don't overlap each + * other, then stacks the contents of each subgroup individually. + * @param {Item[]} subgroupItems + * All the items in a subgroup + * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin + * Margins between items and between items and the axis. + * @param {subgroups[]} subgroups + * All subgroups + */ +exports.stackSubgroupsWithInnerStack = function (subgroupItems, margin, subgroups) { + var doSubStack = false; + + // Run subgroups in their order (if any) + var subgroupOrder = []; + + for (var subgroup in subgroups) { + if (subgroups[subgroup].hasOwnProperty("index")) { + subgroupOrder[subgroups[subgroup].index] = subgroup; + } else { + subgroupOrder.push(subgroup); + } + } - /** - * Calculate the conversion offset and scale for current range, based on - * the provided width - * @param {Number} width - * @returns {{offset: number, scale: number}} conversion - */ - Range.prototype.conversion = function (width, totalHidden) { - return Range.conversion(this.start, this.end, width, totalHidden); - }; + for (var j = 0; j < subgroupOrder.length; j++) { + subgroup = subgroupOrder[j]; + if (subgroups.hasOwnProperty(subgroup)) { - /** - * Static method to calculate the conversion offset and scale for a range, - * based on the provided start, end, and width - * @param {Number} start - * @param {Number} end - * @param {Number} width - * @returns {{offset: number, scale: number}} conversion - */ - Range.conversion = function (start, end, width, totalHidden) { - if (totalHidden === undefined) { - totalHidden = 0; - } - if (width != 0 && end - start != 0) { - return { - offset: start, - scale: width / (end - start - totalHidden) - }; - } else { - return { - offset: 0, - scale: 1 - }; + doSubStack = doSubStack || subgroups[subgroup].stack; + subgroups[subgroup].top = 0; + + for (var otherSubgroup in subgroups) { + if (subgroups[otherSubgroup].visible && subgroups[subgroup].index > subgroups[otherSubgroup].index) { + subgroups[subgroup].top += subgroups[otherSubgroup].height; + } + } + + var items = subgroupItems[subgroup]; + for (var i = 0; i < items.length; i++) { + if (items[i].data.subgroup !== undefined) { + items[i].top = subgroups[items[i].data.subgroup].top + 0.5 * margin.item.vertical; + + if (subgroups[subgroup].stack) { + items[i].baseTop = items[i].top; + } + } + } + + if (doSubStack && subgroups[subgroup].stack) { + exports.substack(subgroupItems[subgroup], margin, subgroups[subgroup]); + } } - }; + } +}; - /** - * Start dragging horizontally or vertically - * @param {Event} event - * @private - */ - Range.prototype._onDragStart = function (event) { - this.deltaDifference = 0; - this.previousDelta = 0; +/** + * Test if the two provided items collide + * The items must have parameters left, width, top, and height. + * @param {Item} a The first item + * @param {Item} b The second item + * @param {{horizontal: number, vertical: number}} margin + * An object containing a horizontal and vertical + * minimum required margin. + * @param {boolean} rtl + * @return {boolean} true if a and b collide, else false + */ +exports.collision = function (a, b, margin, rtl) { + if (rtl) { + return a.right - margin.horizontal + EPSILON < b.right + b.width && a.right + a.width + margin.horizontal - EPSILON > b.right && a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top; + } else { + return a.left - margin.horizontal + EPSILON < b.left + b.width && a.left + a.width + margin.horizontal - EPSILON > b.left && a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top; + } +}; - // only allow dragging when configured as movable - if (!this.options.moveable) return; +/** + * Test if the two provided objects collide + * The objects must have parameters start, end, top, and height. + * @param {Object} a The first Object + * @param {Object} b The second Object + * @return {boolean} true if a and b collide, else false + */ +exports.collisionByTimes = function (a, b) { + return a.start <= b.start && a.end >= b.start && a.top < b.top + b.height && a.top + a.height > b.top || b.start <= a.start && b.end >= a.start && b.top < a.top + a.height && b.top + b.height > a.top; +}; - // only start dragging when the mouse is inside the current range - if (!this._isInsideRange(event)) return; +/***/ }), +/* 101 */ +/***/ (function(module, exports, __webpack_require__) { - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.props.touch.allowDragging) return; +"use strict"; - this.stopRolling(); - this.props.touch.start = this.start; - this.props.touch.end = this.end; - this.props.touch.dragging = true; +var Item = __webpack_require__(38); - if (this.body.dom.root) { - this.body.dom.root.style.cursor = 'move'; +/** + * @constructor BoxItem + * @extends Item + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ +function BoxItem(data, conversion, options) { + this.props = { + dot: { + width: 0, + height: 0 + }, + line: { + width: 0, + height: 0 } }; + this.options = options; + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data); + } + } - /** - * Perform dragging operation - * @param {Event} event - * @private - */ - Range.prototype._onDrag = function (event) { - if (!event) return; + Item.call(this, data, conversion, options); +} - if (!this.props.touch.dragging) return; +BoxItem.prototype = new Item(null, null, null); - // only allow dragging when configured as movable - if (!this.options.moveable) return; +/** + * Check whether this item is visible inside given range + * @param {{start: number, end: number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ +BoxItem.prototype.isVisible = function (range) { + // determine visibility + var isVisible; + var align = this.options.align; + var widthInMs = this.width * range.getMillisecondsPerPixel(); + + if (align == 'right') { + isVisible = this.data.start.getTime() > range.start && this.data.start.getTime() - widthInMs < range.end; + } else if (align == 'left') { + isVisible = this.data.start.getTime() + widthInMs > range.start && this.data.start.getTime() < range.end; + } else { + // default or 'center' + isVisible = this.data.start.getTime() + widthInMs / 2 > range.start && this.data.start.getTime() - widthInMs / 2 < range.end; + } + return isVisible; +}; - // TODO: this may be redundant in hammerjs2 - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.props.touch.allowDragging) return; +BoxItem.prototype._createDomElement = function () { + if (!this.dom) { + // create DOM + this.dom = {}; - var direction = this.options.direction; - validateDirection(direction); - var delta = direction == 'horizontal' ? event.deltaX : event.deltaY; - delta -= this.deltaDifference; - var interval = this.props.touch.end - this.props.touch.start; + // create main box + this.dom.box = document.createElement('DIV'); - // normalize dragging speed if cutout is in between. - var duration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); - interval -= duration; + // contents box (inside the background box). used for making margins + this.dom.content = document.createElement('DIV'); + this.dom.content.className = 'vis-item-content'; + this.dom.box.appendChild(this.dom.content); - var width = direction == 'horizontal' ? this.body.domProps.center.width : this.body.domProps.center.height; + // line to axis + this.dom.line = document.createElement('DIV'); + this.dom.line.className = 'vis-line'; - if (this.options.rtl) { - var diffRange = delta / width * interval; - } else { - var diffRange = -delta / width * interval; - } + // dot on axis + this.dom.dot = document.createElement('DIV'); + this.dom.dot.className = 'vis-dot'; - var newStart = this.props.touch.start + diffRange; - var newEnd = this.props.touch.end + diffRange; + // attach this item as attribute + this.dom.box['timeline-item'] = this; - // snapping times away from hidden zones - var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, this.previousDelta - delta, true); - var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, this.previousDelta - delta, true); - if (safeStart != newStart || safeEnd != newEnd) { - this.deltaDifference += delta; - this.props.touch.start = safeStart; - this.props.touch.end = safeEnd; - this._onDrag(event); - return; + this.dirty = true; + } +}; + +BoxItem.prototype._appendDomElement = function () { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) throw new Error('Cannot redraw item: parent has no foreground container element'); + foreground.appendChild(this.dom.box); + } + if (!this.dom.line.parentNode) { + var background = this.parent.dom.background; + if (!background) throw new Error('Cannot redraw item: parent has no background container element'); + background.appendChild(this.dom.line); + } + if (!this.dom.dot.parentNode) { + var axis = this.parent.dom.axis; + if (!background) throw new Error('Cannot redraw item: parent has no axis container element'); + axis.appendChild(this.dom.dot); + } + this.displayed = true; +}; + +BoxItem.prototype._updateDirtyDomComponents = function () { + // An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.box); + this._updateStyle(this.dom.box); + + var editable = this.editable.updateTime || this.editable.updateGroup; + + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); + this.dom.box.className = 'vis-item vis-box' + className; + this.dom.line.className = 'vis-item vis-line' + className; + this.dom.dot.className = 'vis-item vis-dot' + className; + } +}; + +BoxItem.prototype._getDomComponentsSizes = function () { + return { + previous: { + right: this.dom.box.style.right, + left: this.dom.box.style.left + }, + dot: { + height: this.dom.dot.offsetHeight, + width: this.dom.dot.offsetWidth + }, + line: { + width: this.dom.line.offsetWidth + }, + box: { + width: this.dom.box.offsetWidth, + height: this.dom.box.offsetHeight } + }; +}; - this.previousDelta = delta; - this._applyRange(newStart, newEnd); - - var startDate = new Date(this.start); - var endDate = new Date(this.end); - - // fire a rangechange event - this.body.emitter.emit('rangechange', { - start: startDate, - end: endDate, - byUser: true, - event: event - }); +BoxItem.prototype._updateDomComponentsSizes = function (sizes) { + if (this.options.rtl) { + this.dom.box.style.right = "0px"; + } else { + this.dom.box.style.left = "0px"; + } - // fire a panmove event - this.body.emitter.emit('panmove'); - }; + // recalculate size + this.props.dot.height = sizes.dot.height; + this.props.dot.width = sizes.dot.width; + this.props.line.width = sizes.line.width; + this.width = sizes.box.width; + this.height = sizes.box.height; - /** - * Stop dragging operation - * @param {event} event - * @private - */ - Range.prototype._onDragEnd = function (event) { - if (!this.props.touch.dragging) return; + // restore previous position + if (this.options.rtl) { + this.dom.box.style.right = sizes.previous.right; + } else { + this.dom.box.style.left = sizes.previous.left; + } - // only allow dragging when configured as movable - if (!this.options.moveable) return; + this.dirty = false; +}; - // TODO: this may be redundant in hammerjs2 - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.props.touch.allowDragging) return; +BoxItem.prototype._repaintDomAdditionals = function () { + this._repaintOnItemUpdateTimeTooltip(this.dom.box); + this._repaintDragCenter(); + this._repaintDeleteButton(this.dom.box); +}; - this.props.touch.dragging = false; - if (this.body.dom.root) { - this.body.dom.root.style.cursor = 'auto'; +/** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw queue if returnQueue=true + */ +BoxItem.prototype.redraw = function (returnQueue) { + var sizes; + var queue = [ + // create item DOM + this._createDomElement.bind(this), + + // append DOM to parent DOM + this._appendDomElement.bind(this), + + // update dirty DOM + this._updateDirtyDomComponents.bind(this), function () { + if (this.dirty) { + sizes = this._getDomComponentsSizes(); + } + }.bind(this), function () { + if (this.dirty) { + this._updateDomComponentsSizes.bind(this)(sizes); } + }.bind(this), - // fire a rangechanged event - this.body.emitter.emit('rangechanged', { - start: new Date(this.start), - end: new Date(this.end), - byUser: true, - event: event + // repaint DOM additionals + this._repaintDomAdditionals.bind(this)]; + + if (returnQueue) { + return queue; + } else { + var result; + queue.forEach(function (fn) { + result = fn(); }); - }; + return result; + } +}; - /** - * Event handler for mouse wheel event, used to zoom - * Code from http://adomas.org/javascript-mouse-wheel/ - * @param {Event} event - * @private - */ - Range.prototype._onMouseWheel = function (event) { - // retrieve delta - var delta = 0; - if (event.wheelDelta) { - /* IE/Opera. */ - delta = event.wheelDelta / 120; - } else if (event.detail) { - /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail / 3; - } - - // don't allow zoom when the according key is pressed and the zoomKey option or not zoomable but movable - if (this.options.zoomKey && !event[this.options.zoomKey] && this.options.zoomable || !this.options.zoomable && this.options.moveable) { - if (this.options.horizontalScroll) { - // Prevent default actions caused by mouse wheel - // (else the page and timeline both scroll) - event.preventDefault(); +/** + * Show the item in the DOM (when not already displayed). The items DOM will + * be created when needed. + */ +BoxItem.prototype.show = function () { + if (!this.displayed) { + this.redraw(); + } +}; - // calculate a single scroll jump relative to the range scale - var diff = delta * (this.end - this.start) / 20; - // calculate new start and end - var newStart = this.start - diff; - var newEnd = this.end - diff; +/** + * Hide the item from the DOM (when visible) + */ +BoxItem.prototype.hide = function () { + if (this.displayed) { + var dom = this.dom; - var options = { - animation: false, - byUser: true, - event: event - }; - this.setRange(newStart, newEnd, options); - } - return; - } + if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); + if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); + if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); - // only allow zooming when configured as zoomable and moveable - if (!(this.options.zoomable && this.options.moveable)) return; + this.displayed = false; + } +}; - // only zoom when the mouse is inside the current range - if (!this._isInsideRange(event)) return; +/** + * Reposition the item horizontally + * @Override + */ +BoxItem.prototype.repositionX = function () { + var start = this.conversion.toScreen(this.data.start); + var align = this.options.align; + + // calculate left position of the box + if (align == 'right') { + if (this.options.rtl) { + this.right = start - this.width; - // If delta is nonzero, handle it. - // Basically, delta is now positive if wheel was scrolled up, - // and negative, if wheel was scrolled down. - if (delta) { - // perform the zoom action. Delta is normally 1 or -1 + // reposition box, line, and dot + this.dom.box.style.right = this.right + 'px'; + this.dom.line.style.right = start - this.props.line.width + 'px'; + this.dom.dot.style.right = start - this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; + } else { + this.left = start - this.width; - // adjust a negative delta such that zooming in with delta 0.1 - // equals zooming out with a delta -0.1 - var scale; - if (delta < 0) { - scale = 1 - delta / 5; - } else { - scale = 1 / (1 + delta / 5); - } + // reposition box, line, and dot + this.dom.box.style.left = this.left + 'px'; + this.dom.line.style.left = start - this.props.line.width + 'px'; + this.dom.dot.style.left = start - this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; + } + } else if (align == 'left') { + if (this.options.rtl) { + this.right = start; - // calculate center, the date to zoom around - var pointerDate; - if (this.rolling) { - pointerDate = this.start + (this.end - this.start) * this.options.rollingMode.offset; - } else { - var pointer = this.getPointer({ x: event.clientX, y: event.clientY }, this.body.dom.center); - pointerDate = this._pointerToDate(pointer); - } - this.zoom(scale, pointerDate, delta, event); + // reposition box, line, and dot + this.dom.box.style.right = this.right + 'px'; + this.dom.line.style.right = start + 'px'; + this.dom.dot.style.right = start + this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; + } else { + this.left = start; - // Prevent default actions caused by mouse wheel - // (else the page and timeline both scroll) - event.preventDefault(); + // reposition box, line, and dot + this.dom.box.style.left = this.left + 'px'; + this.dom.line.style.left = start + 'px'; + this.dom.dot.style.left = start + this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; } - }; + } else { + // default or 'center' + if (this.options.rtl) { + this.right = start - this.width / 2; - /** - * Start of a touch gesture - * @private - */ - Range.prototype._onTouch = function (event) { - this.props.touch.start = this.start; - this.props.touch.end = this.end; - this.props.touch.allowDragging = true; - this.props.touch.center = null; - this.scaleOffset = 0; - this.deltaDifference = 0; - }; + // reposition box, line, and dot + this.dom.box.style.right = this.right + 'px'; + this.dom.line.style.right = start - this.props.line.width + 'px'; + this.dom.dot.style.right = start - this.props.dot.width / 2 + 'px'; + } else { + this.left = start - this.width / 2; - /** - * Handle pinch event - * @param {Event} event - * @private - */ - Range.prototype._onPinch = function (event) { - // only allow zooming when configured as zoomable and moveable - if (!(this.options.zoomable && this.options.moveable)) return; + // reposition box, line, and dot + this.dom.box.style.left = this.left + 'px'; + this.dom.line.style.left = start - this.props.line.width / 2 + 'px'; + this.dom.dot.style.left = start - this.props.dot.width / 2 + 'px'; + } + } +}; - this.props.touch.allowDragging = false; +/** + * Reposition the item vertically + * @Override + */ +BoxItem.prototype.repositionY = function () { + var orientation = this.options.orientation.item; + var box = this.dom.box; + var line = this.dom.line; + var dot = this.dom.dot; + + if (orientation == 'top') { + box.style.top = (this.top || 0) + 'px'; + + line.style.top = '0'; + line.style.height = this.parent.top + this.top + 1 + 'px'; + line.style.bottom = ''; + } else { + // orientation 'bottom' + var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty + var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; - if (!this.props.touch.center) { - this.props.touch.center = this.getPointer(event.center, this.body.dom.center); - } + box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; + line.style.top = itemSetHeight - lineHeight + 'px'; + line.style.bottom = '0'; + } - this.stopRolling(); + dot.style.top = -this.props.dot.height / 2 + 'px'; +}; - var scale = 1 / (event.scale + this.scaleOffset); - var centerDate = this._pointerToDate(this.props.touch.center); +/** + * Return the width of the item left from its start date + * @return {number} + */ +BoxItem.prototype.getWidthLeft = function () { + return this.width / 2; +}; - var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); - var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, centerDate); - var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; +/** + * Return the width of the item right from its start date + * @return {number} + */ +BoxItem.prototype.getWidthRight = function () { + return this.width / 2; +}; - // calculate new start and end - var newStart = centerDate - hiddenDurationBefore + (this.props.touch.start - (centerDate - hiddenDurationBefore)) * scale; - var newEnd = centerDate + hiddenDurationAfter + (this.props.touch.end - (centerDate + hiddenDurationAfter)) * scale; +module.exports = BoxItem; - // snapping times away from hidden zones - this.startToFront = 1 - scale <= 0; // used to do the right auto correction with periodic hidden times - this.endToFront = scale - 1 <= 0; // used to do the right auto correction with periodic hidden times +/***/ }), +/* 102 */ +/***/ (function(module, exports, __webpack_require__) { - var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true); - var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true); - if (safeStart != newStart || safeEnd != newEnd) { - this.props.touch.start = safeStart; - this.props.touch.end = safeEnd; - this.scaleOffset = 1 - event.scale; - newStart = safeStart; - newEnd = safeEnd; - } +"use strict"; - var options = { - animation: false, - byUser: true, - event: event - }; - this.setRange(newStart, newEnd, options); - this.startToFront = false; // revert to default - this.endToFront = true; // revert to default - }; +var Item = __webpack_require__(38); - /** - * Test whether the mouse from a mouse event is inside the visible window, - * between the current start and end date - * @param {Object} event - * @return {boolean} Returns true when inside the visible window - * @private - */ - Range.prototype._isInsideRange = function (event) { - // calculate the time where the mouse is, check whether inside - // and no scroll action should happen. - var clientX = event.center ? event.center.x : event.clientX; - if (this.options.rtl) { - var x = clientX - util.getAbsoluteLeft(this.body.dom.centerContainer); - } else { - var x = util.getAbsoluteRight(this.body.dom.centerContainer) - clientX; +/** + * @constructor PointItem + * @extends Item + * @param {Object} data Object containing parameters start + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe available options + */ +function PointItem(data, conversion, options) { + this.props = { + dot: { + top: 0, + width: 0, + height: 0 + }, + content: { + height: 0, + marginLeft: 0, + marginRight: 0 } - var time = this.body.util.toTime(x); - - return time >= this.start && time <= this.end; }; + this.options = options; + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data); + } + } - /** - * Helper function to calculate the center date for zooming - * @param {{x: Number, y: Number}} pointer - * @return {number} date - * @private - */ - Range.prototype._pointerToDate = function (pointer) { - var conversion; - var direction = this.options.direction; + Item.call(this, data, conversion, options); +} - validateDirection(direction); +PointItem.prototype = new Item(null, null, null); - if (direction == 'horizontal') { - return this.body.util.toTime(pointer.x).valueOf(); - } else { - var height = this.body.domProps.center.height; - conversion = this.conversion(height); - return pointer.y / conversion.scale + conversion.offset; - } - }; +/** + * Check whether this item is visible inside given range + * @param {{start: number, end: number}} range with a timestamp for start and end + * @returns {boolean} True if visible + */ +PointItem.prototype.isVisible = function (range) { + // determine visibility + var widthInMs = this.width * range.getMillisecondsPerPixel(); + + return this.data.start.getTime() + widthInMs > range.start && this.data.start < range.end; +}; + +PointItem.prototype._createDomElement = function () { + if (!this.dom) { + // create DOM + this.dom = {}; - /** - * Get the pointer location relative to the location of the dom element - * @param {{x: Number, y: Number}} touch - * @param {Element} element HTML DOM element - * @return {{x: Number, y: Number}} pointer - * @private - */ - Range.prototype.getPointer = function (touch, element) { - if (this.options.rtl) { - return { - x: util.getAbsoluteRight(element) - touch.x, - y: touch.y - util.getAbsoluteTop(element) - }; - } else { - return { - x: touch.x - util.getAbsoluteLeft(element), - y: touch.y - util.getAbsoluteTop(element) - }; + // background box + this.dom.point = document.createElement('div'); + // className is updated in redraw() + + // contents box, right from the dot + this.dom.content = document.createElement('div'); + this.dom.content.className = 'vis-item-content'; + this.dom.point.appendChild(this.dom.content); + + // dot at start + this.dom.dot = document.createElement('div'); + this.dom.point.appendChild(this.dom.dot); + + // attach this item as attribute + this.dom.point['timeline-item'] = this; + + this.dirty = true; + } +}; + +PointItem.prototype._appendDomElement = function () { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.point.parentNode) { + var foreground = this.parent.dom.foreground; + if (!foreground) { + throw new Error('Cannot redraw item: parent has no foreground container element'); + } + foreground.appendChild(this.dom.point); + } + this.displayed = true; +}; + +PointItem.prototype._updateDirtyDomComponents = function () { + // An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.point); + this._updateStyle(this.dom.point); + + var editable = this.editable.updateTime || this.editable.updateGroup; + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); + this.dom.point.className = 'vis-item vis-point' + className; + this.dom.dot.className = 'vis-item vis-dot' + className; + } +}; + +PointItem.prototype._getDomComponentsSizes = function () { + return { + dot: { + width: this.dom.dot.offsetWidth, + height: this.dom.dot.offsetHeight + }, + content: { + width: this.dom.content.offsetWidth, + height: this.dom.content.offsetHeight + }, + point: { + width: this.dom.point.offsetWidth, + height: this.dom.point.offsetHeight } }; +}; - /** - * Zoom the range the given scale in or out. Start and end date will - * be adjusted, and the timeline will be redrawn. You can optionally give a - * date around which to zoom. - * For example, try scale = 0.9 or 1.1 - * @param {Number} scale Scaling factor. Values above 1 will zoom out, - * values below 1 will zoom in. - * @param {Number} [center] Value representing a date around which will - * be zoomed. - */ - Range.prototype.zoom = function (scale, center, delta, event) { - // if centerDate is not provided, take it half between start Date and end Date - if (center == null) { - center = (this.start + this.end) / 2; - } +PointItem.prototype._updateDomComponentsSizes = function (sizes) { + // recalculate size of dot and contents + this.props.dot.width = sizes.dot.width; + this.props.dot.height = sizes.dot.height; + this.props.content.height = sizes.content.height; + + // resize contents + if (this.options.rtl) { + this.dom.content.style.marginRight = 2 * this.props.dot.width + 'px'; + } else { + this.dom.content.style.marginLeft = 2 * this.props.dot.width + 'px'; + } + //this.dom.content.style.marginRight = ... + 'px'; // TODO: margin right + + // recalculate size + this.width = sizes.point.width; + this.height = sizes.point.height; - var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); - var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this, center); - var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; + // reposition the dot + this.dom.dot.style.top = (this.height - this.props.dot.height) / 2 + 'px'; + if (this.options.rtl) { + this.dom.dot.style.right = this.props.dot.width / 2 + 'px'; + } else { + this.dom.dot.style.left = this.props.dot.width / 2 + 'px'; + } - // calculate new start and end - var newStart = center - hiddenDurationBefore + (this.start - (center - hiddenDurationBefore)) * scale; - var newEnd = center + hiddenDurationAfter + (this.end - (center + hiddenDurationAfter)) * scale; + this.dirty = false; +}; - // snapping times away from hidden zones - this.startToFront = delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times - this.endToFront = -delta > 0 ? false : true; // used to do the right autocorrection with periodic hidden times - var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, delta, true); - var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, -delta, true); - if (safeStart != newStart || safeEnd != newEnd) { - newStart = safeStart; - newEnd = safeEnd; +PointItem.prototype._repaintDomAdditionals = function () { + this._repaintOnItemUpdateTimeTooltip(this.dom.point); + this._repaintDragCenter(); + this._repaintDeleteButton(this.dom.point); +}; + +/** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw queue if returnQueue=true + */ +PointItem.prototype.redraw = function (returnQueue) { + var sizes; + var queue = [ + // create item DOM + this._createDomElement.bind(this), + + // append DOM to parent DOM + this._appendDomElement.bind(this), + + // update dirty DOM + this._updateDirtyDomComponents.bind(this), function () { + if (this.dirty) { + sizes = this._getDomComponentsSizes(); + } + }.bind(this), function () { + if (this.dirty) { + this._updateDomComponentsSizes.bind(this)(sizes); } + }.bind(this), - var options = { - animation: false, - byUser: true, - event: event - }; - this.setRange(newStart, newEnd, options); + // repaint DOM additionals + this._repaintDomAdditionals.bind(this)]; - this.startToFront = false; // revert to default - this.endToFront = true; // revert to default - }; + if (returnQueue) { + return queue; + } else { + var result; + queue.forEach(function (fn) { + result = fn(); + }); + return result; + } +}; - /** - * Move the range with a given delta to the left or right. Start and end - * value will be adjusted. For example, try delta = 0.1 or -0.1 - * @param {Number} delta Moving amount. Positive value will move right, - * negative value will move left - */ - Range.prototype.move = function (delta) { - // zoom start Date and end Date relative to the centerDate - var diff = this.end - this.start; +/** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + */ +PointItem.prototype.show = function () { + if (!this.displayed) { + this.redraw(); + } +}; + +/** + * Hide the item from the DOM (when visible) + */ +PointItem.prototype.hide = function () { + if (this.displayed) { + if (this.dom.point.parentNode) { + this.dom.point.parentNode.removeChild(this.dom.point); + } - // apply new values - var newStart = this.start + diff * delta; - var newEnd = this.end + diff * delta; + this.displayed = false; + } +}; - // TODO: reckon with min and max range +/** + * Reposition the item horizontally + * @Override + */ +PointItem.prototype.repositionX = function () { + var start = this.conversion.toScreen(this.data.start); - this.start = newStart; - this.end = newEnd; - }; + if (this.options.rtl) { + this.right = start - this.props.dot.width; - /** - * Move the range to a new center point - * @param {Number} moveTo New center point of the range - */ - Range.prototype.moveTo = function (moveTo) { - var center = (this.start + this.end) / 2; + // reposition point + this.dom.point.style.right = this.right + 'px'; + } else { + this.left = start - this.props.dot.width; - var diff = center - moveTo; + // reposition point + this.dom.point.style.left = this.left + 'px'; + } +}; - // calculate new start and end - var newStart = this.start - diff; - var newEnd = this.end - diff; +/** + * Reposition the item vertically + * @Override + */ +PointItem.prototype.repositionY = function () { + var orientation = this.options.orientation.item; + var point = this.dom.point; + if (orientation == 'top') { + point.style.top = this.top + 'px'; + } else { + point.style.top = this.parent.height - this.top - this.height + 'px'; + } +}; - var options = { - animation: false, - byUser: true, - event: null - }; - this.setRange(newStart, newEnd, options); - }; +/** + * Return the width of the item left from its start date + * @return {number} + */ +PointItem.prototype.getWidthLeft = function () { + return this.props.dot.width; +}; - module.exports = Range; +/** + * Return the width of the item right from its start date + * @return {number} + */ +PointItem.prototype.getWidthRight = function () { + return this.props.dot.width; +}; + +module.exports = PointItem; /***/ }), -/* 120 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - var Hammer = __webpack_require__(113); - /** - * Register a touch event, taking place before a gesture - * @param {Hammer} hammer A hammer instance - * @param {function} callback Callback, called as callback(event) - */ - exports.onTouch = function (hammer, callback) { - callback.inputHandler = function (event) { - if (event.isFirst) { - callback(event); - } - }; +var Item = __webpack_require__(38); +var BackgroundGroup = __webpack_require__(69); +var RangeItem = __webpack_require__(70); - hammer.on('hammer.input', callback.inputHandler); +/** + * @constructor BackgroundItem + * @extends Item + * @param {Object} data Object containing parameters start, end + * content, className. + * @param {{toScreen: function, toTime: function}} conversion + * Conversion functions from time to screen and vice versa + * @param {Object} [options] Configuration options + * // TODO: describe options + * // TODO: implement support for the BackgroundItem just having a start, then being displayed as a sort of an annotation + */ +function BackgroundItem(data, conversion, options) { + this.props = { + content: { + width: 0 + } }; + this.overflow = false; // if contents can overflow (css styling), this flag is set to true - /** - * Register a release event, taking place after a gesture - * @param {Hammer} hammer A hammer instance - * @param {function} callback Callback, called as callback(event) - */ - exports.onRelease = function (hammer, callback) { - callback.inputHandler = function (event) { - if (event.isFinal) { - callback(event); - } - }; + // validate data + if (data) { + if (data.start == undefined) { + throw new Error('Property "start" missing in item ' + data.id); + } + if (data.end == undefined) { + throw new Error('Property "end" missing in item ' + data.id); + } + } - return hammer.on('hammer.input', callback.inputHandler); - }; + Item.call(this, data, conversion, options); +} - /** - * Unregister a touch event, taking place before a gesture - * @param {Hammer} hammer A hammer instance - * @param {function} callback Callback, called as callback(event) - */ - exports.offTouch = function (hammer, callback) { - hammer.off('hammer.input', callback.inputHandler); - }; +BackgroundItem.prototype = new Item(null, null, null); - /** - * Unregister a release event, taking place before a gesture - * @param {Hammer} hammer A hammer instance - * @param {function} callback Callback, called as callback(event) - */ - exports.offRelease = exports.offTouch; +BackgroundItem.prototype.baseClassName = 'vis-item vis-background'; - /** - * Hack the PinchRecognizer such that it doesn't prevent default behavior - * for vertical panning. - * - * Yeah ... this is quite a hack ... see https://github.com/hammerjs/hammer.js/issues/932 - * - * @param {Hammer.Pinch} pinchRecognizer - * @return {Hammer.Pinch} returns the pinchRecognizer - */ - exports.disablePreventDefaultVertically = function (pinchRecognizer) { - var TOUCH_ACTION_PAN_Y = 'pan-y'; +BackgroundItem.prototype.stack = false; - pinchRecognizer.getTouchAction = function () { - // default method returns [TOUCH_ACTION_NONE] - return [TOUCH_ACTION_PAN_Y]; - }; +/** + * Check whether this item is visible inside given range + * @param {vis.Range} range with a timestamp for start and end + * @returns {boolean} True if visible + */ +BackgroundItem.prototype.isVisible = function (range) { + // determine visibility + return this.data.start < range.end && this.data.end > range.start; +}; + +BackgroundItem.prototype._createDomElement = function () { + if (!this.dom) { + // create DOM + this.dom = {}; - return pinchRecognizer; - }; + // background box + this.dom.box = document.createElement('div'); + // className is updated in redraw() -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { + // frame box (to prevent the item contents from overflowing + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'vis-item-overflow'; + this.dom.box.appendChild(this.dom.frame); - 'use strict'; + // contents box + this.dom.content = document.createElement('div'); + this.dom.content.className = 'vis-item-content'; + this.dom.frame.appendChild(this.dom.content); - var util = __webpack_require__(1); + // Note: we do NOT attach this item as attribute to the DOM, + // such that background items cannot be selected + //this.dom.box['timeline-item'] = this; - /** - * Prototype for visual components - * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} [body] - * @param {Object} [options] - */ - function Component(body, options) { - this.options = null; - this.props = null; + this.dirty = true; } +}; - /** - * Set options for the component. The new options will be merged into the - * current options. - * @param {Object} options - */ - Component.prototype.setOptions = function (options) { - if (options) { - util.extend(this.options, options); +BackgroundItem.prototype._appendDomElement = function () { + if (!this.parent) { + throw new Error('Cannot redraw item: no parent attached'); + } + if (!this.dom.box.parentNode) { + var background = this.parent.dom.background; + if (!background) { + throw new Error('Cannot redraw item: parent has no background container element'); } - }; - - /** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ - Component.prototype.redraw = function () { - // should be implemented by the component - return false; - }; - - /** - * Destroy the component. Cleanup DOM and event listeners - */ - Component.prototype.destroy = function () { - // should be implemented by the component - }; + background.appendChild(this.dom.box); + } + this.displayed = true; +}; - /** - * Test whether the component is resized since the last time _isResized() was - * called. - * @return {Boolean} Returns true if the component is resized - * @protected - */ - Component.prototype._isResized = function () { - var resized = this.props._previousWidth !== this.props.width || this.props._previousHeight !== this.props.height; +BackgroundItem.prototype._updateDirtyDomComponents = function () { + // update dirty DOM. An item is marked dirty when: + // - the item is not yet rendered + // - the item's data is changed + // - the item is selected/deselected + if (this.dirty) { + this._updateContents(this.dom.content); + this._updateDataAttributes(this.dom.content); + this._updateStyle(this.dom.box); - this.props._previousWidth = this.props.width; - this.props._previousHeight = this.props.height; + // update class + var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : ''); + this.dom.box.className = this.baseClassName + className; + } +}; - return resized; +BackgroundItem.prototype._getDomComponentsSizes = function () { + // determine from css whether this box has overflow + this.overflow = window.getComputedStyle(this.dom.content).overflow !== 'hidden'; + return { + content: { + width: this.dom.content.offsetWidth + } }; +}; - module.exports = Component; +BackgroundItem.prototype._updateDomComponentsSizes = function (sizes) { + // recalculate size + this.props.content.width = sizes.content.width; + this.height = 0; // set height zero, so this item will be ignored when stacking items -/***/ }), -/* 122 */ -/***/ (function(module, exports) { + this.dirty = false; +}; - "use strict"; +BackgroundItem.prototype._repaintDomAdditionals = function () {}; - /** - * used in Core to convert the options into a volatile variable - * - * @param {function} moment - * @param {Object} body - * @param {Array | Object} hiddenDates - */ - exports.convertHiddenOptions = function (moment, body, hiddenDates) { - if (hiddenDates && !Array.isArray(hiddenDates)) { - return exports.convertHiddenOptions(moment, body, [hiddenDates]); +/** + * Repaint the item + * @param {boolean} [returnQueue=false] return the queue + * @return {boolean} the redraw result or the redraw queue if returnQueue=true + */ +BackgroundItem.prototype.redraw = function (returnQueue) { + var sizes; + var queue = [ + // create item DOM + this._createDomElement.bind(this), + + // append DOM to parent DOM + this._appendDomElement.bind(this), this._updateDirtyDomComponents.bind(this), function () { + if (this.dirty) { + sizes = this._getDomComponentsSizes.bind(this)(); } - - body.hiddenDates = []; - if (hiddenDates) { - if (Array.isArray(hiddenDates) == true) { - for (var i = 0; i < hiddenDates.length; i++) { - if (hiddenDates[i].repeat === undefined) { - var dateItem = {}; - dateItem.start = moment(hiddenDates[i].start).toDate().valueOf(); - dateItem.end = moment(hiddenDates[i].end).toDate().valueOf(); - body.hiddenDates.push(dateItem); - } - } - body.hiddenDates.sort(function (a, b) { - return a.start - b.start; - }); // sort by start time - } + }.bind(this), function () { + if (this.dirty) { + this._updateDomComponentsSizes.bind(this)(sizes); } - }; + }.bind(this), - /** - * create new entrees for the repeating hidden dates - * @param {function} moment - * @param {Object} body - * @param {Array | Object} hiddenDates - */ - exports.updateHiddenDates = function (moment, body, hiddenDates) { - if (hiddenDates && !Array.isArray(hiddenDates)) { - return exports.updateHiddenDates(moment, body, [hiddenDates]); - } + // repaint DOM additionals + this._repaintDomAdditionals.bind(this)]; - if (hiddenDates && body.domProps.centerContainer.width !== undefined) { - exports.convertHiddenOptions(moment, body, hiddenDates); + if (returnQueue) { + return queue; + } else { + var result; + queue.forEach(function (fn) { + result = fn(); + }); + return result; + } +}; - var start = moment(body.range.start); - var end = moment(body.range.end); +/** + * Show the item in the DOM (when not already visible). The items DOM will + * be created when needed. + */ +BackgroundItem.prototype.show = RangeItem.prototype.show; - var totalRange = body.range.end - body.range.start; - var pixelTime = totalRange / body.domProps.centerContainer.width; +/** + * Hide the item from the DOM (when visible) + * @return {Boolean} changed + */ +BackgroundItem.prototype.hide = RangeItem.prototype.hide; - for (var i = 0; i < hiddenDates.length; i++) { - if (hiddenDates[i].repeat !== undefined) { - var startDate = moment(hiddenDates[i].start); - var endDate = moment(hiddenDates[i].end); +/** + * Reposition the item horizontally + * @Override + */ +BackgroundItem.prototype.repositionX = RangeItem.prototype.repositionX; - if (startDate._d == "Invalid Date") { - throw new Error("Supplied start date is not valid: " + hiddenDates[i].start); - } - if (endDate._d == "Invalid Date") { - throw new Error("Supplied end date is not valid: " + hiddenDates[i].end); - } +/** + * Reposition the item vertically + * @Override + */ +BackgroundItem.prototype.repositionY = function (margin) { + // eslint-disable-line no-unused-vars + var height; + var orientation = this.options.orientation.item; - var duration = endDate - startDate; - if (duration >= 4 * pixelTime) { + // special positioning for subgroups + if (this.data.subgroup !== undefined) { + // TODO: instead of calculating the top position of the subgroups here for every BackgroundItem, calculate the top of the subgroup once in Itemset + var itemSubgroup = this.data.subgroup; - var offset = 0; - var runUntil = end.clone(); - switch (hiddenDates[i].repeat) { - case "daily": - // case of time - if (startDate.day() != endDate.day()) { - offset = 1; - } - startDate.dayOfYear(start.dayOfYear()); - startDate.year(start.year()); - startDate.subtract(7, 'days'); + this.dom.box.style.height = this.parent.subgroups[itemSubgroup].height + 'px'; - endDate.dayOfYear(start.dayOfYear()); - endDate.year(start.year()); - endDate.subtract(7 - offset, 'days'); + if (orientation == 'top') { + this.dom.box.style.top = this.parent.top + this.parent.subgroups[itemSubgroup].top + 'px'; + } else { + this.dom.box.style.top = this.parent.top + this.parent.height - this.parent.subgroups[itemSubgroup].top - this.parent.subgroups[itemSubgroup].height + 'px'; + } + this.dom.box.style.bottom = ''; + } + // and in the case of no subgroups: + else { + // we want backgrounds with groups to only show in groups. + if (this.parent instanceof BackgroundGroup) { + // if the item is not in a group: + height = Math.max(this.parent.height, this.parent.itemSet.body.domProps.center.height, this.parent.itemSet.body.domProps.centerContainer.height); + this.dom.box.style.bottom = orientation == 'bottom' ? '0' : ''; + this.dom.box.style.top = orientation == 'top' ? '0' : ''; + } else { + height = this.parent.height; + // same alignment for items when orientation is top or bottom + this.dom.box.style.top = this.parent.top + 'px'; + this.dom.box.style.bottom = ''; + } + } + this.dom.box.style.height = height + 'px'; +}; - runUntil.add(1, 'weeks'); - break; - case "weekly": - var dayOffset = endDate.diff(startDate, 'days'); - var day = startDate.day(); +module.exports = BackgroundItem; - // set the start date to the range.start - startDate.date(start.date()); - startDate.month(start.month()); - startDate.year(start.year()); - endDate = startDate.clone(); +/***/ }), +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { - // force - startDate.day(day); - endDate.day(day); - endDate.add(dayOffset, 'days'); +"use strict"; - startDate.subtract(1, 'weeks'); - endDate.subtract(1, 'weeks'); - runUntil.add(1, 'weeks'); - break; - case "monthly": - if (startDate.month() != endDate.month()) { - offset = 1; - } - startDate.month(start.month()); - startDate.year(start.year()); - startDate.subtract(1, 'months'); +Object.defineProperty(exports, "__esModule", { + value: true +}); - endDate.month(start.month()); - endDate.year(start.year()); - endDate.subtract(1, 'months'); - endDate.add(offset, 'months'); +var _classCallCheck2 = __webpack_require__(0); - runUntil.add(1, 'months'); - break; - case "yearly": - if (startDate.year() != endDate.year()) { - offset = 1; - } - startDate.year(start.year()); - startDate.subtract(1, 'years'); - endDate.year(start.year()); - endDate.subtract(1, 'years'); - endDate.add(offset, 'years'); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - runUntil.add(1, 'years'); - break; - default: - console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat); - return; - } - while (startDate < runUntil) { - body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() }); - switch (hiddenDates[i].repeat) { - case "daily": - startDate.add(1, 'days'); - endDate.add(1, 'days'); - break; - case "weekly": - startDate.add(1, 'weeks'); - endDate.add(1, 'weeks'); - break; - case "monthly": - startDate.add(1, 'months'); - endDate.add(1, 'months'); - break; - case "yearly": - startDate.add(1, 'y'); - endDate.add(1, 'y'); - break; - default: - console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat); - return; - } - } - body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() }); - } - } - } - // remove duplicates, merge where possible - exports.removeDuplicates(body); - // ensure the new positions are not on hidden dates - var startHidden = exports.isHidden(body.range.start, body.hiddenDates); - var endHidden = exports.isHidden(body.range.end, body.hiddenDates); - var rangeStart = body.range.start; - var rangeEnd = body.range.end; - if (startHidden.hidden == true) { - rangeStart = body.range.startToFront == true ? startHidden.startDate - 1 : startHidden.endDate + 1; - } - if (endHidden.hidden == true) { - rangeEnd = body.range.endToFront == true ? endHidden.startDate - 1 : endHidden.endDate + 1; - } - if (startHidden.hidden == true || endHidden.hidden == true) { - body.range._applyRange(rangeStart, rangeEnd); - } - } - }; +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/** + * Popup is a class to create a popup window with some text + */ +var Popup = function () { /** - * remove duplicates from the hidden dates list. Duplicates are evil. They mess everything up. - * Scales with N^2 - * @param body + * @param {Element} container The container object. + * @param {string} overflowMethod How the popup should act to overflowing ('flip' or 'cap') */ - exports.removeDuplicates = function (body) { - var hiddenDates = body.hiddenDates; - var safeDates = []; - for (var i = 0; i < hiddenDates.length; i++) { - for (var j = 0; j < hiddenDates.length; j++) { - if (i != j && hiddenDates[j].remove != true && hiddenDates[i].remove != true) { - // j inside i - if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { - hiddenDates[j].remove = true; - } - // j start inside i - else if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].start <= hiddenDates[i].end) { - hiddenDates[i].end = hiddenDates[j].end; - hiddenDates[j].remove = true; - } - // j end inside i - else if (hiddenDates[j].end >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { - hiddenDates[i].start = hiddenDates[j].start; - hiddenDates[j].remove = true; - } - } - } - } + function Popup(container, overflowMethod) { + (0, _classCallCheck3['default'])(this, Popup); - for (var i = 0; i < hiddenDates.length; i++) { - if (hiddenDates[i].remove !== true) { - safeDates.push(hiddenDates[i]); - } - } + this.container = container; + this.overflowMethod = overflowMethod || 'cap'; - body.hiddenDates = safeDates; - body.hiddenDates.sort(function (a, b) { - return a.start - b.start; - }); // sort by start time - }; + this.x = 0; + this.y = 0; + this.padding = 5; + this.hidden = false; - exports.printDates = function (dates) { - for (var i = 0; i < dates.length; i++) { - console.log(i, new Date(dates[i].start), new Date(dates[i].end), dates[i].start, dates[i].end, dates[i].remove); - } - }; + // create the frame + this.frame = document.createElement('div'); + this.frame.className = 'vis-tooltip'; + this.container.appendChild(this.frame); + } /** - * Used in TimeStep to avoid the hidden times. - * @param {function} moment - * @param {TimeStep} timeStep - * @param previousTime + * @param {number} x Horizontal position of the popup window + * @param {number} y Vertical position of the popup window */ - exports.stepOverHiddenDates = function (moment, timeStep, previousTime) { - var stepInHidden = false; - var currentValue = timeStep.current.valueOf(); - for (var i = 0; i < timeStep.hiddenDates.length; i++) { - var startDate = timeStep.hiddenDates[i].start; - var endDate = timeStep.hiddenDates[i].end; - if (currentValue >= startDate && currentValue < endDate) { - stepInHidden = true; - break; - } - } - if (stepInHidden == true && currentValue < timeStep._end.valueOf() && currentValue != previousTime) { - var prevValue = moment(previousTime); - var newValue = moment(endDate); - //check if the next step should be major - if (prevValue.year() != newValue.year()) { - timeStep.switchedYear = true; - } else if (prevValue.month() != newValue.month()) { - timeStep.switchedMonth = true; - } else if (prevValue.dayOfYear() != newValue.dayOfYear()) { - timeStep.switchedDay = true; - } - timeStep.current = newValue; + (0, _createClass3['default'])(Popup, [{ + key: 'setPosition', + value: function setPosition(x, y) { + this.x = parseInt(x); + this.y = parseInt(y); } - }; - ///** - // * Used in TimeStep to avoid the hidden times. - // * @param timeStep - // * @param previousTime - // */ - //exports.checkFirstStep = function(timeStep) { - // var stepInHidden = false; - // var currentValue = timeStep.current.valueOf(); - // for (var i = 0; i < timeStep.hiddenDates.length; i++) { - // var startDate = timeStep.hiddenDates[i].start; - // var endDate = timeStep.hiddenDates[i].end; - // if (currentValue >= startDate && currentValue < endDate) { - // stepInHidden = true; - // break; - // } - // } - // - // if (stepInHidden == true && currentValue <= timeStep._end.valueOf()) { - // var newValue = moment(endDate); - // timeStep.current = newValue.toDate(); - // } - //}; + /** + * Set the content for the popup window. This can be HTML code or text. + * @param {string | Element} content + */ - /** - * replaces the Core toScreen methods - * @param Core - * @param time - * @param width - * @returns {number} - */ - exports.toScreen = function (Core, time, width) { - if (Core.body.hiddenDates.length == 0) { - var conversion = Core.range.conversion(width); - return (time.valueOf() - conversion.offset) * conversion.scale; - } else { - var hidden = exports.isHidden(time, Core.body.hiddenDates); - if (hidden.hidden == true) { - time = hidden.startDate; - } - - var duration = exports.getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end); - if (time < Core.range.start) { - var conversion = Core.range.conversion(width, duration); - var hiddenBeforeStart = exports.getHiddenDurationBeforeStart(Core.body.hiddenDates, time, conversion.offset); - time = Core.options.moment(time).toDate().valueOf(); - time = time + hiddenBeforeStart; - return -(conversion.offset - time.valueOf()) * conversion.scale; - } else if (time > Core.range.end) { - var rangeAfterEnd = { start: Core.range.start, end: time }; - time = exports.correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, rangeAfterEnd, time); - var conversion = Core.range.conversion(width, duration); - return (time.valueOf() - conversion.offset) * conversion.scale; + }, { + key: 'setText', + value: function setText(content) { + if (content instanceof Element) { + this.frame.innerHTML = ''; + this.frame.appendChild(content); } else { - time = exports.correctTimeForHidden(Core.options.moment, Core.body.hiddenDates, Core.range, time); - var conversion = Core.range.conversion(width, duration); - return (time.valueOf() - conversion.offset) * conversion.scale; + this.frame.innerHTML = content; // string containing text or HTML } } - }; - - /** - * Replaces the core toTime methods - * @param body - * @param range - * @param x - * @param width - * @returns {Date} - */ - exports.toTime = function (Core, x, width) { - if (Core.body.hiddenDates.length == 0) { - var conversion = Core.range.conversion(width); - return new Date(x / conversion.scale + conversion.offset); - } else { - var hiddenDuration = exports.getHiddenDurationBetween(Core.body.hiddenDates, Core.range.start, Core.range.end); - var totalDuration = Core.range.end - Core.range.start - hiddenDuration; - var partialDuration = totalDuration * x / width; - var accumulatedHiddenDuration = exports.getAccumulatedHiddenDuration(Core.body.hiddenDates, Core.range, partialDuration); - var newTime = new Date(accumulatedHiddenDuration + partialDuration + Core.range.start); - return newTime; - } - }; + /** + * Show the popup window + * @param {boolean} [doShow] Show or hide the window + */ - /** - * Support function - * - * @param hiddenDates - * @param range - * @returns {number} - */ - exports.getHiddenDurationBetween = function (hiddenDates, start, end) { - var duration = 0; - for (var i = 0; i < hiddenDates.length; i++) { - var startDate = hiddenDates[i].start; - var endDate = hiddenDates[i].end; - // if time after the cutout, and the - if (startDate >= start && endDate < end) { - duration += endDate - startDate; + }, { + key: 'show', + value: function show(doShow) { + if (doShow === undefined) { + doShow = true; } - } - return duration; - }; - /** - * Support function - * - * @param hiddenDates - * @param start - * @param end - * @returns {number} - */ - exports.getHiddenDurationBeforeStart = function (hiddenDates, start, end) { - var duration = 0; - for (var i = 0; i < hiddenDates.length; i++) { - var startDate = hiddenDates[i].start; - var endDate = hiddenDates[i].end; + if (doShow === true) { + var height = this.frame.clientHeight; + var width = this.frame.clientWidth; + var maxHeight = this.frame.parentNode.clientHeight; + var maxWidth = this.frame.parentNode.clientWidth; - if (startDate >= start && endDate <= end) { - duration += endDate - startDate; - } - } - return duration; - }; + var left = 0, + top = 0; - /** - * Support function - * @param moment - * @param hiddenDates - * @param range - * @param time - * @returns {{duration: number, time: *, offset: number}} - */ - exports.correctTimeForHidden = function (moment, hiddenDates, range, time) { - time = moment(time).toDate().valueOf(); - time -= exports.getHiddenDurationBefore(moment, hiddenDates, range, time); - return time; - }; + if (this.overflowMethod == 'flip') { + var isLeft = false, + isTop = true; // Where around the position it's located - exports.getHiddenDurationBefore = function (moment, hiddenDates, range, time) { - var timeOffset = 0; - time = moment(time).toDate().valueOf(); + if (this.y - height < this.padding) { + isTop = false; + } - for (var i = 0; i < hiddenDates.length; i++) { - var startDate = hiddenDates[i].start; - var endDate = hiddenDates[i].end; - // if time after the cutout, and the - if (startDate >= range.start && endDate < range.end) { - if (time >= endDate) { - timeOffset += endDate - startDate; - } - } - } - return timeOffset; - }; + if (this.x + width > maxWidth - this.padding) { + isLeft = true; + } - /** - * sum the duration from start to finish, including the hidden duration, - * until the required amount has been reached, return the accumulated hidden duration - * @param hiddenDates - * @param range - * @param time - * @returns {{duration: number, time: *, offset: number}} - */ - exports.getAccumulatedHiddenDuration = function (hiddenDates, range, requiredDuration) { - var hiddenDuration = 0; - var duration = 0; - var previousPoint = range.start; - //exports.printDates(hiddenDates) - for (var i = 0; i < hiddenDates.length; i++) { - var startDate = hiddenDates[i].start; - var endDate = hiddenDates[i].end; - // if time after the cutout, and the - if (startDate >= range.start && endDate < range.end) { - duration += startDate - previousPoint; - previousPoint = endDate; - if (duration >= requiredDuration) { - break; + if (isLeft) { + left = this.x - width; + } else { + left = this.x; + } + + if (isTop) { + top = this.y - height; + } else { + top = this.y; + } } else { - hiddenDuration += endDate - startDate; + top = this.y - height; + if (top + height + this.padding > maxHeight) { + top = maxHeight - height - this.padding; + } + if (top < this.padding) { + top = this.padding; + } + + left = this.x; + if (left + width + this.padding > maxWidth) { + left = maxWidth - width - this.padding; + } + if (left < this.padding) { + left = this.padding; + } } + + this.frame.style.left = left + "px"; + this.frame.style.top = top + "px"; + this.frame.style.visibility = "visible"; + this.hidden = false; + } else { + this.hide(); } } - return hiddenDuration; - }; + /** + * Hide the popup window + */ - /** - * used to step over to either side of a hidden block. Correction is disabled on tablets, might be set to true - * @param hiddenDates - * @param time - * @param direction - * @param correctionEnabled - * @returns {*} - */ - exports.snapAwayFromHidden = function (hiddenDates, time, direction, correctionEnabled) { - var isHidden = exports.isHidden(time, hiddenDates); - if (isHidden.hidden == true) { - if (direction < 0) { - if (correctionEnabled == true) { - return isHidden.startDate - (isHidden.endDate - time) - 1; - } else { - return isHidden.startDate - 1; - } - } else { - if (correctionEnabled == true) { - return isHidden.endDate + (time - isHidden.startDate) + 1; - } else { - return isHidden.endDate + 1; - } - } - } else { - return time; + }, { + key: 'hide', + value: function hide() { + this.hidden = true; + this.frame.style.left = "0"; + this.frame.style.top = "0"; + this.frame.style.visibility = "hidden"; } - }; - /** - * Check if a time is hidden - * - * @param time - * @param hiddenDates - * @returns {{hidden: boolean, startDate: Window.start, endDate: *}} - */ - exports.isHidden = function (time, hiddenDates) { - for (var i = 0; i < hiddenDates.length; i++) { - var startDate = hiddenDates[i].start; - var endDate = hiddenDates[i].end; + /** + * Remove the popup window + */ - if (time >= startDate && time < endDate) { - // if the start is entering a hidden zone - return { hidden: true, startDate: startDate, endDate: endDate }; - } + }, { + key: 'destroy', + value: function destroy() { + this.frame.parentNode.removeChild(this.frame); // Remove element from DOM } - return { hidden: false, startDate: startDate, endDate: endDate }; - }; + }]); + return Popup; +}(); + +exports['default'] = Popup; /***/ }), -/* 123 */ +/* 105 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - var _stringify = __webpack_require__(90); - - var _stringify2 = _interopRequireDefault(_stringify); +"use strict"; - var _typeof2 = __webpack_require__(62); - var _typeof3 = _interopRequireDefault(_typeof2); +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** + * This object contains all possible options. It will check if the types are correct, if required if the option is one + * of the allowed values. + * + * __any__ means that the name of the property does not matter. + * __type__ is a required field for all objects and contains the allowed types of all objects + */ +var string = 'string'; +var bool = 'boolean'; +var number = 'number'; +var array = 'array'; +var date = 'date'; +var object = 'object'; // should only be in a __type__ property +var dom = 'dom'; +var moment = 'moment'; +var any = 'any'; + +var allOptions = { + configure: { + enabled: { 'boolean': bool }, + filter: { 'boolean': bool, 'function': 'function' }, + container: { dom: dom }, + __type__: { object: object, 'boolean': bool, 'function': 'function' } + }, + + //globals : + align: { string: string }, + rtl: { 'boolean': bool, 'undefined': 'undefined' }, + rollingMode: { + follow: { 'boolean': bool }, + offset: { number: number, 'undefined': 'undefined' }, + __type__: { object: object } + }, + verticalScroll: { 'boolean': bool, 'undefined': 'undefined' }, + horizontalScroll: { 'boolean': bool, 'undefined': 'undefined' }, + autoResize: { 'boolean': bool }, + throttleRedraw: { number: number }, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511 + clickToUse: { 'boolean': bool }, + dataAttributes: { string: string, array: array }, + editable: { + add: { 'boolean': bool, 'undefined': 'undefined' }, + remove: { 'boolean': bool, 'undefined': 'undefined' }, + updateGroup: { 'boolean': bool, 'undefined': 'undefined' }, + updateTime: { 'boolean': bool, 'undefined': 'undefined' }, + overrideItems: { 'boolean': bool, 'undefined': 'undefined' }, + __type__: { 'boolean': bool, object: object } + }, + end: { number: number, date: date, string: string, moment: moment }, + format: { + minorLabels: { + millisecond: { string: string, 'undefined': 'undefined' }, + second: { string: string, 'undefined': 'undefined' }, + minute: { string: string, 'undefined': 'undefined' }, + hour: { string: string, 'undefined': 'undefined' }, + weekday: { string: string, 'undefined': 'undefined' }, + day: { string: string, 'undefined': 'undefined' }, + week: { string: string, 'undefined': 'undefined' }, + month: { string: string, 'undefined': 'undefined' }, + year: { string: string, 'undefined': 'undefined' }, + __type__: { object: object, 'function': 'function' } + }, + majorLabels: { + millisecond: { string: string, 'undefined': 'undefined' }, + second: { string: string, 'undefined': 'undefined' }, + minute: { string: string, 'undefined': 'undefined' }, + hour: { string: string, 'undefined': 'undefined' }, + weekday: { string: string, 'undefined': 'undefined' }, + day: { string: string, 'undefined': 'undefined' }, + week: { string: string, 'undefined': 'undefined' }, + month: { string: string, 'undefined': 'undefined' }, + year: { string: string, 'undefined': 'undefined' }, + __type__: { object: object, 'function': 'function' } + }, + __type__: { object: object } + }, + moment: { 'function': 'function' }, + groupOrder: { string: string, 'function': 'function' }, + groupEditable: { + add: { 'boolean': bool, 'undefined': 'undefined' }, + remove: { 'boolean': bool, 'undefined': 'undefined' }, + order: { 'boolean': bool, 'undefined': 'undefined' }, + __type__: { 'boolean': bool, object: object } + }, + groupOrderSwap: { 'function': 'function' }, + height: { string: string, number: number }, + hiddenDates: { + start: { date: date, number: number, string: string, moment: moment }, + end: { date: date, number: number, string: string, moment: moment }, + repeat: { string: string }, + __type__: { object: object, array: array } + }, + itemsAlwaysDraggable: { + item: { 'boolean': bool, 'undefined': 'undefined' }, + range: { 'boolean': bool, 'undefined': 'undefined' }, + __type__: { 'boolean': bool, object: object } + }, + limitSize: { 'boolean': bool }, + locale: { string: string }, + locales: { + __any__: { any: any }, + __type__: { object: object } + }, + margin: { + axis: { number: number }, + item: { + horizontal: { number: number, 'undefined': 'undefined' }, + vertical: { number: number, 'undefined': 'undefined' }, + __type__: { object: object, number: number } + }, + __type__: { object: object, number: number } + }, + max: { date: date, number: number, string: string, moment: moment }, + maxHeight: { number: number, string: string }, + maxMinorChars: { number: number }, + min: { date: date, number: number, string: string, moment: moment }, + minHeight: { number: number, string: string }, + moveable: { 'boolean': bool }, + multiselect: { 'boolean': bool }, + multiselectPerGroup: { 'boolean': bool }, + onAdd: { 'function': 'function' }, + onDropObjectOnItem: { 'function': 'function' }, + onUpdate: { 'function': 'function' }, + onMove: { 'function': 'function' }, + onMoving: { 'function': 'function' }, + onRemove: { 'function': 'function' }, + onAddGroup: { 'function': 'function' }, + onMoveGroup: { 'function': 'function' }, + onRemoveGroup: { 'function': 'function' }, + onInitialDrawComplete: { 'function': 'function' }, + order: { 'function': 'function' }, + orientation: { + axis: { string: string, 'undefined': 'undefined' }, + item: { string: string, 'undefined': 'undefined' }, + __type__: { string: string, object: object } + }, + selectable: { 'boolean': bool }, + showCurrentTime: { 'boolean': bool }, + showMajorLabels: { 'boolean': bool }, + showMinorLabels: { 'boolean': bool }, + stack: { 'boolean': bool }, + stackSubgroups: { 'boolean': bool }, + snap: { 'function': 'function', 'null': 'null' }, + start: { date: date, number: number, string: string, moment: moment }, + template: { 'function': 'function' }, + groupTemplate: { 'function': 'function' }, + visibleFrameTemplate: { string: string, 'function': 'function' }, + showTooltips: { 'boolean': bool }, + tooltip: { + followMouse: { 'boolean': bool }, + overflowMethod: { 'string': ['cap', 'flip'] }, + __type__: { object: object } + }, + tooltipOnItemUpdateTime: { + template: { 'function': 'function' }, + __type__: { 'boolean': bool, object: object } + }, + timeAxis: { + scale: { string: string, 'undefined': 'undefined' }, + step: { number: number, 'undefined': 'undefined' }, + __type__: { object: object } + }, + type: { string: string }, + width: { string: string, number: number }, + zoomable: { 'boolean': bool }, + zoomKey: { string: ['ctrlKey', 'altKey', 'metaKey', ''] }, + zoomMax: { number: number }, + zoomMin: { number: number }, + + __type__: { object: object } +}; + +var configureOptions = { + global: { + align: ['center', 'left', 'right'], + direction: false, + autoResize: true, + clickToUse: false, + // dataAttributes: ['all'], // FIXME: can be 'all' or string[] + editable: { + add: false, + remove: false, + updateGroup: false, + updateTime: false + }, + end: '', + format: { + minorLabels: { + millisecond: 'SSS', + second: 's', + minute: 'HH:mm', + hour: 'HH:mm', + weekday: 'ddd D', + day: 'D', + week: 'w', + month: 'MMM', + year: 'YYYY' + }, + majorLabels: { + millisecond: 'HH:mm:ss', + second: 'D MMMM HH:mm', + minute: 'ddd D MMMM', + hour: 'ddd D MMMM', + weekday: 'MMMM YYYY', + day: 'MMMM YYYY', + week: 'MMMM YYYY', + month: 'YYYY', + year: '' + } + }, - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + //groupOrder: {string, 'function': 'function'}, + groupsDraggable: false, + height: '', + //hiddenDates: {object, array}, + locale: '', + margin: { + axis: [20, 0, 100, 1], + item: { + horizontal: [10, 0, 100, 1], + vertical: [10, 0, 100, 1] + } + }, + max: '', + maxHeight: '', + maxMinorChars: [7, 0, 20, 1], + min: '', + minHeight: '', + moveable: false, + multiselect: false, + multiselectPerGroup: false, + //onAdd: {'function': 'function'}, + //onUpdate: {'function': 'function'}, + //onMove: {'function': 'function'}, + //onMoving: {'function': 'function'}, + //onRename: {'function': 'function'}, + //order: {'function': 'function'}, + orientation: { + axis: ['both', 'bottom', 'top'], + item: ['bottom', 'top'] + }, + selectable: true, + showCurrentTime: false, + showMajorLabels: true, + showMinorLabels: true, + stack: true, + stackSubgroups: true, + //snap: {'function': 'function', nada}, + start: '', + //template: {'function': 'function'}, + //timeAxis: { + // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'], + // step: [1, 1, 10, 1] + //}, + showTooltips: true, + tooltip: { + followMouse: false, + overflowMethod: 'flip' + }, + tooltipOnItemUpdateTime: false, + type: ['box', 'point', 'range', 'background'], + width: '100%', + zoomable: true, + zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''], + zoomMax: [315360000000000, 10, 315360000000000, 1], + zoomMin: [10, 10, 315360000000000, 1] + } +}; - var Emitter = __webpack_require__(99); - var Hammer = __webpack_require__(113); - var hammerUtil = __webpack_require__(120); - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var Range = __webpack_require__(119); - var ItemSet = __webpack_require__(124); - var TimeAxis = __webpack_require__(140); - var Activator = __webpack_require__(141); - var DateUtil = __webpack_require__(122); - var CustomTime = __webpack_require__(142); +exports.allOptions = allOptions; +exports.configureOptions = configureOptions; - /** - * Create a timeline visualization - * @constructor - */ - function Core() {} +/***/ }), +/* 106 */ +/***/ (function(module, exports, __webpack_require__) { - // turn Core into an event emitter - Emitter(Core.prototype); +"use strict"; - /** - * Create the main DOM for the Core: a root panel containing left, right, - * top, bottom, content, and background panel. - * @param {Element} container The container element where the Core will - * be attached. - * @protected - */ - Core.prototype._create = function (container) { - this.dom = {}; - this.dom.container = container; - - this.dom.root = document.createElement('div'); - this.dom.background = document.createElement('div'); - this.dom.backgroundVertical = document.createElement('div'); - this.dom.backgroundHorizontal = document.createElement('div'); - this.dom.centerContainer = document.createElement('div'); - this.dom.leftContainer = document.createElement('div'); - this.dom.rightContainer = document.createElement('div'); - this.dom.center = document.createElement('div'); - this.dom.left = document.createElement('div'); - this.dom.right = document.createElement('div'); - this.dom.top = document.createElement('div'); - this.dom.bottom = document.createElement('div'); - this.dom.shadowTop = document.createElement('div'); - this.dom.shadowBottom = document.createElement('div'); - this.dom.shadowTopLeft = document.createElement('div'); - this.dom.shadowBottomLeft = document.createElement('div'); - this.dom.shadowTopRight = document.createElement('div'); - this.dom.shadowBottomRight = document.createElement('div'); - this.dom.rollingModeBtn = document.createElement('div'); - - this.dom.root.className = 'vis-timeline'; - this.dom.background.className = 'vis-panel vis-background'; - this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical'; - this.dom.backgroundHorizontal.className = 'vis-panel vis-background vis-horizontal'; - this.dom.centerContainer.className = 'vis-panel vis-center'; - this.dom.leftContainer.className = 'vis-panel vis-left'; - this.dom.rightContainer.className = 'vis-panel vis-right'; - this.dom.top.className = 'vis-panel vis-top'; - this.dom.bottom.className = 'vis-panel vis-bottom'; - this.dom.left.className = 'vis-content'; - this.dom.center.className = 'vis-content'; - this.dom.right.className = 'vis-content'; - this.dom.shadowTop.className = 'vis-shadow vis-top'; - this.dom.shadowBottom.className = 'vis-shadow vis-bottom'; - this.dom.shadowTopLeft.className = 'vis-shadow vis-top'; - this.dom.shadowBottomLeft.className = 'vis-shadow vis-bottom'; - this.dom.shadowTopRight.className = 'vis-shadow vis-top'; - this.dom.shadowBottomRight.className = 'vis-shadow vis-bottom'; - this.dom.rollingModeBtn.className = 'vis-rolling-mode-btn'; - - this.dom.root.appendChild(this.dom.background); - this.dom.root.appendChild(this.dom.backgroundVertical); - this.dom.root.appendChild(this.dom.backgroundHorizontal); - this.dom.root.appendChild(this.dom.centerContainer); - this.dom.root.appendChild(this.dom.leftContainer); - this.dom.root.appendChild(this.dom.rightContainer); - this.dom.root.appendChild(this.dom.top); - this.dom.root.appendChild(this.dom.bottom); - this.dom.root.appendChild(this.dom.bottom); - this.dom.root.appendChild(this.dom.rollingModeBtn); - - this.dom.centerContainer.appendChild(this.dom.center); - this.dom.leftContainer.appendChild(this.dom.left); - this.dom.rightContainer.appendChild(this.dom.right); - this.dom.centerContainer.appendChild(this.dom.shadowTop); - this.dom.centerContainer.appendChild(this.dom.shadowBottom); - this.dom.leftContainer.appendChild(this.dom.shadowTopLeft); - this.dom.leftContainer.appendChild(this.dom.shadowBottomLeft); - this.dom.rightContainer.appendChild(this.dom.shadowTopRight); - this.dom.rightContainer.appendChild(this.dom.shadowBottomRight); - - // size properties of each of the panels - this.props = { - root: {}, - background: {}, - centerContainer: {}, - leftContainer: {}, - rightContainer: {}, - center: {}, - left: {}, - right: {}, - top: {}, - bottom: {}, - border: {}, - scrollTop: 0, - scrollTopMin: 0 - }; +var _typeof2 = __webpack_require__(6); - this.on('rangechange', function () { - if (this.initialDrawDone === true) { - this._redraw(); - } - }.bind(this)); - this.on('touch', this._onTouch.bind(this)); - this.on('panmove', this._onDrag.bind(this)); +var _typeof3 = _interopRequireDefault(_typeof2); - var me = this; - this._origRedraw = this._redraw.bind(this); - this._redraw = util.throttle(this._origRedraw); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - this.on('_change', function (properties) { - if (me.itemSet && me.itemSet.initialItemSetDrawn && properties && properties.queue == true) { - me._redraw(); - } else { - me._origRedraw(); - } - }); +var util = __webpack_require__(2); +var DOMutil = __webpack_require__(14); +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var Component = __webpack_require__(16); +var DataAxis = __webpack_require__(107); +var GraphGroup = __webpack_require__(109); +var Legend = __webpack_require__(112); +var Bars = __webpack_require__(110); +var Lines = __webpack_require__(111); +var Points = __webpack_require__(72); - // create event listeners for all interesting events, these events will be - // emitted via emitter - this.hammer = new Hammer(this.dom.root); - var pinchRecognizer = this.hammer.get('pinch').set({ enable: true }); - hammerUtil.disablePreventDefaultVertically(pinchRecognizer); - this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL }); - this.listeners = {}; - - var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend' - // TODO: cleanup - //'touch', 'pinch', - //'tap', 'doubletap', 'hold', - //'dragstart', 'drag', 'dragend', - //'mousewheel', 'DOMMouseScroll' // DOMMouseScroll is needed for Firefox - ]; - events.forEach(function (type) { - var listener = function listener(event) { - if (me.isActive()) { - me.emit(type, event); - } - }; - me.hammer.on(type, listener); - me.listeners[type] = listener; - }); +var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items - // emulate a touch event (emitted before the start of a pan, pinch, tap, or press) - hammerUtil.onTouch(this.hammer, function (event) { - me.emit('touch', event); - }.bind(this)); +/** + * This is the constructor of the LineGraph. It requires a Timeline body and options. + * + * @param {vis.Timeline.body} body + * @param {Object} options + * @constructor LineGraph + * @extends Component + */ +function LineGraph(body, options) { + this.id = util.randomUUID(); + this.body = body; + + this.defaultOptions = { + yAxisOrientation: 'left', + defaultGroup: 'default', + sort: true, + sampling: true, + stack: false, + graphHeight: '400px', + shaded: { + enabled: false, + orientation: 'bottom' // top, bottom, zero + }, + style: 'line', // line, bar + barChart: { + width: 50, + sideBySide: false, + align: 'center' // left, center, right + }, + interpolation: { + enabled: true, + parametrization: 'centripetal', // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + alpha: 0.5 + }, + drawPoints: { + enabled: true, + size: 6, + style: 'square' // square, circle + }, + dataAxis: {}, //Defaults are done on DataAxis level + legend: {}, //Defaults are done on Legend level + groups: { + visibility: {} + } + }; + + // options is shared by this lineGraph and all its items + this.options = util.extend({}, this.defaultOptions); + this.dom = {}; + this.props = {}; + this.hammer = null; + this.groups = {}; + this.abortedGraphUpdate = false; + this.updateSVGheight = false; + this.updateSVGheightOnResize = false; + this.forceGraphUpdate = true; + + var me = this; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet + + // listeners for the DataSet of the items + this.itemListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAdd(params.items); + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdate(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemove(params.items); + } + }; - // emulate a release event (emitted after a pan, pinch, tap, or press) - hammerUtil.onRelease(this.hammer, function (event) { - me.emit('release', event); - }.bind(this)); + // listeners for the DataSet of the groups + this.groupListeners = { + 'add': function add(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onAddGroups(params.items); + }, + 'update': function update(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onUpdateGroups(params.items); + }, + 'remove': function remove(event, params, senderId) { + // eslint-disable-line no-unused-vars + me._onRemoveGroups(params.items); + } + }; - function onMouseWheel(event) { - if (this.isActive()) { - this.emit('mousewheel', event); - } + this.items = {}; // object with an Item for every data item + this.selection = []; // list with the ids of all selected nodes + this.lastStart = this.body.range.start; + this.touchParams = {}; // stores properties while dragging - // prevent scrolling if not specified explicitly or when horizontalScroll is true - if (!this.options.verticalScroll || this.options.horizontalScroll) return; + this.svgElements = {}; + this.setOptions(options); + this.groupsUsingDefaultStyles = [0]; + this.body.emitter.on('rangechanged', function () { + me.lastStart = me.body.range.start; + me.svg.style.left = util.option.asSize(-me.props.width); - // prevent scrolling when zoomKey defined or activated - if (!this.options.zoomKey || event[this.options.zoomKey]) return; + me.forceGraphUpdate = true; + //Is this local redraw necessary? (Core also does a change event!) + me.redraw.call(me); + }); - // Prevent default actions caused by mouse wheel - // (else the page and timeline both scroll) - event.preventDefault(); + // create the HTML DOM + this._create(); + this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups }; +} - var delta = 0; - if (event.wheelDelta) { - /* IE/Opera. */ - delta = event.wheelDelta / 120; - } else if (event.detail) { - /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail / 3; - } +LineGraph.prototype = new Component(); - var current = this.props.scrollTop; - var adjusted = current + delta * 120; +/** + * Create the HTML DOM for the ItemSet + */ +LineGraph.prototype._create = function () { + var frame = document.createElement('div'); + frame.className = 'vis-line-graph'; + this.dom.frame = frame; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + this.svg.style.position = 'relative'; + this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px'; + this.svg.style.display = 'block'; + frame.appendChild(this.svg); + + // data axis + this.options.dataAxis.orientation = 'left'; + this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups); + + this.options.dataAxis.orientation = 'right'; + this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups); + delete this.options.dataAxis.orientation; + + // legends + this.legendLeft = new Legend(this.body, this.options.legend, 'left', this.options.groups); + this.legendRight = new Legend(this.body, this.options.legend, 'right', this.options.groups); + + this.show(); +}; - if (this.isActive()) { - this._setScrollTop(adjusted); - this._redraw(); - this.emit('scroll', event); +/** + * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element. + * @param {object} options + */ +LineGraph.prototype.setOptions = function (options) { + if (options) { + var fields = ['sampling', 'defaultGroup', 'stack', 'height', 'graphHeight', 'yAxisOrientation', 'style', 'barChart', 'dataAxis', 'sort', 'groups']; + if (options.graphHeight === undefined && options.height !== undefined) { + this.updateSVGheight = true; + this.updateSVGheightOnResize = true; + } else if (this.body.domProps.centerContainer.height !== undefined && options.graphHeight !== undefined) { + if (parseInt((options.graphHeight + '').replace("px", '')) < this.body.domProps.centerContainer.height) { + this.updateSVGheight = true; + } + } + util.selectiveDeepExtend(fields, this.options, options); + util.mergeOptions(this.options, options, 'interpolation'); + util.mergeOptions(this.options, options, 'drawPoints'); + util.mergeOptions(this.options, options, 'shaded'); + util.mergeOptions(this.options, options, 'legend'); + + if (options.interpolation) { + if ((0, _typeof3['default'])(options.interpolation) == 'object') { + if (options.interpolation.parametrization) { + if (options.interpolation.parametrization == 'uniform') { + this.options.interpolation.alpha = 0; + } else if (options.interpolation.parametrization == 'chordal') { + this.options.interpolation.alpha = 1.0; + } else { + this.options.interpolation.parametrization = 'centripetal'; + this.options.interpolation.alpha = 0.5; + } + } } } - if (this.dom.centerContainer.addEventListener) { - // IE9, Chrome, Safari, Opera - this.dom.centerContainer.addEventListener("mousewheel", onMouseWheel.bind(this), false); - // Firefox - this.dom.centerContainer.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false); - } else { - // IE 6/7/8 - this.dom.centerContainer.attachEvent("onmousewheel", onMouseWheel.bind(this)); + if (this.yAxisLeft) { + if (options.dataAxis !== undefined) { + this.yAxisLeft.setOptions(this.options.dataAxis); + this.yAxisRight.setOptions(this.options.dataAxis); + } } - function onMouseScrollSide(event) { - if (!me.options.verticalScroll) return; - event.preventDefault(); - if (me.isActive()) { - var adjusted = -event.target.scrollTop; - me._setScrollTop(adjusted); - me._redraw(); - me.emit('scrollSide', event); + if (this.legendLeft) { + if (options.legend !== undefined) { + this.legendLeft.setOptions(this.options.legend); + this.legendRight.setOptions(this.options.legend); } } - this.dom.left.parentNode.addEventListener('scroll', onMouseScrollSide.bind(this)); - this.dom.right.parentNode.addEventListener('scroll', onMouseScrollSide.bind(this)); + if (this.groups.hasOwnProperty(UNGROUPED)) { + this.groups[UNGROUPED].setOptions(options); + } + } - var itemAddedToTimeline = false; + // this is used to redraw the graph if the visibility of the groups is changed. + if (this.dom.frame) { + //not on initial run? + this.forceGraphUpdate = true; + this.body.emitter.emit("_change", { queue: true }); + } +}; - function handleDragOver(event) { - if (event.preventDefault) { - event.preventDefault(); // Necessary. Allows us to drop. - } +/** + * Hide the component from the DOM + */ +LineGraph.prototype.hide = function () { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } +}; - // make sure your target is a vis element - if (!event.target.className.indexOf("vis") > -1) return; +/** + * Show the component in the DOM (when not already visible). + */ +LineGraph.prototype.show = function () { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } +}; - // make sure only one item is added every time you're over the timeline - if (itemAddedToTimeline) return; +/** + * Set items + * @param {vis.DataSet | null} items + */ +LineGraph.prototype.setItems = function (items) { + var me = this, + ids, + oldItemsData = this.itemsData; + + // replace the dataset + if (!items) { + this.itemsData = null; + } else if (items instanceof DataSet || items instanceof DataView) { + this.itemsData = items; + } else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } - event.dataTransfer.dropEffect = 'move'; - itemAddedToTimeline = true; - return false; - } + if (oldItemsData) { + // unsubscribe from old dataset + util.forEach(this.itemListeners, function (callback, event) { + oldItemsData.off(event, callback); + }); - function handleDrop(event) { - // prevent redirect to blank page - Firefox - if (event.preventDefault) { - event.preventDefault(); - } - if (event.stopPropagation) { - event.stopPropagation(); - } - // return when dropping non-vis items - try { - var itemData = JSON.parse(event.dataTransfer.getData("text")); - if (!itemData.content) return; - } catch (err) { - return false; - } + // remove all drawn items + ids = oldItemsData.getIds(); + this._onRemove(ids); + } - itemAddedToTimeline = false; - event.center = { - x: event.clientX, - y: event.clientY - }; - me.itemSet._onAddItem(event); - me.emit('drop', me.getEventProperties(event)); - return false; + if (this.itemsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.itemListeners, function (callback, event) { + me.itemsData.on(event, callback, id); + }); + + // add all new items + ids = this.itemsData.getIds(); + this._onAdd(ids); + } +}; + +/** + * Set groups + * @param {vis.DataSet} groups + */ +LineGraph.prototype.setGroups = function (groups) { + var me = this; + var ids; + + // unsubscribe from current dataset + if (this.groupsData) { + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.off(event, callback); + }); + + // remove all drawn groups + ids = this.groupsData.getIds(); + this.groupsData = null; + for (var i = 0; i < ids.length; i++) { + this._removeGroup(ids[i]); } + } - this.dom.center.addEventListener('dragover', handleDragOver.bind(this), false); - this.dom.center.addEventListener('drop', handleDrop.bind(this), false); + // replace the dataset + if (!groups) { + this.groupsData = null; + } else if (groups instanceof DataSet || groups instanceof DataView) { + this.groupsData = groups; + } else { + throw new TypeError('Data must be an instance of DataSet or DataView'); + } - this.customTimes = []; + if (this.groupsData) { + // subscribe to new dataset + var id = this.id; + util.forEach(this.groupListeners, function (callback, event) { + me.groupsData.on(event, callback, id); + }); - // store state information needed for touch events - this.touch = {}; + // draw all ms + ids = this.groupsData.getIds(); + this._onAddGroups(ids); + } +}; + +LineGraph.prototype._onUpdate = function (ids) { + this._updateAllGroupData(ids); +}; +LineGraph.prototype._onAdd = function (ids) { + this._onUpdate(ids); +}; +LineGraph.prototype._onRemove = function (ids) { + this._onUpdate(ids); +}; +LineGraph.prototype._onUpdateGroups = function (groupIds) { + this._updateAllGroupData(null, groupIds); +}; +LineGraph.prototype._onAddGroups = function (groupIds) { + this._onUpdateGroups(groupIds); +}; - this.redrawCount = 0; - this.initialDrawDone = false; +/** + * this cleans the group out off the legends and the dataaxis, updates the ungrouped and updates the graph + * @param {Array} groupIds + * @private + */ +LineGraph.prototype._onRemoveGroups = function (groupIds) { + for (var i = 0; i < groupIds.length; i++) { + this._removeGroup(groupIds[i]); + } + this.forceGraphUpdate = true; + this.body.emitter.emit("_change", { queue: true }); +}; - // attach the root panel to the provided container - if (!container) throw new Error('No container provided'); - container.appendChild(this.dom.root); - }; +/** + * this cleans the group out off the legends and the dataaxis + * @param {vis.GraphGroup.id} groupId + * @private + */ +LineGraph.prototype._removeGroup = function (groupId) { + if (this.groups.hasOwnProperty(groupId)) { + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.removeGroup(groupId); + this.legendRight.removeGroup(groupId); + this.legendRight.redraw(); + } else { + this.yAxisLeft.removeGroup(groupId); + this.legendLeft.removeGroup(groupId); + this.legendLeft.redraw(); + } + delete this.groups[groupId]; + } +}; - /** - * Set options. Options will be passed to all components loaded in the Timeline. - * @param {Object} [options] - * {String} orientation - * Vertical orientation for the Timeline, - * can be 'bottom' (default) or 'top'. - * {String | Number} width - * Width for the timeline, a number in pixels or - * a css string like '1000px' or '75%'. '100%' by default. - * {String | Number} height - * Fixed height for the Timeline, a number in pixels or - * a css string like '400px' or '75%'. If undefined, - * The Timeline will automatically size such that - * its contents fit. - * {String | Number} minHeight - * Minimum height for the Timeline, a number in pixels or - * a css string like '400px' or '75%'. - * {String | Number} maxHeight - * Maximum height for the Timeline, a number in pixels or - * a css string like '400px' or '75%'. - * {Number | Date | String} start - * Start date for the visible window - * {Number | Date | String} end - * End date for the visible window - */ - Core.prototype.setOptions = function (options) { - if (options) { - // copy the known options - var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates', 'locale', 'locales', 'moment', 'rtl', 'zoomKey', 'horizontalScroll', 'verticalScroll']; - util.selectiveExtend(fields, this.options, options); +/** + * update a group object with the group dataset entree + * + * @param {vis.GraphGroup} group + * @param {vis.GraphGroup.id} groupId + * @private + */ +LineGraph.prototype._updateGroup = function (group, groupId) { + if (!this.groups.hasOwnProperty(groupId)) { + this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.addGroup(groupId, this.groups[groupId]); + this.legendRight.addGroup(groupId, this.groups[groupId]); + } else { + this.yAxisLeft.addGroup(groupId, this.groups[groupId]); + this.legendLeft.addGroup(groupId, this.groups[groupId]); + } + } else { + this.groups[groupId].update(group); + if (this.groups[groupId].options.yAxisOrientation == 'right') { + this.yAxisRight.updateGroup(groupId, this.groups[groupId]); + this.legendRight.updateGroup(groupId, this.groups[groupId]); + //If yAxisOrientation changed, clean out the group from the other axis. + this.yAxisLeft.removeGroup(groupId); + this.legendLeft.removeGroup(groupId); + } else { + this.yAxisLeft.updateGroup(groupId, this.groups[groupId]); + this.legendLeft.updateGroup(groupId, this.groups[groupId]); + //If yAxisOrientation changed, clean out the group from the other axis. + this.yAxisRight.removeGroup(groupId); + this.legendRight.removeGroup(groupId); + } + } + this.legendLeft.redraw(); + this.legendRight.redraw(); +}; - this.dom.rollingModeBtn.style.visibility = 'hidden'; +/** + * this updates all groups, it is used when there is an update the the itemset. + * + * @param {Array} ids + * @param {Array} groupIds + * @private + */ +LineGraph.prototype._updateAllGroupData = function (ids, groupIds) { + if (this.itemsData != null) { + var groupsContent = {}; + var items = this.itemsData.get(); + var fieldId = this.itemsData._fieldId; + var idMap = {}; + if (ids) { + ids.map(function (id) { + idMap[id] = id; + }); + } - if (this.options.rtl) { - this.dom.container.style.direction = "rtl"; - this.dom.backgroundVertical.className = 'vis-panel vis-background vis-vertical-rtl'; + //pre-Determine array sizes, for more efficient memory claim + var groupCounts = {}; + for (var i = 0; i < items.length; i++) { + var item = items[i]; + var groupId = item.group; + if (groupId === null || groupId === undefined) { + groupId = UNGROUPED; } + groupCounts.hasOwnProperty(groupId) ? groupCounts[groupId]++ : groupCounts[groupId] = 1; + } - if (this.options.verticalScroll) { - if (this.options.rtl) { - this.dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; - } else { - this.dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; - } - } + //Pre-load arrays from existing groups if items are not changed (not in ids) + var existingItemsMap = {}; + if (!groupIds && ids) { + for (groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + group = this.groups[groupId]; + var existing_items = group.getItems(); - this.options.orientation = { item: undefined, axis: undefined }; - if ('orientation' in options) { - if (typeof options.orientation === 'string') { - this.options.orientation = { - item: options.orientation, - axis: options.orientation - }; - } else if ((0, _typeof3['default'])(options.orientation) === 'object') { - if ('item' in options.orientation) { - this.options.orientation.item = options.orientation.item; - } - if ('axis' in options.orientation) { - this.options.orientation.axis = options.orientation.axis; + groupsContent[groupId] = existing_items.filter(function (item) { + existingItemsMap[item[fieldId]] = item[fieldId]; + return item[fieldId] !== idMap[item[fieldId]]; + }); + var newLength = groupCounts[groupId]; + groupCounts[groupId] -= groupsContent[groupId].length; + if (groupsContent[groupId].length < newLength) { + groupsContent[groupId][newLength - 1] = {}; } } } + } - if (this.options.orientation.axis === 'both') { - if (!this.timeAxis2) { - var timeAxis2 = this.timeAxis2 = new TimeAxis(this.body); - timeAxis2.setOptions = function (options) { - var _options = options ? util.extend({}, options) : {}; - _options.orientation = 'top'; // override the orientation option, always top - TimeAxis.prototype.setOptions.call(timeAxis2, _options); - }; - this.components.push(timeAxis2); - } - } else { - if (this.timeAxis2) { - var index = this.components.indexOf(this.timeAxis2); - if (index !== -1) { - this.components.splice(index, 1); - } - this.timeAxis2.destroy(); - this.timeAxis2 = null; - } + //Now insert data into the arrays. + for (i = 0; i < items.length; i++) { + item = items[i]; + groupId = item.group; + if (groupId === null || groupId === undefined) { + groupId = UNGROUPED; } - - // if the graph2d's drawPoints is a function delegate the callback to the onRender property - if (typeof options.drawPoints == 'function') { - options.drawPoints = { - onRender: options.drawPoints - }; + if (!groupIds && ids && item[fieldId] !== idMap[item[fieldId]] && existingItemsMap.hasOwnProperty(item[fieldId])) { + continue; + } + if (!groupsContent.hasOwnProperty(groupId)) { + groupsContent[groupId] = new Array(groupCounts[groupId]); } + //Copy data (because of unmodifiable DataView input. + var extended = util.bridgeObject(item); + extended.x = util.convert(item.x, 'Date'); + extended.end = util.convert(item.end, 'Date'); + extended.orginalY = item.y; //real Y + extended.y = Number(item.y); + extended[fieldId] = item[fieldId]; + + var index = groupsContent[groupId].length - groupCounts[groupId]--; + groupsContent[groupId][index] = extended; + } - if ('hiddenDates' in this.options) { - DateUtil.convertHiddenOptions(this.options.moment, this.body, this.options.hiddenDates); + //Make sure all groups are present, to allow removal of old groups + for (groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + if (!groupsContent.hasOwnProperty(groupId)) { + groupsContent[groupId] = new Array(0); + } } + } - if ('clickToUse' in options) { - if (options.clickToUse) { - if (!this.activator) { - this.activator = new Activator(this.dom.root); + //Update legendas, style and axis + for (groupId in groupsContent) { + if (groupsContent.hasOwnProperty(groupId)) { + if (groupsContent[groupId].length == 0) { + if (this.groups.hasOwnProperty(groupId)) { + this._removeGroup(groupId); } } else { - if (this.activator) { - this.activator.destroy(); - delete this.activator; + var group = undefined; + if (this.groupsData != undefined) { + group = this.groupsData.get(groupId); + } + if (group == undefined) { + group = { id: groupId, content: this.options.defaultGroup + groupId }; } + this._updateGroup(group, groupId); + this.groups[groupId].setItems(groupsContent[groupId]); } } - - if ('showCustomTime' in options) { - throw new Error('Option `showCustomTime` is deprecated. Create a custom time bar via timeline.addCustomTime(time [, id])'); - } - - // enable/disable autoResize - this._initAutoResize(); - } - - // propagate options to all components - this.components.forEach(function (component) { - return component.setOptions(options); - }); - - // enable/disable configure - if ('configure' in options) { - if (!this.configurator) { - this.configurator = this._createConfigurator(); - } - - this.configurator.setOptions(options.configure); - - // collect the settings of all components, and pass them to the configuration system - var appliedOptions = util.deepExtend({}, this.options); - this.components.forEach(function (component) { - util.deepExtend(appliedOptions, component.options); - }); - this.configurator.setModuleOptions({ global: appliedOptions }); } + this.forceGraphUpdate = true; + this.body.emitter.emit("_change", { queue: true }); + } +}; - this._redraw(); - }; +/** + * Redraw the component, mandatory function + * @return {boolean} Returns true if the component is resized + */ +LineGraph.prototype.redraw = function () { + var resized = false; - /** - * Returns true when the Timeline is active. - * @returns {boolean} - */ - Core.prototype.isActive = function () { - return !this.activator || this.activator.active; - }; + // calculate actual size and position + this.props.width = this.dom.frame.offsetWidth; + this.props.height = this.body.domProps.centerContainer.height - this.body.domProps.border.top - this.body.domProps.border.bottom; - /** - * Destroy the Core, clean up all DOM elements and event listeners. - */ - Core.prototype.destroy = function () { - // unbind datasets - this.setItems(null); - this.setGroups(null); + // check if this component is resized + resized = this._isResized() || resized; - // remove all event listeners - this.off(); + // check whether zoomed (in that case we need to re-stack everything) + var visibleInterval = this.body.range.end - this.body.range.start; + var zoomed = visibleInterval != this.lastVisibleInterval; + this.lastVisibleInterval = visibleInterval; - // stop checking for changed size - this._stopAutoResize(); + // the svg element is three times as big as the width, this allows for fully dragging left and right + // without reloading the graph. the controls for this are bound to events in the constructor + if (resized == true) { + this.svg.style.width = util.option.asSize(3 * this.props.width); + this.svg.style.left = util.option.asSize(-this.props.width); - // remove from DOM - if (this.dom.root.parentNode) { - this.dom.root.parentNode.removeChild(this.dom.root); + // if the height of the graph is set as proportional, change the height of the svg + if ((this.options.height + '').indexOf("%") != -1 || this.updateSVGheightOnResize == true) { + this.updateSVGheight = true; } - this.dom = null; + } - // remove Activator - if (this.activator) { - this.activator.destroy(); - delete this.activator; + // update the height of the graph on each redraw of the graph. + if (this.updateSVGheight == true) { + if (this.options.graphHeight != this.props.height + 'px') { + this.options.graphHeight = this.props.height + 'px'; + this.svg.style.height = this.props.height + 'px'; } + this.updateSVGheight = false; + } else { + this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px'; + } - // cleanup hammer touch events - for (var event in this.listeners) { - if (this.listeners.hasOwnProperty(event)) { - delete this.listeners[event]; + // zoomed is here to ensure that animations are shown correctly. + if (resized == true || zoomed == true || this.abortedGraphUpdate == true || this.forceGraphUpdate == true) { + resized = this._updateGraph() || resized; + this.forceGraphUpdate = false; + } else { + // move the whole svg while dragging + if (this.lastStart != 0) { + var offset = this.body.range.start - this.lastStart; + var range = this.body.range.end - this.body.range.start; + if (this.props.width != 0) { + var rangePerPixelInv = this.props.width / range; + var xOffset = offset * rangePerPixelInv; + this.svg.style.left = -this.props.width - xOffset + 'px'; + } + } + } + this.legendLeft.redraw(); + this.legendRight.redraw(); + return resized; +}; + +LineGraph.prototype._getSortedGroupIds = function () { + // getting group Ids + var grouplist = []; + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + var group = this.groups[groupId]; + if (group.visible == true && (this.options.groups.visibility[groupId] === undefined || this.options.groups.visibility[groupId] == true)) { + grouplist.push({ id: groupId, zIndex: group.options.zIndex }); } } - this.listeners = null; - this.hammer = null; - - // give all components the opportunity to cleanup - this.components.forEach(function (component) { - return component.destroy(); - }); - - this.body = null; - }; - - /** - * Set a custom time bar - * @param {Date} time - * @param {number} [id=undefined] Optional id of the custom time bar to be adjusted. - */ - Core.prototype.setCustomTime = function (time, id) { - var customTimes = this.customTimes.filter(function (component) { - return id === component.options.id; - }); + } + util.insertSort(grouplist, function (a, b) { + var az = a.zIndex; + var bz = b.zIndex; + if (az === undefined) az = 0; + if (bz === undefined) bz = 0; + return az == bz ? 0 : az < bz ? -1 : 1; + }); + var groupIds = new Array(grouplist.length); + for (var i = 0; i < grouplist.length; i++) { + groupIds[i] = grouplist[i].id; + } + return groupIds; +}; - if (customTimes.length === 0) { - throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); - } +/** + * Update and redraw the graph. + * + * @returns {boolean} + * @private + */ +LineGraph.prototype._updateGraph = function () { + // reset the svg elements + DOMutil.prepareElements(this.svgElements); + if (this.props.width != 0 && this.itemsData != null) { + var group, i; + var groupRanges = {}; + var changeCalled = false; + // this is the range of the SVG canvas + var minDate = this.body.util.toGlobalTime(-this.body.domProps.root.width); + var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); - if (customTimes.length > 0) { - customTimes[0].setCustomTime(time); - } - }; + // getting group Ids + var groupIds = this._getSortedGroupIds(); + if (groupIds.length > 0) { + var groupsData = {}; - /** - * Retrieve the current custom time. - * @param {number} [id=undefined] Id of the custom time bar. - * @return {Date | undefined} customTime - */ - Core.prototype.getCustomTime = function (id) { - var customTimes = this.customTimes.filter(function (component) { - return component.options.id === id; - }); + // fill groups data, this only loads the data we require based on the timewindow + this._getRelevantData(groupIds, groupsData, minDate, maxDate); - if (customTimes.length === 0) { - throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); - } - return customTimes[0].getCustomTime(); - }; + // apply sampling, if disabled, it will pass through this function. + this._applySampling(groupIds, groupsData); - /** - * Set a custom title for the custom time bar. - * @param {String} [title] Custom title - * @param {number} [id=undefined] Id of the custom time bar. - */ - Core.prototype.setCustomTimeTitle = function (title, id) { - var customTimes = this.customTimes.filter(function (component) { - return component.options.id === id; - }); + // we transform the X coordinates to detect collisions + for (i = 0; i < groupIds.length; i++) { + this._convertXcoordinates(groupsData[groupIds[i]]); + } - if (customTimes.length === 0) { - throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); - } - if (customTimes.length > 0) { - return customTimes[0].setCustomTitle(title); - } - }; + // now all needed data has been collected we start the processing. + this._getYRanges(groupIds, groupsData, groupRanges); - /** - * Retrieve meta information from an event. - * Should be overridden by classes extending Core - * @param {Event} event - * @return {Object} An object with related information. - */ - Core.prototype.getEventProperties = function (event) { - return { event: event }; - }; + // update the Y axis first, we use this data to draw at the correct Y points + changeCalled = this._updateYAxis(groupIds, groupRanges); - /** - * Add custom vertical bar - * @param {Date | String | Number} [time] A Date, unix timestamp, or - * ISO date string. Time point where - * the new bar should be placed. - * If not provided, `new Date()` will - * be used. - * @param {Number | String} [id=undefined] Id of the new bar. Optional - * @return {Number | String} Returns the id of the new bar - */ - Core.prototype.addCustomTime = function (time, id) { - var timestamp = time !== undefined ? util.convert(time, 'Date').valueOf() : new Date(); + // at changeCalled, abort this update cycle as the graph needs another update with new Width input from the Redraw container. + // Cleanup SVG elements on abort. + if (changeCalled == true) { + DOMutil.cleanupElements(this.svgElements); + this.abortedGraphUpdate = true; + return true; + } + this.abortedGraphUpdate = false; - var exists = this.customTimes.some(function (customTime) { - return customTime.options.id === id; - }); - if (exists) { - throw new Error('A custom time with id ' + (0, _stringify2['default'])(id) + ' already exists'); - } + // With the yAxis scaled correctly, use this to get the Y values of the points. + var below = undefined; + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (this.options.stack === true && this.options.style === 'line') { + if (group.options.excludeFromStacking == undefined || !group.options.excludeFromStacking) { + if (below != undefined) { + this._stack(groupsData[group.id], groupsData[below.id]); + if (group.options.shaded.enabled == true && group.options.shaded.orientation !== "group") { + if (group.options.shaded.orientation == "top" && below.options.shaded.orientation !== "group") { + below.options.shaded.orientation = "group"; + below.options.shaded.groupId = group.id; + } else { + group.options.shaded.orientation = "group"; + group.options.shaded.groupId = below.id; + } + } + } + below = group; + } + } + this._convertYcoordinates(groupsData[groupIds[i]], group); + } - var customTime = new CustomTime(this.body, util.extend({}, this.options, { - time: timestamp, - id: id - })); - - this.customTimes.push(customTime); - this.components.push(customTime); - this._redraw(); - - return id; - }; - - /** - * Remove previously added custom bar - * @param {int} id ID of the custom bar to be removed - * @return {boolean} True if the bar exists and is removed, false otherwise - */ - Core.prototype.removeCustomTime = function (id) { - var customTimes = this.customTimes.filter(function (bar) { - return bar.options.id === id; - }); + //Precalculate paths and draw shading if appropriate. This will make sure the shading is always behind any lines. + var paths = {}; + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (group.options.style === 'line' && group.options.shaded.enabled == true) { + var dataset = groupsData[groupIds[i]]; + if (dataset == null || dataset.length == 0) { + continue; + } + if (!paths.hasOwnProperty(groupIds[i])) { + paths[groupIds[i]] = Lines.calcPath(dataset, group); + } + if (group.options.shaded.orientation === "group") { + var subGroupId = group.options.shaded.groupId; + if (groupIds.indexOf(subGroupId) === -1) { + console.log(group.id + ": Unknown shading group target given:" + subGroupId); + continue; + } + if (!paths.hasOwnProperty(subGroupId)) { + paths[subGroupId] = Lines.calcPath(groupsData[subGroupId], this.groups[subGroupId]); + } + Lines.drawShading(paths[groupIds[i]], group, paths[subGroupId], this.framework); + } else { + Lines.drawShading(paths[groupIds[i]], group, undefined, this.framework); + } + } + } - if (customTimes.length === 0) { - throw new Error('No custom time bar found with id ' + (0, _stringify2['default'])(id)); + // draw the groups, calculating paths if still necessary. + Bars.draw(groupIds, groupsData, this.framework); + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (groupsData[groupIds[i]].length > 0) { + switch (group.options.style) { + case "line": + if (!paths.hasOwnProperty(groupIds[i])) { + paths[groupIds[i]] = Lines.calcPath(groupsData[groupIds[i]], group); + } + Lines.draw(paths[groupIds[i]], group, this.framework); + // eslint-disable-line no-fallthrough + case "point": + // eslint-disable-line no-fallthrough + case "points": + if (group.options.style == "point" || group.options.style == "points" || group.options.drawPoints.enabled == true) { + Points.draw(groupsData[groupIds[i]], group, this.framework); + } + break; + case "bar": + // bar needs to be drawn enmasse + // eslint-disable-line no-fallthrough + default: + //do nothing... + } + } + } } + } - customTimes.forEach(function (customTime) { - this.customTimes.splice(this.customTimes.indexOf(customTime), 1); - this.components.splice(this.components.indexOf(customTime), 1); - customTime.destroy(); - }.bind(this)); - }; - - /** - * Get the id's of the currently visible items. - * @returns {Array} The ids of the visible items - */ - Core.prototype.getVisibleItems = function () { - return this.itemSet && this.itemSet.getVisibleItems() || []; - }; - - /** - * Set Core window such that it fits all items - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * @param {Function} a callback funtion to be executed at the end of this function - */ - Core.prototype.fit = function (options, callback) { - var range = this.getDataRange(); + // cleanup unused svg elements + DOMutil.cleanupElements(this.svgElements); + return false; +}; - // skip range set if there is no min and max date - if (range.min === null && range.max === null) { - return; +LineGraph.prototype._stack = function (data, subData) { + var index, dx, dy, subPrevPoint, subNextPoint; + index = 0; + // for each data point we look for a matching on in the set below + for (var j = 0; j < data.length; j++) { + subPrevPoint = undefined; + subNextPoint = undefined; + // we look for time matches or a before-after point + for (var k = index; k < subData.length; k++) { + // if times match exactly + if (subData[k].x === data[j].x) { + subPrevPoint = subData[k]; + subNextPoint = subData[k]; + index = k; + break; + } else if (subData[k].x > data[j].x) { + // overshoot + subNextPoint = subData[k]; + if (k == 0) { + subPrevPoint = subNextPoint; + } else { + subPrevPoint = subData[k - 1]; + } + index = k; + break; + } } - - // apply a margin of 1% left and right of the data - var interval = range.max - range.min; - var min = new Date(range.min.valueOf() - interval * 0.01); - var max = new Date(range.max.valueOf() + interval * 0.01); - var animation = options && options.animation !== undefined ? options.animation : true; - this.range.setRange(min, max, { animation: animation }, callback); - }; - - /** - * Calculate the data range of the items start and end dates - * @returns {{min: Date | null, max: Date | null}} - * @protected - */ - Core.prototype.getDataRange = function () { - // must be implemented by Timeline and Graph2d - throw new Error('Cannot invoke abstract method getDataRange'); - }; - - /** - * Set the visible window. Both parameters are optional, you can change only - * start or only end. Syntax: - * - * TimeLine.setWindow(start, end) - * TimeLine.setWindow(start, end, options) - * TimeLine.setWindow(range) - * - * Where start and end can be a Date, number, or string, and range is an - * object with properties start and end. - * - * @param {Date | Number | String | Object} [start] Start date of visible window - * @param {Date | Number | String} [end] End date of visible window - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * @param {Function} a callback funtion to be executed at the end of this function - */ - Core.prototype.setWindow = function (start, end, options, callback) { - if (typeof arguments[2] == "function") { - callback = arguments[2]; - options = {}; - } - var animation; - if (arguments.length == 1) { - var range = arguments[0]; - animation = range.animation !== undefined ? range.animation : true; - this.range.setRange(range.start, range.end, { animation: animation }); - } else if (arguments.length == 2 && typeof arguments[1] == "function") { - var range = arguments[0]; - callback = arguments[1]; - animation = range.animation !== undefined ? range.animation : true; - this.range.setRange(range.start, range.end, { animation: animation }, callback); + // in case the last data point has been used, we assume it stays like this. + if (subNextPoint === undefined) { + subPrevPoint = subData[subData.length - 1]; + subNextPoint = subData[subData.length - 1]; + } + // linear interpolation + dx = subNextPoint.x - subPrevPoint.x; + dy = subNextPoint.y - subPrevPoint.y; + if (dx == 0) { + data[j].y = data[j].orginalY + subNextPoint.y; } else { - animation = options && options.animation !== undefined ? options.animation : true; - this.range.setRange(start, end, { animation: animation }, callback); + data[j].y = data[j].orginalY + dy / dx * (data[j].x - subPrevPoint.x) + subPrevPoint.y; // ax + b where b is data[j].y } - }; + } +}; - /** - * Move the window such that given time is centered on screen. - * @param {Date | Number | String} time - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * @param {Function} a callback funtion to be executed at the end of this function - */ - Core.prototype.moveTo = function (time, options, callback) { - if (typeof arguments[1] == "function") { - callback = arguments[1]; - options = {}; +/** + * first select and preprocess the data from the datasets. + * the groups have their preselection of data, we now loop over this data to see + * what data we need to draw. Sorted data is much faster. + * more optimization is possible by doing the sampling before and using the binary search + * to find the end date to determine the increment. + * + * @param {array} groupIds + * @param {object} groupsData + * @param {date} minDate + * @param {date} maxDate + * @private + */ +LineGraph.prototype._getRelevantData = function (groupIds, groupsData, minDate, maxDate) { + var group, i, j, item; + if (groupIds.length > 0) { + for (i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + var itemsData = group.getItems(); + // optimization for sorted data + if (group.options.sort == true) { + var dateComparator = function dateComparator(a, b) { + return a.getTime() == b.getTime() ? 0 : a < b ? -1 : 1; + }; + var first = Math.max(0, util.binarySearchValue(itemsData, minDate, 'x', 'before', dateComparator)); + var last = Math.min(itemsData.length, util.binarySearchValue(itemsData, maxDate, 'x', 'after', dateComparator) + 1); + if (last <= 0) { + last = itemsData.length; + } + var dataContainer = new Array(last - first); + for (j = first; j < last; j++) { + item = group.itemsData[j]; + dataContainer[j - first] = item; + } + groupsData[groupIds[i]] = dataContainer; + } else { + // If unsorted data, all data is relevant, just returning entire structure + groupsData[groupIds[i]] = group.itemsData; + } } - var interval = this.range.end - this.range.start; - var t = util.convert(time, 'Date').valueOf(); - - var start = t - interval / 2; - var end = t + interval / 2; - var animation = options && options.animation !== undefined ? options.animation : true; - - this.range.setRange(start, end, { animation: animation }, callback); - }; - - /** - * Get the visible window - * @return {{start: Date, end: Date}} Visible range - */ - Core.prototype.getWindow = function () { - var range = this.range.getRange(); - return { - start: new Date(range.start), - end: new Date(range.end) - }; - }; - - /** - * Zoom in the window such that given time is centered on screen. - * @param {Number} percentage - must be between [0..1] - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * @param {Function} a callback funtion to be executed at the end of this function - */ - Core.prototype.zoomIn = function (percentage, options, callback) { - if (!percentage || percentage < 0 || percentage > 1) return; - if (typeof arguments[1] == "function") { - callback = arguments[1]; - options = {}; - } - var range = this.getWindow(); - var start = range.start.valueOf(); - var end = range.end.valueOf(); - var interval = end - start; - var newInterval = interval / (1 + percentage); - var distance = (interval - newInterval) / 2; - var newStart = start + distance; - var newEnd = end - distance; - - this.setWindow(newStart, newEnd, options, callback); - }; + } +}; - /** - * Zoom out the window such that given time is centered on screen. - * @param {Number} percentage - must be between [0..1] - * @param {Object} [options] Available options: - * `animation: boolean | {duration: number, easingFunction: string}` - * If true (default), the range is animated - * smoothly to the new window. An object can be - * provided to specify duration and easing function. - * Default duration is 500 ms, and default easing - * function is 'easeInOutQuad'. - * @param {Function} a callback funtion to be executed at the end of this function - */ - Core.prototype.zoomOut = function (percentage, options, callback) { - if (!percentage || percentage < 0 || percentage > 1) return; - if (typeof arguments[1] == "function") { - callback = arguments[1]; - options = {}; - } - var range = this.getWindow(); - var start = range.start.valueOf(); - var end = range.end.valueOf(); - var interval = end - start; - var newStart = start - interval * percentage / 2; - var newEnd = end + interval * percentage / 2; - - this.setWindow(newStart, newEnd, options, callback); - }; +/** + * + * @param {Array.} groupIds + * @param {vis.DataSet} groupsData + * @private + */ +LineGraph.prototype._applySampling = function (groupIds, groupsData) { + var group; + if (groupIds.length > 0) { + for (var i = 0; i < groupIds.length; i++) { + group = this.groups[groupIds[i]]; + if (group.options.sampling == true) { + var dataContainer = groupsData[groupIds[i]]; + if (dataContainer.length > 0) { + var increment = 1; + var amountOfPoints = dataContainer.length; - /** - * Force a redraw. Can be overridden by implementations of Core - * - * Note: this function will be overridden on construction with a trottled version - */ - Core.prototype.redraw = function () { - this._redraw(); - }; + // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop + // of width changing of the yAxis. + //TODO: This assumes sorted data, but that's not guaranteed! + var xDistance = this.body.util.toGlobalScreen(dataContainer[dataContainer.length - 1].x) - this.body.util.toGlobalScreen(dataContainer[0].x); + var pointsPerPixel = amountOfPoints / xDistance; + increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1, Math.round(pointsPerPixel))); - /** - * Redraw for internal use. Redraws all components. See also the public - * method redraw. - * @protected - */ - Core.prototype._redraw = function () { - this.redrawCount++; - var resized = false; - var options = this.options; - var props = this.props; - var dom = this.dom; + var sampledData = new Array(amountOfPoints); + for (var j = 0; j < amountOfPoints; j += increment) { + var idx = Math.round(j / increment); + sampledData[idx] = dataContainer[j]; + } + groupsData[groupIds[i]] = sampledData.splice(0, Math.round(amountOfPoints / increment)); + } + } + } + } +}; - if (!dom || !dom.container || dom.root.offsetWidth == 0) return; // when destroyed, or invisible +/** + * + * @param {Array.} groupIds + * @param {vis.DataSet} groupsData + * @param {object} groupRanges | this is being filled here + * @private + */ +LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) { + var groupData, group, i; + var combinedDataLeft = []; + var combinedDataRight = []; + var options; + if (groupIds.length > 0) { + for (i = 0; i < groupIds.length; i++) { + groupData = groupsData[groupIds[i]]; + options = this.groups[groupIds[i]].options; + if (groupData.length > 0) { + group = this.groups[groupIds[i]]; + // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. + if (options.stack === true && options.style === 'bar') { + if (options.yAxisOrientation === 'left') { + combinedDataLeft = combinedDataLeft.concat(groupData); + } else { + combinedDataRight = combinedDataRight.concat(groupData); + } + } else { + groupRanges[groupIds[i]] = group.getYRange(groupData, groupIds[i]); + } + } + } - DateUtil.updateHiddenDates(this.options.moment, this.body, this.options.hiddenDates); + // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. + Bars.getStackedYRange(combinedDataLeft, groupRanges, groupIds, '__barStackLeft', 'left'); + Bars.getStackedYRange(combinedDataRight, groupRanges, groupIds, '__barStackRight', 'right'); + } +}; - // update class names - if (options.orientation == 'top') { - util.addClassName(dom.root, 'vis-top'); - util.removeClassName(dom.root, 'vis-bottom'); - } else { - util.removeClassName(dom.root, 'vis-top'); - util.addClassName(dom.root, 'vis-bottom'); +/** + * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. + * @param {Array.} groupIds + * @param {Object} groupRanges + * @returns {boolean} resized + * @private + */ +LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { + var resized = false; + var yAxisLeftUsed = false; + var yAxisRightUsed = false; + var minLeft = 1e9, + minRight = 1e9, + maxLeft = -1e9, + maxRight = -1e9, + minVal, + maxVal; + // if groups are present + if (groupIds.length > 0) { + // this is here to make sure that if there are no items in the axis but there are groups, that there is no infinite draw/redraw loop. + for (var i = 0; i < groupIds.length; i++) { + var group = this.groups[groupIds[i]]; + if (group && group.options.yAxisOrientation != 'right') { + yAxisLeftUsed = true; + minLeft = 1e9; + maxLeft = -1e9; + } else if (group && group.options.yAxisOrientation) { + yAxisRightUsed = true; + minRight = 1e9; + maxRight = -1e9; + } } - // update root width and height options - dom.root.style.maxHeight = util.option.asSize(options.maxHeight, ''); - dom.root.style.minHeight = util.option.asSize(options.minHeight, ''); - dom.root.style.width = util.option.asSize(options.width, ''); - - // calculate border widths - props.border.left = (dom.centerContainer.offsetWidth - dom.centerContainer.clientWidth) / 2; - props.border.right = props.border.left; - props.border.top = (dom.centerContainer.offsetHeight - dom.centerContainer.clientHeight) / 2; - props.border.bottom = props.border.top; - props.borderRootHeight = dom.root.offsetHeight - dom.root.clientHeight; - props.borderRootWidth = dom.root.offsetWidth - dom.root.clientWidth; - - // workaround for a bug in IE: the clientWidth of an element with - // a height:0px and overflow:hidden is not calculated and always has value 0 - if (dom.centerContainer.clientHeight === 0) { - props.border.left = props.border.top; - props.border.right = props.border.left; - } - if (dom.root.clientHeight === 0) { - props.borderRootWidth = props.borderRootHeight; - } - - // calculate the heights. If any of the side panels is empty, we set the height to - // minus the border width, such that the border will be invisible - props.center.height = dom.center.offsetHeight; - props.left.height = dom.left.offsetHeight; - props.right.height = dom.right.offsetHeight; - props.top.height = dom.top.clientHeight || -props.border.top; - props.bottom.height = dom.bottom.clientHeight || -props.border.bottom; - - // TODO: compensate borders when any of the panels is empty. - - // apply auto height - // TODO: only calculate autoHeight when needed (else we cause an extra reflow/repaint of the DOM) - var contentHeight = Math.max(props.left.height, props.center.height, props.right.height); - var autoHeight = props.top.height + contentHeight + props.bottom.height + props.borderRootHeight + props.border.top + props.border.bottom; - dom.root.style.height = util.option.asSize(options.height, autoHeight + 'px'); - - // calculate heights of the content panels - props.root.height = dom.root.offsetHeight; - props.background.height = props.root.height - props.borderRootHeight; - var containerHeight = props.root.height - props.top.height - props.bottom.height - props.borderRootHeight; - props.centerContainer.height = containerHeight; - props.leftContainer.height = containerHeight; - props.rightContainer.height = props.leftContainer.height; - - // calculate the widths of the panels - props.root.width = dom.root.offsetWidth; - props.background.width = props.root.width - props.borderRootWidth; - - if (!this.initialDrawDone) { - props.scrollbarWidth = util.getScrollBarWidth(); - } - - if (options.verticalScroll) { - if (options.rtl) { - props.left.width = dom.leftContainer.clientWidth || -props.border.left; - props.right.width = dom.rightContainer.clientWidth + props.scrollbarWidth || -props.border.right; - } else { - props.left.width = dom.leftContainer.clientWidth + props.scrollbarWidth || -props.border.left; - props.right.width = dom.rightContainer.clientWidth || -props.border.right; + // if there are items: + for (i = 0; i < groupIds.length; i++) { + if (groupRanges.hasOwnProperty(groupIds[i])) { + if (groupRanges[groupIds[i]].ignore !== true) { + minVal = groupRanges[groupIds[i]].min; + maxVal = groupRanges[groupIds[i]].max; + + if (groupRanges[groupIds[i]].yAxisOrientation != 'right') { + yAxisLeftUsed = true; + minLeft = minLeft > minVal ? minVal : minLeft; + maxLeft = maxLeft < maxVal ? maxVal : maxLeft; + } else { + yAxisRightUsed = true; + minRight = minRight > minVal ? minVal : minRight; + maxRight = maxRight < maxVal ? maxVal : maxRight; + } + } } - } else { - props.left.width = dom.leftContainer.clientWidth || -props.border.left; - props.right.width = dom.rightContainer.clientWidth || -props.border.right; } - this._setDOM(); + if (yAxisLeftUsed == true) { + this.yAxisLeft.setRange(minLeft, maxLeft); + } + if (yAxisRightUsed == true) { + this.yAxisRight.setRange(minRight, maxRight); + } + } + resized = this._toggleAxisVisiblity(yAxisLeftUsed, this.yAxisLeft) || resized; + resized = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || resized; - // update the scrollTop, feasible range for the offset can be changed - // when the height of the Core or of the contents of the center changed - var offset = this._updateScrollTop(); + if (yAxisRightUsed == true && yAxisLeftUsed == true) { + this.yAxisLeft.drawIcons = true; + this.yAxisRight.drawIcons = true; + } else { + this.yAxisLeft.drawIcons = false; + this.yAxisRight.drawIcons = false; + } + this.yAxisRight.master = !yAxisLeftUsed; + this.yAxisRight.masterAxis = this.yAxisLeft; - // reposition the scrollable contents - if (options.orientation.item != 'top') { - offset += Math.max(props.centerContainer.height - props.center.height - props.border.top - props.border.bottom, 0); + if (this.yAxisRight.master == false) { + if (yAxisRightUsed == true) { + this.yAxisLeft.lineOffset = this.yAxisRight.width; + } else { + this.yAxisLeft.lineOffset = 0; } - dom.center.style.top = offset + 'px'; - // show shadows when vertical scrolling is available - var visibilityTop = props.scrollTop == 0 ? 'hidden' : ''; - var visibilityBottom = props.scrollTop == props.scrollTopMin ? 'hidden' : ''; - dom.shadowTop.style.visibility = visibilityTop; - dom.shadowBottom.style.visibility = visibilityBottom; - dom.shadowTopLeft.style.visibility = visibilityTop; - dom.shadowBottomLeft.style.visibility = visibilityBottom; - dom.shadowTopRight.style.visibility = visibilityTop; - dom.shadowBottomRight.style.visibility = visibilityBottom; + resized = this.yAxisLeft.redraw() || resized; + resized = this.yAxisRight.redraw() || resized; + } else { + resized = this.yAxisRight.redraw() || resized; + } - if (options.verticalScroll) { - dom.rightContainer.className = 'vis-panel vis-right vis-vertical-scroll'; - dom.leftContainer.className = 'vis-panel vis-left vis-vertical-scroll'; + // clean the accumulated lists + var tempGroups = ['__barStackLeft', '__barStackRight', '__lineStackLeft', '__lineStackRight']; + for (i = 0; i < tempGroups.length; i++) { + if (groupIds.indexOf(tempGroups[i]) != -1) { + groupIds.splice(groupIds.indexOf(tempGroups[i]), 1); + } + } - dom.shadowTopRight.style.visibility = "hidden"; - dom.shadowBottomRight.style.visibility = "hidden"; - dom.shadowTopLeft.style.visibility = "hidden"; - dom.shadowBottomLeft.style.visibility = "hidden"; + return resized; +}; - dom.left.style.top = '0px'; - dom.right.style.top = '0px'; +/** + * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function + * + * @param {boolean} axisUsed + * @param {vis.DataAxis} axis + * @returns {boolean} + * @private + */ +LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { + var changed = false; + if (axisUsed == false) { + if (axis.dom.frame.parentNode && axis.hidden == false) { + axis.hide(); + changed = true; } - - if (!options.verticalScroll || props.center.height < props.centerContainer.height) { - dom.left.style.top = offset + 'px'; - dom.right.style.top = offset + 'px'; - dom.rightContainer.className = dom.rightContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' '); - dom.leftContainer.className = dom.leftContainer.className.replace(new RegExp('(?:^|\\s)' + 'vis-vertical-scroll' + '(?:\\s|$)'), ' '); - props.left.width = dom.leftContainer.clientWidth || -props.border.left; - props.right.width = dom.rightContainer.clientWidth || -props.border.right; - this._setDOM(); + } else { + if (!axis.dom.frame.parentNode && axis.hidden == true) { + axis.show(); + changed = true; } + } + return changed; +}; - // enable/disable vertical panning - var contentsOverflow = props.center.height > props.centerContainer.height; - this.hammer.get('pan').set({ - direction: contentsOverflow ? Hammer.DIRECTION_ALL : Hammer.DIRECTION_HORIZONTAL - }); - - // redraw all components - this.components.forEach(function (component) { - resized = component.redraw() || resized; - }); - var MAX_REDRAW = 5; - if (resized) { - if (this.redrawCount < MAX_REDRAW) { - this.body.emitter.emit('_change'); - return; - } else { - console.log('WARNING: infinite loop in redraw?'); - } +/** + * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for + * the yAxis. + * + * @param {Array.} datapoints + * @private + */ +LineGraph.prototype._convertXcoordinates = function (datapoints) { + var toScreen = this.body.util.toScreen; + for (var i = 0; i < datapoints.length; i++) { + datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width; + datapoints[i].screen_y = datapoints[i].y; //starting point for range calculations + if (datapoints[i].end != undefined) { + datapoints[i].screen_end = toScreen(datapoints[i].end) + this.props.width; } else { - this.redrawCount = 0; + datapoints[i].screen_end = undefined; } - this.initialDrawDone = true; + } +}; - //Emit public 'changed' event for UI updates, see issue #1592 - this.body.emitter.emit("changed"); - }; +/** + * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the + * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for + * the yAxis. + * + * @param {Array.} datapoints + * @param {vis.GraphGroup} group + * @private + */ +LineGraph.prototype._convertYcoordinates = function (datapoints, group) { + var axis = this.yAxisLeft; + var svgHeight = Number(this.svg.style.height.replace('px', '')); + if (group.options.yAxisOrientation == 'right') { + axis = this.yAxisRight; + } + for (var i = 0; i < datapoints.length; i++) { + datapoints[i].screen_y = Math.round(axis.convertValue(datapoints[i].y)); + } + group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0))); +}; - Core.prototype._setDOM = function () { - var props = this.props; - var dom = this.dom; +module.exports = LineGraph; - props.leftContainer.width = props.left.width; - props.rightContainer.width = props.right.width; - var centerWidth = props.root.width - props.left.width - props.right.width - props.borderRootWidth; - props.center.width = centerWidth; - props.centerContainer.width = centerWidth; - props.top.width = centerWidth; - props.bottom.width = centerWidth; - - // resize the panels - dom.background.style.height = props.background.height + 'px'; - dom.backgroundVertical.style.height = props.background.height + 'px'; - dom.backgroundHorizontal.style.height = props.centerContainer.height + 'px'; - dom.centerContainer.style.height = props.centerContainer.height + 'px'; - dom.leftContainer.style.height = props.leftContainer.height + 'px'; - dom.rightContainer.style.height = props.rightContainer.height + 'px'; - - dom.background.style.width = props.background.width + 'px'; - dom.backgroundVertical.style.width = props.centerContainer.width + 'px'; - dom.backgroundHorizontal.style.width = props.background.width + 'px'; - dom.centerContainer.style.width = props.center.width + 'px'; - dom.top.style.width = props.top.width + 'px'; - dom.bottom.style.width = props.bottom.width + 'px'; - - // reposition the panels - dom.background.style.left = '0'; - dom.background.style.top = '0'; - dom.backgroundVertical.style.left = props.left.width + props.border.left + 'px'; - dom.backgroundVertical.style.top = '0'; - dom.backgroundHorizontal.style.left = '0'; - dom.backgroundHorizontal.style.top = props.top.height + 'px'; - dom.centerContainer.style.left = props.left.width + 'px'; - dom.centerContainer.style.top = props.top.height + 'px'; - dom.leftContainer.style.left = '0'; - dom.leftContainer.style.top = props.top.height + 'px'; - dom.rightContainer.style.left = props.left.width + props.center.width + 'px'; - dom.rightContainer.style.top = props.top.height + 'px'; - dom.top.style.left = props.left.width + 'px'; - dom.top.style.top = '0'; - dom.bottom.style.left = props.left.width + 'px'; - dom.bottom.style.top = props.top.height + props.centerContainer.height + 'px'; - dom.center.style.left = '0'; - dom.left.style.left = '0'; - dom.right.style.left = '0'; - }; +/***/ }), +/* 107 */ +/***/ (function(module, exports, __webpack_require__) { - // TODO: deprecated since version 1.1.0, remove some day - Core.prototype.repaint = function () { - throw new Error('Function repaint is deprecated. Use redraw instead.'); - }; +"use strict"; - /** - * Set a current time. This can be used for example to ensure that a client's - * time is synchronized with a shared server time. - * Only applicable when option `showCurrentTime` is true. - * @param {Date | String | Number} time A Date, unix timestamp, or - * ISO date string. - */ - Core.prototype.setCurrentTime = function (time) { - if (!this.currentTime) { - throw new Error('Option showCurrentTime must be true'); - } - this.currentTime.setCurrentTime(time); - }; +var _keys = __webpack_require__(8); - /** - * Get the current time. - * Only applicable when option `showCurrentTime` is true. - * @return {Date} Returns the current time. - */ - Core.prototype.getCurrentTime = function () { - if (!this.currentTime) { - throw new Error('Option showCurrentTime must be true'); - } +var _keys2 = _interopRequireDefault(_keys); - return this.currentTime.getCurrentTime(); - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Convert a position on screen (pixels) to a datetime - * @param {int} x Position on the screen in pixels - * @return {Date} time The datetime the corresponds with given position x - * @protected - */ - // TODO: move this function to Range - Core.prototype._toTime = function (x) { - return DateUtil.toTime(this, x, this.props.center.width); +var util = __webpack_require__(2); +var DOMutil = __webpack_require__(14); +var Component = __webpack_require__(16); +var DataScale = __webpack_require__(108); +/** + * A horizontal time axis + * @param {Object} body + * @param {Object} [options] See DataAxis.setOptions for the available + * options. + * @param {SVGElement} svg + * @param {vis.LineGraph.options} linegraphOptions + * @constructor DataAxis + * @extends Component + */ +function DataAxis(body, options, svg, linegraphOptions) { + this.id = util.randomUUID(); + this.body = body; + + this.defaultOptions = { + orientation: 'left', // supported: 'left', 'right' + showMinorLabels: true, + showMajorLabels: true, + icons: false, + majorLinesOffset: 7, + minorLinesOffset: 4, + labelOffsetX: 10, + labelOffsetY: 2, + iconWidth: 20, + width: '40px', + visible: true, + alignZeros: true, + left: { + range: { min: undefined, max: undefined }, + format: function format(value) { + return '' + parseFloat(value.toPrecision(3)); + }, + title: { text: undefined, style: undefined } + }, + right: { + range: { min: undefined, max: undefined }, + format: function format(value) { + return '' + parseFloat(value.toPrecision(3)); + }, + title: { text: undefined, style: undefined } + } }; - /** - * Convert a position on the global screen (pixels) to a datetime - * @param {int} x Position on the screen in pixels - * @return {Date} time The datetime the corresponds with given position x - * @protected - */ - // TODO: move this function to Range - Core.prototype._toGlobalTime = function (x) { - return DateUtil.toTime(this, x, this.props.root.width); - //var conversion = this.range.conversion(this.props.root.width); - //return new Date(x / conversion.scale + conversion.offset); + this.linegraphOptions = linegraphOptions; + this.linegraphSVG = svg; + this.props = {}; + this.DOMelements = { // dynamic elements + lines: {}, + labels: {}, + title: {} }; - /** - * Convert a datetime (Date object) into a position on the screen - * @param {Date} time A date - * @return {int} x The position on the screen in pixels which corresponds - * with the given date. - * @protected - */ - // TODO: move this function to Range - Core.prototype._toScreen = function (time) { - return DateUtil.toScreen(this, time, this.props.center.width); - }; + this.dom = {}; + this.scale = undefined; + this.range = { start: 0, end: 0 }; - /** - * Convert a datetime (Date object) into a position on the root - * This is used to get the pixel density estimate for the screen, not the center panel - * @param {Date} time A date - * @return {int} x The position on root in pixels which corresponds - * with the given date. - * @protected - */ - // TODO: move this function to Range - Core.prototype._toGlobalScreen = function (time) { - return DateUtil.toScreen(this, time, this.props.root.width); - //var conversion = this.range.conversion(this.props.root.width); - //return (time.valueOf() - conversion.offset) * conversion.scale; - }; + this.options = util.extend({}, this.defaultOptions); + this.conversionFactor = 1; - /** - * Initialize watching when option autoResize is true - * @private - */ - Core.prototype._initAutoResize = function () { - if (this.options.autoResize == true) { - this._startAutoResize(); - } else { - this._stopAutoResize(); - } - }; + this.setOptions(options); + this.width = Number(('' + this.options.width).replace("px", "")); + this.minWidth = this.width; + this.height = this.linegraphSVG.getBoundingClientRect().height; + this.hidden = false; - /** - * Watch for changes in the size of the container. On resize, the Panel will - * automatically redraw itself. - * @private - */ - Core.prototype._startAutoResize = function () { - var me = this; + this.stepPixels = 25; + this.zeroCrossing = -1; + this.amountOfSteps = -1; - this._stopAutoResize(); + this.lineOffset = 0; + this.master = true; + this.masterAxis = null; + this.svgElements = {}; + this.iconsRemoved = false; - this._onResize = function () { - if (me.options.autoResize != true) { - // stop watching when the option autoResize is changed to false - me._stopAutoResize(); - return; - } + this.groups = {}; + this.amountOfGroups = 0; - if (me.dom.root) { - // check whether the frame is resized - // Note: we compare offsetWidth here, not clientWidth. For some reason, - // IE does not restore the clientWidth from 0 to the actual width after - // changing the timeline's container display style from none to visible - if (me.dom.root.offsetWidth != me.props.lastWidth || me.dom.root.offsetHeight != me.props.lastHeight) { - me.props.lastWidth = me.dom.root.offsetWidth; - me.props.lastHeight = me.dom.root.offsetHeight; - me.props.scrollbarWidth = util.getScrollBarWidth(); + // create the HTML DOM + this._create(); + this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups }; - me.body.emitter.emit('_change'); - } - } - }; + var me = this; + this.body.emitter.on("verticalDrag", function () { + me.dom.lineContainer.style.top = me.body.domProps.scrollTop + 'px'; + }); +} - // add event listener to window resize - util.addEventListener(window, 'resize', this._onResize); +DataAxis.prototype = new Component(); - //Prevent initial unnecessary redraw - if (me.dom.root) { - me.props.lastWidth = me.dom.root.offsetWidth; - me.props.lastHeight = me.dom.root.offsetHeight; - } +DataAxis.prototype.addGroup = function (label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; +}; - this.watchTimer = setInterval(this._onResize, 1000); - }; +DataAxis.prototype.updateGroup = function (label, graphOptions) { + if (!this.groups.hasOwnProperty(label)) { + this.amountOfGroups += 1; + } + this.groups[label] = graphOptions; +}; - /** - * Stop watching for a resize of the frame. - * @private - */ - Core.prototype._stopAutoResize = function () { - if (this.watchTimer) { - clearInterval(this.watchTimer); - this.watchTimer = undefined; +DataAxis.prototype.removeGroup = function (label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } +}; + +DataAxis.prototype.setOptions = function (options) { + if (options) { + var redraw = false; + if (this.options.orientation != options.orientation && options.orientation !== undefined) { + redraw = true; } + var fields = ['orientation', 'showMinorLabels', 'showMajorLabels', 'icons', 'majorLinesOffset', 'minorLinesOffset', 'labelOffsetX', 'labelOffsetY', 'iconWidth', 'width', 'visible', 'left', 'right', 'alignZeros']; + util.selectiveDeepExtend(fields, this.options, options); - // remove event listener on window.resize - if (this._onResize) { - util.removeEventListener(window, 'resize', this._onResize); - this._onResize = null; + this.minWidth = Number(('' + this.options.width).replace("px", "")); + if (redraw === true && this.dom.frame) { + this.hide(); + this.show(); } - }; + } +}; - /** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ - Core.prototype._onTouch = function (event) { - this.touch.allowDragging = true; - this.touch.initialScrollTop = this.props.scrollTop; - }; +/** + * Create the HTML DOM for the DataAxis + */ +DataAxis.prototype._create = function () { + this.dom.frame = document.createElement('div'); + this.dom.frame.style.width = this.options.width; + this.dom.frame.style.height = this.height; + + this.dom.lineContainer = document.createElement('div'); + this.dom.lineContainer.style.width = '100%'; + this.dom.lineContainer.style.height = this.height; + this.dom.lineContainer.style.position = 'relative'; + + // create svg element for graph drawing. + this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + this.svg.style.position = "absolute"; + this.svg.style.top = '0px'; + this.svg.style.height = '100%'; + this.svg.style.width = '100%'; + this.svg.style.display = "block"; + this.dom.frame.appendChild(this.svg); +}; + +DataAxis.prototype._redrawGroupIcons = function () { + DOMutil.prepareElements(this.svgElements); + + var x; + var iconWidth = this.options.iconWidth; + var iconHeight = 15; + var iconOffset = 4; + var y = iconOffset + 0.5 * iconHeight; + + if (this.options.orientation === 'left') { + x = iconOffset; + } else { + x = this.width - iconWidth - iconOffset; + } - /** - * Start moving the timeline vertically - * @param {Event} event - * @private - */ - Core.prototype._onPinch = function (event) { - this.touch.allowDragging = false; - }; + var groupArray = (0, _keys2['default'])(this.groups); + groupArray.sort(function (a, b) { + return a < b ? -1 : 1; + }); - /** - * Move the timeline vertically - * @param {Event} event - * @private - */ - Core.prototype._onDrag = function (event) { - if (!event) return; - // refuse to drag when we where pinching to prevent the timeline make a jump - // when releasing the fingers in opposite order from the touch screen - if (!this.touch.allowDragging) return; + for (var i = 0; i < groupArray.length; i++) { + var groupId = groupArray[i]; + if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) { + this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y); + y += iconHeight + iconOffset; + } + } - var delta = event.deltaY; + DOMutil.cleanupElements(this.svgElements); + this.iconsRemoved = false; +}; - var oldScrollTop = this._getScrollTop(); - var newScrollTop = this._setScrollTop(this.touch.initialScrollTop + delta); +DataAxis.prototype._cleanupIcons = function () { + if (this.iconsRemoved === false) { + DOMutil.prepareElements(this.svgElements); + DOMutil.cleanupElements(this.svgElements); + this.iconsRemoved = true; + } +}; - if (this.options.verticalScroll) { - this.dom.left.parentNode.scrollTop = -this.props.scrollTop; - this.dom.right.parentNode.scrollTop = -this.props.scrollTop; +/** + * Create the HTML DOM for the DataAxis + */ +DataAxis.prototype.show = function () { + this.hidden = false; + if (!this.dom.frame.parentNode) { + if (this.options.orientation === 'left') { + this.body.dom.left.appendChild(this.dom.frame); + } else { + this.body.dom.right.appendChild(this.dom.frame); } + } - if (newScrollTop != oldScrollTop) { - this.emit("verticalDrag"); - } - }; + if (!this.dom.lineContainer.parentNode) { + this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer); + } +}; - /** - * Apply a scrollTop - * @param {Number} scrollTop - * @returns {Number} scrollTop Returns the applied scrollTop - * @private - */ - Core.prototype._setScrollTop = function (scrollTop) { - this.props.scrollTop = scrollTop; - this._updateScrollTop(); - return this.props.scrollTop; - }; +/** + * Create the HTML DOM for the DataAxis + */ +DataAxis.prototype.hide = function () { + this.hidden = true; + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } - /** - * Update the current scrollTop when the height of the containers has been changed - * @returns {Number} scrollTop Returns the applied scrollTop - * @private - */ - Core.prototype._updateScrollTop = function () { - // recalculate the scrollTopMin - var scrollTopMin = Math.min(this.props.centerContainer.height - this.props.center.height, 0); // is negative or zero - if (scrollTopMin != this.props.scrollTopMin) { - // in case of bottom orientation, change the scrollTop such that the contents - // do not move relative to the time axis at the bottom - if (this.options.orientation.item != 'top') { - this.props.scrollTop += scrollTopMin - this.props.scrollTopMin; - } - this.props.scrollTopMin = scrollTopMin; - } + if (this.dom.lineContainer.parentNode) { + this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer); + } +}; - // limit the scrollTop to the feasible scroll range - if (this.props.scrollTop > 0) this.props.scrollTop = 0; - if (this.props.scrollTop < scrollTopMin) this.props.scrollTop = scrollTopMin; +/** + * Set a range (start and end) + * @param {number} start + * @param {number} end + */ +DataAxis.prototype.setRange = function (start, end) { + this.range.start = start; + this.range.end = end; +}; - if (this.options.verticalScroll) { - this.dom.left.parentNode.scrollTop = -this.props.scrollTop; - this.dom.right.parentNode.scrollTop = -this.props.scrollTop; +/** + * Repaint the component + * @return {boolean} Returns true if the component is resized + */ +DataAxis.prototype.redraw = function () { + var resized = false; + var activeGroups = 0; + + // Make sure the line container adheres to the vertical scrolling. + this.dom.lineContainer.style.top = this.body.domProps.scrollTop + 'px'; + + for (var groupId in this.groups) { + if (this.groups.hasOwnProperty(groupId)) { + if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) { + activeGroups++; + } } + } + if (this.amountOfGroups === 0 || activeGroups === 0) { + this.hide(); + } else { + this.show(); + this.height = Number(this.linegraphSVG.style.height.replace("px", "")); - return this.props.scrollTop; - }; + // svg offsetheight did not work in firefox and explorer... + this.dom.lineContainer.style.height = this.height + 'px'; + this.width = this.options.visible === true ? Number(('' + this.options.width).replace("px", "")) : 0; - /** - * Get the current scrollTop - * @returns {number} scrollTop - * @private - */ - Core.prototype._getScrollTop = function () { - return this.props.scrollTop; - }; + var props = this.props; + var frame = this.dom.frame; - /** - * Load a configurator - * @return {Object} - * @private - */ - Core.prototype._createConfigurator = function () { - throw new Error('Cannot invoke abstract method _createConfigurator'); - }; + // update classname + frame.className = 'vis-data-axis'; - module.exports = Core; + // calculate character width and height + this._calculateCharSize(); -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { + var orientation = this.options.orientation; + var showMinorLabels = this.options.showMinorLabels; + var showMajorLabels = this.options.showMajorLabels; - 'use strict'; + // determine the width and height of the elements for the axis + props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; + props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; - var _create = __webpack_require__(55); + props.minorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset; + props.minorLineHeight = 1; + props.majorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset; + props.majorLineHeight = 1; - var _create2 = _interopRequireDefault(_create); + // take frame offline while updating (is almost twice as fast) + if (orientation === 'left') { + frame.style.top = '0'; + frame.style.left = '0'; + frame.style.bottom = ''; + frame.style.width = this.width + 'px'; + frame.style.height = this.height + "px"; + this.props.width = this.body.domProps.left.width; + this.props.height = this.body.domProps.left.height; + } else { + // right + frame.style.top = ''; + frame.style.bottom = '0'; + frame.style.left = '0'; + frame.style.width = this.width + 'px'; + frame.style.height = this.height + "px"; + this.props.width = this.body.domProps.right.width; + this.props.height = this.body.domProps.right.height; + } - var _typeof2 = __webpack_require__(62); + resized = this._redrawLabels(); + resized = this._isResized() || resized; - var _typeof3 = _interopRequireDefault(_typeof2); + if (this.options.icons === true) { + this._redrawGroupIcons(); + } else { + this._cleanupIcons(); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + this._redrawTitle(orientation); + } + return resized; +}; - var Hammer = __webpack_require__(113); - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var TimeStep = __webpack_require__(125); - var Component = __webpack_require__(121); - var Group = __webpack_require__(126); - var BackgroundGroup = __webpack_require__(130); - var BoxItem = __webpack_require__(131); - var PointItem = __webpack_require__(132); - var RangeItem = __webpack_require__(128); - var BackgroundItem = __webpack_require__(133); - var Popup = __webpack_require__(134)['default']; +/** + * Repaint major and minor text labels and vertical grid lines + * + * @returns {boolean} + * @private + */ +DataAxis.prototype._redrawLabels = function () { + var _this = this; - var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items - var BACKGROUND = '__background__'; // reserved group id for background items without group + var resized = false; + DOMutil.prepareElements(this.DOMelements.lines); + DOMutil.prepareElements(this.DOMelements.labels); + var orientation = this.options['orientation']; + var customRange = this.options[orientation].range != undefined ? this.options[orientation].range : {}; - /** - * An ItemSet holds a set of items and ranges which can be displayed in a - * range. The width is determined by the parent of the ItemSet, and the height - * is determined by the size of the items. - * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body - * @param {Object} [options] See ItemSet.setOptions for the available options. - * @constructor ItemSet - * @extends Component - */ - function ItemSet(body, options) { - this.body = body; - this.defaultOptions = { - type: null, // 'box', 'point', 'range', 'background' - orientation: { - item: 'bottom' // item orientation: 'top' or 'bottom' - }, - align: 'auto', // alignment of box items - stack: true, - stackSubgroups: true, - groupOrderSwap: function groupOrderSwap(fromGroup, toGroup, groups) { - var targetOrder = toGroup.order; - toGroup.order = fromGroup.order; - fromGroup.order = targetOrder; - }, - groupOrder: 'order', + //Override range with manual options: + var autoScaleEnd = true; + if (customRange.max != undefined) { + this.range.end = customRange.max; + autoScaleEnd = false; + } + var autoScaleStart = true; + if (customRange.min != undefined) { + this.range.start = customRange.min; + autoScaleStart = false; + } - selectable: true, - multiselect: false, - itemsAlwaysDraggable: { - item: false, - range: false - }, + this.scale = new DataScale(this.range.start, this.range.end, autoScaleStart, autoScaleEnd, this.dom.frame.offsetHeight, this.props.majorCharHeight, this.options.alignZeros, this.options[orientation].format); - editable: { - updateTime: false, - updateGroup: false, - add: false, - remove: false, - overrideItems: false - }, + if (this.master === false && this.masterAxis != undefined) { + this.scale.followScale(this.masterAxis.scale); + } - groupEditable: { - order: false, - add: false, - remove: false - }, + //Is updated in side-effect of _redrawLabel(): + this.maxLabelSize = 0; - snap: TimeStep.snap, + var lines = this.scale.getLines(); + lines.forEach(function (line) { + var y = line.y; + var isMajor = line.major; + if (_this.options['showMinorLabels'] && isMajor === false) { + _this._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-minor', _this.props.minorCharHeight); + } + if (isMajor) { + if (y >= 0) { + _this._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-major', _this.props.majorCharHeight); + } + } + if (_this.master === true) { + if (isMajor) { + _this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-major', _this.options.majorLinesOffset, _this.props.majorLineWidth); + } else { + _this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-minor', _this.options.minorLinesOffset, _this.props.minorLineWidth); + } + } + }); - onAdd: function onAdd(item, callback) { - callback(item); - }, - onUpdate: function onUpdate(item, callback) { - callback(item); - }, - onMove: function onMove(item, callback) { - callback(item); - }, - onRemove: function onRemove(item, callback) { - callback(item); - }, - onMoving: function onMoving(item, callback) { - callback(item); - }, - onAddGroup: function onAddGroup(item, callback) { - callback(item); - }, - onMoveGroup: function onMoveGroup(item, callback) { - callback(item); - }, - onRemoveGroup: function onRemoveGroup(item, callback) { - callback(item); - }, + // Note that title is rotated, so we're using the height, not width! + var titleWidth = 0; + if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) { + titleWidth = this.props.titleCharHeight; + } + var offset = this.options.icons === true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15; - margin: { - item: { - horizontal: 10, - vertical: 10 - }, - axis: 20 - }, + // this will resize the yAxis to accommodate the labels. + if (this.maxLabelSize > this.width - offset && this.options.visible === true) { + this.width = this.maxLabelSize + offset; + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements.lines); + DOMutil.cleanupElements(this.DOMelements.labels); + this.redraw(); + resized = true; + } + // this will resize the yAxis if it is too big for the labels. + else if (this.maxLabelSize < this.width - offset && this.options.visible === true && this.width > this.minWidth) { + this.width = Math.max(this.minWidth, this.maxLabelSize + offset); + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements.lines); + DOMutil.cleanupElements(this.DOMelements.labels); + this.redraw(); + resized = true; + } else { + DOMutil.cleanupElements(this.DOMelements.lines); + DOMutil.cleanupElements(this.DOMelements.labels); + resized = false; + } - showTooltips: true, + return resized; +}; - tooltip: { - followMouse: false, - overflowMethod: 'flip' - }, +DataAxis.prototype.convertValue = function (value) { + return this.scale.convertValue(value); +}; - tooltipOnItemUpdateTime: false - }; +DataAxis.prototype.screenToValue = function (x) { + return this.scale.screenToValue(x); +}; - // options is shared by this ItemSet and all its items - this.options = util.extend({}, this.defaultOptions); - this.options.rtl = options.rtl; +/** + * Create a label for the axis at position x + * + * @param {number} y + * @param {string} text + * @param {'top'|'right'|'bottom'|'left'} orientation + * @param {string} className + * @param {number} characterHeight + * @private + */ +DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) { + // reuse redundant label + var label = DOMutil.getDOMElement('div', this.DOMelements.labels, this.dom.frame); //this.dom.redundant.labels.shift(); + label.className = className; + label.innerHTML = text; + if (orientation === 'left') { + label.style.left = '-' + this.options.labelOffsetX + 'px'; + label.style.textAlign = "right"; + } else { + label.style.right = '-' + this.options.labelOffsetX + 'px'; + label.style.textAlign = "left"; + } - // options for getting items from the DataSet with the correct type - this.itemOptions = { - type: { start: 'Date', end: 'Date' } - }; + label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px'; - this.conversion = { - toScreen: body.util.toScreen, - toTime: body.util.toTime - }; - this.dom = {}; - this.props = {}; - this.hammer = null; + text += ''; - var me = this; - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet + var largestWidth = Math.max(this.props.majorCharWidth, this.props.minorCharWidth); + if (this.maxLabelSize < text.length * largestWidth) { + this.maxLabelSize = text.length * largestWidth; + } +}; - // listeners for the DataSet of the items - this.itemListeners = { - 'add': function add(event, params, senderId) { - me._onAdd(params.items); - }, - 'update': function update(event, params, senderId) { - me._onUpdate(params.items); - }, - 'remove': function remove(event, params, senderId) { - me._onRemove(params.items); - } - }; +/** + * Create a minor line for the axis at position y + * @param {number} y + * @param {'top'|'right'|'bottom'|'left'} orientation + * @param {string} className + * @param {number} offset + * @param {number} width + */ +DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) { + if (this.master === true) { + var line = DOMutil.getDOMElement('div', this.DOMelements.lines, this.dom.lineContainer); //this.dom.redundant.lines.shift(); + line.className = className; + line.innerHTML = ''; - // listeners for the DataSet of the groups - this.groupListeners = { - 'add': function add(event, params, senderId) { - me._onAddGroups(params.items); - }, - 'update': function update(event, params, senderId) { - me._onUpdateGroups(params.items); - }, - 'remove': function remove(event, params, senderId) { - me._onRemoveGroups(params.items); - } - }; + if (orientation === 'left') { + line.style.left = this.width - offset + 'px'; + } else { + line.style.right = this.width - offset + 'px'; + } - this.items = {}; // object with an Item for every data item - this.groups = {}; // Group object for every group - this.groupIds = []; + line.style.width = width + 'px'; + line.style.top = y + 'px'; + } +}; - this.selection = []; // list with the ids of all selected nodes +/** + * Create a title for the axis + * @private + * @param {'top'|'right'|'bottom'|'left'} orientation + */ +DataAxis.prototype._redrawTitle = function (orientation) { + DOMutil.prepareElements(this.DOMelements.title); - this.popup = null; + // Check if the title is defined for this axes + if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) { + var title = DOMutil.getDOMElement('div', this.DOMelements.title, this.dom.frame); + title.className = 'vis-y-axis vis-title vis-' + orientation; + title.innerHTML = this.options[orientation].title.text; - this.touchParams = {}; // stores properties while dragging - this.groupTouchParams = {}; - // create the HTML DOM + // Add style - if provided + if (this.options[orientation].title.style !== undefined) { + util.addCssText(title, this.options[orientation].title.style); + } - this._create(); + if (orientation === 'left') { + title.style.left = this.props.titleCharHeight + 'px'; + } else { + title.style.right = this.props.titleCharHeight + 'px'; + } - this.setOptions(options); + title.style.width = this.height + 'px'; } - ItemSet.prototype = new Component(); + // we need to clean up in case we did not use all elements. + DOMutil.cleanupElements(this.DOMelements.title); +}; - // available item types will be registered here - ItemSet.types = { - background: BackgroundItem, - box: BoxItem, - range: RangeItem, - point: PointItem - }; +/** + * Determine the size of text on the axis (both major and minor axis). + * The size is calculated only once and then cached in this.props. + * @private + */ +DataAxis.prototype._calculateCharSize = function () { + // determine the char width and height on the minor axis + if (!('minorCharHeight' in this.props)) { + var textMinor = document.createTextNode('0'); + var measureCharMinor = document.createElement('div'); + measureCharMinor.className = 'vis-y-axis vis-minor vis-measure'; + measureCharMinor.appendChild(textMinor); + this.dom.frame.appendChild(measureCharMinor); - /** - * Create the HTML DOM for the ItemSet - */ - ItemSet.prototype._create = function () { - var frame = document.createElement('div'); - frame.className = 'vis-itemset'; - frame['timeline-itemset'] = this; - this.dom.frame = frame; - - // create background panel - var background = document.createElement('div'); - background.className = 'vis-background'; - frame.appendChild(background); - this.dom.background = background; - - // create foreground panel - var foreground = document.createElement('div'); - foreground.className = 'vis-foreground'; - frame.appendChild(foreground); - this.dom.foreground = foreground; - - // create axis panel - var axis = document.createElement('div'); - axis.className = 'vis-axis'; - this.dom.axis = axis; - - // create labelset - var labelSet = document.createElement('div'); - labelSet.className = 'vis-labelset'; - this.dom.labelSet = labelSet; - - // create ungrouped Group - this._updateUngrouped(); + this.props.minorCharHeight = measureCharMinor.clientHeight; + this.props.minorCharWidth = measureCharMinor.clientWidth; - // create background Group - var backgroundGroup = new BackgroundGroup(BACKGROUND, null, this); - backgroundGroup.show(); - this.groups[BACKGROUND] = backgroundGroup; + this.dom.frame.removeChild(measureCharMinor); + } - // attach event listeners - // Note: we bind to the centerContainer for the case where the height - // of the center container is larger than of the ItemSet, so we - // can click in the empty area to create a new item or deselect an item. - this.hammer = new Hammer(this.body.dom.centerContainer); + if (!('majorCharHeight' in this.props)) { + var textMajor = document.createTextNode('0'); + var measureCharMajor = document.createElement('div'); + measureCharMajor.className = 'vis-y-axis vis-major vis-measure'; + measureCharMajor.appendChild(textMajor); + this.dom.frame.appendChild(measureCharMajor); - // drag items when selected - this.hammer.on('hammer.input', function (event) { - if (event.isFirst) { - this._onTouch(event); - } - }.bind(this)); - this.hammer.on('panstart', this._onDragStart.bind(this)); - this.hammer.on('panmove', this._onDrag.bind(this)); - this.hammer.on('panend', this._onDragEnd.bind(this)); - this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL }); + this.props.majorCharHeight = measureCharMajor.clientHeight; + this.props.majorCharWidth = measureCharMajor.clientWidth; - // single select (or unselect) when tapping an item - this.hammer.on('tap', this._onSelectItem.bind(this)); + this.dom.frame.removeChild(measureCharMajor); + } - // multi select when holding mouse/touch, or on ctrl+click - this.hammer.on('press', this._onMultiSelectItem.bind(this)); + if (!('titleCharHeight' in this.props)) { + var textTitle = document.createTextNode('0'); + var measureCharTitle = document.createElement('div'); + measureCharTitle.className = 'vis-y-axis vis-title vis-measure'; + measureCharTitle.appendChild(textTitle); + this.dom.frame.appendChild(measureCharTitle); - // add item on doubletap - this.hammer.on('doubletap', this._onAddItem.bind(this)); + this.props.titleCharHeight = measureCharTitle.clientHeight; + this.props.titleCharWidth = measureCharTitle.clientWidth; - if (this.options.rtl) { - this.groupHammer = new Hammer(this.body.dom.rightContainer); - } else { - this.groupHammer = new Hammer(this.body.dom.leftContainer); - } + this.dom.frame.removeChild(measureCharTitle); + } +}; - this.groupHammer.on('tap', this._onGroupClick.bind(this)); - this.groupHammer.on('panstart', this._onGroupDragStart.bind(this)); - this.groupHammer.on('panmove', this._onGroupDrag.bind(this)); - this.groupHammer.on('panend', this._onGroupDragEnd.bind(this)); - this.groupHammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_VERTICAL }); +module.exports = DataAxis; - this.body.dom.centerContainer.addEventListener('mouseover', this._onMouseOver.bind(this)); - this.body.dom.centerContainer.addEventListener('mouseout', this._onMouseOut.bind(this)); - this.body.dom.centerContainer.addEventListener('mousemove', this._onMouseMove.bind(this)); - // right-click on timeline - this.body.dom.centerContainer.addEventListener('contextmenu', this._onDragEnd.bind(this)); +/***/ }), +/* 108 */ +/***/ (function(module, exports, __webpack_require__) { - this.body.dom.centerContainer.addEventListener('mousewheel', this._onMouseWheel.bind(this)); +"use strict"; - // attach to the DOM - this.show(); - }; - /** - * Set options for the ItemSet. Existing options will be extended/overwritten. - * @param {Object} [options] The following options are available: - * {String} type - * Default type for the items. Choose from 'box' - * (default), 'point', 'range', or 'background'. - * The default style can be overwritten by - * individual items. - * {String} align - * Alignment for the items, only applicable for - * BoxItem. Choose 'center' (default), 'left', or - * 'right'. - * {String} orientation.item - * Orientation of the item set. Choose 'top' or - * 'bottom' (default). - * {Function} groupOrder - * A sorting function for ordering groups - * {Boolean} stack - * If true (default), items will be stacked on - * top of each other. - * {Number} margin.axis - * Margin between the axis and the items in pixels. - * Default is 20. - * {Number} margin.item.horizontal - * Horizontal margin between items in pixels. - * Default is 10. - * {Number} margin.item.vertical - * Vertical Margin between items in pixels. - * Default is 10. - * {Number} margin.item - * Margin between items in pixels in both horizontal - * and vertical direction. Default is 10. - * {Number} margin - * Set margin for both axis and items in pixels. - * {Boolean} selectable - * If true (default), items can be selected. - * {Boolean} multiselect - * If true, multiple items can be selected. - * False by default. - * {Boolean} editable - * Set all editable options to true or false - * {Boolean} editable.updateTime - * Allow dragging an item to an other moment in time - * {Boolean} editable.updateGroup - * Allow dragging an item to an other group - * {Boolean} editable.add - * Allow creating new items on double tap - * {Boolean} editable.remove - * Allow removing items by clicking the delete button - * top right of a selected item. - * {Function(item: Item, callback: Function)} onAdd - * Callback function triggered when an item is about to be added: - * when the user double taps an empty space in the Timeline. - * {Function(item: Item, callback: Function)} onUpdate - * Callback function fired when an item is about to be updated. - * This function typically has to show a dialog where the user - * change the item. If not implemented, nothing happens. - * {Function(item: Item, callback: Function)} onMove - * Fired when an item has been moved. If not implemented, - * the move action will be accepted. - * {Function(item: Item, callback: Function)} onRemove - * Fired when an item is about to be deleted. - * If not implemented, the item will be always removed. - */ - ItemSet.prototype.setOptions = function (options) { - if (options) { - // copy all options that we know - var fields = ['type', 'rtl', 'align', 'order', 'stack', 'stackSubgroups', 'selectable', 'multiselect', 'multiselectPerGroup', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'visibleFrameTemplate', 'hide', 'snap', 'groupOrderSwap', 'showTooltips', 'tooltip', 'tooltipOnItemUpdateTime']; - util.selectiveExtend(fields, this.options, options); - - if ('itemsAlwaysDraggable' in options) { - if (typeof options.itemsAlwaysDraggable === 'boolean') { - this.options.itemsAlwaysDraggable.item = options.itemsAlwaysDraggable; - this.options.itemsAlwaysDraggable.range = false; - } else if ((0, _typeof3['default'])(options.itemsAlwaysDraggable) === 'object') { - util.selectiveExtend(['item', 'range'], this.options.itemsAlwaysDraggable, options.itemsAlwaysDraggable); - // only allow range always draggable when item is always draggable as well - if (!this.options.itemsAlwaysDraggable.item) { - this.options.itemsAlwaysDraggable.range = false; - } - } +/** + * + * @param {number} start + * @param {number} end + * @param {boolean} autoScaleStart + * @param {boolean} autoScaleEnd + * @param {number} containerHeight + * @param {number} majorCharHeight + * @param {boolean} zeroAlign + * @param {function} formattingFunction + * @constructor DataScale + */ +function DataScale(start, end, autoScaleStart, autoScaleEnd, containerHeight, majorCharHeight) { + var zeroAlign = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; + var formattingFunction = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false; + + this.majorSteps = [1, 2, 5, 10]; + this.minorSteps = [0.25, 0.5, 1, 2]; + this.customLines = null; + + this.containerHeight = containerHeight; + this.majorCharHeight = majorCharHeight; + this._start = start; + this._end = end; + + this.scale = 1; + this.minorStepIdx = -1; + this.magnitudefactor = 1; + this.determineScale(); + + this.zeroAlign = zeroAlign; + this.autoScaleStart = autoScaleStart; + this.autoScaleEnd = autoScaleEnd; + + this.formattingFunction = formattingFunction; + + if (autoScaleStart || autoScaleEnd) { + var me = this; + var roundToMinor = function roundToMinor(value) { + var rounded = value - value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]); + if (value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]) > 0.5 * (me.magnitudefactor * me.minorSteps[me.minorStepIdx])) { + return rounded + me.magnitudefactor * me.minorSteps[me.minorStepIdx]; + } else { + return rounded; } + }; + if (autoScaleStart) { + this._start -= this.magnitudefactor * 2 * this.minorSteps[this.minorStepIdx]; + this._start = roundToMinor(this._start); + } - if ('orientation' in options) { - if (typeof options.orientation === 'string') { - this.options.orientation.item = options.orientation === 'top' ? 'top' : 'bottom'; - } else if ((0, _typeof3['default'])(options.orientation) === 'object' && 'item' in options.orientation) { - this.options.orientation.item = options.orientation.item; - } - } + if (autoScaleEnd) { + this._end += this.magnitudefactor * this.minorSteps[this.minorStepIdx]; + this._end = roundToMinor(this._end); + } + this.determineScale(); + } +} - if ('margin' in options) { - if (typeof options.margin === 'number') { - this.options.margin.axis = options.margin; - this.options.margin.item.horizontal = options.margin; - this.options.margin.item.vertical = options.margin; - } else if ((0, _typeof3['default'])(options.margin) === 'object') { - util.selectiveExtend(['axis'], this.options.margin, options.margin); - if ('item' in options.margin) { - if (typeof options.margin.item === 'number') { - this.options.margin.item.horizontal = options.margin.item; - this.options.margin.item.vertical = options.margin.item; - } else if ((0, _typeof3['default'])(options.margin.item) === 'object') { - util.selectiveExtend(['horizontal', 'vertical'], this.options.margin.item, options.margin.item); - } - } - } - } +DataScale.prototype.setCharHeight = function (majorCharHeight) { + this.majorCharHeight = majorCharHeight; +}; - if ('editable' in options) { - if (typeof options.editable === 'boolean') { - this.options.editable.updateTime = options.editable; - this.options.editable.updateGroup = options.editable; - this.options.editable.add = options.editable; - this.options.editable.remove = options.editable; - this.options.editable.overrideItems = false; - } else if ((0, _typeof3['default'])(options.editable) === 'object') { - util.selectiveExtend(['updateTime', 'updateGroup', 'add', 'remove', 'overrideItems'], this.options.editable, options.editable); - } - } +DataScale.prototype.setHeight = function (containerHeight) { + this.containerHeight = containerHeight; +}; - if ('groupEditable' in options) { - if (typeof options.groupEditable === 'boolean') { - this.options.groupEditable.order = options.groupEditable; - this.options.groupEditable.add = options.groupEditable; - this.options.groupEditable.remove = options.groupEditable; - } else if ((0, _typeof3['default'])(options.groupEditable) === 'object') { - util.selectiveExtend(['order', 'add', 'remove'], this.options.groupEditable, options.groupEditable); - } - } +DataScale.prototype.determineScale = function () { + var range = this._end - this._start; + this.scale = this.containerHeight / range; + var minimumStepValue = this.majorCharHeight / this.scale; + var orderOfMagnitude = range > 0 ? Math.round(Math.log(range) / Math.LN10) : 0; - // callback functions - var addCallback = function (name) { - var fn = options[name]; - if (fn) { - if (!(fn instanceof Function)) { - throw new Error('option ' + name + ' must be a function ' + name + '(item, callback)'); - } - this.options[name] = fn; - } - }.bind(this); - ['onAdd', 'onUpdate', 'onRemove', 'onMove', 'onMoving', 'onAddGroup', 'onMoveGroup', 'onRemoveGroup'].forEach(addCallback); + this.minorStepIdx = -1; + this.magnitudefactor = Math.pow(10, orderOfMagnitude); + + var start = 0; + if (orderOfMagnitude < 0) { + start = orderOfMagnitude; + } - // force the itemSet to refresh: options like orientation and margins may be changed - this.markDirty(); + var solutionFound = false; + for (var l = start; Math.abs(l) <= Math.abs(orderOfMagnitude); l++) { + this.magnitudefactor = Math.pow(10, l); + for (var j = 0; j < this.minorSteps.length; j++) { + var stepSize = this.magnitudefactor * this.minorSteps[j]; + if (stepSize >= minimumStepValue) { + solutionFound = true; + this.minorStepIdx = j; + break; + } } - }; + if (solutionFound === true) { + break; + } + } +}; - /** - * Mark the ItemSet dirty so it will refresh everything with next redraw. - * Optionally, all items can be marked as dirty and be refreshed. - * @param {{refreshItems: boolean}} [options] - */ - ItemSet.prototype.markDirty = function (options) { - this.groupIds = []; +DataScale.prototype.is_major = function (value) { + return value % (this.magnitudefactor * this.majorSteps[this.minorStepIdx]) === 0; +}; - if (options && options.refreshItems) { - util.forEach(this.items, function (item) { - item.dirty = true; - if (item.displayed) item.redraw(); - }); - } - }; +DataScale.prototype.getStep = function () { + return this.magnitudefactor * this.minorSteps[this.minorStepIdx]; +}; - /** - * Destroy the ItemSet - */ - ItemSet.prototype.destroy = function () { - this.hide(); - this.setItems(null); - this.setGroups(null); +DataScale.prototype.getFirstMajor = function () { + var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx]; + return this.convertValue(this._start + (majorStep - this._start % majorStep) % majorStep); +}; - this.hammer = null; +DataScale.prototype.formatValue = function (current) { + var returnValue = current.toPrecision(5); + if (typeof this.formattingFunction === 'function') { + returnValue = this.formattingFunction(current); + } - this.body = null; - this.conversion = null; - }; + if (typeof returnValue === 'number') { + return '' + returnValue; + } else if (typeof returnValue === 'string') { + return returnValue; + } else { + return current.toPrecision(5); + } +}; - /** - * Hide the component from the DOM - */ - ItemSet.prototype.hide = function () { - // remove the frame containing the items - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); +DataScale.prototype.getLines = function () { + var lines = []; + var step = this.getStep(); + var bottomOffset = (step - this._start % step) % step; + for (var i = this._start + bottomOffset; this._end - i > 0.00001; i += step) { + if (i != this._start) { + //Skip the bottom line + lines.push({ major: this.is_major(i), y: this.convertValue(i), val: this.formatValue(i) }); } + } + return lines; +}; - // remove the axis with dots - if (this.dom.axis.parentNode) { - this.dom.axis.parentNode.removeChild(this.dom.axis); - } +DataScale.prototype.followScale = function (other) { + var oldStepIdx = this.minorStepIdx; + var oldStart = this._start; + var oldEnd = this._end; - // remove the labelset containing all group labels - if (this.dom.labelSet.parentNode) { - this.dom.labelSet.parentNode.removeChild(this.dom.labelSet); - } + var me = this; + var increaseMagnitude = function increaseMagnitude() { + me.magnitudefactor *= 2; + }; + var decreaseMagnitude = function decreaseMagnitude() { + me.magnitudefactor /= 2; }; - /** - * Show the component in the DOM (when not already visible). - * @return {Boolean} changed - */ - ItemSet.prototype.show = function () { - // show frame containing the items - if (!this.dom.frame.parentNode) { - this.body.dom.center.appendChild(this.dom.frame); + if (other.minorStepIdx <= 1 && this.minorStepIdx <= 1 || other.minorStepIdx > 1 && this.minorStepIdx > 1) { + //easy, no need to change stepIdx nor multiplication factor + } else if (other.minorStepIdx < this.minorStepIdx) { + //I'm 5, they are 4 per major. + this.minorStepIdx = 1; + if (oldStepIdx == 2) { + increaseMagnitude(); + } else { + increaseMagnitude(); + increaseMagnitude(); } - - // show axis with dots - if (!this.dom.axis.parentNode) { - this.body.dom.backgroundVertical.appendChild(this.dom.axis); + } else { + //I'm 4, they are 5 per major + this.minorStepIdx = 2; + if (oldStepIdx == 1) { + decreaseMagnitude(); + } else { + decreaseMagnitude(); + decreaseMagnitude(); } + } - // show labelset containing labels - if (!this.dom.labelSet.parentNode) { - if (this.options.rtl) { - this.body.dom.right.appendChild(this.dom.labelSet); + //Get masters stats: + var otherZero = other.convertValue(0); + var otherStep = other.getStep() * other.scale; + + var done = false; + var count = 0; + //Loop until magnitude is correct for given constrains. + while (!done && count++ < 5) { + + //Get my stats: + this.scale = otherStep / (this.minorSteps[this.minorStepIdx] * this.magnitudefactor); + var newRange = this.containerHeight / this.scale; + + //For the case the magnitudefactor has changed: + this._start = oldStart; + this._end = this._start + newRange; + + var myOriginalZero = this._end * this.scale; + var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx]; + var majorOffset = this.getFirstMajor() - other.getFirstMajor(); + + if (this.zeroAlign) { + var zeroOffset = otherZero - myOriginalZero; + this._end += zeroOffset / this.scale; + this._start = this._end - newRange; + } else { + if (!this.autoScaleStart) { + this._start += majorStep - majorOffset / this.scale; + this._end = this._start + newRange; } else { - this.body.dom.left.appendChild(this.dom.labelSet); + this._start -= majorOffset / this.scale; + this._end = this._start + newRange; } } - }; + if (!this.autoScaleEnd && this._end > oldEnd + 0.00001) { + //Need to decrease magnitude to prevent scale overshoot! (end) + decreaseMagnitude(); + done = false; + continue; + } + if (!this.autoScaleStart && this._start < oldStart - 0.00001) { + if (this.zeroAlign && oldStart >= 0) { + console.warn("Can't adhere to given 'min' range, due to zeroalign"); + } else { + //Need to decrease magnitude to prevent scale overshoot! (start) + decreaseMagnitude(); + done = false; + continue; + } + } + if (this.autoScaleStart && this.autoScaleEnd && newRange < oldEnd - oldStart) { + increaseMagnitude(); + done = false; + continue; + } + done = true; + } +}; - /** - * Set selected items by their id. Replaces the current selection - * Unknown id's are silently ignored. - * @param {string[] | string} [ids] An array with zero or more id's of the items to be - * selected, or a single item id. If ids is undefined - * or an empty array, all items will be unselected. - */ - ItemSet.prototype.setSelection = function (ids) { - var i, ii, id, item; +DataScale.prototype.convertValue = function (value) { + return this.containerHeight - (value - this._start) * this.scale; +}; - if (ids == undefined) ids = []; - if (!Array.isArray(ids)) ids = [ids]; +DataScale.prototype.screenToValue = function (pixels) { + return (this.containerHeight - pixels) / this.scale + this._start; +}; - // unselect currently selected items - for (i = 0, ii = this.selection.length; i < ii; i++) { - id = this.selection[i]; - item = this.items[id]; - if (item) item.unselect(); - } +module.exports = DataScale; - // select items - this.selection = []; - for (i = 0, ii = ids.length; i < ii; i++) { - id = ids[i]; - item = this.items[id]; - if (item) { - this.selection.push(id); - item.select(); - } - } - }; +/***/ }), +/* 109 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Get the selected items by their id - * @return {Array} ids The ids of the selected items - */ - ItemSet.prototype.getSelection = function () { - return this.selection.concat([]); - }; +"use strict"; - /** - * Get the id's of the currently visible items. - * @returns {Array} The ids of the visible items - */ - ItemSet.prototype.getVisibleItems = function () { - var range = this.body.range.getRange(); - if (this.options.rtl) { - var right = this.body.util.toScreen(range.start); - var left = this.body.util.toScreen(range.end); - } else { - var left = this.body.util.toScreen(range.start); - var right = this.body.util.toScreen(range.end); - } +var _typeof2 = __webpack_require__(6); - var ids = []; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - var group = this.groups[groupId]; - var rawVisibleItems = group.isVisible ? group.visibleItems : []; - - // filter the "raw" set with visibleItems into a set which is really - // visible by pixels - for (var i = 0; i < rawVisibleItems.length; i++) { - var item = rawVisibleItems[i]; - // TODO: also check whether visible vertically - if (this.options.rtl) { - if (item.right < left && item.right + item.width > right) { - ids.push(item.id); - } - } else { - if (item.left < right && item.left + item.width > left) { - ids.push(item.id); - } - } - } - } - } +var _typeof3 = _interopRequireDefault(_typeof2); - return ids; - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Deselect a selected item - * @param {String | Number} id - * @private - */ - ItemSet.prototype._deselect = function (id) { - var selection = this.selection; - for (var i = 0, ii = selection.length; i < ii; i++) { - if (selection[i] == id) { - // non-strict comparison! - selection.splice(i, 1); - break; - } - } - }; +var util = __webpack_require__(2); +var Bars = __webpack_require__(110); +var Lines = __webpack_require__(111); +var Points = __webpack_require__(72); - /** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ - ItemSet.prototype.redraw = function () { - var margin = this.options.margin, - range = this.body.range, - asSize = util.option.asSize, - options = this.options, - orientation = options.orientation.item, - resized = false, - frame = this.dom.frame; - - // recalculate absolute position (before redrawing groups) - this.props.top = this.body.domProps.top.height + this.body.domProps.border.top; +/** + * /** + * @param {object} group | the object of the group from the dataset + * @param {string} groupId | ID of the group + * @param {object} options | the default options + * @param {array} groupsUsingDefaultStyles | this array has one entree. + * It is passed as an array so it is passed by reference. + * It enumerates through the default styles + * @constructor GraphGroup + */ +function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { + this.id = groupId; + var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex', 'excludeFromStacking', 'excludeFromLegend']; + this.options = util.selectiveBridgeObject(fields, options); + this.usingDefaultStyle = group.className === undefined; + this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; + this.zeroPosition = 0; + this.update(group); + if (this.usingDefaultStyle == true) { + this.groupsUsingDefaultStyles[0] += 1; + } + this.itemsData = []; + this.visible = group.visible === undefined ? true : group.visible; +} - if (this.options.rtl) { - this.props.right = this.body.domProps.right.width + this.body.domProps.border.right; - } else { - this.props.left = this.body.domProps.left.width + this.body.domProps.border.left; - } - - // update class name - frame.className = 'vis-itemset'; - - // reorder the groups (if needed) - resized = this._orderGroups() || resized; - - // check whether zoomed (in that case we need to re-stack everything) - // TODO: would be nicer to get this as a trigger from Range - var visibleInterval = range.end - range.start; - var zoomed = visibleInterval != this.lastVisibleInterval || this.props.width != this.props.lastWidth; - var scrolled = range.start != this.lastRangeStart; - var changedStackOption = options.stack != this.lastStack; - var changedStackSubgroupsOption = options.stackSubgroups != this.lastStackSubgroups; - var forceRestack = zoomed || scrolled || changedStackOption || changedStackSubgroupsOption; - this.lastVisibleInterval = visibleInterval; - this.lastRangeStart = range.start; - this.lastStack = options.stack; - this.lastStackSubgroups = options.stackSubgroups; - - this.props.lastWidth = this.props.width; - - var firstGroup = this._firstGroup(); - var firstMargin = { - item: margin.item, - axis: margin.axis - }; - var nonFirstMargin = { - item: margin.item, - axis: margin.item.vertical / 2 - }; - var height = 0; - var minHeight = margin.axis + margin.item.vertical; +/** + * this loads a reference to all items in this group into this group. + * @param {array} items + */ +GraphGroup.prototype.setItems = function (items) { + if (items != null) { + this.itemsData = items; + if (this.options.sort == true) { + util.insertSort(this.itemsData, function (a, b) { + return a.x > b.x ? 1 : -1; + }); + } + } else { + this.itemsData = []; + } +}; - // redraw the background group - this.groups[BACKGROUND].redraw(range, nonFirstMargin, forceRestack); +GraphGroup.prototype.getItems = function () { + return this.itemsData; +}; - // redraw all regular groups - util.forEach(this.groups, function (group) { - var groupMargin = group == firstGroup ? firstMargin : nonFirstMargin; - var groupResized = group.redraw(range, groupMargin, forceRestack); - resized = groupResized || resized; - height += group.height; - }); - height = Math.max(height, minHeight); +/** + * this is used for barcharts and shading, this way, we only have to calculate it once. + * @param {number} pos + */ +GraphGroup.prototype.setZeroPosition = function (pos) { + this.zeroPosition = pos; +}; + +/** + * set the options of the graph group over the default options. + * @param {Object} options + */ +GraphGroup.prototype.setOptions = function (options) { + if (options !== undefined) { + var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex', 'excludeFromStacking', 'excludeFromLegend']; + util.selectiveDeepExtend(fields, this.options, options); - // update frame height - frame.style.height = asSize(height); + // if the group's drawPoints is a function delegate the callback to the onRender property + if (typeof options.drawPoints == 'function') { + options.drawPoints = { + onRender: options.drawPoints + }; + } - // calculate actual size - this.props.width = frame.offsetWidth; - this.props.height = height; + util.mergeOptions(this.options, options, 'interpolation'); + util.mergeOptions(this.options, options, 'drawPoints'); + util.mergeOptions(this.options, options, 'shaded'); - // reposition axis - this.dom.axis.style.top = asSize(orientation == 'top' ? this.body.domProps.top.height + this.body.domProps.border.top : this.body.domProps.top.height + this.body.domProps.centerContainer.height); - if (this.options.rtl) { - this.dom.axis.style.right = '0'; - } else { - this.dom.axis.style.left = '0'; + if (options.interpolation) { + if ((0, _typeof3['default'])(options.interpolation) == 'object') { + if (options.interpolation.parametrization) { + if (options.interpolation.parametrization == 'uniform') { + this.options.interpolation.alpha = 0; + } else if (options.interpolation.parametrization == 'chordal') { + this.options.interpolation.alpha = 1.0; + } else { + this.options.interpolation.parametrization = 'centripetal'; + this.options.interpolation.alpha = 0.5; + } + } + } } + } +}; - this.initialItemSetDrawn = true; - // check if this component is resized - resized = this._isResized() || resized; +/** + * this updates the current group class with the latest group dataset entree, used in _updateGroup in linegraph + * @param {vis.Group} group + */ +GraphGroup.prototype.update = function (group) { + this.group = group; + this.content = group.content || 'graph'; + this.className = group.className || this.className || 'vis-graph-group' + this.groupsUsingDefaultStyles[0] % 10; + this.visible = group.visible === undefined ? true : group.visible; + this.style = group.style; + this.setOptions(group.options); +}; - return resized; - }; +/** + * return the legend entree for this group. + * + * @param {number} iconWidth + * @param {number} iconHeight + * @param {{svg: (*|Element), svgElements: Object, options: Object, groups: Array.}} framework + * @param {number} x + * @param {number} y + * @returns {{icon: (*|Element), label: (*|string), orientation: *}} + */ +GraphGroup.prototype.getLegend = function (iconWidth, iconHeight, framework, x, y) { + if (framework == undefined || framework == null) { + var svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + framework = { svg: svg, svgElements: {}, options: this.options, groups: [this] }; + } + if (x == undefined || x == null) { + x = 0; + } + if (y == undefined || y == null) { + y = 0.5 * iconHeight; + } + switch (this.options.style) { + case "line": + Lines.drawIcon(this, x, y, iconWidth, iconHeight, framework); + break; + case "points": //explicit no break + case "point": + Points.drawIcon(this, x, y, iconWidth, iconHeight, framework); + break; + case "bar": + Bars.drawIcon(this, x, y, iconWidth, iconHeight, framework); + break; + } + return { icon: framework.svg, label: this.content, orientation: this.options.yAxisOrientation }; +}; + +GraphGroup.prototype.getYRange = function (groupData) { + var yMin = groupData[0].y; + var yMax = groupData[0].y; + for (var j = 0; j < groupData.length; j++) { + yMin = yMin > groupData[j].y ? groupData[j].y : yMin; + yMax = yMax < groupData[j].y ? groupData[j].y : yMax; + } + return { min: yMin, max: yMax, yAxisOrientation: this.options.yAxisOrientation }; +}; + +module.exports = GraphGroup; - /** - * Get the first group, aligned with the axis - * @return {Group | null} firstGroup - * @private - */ - ItemSet.prototype._firstGroup = function () { - var firstGroupIndex = this.options.orientation.item == 'top' ? 0 : this.groupIds.length - 1; - var firstGroupId = this.groupIds[firstGroupIndex]; - var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED]; +/***/ }), +/* 110 */ +/***/ (function(module, exports, __webpack_require__) { - return firstGroup || null; - }; +"use strict"; - /** - * Create or delete the group holding all ungrouped items. This group is used when - * there are no groups specified. - * @protected - */ - ItemSet.prototype._updateUngrouped = function () { - var ungrouped = this.groups[UNGROUPED]; - var background = this.groups[BACKGROUND]; - var item, itemId; - if (this.groupsData) { - // remove the group holding all ungrouped items - if (ungrouped) { - ungrouped.hide(); - delete this.groups[UNGROUPED]; +var DOMutil = __webpack_require__(14); +var Points = __webpack_require__(72); - for (itemId in this.items) { - if (this.items.hasOwnProperty(itemId)) { - item = this.items[itemId]; - item.parent && item.parent.remove(item); - var groupId = this._getGroupId(item.data); - var group = this.groups[groupId]; - group && group.add(item) || item.hide(); - } +/** + * + * @param {vis.GraphGroup.id} groupId + * @param {Object} options // TODO: Describe options + * @constructor Bargraph + */ +function Bargraph(groupId, options) {// eslint-disable-line no-unused-vars +} + +Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { + var fillHeight = iconHeight * 0.5; + var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); + + var barWidth = Math.round(0.3 * iconWidth); + var originalWidth = group.options.barChart.width; + var scale = originalWidth / barWidth; + var bar1Height = Math.round(0.4 * iconHeight); + var bar2Height = Math.round(0.75 * iconHeight); + + var offset = Math.round((iconWidth - 2 * barWidth) / 3); + + DOMutil.drawBar(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, barWidth, bar1Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + DOMutil.drawBar(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); + + if (group.options.drawPoints.enabled == true) { + var groupTemplate = { + style: group.options.drawPoints.style, + styles: group.options.drawPoints.styles, + size: group.options.drawPoints.size / scale, + className: group.className + }; + DOMutil.drawPoint(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, groupTemplate, framework.svgElements, framework.svg); + DOMutil.drawPoint(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, groupTemplate, framework.svgElements, framework.svg); + } +}; + +/** + * draw a bar graph + * + * @param {Array.} groupIds + * @param {Object} processedGroupData + * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework + */ +Bargraph.draw = function (groupIds, processedGroupData, framework) { + var combinedData = []; + var intersections = {}; + var coreDistance; + var key, drawData; + var group; + var i, j; + var barPoints = 0; + + // combine all barchart data + for (i = 0; i < groupIds.length; i++) { + group = framework.groups[groupIds[i]]; + if (group.options.style === 'bar') { + if (group.visible === true && (framework.options.groups.visibility[groupIds[i]] === undefined || framework.options.groups.visibility[groupIds[i]] === true)) { + for (j = 0; j < processedGroupData[groupIds[i]].length; j++) { + combinedData.push({ + screen_x: processedGroupData[groupIds[i]][j].screen_x, + screen_end: processedGroupData[groupIds[i]][j].screen_end, + screen_y: processedGroupData[groupIds[i]][j].screen_y, + x: processedGroupData[groupIds[i]][j].x, + end: processedGroupData[groupIds[i]][j].end, + y: processedGroupData[groupIds[i]][j].y, + groupId: groupIds[i], + label: processedGroupData[groupIds[i]][j].label + }); + barPoints += 1; } } + } + } + + if (barPoints === 0) { + return; + } + + // sort by time and by group + combinedData.sort(function (a, b) { + if (a.screen_x === b.screen_x) { + return a.groupId < b.groupId ? -1 : 1; + } else { + return a.screen_x - b.screen_x; + } + }); + + // get intersections + Bargraph._getDataIntersections(intersections, combinedData); + + // plot barchart + for (i = 0; i < combinedData.length; i++) { + group = framework.groups[combinedData[i].groupId]; + var minWidth = group.options.barChart.minWidth != undefined ? group.options.barChart.minWidth : 0.1 * group.options.barChart.width; + + key = combinedData[i].screen_x; + var heightOffset = 0; + if (intersections[key] === undefined) { + if (i + 1 < combinedData.length) { + coreDistance = Math.abs(combinedData[i + 1].screen_x - key); + } + drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); } else { - // create a group holding all (unfiltered) items - if (!ungrouped) { - var id = null; - var data = null; - ungrouped = new Group(id, data, this); - this.groups[UNGROUPED] = ungrouped; + var nextKey = i + (intersections[key].amount - intersections[key].resolved); + if (nextKey < combinedData.length) { + coreDistance = Math.abs(combinedData[nextKey].screen_x - key); + } + drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); + intersections[key].resolved += 1; - for (itemId in this.items) { - if (this.items.hasOwnProperty(itemId)) { - item = this.items[itemId]; - ungrouped.add(item); - } + if (group.options.stack === true && group.options.excludeFromStacking !== true) { + if (combinedData[i].screen_y < group.zeroPosition) { + heightOffset = intersections[key].accumulatedNegative; + intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y; + } else { + heightOffset = intersections[key].accumulatedPositive; + intersections[key].accumulatedPositive += group.zeroPosition - combinedData[i].screen_y; } - - ungrouped.show(); + } else if (group.options.barChart.sideBySide === true) { + drawData.width = drawData.width / intersections[key].amount; + drawData.offset += intersections[key].resolved * drawData.width - 0.5 * drawData.width * (intersections[key].amount + 1); } } - }; - /** - * Get the element for the labelset - * @return {HTMLElement} labelSet - */ - ItemSet.prototype.getLabelSet = function () { - return this.dom.labelSet; - }; + var dataWidth = drawData.width; + var start = combinedData[i].screen_x; - /** - * Set items - * @param {vis.DataSet | null} items - */ - ItemSet.prototype.setItems = function (items) { - var me = this, - ids, - oldItemsData = this.itemsData; - - // replace the dataset - if (!items) { - this.itemsData = null; - } else if (items instanceof DataSet || items instanceof DataView) { - this.itemsData = items; + // are we drawing explicit boxes? (we supplied an end value) + if (combinedData[i].screen_end != undefined) { + dataWidth = combinedData[i].screen_end - combinedData[i].screen_x; + start += dataWidth * 0.5; } else { - throw new TypeError('Data must be an instance of DataSet or DataView'); + start += drawData.offset; } - if (oldItemsData) { - // unsubscribe from old dataset - util.forEach(this.itemListeners, function (callback, event) { - oldItemsData.off(event, callback); - }); + DOMutil.drawBar(start, combinedData[i].screen_y - heightOffset, dataWidth, group.zeroPosition - combinedData[i].screen_y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); - // remove all drawn items - ids = oldItemsData.getIds(); - this._onRemove(ids); + // draw points + if (group.options.drawPoints.enabled === true) { + var pointData = { + screen_x: combinedData[i].screen_x, + screen_y: combinedData[i].screen_y - heightOffset, + x: combinedData[i].x, + y: combinedData[i].y, + groupId: combinedData[i].groupId, + label: combinedData[i].label + }; + Points.draw([pointData], group, framework, drawData.offset); + //DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg); } + } +}; - if (this.itemsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.itemListeners, function (callback, event) { - me.itemsData.on(event, callback, id); - }); - - // add all new items - ids = this.itemsData.getIds(); - this._onAdd(ids); +/** + * Fill the intersections object with counters of how many datapoints share the same x coordinates + * @param {Object} intersections + * @param {Array.} combinedData + * @private + */ +Bargraph._getDataIntersections = function (intersections, combinedData) { + // get intersections + var coreDistance; + for (var i = 0; i < combinedData.length; i++) { + if (i + 1 < combinedData.length) { + coreDistance = Math.abs(combinedData[i + 1].screen_x - combinedData[i].screen_x); + } + if (i > 0) { + coreDistance = Math.min(coreDistance, Math.abs(combinedData[i - 1].screen_x - combinedData[i].screen_x)); + } + if (coreDistance === 0) { + if (intersections[combinedData[i].screen_x] === undefined) { + intersections[combinedData[i].screen_x] = { + amount: 0, + resolved: 0, + accumulatedPositive: 0, + accumulatedNegative: 0 + }; + } + intersections[combinedData[i].screen_x].amount += 1; + } + } +}; - // update the group holding all ungrouped items - this._updateUngrouped(); +/** + * Get the width and offset for bargraphs based on the coredistance between datapoints + * + * @param {number} coreDistance + * @param {vis.Group} group + * @param {number} minWidth + * @returns {{width: number, offset: number}} + * @private + */ +Bargraph._getSafeDrawData = function (coreDistance, group, minWidth) { + var width, offset; + if (coreDistance < group.options.barChart.width && coreDistance > 0) { + width = coreDistance < minWidth ? minWidth : coreDistance; + + offset = 0; // recalculate offset with the new width; + if (group.options.barChart.align === 'left') { + offset -= 0.5 * coreDistance; + } else if (group.options.barChart.align === 'right') { + offset += 0.5 * coreDistance; } + } else { + // default settings + width = group.options.barChart.width; + offset = 0; + if (group.options.barChart.align === 'left') { + offset -= 0.5 * group.options.barChart.width; + } else if (group.options.barChart.align === 'right') { + offset += 0.5 * group.options.barChart.width; + } + } - this.body.emitter.emit('_change', { queue: true }); - }; + return { width: width, offset: offset }; +}; - /** - * Get the current items - * @returns {vis.DataSet | null} - */ - ItemSet.prototype.getItems = function () { - return this.itemsData; - }; +Bargraph.getStackedYRange = function (combinedData, groupRanges, groupIds, groupLabel, orientation) { + if (combinedData.length > 0) { + // sort by time and by group + combinedData.sort(function (a, b) { + if (a.screen_x === b.screen_x) { + return a.groupId < b.groupId ? -1 : 1; + } else { + return a.screen_x - b.screen_x; + } + }); + var intersections = {}; - /** - * Set groups - * @param {vis.DataSet} groups - */ - ItemSet.prototype.setGroups = function (groups) { - var me = this, - ids; + Bargraph._getDataIntersections(intersections, combinedData); + groupRanges[groupLabel] = Bargraph._getStackedYRange(intersections, combinedData); + groupRanges[groupLabel].yAxisOrientation = orientation; + groupIds.push(groupLabel); + } +}; + +Bargraph._getStackedYRange = function (intersections, combinedData) { + var key; + var yMin = combinedData[0].screen_y; + var yMax = combinedData[0].screen_y; + for (var i = 0; i < combinedData.length; i++) { + key = combinedData[i].screen_x; + if (intersections[key] === undefined) { + yMin = yMin > combinedData[i].screen_y ? combinedData[i].screen_y : yMin; + yMax = yMax < combinedData[i].screen_y ? combinedData[i].screen_y : yMax; + } else { + if (combinedData[i].screen_y < 0) { + intersections[key].accumulatedNegative += combinedData[i].screen_y; + } else { + intersections[key].accumulatedPositive += combinedData[i].screen_y; + } + } + } + for (var xpos in intersections) { + if (intersections.hasOwnProperty(xpos)) { + yMin = yMin > intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMin; + yMin = yMin > intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMin; + yMax = yMax < intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMax; + yMax = yMax < intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMax; + } + } - // unsubscribe from current dataset - if (this.groupsData) { - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.off(event, callback); - }); + return { min: yMin, max: yMax }; +}; - // remove all drawn groups - ids = this.groupsData.getIds(); - this.groupsData = null; - this._onRemoveGroups(ids); // note: this will cause a redraw - } +module.exports = Bargraph; - // replace the dataset - if (!groups) { - this.groupsData = null; - } else if (groups instanceof DataSet || groups instanceof DataView) { - this.groupsData = groups; - } else { - throw new TypeError('Data must be an instance of DataSet or DataView'); - } +/***/ }), +/* 111 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.groupsData) { - // go over all groups nesting - var groupsData = this.groupsData; - if (this.groupsData instanceof DataView) { - groupsData = this.groupsData.getDataSet(); - } +"use strict"; - groupsData.get().forEach(function (group) { - if (group.nestedGroups) { - group.nestedGroups.forEach(function (nestedGroupId) { - var updatedNestedGroup = groupsData.get(nestedGroupId); - updatedNestedGroup.nestedInGroup = group.id; - if (group.showNested == false) { - updatedNestedGroup.visible = false; - } - groupsData.update(updatedNestedGroup); - }); - } - }); - // subscribe to new dataset - var id = this.id; - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.on(event, callback, id); - }); +var DOMutil = __webpack_require__(14); - // draw all ms - ids = this.groupsData.getIds(); - this._onAddGroups(ids); +/** + * + * @param {vis.GraphGroup.id} groupId + * @param {Object} options // TODO: Describe options + * @constructor Line + */ +function Line(groupId, options) {// eslint-disable-line no-unused-vars +} + +Line.calcPath = function (dataset, group) { + if (dataset != null) { + if (dataset.length > 0) { + var d = []; + + // construct path from dataset + if (group.options.interpolation.enabled == true) { + d = Line._catmullRom(dataset, group); + } else { + d = Line._linear(dataset); + } + return d; + } } +}; - // update the group holding all ungrouped items - this._updateUngrouped(); +Line.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { + var fillHeight = iconHeight * 0.5; + var path, fillPath; - // update the order of all items in each group - this._order(); + var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); - this.body.emitter.emit('_change', { queue: true }); - }; + path = DOMutil.getSVGElement("path", framework.svgElements, framework.svg); + path.setAttributeNS(null, "class", group.className); + if (group.style !== undefined) { + path.setAttributeNS(null, "style", group.style); + } - /** - * Get the current groups - * @returns {vis.DataSet | null} groups - */ - ItemSet.prototype.getGroups = function () { - return this.groupsData; - }; + path.setAttributeNS(null, "d", "M" + x + "," + y + " L" + (x + iconWidth) + "," + y + ""); + if (group.options.shaded.enabled == true) { + fillPath = DOMutil.getSVGElement("path", framework.svgElements, framework.svg); + if (group.options.shaded.orientation == 'top') { + fillPath.setAttributeNS(null, "d", "M" + x + ", " + (y - fillHeight) + "L" + x + "," + y + " L" + (x + iconWidth) + "," + y + " L" + (x + iconWidth) + "," + (y - fillHeight)); + } else { + fillPath.setAttributeNS(null, "d", "M" + x + "," + y + " " + "L" + x + "," + (y + fillHeight) + " " + "L" + (x + iconWidth) + "," + (y + fillHeight) + "L" + (x + iconWidth) + "," + y); + } + fillPath.setAttributeNS(null, "class", group.className + " vis-icon-fill"); + if (group.options.shaded.style !== undefined && group.options.shaded.style !== "") { + fillPath.setAttributeNS(null, "style", group.options.shaded.style); + } + } - /** - * Remove an item by its id - * @param {String | Number} id - */ - ItemSet.prototype.removeItem = function (id) { - var item = this.itemsData.get(id), - dataset = this.itemsData.getDataSet(), - itemObj = this.items[id]; + if (group.options.drawPoints.enabled == true) { + var groupTemplate = { + style: group.options.drawPoints.style, + styles: group.options.drawPoints.styles, + size: group.options.drawPoints.size, + className: group.className + }; + DOMutil.drawPoint(x + 0.5 * iconWidth, y, groupTemplate, framework.svgElements, framework.svg); + } +}; + +Line.drawShading = function (pathArray, group, subPathArray, framework) { + // append shading to the path + if (group.options.shaded.enabled == true) { + var svgHeight = Number(framework.svg.style.height.replace('px', '')); + var fillPath = DOMutil.getSVGElement('path', framework.svgElements, framework.svg); + var type = "L"; + if (group.options.interpolation.enabled == true) { + type = "C"; + } + var dFill; + var zero = 0; + if (group.options.shaded.orientation == 'top') { + zero = 0; + } else if (group.options.shaded.orientation == 'bottom') { + zero = svgHeight; + } else { + zero = Math.min(Math.max(0, group.zeroPosition), svgHeight); + } + if (group.options.shaded.orientation == 'group' && subPathArray != null && subPathArray != undefined) { + dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' L' + subPathArray[subPathArray.length - 1][0] + "," + subPathArray[subPathArray.length - 1][1] + " " + this.serializePath(subPathArray, type, true) + subPathArray[0][0] + "," + subPathArray[0][1] + " Z"; + } else { + dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' V' + zero + ' H' + pathArray[0][0] + " Z"; + } - if (item) { - // confirm deletion - this.options.onRemove(item, function (item) { - if (item) { - // remove by id here, it is possible that an item has no id defined - // itself, so better not delete by the item itself - dataset.remove(id); + fillPath.setAttributeNS(null, 'class', group.className + ' vis-fill'); + if (group.options.shaded.style !== undefined) { + fillPath.setAttributeNS(null, 'style', group.options.shaded.style); } - }); + fillPath.setAttributeNS(null, 'd', dFill); } - }; +}; - /** - * Get the time of an item based on it's data and options.type - * @param {Object} itemData - * @returns {string} Returns the type - * @private - */ - ItemSet.prototype._getType = function (itemData) { - return itemData.type || this.options.type || (itemData.end ? 'range' : 'box'); - }; +/** + * draw a line graph + * + * @param {Array.} pathArray + * @param {vis.Group} group + * @param {{svg: Object, svgElements: Array., options: Object, groups: Array.}} framework + */ +Line.draw = function (pathArray, group, framework) { + if (pathArray != null && pathArray != undefined) { + var path = DOMutil.getSVGElement('path', framework.svgElements, framework.svg); + path.setAttributeNS(null, "class", group.className); + if (group.style !== undefined) { + path.setAttributeNS(null, "style", group.style); + } - /** - * Get the group id for an item - * @param {Object} itemData - * @returns {string} Returns the groupId - * @private - */ - ItemSet.prototype._getGroupId = function (itemData) { - var type = this._getType(itemData); - if (type == 'background' && itemData.group == undefined) { - return BACKGROUND; + var type = "L"; + if (group.options.interpolation.enabled == true) { + type = "C"; + } + // copy properties to path for drawing. + path.setAttributeNS(null, 'd', 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false)); + } +}; + +Line.serializePath = function (pathArray, type, inverse) { + if (pathArray.length < 2) { + //Too little data to create a path. + return ""; + } + var d = type; + var i; + if (inverse) { + for (i = pathArray.length - 2; i > 0; i--) { + d += pathArray[i][0] + "," + pathArray[i][1] + " "; + } } else { - return this.groupsData ? itemData.group : UNGROUPED; + for (i = 1; i < pathArray.length; i++) { + d += pathArray[i][0] + "," + pathArray[i][1] + " "; + } } - }; + return d; +}; - /** - * Handle updated items - * @param {Number[]} ids - * @protected - */ - ItemSet.prototype._onUpdate = function (ids) { - var me = this; +/** + * This uses an uniform parametrization of the interpolation algorithm: + * 'On the Parameterization of Catmull-Rom Curves' by Cem Yuksel et al. + * @param {Array.} data + * @returns {string} + * @private + */ +Line._catmullRomUniform = function (data) { + // catmull rom + var p0, p1, p2, p3, bp1, bp2; + var d = []; + d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]); + var normalization = 1 / 6; + var length = data.length; + for (var i = 0; i < length - 1; i++) { + + p0 = i == 0 ? data[0] : data[i - 1]; + p1 = data[i]; + p2 = data[i + 1]; + p3 = i + 2 < length ? data[i + 2] : p2; + + // Catmull-Rom to Cubic Bezier conversion matrix + // 0 1 0 0 + // -1/6 1 1/6 0 + // 0 1/6 1 -1/6 + // 0 0 1 0 + + // bp0 = { x: p1.x, y: p1.y }; + bp1 = { + screen_x: (-p0.screen_x + 6 * p1.screen_x + p2.screen_x) * normalization, + screen_y: (-p0.screen_y + 6 * p1.screen_y + p2.screen_y) * normalization + }; + bp2 = { + screen_x: (p1.screen_x + 6 * p2.screen_x - p3.screen_x) * normalization, + screen_y: (p1.screen_y + 6 * p2.screen_y - p3.screen_y) * normalization + }; + // bp0 = { x: p2.x, y: p2.y }; - ids.forEach(function (id) { - var itemData = me.itemsData.get(id, me.itemOptions); - var item = me.items[id]; - var type = itemData ? me._getType(itemData) : null; + d.push([bp1.screen_x, bp1.screen_y]); + d.push([bp2.screen_x, bp2.screen_y]); + d.push([p2.screen_x, p2.screen_y]); + } - var constructor = ItemSet.types[type]; - var selected; + return d; +}; - if (item) { - // update item - if (!constructor || !(item instanceof constructor)) { - // item type has changed, delete the item and recreate it - selected = item.selected; // preserve selection of this item - me._removeItem(item); - item = null; - } else { - me._updateItem(item, itemData); - } - } +/** + * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm. + * By default, the centripetal parameterization is used because this gives the nicest results. + * These parameterizations are relatively heavy because the distance between 4 points have to be calculated. + * + * One optimization can be used to reuse distances since this is a sliding window approach. + * @param {Array.} data + * @param {vis.GraphGroup} group + * @returns {string} + * @private + */ +Line._catmullRom = function (data, group) { + var alpha = group.options.interpolation.alpha; + if (alpha == 0 || alpha === undefined) { + return this._catmullRomUniform(data); + } else { + var p0, p1, p2, p3, bp1, bp2, d1, d2, d3, A, B, N, M; + var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA; + var d = []; + d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]); + var length = data.length; + for (var i = 0; i < length - 1; i++) { + + p0 = i == 0 ? data[0] : data[i - 1]; + p1 = data[i]; + p2 = data[i + 1]; + p3 = i + 2 < length ? data[i + 2] : p2; + + d1 = Math.sqrt(Math.pow(p0.screen_x - p1.screen_x, 2) + Math.pow(p0.screen_y - p1.screen_y, 2)); + d2 = Math.sqrt(Math.pow(p1.screen_x - p2.screen_x, 2) + Math.pow(p1.screen_y - p2.screen_y, 2)); + d3 = Math.sqrt(Math.pow(p2.screen_x - p3.screen_x, 2) + Math.pow(p2.screen_y - p3.screen_y, 2)); + + // Catmull-Rom to Cubic Bezier conversion matrix + + // A = 2d1^2a + 3d1^a * d2^a + d3^2a + // B = 2d3^2a + 3d3^a * d2^a + d2^2a + + // [ 0 1 0 0 ] + // [ -d2^2a /N A/N d1^2a /N 0 ] + // [ 0 d3^2a /M B/M -d2^2a /M ] + // [ 0 0 1 0 ] + + d3powA = Math.pow(d3, alpha); + d3pow2A = Math.pow(d3, 2 * alpha); + d2powA = Math.pow(d2, alpha); + d2pow2A = Math.pow(d2, 2 * alpha); + d1powA = Math.pow(d1, alpha); + d1pow2A = Math.pow(d1, 2 * alpha); + + A = 2 * d1pow2A + 3 * d1powA * d2powA + d2pow2A; + B = 2 * d3pow2A + 3 * d3powA * d2powA + d2pow2A; + N = 3 * d1powA * (d1powA + d2powA); + if (N > 0) { + N = 1 / N; + } + M = 3 * d3powA * (d3powA + d2powA); + if (M > 0) { + M = 1 / M; + } + + bp1 = { + screen_x: (-d2pow2A * p0.screen_x + A * p1.screen_x + d1pow2A * p2.screen_x) * N, + screen_y: (-d2pow2A * p0.screen_y + A * p1.screen_y + d1pow2A * p2.screen_y) * N + }; - if (!item && itemData) { - // create item - if (constructor) { - item = new constructor(itemData, me.conversion, me.options); - item.id = id; // TODO: not so nice setting id afterwards + bp2 = { + screen_x: (d3pow2A * p1.screen_x + B * p2.screen_x - d2pow2A * p3.screen_x) * M, + screen_y: (d3pow2A * p1.screen_y + B * p2.screen_y - d2pow2A * p3.screen_y) * M + }; - me._addItem(item); - if (selected) { - this.selection.push(id); - item.select(); - } - } else if (type == 'rangeoverflow') { - // TODO: deprecated since version 2.1.0 (or 3.0.0?). cleanup some day - throw new TypeError('Item type "rangeoverflow" is deprecated. Use css styling instead: ' + '.vis-item.vis-range .vis-item-content {overflow: visible;}'); - } else { - throw new TypeError('Unknown item type "' + type + '"'); + if (bp1.screen_x == 0 && bp1.screen_y == 0) { + bp1 = p1; + } + if (bp2.screen_x == 0 && bp2.screen_y == 0) { + bp2 = p2; + } + d.push([bp1.screen_x, bp1.screen_y]); + d.push([bp2.screen_x, bp2.screen_y]); + d.push([p2.screen_x, p2.screen_y]); } - } - }.bind(this)); - - this._order(); - this.body.emitter.emit('_change', { queue: true }); - }; - - /** - * Handle added items - * @param {Number[]} ids - * @protected - */ - ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate; - /** - * Handle removed items - * @param {Number[]} ids - * @protected - */ - ItemSet.prototype._onRemove = function (ids) { - var count = 0; - var me = this; - ids.forEach(function (id) { - var item = me.items[id]; - if (item) { - count++; - me._removeItem(item); - } - }); + return d; + } +}; - if (count) { - // update order - this._order(); - this.body.emitter.emit('_change', { queue: true }); +/** + * this generates the SVG path for a linear drawing between datapoints. + * @param {Array.} data + * @returns {string} + * @private + */ +Line._linear = function (data) { + // linear + var d = []; + for (var i = 0; i < data.length; i++) { + d.push([data[i].screen_x, data[i].screen_y]); } - }; + return d; +}; - /** - * Update the order of item in all groups - * @private - */ - ItemSet.prototype._order = function () { - // reorder the items in all groups - // TODO: optimization: only reorder groups affected by the changed items - util.forEach(this.groups, function (group) { - group.order(); - }); - }; +module.exports = Line; - /** - * Handle updated groups - * @param {Number[]} ids - * @private - */ - ItemSet.prototype._onUpdateGroups = function (ids) { - this._onAddGroups(ids); - }; +/***/ }), +/* 112 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Handle changed groups (added or updated) - * @param {Number[]} ids - * @private - */ - ItemSet.prototype._onAddGroups = function (ids) { - var me = this; +"use strict"; - ids.forEach(function (id) { - var groupData = me.groupsData.get(id); - var group = me.groups[id]; - if (!group) { - // check for reserved ids - if (id == UNGROUPED || id == BACKGROUND) { - throw new Error('Illegal group id. ' + id + ' is a reserved id.'); - } +var _keys = __webpack_require__(8); - var groupOptions = (0, _create2['default'])(me.options); - util.extend(groupOptions, { - height: null - }); +var _keys2 = _interopRequireDefault(_keys); - group = new Group(id, groupData, me); - me.groups[id] = group; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // add items with this groupId to the new group - for (var itemId in me.items) { - if (me.items.hasOwnProperty(itemId)) { - var item = me.items[itemId]; - if (item.data.group == id) { - group.add(item); - } - } - } +var util = __webpack_require__(2); +var DOMutil = __webpack_require__(14); +var Component = __webpack_require__(16); - group.order(); - group.show(); - } else { - // update group - group.setData(groupData); - } - }); - - this.body.emitter.emit('_change', { queue: true }); +/** + * Legend for Graph2d + * + * @param {vis.Graph2d.body} body + * @param {vis.Graph2d.options} options + * @param {number} side + * @param {vis.LineGraph.options} linegraphOptions + * @constructor Legend + * @extends Component + */ +function Legend(body, options, side, linegraphOptions) { + this.body = body; + this.defaultOptions = { + enabled: false, + icons: true, + iconSize: 20, + iconSpacing: 6, + left: { + visible: true, + position: 'top-left' // top/bottom - left,center,right + }, + right: { + visible: true, + position: 'top-right' // top/bottom - left,center,right + } }; - /** - * Handle removed groups - * @param {Number[]} ids - * @private - */ - ItemSet.prototype._onRemoveGroups = function (ids) { - var groups = this.groups; - ids.forEach(function (id) { - var group = groups[id]; + this.side = side; + this.options = util.extend({}, this.defaultOptions); + this.linegraphOptions = linegraphOptions; - if (group) { - group.hide(); - delete groups[id]; - } - }); + this.svgElements = {}; + this.dom = {}; + this.groups = {}; + this.amountOfGroups = 0; + this._create(); + this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups }; - this.markDirty(); + this.setOptions(options); +} - this.body.emitter.emit('_change', { queue: true }); - }; +Legend.prototype = new Component(); - /** - * Reorder the groups if needed - * @return {boolean} changed - * @private - */ - ItemSet.prototype._orderGroups = function () { - if (this.groupsData) { - // reorder the groups - var groupIds = this.groupsData.getIds({ - order: this.options.groupOrder - }); +Legend.prototype.clear = function () { + this.groups = {}; + this.amountOfGroups = 0; +}; - groupIds = this._orderNestedGroups(groupIds); +Legend.prototype.addGroup = function (label, graphOptions) { - var changed = !util.equalArray(groupIds, this.groupIds); - if (changed) { - // hide all groups, removes them from the DOM - var groups = this.groups; - groupIds.forEach(function (groupId) { - groups[groupId].hide(); - }); + // Include a group only if the group option 'excludeFromLegend: false' is not set. + if (graphOptions.options.excludeFromLegend != true) { + if (!this.groups.hasOwnProperty(label)) { + this.groups[label] = graphOptions; + } + this.amountOfGroups += 1; + } +}; - // show the groups again, attach them to the DOM in correct order - groupIds.forEach(function (groupId) { - groups[groupId].show(); - }); +Legend.prototype.updateGroup = function (label, graphOptions) { + this.groups[label] = graphOptions; +}; - this.groupIds = groupIds; - } +Legend.prototype.removeGroup = function (label) { + if (this.groups.hasOwnProperty(label)) { + delete this.groups[label]; + this.amountOfGroups -= 1; + } +}; - return changed; - } else { - return false; - } - }; +Legend.prototype._create = function () { + this.dom.frame = document.createElement('div'); + this.dom.frame.className = 'vis-legend'; + this.dom.frame.style.position = "absolute"; + this.dom.frame.style.top = "10px"; + this.dom.frame.style.display = "block"; - /** - * Reorder the nested groups - * @return {boolean} changed - * @private - */ - ItemSet.prototype._orderNestedGroups = function (groupIds) { - var newGroupIdsOrder = []; - - groupIds.forEach(function (groupId) { - var groupData = this.groupsData.get(groupId); - if (!groupData.nestedInGroup) { - newGroupIdsOrder.push(groupId); - } - if (groupData.nestedGroups) { - var nestedGroups = this.groupsData.get({ - filter: function filter(nestedGroup) { - return nestedGroup.nestedInGroup == groupId; - }, - order: this.options.groupOrder - }); - var nestedGroupIds = nestedGroups.map(function (nestedGroup) { - return nestedGroup.id; - }); - newGroupIdsOrder = newGroupIdsOrder.concat(nestedGroupIds); - } - }, this); - return newGroupIdsOrder; - }; + this.dom.textArea = document.createElement('div'); + this.dom.textArea.className = 'vis-legend-text'; + this.dom.textArea.style.position = "relative"; + this.dom.textArea.style.top = "0px"; - /** - * Add a new item - * @param {Item} item - * @private - */ - ItemSet.prototype._addItem = function (item) { - this.items[item.id] = item; + this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + this.svg.style.position = 'absolute'; + this.svg.style.top = 0 + 'px'; + this.svg.style.width = this.options.iconSize + 5 + 'px'; + this.svg.style.height = '100%'; - // add to group - var groupId = this._getGroupId(item.data); - var group = this.groups[groupId]; + this.dom.frame.appendChild(this.svg); + this.dom.frame.appendChild(this.dom.textArea); +}; - if (!group) { - item.groupShowing = false; - } else if (group && group.data && group.data.showNested) { - item.groupShowing = true; - } +/** + * Hide the component from the DOM + */ +Legend.prototype.hide = function () { + // remove the frame containing the items + if (this.dom.frame.parentNode) { + this.dom.frame.parentNode.removeChild(this.dom.frame); + } +}; - if (group) group.add(item); - }; +/** + * Show the component in the DOM (when not already visible). + */ +Legend.prototype.show = function () { + // show frame containing the items + if (!this.dom.frame.parentNode) { + this.body.dom.center.appendChild(this.dom.frame); + } +}; + +Legend.prototype.setOptions = function (options) { + var fields = ['enabled', 'orientation', 'icons', 'left', 'right']; + util.selectiveDeepExtend(fields, this.options, options); +}; + +Legend.prototype.redraw = function () { + var activeGroups = 0; + var groupArray = (0, _keys2['default'])(this.groups); + groupArray.sort(function (a, b) { + return a < b ? -1 : 1; + }); - /** - * Update an existing item - * @param {Item} item - * @param {Object} itemData - * @private - */ - ItemSet.prototype._updateItem = function (item, itemData) { - // update the items data (will redraw the item when displayed) - item.setData(itemData); + for (var i = 0; i < groupArray.length; i++) { + var groupId = groupArray[i]; + if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { + activeGroups++; + } + } - var groupId = this._getGroupId(item.data); - var group = this.groups[groupId]; - if (!group) { - item.groupShowing = false; - } else if (group && group.data && group.data.showNested) { - item.groupShowing = true; + if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false || activeGroups == 0) { + this.hide(); + } else { + this.show(); + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { + this.dom.frame.style.left = '4px'; + this.dom.frame.style.textAlign = "left"; + this.dom.textArea.style.textAlign = "left"; + this.dom.textArea.style.left = this.options.iconSize + 15 + 'px'; + this.dom.textArea.style.right = ''; + this.svg.style.left = 0 + 'px'; + this.svg.style.right = ''; + } else { + this.dom.frame.style.right = '4px'; + this.dom.frame.style.textAlign = "right"; + this.dom.textArea.style.textAlign = "right"; + this.dom.textArea.style.right = this.options.iconSize + 15 + 'px'; + this.dom.textArea.style.left = ''; + this.svg.style.right = 0 + 'px'; + this.svg.style.left = ''; + } + + if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { + this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; + this.dom.frame.style.bottom = ''; + } else { + var scrollableHeight = this.body.domProps.center.height - this.body.domProps.centerContainer.height; + this.dom.frame.style.bottom = 4 + scrollableHeight + Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; + this.dom.frame.style.top = ''; } - }; - /** - * Delete an item from the ItemSet: remove it from the DOM, from the map - * with items, and from the map with visible items, and from the selection - * @param {Item} item - * @private - */ - ItemSet.prototype._removeItem = function (item) { - // remove from DOM - item.hide(); + if (this.options.icons == false) { + this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px'; + this.dom.textArea.style.right = ''; + this.dom.textArea.style.left = ''; + this.svg.style.width = '0px'; + } else { + this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px'; + this.drawLegendIcons(); + } + + var content = ''; + for (i = 0; i < groupArray.length; i++) { + groupId = groupArray[i]; + if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { + content += this.groups[groupId].content + '
'; + } + } + this.dom.textArea.innerHTML = content; + this.dom.textArea.style.lineHeight = 0.75 * this.options.iconSize + this.options.iconSpacing + 'px'; + } +}; - // remove from items - delete this.items[item.id]; +Legend.prototype.drawLegendIcons = function () { + if (this.dom.frame.parentNode) { + var groupArray = (0, _keys2['default'])(this.groups); + groupArray.sort(function (a, b) { + return a < b ? -1 : 1; + }); - // remove from selection - var index = this.selection.indexOf(item.id); - if (index != -1) this.selection.splice(index, 1); + // this resets the elements so the order is maintained + DOMutil.resetElements(this.svgElements); - // remove from group - item.parent && item.parent.remove(item); - }; + var padding = window.getComputedStyle(this.dom.frame).paddingTop; + var iconOffset = Number(padding.replace('px', '')); + var x = iconOffset; + var iconWidth = this.options.iconSize; + var iconHeight = 0.75 * this.options.iconSize; + var y = iconOffset + 0.5 * iconHeight + 3; - /** - * Create an array containing all items being a range (having an end date) - * @param array - * @returns {Array} - * @private - */ - ItemSet.prototype._constructByEndArray = function (array) { - var endArray = []; + this.svg.style.width = iconWidth + 5 + iconOffset + 'px'; - for (var i = 0; i < array.length; i++) { - if (array[i] instanceof RangeItem) { - endArray.push(array[i]); + for (var i = 0; i < groupArray.length; i++) { + var groupId = groupArray[i]; + if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { + this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y); + y += iconHeight + this.options.iconSpacing; } } - return endArray; - }; + } +}; - /** - * Register the clicked item on touch, before dragStart is initiated. - * - * dragStart is initiated from a mousemove event, AFTER the mouse/touch is - * already moving. Therefore, the mouse/touch can sometimes be above an other - * DOM element than the item itself. - * - * @param {Event} event - * @private - */ - ItemSet.prototype._onTouch = function (event) { - // store the touched item, used in _onDragStart - this.touchParams.item = this.itemFromTarget(event); - this.touchParams.dragLeftItem = event.target.dragLeftItem || false; - this.touchParams.dragRightItem = event.target.dragRightItem || false; - this.touchParams.itemProps = null; - }; +module.exports = Legend; - /** - * Given an group id, returns the index it has. - * - * @param {Number} groupID - * @private - */ - ItemSet.prototype._getGroupIndex = function (groupId) { - for (var i = 0; i < this.groupIds.length; i++) { - if (groupId == this.groupIds[i]) return i; - } - }; +/***/ }), +/* 113 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Start dragging the selected events - * @param {Event} event - * @private - */ - ItemSet.prototype._onDragStart = function (event) { - if (this.touchParams.itemIsDragging) { - return; - } - var item = this.touchParams.item || null; - var me = this; - var props; +"use strict"; - if (item && (item.selected || this.options.itemsAlwaysDraggable.item)) { - if (this.options.editable.overrideItems && !this.options.editable.updateTime && !this.options.editable.updateGroup) { - return; +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** + * This object contains all possible options. It will check if the types are correct, if required if the option is one + * of the allowed values. + * + * __any__ means that the name of the property does not matter. + * __type__ is a required field for all objects and contains the allowed types of all objects + */ +var string = 'string'; +var bool = 'boolean'; +var number = 'number'; +var array = 'array'; +var date = 'date'; +var object = 'object'; // should only be in a __type__ property +var dom = 'dom'; +var moment = 'moment'; +var any = 'any'; + +var allOptions = { + configure: { + enabled: { 'boolean': bool }, + filter: { 'boolean': bool, 'function': 'function' }, + container: { dom: dom }, + __type__: { object: object, 'boolean': bool, 'function': 'function' } + }, + + //globals : + yAxisOrientation: { string: ['left', 'right'] }, + defaultGroup: { string: string }, + sort: { 'boolean': bool }, + sampling: { 'boolean': bool }, + stack: { 'boolean': bool }, + graphHeight: { string: string, number: number }, + shaded: { + enabled: { 'boolean': bool }, + orientation: { string: ['bottom', 'top', 'zero', 'group'] }, // top, bottom, zero, group + groupId: { object: object }, + __type__: { 'boolean': bool, object: object } + }, + style: { string: ['line', 'bar', 'points'] }, // line, bar + barChart: { + width: { number: number }, + minWidth: { number: number }, + sideBySide: { 'boolean': bool }, + align: { string: ['left', 'center', 'right'] }, + __type__: { object: object } + }, + interpolation: { + enabled: { 'boolean': bool }, + parametrization: { string: ['centripetal', 'chordal', 'uniform'] }, // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + alpha: { number: number }, + __type__: { object: object, 'boolean': bool } + }, + drawPoints: { + enabled: { 'boolean': bool }, + onRender: { 'function': 'function' }, + size: { number: number }, + style: { string: ['square', 'circle'] }, // square, circle + __type__: { object: object, 'boolean': bool, 'function': 'function' } + }, + dataAxis: { + showMinorLabels: { 'boolean': bool }, + showMajorLabels: { 'boolean': bool }, + icons: { 'boolean': bool }, + width: { string: string, number: number }, + visible: { 'boolean': bool }, + alignZeros: { 'boolean': bool }, + left: { + range: { min: { number: number, 'undefined': 'undefined' }, max: { number: number, 'undefined': 'undefined' }, __type__: { object: object } }, + format: { 'function': 'function' }, + title: { text: { string: string, number: number, 'undefined': 'undefined' }, style: { string: string, 'undefined': 'undefined' }, __type__: { object: object } }, + __type__: { object: object } + }, + right: { + range: { min: { number: number, 'undefined': 'undefined' }, max: { number: number, 'undefined': 'undefined' }, __type__: { object: object } }, + format: { 'function': 'function' }, + title: { text: { string: string, number: number, 'undefined': 'undefined' }, style: { string: string, 'undefined': 'undefined' }, __type__: { object: object } }, + __type__: { object: object } + }, + __type__: { object: object } + }, + legend: { + enabled: { 'boolean': bool }, + icons: { 'boolean': bool }, + left: { + visible: { 'boolean': bool }, + position: { string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] }, + __type__: { object: object } + }, + right: { + visible: { 'boolean': bool }, + position: { string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] }, + __type__: { object: object } + }, + __type__: { object: object, 'boolean': bool } + }, + groups: { + visibility: { any: any }, + __type__: { object: object } + }, + + autoResize: { 'boolean': bool }, + throttleRedraw: { number: number }, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511 + clickToUse: { 'boolean': bool }, + end: { number: number, date: date, string: string, moment: moment }, + format: { + minorLabels: { + millisecond: { string: string, 'undefined': 'undefined' }, + second: { string: string, 'undefined': 'undefined' }, + minute: { string: string, 'undefined': 'undefined' }, + hour: { string: string, 'undefined': 'undefined' }, + weekday: { string: string, 'undefined': 'undefined' }, + day: { string: string, 'undefined': 'undefined' }, + month: { string: string, 'undefined': 'undefined' }, + year: { string: string, 'undefined': 'undefined' }, + __type__: { object: object } + }, + majorLabels: { + millisecond: { string: string, 'undefined': 'undefined' }, + second: { string: string, 'undefined': 'undefined' }, + minute: { string: string, 'undefined': 'undefined' }, + hour: { string: string, 'undefined': 'undefined' }, + weekday: { string: string, 'undefined': 'undefined' }, + day: { string: string, 'undefined': 'undefined' }, + month: { string: string, 'undefined': 'undefined' }, + year: { string: string, 'undefined': 'undefined' }, + __type__: { object: object } + }, + __type__: { object: object } + }, + moment: { 'function': 'function' }, + height: { string: string, number: number }, + hiddenDates: { + start: { date: date, number: number, string: string, moment: moment }, + end: { date: date, number: number, string: string, moment: moment }, + repeat: { string: string }, + __type__: { object: object, array: array } + }, + locale: { string: string }, + locales: { + __any__: { any: any }, + __type__: { object: object } + }, + max: { date: date, number: number, string: string, moment: moment }, + maxHeight: { number: number, string: string }, + maxMinorChars: { number: number }, + min: { date: date, number: number, string: string, moment: moment }, + minHeight: { number: number, string: string }, + moveable: { 'boolean': bool }, + multiselect: { 'boolean': bool }, + orientation: { string: string }, + showCurrentTime: { 'boolean': bool }, + showMajorLabels: { 'boolean': bool }, + showMinorLabels: { 'boolean': bool }, + start: { date: date, number: number, string: string, moment: moment }, + timeAxis: { + scale: { string: string, 'undefined': 'undefined' }, + step: { number: number, 'undefined': 'undefined' }, + __type__: { object: object } + }, + width: { string: string, number: number }, + zoomable: { 'boolean': bool }, + zoomKey: { string: ['ctrlKey', 'altKey', 'metaKey', ''] }, + zoomMax: { number: number }, + zoomMin: { number: number }, + zIndex: { number: number }, + __type__: { object: object } +}; + +var configureOptions = { + global: { + //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly + sort: true, + sampling: true, + stack: false, + shaded: { + enabled: false, + orientation: ['zero', 'top', 'bottom', 'group'] // zero, top, bottom + }, + style: ['line', 'bar', 'points'], // line, bar + barChart: { + width: [50, 5, 100, 5], + minWidth: [50, 5, 100, 5], + sideBySide: false, + align: ['left', 'center', 'right'] // left, center, right + }, + interpolation: { + enabled: true, + parametrization: ['centripetal', 'chordal', 'uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) + }, + drawPoints: { + enabled: true, + size: [6, 2, 30, 1], + style: ['square', 'circle'] // square, circle + }, + dataAxis: { + showMinorLabels: true, + showMajorLabels: true, + icons: false, + width: [40, 0, 200, 1], + visible: true, + alignZeros: true, + left: { + //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined}, + //format: function (value) {return value;}, + title: { text: '', style: '' } + }, + right: { + //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined}, + //format: function (value) {return value;}, + title: { text: '', style: '' } + } + }, + legend: { + enabled: false, + icons: true, + left: { + visible: true, + position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right + }, + right: { + visible: true, + position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right } + }, - // override options.editable - if (item.editable != null && !item.editable.updateTime && !item.editable.updateGroup && !this.options.editable.overrideItems) { - return; + autoResize: true, + clickToUse: false, + end: '', + format: { + minorLabels: { + millisecond: 'SSS', + second: 's', + minute: 'HH:mm', + hour: 'HH:mm', + weekday: 'ddd D', + day: 'D', + month: 'MMM', + year: 'YYYY' + }, + majorLabels: { + millisecond: 'HH:mm:ss', + second: 'D MMMM HH:mm', + minute: 'ddd D MMMM', + hour: 'ddd D MMMM', + weekday: 'MMMM YYYY', + day: 'MMMM YYYY', + month: 'YYYY', + year: '' } + }, - var dragLeftItem = this.touchParams.dragLeftItem; - var dragRightItem = this.touchParams.dragRightItem; - this.touchParams.itemIsDragging = true; - this.touchParams.selectedItem = item; + height: '', + locale: '', + max: '', + maxHeight: '', + maxMinorChars: [7, 0, 20, 1], + min: '', + minHeight: '', + moveable: true, + orientation: ['both', 'bottom', 'top'], + showCurrentTime: false, + showMajorLabels: true, + showMinorLabels: true, + start: '', + width: '100%', + zoomable: true, + zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''], + zoomMax: [315360000000000, 10, 315360000000000, 1], + zoomMin: [10, 10, 315360000000000, 1], + zIndex: 0 + } +}; + +exports.allOptions = allOptions; +exports.configureOptions = configureOptions; - if (dragLeftItem) { - props = { - item: dragLeftItem, - initialX: event.center.x, - dragLeft: true, - data: this._cloneItemData(item.data) - }; +/***/ }), +/* 114 */ +/***/ (function(module, exports, __webpack_require__) { - this.touchParams.itemProps = [props]; - } else if (dragRightItem) { - props = { - item: dragRightItem, - initialX: event.center.x, - dragRight: true, - data: this._cloneItemData(item.data) - }; +"use strict"; - this.touchParams.itemProps = [props]; - } else { - if (this.groupIds.length < 1) { - // Mitigates a race condition if _onDragStart() is - // called after markDirty() without redraw() being called between. - this.redraw(); - } - var baseGroupIndex = this._getGroupIndex(item.data.group); +var _create = __webpack_require__(29); - var itemsToDrag = this.options.itemsAlwaysDraggable.item && !item.selected ? [item.id] : this.getSelection(); +var _create2 = _interopRequireDefault(_create); - this.touchParams.itemProps = itemsToDrag.map(function (id) { - var item = me.items[id]; - var groupIndex = me._getGroupIndex(item.data.group); - return { - item: item, - initialX: event.center.x, - groupOffset: baseGroupIndex - groupIndex, - data: this._cloneItemData(item.data) - }; - }.bind(this)); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - event.stopPropagation(); - } else if (this.options.editable.add && (event.srcEvent.ctrlKey || event.srcEvent.metaKey)) { - // create a new range item when dragging with ctrl key down - this._onDragStartAddItem(event); - } - }; +/** + * Parse a text source containing data in DOT language into a JSON object. + * The object contains two lists: one with nodes and one with edges. + * + * DOT language reference: http://www.graphviz.org/doc/info/lang.html + * + * DOT language attributes: http://graphviz.org/content/attrs + * + * @param {string} data Text containing a graph in DOT-notation + * @return {Object} graph An object containing two parameters: + * {Object[]} nodes + * {Object[]} edges + * + * ------------------------------------------- + * TODO + * ==== + * + * For label handling, this is an incomplete implementation. From docs (quote #3015): + * + * > the escape sequences "\n", "\l" and "\r" divide the label into lines, centered, + * > left-justified, and right-justified, respectively. + * + * Source: http://www.graphviz.org/content/attrs#kescString + * + * > As another aid for readability, dot allows double-quoted strings to span multiple physical + * > lines using the standard C convention of a backslash immediately preceding a newline + * > character + * > In addition, double-quoted strings can be concatenated using a '+' operator. + * > As HTML strings can contain newline characters, which are used solely for formatting, + * > the language does not allow escaped newlines or concatenation operators to be used + * > within them. + * + * - Currently, only '\\n' is handled + * - Note that text explicitly says 'labels'; the dot parser currently handles escape + * sequences in **all** strings. + */ +function parseDOT(data) { + dot = data; + return parseGraph(); +} + +// mapping of attributes from DOT (the keys) to vis.js (the values) +var NODE_ATTR_MAPPING = { + 'fontsize': 'font.size', + 'fontcolor': 'font.color', + 'labelfontcolor': 'font.color', + 'fontname': 'font.face', + 'color': ['color.border', 'color.background'], + 'fillcolor': 'color.background', + 'tooltip': 'title', + 'labeltooltip': 'title' +}; +var EDGE_ATTR_MAPPING = (0, _create2['default'])(NODE_ATTR_MAPPING); +EDGE_ATTR_MAPPING.color = 'color.color'; +EDGE_ATTR_MAPPING.style = 'dashes'; + +// token types enumeration +var TOKENTYPE = { + NULL: 0, + DELIMITER: 1, + IDENTIFIER: 2, + UNKNOWN: 3 +}; + +// map with all delimiters +var DELIMITERS = { + '{': true, + '}': true, + '[': true, + ']': true, + ';': true, + '=': true, + ',': true, + + '->': true, + '--': true +}; + +var dot = ''; // current dot file +var index = 0; // current index in dot file +var c = ''; // current token character in expr +var token = ''; // current token +var tokenType = TOKENTYPE.NULL; // type of the token - /** - * Start creating a new range item by dragging. - * @param {Event} event - * @private - */ - ItemSet.prototype._onDragStartAddItem = function (event) { - var snap = this.options.snap || null; +/** + * Get the first character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ +function first() { + index = 0; + c = dot.charAt(0); +} - if (this.options.rtl) { - var xAbs = util.getAbsoluteRight(this.dom.frame); - var x = xAbs - event.center.x + 10; // plus 10 to compensate for the drag starting as soon as you've moved 10px +/** + * Get the next character from the dot file. + * The character is stored into the char c. If the end of the dot file is + * reached, the function puts an empty string in c. + */ +function next() { + index++; + c = dot.charAt(index); +} + +/** + * Preview the next character from the dot file. + * @return {string} cNext + */ +function nextPreview() { + return dot.charAt(index + 1); +} + +var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; +/** + * Test whether given character is alphabetic or numeric + * @param {string} c + * @return {Boolean} isAlphaNumeric + */ +function isAlphaNumeric(c) { + return regexAlphaNumeric.test(c); +} + +/** + * Merge all options of object b into object b + * @param {Object} a + * @param {Object} b + * @return {Object} a + */ +function merge(a, b) { + if (!a) { + a = {}; + } + + if (b) { + for (var name in b) { + if (b.hasOwnProperty(name)) { + a[name] = b[name]; + } + } + } + return a; +} + +/** + * Set a value in an object, where the provided parameter name can be a + * path with nested parameters. For example: + * + * var obj = {a: 2}; + * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} + * + * @param {Object} obj + * @param {string} path A parameter name or dot-separated parameter path, + * like "color.highlight.border". + * @param {*} value + */ +function setValue(obj, path, value) { + var keys = path.split('.'); + var o = obj; + while (keys.length) { + var key = keys.shift(); + if (keys.length) { + // this isn't the end point + if (!o[key]) { + o[key] = {}; + } + o = o[key]; } else { - var xAbs = util.getAbsoluteLeft(this.dom.frame); - var x = event.center.x - xAbs - 10; // minus 10 to compensate for the drag starting as soon as you've moved 10px + // this is the end point + o[key] = value; } + } +} - var time = this.body.util.toTime(x); - var scale = this.body.util.getScale(); - var step = this.body.util.getStep(); - var start = snap ? snap(time, scale, step) : time; - var end = start; +/** + * Add a node to a graph object. If there is already a node with + * the same id, their attributes will be merged. + * @param {Object} graph + * @param {Object} node + */ +function addNode(graph, node) { + var i, len; + var current = null; + + // find root graph (in case of subgraph) + var graphs = [graph]; // list with all graphs from current graph to root graph + var root = graph; + while (root.parent) { + graphs.push(root.parent); + root = root.parent; + } + + // find existing node (at root level) by its id + if (root.nodes) { + for (i = 0, len = root.nodes.length; i < len; i++) { + if (node.id === root.nodes[i].id) { + current = root.nodes[i]; + break; + } + } + } - var itemData = { - type: 'range', - start: start, - end: end, - content: 'new item' + if (!current) { + // this is a new node + current = { + id: node.id }; + if (graph.node) { + // clone default attributes + current.attr = merge(current.attr, graph.node); + } + } - var id = util.randomUUID(); - itemData[this.itemsData._fieldId] = id; - - var group = this.groupFromTarget(event); - if (group) { - itemData.group = group.groupId; - } - var newItem = new RangeItem(itemData, this.conversion, this.options); - newItem.id = id; // TODO: not so nice setting id afterwards - newItem.data = this._cloneItemData(itemData); - this._addItem(newItem); - this.touchParams.selectedItem = newItem; - - var props = { - item: newItem, - initialX: event.center.x, - data: newItem.data - }; + // add node to this (sub)graph and all its parent graphs + for (i = graphs.length - 1; i >= 0; i--) { + var g = graphs[i]; - if (this.options.rtl) { - props.dragLeft = true; - } else { - props.dragRight = true; + if (!g.nodes) { + g.nodes = []; + } + if (g.nodes.indexOf(current) === -1) { + g.nodes.push(current); } - this.touchParams.itemProps = [props]; + } - event.stopPropagation(); - }; + // merge attributes + if (node.attr) { + current.attr = merge(current.attr, node.attr); + } +} - /** - * Drag selected items - * @param {Event} event - * @private - */ - ItemSet.prototype._onDrag = function (event) { - if (this.touchParams.itemProps) { - event.stopPropagation(); +/** + * Add an edge to a graph object + * @param {Object} graph + * @param {Object} edge + */ +function addEdge(graph, edge) { + if (!graph.edges) { + graph.edges = []; + } + graph.edges.push(edge); + if (graph.edge) { + var attr = merge({}, graph.edge); // clone default attributes + edge.attr = merge(attr, edge.attr); // merge attributes + } +} - var me = this; - var snap = this.options.snap || null; +/** + * Create an edge to a graph object + * @param {Object} graph + * @param {string | number | Object} from + * @param {string | number | Object} to + * @param {string} type + * @param {Object | null} attr + * @return {Object} edge + */ +function createEdge(graph, from, to, type, attr) { + var edge = { + from: from, + to: to, + type: type + }; - if (this.options.rtl) { - var xOffset = this.body.dom.root.offsetLeft + this.body.domProps.right.width; - } else { - var xOffset = this.body.dom.root.offsetLeft + this.body.domProps.left.width; - } + if (graph.edge) { + edge.attr = merge({}, graph.edge); // clone default attributes + } + edge.attr = merge(edge.attr || {}, attr); // merge attributes - var scale = this.body.util.getScale(); - var step = this.body.util.getStep(); + return edge; +} - //only calculate the new group for the item that's actually dragged - var selectedItem = this.touchParams.selectedItem; - var updateGroupAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateGroup || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateGroup; - var newGroupBase = null; - if (updateGroupAllowed && selectedItem) { - if (selectedItem.data.group != undefined) { - // drag from one group to another - var group = me.groupFromTarget(event); - if (group) { - //we know the offset for all items, so the new group for all items - //will be relative to this one. - newGroupBase = this._getGroupIndex(group.groupId); - } +/** + * Get next token in the current dot file. + * The token and token type are available as token and tokenType + */ +function getToken() { + tokenType = TOKENTYPE.NULL; + token = ''; + + // skip over whitespaces + while (c === ' ' || c === '\t' || c === '\n' || c === '\r') { + // space, tab, enter + next(); + } + + do { + var isComment = false; + + // skip comment + if (c === '#') { + // find the previous non-space character + var i = index - 1; + while (dot.charAt(i) === ' ' || dot.charAt(i) === '\t') { + i--; + } + if (dot.charAt(i) === '\n' || dot.charAt(i) === '') { + // the # is at the start of a line, this is indeed a line comment + while (c != '' && c != '\n') { + next(); } + isComment = true; } - - // move - this.touchParams.itemProps.forEach(function (props) { - var current = me.body.util.toTime(event.center.x - xOffset); - var initial = me.body.util.toTime(props.initialX - xOffset); - - if (this.options.rtl) { - var offset = -(current - initial); // ms + } + if (c === '/' && nextPreview() === '/') { + // skip line comment + while (c != '' && c != '\n') { + next(); + } + isComment = true; + } + if (c === '/' && nextPreview() === '*') { + // skip block comment + while (c != '') { + if (c === '*' && nextPreview() === '/') { + // end of block comment found. skip these last two characters + next(); + next(); + break; } else { - var offset = current - initial; // ms - } - - var itemData = this._cloneItemData(props.item.data); // clone the data - if (props.item.editable != null && !props.item.editable.updateTime && !props.item.editable.updateGroup && !me.options.editable.overrideItems) { - return; + next(); } + } + isComment = true; + } - var updateTimeAllowed = (this.options.editable.overrideItems || selectedItem.editable == null) && this.options.editable.updateTime || !this.options.editable.overrideItems && selectedItem.editable != null && selectedItem.editable.updateTime; - if (updateTimeAllowed) { - if (props.dragLeft) { - // drag left side of a range item - if (this.options.rtl) { - if (itemData.end != undefined) { - var initialEnd = util.convert(props.data.end, 'Date'); - var end = new Date(initialEnd.valueOf() + offset); - // TODO: pass a Moment instead of a Date to snap(). (Breaking change) - itemData.end = snap ? snap(end, scale, step) : end; - } - } else { - if (itemData.start != undefined) { - var initialStart = util.convert(props.data.start, 'Date'); - var start = new Date(initialStart.valueOf() + offset); - // TODO: pass a Moment instead of a Date to snap(). (Breaking change) - itemData.start = snap ? snap(start, scale, step) : start; - } - } - } else if (props.dragRight) { - // drag right side of a range item - if (this.options.rtl) { - if (itemData.start != undefined) { - var initialStart = util.convert(props.data.start, 'Date'); - var start = new Date(initialStart.valueOf() + offset); - // TODO: pass a Moment instead of a Date to snap(). (Breaking change) - itemData.start = snap ? snap(start, scale, step) : start; - } - } else { - if (itemData.end != undefined) { - var initialEnd = util.convert(props.data.end, 'Date'); - var end = new Date(initialEnd.valueOf() + offset); - // TODO: pass a Moment instead of a Date to snap(). (Breaking change) - itemData.end = snap ? snap(end, scale, step) : end; - } - } - } else { - // drag both start and end - if (itemData.start != undefined) { - - var initialStart = util.convert(props.data.start, 'Date').valueOf(); - var start = new Date(initialStart + offset); - - if (itemData.end != undefined) { - var initialEnd = util.convert(props.data.end, 'Date'); - var duration = initialEnd.valueOf() - initialStart.valueOf(); + // skip over whitespaces + while (c === ' ' || c === '\t' || c === '\n' || c === '\r') { + // space, tab, enter + next(); + } + } while (isComment); - // TODO: pass a Moment instead of a Date to snap(). (Breaking change) - itemData.start = snap ? snap(start, scale, step) : start; - itemData.end = new Date(itemData.start.valueOf() + duration); - } else { - // TODO: pass a Moment instead of a Date to snap(). (Breaking change) - itemData.start = snap ? snap(start, scale, step) : start; - } - } - } - } + // check for end of dot file + if (c === '') { + // token is still empty + tokenType = TOKENTYPE.DELIMITER; + return; + } - if (updateGroupAllowed && !props.dragLeft && !props.dragRight && newGroupBase != null) { - if (itemData.group != undefined) { - var newOffset = newGroupBase - props.groupOffset; + // check for delimiters consisting of 2 characters + var c2 = c + nextPreview(); + if (DELIMITERS[c2]) { + tokenType = TOKENTYPE.DELIMITER; + token = c2; + next(); + next(); + return; + } - //make sure we stay in bounds - newOffset = Math.max(0, newOffset); - newOffset = Math.min(me.groupIds.length - 1, newOffset); - itemData.group = me.groupIds[newOffset]; - } - } + // check for delimiters consisting of 1 character + if (DELIMITERS[c]) { + tokenType = TOKENTYPE.DELIMITER; + token = c; + next(); + return; + } - // confirm moving the item - itemData = this._cloneItemData(itemData); // convert start and end to the correct type - me.options.onMoving(itemData, function (itemData) { - if (itemData) { - props.item.setData(this._cloneItemData(itemData, 'Date')); - } - }.bind(this)); - }.bind(this)); + // check for an identifier (number or string) + // TODO: more precise parsing of numbers/strings (and the port separator ':') + if (isAlphaNumeric(c) || c === '-') { + token += c; + next(); - this.body.emitter.emit('_change'); + while (isAlphaNumeric(c)) { + token += c; + next(); } - }; - - /** - * Move an item to another group - * @param {Item} item - * @param {String | Number} groupId - * @private - */ - ItemSet.prototype._moveToGroup = function (item, groupId) { - var group = this.groups[groupId]; - if (group && group.groupId != item.data.group) { - var oldGroup = item.parent; - oldGroup.remove(item); - oldGroup.order(); - - item.data.group = group.groupId; + if (token === 'false') { + token = false; // convert to boolean + } else if (token === 'true') { + token = true; // convert to boolean + } else if (!isNaN(Number(token))) { + token = Number(token); // convert to number + } + tokenType = TOKENTYPE.IDENTIFIER; + return; + } - group.add(item); - group.order(); + // check for a string enclosed by double quotes + if (c === '"') { + next(); + while (c != '' && (c != '"' || c === '"' && nextPreview() === '"')) { + if (c === '"') { + // skip the escape character + token += c; + next(); + } else if (c === '\\' && nextPreview() === 'n') { + // Honor a newline escape sequence + token += '\n'; + next(); + } else { + token += c; + } + next(); } - }; + if (c != '"') { + throw newSyntaxError('End of string " expected'); + } + next(); + tokenType = TOKENTYPE.IDENTIFIER; + return; + } - /** - * End of dragging selected items - * @param {Event} event - * @private - */ - ItemSet.prototype._onDragEnd = function (event) { - this.touchParams.itemIsDragging = false; - if (this.touchParams.itemProps) { - event.stopPropagation(); + // something unknown is found, wrong characters, a syntax error + tokenType = TOKENTYPE.UNKNOWN; + while (c != '') { + token += c; + next(); + } + throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); +} - var me = this; - var dataset = this.itemsData.getDataSet(); - var itemProps = this.touchParams.itemProps; - this.touchParams.itemProps = null; - - itemProps.forEach(function (props) { - var id = props.item.id; - var exists = me.itemsData.get(id, me.itemOptions) != null; - - if (!exists) { - // add a new item - me.options.onAdd(props.item.data, function (itemData) { - me._removeItem(props.item); // remove temporary item - if (itemData) { - me.itemsData.getDataSet().add(itemData); - } +/** + * Parse a graph. + * @returns {Object} graph + */ +function parseGraph() { + var graph = {}; + + first(); + getToken(); + + // optional strict keyword + if (token === 'strict') { + graph.strict = true; + getToken(); + } - // force re-stacking of all items next redraw - me.body.emitter.emit('_change'); - }); - } else { - // update existing item - var itemData = this._cloneItemData(props.item.data); // convert start and end to the correct type - me.options.onMove(itemData, function (itemData) { - if (itemData) { - // apply changes - itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined) - dataset.update(itemData); - } else { - // restore original values - props.item.setData(props.data); + // graph or digraph keyword + if (token === 'graph' || token === 'digraph') { + graph.type = token; + getToken(); + } - me.body.emitter.emit('_change'); - } - }); - } - }.bind(this)); - } - }; + // optional graph id + if (tokenType === TOKENTYPE.IDENTIFIER) { + graph.id = token; + getToken(); + } - ItemSet.prototype._onGroupClick = function (event) { - var group = this.groupFromTarget(event); + // open angle bracket + if (token != '{') { + throw newSyntaxError('Angle bracket { expected'); + } + getToken(); - if (!group || !group.nestedGroups) return; + // statements + parseStatements(graph); - var groupsData = this.groupsData; - if (this.groupsData instanceof DataView) { - groupsData = this.groupsData.getDataSet(); - } + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); + } + getToken(); + + // end of file + if (token !== '') { + throw newSyntaxError('End of file expected'); + } + getToken(); - group.showNested = !group.showNested; + // remove temporary default options + delete graph.node; + delete graph.edge; + delete graph.graph; - var nestedGroups = groupsData.get(group.nestedGroups).map(function (nestedGroup) { - if (nestedGroup.visible == undefined) { - nestedGroup.visible = true; - } - nestedGroup.visible = !!group.showNested; - return nestedGroup; - }); - groupsData.update(nestedGroups); + return graph; +} - if (group.showNested) { - util.removeClassName(group.dom.label, 'collapsed'); - util.addClassName(group.dom.label, 'expanded'); - } else { - util.removeClassName(group.dom.label, 'expanded'); - var collapsedDirClassName = this.options.rtl ? 'collapsed-rtl' : 'collapsed'; - util.addClassName(group.dom.label, collapsedDirClassName); +/** + * Parse a list with statements. + * @param {Object} graph + */ +function parseStatements(graph) { + while (token !== '' && token != '}') { + parseStatement(graph); + if (token === ';') { + getToken(); } - }; + } +} - ItemSet.prototype._onGroupDragStart = function (event) { - if (this.options.groupEditable.order) { - this.groupTouchParams.group = this.groupFromTarget(event); +/** + * Parse a single statement. Can be a an attribute statement, node + * statement, a series of node statements and edge statements, or a + * parameter. + * @param {Object} graph + */ +function parseStatement(graph) { + // parse subgraph + var subgraph = parseSubgraph(graph); + if (subgraph) { + // edge statements + parseEdge(graph, subgraph); - if (this.groupTouchParams.group) { - event.stopPropagation(); + return; + } - this.groupTouchParams.originalOrder = this.groupsData.getIds({ - order: this.options.groupOrder - }); - } - } - }; + // parse an attribute statement + var attr = parseAttributeStatement(graph); + if (attr) { + return; + } - ItemSet.prototype._onGroupDrag = function (event) { - if (this.options.groupEditable.order && this.groupTouchParams.group) { - event.stopPropagation(); + // parse node + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + var id = token; // id can be a string or a number + getToken(); - var groupsData = this.groupsData; - if (this.groupsData instanceof DataView) { - groupsData = this.groupsData.getDataSet(); - } - // drag from one group to another - var group = this.groupFromTarget(event); - - // try to avoid toggling when groups differ in height - if (group && group.height != this.groupTouchParams.group.height) { - var movingUp = group.top < this.groupTouchParams.group.top; - var clientY = event.center ? event.center.y : event.clientY; - var targetGroupTop = util.getAbsoluteTop(group.dom.foreground); - var draggedGroupHeight = this.groupTouchParams.group.height; - if (movingUp) { - // skip swapping the groups when the dragged group is not below clientY afterwards - if (targetGroupTop + draggedGroupHeight < clientY) { - return; - } - } else { - var targetGroupHeight = group.height; - // skip swapping the groups when the dragged group is not below clientY afterwards - if (targetGroupTop + targetGroupHeight - draggedGroupHeight > clientY) { - return; - } - } - } + if (token === '=') { + // id statement + getToken(); + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier expected'); + } + graph[id] = token; + getToken(); + // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " + } else { + parseNodeStatement(graph, id); + } +} - if (group && group != this.groupTouchParams.group) { - var targetGroup = groupsData.get(group.groupId); - var draggedGroup = groupsData.get(this.groupTouchParams.group.groupId); +/** + * Parse a subgraph + * @param {Object} graph parent graph object + * @return {Object | null} subgraph + */ +function parseSubgraph(graph) { + var subgraph = null; + + // optional subgraph keyword + if (token === 'subgraph') { + subgraph = {}; + subgraph.type = 'subgraph'; + getToken(); - // switch groups - if (draggedGroup && targetGroup) { - this.options.groupOrderSwap(draggedGroup, targetGroup, groupsData); - groupsData.update(draggedGroup); - groupsData.update(targetGroup); - } + // optional graph id + if (tokenType === TOKENTYPE.IDENTIFIER) { + subgraph.id = token; + getToken(); + } + } - // fetch current order of groups - var newOrder = groupsData.getIds({ - order: this.options.groupOrder - }); + // open angle bracket + if (token === '{') { + getToken(); - // in case of changes since _onGroupDragStart - if (!util.equalArray(newOrder, this.groupTouchParams.originalOrder)) { - var origOrder = this.groupTouchParams.originalOrder; - var draggedId = this.groupTouchParams.group.groupId; - var numGroups = Math.min(origOrder.length, newOrder.length); - var curPos = 0; - var newOffset = 0; - var orgOffset = 0; - while (curPos < numGroups) { - // as long as the groups are where they should be step down along the groups order - while (curPos + newOffset < numGroups && curPos + orgOffset < numGroups && newOrder[curPos + newOffset] == origOrder[curPos + orgOffset]) { - curPos++; - } + if (!subgraph) { + subgraph = {}; + } + subgraph.parent = graph; + subgraph.node = graph.node; + subgraph.edge = graph.edge; + subgraph.graph = graph.graph; - // all ok - if (curPos + newOffset >= numGroups) { - break; - } + // statements + parseStatements(subgraph); - // not all ok - // if dragged group was move upwards everything below should have an offset - if (newOrder[curPos + newOffset] == draggedId) { - newOffset = 1; - continue; - } - // if dragged group was move downwards everything above should have an offset - else if (origOrder[curPos + orgOffset] == draggedId) { - orgOffset = 1; - continue; - } - // found a group (apart from dragged group) that has the wrong position -> switch with the - // group at the position where other one should be, fix index arrays and continue - else { - var slippedPosition = newOrder.indexOf(origOrder[curPos + orgOffset]); - var switchGroup = groupsData.get(newOrder[curPos + newOffset]); - var shouldBeGroup = groupsData.get(origOrder[curPos + orgOffset]); - this.options.groupOrderSwap(switchGroup, shouldBeGroup, groupsData); - groupsData.update(switchGroup); - groupsData.update(shouldBeGroup); - - var switchGroupId = newOrder[curPos + newOffset]; - newOrder[curPos + newOffset] = origOrder[curPos + orgOffset]; - newOrder[slippedPosition] = switchGroupId; - - curPos++; - } - } - } - } + // close angle bracket + if (token != '}') { + throw newSyntaxError('Angle bracket } expected'); } - }; + getToken(); - ItemSet.prototype._onGroupDragEnd = function (event) { - if (this.options.groupEditable.order && this.groupTouchParams.group) { - event.stopPropagation(); + // remove temporary default options + delete subgraph.node; + delete subgraph.edge; + delete subgraph.graph; + delete subgraph.parent; - // update existing group - var me = this; - var id = me.groupTouchParams.group.groupId; - var dataset = me.groupsData.getDataSet(); - var groupData = util.extend({}, dataset.get(id)); // clone the data - me.options.onMoveGroup(groupData, function (groupData) { - if (groupData) { - // apply changes - groupData[dataset._fieldId] = id; // ensure the group contains its id (can be undefined) - dataset.update(groupData); - } else { + // register at the parent graph + if (!graph.subgraphs) { + graph.subgraphs = []; + } + graph.subgraphs.push(subgraph); + } - // fetch current order of groups - var newOrder = dataset.getIds({ - order: me.options.groupOrder - }); + return subgraph; +} - // restore original order - if (!util.equalArray(newOrder, me.groupTouchParams.originalOrder)) { - var origOrder = me.groupTouchParams.originalOrder; - var numGroups = Math.min(origOrder.length, newOrder.length); - var curPos = 0; - while (curPos < numGroups) { - // as long as the groups are where they should be step down along the groups order - while (curPos < numGroups && newOrder[curPos] == origOrder[curPos]) { - curPos++; - } +/** + * parse an attribute statement like "node [shape=circle fontSize=16]". + * Available keywords are 'node', 'edge', 'graph'. + * The previous list with default attributes will be replaced + * @param {Object} graph + * @returns {String | null} keyword Returns the name of the parsed attribute + * (node, edge, graph), or null if nothing + * is parsed. + */ +function parseAttributeStatement(graph) { + // attribute statements + if (token === 'node') { + getToken(); - // all ok - if (curPos >= numGroups) { - break; - } + // node attributes + graph.node = parseAttributeList(); + return 'node'; + } else if (token === 'edge') { + getToken(); - // found a group that has the wrong position -> switch with the - // group at the position where other one should be, fix index arrays and continue - var slippedPosition = newOrder.indexOf(origOrder[curPos]); - var switchGroup = dataset.get(newOrder[curPos]); - var shouldBeGroup = dataset.get(origOrder[curPos]); - me.options.groupOrderSwap(switchGroup, shouldBeGroup, dataset); - dataset.update(switchGroup); - dataset.update(shouldBeGroup); + // edge attributes + graph.edge = parseAttributeList(); + return 'edge'; + } else if (token === 'graph') { + getToken(); - var switchGroupId = newOrder[curPos]; - newOrder[curPos] = origOrder[curPos]; - newOrder[slippedPosition] = switchGroupId; + // graph attributes + graph.graph = parseAttributeList(); + return 'graph'; + } - curPos++; - } - } - } - }); + return null; +} - me.body.emitter.emit('groupDragged', { groupId: id }); - } +/** + * parse a node statement + * @param {Object} graph + * @param {string | number} id + */ +function parseNodeStatement(graph, id) { + // node statement + var node = { + id: id }; + var attr = parseAttributeList(); + if (attr) { + node.attr = attr; + } + addNode(graph, node); - /** - * Handle selecting/deselecting an item when tapping it - * @param {Event} event - * @private - */ - ItemSet.prototype._onSelectItem = function (event) { - if (!this.options.selectable) return; + // edge statements + parseEdge(graph, id); +} - var ctrlKey = event.srcEvent && (event.srcEvent.ctrlKey || event.srcEvent.metaKey); - var shiftKey = event.srcEvent && event.srcEvent.shiftKey; - if (ctrlKey || shiftKey) { - this._onMultiSelectItem(event); - return; +/** + * Parse an edge or a series of edges + * @param {Object} graph + * @param {string | number} from Id of the from node + */ +function parseEdge(graph, from) { + while (token === '->' || token === '--') { + var to; + var type = token; + getToken(); + + var subgraph = parseSubgraph(graph); + if (subgraph) { + to = subgraph; + } else { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Identifier or subgraph expected'); + } + to = token; + addNode(graph, { + id: to + }); + getToken(); } - var oldSelection = this.getSelection(); + // parse edge attributes + var attr = parseAttributeList(); - var item = this.itemFromTarget(event); - var selection = item ? [item.id] : []; - this.setSelection(selection); + // create edge + var edge = createEdge(graph, from, to, type, attr); + addEdge(graph, edge); - var newSelection = this.getSelection(); + from = to; + } +} - // emit a select event, - // except when old selection is empty and new selection is still empty - if (newSelection.length > 0 || oldSelection.length > 0) { - this.body.emitter.emit('select', { - items: newSelection, - event: event - }); - } +/** + * Parse a set with attributes, + * for example [label="1.000", shape=solid] + * @return {Object | null} attr + */ +function parseAttributeList() { + var attr = null; + + // edge styles of dot and vis + var edgeStyles = { + 'dashed': true, + 'solid': false, + 'dotted': [1, 5] }; - /** - * Handle hovering an item - * @param {Event} event - * @private - */ - ItemSet.prototype._onMouseOver = function (event) { - var item = this.itemFromTarget(event); - if (!item) return; - - // Item we just left - var related = this.itemFromRelatedTarget(event); - if (item === related) { - // We haven't changed item, just element in the item - return; - } + while (token === '[') { + getToken(); + attr = {}; + while (token !== '' && token != ']') { + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute name expected'); + } + var name = token; - var title = item.getTitle(); - if (this.options.showTooltips && title) { - if (this.popup == null) { - this.popup = new Popup(this.body.dom.root, this.options.tooltip.overflowMethod || 'flip'); + getToken(); + if (token != '=') { + throw newSyntaxError('Equal sign = expected'); } + getToken(); - this.popup.setText(title); - var container = this.body.dom.centerContainer; - this.popup.setPosition(event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, event.clientY - util.getAbsoluteTop(container) + container.offsetTop); - this.popup.show(); - } else { - // Hovering over item without a title, hide popup - // Needed instead of _just_ in _onMouseOut due to #2572 - if (this.popup != null) { - this.popup.hide(); + if (tokenType != TOKENTYPE.IDENTIFIER) { + throw newSyntaxError('Attribute value expected'); } - } + var value = token; - this.body.emitter.emit('itemover', { - item: item.id, - event: event - }); - }; - ItemSet.prototype._onMouseOut = function (event) { - var item = this.itemFromTarget(event); - if (!item) return; - - // Item we are going to - var related = this.itemFromRelatedTarget(event); - if (item === related) { - // We aren't changing item, just element in the item - return; - } + // convert from dot style to vis + if (name === 'style') { + value = edgeStyles[value]; + } - if (this.popup != null) { - this.popup.hide(); - } - - this.body.emitter.emit('itemout', { - item: item.id, - event: event - }); - }; - ItemSet.prototype._onMouseMove = function (event) { - var item = this.itemFromTarget(event); - if (!item) return; + setValue(attr, name, value); // name can be a path - if (this.options.showTooltips && this.options.tooltip.followMouse) { - if (this.popup) { - if (!this.popup.hidden) { - var container = this.body.dom.centerContainer; - this.popup.setPosition(event.clientX - util.getAbsoluteLeft(container) + container.offsetLeft, event.clientY - util.getAbsoluteTop(container) + container.offsetTop); - this.popup.show(); // Redraw - } + getToken(); + if (token == ',') { + getToken(); } } - }; - /** - * Handle mousewheel - * @param event - * @private - */ - ItemSet.prototype._onMouseWheel = function (event) { - if (this.touchParams.itemIsDragging) { - this._onDragEnd(event); + if (token != ']') { + throw newSyntaxError('Bracket ] expected'); } - }; + getToken(); + } - /** - * Handle updates of an item on double tap - * @param event - * @private - */ - ItemSet.prototype._onUpdateItem = function (item) { - if (!this.options.selectable) return; - if (!this.options.editable.add) return; + return attr; +} - var me = this; +/** + * Create a syntax error with extra information on current token and index. + * @param {string} message + * @returns {SyntaxError} err + */ +function newSyntaxError(message) { + return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); +} - if (item) { - // execute async handler to update the item (or cancel it) - var itemData = me.itemsData.get(item.id); // get a clone of the data from the dataset - this.options.onUpdate(itemData, function (itemData) { - if (itemData) { - me.itemsData.getDataSet().update(itemData); - } +/** + * Chop off text after a maximum length + * @param {string} text + * @param {number} maxLength + * @returns {String} + */ +function chop(text, maxLength) { + return text.length <= maxLength ? text : text.substr(0, 27) + '...'; +} + +/** + * Execute a function fn for each pair of elements in two arrays + * @param {Array | *} array1 + * @param {Array | *} array2 + * @param {function} fn + */ +function forEach2(array1, array2, fn) { + if (Array.isArray(array1)) { + array1.forEach(function (elem1) { + if (Array.isArray(array2)) { + array2.forEach(function (elem2) { + fn(elem1, elem2); + }); + } else { + fn(elem1, array2); + } + }); + } else { + if (Array.isArray(array2)) { + array2.forEach(function (elem2) { + fn(array1, elem2); }); + } else { + fn(array1, array2); } - }; - - /** - * Handle creation of an item on double tap - * @param event - * @private - */ - ItemSet.prototype._onAddItem = function (event) { - if (!this.options.selectable) return; - if (!this.options.editable.add) return; + } +} - var me = this; - var snap = this.options.snap || null; - var item = this.itemFromTarget(event); +/** + * Set a nested property on an object + * When nested objects are missing, they will be created. + * For example setProp({}, 'font.color', 'red') will return {font: {color: 'red'}} + * @param {Object} object + * @param {string} path A dot separated string like 'font.color' + * @param {*} value Value for the property + * @return {Object} Returns the original object, allows for chaining. + */ +function setProp(object, path, value) { + var names = path.split('.'); + var prop = names.pop(); + + // traverse over the nested objects + var obj = object; + for (var i = 0; i < names.length; i++) { + var name = names[i]; + if (!(name in obj)) { + obj[name] = {}; + } + obj = obj[name]; + } + + // set the property value + obj[prop] = value; + + return object; +} - if (!item) { - // add item - if (this.options.rtl) { - var xAbs = util.getAbsoluteRight(this.dom.frame); - var x = xAbs - event.center.x; +/** + * Convert an object with DOT attributes to their vis.js equivalents. + * @param {Object} attr Object with DOT attributes + * @param {Object} mapping + * @return {Object} Returns an object with vis.js attributes + */ +function convertAttr(attr, mapping) { + var converted = {}; + + for (var prop in attr) { + if (attr.hasOwnProperty(prop)) { + var visProp = mapping[prop]; + if (Array.isArray(visProp)) { + visProp.forEach(function (visPropI) { + setProp(converted, visPropI, attr[prop]); + }); + } else if (typeof visProp === 'string') { + setProp(converted, visProp, attr[prop]); } else { - var xAbs = util.getAbsoluteLeft(this.dom.frame); - var x = event.center.x - xAbs; + setProp(converted, prop, attr[prop]); + } + } + } + + return converted; +} + +/** + * Convert a string containing a graph in DOT language into a map containing + * with nodes and edges in the format of graph. + * @param {string} data Text containing a graph in DOT-notation + * @return {Object} graphData + */ +function DOTToGraph(data) { + // parse the DOT file + var dotData = parseDOT(data); + var graphData = { + nodes: [], + edges: [], + options: {} + }; + + // copy the nodes + if (dotData.nodes) { + dotData.nodes.forEach(function (dotNode) { + var graphNode = { + id: dotNode.id, + label: String(dotNode.label || dotNode.id) + }; + merge(graphNode, convertAttr(dotNode.attr, NODE_ATTR_MAPPING)); + if (graphNode.image) { + graphNode.shape = 'image'; } - // var xAbs = util.getAbsoluteLeft(this.dom.frame); - // var x = event.center.x - xAbs; - var start = this.body.util.toTime(x); - var scale = this.body.util.getScale(); - var step = this.body.util.getStep(); + graphData.nodes.push(graphNode); + }); + } - var newItemData; - if (event.type == 'drop') { - newItemData = JSON.parse(event.dataTransfer.getData("text")); - newItemData.content = newItemData.content ? newItemData.content : 'new item'; - newItemData.start = newItemData.start ? newItemData.start : snap ? snap(start, scale, step) : start; - newItemData.type = newItemData.type || 'box'; - newItemData[this.itemsData._fieldId] = newItemData.id || util.randomUUID(); + // copy the edges + if (dotData.edges) { + /** + * Convert an edge in DOT format to an edge with VisGraph format + * @param {Object} dotEdge + * @returns {Object} graphEdge + */ + var convertEdge = function convertEdge(dotEdge) { + var graphEdge = { + from: dotEdge.from, + to: dotEdge.to + }; + merge(graphEdge, convertAttr(dotEdge.attr, EDGE_ATTR_MAPPING)); + graphEdge.arrows = dotEdge.type === '->' ? 'to' : undefined; - if (newItemData.type == 'range' && !newItemData.end) { - var end = this.body.util.toTime(x + this.props.width / 5); - newItemData.end = snap ? snap(end, scale, step) : end; - } + return graphEdge; + }; + + dotData.edges.forEach(function (dotEdge) { + var from, to; + if (dotEdge.from instanceof Object) { + from = dotEdge.from.nodes; } else { - newItemData = { - start: snap ? snap(start, scale, step) : start, - content: 'new item' + from = { + id: dotEdge.from }; - newItemData[this.itemsData._fieldId] = util.randomUUID(); + } - // when default type is a range, add a default end date to the new item - if (this.options.type === 'range') { - var end = this.body.util.toTime(x + this.props.width / 5); - newItemData.end = snap ? snap(end, scale, step) : end; - } + // TODO: support for attributes 'dir' and 'arrowhead' (edge arrows) + + if (dotEdge.to instanceof Object) { + to = dotEdge.to.nodes; + } else { + to = { + id: dotEdge.to + }; } - var group = this.groupFromTarget(event); - if (group) { - newItemData.group = group.groupId; + if (dotEdge.from instanceof Object && dotEdge.from.edges) { + dotEdge.from.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); } - // execute async handler to customize (or cancel) adding an item - newItemData = this._cloneItemData(newItemData); // convert start and end to the correct type - this.options.onAdd(newItemData, function (item) { - if (item) { - me.itemsData.getDataSet().add(item); - if (event.type == 'drop') { - me.setSelection([item.id]); - } - // TODO: need to trigger a redraw? - } + forEach2(from, to, function (from, to) { + var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); }); + + if (dotEdge.to instanceof Object && dotEdge.to.edges) { + dotEdge.to.edges.forEach(function (subEdge) { + var graphEdge = convertEdge(subEdge); + graphData.edges.push(graphEdge); + }); + } + }); + } + + // copy the options + if (dotData.attr) { + graphData.options = dotData.attr; + } + + return graphData; +} + +// exports +exports.parseDOT = parseDOT; +exports.DOTToGraph = DOTToGraph; + +/***/ }), +/* 115 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/** + * + * @param {json} gephiJSON + * @param {obj} optionsObj + * @returns {{nodes: Array, edges: Array}} + */ +function parseGephi(gephiJSON, optionsObj) { + var edges = []; + var nodes = []; + var options = { + edges: { + inheritColor: false + }, + nodes: { + fixed: false, + parseColor: false } }; - /** - * Handle selecting/deselecting multiple items when holding an item - * @param {Event} event - * @private - */ - ItemSet.prototype._onMultiSelectItem = function (event) { - if (!this.options.selectable) return; + if (optionsObj !== undefined) { + if (optionsObj.fixed !== undefined) { + options.nodes.fixed = optionsObj.fixed; + } + if (optionsObj.parseColor !== undefined) { + options.nodes.parseColor = optionsObj.parseColor; + } + if (optionsObj.inheritColor !== undefined) { + options.edges.inheritColor = optionsObj.inheritColor; + } + } - var item = this.itemFromTarget(event); + var gEdges = gephiJSON.edges; + var gNodes = gephiJSON.nodes; + for (var i = 0; i < gEdges.length; i++) { + var edge = {}; + var gEdge = gEdges[i]; + edge['id'] = gEdge.id; + edge['from'] = gEdge.source; + edge['to'] = gEdge.target; + edge['attributes'] = gEdge.attributes; + edge['label'] = gEdge.label; + edge['title'] = gEdge.attributes !== undefined ? gEdge.attributes.title : undefined; + if (gEdge['type'] === 'Directed') { + edge['arrows'] = 'to'; + } + // edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined; + // edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size; + if (gEdge.color && options.inheritColor === false) { + edge['color'] = gEdge.color; + } + edges.push(edge); + } - if (item) { - // multi select items (if allowed) + for (var j = 0; j < gNodes.length; j++) { + var node = {}; + var gNode = gNodes[j]; + node['id'] = gNode.id; + node['attributes'] = gNode.attributes; + node['x'] = gNode.x; + node['y'] = gNode.y; + node['label'] = gNode.label; + node['title'] = gNode.attributes !== undefined ? gNode.attributes.title : gNode.title; + if (options.nodes.parseColor === true) { + node['color'] = gNode.color; + } else { + node['color'] = gNode.color !== undefined ? { background: gNode.color, border: gNode.color, highlight: { background: gNode.color, border: gNode.color }, hover: { background: gNode.color, border: gNode.color } } : undefined; + } + node['size'] = gNode.size; + node['fixed'] = options.nodes.fixed && gNode.x !== undefined && gNode.y !== undefined; + nodes.push(node); + } - var selection = this.options.multiselect ? this.getSelection() // take current selection - : []; // deselect current selection + return { nodes: nodes, edges: edges }; +} - var shiftKey = event.srcEvent && event.srcEvent.shiftKey || false; +exports.parseGephi = parseGephi; - if (shiftKey && this.options.multiselect) { - // select all items between the old selection and the tapped item - var itemGroup = this.itemsData.get(item.id).group; +/***/ }), +/* 116 */ +/***/ (function(module, exports, __webpack_require__) { - // when filtering get the group of the last selected item - var lastSelectedGroup = undefined; - if (this.options.multiselectPerGroup) { - if (selection.length > 0) { - lastSelectedGroup = this.itemsData.get(selection[0]).group; - } - } +"use strict"; - // determine the selection range - if (!this.options.multiselectPerGroup || lastSelectedGroup == undefined || lastSelectedGroup == itemGroup) { - selection.push(item.id); - } - var range = ItemSet._getItemRange(this.itemsData.get(selection, this.itemOptions)); - if (!this.options.multiselectPerGroup || lastSelectedGroup == itemGroup) { - // select all items within the selection range - selection = []; - for (var id in this.items) { - if (this.items.hasOwnProperty(id)) { - var _item = this.items[id]; - var start = _item.data.start; - var end = _item.data.end !== undefined ? _item.data.end : start; +Object.defineProperty(exports, "__esModule", { + value: true +}); - if (start >= range.min && end <= range.max && (!this.options.multiselectPerGroup || lastSelectedGroup == this.itemsData.get(_item.id).group) && !(_item instanceof BackgroundItem)) { - selection.push(_item.id); // do not use id but item.id, id itself is stringified - } - } - } - } - } else { - // add/remove this item from the current selection - var index = selection.indexOf(item.id); - if (index == -1) { - // item is not yet selected -> select it - selection.push(item.id); - } else { - // item is already selected -> deselect it - selection.splice(index, 1); - } - } +var _classCallCheck2 = __webpack_require__(0); - this.setSelection(selection); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - this.body.emitter.emit('select', { - items: this.getSelection(), - event: event - }); - } - }; +var _createClass2 = __webpack_require__(1); - /** - * Calculate the time range of a list of items - * @param {Array.} itemsData - * @return {{min: Date, max: Date}} Returns the range of the provided items - * @private - */ - ItemSet._getItemRange = function (itemsData) { - var max = null; - var min = null; +var _createClass3 = _interopRequireDefault(_createClass2); - itemsData.forEach(function (data) { - if (min == null || data.start < min) { - min = data.start; - } +var _CachedImage = __webpack_require__(185); - if (data.end != undefined) { - if (max == null || data.end > max) { - max = data.end; - } - } else { - if (max == null || data.start > max) { - max = data.start; - } - } - }); +var _CachedImage2 = _interopRequireDefault(_CachedImage); - return { - min: min, - max: max - }; - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /** - * Find an item from an element: - * searches for the attribute 'timeline-item' in the element's tree - * @param {HTMLElement} element - * @return {Item | null} item - */ - ItemSet.prototype.itemFromElement = function (element) { - var cur = element; - while (cur) { - if (cur.hasOwnProperty('timeline-item')) { - return cur['timeline-item']; - } - cur = cur.parentNode; - } +/** + * This callback is a callback that accepts an Image. + * @callback ImageCallback + * @param {Image} image + */ - return null; - }; +/** + * This class loads images and keeps them stored. + * + * @param {ImageCallback} callback + */ +var Images = function () { + /** + * @param {ImageCallback} callback + */ + function Images(callback) { + (0, _classCallCheck3["default"])(this, Images); - /** - * Find an item from an event target: - * searches for the attribute 'timeline-item' in the event target's element tree - * @param {Event} event - * @return {Item | null} item - */ - ItemSet.prototype.itemFromTarget = function (event) { - return this.itemFromElement(event.target); - }; + this.images = {}; + this.imageBroken = {}; + this.callback = callback; + } - /** - * Find an item from an event's related target: - * searches for the attribute 'timeline-item' in the related target's element tree - * @param {Event} event - * @return {Item | null} item - */ - ItemSet.prototype.itemFromRelatedTarget = function (event) { - return this.itemFromElement(event.relatedTarget); - }; + /** + * @param {string} url The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image + * @param {string} brokenUrl Url the broken image to try and load + * @param {Image} imageToLoadBrokenUrlOn The image object + */ - /** - * Find the Group from an event target: - * searches for the attribute 'timeline-group' in the event target's element tree - * @param {Event} event - * @return {Group | null} group - */ - ItemSet.prototype.groupFromTarget = function (event) { - var clientY = event.center ? event.center.y : event.clientY; - var groupIds = this.groupIds; - if (groupIds.length <= 0 && this.groupsData) { - groupIds = this.groupsData.getIds({ - order: this.options.groupOrder - }); - } + (0, _createClass3["default"])(Images, [{ + key: "_tryloadBrokenUrl", + value: function _tryloadBrokenUrl(url, brokenUrl, imageToLoadBrokenUrlOn) { + //If these parameters aren't specified then exit the function because nothing constructive can be done + if (url === undefined || imageToLoadBrokenUrlOn === undefined) return; + if (brokenUrl === undefined) { + console.warn("No broken url image defined"); + return; + } - for (var i = 0; i < groupIds.length; i++) { - var groupId = groupIds[i]; - var group = this.groups[groupId]; - var foreground = group.dom.foreground; - var top = util.getAbsoluteTop(foreground); - if (clientY > top && clientY < top + foreground.offsetHeight) { - return group; - } + //Clear the old subscription to the error event and put a new in place that only handle errors in loading the brokenImageUrl + imageToLoadBrokenUrlOn.onerror = function () { + console.error("Could not load brokenImage:", brokenUrl); + // cache item will contain empty image, this should be OK for default + }; - if (this.options.orientation.item === 'top') { - if (i === this.groupIds.length - 1 && clientY > top) { - return group; + //Set the source of the image to the brokenUrl, this is actually what kicks off the loading of the broken image + imageToLoadBrokenUrlOn.image.src = brokenUrl; } - } else { - if (i === 0 && clientY < top + foreground.offset) { - return group; + + /** + * + * @param {vis.Image} imageToRedrawWith + * @private + */ + + }, { + key: "_redrawWithImage", + value: function _redrawWithImage(imageToRedrawWith) { + if (this.callback) { + this.callback(imageToRedrawWith); + } } - } - } - return null; - }; + /** + * @param {string} url Url of the image + * @param {string} brokenUrl Url of an image to use if the url image is not found + * @return {Image} img The image object + */ - /** - * Find the ItemSet from an event target: - * searches for the attribute 'timeline-itemset' in the event target's element tree - * @param {Event} event - * @return {ItemSet | null} item - */ - ItemSet.itemSetFromTarget = function (event) { - var target = event.target; - while (target) { - if (target.hasOwnProperty('timeline-itemset')) { - return target['timeline-itemset']; - } - target = target.parentNode; - } + }, { + key: "load", + value: function load(url, brokenUrl) { + var _this = this; - return null; - }; + //Try and get the image from the cache, if successful then return the cached image + var cachedImage = this.images[url]; + if (cachedImage) return cachedImage; - /** - * Clone the data of an item, and "normalize" it: convert the start and end date - * to the type (Date, Moment, ...) configured in the DataSet. If not configured, - * start and end are converted to Date. - * @param {Object} itemData, typically `item.data` - * @param {string} [type] Optional Date type. If not provided, the type from the DataSet is taken - * @return {Object} The cloned object - * @private - */ - ItemSet.prototype._cloneItemData = function (itemData, type) { - var clone = util.extend({}, itemData); + //Create a new image + var img = new _CachedImage2["default"](); - if (!type) { - // convert start and end date to the type (Date, Moment, ...) configured in the DataSet - type = this.itemsData.getDataSet()._options.type; - } + // Need to add to cache here, otherwise final return will spawn different copies of the same image, + // Also, there will be multiple loads of the same image. + this.images[url] = img; - if (clone.start != undefined) { - clone.start = util.convert(clone.start, type && type.start || 'Date'); - } - if (clone.end != undefined) { - clone.end = util.convert(clone.end, type && type.end || 'Date'); - } + //Subscribe to the event that is raised if the image loads successfully + img.image.onload = function () { + // Properly init the cached item and then request a redraw + _this._fixImageCoordinates(img.image); + img.init(); + _this._redrawWithImage(img); + }; - return clone; - }; + //Subscribe to the event that is raised if the image fails to load + img.image.onerror = function () { + console.error("Could not load image:", url); + //Try and load the image specified by the brokenUrl using + _this._tryloadBrokenUrl(url, brokenUrl, img); + }; + + //Set the source of the image to the url, this is what actually kicks off the loading of the image + img.image.src = url; + + //Return the new image + return img; + } + + /** + * IE11 fix -- thanks dponch! + * + * Local helper function + * @param {vis.Image} imageToCache + * @private + */ + + }, { + key: "_fixImageCoordinates", + value: function _fixImageCoordinates(imageToCache) { + if (imageToCache.width === 0) { + document.body.appendChild(imageToCache); + imageToCache.width = imageToCache.offsetWidth; + imageToCache.height = imageToCache.offsetHeight; + document.body.removeChild(imageToCache); + } + } + }]); + return Images; +}(); - module.exports = ItemSet; +exports["default"] = Images; /***/ }), -/* 125 */ +/* 117 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - var moment = __webpack_require__(82); - var DateUtil = __webpack_require__(122); - var util = __webpack_require__(1); - /** - * @constructor TimeStep - * The class TimeStep is an iterator for dates. You provide a start date and an - * end date. The class itself determines the best scale (step size) based on the - * provided start Date, end Date, and minimumStep. - * - * If minimumStep is provided, the step size is chosen as close as possible - * to the minimumStep but larger than minimumStep. If minimumStep is not - * provided, the scale is set to 1 DAY. - * The minimumStep should correspond with the onscreen size of about 6 characters - * - * Alternatively, you can set a scale by hand. - * After creation, you can initialize the class by executing first(). Then you - * can iterate from the start date to the end date via next(). You can check if - * the end date is reached with the function hasNext(). After each step, you can - * retrieve the current date via getCurrent(). - * The TimeStep has scales ranging from milliseconds, seconds, minutes, hours, - * days, to years. - * - * Version: 1.2 - * - * @param {Date} [start] The start date, for example new Date(2010, 9, 21) - * or new Date(2010, 9, 21, 23, 45, 00) - * @param {Date} [end] The end date - * @param {Number} [minimumStep] Optional. Minimum step size in milliseconds - */ - function TimeStep(start, end, minimumStep, hiddenDates) { - this.moment = moment; - - // variables - this.current = this.moment(); - this._start = this.moment(); - this._end = this.moment(); - - this.autoScale = true; - this.scale = 'day'; - this.step = 1; - - // initialize the range - this.setRange(start, end, minimumStep); - - // hidden Dates options - this.switchedDay = false; - this.switchedMonth = false; - this.switchedYear = false; - if (Array.isArray(hiddenDates)) { - this.hiddenDates = hiddenDates; - } else if (hiddenDates != undefined) { - this.hiddenDates = [hiddenDates]; - } else { - this.hiddenDates = []; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - this.format = TimeStep.FORMAT; // default formatting - } +var _slicedToArray2 = __webpack_require__(30); - // Time formatting - TimeStep.FORMAT = { - minorLabels: { - millisecond: 'SSS', - second: 's', - minute: 'HH:mm', - hour: 'HH:mm', - weekday: 'ddd D', - day: 'D', - week: 'w', - month: 'MMM', - year: 'YYYY' - }, - majorLabels: { - millisecond: 'HH:mm:ss', - second: 'D MMMM HH:mm', - minute: 'ddd D MMMM', - hour: 'ddd D MMMM', - weekday: 'MMMM YYYY', - day: 'MMMM YYYY', - week: 'MMMM YYYY', - month: 'YYYY', - year: '' - } - }; +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - /** - * Set custom constructor function for moment. Can be used to set dates - * to UTC or to set a utcOffset. - * @param {function} moment - */ - TimeStep.prototype.setMoment = function (moment) { - this.moment = moment; +var _typeof2 = __webpack_require__(6); - // update the date properties, can have a new utcOffset - this.current = this.moment(this.current.valueOf()); - this._start = this.moment(this._start.valueOf()); - this._end = this.moment(this._end.valueOf()); - }; +var _typeof3 = _interopRequireDefault(_typeof2); - /** - * Set custom formatting for the minor an major labels of the TimeStep. - * Both `minorLabels` and `majorLabels` are an Object with properties: - * 'millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'. - * @param {{minorLabels: Object, majorLabels: Object}} format - */ - TimeStep.prototype.setFormat = function (format) { - var defaultFormat = util.deepExtend({}, TimeStep.FORMAT); - this.format = util.deepExtend(defaultFormat, format); - }; +var _classCallCheck2 = __webpack_require__(0); - /** - * Set a new range - * If minimumStep is provided, the step size is chosen as close as possible - * to the minimumStep but larger than minimumStep. If minimumStep is not - * provided, the scale is set to 1 DAY. - * The minimumStep should correspond with the onscreen size of about 6 characters - * @param {Date} [start] The start date and time. - * @param {Date} [end] The end date and time. - * @param {int} [minimumStep] Optional. Minimum step size in milliseconds - */ - TimeStep.prototype.setRange = function (start, end, minimumStep) { - if (!(start instanceof Date) || !(end instanceof Date)) { - throw "No legal start or end date in method setRange"; - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - this._start = start != undefined ? this.moment(start.valueOf()) : new Date(); - this._end = end != undefined ? this.moment(end.valueOf()) : new Date(); +var _createClass2 = __webpack_require__(1); - if (this.autoScale) { - this.setMinimumStep(minimumStep); - } - }; +var _createClass3 = _interopRequireDefault(_createClass2); - /** - * Set the range iterator to the start date. - */ - TimeStep.prototype.start = function () { - this.current = this._start.clone(); - this.roundToMinor(); - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Round the current date to the first minor date value - * This must be executed once when the current date is set to start Date - */ - TimeStep.prototype.roundToMinor = function () { - // round to floor - // to prevent year & month scales rounding down to the first day of week we perform this separately - if (this.scale == 'week') { - this.current.weekday(0); - } - // IMPORTANT: we have no breaks in this switch! (this is no bug) - // noinspection FallThroughInSwitchStatementJS - switch (this.scale) { - case 'year': - this.current.year(this.step * Math.floor(this.current.year() / this.step)); - this.current.month(0); - case 'month': - this.current.date(1); - case 'week': // intentional fall through - case 'day': // intentional fall through - case 'weekday': - this.current.hours(0); - case 'hour': - this.current.minutes(0); - case 'minute': - this.current.seconds(0); - case 'second': - this.current.milliseconds(0); - //case 'millisecond': // nothing to do for milliseconds - } +var util = __webpack_require__(2); +var ComponentUtil = __webpack_require__(48)['default']; +var LabelSplitter = __webpack_require__(191)['default']; - if (this.step != 1) { - // round down to the first minor value that is a multiple of the current step size - switch (this.scale) { - case 'millisecond': - this.current.subtract(this.current.milliseconds() % this.step, 'milliseconds');break; - case 'second': - this.current.subtract(this.current.seconds() % this.step, 'seconds');break; - case 'minute': - this.current.subtract(this.current.minutes() % this.step, 'minutes');break; - case 'hour': - this.current.subtract(this.current.hours() % this.step, 'hours');break; - case 'weekday': // intentional fall through - case 'day': - this.current.subtract((this.current.date() - 1) % this.step, 'day');break; - case 'week': - this.current.subtract(this.current.week() % this.step, 'week');break; - case 'month': - this.current.subtract(this.current.month() % this.step, 'month');break; - case 'year': - this.current.subtract(this.current.year() % this.step, 'year');break; - default: - break; - } - } - }; +/** + * @typedef {'bold'|'ital'|'boldital'|'mono'|'normal'} MultiFontStyle + * + * The allowed specifiers of multi-fonts. + */ + +/** + * @typedef {{color:string, size:number, face:string, mod:string, vadjust:number}} MultiFontOptions + * + * The full set of options of a given multi-font. + */ + +/** + * @typedef {Array.} Pile + * + * Sequence of option objects, the order is significant. + * The sequence is used to determine the value of a given option. + * + * Usage principles: + * + * - All search is done in the sequence of the pile. + * - As soon as a value is found, the searching stops. + * - prototypes are totally ignored. The idea is to add option objects used as prototypes + * to the pile, in the correct order. + */ + +/** + * List of special styles for multi-fonts + * @private + */ +var multiFontStyle = ['bold', 'ital', 'boldital', 'mono']; + +/** + * A Label to be used for Nodes or Edges. + */ + +var Label = function () { /** - * Check if the there is a next step - * @return {boolean} true if the current date has not passed the end date + * @param {Object} body + * @param {Object} options + * @param {boolean} [edgelabel=false] */ - TimeStep.prototype.hasNext = function () { - return this.current.valueOf() <= this._end.valueOf(); - }; + function Label(body, options) { + var edgelabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + (0, _classCallCheck3['default'])(this, Label); + + this.body = body; + this.pointToSelf = false; + this.baseSize = undefined; + this.fontOptions = {}; // instance variable containing the *instance-local* font options + this.setOptions(options); + this.size = { top: 0, left: 0, width: 0, height: 0, yLine: 0 }; + this.isEdgeLabel = edgelabel; + } /** - * Do the next step + * @param {Object} options the options of the parent Node-instance */ - TimeStep.prototype.next = function () { - var prev = this.current.valueOf(); - // Two cases, needed to prevent issues with switching daylight savings - // (end of March and end of October) - switch (this.scale) { - case 'millisecond': - this.current.add(this.step, 'millisecond');break; - case 'second': - this.current.add(this.step, 'second');break; - case 'minute': - this.current.add(this.step, 'minute');break; - case 'hour': - this.current.add(this.step, 'hour'); - if (this.current.month() < 6) { - this.current.subtract(this.current.hours() % this.step, 'hour'); - } else { - if (this.current.hours() % this.step !== 0) { - this.current.add(this.step - this.current.hours() % this.step, 'hour'); - } - } - break; - case 'weekday': // intentional fall through - case 'day': - this.current.add(this.step, 'day');break; - case 'week': - if (this.current.weekday() !== 0) { - // we had a month break not correlating with a week's start before - this.current.weekday(0); // switch back to week cycles - this.current.add(this.step, 'week'); - } else { - // first day of the week - var nextWeek = this.current.clone(); - nextWeek.add(1, 'week'); - if (nextWeek.isSame(this.current, 'month')) { - // is the first day of the next week in the same month? - this.current.add(this.step, 'week'); // the default case - } else { - // inject a step at each first day of the month - this.current.add(this.step, 'week'); - this.current.date(1); + (0, _createClass3['default'])(Label, [{ + key: 'setOptions', + value: function setOptions(options) { + this.elementOptions = options; // Reference to the options of the parent Node-instance + + this.initFontOptions(options.font); + + if (ComponentUtil.isValidLabel(options.label)) { + this.labelDirty = true; + } else { + // Bad label! Change the option value to prevent bad stuff happening + options.label = ''; + } + + if (options.font !== undefined && options.font !== null) { + // font options can be deleted at various levels + if (typeof options.font === 'string') { + this.baseSize = this.fontOptions.size; + } else if ((0, _typeof3['default'])(options.font) === 'object') { + var size = options.font.size; + + if (size !== undefined) { + this.baseSize = size; } } - break; - case 'month': - this.current.add(this.step, 'month');break; - case 'year': - this.current.add(this.step, 'year');break; - default: - break; - } - - if (this.step != 1) { - // round down to the correct major value - switch (this.scale) { - case 'millisecond': - if (this.current.milliseconds() > 0 && this.current.milliseconds() < this.step) this.current.milliseconds(0);break; - case 'second': - if (this.current.seconds() > 0 && this.current.seconds() < this.step) this.current.seconds(0);break; - case 'minute': - if (this.current.minutes() > 0 && this.current.minutes() < this.step) this.current.minutes(0);break; - case 'hour': - if (this.current.hours() > 0 && this.current.hours() < this.step) this.current.hours(0);break; - case 'weekday': // intentional fall through - case 'day': - if (this.current.date() < this.step + 1) this.current.date(1);break; - case 'week': - if (this.current.week() < this.step) this.current.week(1);break; // week numbering starts at 1, not 0 - case 'month': - if (this.current.month() < this.step) this.current.month(0);break; - case 'year': - break; // nothing to do for year - default: - break; } } - // safety mechanism: if current time is still unchanged, move to the end - if (this.current.valueOf() == prev) { - this.current = this._end.clone(); - } + /** + * Init the font Options structure. + * + * Member fontOptions serves as an accumulator for the current font options. + * As such, it needs to be completely separated from the node options. + * + * @param {Object} newFontOptions the new font options to process + * @private + */ - // Reset switches for year, month and day. Will get set to true where appropriate in DateUtil.stepOverHiddenDates - this.switchedDay = false; - this.switchedMonth = false; - this.switchedYear = false; + }, { + key: 'initFontOptions', + value: function initFontOptions(newFontOptions) { + var _this = this; - DateUtil.stepOverHiddenDates(this.moment, this, prev); - }; + // Prepare the multi-font option objects. + // These will be filled in propagateFonts(), if required + util.forEach(multiFontStyle, function (style) { + _this.fontOptions[style] = {}; + }); - /** - * Get the current datetime - * @return {Moment} current The current date - */ - TimeStep.prototype.getCurrent = function () { - return this.current; - }; + // Handle shorthand option, if present + if (Label.parseFontString(this.fontOptions, newFontOptions)) { + this.fontOptions.vadjust = 0; + return; + } - /** - * Set a custom scale. Autoscaling will be disabled. - * For example setScale('minute', 5) will result - * in minor steps of 5 minutes, and major steps of an hour. - * - * @param {{scale: string, step: number}} params - * An object containing two properties: - * - A string 'scale'. Choose from 'millisecond', 'second', - * 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'. - * - A number 'step'. A step size, by default 1. - * Choose for example 1, 2, 5, or 10. - */ - TimeStep.prototype.setScale = function (params) { - if (params && typeof params.scale == 'string') { - this.scale = params.scale; - this.step = params.step > 0 ? params.step : 1; - this.autoScale = false; + // Copy over the non-multifont options, if specified + util.forEach(newFontOptions, function (prop, n) { + if (prop !== undefined && prop !== null && (typeof prop === 'undefined' ? 'undefined' : (0, _typeof3['default'])(prop)) !== 'object') { + _this.fontOptions[n] = prop; + } + }); } - }; - - /** - * Enable or disable autoscaling - * @param {boolean} enable If true, autoascaling is set true - */ - TimeStep.prototype.setAutoScale = function (enable) { - this.autoScale = enable; - }; - /** - * Automatically determine the scale that bests fits the provided minimum step - * @param {Number} [minimumStep] The minimum step size in milliseconds - */ - TimeStep.prototype.setMinimumStep = function (minimumStep) { - if (minimumStep == undefined) { - return; - } + /** + * If in-variable is a string, parse it as a font specifier. + * + * Note that following is not done here and have to be done after the call: + * - No number conversion (size) + * - Not all font options are set (vadjust, mod) + * + * @param {Object} outOptions out-parameter, object in which to store the parse results (if any) + * @param {Object} inOptions font options to parse + * @return {boolean} true if font parsed as string, false otherwise + * @static + */ - //var b = asc + ds; + }, { + key: 'constrain', - var stepYear = 1000 * 60 * 60 * 24 * 30 * 12; - var stepMonth = 1000 * 60 * 60 * 24 * 30; - var stepDay = 1000 * 60 * 60 * 24; - var stepHour = 1000 * 60 * 60; - var stepMinute = 1000 * 60; - var stepSecond = 1000; - var stepMillisecond = 1; - // find the smallest step that is larger than the provided minimumStep - if (stepYear * 1000 > minimumStep) { - this.scale = 'year';this.step = 1000; - } - if (stepYear * 500 > minimumStep) { - this.scale = 'year';this.step = 500; - } - if (stepYear * 100 > minimumStep) { - this.scale = 'year';this.step = 100; - } - if (stepYear * 50 > minimumStep) { - this.scale = 'year';this.step = 50; - } - if (stepYear * 10 > minimumStep) { - this.scale = 'year';this.step = 10; - } - if (stepYear * 5 > minimumStep) { - this.scale = 'year';this.step = 5; - } - if (stepYear > minimumStep) { - this.scale = 'year';this.step = 1; - } - if (stepMonth * 3 > minimumStep) { - this.scale = 'month';this.step = 3; - } - if (stepMonth > minimumStep) { - this.scale = 'month';this.step = 1; - } - if (stepDay * 5 > minimumStep) { - this.scale = 'day';this.step = 5; - } - if (stepDay * 2 > minimumStep) { - this.scale = 'day';this.step = 2; - } - if (stepDay > minimumStep) { - this.scale = 'day';this.step = 1; - } - if (stepDay / 2 > minimumStep) { - this.scale = 'weekday';this.step = 1; - } - if (stepHour * 4 > minimumStep) { - this.scale = 'hour';this.step = 4; - } - if (stepHour > minimumStep) { - this.scale = 'hour';this.step = 1; - } - if (stepMinute * 15 > minimumStep) { - this.scale = 'minute';this.step = 15; - } - if (stepMinute * 10 > minimumStep) { - this.scale = 'minute';this.step = 10; - } - if (stepMinute * 5 > minimumStep) { - this.scale = 'minute';this.step = 5; - } - if (stepMinute > minimumStep) { - this.scale = 'minute';this.step = 1; - } - if (stepSecond * 15 > minimumStep) { - this.scale = 'second';this.step = 15; - } - if (stepSecond * 10 > minimumStep) { - this.scale = 'second';this.step = 10; - } - if (stepSecond * 5 > minimumStep) { - this.scale = 'second';this.step = 5; - } - if (stepSecond > minimumStep) { - this.scale = 'second';this.step = 1; - } - if (stepMillisecond * 200 > minimumStep) { - this.scale = 'millisecond';this.step = 200; - } - if (stepMillisecond * 100 > minimumStep) { - this.scale = 'millisecond';this.step = 100; - } - if (stepMillisecond * 50 > minimumStep) { - this.scale = 'millisecond';this.step = 50; - } - if (stepMillisecond * 10 > minimumStep) { - this.scale = 'millisecond';this.step = 10; - } - if (stepMillisecond * 5 > minimumStep) { - this.scale = 'millisecond';this.step = 5; - } - if (stepMillisecond > minimumStep) { - this.scale = 'millisecond';this.step = 1; - } - }; + /** + * Set the width and height constraints based on 'nearest' value + * + * @param {Array} pile array of option objects to consider + * @returns {object} the actual constraint values to use + * @private + */ + value: function constrain(pile) { + // NOTE: constrainWidth and constrainHeight never set! + // NOTE: for edge labels, only 'maxWdt' set + // Node labels can set all the fields + var fontOptions = { + constrainWidth: false, + maxWdt: -1, + minWdt: -1, + constrainHeight: false, + minHgt: -1, + valign: 'middle' + }; - /** - * Snap a date to a rounded value. - * The snap intervals are dependent on the current scale and step. - * Static function - * @param {Date} date the date to be snapped. - * @param {string} scale Current scale, can be 'millisecond', 'second', - * 'minute', 'hour', 'weekday, 'day', 'week', 'month', 'year'. - * @param {number} step Current step (1, 2, 4, 5, ... - * @return {Date} snappedDate - */ - TimeStep.snap = function (date, scale, step) { - var clone = moment(date); - - if (scale == 'year') { - var year = clone.year() + Math.round(clone.month() / 12); - clone.year(Math.round(year / step) * step); - clone.month(0); - clone.date(0); - clone.hours(0); - clone.minutes(0); - clone.seconds(0); - clone.milliseconds(0); - } else if (scale == 'month') { - if (clone.date() > 15) { - clone.date(1); - clone.add(1, 'month'); - // important: first set Date to 1, after that change the month. - } else { - clone.date(1); - } - - clone.hours(0); - clone.minutes(0); - clone.seconds(0); - clone.milliseconds(0); - } else if (scale == 'week') { - if (clone.weekday() > 2) { - // doing it the momentjs locale aware way - clone.weekday(0); - clone.add(1, 'week'); - } else { - clone.weekday(0); - } - - clone.hours(0); - clone.minutes(0); - clone.seconds(0); - clone.milliseconds(0); - } else if (scale == 'day') { - //noinspection FallthroughInSwitchStatementJS - switch (step) { - case 5: - case 2: - clone.hours(Math.round(clone.hours() / 24) * 24);break; - default: - clone.hours(Math.round(clone.hours() / 12) * 12);break; - } - clone.minutes(0); - clone.seconds(0); - clone.milliseconds(0); - } else if (scale == 'weekday') { - //noinspection FallthroughInSwitchStatementJS - switch (step) { - case 5: - case 2: - clone.hours(Math.round(clone.hours() / 12) * 12);break; - default: - clone.hours(Math.round(clone.hours() / 6) * 6);break; + var widthConstraint = util.topMost(pile, 'widthConstraint'); + if (typeof widthConstraint === 'number') { + fontOptions.maxWdt = Number(widthConstraint); + fontOptions.minWdt = Number(widthConstraint); + } else if ((typeof widthConstraint === 'undefined' ? 'undefined' : (0, _typeof3['default'])(widthConstraint)) === 'object') { + var widthConstraintMaximum = util.topMost(pile, ['widthConstraint', 'maximum']); + if (typeof widthConstraintMaximum === 'number') { + fontOptions.maxWdt = Number(widthConstraintMaximum); + } + var widthConstraintMinimum = util.topMost(pile, ['widthConstraint', 'minimum']); + if (typeof widthConstraintMinimum === 'number') { + fontOptions.minWdt = Number(widthConstraintMinimum); + } } - clone.minutes(0); - clone.seconds(0); - clone.milliseconds(0); - } else if (scale == 'hour') { - switch (step) { - case 4: - clone.minutes(Math.round(clone.minutes() / 60) * 60);break; - default: - clone.minutes(Math.round(clone.minutes() / 30) * 30);break; - } - clone.seconds(0); - clone.milliseconds(0); - } else if (scale == 'minute') { - //noinspection FallthroughInSwitchStatementJS - switch (step) { - case 15: - case 10: - clone.minutes(Math.round(clone.minutes() / 5) * 5); - clone.seconds(0); - break; - case 5: - clone.seconds(Math.round(clone.seconds() / 60) * 60);break; - default: - clone.seconds(Math.round(clone.seconds() / 30) * 30);break; - } - clone.milliseconds(0); - } else if (scale == 'second') { - //noinspection FallthroughInSwitchStatementJS - switch (step) { - case 15: - case 10: - clone.seconds(Math.round(clone.seconds() / 5) * 5); - clone.milliseconds(0); - break; - case 5: - clone.milliseconds(Math.round(clone.milliseconds() / 1000) * 1000);break; - default: - clone.milliseconds(Math.round(clone.milliseconds() / 500) * 500);break; + + var heightConstraint = util.topMost(pile, 'heightConstraint'); + if (typeof heightConstraint === 'number') { + fontOptions.minHgt = Number(heightConstraint); + } else if ((typeof heightConstraint === 'undefined' ? 'undefined' : (0, _typeof3['default'])(heightConstraint)) === 'object') { + var heightConstraintMinimum = util.topMost(pile, ['heightConstraint', 'minimum']); + if (typeof heightConstraintMinimum === 'number') { + fontOptions.minHgt = Number(heightConstraintMinimum); + } + var heightConstraintValign = util.topMost(pile, ['heightConstraint', 'valign']); + if (typeof heightConstraintValign === 'string') { + if (heightConstraintValign === 'top' || heightConstraintValign === 'bottom') { + fontOptions.valign = heightConstraintValign; + } + } } - } else if (scale == 'millisecond') { - var _step = step > 5 ? step / 2 : 1; - clone.milliseconds(Math.round(clone.milliseconds() / _step) * _step); + + return fontOptions; } - return clone; - }; + /** + * Set options and update internal state + * + * @param {Object} options options to set + * @param {Array} pile array of option objects to consider for option 'chosen' + */ - /** - * Check if the current value is a major value (for example when the step - * is DAY, a major value is each first day of the MONTH) - * @return {boolean} true if current date is major, else false. - */ - TimeStep.prototype.isMajor = function () { - if (this.switchedYear == true) { - switch (this.scale) { - case 'year': - case 'month': - case 'week': - case 'weekday': - case 'day': - case 'hour': - case 'minute': - case 'second': - case 'millisecond': - return true; - default: - return false; - } - } else if (this.switchedMonth == true) { - switch (this.scale) { - case 'week': - case 'weekday': - case 'day': - case 'hour': - case 'minute': - case 'second': - case 'millisecond': - return true; - default: - return false; + }, { + key: 'update', + value: function update(options, pile) { + this.setOptions(options, true); + this.propagateFonts(pile); + util.deepExtend(this.fontOptions, this.constrain(pile)); + this.fontOptions.chooser = ComponentUtil.choosify('label', pile); + } + + /** + * When margins are set in an element, adjust sizes is called to remove them + * from the width/height constraints. This must be done prior to label sizing. + * + * @param {{top: number, right: number, bottom: number, left: number}} margins + */ + + }, { + key: 'adjustSizes', + value: function adjustSizes(margins) { + var widthBias = margins ? margins.right + margins.left : 0; + if (this.fontOptions.constrainWidth) { + this.fontOptions.maxWdt -= widthBias; + this.fontOptions.minWdt -= widthBias; } - } else if (this.switchedDay == true) { - switch (this.scale) { - case 'millisecond': - case 'second': - case 'minute': - case 'hour': - return true; - default: - return false; + var heightBias = margins ? margins.top + margins.bottom : 0; + if (this.fontOptions.constrainHeight) { + this.fontOptions.minHgt -= heightBias; } } - var date = this.moment(this.current); - switch (this.scale) { - case 'millisecond': - return date.milliseconds() == 0; - case 'second': - return date.seconds() == 0; - case 'minute': - return date.hours() == 0 && date.minutes() == 0; - case 'hour': - return date.hours() == 0; - case 'weekday': // intentional fall through - case 'day': - return date.date() == 1; - case 'week': - return date.date() == 1; - case 'month': - return date.month() == 0; - case 'year': - return false; - default: - return false; - } - }; + ///////////////////////////////////////////////////////// + // Methods for handling options piles + // Eventually, these will be moved to a separate class + ///////////////////////////////////////////////////////// - /** - * Returns formatted text for the minor axislabel, depending on the current - * date and the scale. For example when scale is MINUTE, the current time is - * formatted as "hh:mm". - * @param {Date} [date] custom date. if not provided, current date is taken - */ - TimeStep.prototype.getLabelMinor = function (date) { - if (date == undefined) { - date = this.current; - } - if (date instanceof Date) { - date = this.moment(date); - } + /** + * Add the font members of the passed list of option objects to the pile. + * + * @param {Pile} dstPile pile of option objects add to + * @param {Pile} srcPile pile of option objects to take font options from + * @private + */ - if (typeof this.format.minorLabels === "function") { - return this.format.minorLabels(date, this.scale, this.step); + }, { + key: 'addFontOptionsToPile', + value: function addFontOptionsToPile(dstPile, srcPile) { + for (var i = 0; i < srcPile.length; ++i) { + this.addFontToPile(dstPile, srcPile[i]); + } } - var format = this.format.minorLabels[this.scale]; - // noinspection FallThroughInSwitchStatementJS - switch (this.scale) { - case 'week': - if (this.isMajor() && date.weekday() !== 0) { - return ""; - } - default: - return format && format.length > 0 ? this.moment(date).format(format) : ''; - } - }; + /** + * Add given font option object to the list of objects (the 'pile') to consider for determining + * multi-font option values. + * + * @param {Pile} pile pile of option objects to use + * @param {object} options instance to add to pile + * @private + */ - /** - * Returns formatted text for the major axis label, depending on the current - * date and the scale. For example when scale is MINUTE, the major scale is - * hours, and the hour will be formatted as "hh". - * @param {Date} [date] custom date. if not provided, current date is taken - */ - TimeStep.prototype.getLabelMajor = function (date) { - if (date == undefined) { - date = this.current; - } - if (date instanceof Date) { - date = this.moment(date); - } + }, { + key: 'addFontToPile', + value: function addFontToPile(pile, options) { + if (options === undefined) return; + if (options.font === undefined || options.font === null) return; - if (typeof this.format.majorLabels === "function") { - return this.format.majorLabels(date, this.scale, this.step); + var item = options.font; + pile.push(item); } - var format = this.format.majorLabels[this.scale]; - return format && format.length > 0 ? this.moment(date).format(format) : ''; - }; + /** + * Collect all own-property values from the font pile that aren't multi-font option objectss. + * + * @param {Pile} pile pile of option objects to use + * @returns {object} object with all current own basic font properties + * @private + */ - TimeStep.prototype.getClassName = function () { - var _moment = this.moment; - var m = this.moment(this.current); - var current = m.locale ? m.locale('en') : m.lang('en'); // old versions of moment have .lang() function - var step = this.step; - var classNames = []; + }, { + key: 'getBasicOptions', + value: function getBasicOptions(pile) { + var ret = {}; - function even(value) { - return value / step % 2 == 0 ? ' vis-even' : ' vis-odd'; - } + // Scans the whole pile to get all options present + for (var n = 0; n < pile.length; ++n) { + var fontOptions = pile[n]; - function today(date) { - if (date.isSame(new Date(), 'day')) { - return ' vis-today'; - } - if (date.isSame(_moment().add(1, 'day'), 'day')) { - return ' vis-tomorrow'; - } - if (date.isSame(_moment().add(-1, 'day'), 'day')) { - return ' vis-yesterday'; - } - return ''; - } + // Convert shorthand if necessary + var tmpShorthand = {}; + if (Label.parseFontString(tmpShorthand, fontOptions)) { + fontOptions = tmpShorthand; + } - function currentWeek(date) { - return date.isSame(new Date(), 'week') ? ' vis-current-week' : ''; - } + util.forEach(fontOptions, function (opt, name) { + if (opt === undefined) return; // multi-font option need not be present + if (ret.hasOwnProperty(name)) return; // Keep first value we encounter - function currentMonth(date) { - return date.isSame(new Date(), 'month') ? ' vis-current-month' : ''; - } + if (multiFontStyle.indexOf(name) !== -1) { + // Skip multi-font properties but we do need the structure + ret[name] = {}; + } else { + ret[name] = opt; + } + }); + } - function currentYear(date) { - return date.isSame(new Date(), 'year') ? ' vis-current-year' : ''; + return ret; } - switch (this.scale) { - case 'millisecond': - classNames.push(today(current)); - classNames.push(even(current.milliseconds())); - break; - case 'second': - classNames.push(today(current)); - classNames.push(even(current.seconds())); - break; - case 'minute': - classNames.push(today(current)); - classNames.push(even(current.minutes())); - break; - case 'hour': - classNames.push('vis-h' + current.hours() + this.step == 4 ? '-h' + (current.hours() + 4) : ''); - classNames.push(today(current)); - classNames.push(even(current.hours())); - break; - case 'weekday': - classNames.push('vis-' + current.format('dddd').toLowerCase()); - classNames.push(today(current)); - classNames.push(currentWeek(current)); - classNames.push(even(current.date())); - break; - case 'day': - classNames.push('vis-day' + current.date()); - classNames.push('vis-' + current.format('MMMM').toLowerCase()); - classNames.push(today(current)); - classNames.push(currentMonth(current)); - classNames.push(this.step <= 2 ? today(current) : ''); - classNames.push(this.step <= 2 ? 'vis-' + current.format('dddd').toLowerCase() : ''); - classNames.push(even(current.date() - 1)); - break; - case 'week': - classNames.push('vis-week' + current.format('w')); - classNames.push(currentWeek(current)); - classNames.push(even(current.week())); - break; - case 'month': - classNames.push('vis-' + current.format('MMMM').toLowerCase()); - classNames.push(currentMonth(current)); - classNames.push(even(current.month())); - break; - case 'year': - classNames.push('vis-year' + current.year()); - classNames.push(currentYear(current)); - classNames.push(even(current.year())); - break; - } - return classNames.filter(String).join(" "); - }; + /** + * Return the value for given option for the given multi-font. + * + * All available option objects are trawled in the set order to construct the option values. + * + * --------------------------------------------------------------------- + * ## Traversal of pile for multi-fonts + * + * The determination of multi-font option values is a special case, because any values not + * present in the multi-font options should by definition be taken from the main font options, + * i.e. from the current 'parent' object of the multi-font option. + * + * ### Search order for multi-fonts + * + * 'bold' used as example: + * + * - search in option group 'bold' in local properties + * - search in main font option group in local properties + * + * --------------------------------------------------------------------- + * + * @param {Pile} pile pile of option objects to use + * @param {MultiFontStyle} multiName sub path for the multi-font + * @param {string} option the option to search for, for the given multi-font + * @returns {string|number} the value for the given option + * @private + */ - module.exports = TimeStep; + }, { + key: 'getFontOption', + value: function getFontOption(pile, multiName, option) { + var multiFont = void 0; -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { + // Search multi font in local properties + for (var n = 0; n < pile.length; ++n) { + var fontOptions = pile[n]; - 'use strict'; + if (fontOptions.hasOwnProperty(multiName)) { + multiFont = fontOptions[multiName]; + if (multiFont === undefined || multiFont === null) continue; + + // Convert shorthand if necessary + // TODO: inefficient to do this conversion every time; find a better way. + var tmpShorthand = {}; + if (Label.parseFontString(tmpShorthand, multiFont)) { + multiFont = tmpShorthand; + } + + if (multiFont.hasOwnProperty(option)) { + return multiFont[option]; + } + } + } - var _keys = __webpack_require__(58); + // Option is not mentioned in the multi font options; take it from the parent font options. + // These have already been converted with getBasicOptions(), so use the converted values. + if (this.fontOptions.hasOwnProperty(option)) { + return this.fontOptions[option]; + } - var _keys2 = _interopRequireDefault(_keys); + // A value **must** be found; you should never get here. + throw new Error("Did not find value for multi-font for property: '" + option + "'"); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * Return all options values for the given multi-font. + * + * All available option objects are trawled in the set order to construct the option values. + * + * @param {Pile} pile pile of option objects to use + * @param {MultiFontStyle} multiName sub path for the mod-font + * @returns {MultiFontOptions} + * @private + */ - var util = __webpack_require__(1); - var stack = __webpack_require__(127); - var RangeItem = __webpack_require__(128); + }, { + key: 'getFontOptions', + value: function getFontOptions(pile, multiName) { + var result = {}; + var optionNames = ['color', 'size', 'face', 'mod', 'vadjust']; // List of allowed options per multi-font - /** - * @constructor Group - * @param {Number | String} groupId - * @param {Object} data - * @param {ItemSet} itemSet - */ - function Group(groupId, data, itemSet) { - this.groupId = groupId; - this.subgroups = {}; - this.subgroupIndex = 0; - this.subgroupOrderer = data && data.subgroupOrder; - this.itemSet = itemSet; - this.isVisible = null; - this.stackDirty = true; // if true, items will be restacked on next redraw - - if (data && data.nestedGroups) { - this.nestedGroups = data.nestedGroups; - if (data.showNested == false) { - this.showNested = false; - } else { - this.showNested = true; + for (var i = 0; i < optionNames.length; ++i) { + var mod = optionNames[i]; + result[mod] = this.getFontOption(pile, multiName, mod); } + + return result; } - this.nestedInGroup = null; + ///////////////////////////////////////////////////////// + // End methods for handling options piles + ///////////////////////////////////////////////////////// - this.dom = {}; - this.props = { - label: { - width: 0, - height: 0 - } - }; - this.className = null; - - this.items = {}; // items filtered by groupId of this group - this.visibleItems = []; // items currently visible in window - this.itemsInRange = []; // items currently in range - this.orderedItems = { - byStart: [], - byEnd: [] - }; - this.checkRangedItems = false; // needed to refresh the ranged items if the window is programatically changed with NO overlap. - var me = this; - this.itemSet.body.emitter.on("checkRangedItems", function () { - me.checkRangedItems = true; - }); - this._create(); + /** + * Collapse the font options for the multi-font to single objects, from + * the chain of option objects passed (the 'pile'). + * + * @param {Pile} pile sequence of option objects to consider. + * First item in list assumed to be the newly set options. + */ - this.setData(data); - } + }, { + key: 'propagateFonts', + value: function propagateFonts(pile) { + var _this2 = this; - /** - * Create DOM elements for the group - * @private - */ - Group.prototype._create = function () { - var label = document.createElement('div'); - if (this.itemSet.options.groupEditable.order) { - label.className = 'vis-label draggable'; - } else { - label.className = 'vis-label'; - } - this.dom.label = label; - - var inner = document.createElement('div'); - inner.className = 'vis-inner'; - label.appendChild(inner); - this.dom.inner = inner; - - var foreground = document.createElement('div'); - foreground.className = 'vis-group'; - foreground['timeline-group'] = this; - this.dom.foreground = foreground; - - this.dom.background = document.createElement('div'); - this.dom.background.className = 'vis-group'; - - this.dom.axis = document.createElement('div'); - this.dom.axis.className = 'vis-group'; - - // create a hidden marker to detect when the Timelines container is attached - // to the DOM, or the style of a parent of the Timeline is changed from - // display:none is changed to visible. - this.dom.marker = document.createElement('div'); - this.dom.marker.style.visibility = 'hidden'; - this.dom.marker.style.position = 'absolute'; - this.dom.marker.innerHTML = ''; - this.dom.background.appendChild(this.dom.marker); - }; + var fontPile = []; // sequence of font objects to consider, order important - /** - * Set the group data for this group - * @param {Object} data Group data, can contain properties content and className - */ - Group.prototype.setData = function (data) { - // update contents - var content; - var templateFunction; + // Note that this.elementOptions is not used here. + this.addFontOptionsToPile(fontPile, pile); + this.fontOptions = this.getBasicOptions(fontPile); - if (this.itemSet.options && this.itemSet.options.groupTemplate) { - templateFunction = this.itemSet.options.groupTemplate.bind(this); - content = templateFunction(data, this.dom.inner); - } else { - content = data && data.content; - } + // We set multifont values even if multi === false, for consistency (things break otherwise) + + var _loop = function _loop(i) { + var mod = multiFontStyle[i]; + var modOptions = _this2.fontOptions[mod]; + var tmpMultiFontOptions = _this2.getFontOptions(fontPile, mod); + + // Copy over found values + util.forEach(tmpMultiFontOptions, function (option, n) { + modOptions[n] = option; + }); - if (content instanceof Element) { - this.dom.inner.appendChild(content); - while (this.dom.inner.firstChild) { - this.dom.inner.removeChild(this.dom.inner.firstChild); + modOptions.size = Number(modOptions.size); + modOptions.vadjust = Number(modOptions.vadjust); + }; + + for (var i = 0; i < multiFontStyle.length; ++i) { + _loop(i); } - this.dom.inner.appendChild(content); - } else if (content instanceof Object) { - templateFunction(data, this.dom.inner); - } else if (content !== undefined && content !== null) { - this.dom.inner.innerHTML = content; - } else { - this.dom.inner.innerHTML = this.groupId || ''; // groupId can be null } - // update title - this.dom.label.title = data && data.title || ''; - if (!this.dom.inner.firstChild) { - util.addClassName(this.dom.inner, 'vis-hidden'); - } else { - util.removeClassName(this.dom.inner, 'vis-hidden'); - } + /** + * Main function. This is called from anything that wants to draw a label. + * @param {CanvasRenderingContext2D} ctx + * @param {number} x + * @param {number} y + * @param {boolean} selected + * @param {boolean} hover + * @param {string} [baseline='middle'] + */ - if (data && data.nestedGroups) { - if (!this.nestedGroups || this.nestedGroups != data.nestedGroups) { - this.nestedGroups = data.nestedGroups; - } + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover) { + var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle'; - if (data.showNested !== undefined || this.showNested === undefined) { - if (data.showNested == false) { - this.showNested = false; - } else { - this.showNested = true; - } - } + // if no label, return + if (this.elementOptions.label === undefined) return; - util.addClassName(this.dom.label, 'vis-nesting-group'); - var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'; - if (this.showNested) { - util.removeClassName(this.dom.label, collapsedDirClassName); - util.addClassName(this.dom.label, 'expanded'); - } else { - util.removeClassName(this.dom.label, 'expanded'); - util.addClassName(this.dom.label, collapsedDirClassName); + // check if we have to render the label + var viewFontSize = this.fontOptions.size * this.body.view.scale; + if (this.elementOptions.label && viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) return; + + // This ensures that there will not be HUGE letters on screen + // by setting an upper limit on the visible text size (regardless of zoomLevel) + if (viewFontSize >= this.elementOptions.scaling.label.maxVisible) { + viewFontSize = Number(this.elementOptions.scaling.label.maxVisible) / this.body.view.scale; } - } else if (this.nestedGroups) { - this.nestedGroups = null; - var collapsedDirClassName = this.itemSet.options.rtl ? 'collapsed-rtl' : 'collapsed'; - util.removeClassName(this.dom.label, collapsedDirClassName); - util.removeClassName(this.dom.label, 'expanded'); - util.removeClassName(this.dom.label, 'vis-nesting-group'); + // update the size cache if required + this.calculateLabelSize(ctx, selected, hover, x, y, baseline); + this._drawBackground(ctx); + this._drawText(ctx, x, this.size.yLine, baseline, viewFontSize); } - if (data && data.nestedInGroup) { - util.addClassName(this.dom.label, 'vis-nested-group'); - if (this.itemSet.options && this.itemSet.options.rtl) { - this.dom.inner.style.paddingRight = '30px'; - } else { - this.dom.inner.style.paddingLeft = '30px'; - } - } + /** + * Draws the label background + * @param {CanvasRenderingContext2D} ctx + * @private + */ - // update className - var className = data && data.className || null; - if (className != this.className) { - if (this.className) { - util.removeClassName(this.dom.label, this.className); - util.removeClassName(this.dom.foreground, this.className); - util.removeClassName(this.dom.background, this.className); - util.removeClassName(this.dom.axis, this.className); + }, { + key: '_drawBackground', + value: function _drawBackground(ctx) { + if (this.fontOptions.background !== undefined && this.fontOptions.background !== "none") { + ctx.fillStyle = this.fontOptions.background; + var size = this.getSize(); + ctx.fillRect(size.left, size.top, size.width, size.height); } - util.addClassName(this.dom.label, className); - util.addClassName(this.dom.foreground, className); - util.addClassName(this.dom.background, className); - util.addClassName(this.dom.axis, className); - this.className = className; } - // update style - if (this.style) { - util.removeCssText(this.dom.label, this.style); - this.style = null; - } - if (data && data.style) { - util.addCssText(this.dom.label, data.style); - this.style = data.style; - } - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x + * @param {number} y + * @param {string} [baseline='middle'] + * @param {number} viewFontSize + * @private + */ - /** - * Get the width of the group label - * @return {number} width - */ - Group.prototype.getLabelWidth = function () { - return this.props.label.width; - }; + }, { + key: '_drawText', + value: function _drawText(ctx, x, y) { + var baseline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'middle'; + var viewFontSize = arguments[4]; - /** - * Repaint this group - * @param {{start: number, end: number}} range - * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin - * @param {boolean} [forceRestack=false] Force restacking of all items - * @return {boolean} Returns true if the group is resized - */ - Group.prototype.redraw = function (range, margin, forceRestack) { - var resized = false; - - // force recalculation of the height of the items when the marker height changed - // (due to the Timeline being attached to the DOM or changed from display:none to visible) - var markerHeight = this.dom.marker.clientHeight; - if (markerHeight != this.lastMarkerHeight) { - this.lastMarkerHeight = markerHeight; - util.forEach(this.items, function (item) { - item.dirty = true; - if (item.displayed) item.redraw(); - }); + var _setAlignment2 = this._setAlignment(ctx, x, y, baseline); - forceRestack = true; - } + var _setAlignment3 = (0, _slicedToArray3['default'])(_setAlignment2, 2); + + x = _setAlignment3[0]; + y = _setAlignment3[1]; - // recalculate the height of the subgroups - this._calculateSubGroupHeights(margin); - // calculate actual size and position - var foreground = this.dom.foreground; - this.top = foreground.offsetTop; - this.right = foreground.offsetLeft; - this.width = foreground.offsetWidth; + ctx.textAlign = 'left'; + x = x - this.size.width / 2; // Shift label 1/2-distance to the left + if (this.fontOptions.valign && this.size.height > this.size.labelHeight) { + if (this.fontOptions.valign === 'top') { + y -= (this.size.height - this.size.labelHeight) / 2; + } + if (this.fontOptions.valign === 'bottom') { + y += (this.size.height - this.size.labelHeight) / 2; + } + } - var lastIsVisible = this.isVisible; - this.isVisible = this._isGroupVisible(range, margin); + // draw the text + for (var i = 0; i < this.lineCount; i++) { + var line = this.lines[i]; + if (line && line.blocks) { + var width = 0; + if (this.isEdgeLabel || this.fontOptions.align === 'center') { + width += (this.size.width - line.width) / 2; + } else if (this.fontOptions.align === 'right') { + width += this.size.width - line.width; + } + for (var j = 0; j < line.blocks.length; j++) { + var block = line.blocks[j]; + ctx.font = block.font; - var restack = forceRestack || this.stackDirty || this.isVisible && !lastIsVisible; + var _getColor2 = this._getColor(block.color, viewFontSize, block.strokeColor), + _getColor3 = (0, _slicedToArray3['default'])(_getColor2, 2), + fontColor = _getColor3[0], + strokeColor = _getColor3[1]; - this._updateSubgroupsSizes(); - // if restacking, reposition visible items vertically - if (restack) { - if (typeof this.itemSet.options.order === 'function') { - // a custom order function - // brute force restack of all items + if (block.strokeWidth > 0) { + ctx.lineWidth = block.strokeWidth; + ctx.strokeStyle = strokeColor; + ctx.lineJoin = 'round'; + } + ctx.fillStyle = fontColor; - // show all items - var me = this; - var limitSize = false; - util.forEach(this.items, function (item) { - if (!item.displayed) { - item.redraw(); - me.visibleItems.push(item); + if (block.strokeWidth > 0) { + ctx.strokeText(block.text, x + width, y + block.vadjust); + } + ctx.fillText(block.text, x + width, y + block.vadjust); + width += block.width; } - item.repositionX(limitSize); - }); + y += line.height; + } + } + } - // order all items and force a restacking - var customOrderedItems = this.orderedItems.byStart.slice().sort(function (a, b) { - return me.itemSet.options.order(a.data, b.data); - }); - stack.stack(customOrderedItems, margin, true /* restack=true */); - this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); - } else { - // no custom order function, lazy stacking - this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x + * @param {number} y + * @param {string} baseline + * @returns {Array.} + * @private + */ - if (this.itemSet.options.stack) { - // TODO: ugly way to access options... - stack.stack(this.visibleItems, margin, true /* restack=true */); + }, { + key: '_setAlignment', + value: function _setAlignment(ctx, x, y, baseline) { + // check for label alignment (for edges) + // TODO: make alignment for nodes + if (this.isEdgeLabel && this.fontOptions.align !== 'horizontal' && this.pointToSelf === false) { + x = 0; + y = 0; + + var lineMargin = 2; + if (this.fontOptions.align === 'top') { + ctx.textBaseline = 'alphabetic'; + y -= 2 * lineMargin; // distance from edge, required because we use alphabetic. Alphabetic has less difference between browsers + } else if (this.fontOptions.align === 'bottom') { + ctx.textBaseline = 'hanging'; + y += 2 * lineMargin; // distance from edge, required because we use hanging. Hanging has less difference between browsers } else { - // no stacking - stack.nostack(this.visibleItems, margin, this.subgroups, this.itemSet.options.stackSubgroups); + ctx.textBaseline = 'middle'; } + } else { + ctx.textBaseline = baseline; } - - this.stackDirty = false; + return [x, y]; } - // recalculate the height of the group - var height = this._calculateHeight(margin); - - // calculate actual size and position - var foreground = this.dom.foreground; - this.top = foreground.offsetTop; - this.right = foreground.offsetLeft; - this.width = foreground.offsetWidth; - resized = util.updateProperty(this, 'height', height) || resized; - // recalculate size of label - resized = util.updateProperty(this.props.label, 'width', this.dom.inner.clientWidth) || resized; - resized = util.updateProperty(this.props.label, 'height', this.dom.inner.clientHeight) || resized; - // apply new height - this.dom.background.style.height = height + 'px'; - this.dom.foreground.style.height = height + 'px'; - this.dom.label.style.height = height + 'px'; + /** + * fade in when relative scale is between threshold and threshold - 1. + * If the relative scale would be smaller than threshold -1 the draw function would have returned before coming here. + * + * @param {string} color The font color to use + * @param {number} viewFontSize + * @param {string} initialStrokeColor + * @returns {Array.} An array containing the font color and stroke color + * @private + */ - // update vertical position of items after they are re-stacked and the height of the group is calculated - for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { - var item = this.visibleItems[i]; - item.repositionY(margin); - if (!this.isVisible && this.groupId != "__background__") { - if (item.displayed) item.hide(); + }, { + key: '_getColor', + value: function _getColor(color, viewFontSize, initialStrokeColor) { + var fontColor = color || '#000000'; + var strokeColor = initialStrokeColor || '#ffffff'; + if (viewFontSize <= this.elementOptions.scaling.label.drawThreshold) { + var opacity = Math.max(0, Math.min(1, 1 - (this.elementOptions.scaling.label.drawThreshold - viewFontSize))); + fontColor = util.overrideOpacity(fontColor, opacity); + strokeColor = util.overrideOpacity(strokeColor, opacity); } + return [fontColor, strokeColor]; } - if (!this.isVisible && this.height) { - return resized = false; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + * @returns {{width: number, height: number}} + */ + + }, { + key: 'getTextSize', + value: function getTextSize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + this._processLabel(ctx, selected, hover); + return { + width: this.size.width, + height: this.size.height, + lineCount: this.lineCount + }; } - return resized; - }; + /** + * Get the current dimensions of the label + * + * @return {rect} + */ - /** - * recalculate the height of the subgroups - * @private - */ - Group.prototype._calculateSubGroupHeights = function (margin) { - if ((0, _keys2['default'])(this.subgroups).length > 0) { - var me = this; + }, { + key: 'getSize', + value: function getSize() { + var lineMargin = 2; + var x = this.size.left; // default values which might be overridden below + var y = this.size.top - 0.5 * lineMargin; // idem - this.resetSubgroups(); + if (this.isEdgeLabel) { + var x2 = -this.size.width * 0.5; - util.forEach(this.visibleItems, function (item) { - if (item.data.subgroup !== undefined) { - me.subgroups[item.data.subgroup].height = Math.max(me.subgroups[item.data.subgroup].height, item.height + margin.item.vertical); - me.subgroups[item.data.subgroup].visible = true; + switch (this.fontOptions.align) { + case 'middle': + x = x2; + y = -this.size.height * 0.5; + break; + case 'top': + x = x2; + y = -(this.size.height + lineMargin); + break; + case 'bottom': + x = x2; + y = lineMargin; + break; } - }); - } - }; + } - /** - * check if group is visible - * @private - */ - Group.prototype._isGroupVisible = function (range, margin) { - var isVisible = this.top <= range.body.domProps.centerContainer.height - range.body.domProps.scrollTop + margin.axis && this.top + this.height + margin.axis >= -range.body.domProps.scrollTop; - return isVisible; - }; + var ret = { + left: x, + top: y, + width: this.size.width, + height: this.size.height + }; - /** - * recalculate the height of the group - * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin - * @returns {number} Returns the height - * @private - */ - Group.prototype._calculateHeight = function (margin) { - // recalculate the height of the group - var height; - var itemsInRange = this.visibleItems; - if (itemsInRange.length > 0) { - var min = itemsInRange[0].top; - var max = itemsInRange[0].top + itemsInRange[0].height; - util.forEach(itemsInRange, function (item) { - min = Math.min(min, item.top); - max = Math.max(max, item.top + item.height); - }); - if (min > margin.axis) { - // there is an empty gap between the lowest item and the axis - var offset = min - margin.axis; - max -= offset; - util.forEach(itemsInRange, function (item) { - item.top -= offset; - }); - } - height = max + margin.item.vertical / 2; - } else { - height = 0; + return ret; } - height = Math.max(height, this.props.label.height); - return height; - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + * @param {number} [x=0] + * @param {number} [y=0] + * @param {'middle'|'hanging'} [baseline='middle'] + */ - /** - * Show this group: attach to the DOM - */ - Group.prototype.show = function () { - if (!this.dom.label.parentNode) { - this.itemSet.dom.labelSet.appendChild(this.dom.label); - } + }, { + key: 'calculateLabelSize', + value: function calculateLabelSize(ctx, selected, hover) { + var x = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + var y = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle'; - if (!this.dom.foreground.parentNode) { - this.itemSet.dom.foreground.appendChild(this.dom.foreground); + this._processLabel(ctx, selected, hover); + this.size.left = x - this.size.width * 0.5; + this.size.top = y - this.size.height * 0.5; + this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.fontOptions.size; + if (baseline === "hanging") { + this.size.top += 0.5 * this.fontOptions.size; + this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers + this.size.yLine += 4; // distance from node + } } - if (!this.dom.background.parentNode) { - this.itemSet.dom.background.appendChild(this.dom.background); - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + * @param {string} mod + * @returns {{color, size, face, mod, vadjust, strokeWidth: *, strokeColor: (*|string|allOptions.edges.font.strokeColor|{string}|allOptions.nodes.font.strokeColor|Array)}} + */ - if (!this.dom.axis.parentNode) { - this.itemSet.dom.axis.appendChild(this.dom.axis); - } - }; + }, { + key: 'getFormattingValues', + value: function getFormattingValues(ctx, selected, hover, mod) { + var getValue = function getValue(fontOptions, mod, option) { + if (mod === "normal") { + if (option === 'mod') return ""; + return fontOptions[option]; + } - /** - * Hide this group: remove from the DOM - */ - Group.prototype.hide = function () { - var label = this.dom.label; - if (label.parentNode) { - label.parentNode.removeChild(label); - } + if (fontOptions[mod][option] !== undefined) { + // Grumbl leaving out test on undefined equals false for "" + return fontOptions[mod][option]; + } else { + // Take from parent font option + return fontOptions[option]; + } + }; - var foreground = this.dom.foreground; - if (foreground.parentNode) { - foreground.parentNode.removeChild(foreground); - } + var values = { + color: getValue(this.fontOptions, mod, 'color'), + size: getValue(this.fontOptions, mod, 'size'), + face: getValue(this.fontOptions, mod, 'face'), + mod: getValue(this.fontOptions, mod, 'mod'), + vadjust: getValue(this.fontOptions, mod, 'vadjust'), + strokeWidth: this.fontOptions.strokeWidth, + strokeColor: this.fontOptions.strokeColor + }; + if (selected || hover) { + if (mod === "normal" && this.fontOptions.chooser === true && this.elementOptions.labelHighlightBold) { + values.mod = 'bold'; + } else { + if (typeof this.fontOptions.chooser === 'function') { + this.fontOptions.chooser(values, this.elementOptions.id, selected, hover); + } + } + } - var background = this.dom.background; - if (background.parentNode) { - background.parentNode.removeChild(background); - } + var fontString = ""; + if (values.mod !== undefined && values.mod !== "") { + // safeguard for undefined - this happened + fontString += values.mod + " "; + } + fontString += values.size + "px " + values.face; - var axis = this.dom.axis; - if (axis.parentNode) { - axis.parentNode.removeChild(axis); + ctx.font = fontString.replace(/"/g, ""); + values.font = ctx.font; + values.height = values.size; + return values; } - }; - /** - * Add an item to the group - * @param {Item} item - */ - Group.prototype.add = function (item) { - this.items[item.id] = item; - item.setParent(this); - this.stackDirty = true; - // add to - if (item.data.subgroup !== undefined) { - this._addToSubgroup(item); - this.orderSubgroups(); - } + /** + * + * @param {boolean} selected + * @param {boolean} hover + * @returns {boolean} + */ - if (this.visibleItems.indexOf(item) == -1) { - var range = this.itemSet.body.range; // TODO: not nice accessing the range like this - this._checkIfVisible(item, this.visibleItems, range); + }, { + key: 'differentState', + value: function differentState(selected, hover) { + return selected !== this.selectedState || hover !== this.hoverState; } - }; - Group.prototype._addToSubgroup = function (item, subgroupId) { - subgroupId = subgroupId || item.data.subgroup; - if (subgroupId != undefined && this.subgroups[subgroupId] === undefined) { - this.subgroups[subgroupId] = { - height: 0, - top: 0, - start: item.data.start, - end: item.data.end, - visible: false, - index: this.subgroupIndex, - items: [] - }; - this.subgroupIndex++; - } + /** + * This explodes the passed text into lines and determines the width, height and number of lines. + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + * @param {string} inText the text to explode + * @returns {{width, height, lines}|*} + * @private + */ - if (new Date(item.data.start) < new Date(this.subgroups[subgroupId].start)) { - this.subgroups[subgroupId].start = item.data.start; - } - if (new Date(item.data.end) > new Date(this.subgroups[subgroupId].end)) { - this.subgroups[subgroupId].end = item.data.end; + }, { + key: '_processLabelText', + value: function _processLabelText(ctx, selected, hover, inText) { + var splitter = new LabelSplitter(ctx, this, selected, hover); + return splitter.process(inText); } - this.subgroups[subgroupId].items.push(item); - }; + /** + * This explodes the label string into lines and sets the width, height and number of lines. + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + * @private + */ - Group.prototype._updateSubgroupsSizes = function () { - var me = this; - if (me.subgroups) { - for (var subgroup in me.subgroups) { - var newStart = me.subgroups[subgroup].items[0].data.start; - var newEnd = me.subgroups[subgroup].items[0].data.end - 1; + }, { + key: '_processLabel', + value: function _processLabel(ctx, selected, hover) { - me.subgroups[subgroup].items.forEach(function (item) { - if (new Date(item.data.start) < new Date(newStart)) { - newStart = item.data.start; - } - if (new Date(item.data.end) > new Date(newEnd)) { - newEnd = item.data.end; - } - }); + if (this.labelDirty === false && !this.differentState(selected, hover)) return; - me.subgroups[subgroup].start = newStart; - me.subgroups[subgroup].end = new Date(newEnd - 1); // -1 to compensate for colliding end to start subgroups; - } - } - }; + var state = this._processLabelText(ctx, selected, hover, this.elementOptions.label); - Group.prototype.orderSubgroups = function () { - if (this.subgroupOrderer !== undefined) { - var sortArray = []; - if (typeof this.subgroupOrderer == 'string') { - for (var subgroup in this.subgroups) { - sortArray.push({ subgroup: subgroup, sortField: this.subgroups[subgroup].items[0].data[this.subgroupOrderer] }); - } - sortArray.sort(function (a, b) { - return a.sortField - b.sortField; - }); - } else if (typeof this.subgroupOrderer == 'function') { - for (var subgroup in this.subgroups) { - sortArray.push(this.subgroups[subgroup].items[0].data); - } - sortArray.sort(this.subgroupOrderer); + if (this.fontOptions.minWdt > 0 && state.width < this.fontOptions.minWdt) { + state.width = this.fontOptions.minWdt; } - if (sortArray.length > 0) { - for (var i = 0; i < sortArray.length; i++) { - this.subgroups[sortArray[i].subgroup].index = i; - } + this.size.labelHeight = state.height; + if (this.fontOptions.minHgt > 0 && state.height < this.fontOptions.minHgt) { + state.height = this.fontOptions.minHgt; } - } - }; - Group.prototype.resetSubgroups = function () { - for (var subgroup in this.subgroups) { - if (this.subgroups.hasOwnProperty(subgroup)) { - this.subgroups[subgroup].visible = false; - this.subgroups[subgroup].height = 0; - } + this.lines = state.lines; + this.lineCount = state.lines.length; + this.size.width = state.width; + this.size.height = state.height; + this.selectedState = selected; + this.hoverState = hover; + + this.labelDirty = false; } - }; - /** - * Remove an item from the group - * @param {Item} item - */ - Group.prototype.remove = function (item) { - delete this.items[item.id]; - item.setParent(null); - this.stackDirty = true; - - // remove from visible items - var index = this.visibleItems.indexOf(item); - if (index != -1) this.visibleItems.splice(index, 1); - - if (item.data.subgroup !== undefined) { - this._removeFromSubgroup(item); - this.orderSubgroups(); - } - }; + /** + * Check if this label is visible + * + * @return {boolean} true if this label will be show, false otherwise + */ - Group.prototype._removeFromSubgroup = function (item, subgroupId) { - subgroupId = subgroupId || item.data.subgroup; - if (subgroupId != undefined) { - var subgroup = this.subgroups[subgroupId]; - if (subgroup) { - var itemIndex = subgroup.items.indexOf(item); - // Check the item is actually in this subgroup. How should items not in the group be handled? - if (itemIndex >= 0) { - subgroup.items.splice(itemIndex, 1); - if (!subgroup.items.length) { - delete this.subgroups[subgroupId]; - } else { - this._updateSubgroupsSizes(); - } - } + }, { + key: 'visible', + value: function visible() { + if (this.size.width === 0 || this.size.height === 0 || this.elementOptions.label === undefined) { + return false; // nothing to display } - } - }; - - /** - * Remove an item from the corresponding DataSet - * @param {Item} item - */ - Group.prototype.removeFromDataSet = function (item) { - this.itemSet.removeItem(item.id); - }; - - /** - * Reorder the items - */ - Group.prototype.order = function () { - var array = util.toArray(this.items); - var startArray = []; - var endArray = []; - for (var i = 0; i < array.length; i++) { - if (array[i].data.end !== undefined) { - endArray.push(array[i]); + var viewFontSize = this.fontOptions.size * this.body.view.scale; + if (viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) { + return false; // Too small or too far away to show } - startArray.push(array[i]); - } - this.orderedItems = { - byStart: startArray, - byEnd: endArray - }; - - stack.orderByStart(this.orderedItems.byStart); - stack.orderByEnd(this.orderedItems.byEnd); - }; - /** - * Update the visible items - * @param {{byStart: Item[], byEnd: Item[]}} orderedItems All items ordered by start date and by end date - * @param {Item[]} visibleItems The previously visible items. - * @param {{start: number, end: number}} range Visible range - * @return {Item[]} visibleItems The new visible items. - * @private - */ - Group.prototype._updateItemsInRange = function (orderedItems, oldVisibleItems, range) { - var visibleItems = []; - var visibleItemsLookup = {}; // we keep this to quickly look up if an item already exists in the list without using indexOf on visibleItems + return true; + } + }], [{ + key: 'parseFontString', + value: function parseFontString(outOptions, inOptions) { + if (!inOptions || typeof inOptions !== 'string') return false; - var interval = (range.end - range.start) / 4; - var lowerBound = range.start - interval; - var upperBound = range.end + interval; + var newOptionsArray = inOptions.split(" "); - // this function is used to do the binary search. - var searchFunction = function searchFunction(value) { - if (value < lowerBound) { - return -1; - } else if (value <= upperBound) { - return 0; - } else { - return 1; - } - }; + outOptions.size = newOptionsArray[0].replace("px", ''); + outOptions.face = newOptionsArray[1]; + outOptions.color = newOptionsArray[2]; - // first check if the items that were in view previously are still in view. - // IMPORTANT: this handles the case for the items with startdate before the window and enddate after the window! - // also cleans up invisible items. - if (oldVisibleItems.length > 0) { - for (var i = 0; i < oldVisibleItems.length; i++) { - this._checkIfVisibleWithReference(oldVisibleItems[i], visibleItems, visibleItemsLookup, range); - } + return true; } + }]); + return Label; +}(); - // we do a binary search for the items that have only start values. - var initialPosByStart = util.binarySearchCustom(orderedItems.byStart, searchFunction, 'data', 'start'); - - // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the start values. - this._traceVisible(initialPosByStart, orderedItems.byStart, visibleItems, visibleItemsLookup, function (item) { - return item.data.start < lowerBound || item.data.start > upperBound; - }); - - // if the window has changed programmatically without overlapping the old window, the ranged items with start < lowerBound and end > upperbound are not shown. - // We therefore have to brute force check all items in the byEnd list - if (this.checkRangedItems == true) { - this.checkRangedItems = false; - for (i = 0; i < orderedItems.byEnd.length; i++) { - this._checkIfVisibleWithReference(orderedItems.byEnd[i], visibleItems, visibleItemsLookup, range); - } - } else { - // we do a binary search for the items that have defined end times. - var initialPosByEnd = util.binarySearchCustom(orderedItems.byEnd, searchFunction, 'data', 'end'); +exports['default'] = Label; - // trace the visible items from the inital start pos both ways until an invisible item is found, we only look at the end values. - this._traceVisible(initialPosByEnd, orderedItems.byEnd, visibleItems, visibleItemsLookup, function (item) { - return item.data.end < lowerBound || item.data.end > upperBound; - }); - } +/***/ }), +/* 118 */ +/***/ (function(module, exports, __webpack_require__) { - // finally, we reposition all the visible items. - for (var i = 0; i < visibleItems.length; i++) { - var item = visibleItems[i]; - if (!item.displayed) item.show(); - // reposition item horizontally - item.repositionX(); - } +"use strict"; - return visibleItems; - }; - Group.prototype._traceVisible = function (initialPos, items, visibleItems, visibleItemsLookup, breakCondition) { - if (initialPos != -1) { - for (var i = initialPos; i >= 0; i--) { - var item = items[i]; - if (breakCondition(item)) { - break; - } else { - if (visibleItemsLookup[item.id] === undefined) { - visibleItemsLookup[item.id] = true; - visibleItems.push(item); - } - } - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - for (var i = initialPos + 1; i < items.length; i++) { - var item = items[i]; - if (breakCondition(item)) { - break; - } else { - if (visibleItemsLookup[item.id] === undefined) { - visibleItemsLookup[item.id] = true; - visibleItems.push(item); - } - } - } - } - }; +var _slicedToArray2 = __webpack_require__(30); - /** - * this function is very similar to the _checkIfInvisible() but it does not - * return booleans, hides the item if it should not be seen and always adds to - * the visibleItems. - * this one is for brute forcing and hiding. - * - * @param {Item} item - * @param {Array} visibleItems - * @param {{start:number, end:number}} range - * @private - */ - Group.prototype._checkIfVisible = function (item, visibleItems, range) { - if (item.isVisible(range)) { - if (!item.displayed) item.show(); - // reposition item horizontally - item.repositionX(); - visibleItems.push(item); - } else { - if (item.displayed) item.hide(); - } - }; +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - /** - * this function is very similar to the _checkIfInvisible() but it does not - * return booleans, hides the item if it should not be seen and always adds to - * the visibleItems. - * this one is for brute forcing and hiding. - * - * @param {Item} item - * @param {Array} visibleItems - * @param {{start:number, end:number}} range - * @private - */ - Group.prototype._checkIfVisibleWithReference = function (item, visibleItems, visibleItemsLookup, range) { - if (item.isVisible(range)) { - if (visibleItemsLookup[item.id] === undefined) { - visibleItemsLookup[item.id] = true; - visibleItems.push(item); - } - } else { - if (item.displayed) item.hide(); - } - }; +var _classCallCheck2 = __webpack_require__(0); - Group.prototype.changeSubgroup = function (item, oldSubgroup, newSubgroup) { - this._removeFromSubgroup(item, oldSubgroup); - this._addToSubgroup(item, newSubgroup); - this.orderSubgroups(); - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - module.exports = Group; +var _createClass2 = __webpack_require__(1); -/***/ }), -/* 127 */ -/***/ (function(module, exports) { +var _createClass3 = _interopRequireDefault(_createClass2); - 'use strict'; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - // Utility functions for ordering and stacking of items - var EPSILON = 0.001; // used when checking collisions, to prevent round-off errors +var util = __webpack_require__(2); +var EndPoints = __webpack_require__(119)["default"]; - /** - * Order items by their start data - * @param {Item[]} items - */ - exports.orderByStart = function (items) { - items.sort(function (a, b) { - return a.data.start - b.data.start; - }); - }; +/** + * The Base Class for all edges. + * + */ +var EdgeBase = function () { /** - * Order items by their end date. If they have no end date, their start date - * is used. - * @param {Item[]} items + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule */ - exports.orderByEnd = function (items) { - items.sort(function (a, b) { - var aTime = 'end' in a.data ? a.data.end : a.data.start, - bTime = 'end' in b.data ? b.data.end : b.data.start; + function EdgeBase(options, body, labelModule) { + (0, _classCallCheck3["default"])(this, EdgeBase); - return aTime - bTime; - }); - }; + this.body = body; + this.labelModule = labelModule; + this.options = {}; + this.setOptions(options); + this.colorDirty = true; + this.color = {}; + this.selectionWidth = 2; + this.hoverWidth = 1.5; + this.fromPoint = this.from; + this.toPoint = this.to; + } /** - * Adjust vertical positions of the items such that they don't overlap each - * other. - * @param {Item[]} items - * All visible items - * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin - * Margins between items and between items and the axis. - * @param {boolean} [force=false] - * If true, all items will be repositioned. If false (default), only - * items having a top===null will be re-stacked + * Connects a node to itself */ - exports.stack = function (items, margin, force) { - if (force) { - // reset top position of all items - for (var i = 0; i < items.length; i++) { - items[i].top = null; - } - } - // calculate new, non-overlapping positions - for (var i = 0; i < items.length; i++) { - var item = items[i]; - if (item.stack && item.top === null) { - // initialize top position - item.top = margin.axis; - - do { - // TODO: optimize checking for overlap. when there is a gap without items, - // you only need to check for items from the next item on, not from zero - var collidingItem = null; - for (var j = 0, jj = items.length; j < jj; j++) { - var other = items[j]; - if (other.top !== null && other !== item && other.stack && exports.collision(item, other, margin.item, other.options.rtl)) { - collidingItem = other; - break; - } - } - if (collidingItem != null) { - // There is a collision. Reposition the items above the colliding element - item.top = collidingItem.top + collidingItem.height + margin.item.vertical; - } - } while (collidingItem); - } + (0, _createClass3["default"])(EdgeBase, [{ + key: "connect", + value: function connect() { + this.from = this.body.nodes[this.options.from]; + this.to = this.body.nodes[this.options.to]; } - }; - /** - * Adjust vertical positions of the items without stacking them - * @param {Item[]} items - * All visible items - * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin - * Margins between items and between items and the axis. - * @param {subgroups[]} subgroups - * All subgroups - */ - exports.nostack = function (items, margin, subgroups, stackSubgroups) { - for (var i = 0; i < items.length; i++) { - if (items[i].data.subgroup == undefined) { - items[i].top = margin.item.vertical; - } else if (items[i].data.subgroup !== undefined && stackSubgroups) { - var newTop = 0; - for (var subgroup in subgroups) { - if (subgroups.hasOwnProperty(subgroup)) { - if (subgroups[subgroup].visible == true && subgroups[subgroup].index < subgroups[items[i].data.subgroup].index) { - newTop += subgroups[subgroup].height; - subgroups[items[i].data.subgroup].top = newTop; - } - } - } - items[i].top = newTop + 0.5 * margin.item.vertical; - } - } - if (!stackSubgroups) { - exports.stackSubgroups(items, margin, subgroups); + /** + * + * @returns {boolean} always false + */ + + }, { + key: "cleanup", + value: function cleanup() { + return false; } - }; - /** - * Adjust vertical positions of the subgroups such that they don't overlap each - * other. - * @param {subgroups[]} subgroups - * All subgroups - * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin - * Margins between items and between items and the axis. - */ - exports.stackSubgroups = function (items, margin, subgroups) { - for (var subgroup in subgroups) { - if (subgroups.hasOwnProperty(subgroup)) { - - subgroups[subgroup].top = 0; - do { - // TODO: optimize checking for overlap. when there is a gap without items, - // you only need to check for items from the next item on, not from zero - var collidingItem = null; - for (var otherSubgroup in subgroups) { - if (subgroups[otherSubgroup].top !== null && otherSubgroup !== subgroup && subgroups[subgroup].index > subgroups[otherSubgroup].index && exports.collisionByTimes(subgroups[subgroup], subgroups[otherSubgroup])) { - collidingItem = subgroups[otherSubgroup]; - break; - } - } + /** + * + * @param {Object} options + */ - if (collidingItem != null) { - // There is a collision. Reposition the subgroups above the colliding element - subgroups[subgroup].top = collidingItem.top + collidingItem.height; - } - } while (collidingItem); - } - } - for (var i = 0; i < items.length; i++) { - if (items[i].data.subgroup !== undefined) { - items[i].top = subgroups[items[i].data.subgroup].top + 0.5 * margin.item.vertical; - } + }, { + key: "setOptions", + value: function setOptions(options) { + this.options = options; + this.from = this.body.nodes[this.options.from]; + this.to = this.body.nodes[this.options.to]; + this.id = this.options.id; } - }; - /** - * Test if the two provided items collide - * The items must have parameters left, width, top, and height. - * @param {Item} a The first item - * @param {Item} b The second item - * @param {{horizontal: number, vertical: number}} margin - * An object containing a horizontal and vertical - * minimum required margin. - * @param {boolean} rtl - * @return {boolean} true if a and b collide, else false - */ - exports.collision = function (a, b, margin, rtl) { - if (rtl) { - return a.right - margin.horizontal + EPSILON < b.right + b.width && a.right + a.width + margin.horizontal - EPSILON > b.right && a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top; - } else { - return a.left - margin.horizontal + EPSILON < b.left + b.width && a.left + a.width + margin.horizontal - EPSILON > b.left && a.top - margin.vertical + EPSILON < b.top + b.height && a.top + a.height + margin.vertical - EPSILON > b.top; - } - }; + /** + * Redraw a edge as a line + * Draw this edge in the given canvas + * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); + * + * @param {CanvasRenderingContext2D} ctx + * @param {Array} values + * @param {boolean} selected + * @param {boolean} hover + * @param {Node} viaNode + * @private + */ - /** - * Test if the two provided objects collide - * The objects must have parameters start, end, top, and height. - * @param {Object} a The first Object - * @param {Object} b The second Object - * @return {boolean} true if a and b collide, else false - */ - exports.collisionByTimes = function (a, b) { - return a.start <= b.start && a.end >= b.start && a.top < b.top + b.height && a.top + a.height > b.top || b.start <= a.start && b.end >= a.start && b.top < a.top + a.height && b.top + b.height > a.top; - }; + }, { + key: "drawLine", + value: function drawLine(ctx, values, selected, hover, viaNode) { + // set style + ctx.strokeStyle = this.getColor(ctx, values, selected, hover); + ctx.lineWidth = values.width; -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { + if (values.dashes !== false) { + this._drawDashedLine(ctx, values, viaNode); + } else { + this._drawLine(ctx, values, viaNode); + } + } - 'use strict'; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {Array} values + * @param {Node} viaNode + * @param {{x: number, y: number}} [fromPoint] + * @param {{x: number, y: number}} [toPoint] + * @private + */ - var Hammer = __webpack_require__(113); - var Item = __webpack_require__(129); + }, { + key: "_drawLine", + value: function _drawLine(ctx, values, viaNode, fromPoint, toPoint) { + if (this.from != this.to) { + // draw line + this._line(ctx, values, viaNode, fromPoint, toPoint); + } else { + var _getCircleData2 = this._getCircleData(ctx), + _getCircleData3 = (0, _slicedToArray3["default"])(_getCircleData2, 3), + x = _getCircleData3[0], + y = _getCircleData3[1], + radius = _getCircleData3[2]; - /** - * @constructor RangeItem - * @extends Item - * @param {Object} data Object containing parameters start, end - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe options - */ - function RangeItem(data, conversion, options) { - this.props = { - content: { - width: 0 - } - }; - this.overflow = false; // if contents can overflow (css styling), this flag is set to true - this.options = options; - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data.id); - } - if (data.end == undefined) { - throw new Error('Property "end" missing in item ' + data.id); + this._circle(ctx, values, x, y, radius); } } - Item.call(this, data, conversion, options); - } - - RangeItem.prototype = new Item(null, null, null); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {Array} values + * @param {Node} viaNode + * @param {{x: number, y: number}} [fromPoint] TODO: Remove in next major release + * @param {{x: number, y: number}} [toPoint] TODO: Remove in next major release + * @private + */ - RangeItem.prototype.baseClassName = 'vis-item vis-range'; + }, { + key: "_drawDashedLine", + value: function _drawDashedLine(ctx, values, viaNode, fromPoint, toPoint) { + // eslint-disable-line no-unused-vars + ctx.lineCap = 'round'; + var pattern = [5, 5]; + if (Array.isArray(values.dashes) === true) { + pattern = values.dashes; + } - /** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ - RangeItem.prototype.isVisible = function (range) { - // determine visibility - return this.data.start < range.end && this.data.end > range.start; - }; + // only firefox and chrome support this method, else we use the legacy one. + if (ctx.setLineDash !== undefined) { + ctx.save(); - /** - * Repaint the item - */ - RangeItem.prototype.redraw = function () { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; + // set dash settings for chrome or firefox + ctx.setLineDash(pattern); + ctx.lineDashOffset = 0; - // background box - dom.box = document.createElement('div'); - // className is updated in redraw() + // draw the line + if (this.from != this.to) { + // draw line + this._line(ctx, values, viaNode); + } else { + var _getCircleData4 = this._getCircleData(ctx), + _getCircleData5 = (0, _slicedToArray3["default"])(_getCircleData4, 3), + x = _getCircleData5[0], + y = _getCircleData5[1], + radius = _getCircleData5[2]; - // frame box (to prevent the item contents from overflowing) - dom.frame = document.createElement('div'); - dom.frame.className = 'vis-item-overflow'; - dom.box.appendChild(dom.frame); + this._circle(ctx, values, x, y, radius); + } - // visible frame box (showing the frame that is always visible) - dom.visibleFrame = document.createElement('div'); - dom.visibleFrame.className = 'vis-item-visible-frame'; - dom.box.appendChild(dom.visibleFrame); + // restore the dash settings. + ctx.setLineDash([0]); + ctx.lineDashOffset = 0; + ctx.restore(); + } else { + // unsupporting smooth lines + if (this.from != this.to) { + // draw line + ctx.dashedLine(this.from.x, this.from.y, this.to.x, this.to.y, pattern); + } else { + var _getCircleData6 = this._getCircleData(ctx), + _getCircleData7 = (0, _slicedToArray3["default"])(_getCircleData6, 3), + _x = _getCircleData7[0], + _y = _getCircleData7[1], + _radius = _getCircleData7[2]; - // contents box - dom.content = document.createElement('div'); - dom.content.className = 'vis-item-content'; - dom.frame.appendChild(dom.content); + this._circle(ctx, values, _x, _y, _radius); + } + // draw shadow if enabled + this.enableShadow(ctx, values); - // attach this item as attribute - dom.box['timeline-item'] = this; + ctx.stroke(); - this.dirty = true; + // disable shadows for other elements. + this.disableShadow(ctx, values); + } } - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); - } - if (!dom.box.parentNode) { - var foreground = this.parent.dom.foreground; - if (!foreground) { - throw new Error('Cannot redraw item: parent has no foreground container element'); + /** + * + * @param {Node} nearNode + * @param {CanvasRenderingContext2D} ctx + * @param {Object} options + * @returns {{x: number, y: number}} + */ + + }, { + key: "findBorderPosition", + value: function findBorderPosition(nearNode, ctx, options) { + if (this.from != this.to) { + return this._findBorderPosition(nearNode, ctx, options); + } else { + return this._findBorderPositionCircle(nearNode, ctx, options); } - foreground.appendChild(dom.box); } - this.displayed = true; - // Update DOM when item is marked dirty. An item is marked dirty when: - // - the item is not yet rendered - // - the item's data is changed - // - the item is selected/deselected - if (this.dirty) { - this._updateContents(this.dom.content); - this._updateDataAttributes(this.dom.box); - this._updateStyle(this.dom.box); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}} + */ + + }, { + key: "findBorderPositions", + value: function findBorderPositions(ctx) { + var from = {}; + var to = {}; + if (this.from != this.to) { + from = this._findBorderPosition(this.from, ctx); + to = this._findBorderPosition(this.to, ctx); + } else { + var _getCircleData$slice = this._getCircleData(ctx).slice(0, 2), + _getCircleData$slice2 = (0, _slicedToArray3["default"])(_getCircleData$slice, 2), + x = _getCircleData$slice2[0], + y = _getCircleData$slice2[1]; - var editable = this.editable.updateTime || this.editable.updateGroup; + from = this._findBorderPositionCircle(this.from, ctx, { x: x, y: y, low: 0.25, high: 0.6, direction: -1 }); + to = this._findBorderPositionCircle(this.from, ctx, { x: x, y: y, low: 0.6, high: 0.8, direction: 1 }); + } + return { from: from, to: to }; + } - // update class - var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); - dom.box.className = this.baseClassName + className; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @returns {Array.} x, y, radius + * @private + */ - // determine from css whether this box has overflow - this.overflow = window.getComputedStyle(dom.frame).overflow !== 'hidden'; + }, { + key: "_getCircleData", + value: function _getCircleData(ctx) { + var x = void 0, + y = void 0; + var node = this.from; + var radius = this.options.selfReferenceSize; - // recalculate size - // turn off max-width to be able to calculate the real width - // this causes an extra browser repaint/reflow, but so be it - this.dom.content.style.maxWidth = 'none'; - this.props.content.width = this.dom.content.offsetWidth; - this.height = this.dom.box.offsetHeight; - this.dom.content.style.maxWidth = ''; + if (ctx !== undefined) { + if (node.shape.width === undefined) { + node.shape.resize(ctx); + } + } - this.dirty = false; + // get circle coordinates + if (node.shape.width > node.shape.height) { + x = node.x + node.shape.width * 0.5; + y = node.y - radius; + } else { + x = node.x + radius; + y = node.y - node.shape.height * 0.5; + } + return [x, y, radius]; } - this._repaintOnItemUpdateTimeTooltip(dom.box); - this._repaintDeleteButton(dom.box); - this._repaintDragCenter(); - this._repaintDragLeft(); - this._repaintDragRight(); - }; + /** + * Get a point on a circle + * @param {number} x + * @param {number} y + * @param {number} radius + * @param {number} percentage - Value between 0 (line start) and 1 (line end) + * @return {Object} point + * @private + */ - /** - * Show the item in the DOM (when not already visible). The items DOM will - * be created when needed. - */ - RangeItem.prototype.show = function () { - if (!this.displayed) { - this.redraw(); + }, { + key: "_pointOnCircle", + value: function _pointOnCircle(x, y, radius, percentage) { + var angle = percentage * 2 * Math.PI; + return { + x: x + radius * Math.cos(angle), + y: y - radius * Math.sin(angle) + }; } - }; - /** - * Hide the item from the DOM (when visible) - * @return {Boolean} changed - */ - RangeItem.prototype.hide = function () { - if (this.displayed) { - var box = this.dom.box; + /** + * This function uses binary search to look for the point where the circle crosses the border of the node. + * @param {Node} node + * @param {CanvasRenderingContext2D} ctx + * @param {Object} options + * @returns {*} + * @private + */ - if (box.parentNode) { - box.parentNode.removeChild(box); + }, { + key: "_findBorderPositionCircle", + value: function _findBorderPositionCircle(node, ctx, options) { + var x = options.x; + var y = options.y; + var low = options.low; + var high = options.high; + var direction = options.direction; + + var maxIterations = 10; + var iteration = 0; + var radius = this.options.selfReferenceSize; + var pos = void 0, + angle = void 0, + distanceToBorder = void 0, + distanceToPoint = void 0, + difference = void 0; + var threshold = 0.05; + var middle = (low + high) * 0.5; + + while (low <= high && iteration < maxIterations) { + middle = (low + high) * 0.5; + + pos = this._pointOnCircle(x, y, radius, middle); + angle = Math.atan2(node.y - pos.y, node.x - pos.x); + distanceToBorder = node.distanceToBorder(ctx, angle); + distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2)); + difference = distanceToBorder - distanceToPoint; + if (Math.abs(difference) < threshold) { + break; // found + } else if (difference > 0) { + // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. + if (direction > 0) { + low = middle; + } else { + high = middle; + } + } else { + if (direction > 0) { + high = middle; + } else { + low = middle; + } + } + iteration++; } + pos.t = middle; - this.displayed = false; + return pos; } - }; - /** - * Reposition the item horizontally - * @param {boolean} [limitSize=true] If true (default), the width of the range - * item will be limited, as the browser cannot - * display very wide divs. This means though - * that the applied left and width may - * not correspond to the ranges start and end - * @Override - */ - RangeItem.prototype.repositionX = function (limitSize) { - var parentWidth = this.parent.width; - var start = this.conversion.toScreen(this.data.start); - var end = this.conversion.toScreen(this.data.end); - var align = this.data.align === undefined ? this.options.align : this.data.align; - var contentStartPosition; - var contentWidth; + /** + * Get the line width of the edge. Depends on width and whether one of the + * connected nodes is selected. + * @param {boolean} selected + * @param {boolean} hover + * @returns {number} width + * @private + */ - // limit the width of the range, as browsers cannot draw very wide divs - if (limitSize === undefined || limitSize === true) { - if (start < -parentWidth) { - start = -parentWidth; - } - if (end > 2 * parentWidth) { - end = 2 * parentWidth; + }, { + key: "getLineWidth", + value: function getLineWidth(selected, hover) { + if (selected === true) { + return Math.max(this.selectionWidth, 0.3 / this.body.view.scale); + } else { + if (hover === true) { + return Math.max(this.hoverWidth, 0.3 / this.body.view.scale); + } else { + return Math.max(this.options.width, 0.3 / this.body.view.scale); + } } } - // add 0.5 to compensate floating-point values rounding - var boxWidth = Math.max(end - start + 0.5, 1); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @param {boolean} selected - Unused + * @param {boolean} hover - Unused + * @returns {string} + */ - if (this.overflow) { - if (this.options.rtl) { - this.right = start; + }, { + key: "getColor", + value: function getColor(ctx, values, selected, hover) { + // eslint-disable-line no-unused-vars + if (values.inheritsColor !== false) { + // when this is a loop edge, just use the 'from' method + if (values.inheritsColor === 'both' && this.from.id !== this.to.id) { + var grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y); + var fromColor = void 0, + toColor = void 0; + fromColor = this.from.options.color.highlight.border; + toColor = this.to.options.color.highlight.border; + + if (this.from.selected === false && this.to.selected === false) { + fromColor = util.overrideOpacity(this.from.options.color.border, values.opacity); + toColor = util.overrideOpacity(this.to.options.color.border, values.opacity); + } else if (this.from.selected === true && this.to.selected === false) { + toColor = this.to.options.color.border; + } else if (this.from.selected === false && this.to.selected === true) { + fromColor = this.from.options.color.border; + } + grd.addColorStop(0, fromColor); + grd.addColorStop(1, toColor); + + // -------------------- this returns -------------------- // + return grd; + } + + if (values.inheritsColor === "to") { + return util.overrideOpacity(this.to.options.color.border, values.opacity); + } else { + // "from" + return util.overrideOpacity(this.from.options.color.border, values.opacity); + } } else { - this.left = start; + return util.overrideOpacity(values.color, values.opacity); } - this.width = boxWidth + this.props.content.width; - contentWidth = this.props.content.width; + } - // Note: The calculation of width is an optimistic calculation, giving - // a width which will not change when moving the Timeline - // So no re-stacking needed, which is nicer for the eye; - } else { - if (this.options.rtl) { - this.right = start; + /** + * Draw a line from a node to itself, a circle + * + * @param {CanvasRenderingContext2D} ctx + * @param {Array} values + * @param {number} x + * @param {number} y + * @param {number} radius + * @private + */ + + }, { + key: "_circle", + value: function _circle(ctx, values, x, y, radius) { + // draw shadow if enabled + this.enableShadow(ctx, values); + + // draw a circle + ctx.beginPath(); + ctx.arc(x, y, radius, 0, 2 * Math.PI, false); + ctx.stroke(); + + // disable shadows for other elements. + this.disableShadow(ctx, values); + } + + /** + * Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2). + * (x3,y3) is the point. + * + * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment + * + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @param {Node} via + * @param {Array} values + * @returns {number} + */ + + }, { + key: "getDistanceToEdge", + value: function getDistanceToEdge(x1, y1, x2, y2, x3, y3, via, values) { + // eslint-disable-line no-unused-vars + var returnValue = 0; + if (this.from != this.to) { + returnValue = this._getDistanceToEdge(x1, y1, x2, y2, x3, y3, via); } else { - this.left = start; + var _getCircleData8 = this._getCircleData(undefined), + _getCircleData9 = (0, _slicedToArray3["default"])(_getCircleData8, 3), + x = _getCircleData9[0], + y = _getCircleData9[1], + radius = _getCircleData9[2]; + + var dx = x - x3; + var dy = y - y3; + returnValue = Math.abs(Math.sqrt(dx * dx + dy * dy) - radius); } - this.width = boxWidth; - contentWidth = Math.min(end - start, this.props.content.width); - } - if (this.options.rtl) { - this.dom.box.style.right = this.right + 'px'; - } else { - this.dom.box.style.left = this.left + 'px'; + return returnValue; } - this.dom.box.style.width = boxWidth + 'px'; - switch (align) { - case 'left': - if (this.options.rtl) { - this.dom.content.style.right = '0'; - } else { - this.dom.content.style.left = '0'; - } - break; + /** + * + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @returns {number} + * @private + */ - case 'right': - if (this.options.rtl) { - this.dom.content.style.right = Math.max(boxWidth - contentWidth, 0) + 'px'; - } else { - this.dom.content.style.left = Math.max(boxWidth - contentWidth, 0) + 'px'; - } - break; + }, { + key: "_getDistanceToLine", + value: function _getDistanceToLine(x1, y1, x2, y2, x3, y3) { + var px = x2 - x1; + var py = y2 - y1; + var something = px * px + py * py; + var u = ((x3 - x1) * px + (y3 - y1) * py) / something; - case 'center': - if (this.options.rtl) { - this.dom.content.style.right = Math.max((boxWidth - contentWidth) / 2, 0) + 'px'; - } else { - this.dom.content.style.left = Math.max((boxWidth - contentWidth) / 2, 0) + 'px'; - } + if (u > 1) { + u = 1; + } else if (u < 0) { + u = 0; + } - break; + var x = x1 + u * px; + var y = y1 + u * py; + var dx = x - x3; + var dy = y - y3; - default: - // 'auto' - // when range exceeds left of the window, position the contents at the left of the visible area - if (this.overflow) { - if (end > 0) { - contentStartPosition = Math.max(-start, 0); + //# Note: If the actual distance does not matter, + //# if you only want to compare what this function + //# returns to other results of this function, you + //# can just return the squared distance instead + //# (i.e. remove the sqrt) to gain a little performance + + return Math.sqrt(dx * dx + dy * dy); + } + + /** + * @param {CanvasRenderingContext2D} ctx + * @param {string} position + * @param {Node} viaNode + * @param {boolean} selected + * @param {boolean} hover + * @param {Array} values + * @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}} + */ + + }, { + key: "getArrowData", + value: function getArrowData(ctx, position, viaNode, selected, hover, values) { + // set lets + var angle = void 0; + var arrowPoint = void 0; + var node1 = void 0; + var node2 = void 0; + var guideOffset = void 0; + var scaleFactor = void 0; + var type = void 0; + var lineWidth = values.width; + + if (position === 'from') { + node1 = this.from; + node2 = this.to; + guideOffset = 0.1; + scaleFactor = values.fromArrowScale; + type = values.fromArrowType; + } else if (position === 'to') { + node1 = this.to; + node2 = this.from; + guideOffset = -0.1; + scaleFactor = values.toArrowScale; + type = values.toArrowType; + } else { + node1 = this.to; + node2 = this.from; + scaleFactor = values.middleArrowScale; + type = values.middleArrowType; + } + + // if not connected to itself + if (node1 != node2) { + if (position !== 'middle') { + // draw arrow head + if (this.options.smooth.enabled === true) { + arrowPoint = this.findBorderPosition(node1, ctx, { via: viaNode }); + var guidePos = this.getPoint(Math.max(0.0, Math.min(1.0, arrowPoint.t + guideOffset)), viaNode); + angle = Math.atan2(arrowPoint.y - guidePos.y, arrowPoint.x - guidePos.x); } else { - contentStartPosition = -contentWidth; // ensure it's not visible anymore + angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); + arrowPoint = this.findBorderPosition(node1, ctx); } } else { - if (start < 0) { - contentStartPosition = -start; - } else { - contentStartPosition = 0; - } + angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); + arrowPoint = this.getPoint(0.5, viaNode); // this is 0.6 to account for the size of the arrow. } - if (this.options.rtl) { - this.dom.content.style.right = contentStartPosition + 'px'; + } else { + // draw circle + var _getCircleData10 = this._getCircleData(ctx), + _getCircleData11 = (0, _slicedToArray3["default"])(_getCircleData10, 3), + x = _getCircleData11[0], + y = _getCircleData11[1], + radius = _getCircleData11[2]; + + if (position === 'from') { + arrowPoint = this.findBorderPosition(this.from, ctx, { x: x, y: y, low: 0.25, high: 0.6, direction: -1 }); + angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; + } else if (position === 'to') { + arrowPoint = this.findBorderPosition(this.from, ctx, { x: x, y: y, low: 0.6, high: 1.0, direction: 1 }); + angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI; } else { - this.dom.content.style.left = contentStartPosition + 'px'; - this.dom.content.style.width = 'calc(100% - ' + contentStartPosition + 'px)'; + arrowPoint = this._pointOnCircle(x, y, radius, 0.175); + angle = 3.9269908169872414; // === 0.175 * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; } + } + + if (position === 'middle' && scaleFactor < 0) lineWidth *= -1; // reversed middle arrow + var length = 15 * scaleFactor + 3 * lineWidth; // 3* lineWidth is the width of the edge. + + var xi = arrowPoint.x - length * 0.9 * Math.cos(angle); + var yi = arrowPoint.y - length * 0.9 * Math.sin(angle); + var arrowCore = { x: xi, y: yi }; + + return { point: arrowPoint, core: arrowCore, angle: angle, length: length, type: type }; } - }; - /** - * Reposition the item vertically - * @Override - */ - RangeItem.prototype.repositionY = function () { - var orientation = this.options.orientation.item; - var box = this.dom.box; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @param {boolean} selected + * @param {boolean} hover + * @param {Object} arrowData + */ - if (orientation == 'top') { - box.style.top = this.top + 'px'; - } else { - box.style.top = this.parent.height - this.top - this.height + 'px'; + }, { + key: "drawArrowHead", + value: function drawArrowHead(ctx, values, selected, hover, arrowData) { + // set style + ctx.strokeStyle = this.getColor(ctx, values, selected, hover); + ctx.fillStyle = ctx.strokeStyle; + ctx.lineWidth = values.width; + + EndPoints.draw(ctx, arrowData); + + // draw shadow if enabled + this.enableShadow(ctx, values); + ctx.fill(); + // disable shadows for other elements. + this.disableShadow(ctx, values); } - }; - /** - * Repaint a drag area on the left side of the range when the range is selected - * @protected - */ - RangeItem.prototype._repaintDragLeft = function () { - if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.options.editable.updateTime && !this.dom.dragLeft) { - // create and show drag area - var dragLeft = document.createElement('div'); - dragLeft.className = 'vis-drag-left'; - dragLeft.dragLeftItem = this; - - this.dom.box.appendChild(dragLeft); - this.dom.dragLeft = dragLeft; - } else if (!this.selected && !this.options.itemsAlwaysDraggable.range && this.dom.dragLeft) { - // delete drag area - if (this.dom.dragLeft.parentNode) { - this.dom.dragLeft.parentNode.removeChild(this.dom.dragLeft); - } - this.dom.dragLeft = null; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ + + }, { + key: "enableShadow", + value: function enableShadow(ctx, values) { + if (values.shadow === true) { + ctx.shadowColor = values.shadowColor; + ctx.shadowBlur = values.shadowSize; + ctx.shadowOffsetX = values.shadowX; + ctx.shadowOffsetY = values.shadowY; + } } - }; - /** - * Repaint a drag area on the right side of the range when the range is selected - * @protected - */ - RangeItem.prototype._repaintDragRight = function () { - if ((this.selected || this.options.itemsAlwaysDraggable.range) && this.options.editable.updateTime && !this.dom.dragRight) { - // create and show drag area - var dragRight = document.createElement('div'); - dragRight.className = 'vis-drag-right'; - dragRight.dragRightItem = this; - - this.dom.box.appendChild(dragRight); - this.dom.dragRight = dragRight; - } else if (!this.selected && !this.options.itemsAlwaysDraggable.range && this.dom.dragRight) { - // delete drag area - if (this.dom.dragRight.parentNode) { - this.dom.dragRight.parentNode.removeChild(this.dom.dragRight); - } - this.dom.dragRight = null; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ + + }, { + key: "disableShadow", + value: function disableShadow(ctx, values) { + if (values.shadow === true) { + ctx.shadowColor = 'rgba(0,0,0,0)'; + ctx.shadowBlur = 0; + ctx.shadowOffsetX = 0; + ctx.shadowOffsetY = 0; + } } - }; + }]); + return EdgeBase; +}(); - module.exports = RangeItem; +exports["default"] = EdgeBase; /***/ }), -/* 129 */ +/* 119 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - var _typeof2 = __webpack_require__(62); +"use strict"; - var _typeof3 = _interopRequireDefault(_typeof2); - var _keys = __webpack_require__(58); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _keys2 = _interopRequireDefault(_keys); +var _getPrototypeOf = __webpack_require__(3); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var Hammer = __webpack_require__(113); - var util = __webpack_require__(1); - var moment = __webpack_require__(82); +var _possibleConstructorReturn2 = __webpack_require__(4); - /** - * @constructor Item - * @param {Object} data Object containing (optional) parameters type, - * start, end, content, group, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} options Configuration options - * // TODO: describe available options - */ - function Item(data, conversion, options) { - this.id = null; - this.parent = null; - this.data = data; - this.dom = null; - this.conversion = conversion || {}; - this.options = options || {}; - this.selected = false; - this.displayed = false; - this.groupShowing = true; - this.dirty = true; +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - this.top = null; - this.right = null; - this.left = null; - this.width = null; - this.height = null; +var _inherits2 = __webpack_require__(5); - this.editable = null; - this._updateEditStatus(); - } +var _inherits3 = _interopRequireDefault(_inherits2); - Item.prototype.stack = true; +var _classCallCheck2 = __webpack_require__(0); - /** - * Select current item - */ - Item.prototype.select = function () { - this.selected = true; - this.dirty = true; - if (this.displayed) this.redraw(); - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * Unselect current item - */ - Item.prototype.unselect = function () { - this.selected = false; - this.dirty = true; - if (this.displayed) this.redraw(); - }; +var _createClass2 = __webpack_require__(1); - /** - * Set data for the item. Existing data will be updated. The id should not - * be changed. When the item is displayed, it will be redrawn immediately. - * @param {Object} data - */ - Item.prototype.setData = function (data) { - var groupChanged = data.group != undefined && this.data.group != data.group; - if (groupChanged && this.parent != null) { - this.parent.itemSet._moveToGroup(this, data.group); - } - this.parent.stackDirty = true; +var _createClass3 = _interopRequireDefault(_createClass2); - var subGroupChanged = data.subgroup != undefined && this.data.subgroup != data.subgroup; - if (subGroupChanged && this.parent != null) { - this.parent.changeSubgroup(this, this.data.subgroup, data.subgroup); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - this.data = data; - this._updateEditStatus(); - this.dirty = true; - if (this.displayed) this.redraw(); - }; +/** ============================================================================ + * Location of all the endpoint drawing routines. + * + * Every endpoint has its own drawing routine, which contains an endpoint definition. + * + * The endpoint definitions must have the following properies: + * + * - (0,0) is the connection point to the node it attaches to + * - The endpoints are orientated to the positive x-direction + * - The length of the endpoint is at most 1 + * + * As long as the endpoint classes remain simple and not too numerous, they will + * be contained within this module. + * All classes here except `EndPoints` should be considered as private to this module. + * + * ----------------------------------------------------------------------------- + * ### Further Actions + * + * After adding a new endpoint here, you also need to do the following things: + * + * - Add the new endpoint name to `network/options.js` in array `endPoints`. + * - Add the new endpoint name to the documentation. + * Scan for 'arrows.to.type` and add it to the description. + * - Add the endpoint to the examples. At the very least, add it to example + * `edgeStyles/arrowTypes`. + * ============================================================================= */ + +// NOTE: When a typedef is isolated in a separate comment block, an actual description is generated for it, +// using the rest of the commenting in the code block. Usage of typedef in other comments then +// link to there. TIL. +// +// Also noteworthy, all typedef's set up in this manner are collected in a single, global page 'global.html'. +// In other words, it doesn't matter *where* the typedef's are defined in the code. +// +// +// TODO: add descriptive commenting to given typedef's - /** - * Set a parent for the item - * @param {Group} parent - */ - Item.prototype.setParent = function (parent) { - if (this.displayed) { - this.hide(); - this.parent = parent; - if (this.parent) { - this.show(); - } - } else { - this.parent = parent; - } - }; +/** + * @typedef {{type:string, point:Point, angle:number, length:number}} ArrowData + * + * Object containing instantiation data for a given endpoint. + */ - /** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ - Item.prototype.isVisible = function (range) { - return false; - }; +/** + * @typedef {{x:number, y:number}} Point + * + * A point in view-coordinates. + */ - /** - * Show the Item in the DOM (when not already visible) - * @return {Boolean} changed - */ - Item.prototype.show = function () { - return false; - }; +/** + * Common methods for endpoints + * + * @class + */ +var EndPoint = function () { + function EndPoint() { + (0, _classCallCheck3['default'])(this, EndPoint); + } - /** - * Hide the Item from the DOM (when visible) - * @return {Boolean} changed - */ - Item.prototype.hide = function () { - return false; - }; + (0, _createClass3['default'])(EndPoint, null, [{ + key: 'transform', - /** - * Repaint the item - */ - Item.prototype.redraw = function () { - // should be implemented by the item - }; - /** - * Reposition the Item horizontally - */ - Item.prototype.repositionX = function () { - // should be implemented by the item - }; + /** + * Apply transformation on points for display. + * + * The following is done: + * - rotate by the specified angle + * - multiply the (normalized) coordinates by the passed length + * - offset by the target coordinates + * + * @param {Array} points + * @param {ArrowData} arrowData + * @static + */ + value: function transform(points, arrowData) { + if (!(points instanceof Array)) { + points = [points]; + } - /** - * Reposition the Item vertically - */ - Item.prototype.repositionY = function () { - // should be implemented by the item - }; + var x = arrowData.point.x; + var y = arrowData.point.y; + var angle = arrowData.angle; + var length = arrowData.length; - /** - * Repaint a drag area on the center of the item when the item is selected - * @protected - */ - Item.prototype._repaintDragCenter = function () { - if (this.selected && this.options.editable.updateTime && !this.dom.dragCenter) { - var me = this; - // create and show drag area - var dragCenter = document.createElement('div'); - dragCenter.className = 'vis-drag-center'; - dragCenter.dragCenterItem = this; - var hammer = new Hammer(dragCenter); - - hammer.on('tap', function (event) { - me.parent.itemSet.body.emitter.emit('click', { - event: event, - item: me.id - }); - }); - hammer.on('doubletap', function (event) { - event.stopPropagation(); - me.parent.itemSet._onUpdateItem(me); - me.parent.itemSet.body.emitter.emit('doubleClick', { - event: event, - item: me.id - }); - }); + for (var i = 0; i < points.length; ++i) { + var p = points[i]; + var xt = p.x * Math.cos(angle) - p.y * Math.sin(angle); + var yt = p.x * Math.sin(angle) + p.y * Math.cos(angle); - if (this.dom.box) { - if (this.dom.dragLeft) { - this.dom.box.insertBefore(dragCenter, this.dom.dragLeft); - } else { - this.dom.box.appendChild(dragCenter); - } - } else if (this.dom.point) { - this.dom.point.appendChild(dragCenter); + p.x = x + length * xt; + p.y = y + length * yt; } + } + + /** + * Draw a closed path using the given real coordinates. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Array.} points + * @static + */ - this.dom.dragCenter = dragCenter; - } else if (!this.selected && this.dom.dragCenter) { - // delete drag area - if (this.dom.dragCenter.parentNode) { - this.dom.dragCenter.parentNode.removeChild(this.dom.dragCenter); + }, { + key: 'drawPath', + value: function drawPath(ctx, points) { + ctx.beginPath(); + ctx.moveTo(points[0].x, points[0].y); + for (var i = 1; i < points.length; ++i) { + ctx.lineTo(points[i].x, points[i].y); } - this.dom.dragCenter = null; + ctx.closePath(); } - }; + }]); + return EndPoint; +}(); - /** - * Repaint a delete button on the top right of the item when the item is selected - * @param {HTMLElement} anchor - * @protected - */ - Item.prototype._repaintDeleteButton = function (anchor) { - var editable = (this.options.editable.overrideItems || this.editable == null) && this.options.editable.remove || !this.options.editable.overrideItems && this.editable != null && this.editable.remove; +/** + * Drawing methods for the arrow endpoint. + * @extends EndPoint + */ - if (this.selected && editable && !this.dom.deleteButton) { - // create and show button - var me = this; - var deleteButton = document.createElement('div'); +var Arrow = function (_EndPoint) { + (0, _inherits3['default'])(Arrow, _EndPoint); - if (this.options.rtl) { - deleteButton.className = 'vis-delete-rtl'; - } else { - deleteButton.className = 'vis-delete'; - } - deleteButton.title = 'Delete this item'; + function Arrow() { + (0, _classCallCheck3['default'])(this, Arrow); + return (0, _possibleConstructorReturn3['default'])(this, (Arrow.__proto__ || (0, _getPrototypeOf2['default'])(Arrow)).apply(this, arguments)); + } - // TODO: be able to destroy the delete button - new Hammer(deleteButton).on('tap', function (event) { - event.stopPropagation(); - me.parent.removeFromDataSet(me); - }); + (0, _createClass3['default'])(Arrow, null, [{ + key: 'draw', - anchor.appendChild(deleteButton); - this.dom.deleteButton = deleteButton; - } else if (!this.selected && this.dom.deleteButton) { - // remove button - if (this.dom.deleteButton.parentNode) { - this.dom.deleteButton.parentNode.removeChild(this.dom.deleteButton); - } - this.dom.deleteButton = null; + + /** + * Draw this shape at the end of a line. + * + * @param {CanvasRenderingContext2D} ctx + * @param {ArrowData} arrowData + * @static + */ + value: function draw(ctx, arrowData) { + // Normalized points of closed path, in the order that they should be drawn. + // (0, 0) is the attachment point, and the point around which should be rotated + var points = [{ x: 0, y: 0 }, { x: -1, y: 0.3 }, { x: -0.9, y: 0 }, { x: -1, y: -0.3 }]; + + EndPoint.transform(points, arrowData); + EndPoint.drawPath(ctx, points); } - }; + }]); + return Arrow; +}(EndPoint); - /** - * Repaint a onChange tooltip on the top right of the item when the item is selected - * @param {HTMLElement} anchor - * @protected - */ - Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) { - if (!this.options.tooltipOnItemUpdateTime) return; +/** + * Drawing methods for the circle endpoint. + */ - var editable = (this.options.editable.updateTime || this.data.editable === true) && this.data.editable !== false; - if (this.selected && editable && !this.dom.onItemUpdateTimeTooltip) { - // create and show tooltip - var me = this; +var Circle = function () { + function Circle() { + (0, _classCallCheck3['default'])(this, Circle); + } - var onItemUpdateTimeTooltip = document.createElement('div'); + (0, _createClass3['default'])(Circle, null, [{ + key: 'draw', - onItemUpdateTimeTooltip.className = 'vis-onUpdateTime-tooltip'; - anchor.appendChild(onItemUpdateTimeTooltip); - this.dom.onItemUpdateTimeTooltip = onItemUpdateTimeTooltip; - } else if (!this.selected && this.dom.onItemUpdateTimeTooltip) { - // remove button - if (this.dom.onItemUpdateTimeTooltip.parentNode) { - this.dom.onItemUpdateTimeTooltip.parentNode.removeChild(this.dom.onItemUpdateTimeTooltip); - } - this.dom.onItemUpdateTimeTooltip = null; + + /** + * Draw this shape at the end of a line. + * + * @param {CanvasRenderingContext2D} ctx + * @param {ArrowData} arrowData + * @static + */ + value: function draw(ctx, arrowData) { + var point = { x: -0.4, y: 0 }; + + EndPoint.transform(point, arrowData); + ctx.circle(point.x, point.y, arrowData.length * 0.4); } + }]); + return Circle; +}(); - // position onChange tooltip - if (this.dom.onItemUpdateTimeTooltip) { +/** + * Drawing methods for the bar endpoint. + */ - // only show when editing - this.dom.onItemUpdateTimeTooltip.style.visibility = this.parent.itemSet.touchParams.itemIsDragging ? 'visible' : 'hidden'; - // position relative to item's content - if (this.options.rtl) { - this.dom.onItemUpdateTimeTooltip.style.right = this.dom.content.style.right; - } else { - this.dom.onItemUpdateTimeTooltip.style.left = this.dom.content.style.left; - } +var Bar = function () { + function Bar() { + (0, _classCallCheck3['default'])(this, Bar); + } - // position above or below the item depending on the item's position in the window - var tooltipOffset = 50; // TODO: should be tooltip height (depends on template) - var scrollTop = this.parent.itemSet.body.domProps.scrollTop; + (0, _createClass3['default'])(Bar, null, [{ + key: 'draw', - // TODO: this.top for orientation:true is actually the items distance from the bottom... - // (should be this.bottom) - var itemDistanceFromTop; - if (this.options.orientation.item == 'top') { - itemDistanceFromTop = this.top; - } else { - itemDistanceFromTop = this.parent.height - this.top - this.height; - } - var isCloseToTop = itemDistanceFromTop + this.parent.top - tooltipOffset < -scrollTop; - if (isCloseToTop) { - this.dom.onItemUpdateTimeTooltip.style.bottom = ""; - this.dom.onItemUpdateTimeTooltip.style.top = this.height + 2 + "px"; - } else { - this.dom.onItemUpdateTimeTooltip.style.top = ""; - this.dom.onItemUpdateTimeTooltip.style.bottom = this.height + 2 + "px"; - } + /** + * Draw this shape at the end of a line. + * + * @param {CanvasRenderingContext2D} ctx + * @param {ArrowData} arrowData + * @static + */ + value: function draw(ctx, arrowData) { + /* + var points = [ + {x:0, y:0.5}, + {x:0, y:-0.5} + ]; + + EndPoint.transform(points, arrowData); + ctx.beginPath(); + ctx.moveTo(points[0].x, points[0].y); + ctx.lineTo(points[1].x, points[1].y); + ctx.stroke(); + */ - // handle tooltip content - var content; - var templateFunction; + var points = [{ x: 0, y: 0.5 }, { x: 0, y: -0.5 }, { x: -0.15, y: -0.5 }, { x: -0.15, y: 0.5 }]; - if (this.options.tooltipOnItemUpdateTime && this.options.tooltipOnItemUpdateTime.template) { - templateFunction = this.options.tooltipOnItemUpdateTime.template.bind(this); - content = templateFunction(this.data); - } else { - content = 'start: ' + moment(this.data.start).format('MM/DD/YYYY hh:mm'); - if (this.data.end) { - content += '
end: ' + moment(this.data.end).format('MM/DD/YYYY hh:mm'); - } - } - this.dom.onItemUpdateTimeTooltip.innerHTML = content; + EndPoint.transform(points, arrowData); + EndPoint.drawPath(ctx, points); } - }; + }]); + return Bar; +}(); - /** - * Set HTML contents for the item - * @param {Element} element HTML element to fill with the contents - * @private - */ - Item.prototype._updateContents = function (element) { - var content; - var templateFunction; - var itemVisibleFrameContent; - var visibleFrameTemplateFunction; - var itemData = this.parent.itemSet.itemsData.get(this.id); // get a clone of the data from the dataset - - var frameElement = this.dom.box || this.dom.point; - var itemVisibleFrameContentElement = frameElement.getElementsByClassName('vis-item-visible-frame')[0]; - - if (this.options.visibleFrameTemplate) { - visibleFrameTemplateFunction = this.options.visibleFrameTemplate.bind(this); - itemVisibleFrameContent = visibleFrameTemplateFunction(itemData, frameElement); - } else { - itemVisibleFrameContent = ''; - } - - if (itemVisibleFrameContentElement) { - if (itemVisibleFrameContent instanceof Object && !(itemVisibleFrameContent instanceof Element)) { - visibleFrameTemplateFunction(itemData, itemVisibleFrameContentElement); - } else { - var changed = this._contentToString(this.itemVisibleFrameContent) !== this._contentToString(itemVisibleFrameContent); - if (changed) { - // only replace the content when changed - if (itemVisibleFrameContent instanceof Element) { - itemVisibleFrameContentElement.innerHTML = ''; - itemVisibleFrameContentElement.appendChild(itemVisibleFrameContent); - } else if (itemVisibleFrameContent != undefined) { - itemVisibleFrameContentElement.innerHTML = itemVisibleFrameContent; - } else { - if (!(this.data.type == 'background' && this.data.content === undefined)) { - throw new Error('Property "content" missing in item ' + this.id); - } - } - - this.itemVisibleFrameContent = itemVisibleFrameContent; - } - } - } +/** + * Drawing methods for the endpoints. + */ - if (this.options.template) { - templateFunction = this.options.template.bind(this); - content = templateFunction(itemData, element, this.data); - } else { - content = this.data.content; - } - if (content instanceof Object && !(content instanceof Element)) { - templateFunction(itemData, element); - } else { - var changed = this._contentToString(this.content) !== this._contentToString(content); - if (changed) { - // only replace the content when changed - if (content instanceof Element) { - element.innerHTML = ''; - element.appendChild(content); - } else if (content != undefined) { - element.innerHTML = content; - } else { - if (!(this.data.type == 'background' && this.data.content === undefined)) { - throw new Error('Property "content" missing in item ' + this.id); - } - } - this.content = content; - } - } - }; +var EndPoints = function () { + function EndPoints() { + (0, _classCallCheck3['default'])(this, EndPoints); + } - /** - * Process dataAttributes timeline option and set as data- attributes on dom.content - * @param {Element} element HTML element to which the attributes will be attached - * @private - */ - Item.prototype._updateDataAttributes = function (element) { - if (this.options.dataAttributes && this.options.dataAttributes.length > 0) { - var attributes = []; - - if (Array.isArray(this.options.dataAttributes)) { - attributes = this.options.dataAttributes; - } else if (this.options.dataAttributes == 'all') { - attributes = (0, _keys2['default'])(this.data); - } else { - return; - } + (0, _createClass3['default'])(EndPoints, null, [{ + key: 'draw', - for (var i = 0; i < attributes.length; i++) { - var name = attributes[i]; - var value = this.data[name]; - if (value != null) { - element.setAttribute('data-' + name, value); - } else { - element.removeAttribute('data-' + name); - } + /** + * Draw an endpoint + * + * @param {CanvasRenderingContext2D} ctx + * @param {ArrowData} arrowData + * @static + */ + value: function draw(ctx, arrowData) { + var type; + if (arrowData.type) { + type = arrowData.type.toLowerCase(); } - } - }; - - /** - * Update custom styles of the element - * @param element - * @private - */ - Item.prototype._updateStyle = function (element) { - // remove old styles - if (this.style) { - util.removeCssText(element, this.style); - this.style = null; - } - - // append new styles - if (this.data.style) { - util.addCssText(element, this.data.style); - this.style = this.data.style; - } - }; - - /** - * Stringify the items contents - * @param {string | Element | undefined} content - * @returns {string | undefined} - * @private - */ - Item.prototype._contentToString = function (content) { - if (typeof content === 'string') return content; - if (content && 'outerHTML' in content) return content.outerHTML; - return content; - }; - /** - * Update the editability of this item. - */ - Item.prototype._updateEditStatus = function () { - if (this.options) { - if (typeof this.options.editable === 'boolean') { - this.editable = { - updateTime: this.options.editable, - updateGroup: this.options.editable, - remove: this.options.editable - }; - } else if ((0, _typeof3['default'])(this.options.editable) === 'object') { - this.editable = {}; - util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.options.editable); - }; - } - // Item data overrides, except if options.editable.overrideItems is set. - if (!this.options || !this.options.editable || this.options.editable.overrideItems !== true) { - if (this.data) { - if (typeof this.data.editable === 'boolean') { - this.editable = { - updateTime: this.data.editable, - updateGroup: this.data.editable, - remove: this.data.editable - }; - } else if ((0, _typeof3['default'])(this.data.editable) === 'object') { - // TODO: in vis.js 5.0, we should change this to not reset options from the timeline configuration. - // Basically just remove the next line... - this.editable = {}; - util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.data.editable); - } + switch (type) { + case 'circle': + Circle.draw(ctx, arrowData); + break; + case 'bar': + Bar.draw(ctx, arrowData); + break; + case 'arrow': // fall-through + default: + Arrow.draw(ctx, arrowData); } } - }; + }]); + return EndPoints; +}(); - /** - * Return the width of the item left from its start date - * @return {number} - */ - Item.prototype.getWidthLeft = function () { - return 0; - }; +exports['default'] = EndPoints; - /** - * Return the width of the item right from the max of its start and end date - * @return {number} - */ - Item.prototype.getWidthRight = function () { - return 0; - }; +/***/ }), +/* 120 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Return the title of the item - * @return {string | undefined} - */ - Item.prototype.getTitle = function () { - return this.data.title; - }; +"use strict"; - module.exports = Item; -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, "__esModule", { + value: true +}); - 'use strict'; +var _classCallCheck2 = __webpack_require__(0); - var _create = __webpack_require__(55); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _create2 = _interopRequireDefault(_create); +var _createClass2 = __webpack_require__(1); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _createClass3 = _interopRequireDefault(_createClass2); - var util = __webpack_require__(1); - var Group = __webpack_require__(126); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/** + * Barnes Hut Solver + */ +var BarnesHutSolver = function () { /** - * @constructor BackgroundGroup - * @param {Number | String} groupId - * @param {Object} data - * @param {ItemSet} itemSet + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options */ - function BackgroundGroup(groupId, data, itemSet) { - Group.call(this, groupId, data, itemSet); + function BarnesHutSolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, BarnesHutSolver); - this.width = 0; - this.height = 0; - this.top = 0; - this.left = 0; - } + this.body = body; + this.physicsBody = physicsBody; + this.barnesHutTree; + this.setOptions(options); + this.randomSeed = 5; - BackgroundGroup.prototype = (0, _create2['default'])(Group.prototype); + // debug: show grid + // this.body.emitter.on("afterDrawing", (ctx) => {this._debug(ctx,'#ff0000')}) + } /** - * Repaint this group - * @param {{start: number, end: number}} range - * @param {{item: {horizontal: number, vertical: number}, axis: number}} margin - * @param {boolean} [forceRestack=false] Force restacking of all items - * @return {boolean} Returns true if the group is resized + * + * @param {Object} options */ - BackgroundGroup.prototype.redraw = function (range, margin, forceRestack) { - var resized = false; - this.visibleItems = this._updateItemsInRange(this.orderedItems, this.visibleItems, range); - // calculate actual size - this.width = this.dom.background.offsetWidth; + (0, _createClass3["default"])(BarnesHutSolver, [{ + key: "setOptions", + value: function setOptions(options) { + this.options = options; + this.thetaInversed = 1 / this.options.theta; - // apply new height (just always zero for BackgroundGroup - this.dom.background.style.height = '0'; - - // update vertical position of items after they are re-stacked and the height of the group is calculated - for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { - var item = this.visibleItems[i]; - item.repositionY(margin); + // if 1 then min distance = 0.5, if 0.5 then min distance = 0.5 + 0.5*node.shape.radius + this.overlapAvoidanceFactor = 1 - Math.max(0, Math.min(1, this.options.avoidOverlap)); } - return resized; - }; + /** + * + * @returns {number} random integer + */ - /** - * Show this group: attach to the DOM - */ - BackgroundGroup.prototype.show = function () { - if (!this.dom.background.parentNode) { - this.itemSet.dom.background.appendChild(this.dom.background); + }, { + key: "seededRandom", + value: function seededRandom() { + var x = Math.sin(this.randomSeed++) * 10000; + return x - Math.floor(x); } - }; - module.exports = BackgroundGroup; + /** + * This function calculates the forces the nodes apply on each other based on a gravitational model. + * The Barnes Hut method is used to speed up this N-body simulation. + * + * @private + */ -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: "solve", + value: function solve() { + if (this.options.gravitationalConstant !== 0 && this.physicsBody.physicsNodeIndices.length > 0) { + var node = void 0; + var nodes = this.body.nodes; + var nodeIndices = this.physicsBody.physicsNodeIndices; + var nodeCount = nodeIndices.length; - 'use strict'; + // create the tree + var barnesHutTree = this._formBarnesHutTree(nodes, nodeIndices); - var Item = __webpack_require__(129); - var util = __webpack_require__(1); + // for debugging + this.barnesHutTree = barnesHutTree; - /** - * @constructor BoxItem - * @extends Item - * @param {Object} data Object containing parameters start - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe available options - */ - function BoxItem(data, conversion, options) { - this.props = { - dot: { - width: 0, - height: 0 - }, - line: { - width: 0, - height: 0 - } - }; - this.options = options; - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data); + // place the nodes one by one recursively + for (var i = 0; i < nodeCount; i++) { + node = nodes[nodeIndices[i]]; + if (node.options.mass > 0) { + // starting with root is irrelevant, it never passes the BarnesHutSolver condition + this._getForceContributions(barnesHutTree.root, node); + } + } } } - Item.call(this, data, conversion, options); - } - - BoxItem.prototype = new Item(null, null, null); + /** + * @param {Object} parentBranch + * @param {Node} node + * @private + */ - /** - * Check whether this item is visible inside given range - * @param {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ - BoxItem.prototype.isVisible = function (range) { - // determine visibility - var isVisible; - var align = this.options.align; - var widthInMs = this.width * range.getMillisecondsPerPixel(); - - if (align == 'right') { - isVisible = this.data.start.getTime() > range.start && this.data.start.getTime() - widthInMs < range.end; - } else if (align == 'left') { - isVisible = this.data.start.getTime() + widthInMs > range.start && this.data.start.getTime() < range.end; - } else { - // default or 'center' - isVisible = this.data.start.getTime() + widthInMs / 2 > range.start && this.data.start.getTime() - widthInMs / 2 < range.end; + }, { + key: "_getForceContributions", + value: function _getForceContributions(parentBranch, node) { + this._getForceContribution(parentBranch.children.NW, node); + this._getForceContribution(parentBranch.children.NE, node); + this._getForceContribution(parentBranch.children.SW, node); + this._getForceContribution(parentBranch.children.SE, node); } - return isVisible; - }; - /** - * Repaint the item - */ - BoxItem.prototype.redraw = function () { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; + /** + * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. + * If a region contains a single node, we check if it is not itself, then we apply the force. + * + * @param {Object} parentBranch + * @param {Node} node + * @private + */ - // create main box - dom.box = document.createElement('DIV'); + }, { + key: "_getForceContribution", + value: function _getForceContribution(parentBranch, node) { + // we get no force contribution from an empty region + if (parentBranch.childrenCount > 0) { + var dx = void 0, + dy = void 0, + distance = void 0; + + // get the distance from the center of mass to the node. + dx = parentBranch.centerOfMass.x - node.x; + dy = parentBranch.centerOfMass.y - node.y; + distance = Math.sqrt(dx * dx + dy * dy); + + // BarnesHutSolver condition + // original condition : s/d < theta = passed === d/s > 1/theta = passed + // calcSize = 1/s --> d * 1/s > 1/theta = passed + if (distance * parentBranch.calcSize > this.thetaInversed) { + this._calculateForces(distance, dx, dy, node, parentBranch); + } else { + // Did not pass the condition, go into children if available + if (parentBranch.childrenCount === 4) { + this._getForceContributions(parentBranch, node); + } else { + // parentBranch must have only one node, if it was empty we wouldnt be here + if (parentBranch.children.data.id != node.id) { + // if it is not self + this._calculateForces(distance, dx, dy, node, parentBranch); + } + } + } + } + } - // contents box (inside the background box). used for making margins - dom.content = document.createElement('DIV'); - dom.content.className = 'vis-item-content'; - dom.box.appendChild(dom.content); + /** + * Calculate the forces based on the distance. + * + * @param {number} distance + * @param {number} dx + * @param {number} dy + * @param {Node} node + * @param {Object} parentBranch + * @private + */ - // line to axis - dom.line = document.createElement('DIV'); - dom.line.className = 'vis-line'; + }, { + key: "_calculateForces", + value: function _calculateForces(distance, dx, dy, node, parentBranch) { + if (distance === 0) { + distance = 0.1; + dx = distance; + } - // dot on axis - dom.dot = document.createElement('DIV'); - dom.dot.className = 'vis-dot'; + if (this.overlapAvoidanceFactor < 1 && node.shape.radius) { + distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius); + } - // attach this item as attribute - dom.box['timeline-item'] = this; + // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines + // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce + var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass / Math.pow(distance, 3); + var fx = dx * gravityForce; + var fy = dy * gravityForce; - this.dirty = true; + this.physicsBody.forces[node.id].x += fx; + this.physicsBody.forces[node.id].y += fy; } - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); - } - if (!dom.box.parentNode) { - var foreground = this.parent.dom.foreground; - if (!foreground) throw new Error('Cannot redraw item: parent has no foreground container element'); - foreground.appendChild(dom.box); - } - if (!dom.line.parentNode) { - var background = this.parent.dom.background; - if (!background) throw new Error('Cannot redraw item: parent has no background container element'); - background.appendChild(dom.line); - } - if (!dom.dot.parentNode) { - var axis = this.parent.dom.axis; - if (!background) throw new Error('Cannot redraw item: parent has no axis container element'); - axis.appendChild(dom.dot); - } - this.displayed = true; + /** + * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. + * + * @param {Array.} nodes + * @param {Array.} nodeIndices + * @returns {{root: {centerOfMass: {x: number, y: number}, mass: number, range: {minX: number, maxX: number, minY: number, maxY: number}, size: number, calcSize: number, children: {data: null}, maxWidth: number, level: number, childrenCount: number}}} BarnesHutTree + * @private + */ - // Update DOM when item is marked dirty. An item is marked dirty when: - // - the item is not yet rendered - // - the item's data is changed - // - the item is selected/deselected - if (this.dirty) { - this._updateContents(this.dom.content); - this._updateDataAttributes(this.dom.box); - this._updateStyle(this.dom.box); - - var editable = this.editable.updateTime || this.editable.updateGroup; - - // update class - var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); - dom.box.className = 'vis-item vis-box' + className; - dom.line.className = 'vis-item vis-line' + className; - dom.dot.className = 'vis-item vis-dot' + className; - - // set initial position in the visible range of the grid so that the - // rendered box size can be determinated correctly, even the content - // has a dynamic width (fixes #2032). - var previousRight = dom.box.style.right; - var previousLeft = dom.box.style.left; - if (this.options.rtl) { - dom.box.style.right = "0px"; - } else { - dom.box.style.left = "0px"; - } + }, { + key: "_formBarnesHutTree", + value: function _formBarnesHutTree(nodes, nodeIndices) { + var node = void 0; + var nodeCount = nodeIndices.length; - // recalculate size - this.props.dot.height = dom.dot.offsetHeight; - this.props.dot.width = dom.dot.offsetWidth; - this.props.line.width = dom.line.offsetWidth; - this.width = dom.box.offsetWidth; - this.height = dom.box.offsetHeight; + var minX = nodes[nodeIndices[0]].x; + var minY = nodes[nodeIndices[0]].y; + var maxX = nodes[nodeIndices[0]].x; + var maxY = nodes[nodeIndices[0]].y; - // restore previous position - if (this.options.rtl) { - dom.box.style.right = previousRight; - } else { - dom.box.style.left = previousLeft; + // get the range of the nodes + for (var i = 1; i < nodeCount; i++) { + var _node = nodes[nodeIndices[i]]; + var x = _node.x; + var y = _node.y; + if (_node.options.mass > 0) { + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } } + // make the range a square + var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y + if (sizeDiff > 0) { + minY -= 0.5 * sizeDiff; + maxY += 0.5 * sizeDiff; + } // xSize > ySize + else { + minX += 0.5 * sizeDiff; + maxX -= 0.5 * sizeDiff; + } // xSize < ySize - this.dirty = false; - } - this._repaintOnItemUpdateTimeTooltip(dom.box); - this._repaintDragCenter(); - this._repaintDeleteButton(dom.box); - }; + var minimumTreeSize = 1e-5; + var rootSize = Math.max(minimumTreeSize, Math.abs(maxX - minX)); + var halfRootSize = 0.5 * rootSize; + var centerX = 0.5 * (minX + maxX), + centerY = 0.5 * (minY + maxY); - /** - * Show the item in the DOM (when not already displayed). The items DOM will - * be created when needed. - */ - BoxItem.prototype.show = function () { - if (!this.displayed) { - this.redraw(); + // construct the barnesHutTree + var barnesHutTree = { + root: { + centerOfMass: { x: 0, y: 0 }, + mass: 0, + range: { + minX: centerX - halfRootSize, maxX: centerX + halfRootSize, + minY: centerY - halfRootSize, maxY: centerY + halfRootSize + }, + size: rootSize, + calcSize: 1 / rootSize, + children: { data: null }, + maxWidth: 0, + level: 0, + childrenCount: 4 + } + }; + this._splitBranch(barnesHutTree.root); + + // place the nodes one by one recursively + for (var _i = 0; _i < nodeCount; _i++) { + node = nodes[nodeIndices[_i]]; + if (node.options.mass > 0) { + this._placeInTree(barnesHutTree.root, node); + } + } + + // make global + return barnesHutTree; } - }; - /** - * Hide the item from the DOM (when visible) - */ - BoxItem.prototype.hide = function () { - if (this.displayed) { - var dom = this.dom; + /** + * this updates the mass of a branch. this is increased by adding a node. + * + * @param {Object} parentBranch + * @param {Node} node + * @private + */ - if (dom.box.parentNode) dom.box.parentNode.removeChild(dom.box); - if (dom.line.parentNode) dom.line.parentNode.removeChild(dom.line); - if (dom.dot.parentNode) dom.dot.parentNode.removeChild(dom.dot); + }, { + key: "_updateBranchMass", + value: function _updateBranchMass(parentBranch, node) { + var centerOfMass = parentBranch.centerOfMass; + var totalMass = parentBranch.mass + node.options.mass; + var totalMassInv = 1 / totalMass; - this.displayed = false; - } - }; + centerOfMass.x = centerOfMass.x * parentBranch.mass + node.x * node.options.mass; + centerOfMass.x *= totalMassInv; - /** - * Reposition the item horizontally - * @Override - */ - BoxItem.prototype.repositionX = function () { - var start = this.conversion.toScreen(this.data.start); - var align = this.options.align; + centerOfMass.y = centerOfMass.y * parentBranch.mass + node.y * node.options.mass; + centerOfMass.y *= totalMassInv; - // calculate left position of the box - if (align == 'right') { - if (this.options.rtl) { - this.right = start - this.width; + parentBranch.mass = totalMass; + var biggestSize = Math.max(Math.max(node.height, node.radius), node.width); + parentBranch.maxWidth = parentBranch.maxWidth < biggestSize ? biggestSize : parentBranch.maxWidth; + } - // reposition box, line, and dot - this.dom.box.style.right = this.right + 'px'; - this.dom.line.style.right = start - this.props.line.width + 'px'; - this.dom.dot.style.right = start - this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; - } else { - this.left = start - this.width; + /** + * determine in which branch the node will be placed. + * + * @param {Object} parentBranch + * @param {Node} node + * @param {boolean} skipMassUpdate + * @private + */ - // reposition box, line, and dot - this.dom.box.style.left = this.left + 'px'; - this.dom.line.style.left = start - this.props.line.width + 'px'; - this.dom.dot.style.left = start - this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; + }, { + key: "_placeInTree", + value: function _placeInTree(parentBranch, node, skipMassUpdate) { + if (skipMassUpdate != true || skipMassUpdate === undefined) { + // update the mass of the branch. + this._updateBranchMass(parentBranch, node); } - } else if (align == 'left') { - if (this.options.rtl) { - this.right = start; - // reposition box, line, and dot - this.dom.box.style.right = this.right + 'px'; - this.dom.line.style.right = start + 'px'; - this.dom.dot.style.right = start + this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; + var range = parentBranch.children.NW.range; + var region = void 0; + if (range.maxX > node.x) { + // in NW or SW + if (range.maxY > node.y) { + region = "NW"; + } else { + region = "SW"; + } } else { - this.left = start; - - // reposition box, line, and dot - this.dom.box.style.left = this.left + 'px'; - this.dom.line.style.left = start + 'px'; - this.dom.dot.style.left = start + this.props.line.width / 2 - this.props.dot.width / 2 + 'px'; + // in NE or SE + if (range.maxY > node.y) { + region = "NE"; + } else { + region = "SE"; + } } - } else { - // default or 'center' - if (this.options.rtl) { - this.right = start - this.width / 2; - // reposition box, line, and dot - this.dom.box.style.right = this.right + 'px'; - this.dom.line.style.right = start - this.props.line.width + 'px'; - this.dom.dot.style.right = start - this.props.dot.width / 2 + 'px'; - } else { - this.left = start - this.width / 2; + this._placeInRegion(parentBranch, node, region); + } + + /** + * actually place the node in a region (or branch) + * + * @param {Object} parentBranch + * @param {Node} node + * @param {'NW'| 'NE' | 'SW' | 'SE'} region + * @private + */ - // reposition box, line, and dot - this.dom.box.style.left = this.left + 'px'; - this.dom.line.style.left = start - this.props.line.width / 2 + 'px'; - this.dom.dot.style.left = start - this.props.dot.width / 2 + 'px'; + }, { + key: "_placeInRegion", + value: function _placeInRegion(parentBranch, node, region) { + var children = parentBranch.children[region]; + + switch (children.childrenCount) { + case 0: + // place node here + children.children.data = node; + children.childrenCount = 1; + this._updateBranchMass(children, node); + break; + case 1: + // convert into children + // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) + // we move one node a little bit and we do not put it in the tree. + if (children.children.data.x === node.x && children.children.data.y === node.y) { + node.x += this.seededRandom(); + node.y += this.seededRandom(); + } else { + this._splitBranch(children); + this._placeInTree(children, node); + } + break; + case 4: + // place in branch + this._placeInTree(children, node); + break; } } - }; - - /** - * Reposition the item vertically - * @Override - */ - BoxItem.prototype.repositionY = function () { - var orientation = this.options.orientation.item; - var box = this.dom.box; - var line = this.dom.line; - var dot = this.dom.dot; - if (orientation == 'top') { - box.style.top = (this.top || 0) + 'px'; + /** + * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch + * after the split is complete. + * + * @param {Object} parentBranch + * @private + */ - line.style.top = '0'; - line.style.height = this.parent.top + this.top + 1 + 'px'; - line.style.bottom = ''; - } else { - // orientation 'bottom' - var itemSetHeight = this.parent.itemSet.props.height; // TODO: this is nasty - var lineHeight = itemSetHeight - this.parent.top - this.parent.height + this.top; + }, { + key: "_splitBranch", + value: function _splitBranch(parentBranch) { + // if the branch is shaded with a node, replace the node in the new subset. + var containedNode = null; + if (parentBranch.childrenCount === 1) { + containedNode = parentBranch.children.data; + parentBranch.mass = 0; + parentBranch.centerOfMass.x = 0; + parentBranch.centerOfMass.y = 0; + } + parentBranch.childrenCount = 4; + parentBranch.children.data = null; + this._insertRegion(parentBranch, "NW"); + this._insertRegion(parentBranch, "NE"); + this._insertRegion(parentBranch, "SW"); + this._insertRegion(parentBranch, "SE"); - box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; - line.style.top = itemSetHeight - lineHeight + 'px'; - line.style.bottom = '0'; + if (containedNode != null) { + this._placeInTree(parentBranch, containedNode); + } } - dot.style.top = -this.props.dot.height / 2 + 'px'; - }; + /** + * This function subdivides the region into four new segments. + * Specifically, this inserts a single new segment. + * It fills the children section of the parentBranch + * + * @param {Object} parentBranch + * @param {'NW'| 'NE' | 'SW' | 'SE'} region + * @private + */ - /** - * Return the width of the item left from its start date - * @return {number} - */ - BoxItem.prototype.getWidthLeft = function () { - return this.width / 2; - }; - - /** - * Return the width of the item right from its start date - * @return {number} - */ - BoxItem.prototype.getWidthRight = function () { - return this.width / 2; - }; - - module.exports = BoxItem; - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var Item = __webpack_require__(129); - - /** - * @constructor PointItem - * @extends Item - * @param {Object} data Object containing parameters start - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe available options - */ - function PointItem(data, conversion, options) { - this.props = { - dot: { - top: 0, - width: 0, - height: 0 - }, - content: { - height: 0, - marginLeft: 0, - marginRight: 0 - } - }; - this.options = options; - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data); + }, { + key: "_insertRegion", + value: function _insertRegion(parentBranch, region) { + var minX = void 0, + maxX = void 0, + minY = void 0, + maxY = void 0; + var childSize = 0.5 * parentBranch.size; + switch (region) { + case "NW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "NE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY; + maxY = parentBranch.range.minY + childSize; + break; + case "SW": + minX = parentBranch.range.minX; + maxX = parentBranch.range.minX + childSize; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; + case "SE": + minX = parentBranch.range.minX + childSize; + maxX = parentBranch.range.maxX; + minY = parentBranch.range.minY + childSize; + maxY = parentBranch.range.maxY; + break; } - } - - Item.call(this, data, conversion, options); - } - - PointItem.prototype = new Item(null, null, null); - - /** - * Check whether this item is visible inside given range - * @param {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ - PointItem.prototype.isVisible = function (range) { - // determine visibility - var widthInMs = this.width * range.getMillisecondsPerPixel(); - return this.data.start.getTime() + widthInMs > range.start && this.data.start < range.end; - }; - - /** - * Repaint the item - */ - PointItem.prototype.redraw = function () { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; + parentBranch.children[region] = { + centerOfMass: { x: 0, y: 0 }, + mass: 0, + range: { minX: minX, maxX: maxX, minY: minY, maxY: maxY }, + size: 0.5 * parentBranch.size, + calcSize: 2 * parentBranch.calcSize, + children: { data: null }, + maxWidth: 0, + level: parentBranch.level + 1, + childrenCount: 0 + }; + } - // background box - dom.point = document.createElement('div'); - // className is updated in redraw() + //--------------------------- DEBUGGING BELOW ---------------------------// - // contents box, right from the dot - dom.content = document.createElement('div'); - dom.content.className = 'vis-item-content'; - dom.point.appendChild(dom.content); - // dot at start - dom.dot = document.createElement('div'); - dom.point.appendChild(dom.dot); + /** + * This function is for debugging purposed, it draws the tree. + * + * @param {CanvasRenderingContext2D} ctx + * @param {string} color + * @private + */ - // attach this item as attribute - dom.point['timeline-item'] = this; + }, { + key: "_debug", + value: function _debug(ctx, color) { + if (this.barnesHutTree !== undefined) { - this.dirty = true; - } + ctx.lineWidth = 1; - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); - } - if (!dom.point.parentNode) { - var foreground = this.parent.dom.foreground; - if (!foreground) { - throw new Error('Cannot redraw item: parent has no foreground container element'); + this._drawBranch(this.barnesHutTree.root, ctx, color); } - foreground.appendChild(dom.point); } - this.displayed = true; - - // Update DOM when item is marked dirty. An item is marked dirty when: - // - the item is not yet rendered - // - the item's data is changed - // - the item is selected/deselected - if (this.dirty) { - this._updateContents(this.dom.content); - this._updateDataAttributes(this.dom.point); - this._updateStyle(this.dom.point); - - var editable = this.editable.updateTime || this.editable.updateGroup; - // update class - var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : '') + (editable ? ' vis-editable' : ' vis-readonly'); - dom.point.className = 'vis-item vis-point' + className; - dom.dot.className = 'vis-item vis-dot' + className; - - // recalculate size of dot and contents - this.props.dot.width = dom.dot.offsetWidth; - this.props.dot.height = dom.dot.offsetHeight; - this.props.content.height = dom.content.offsetHeight; - - // resize contents - if (this.options.rtl) { - dom.content.style.marginRight = 2 * this.props.dot.width + 'px'; - } else { - dom.content.style.marginLeft = 2 * this.props.dot.width + 'px'; - } - //dom.content.style.marginRight = ... + 'px'; // TODO: margin right - // recalculate size - this.width = dom.point.offsetWidth; - this.height = dom.point.offsetHeight; + /** + * This function is for debugging purposes. It draws the branches recursively. + * + * @param {Object} branch + * @param {CanvasRenderingContext2D} ctx + * @param {string} color + * @private + */ - // reposition the dot - dom.dot.style.top = (this.height - this.props.dot.height) / 2 + 'px'; - if (this.options.rtl) { - dom.dot.style.right = this.props.dot.width / 2 + 'px'; - } else { - dom.dot.style.left = this.props.dot.width / 2 + 'px'; + }, { + key: "_drawBranch", + value: function _drawBranch(branch, ctx, color) { + if (color === undefined) { + color = "#FF0000"; } - this.dirty = false; - } - - this._repaintOnItemUpdateTimeTooltip(dom.point); - this._repaintDragCenter(); - this._repaintDeleteButton(dom.point); - }; - - /** - * Show the item in the DOM (when not already visible). The items DOM will - * be created when needed. - */ - PointItem.prototype.show = function () { - if (!this.displayed) { - this.redraw(); - } - }; - - /** - * Hide the item from the DOM (when visible) - */ - PointItem.prototype.hide = function () { - if (this.displayed) { - if (this.dom.point.parentNode) { - this.dom.point.parentNode.removeChild(this.dom.point); + if (branch.childrenCount === 4) { + this._drawBranch(branch.children.NW, ctx); + this._drawBranch(branch.children.NE, ctx); + this._drawBranch(branch.children.SE, ctx); + this._drawBranch(branch.children.SW, ctx); } + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(branch.range.minX, branch.range.minY); + ctx.lineTo(branch.range.maxX, branch.range.minY); + ctx.stroke(); - this.displayed = false; - } - }; - - /** - * Reposition the item horizontally - * @Override - */ - PointItem.prototype.repositionX = function () { - var start = this.conversion.toScreen(this.data.start); - - if (this.options.rtl) { - this.right = start - this.props.dot.width; + ctx.beginPath(); + ctx.moveTo(branch.range.maxX, branch.range.minY); + ctx.lineTo(branch.range.maxX, branch.range.maxY); + ctx.stroke(); - // reposition point - this.dom.point.style.right = this.right + 'px'; - } else { - this.left = start - this.props.dot.width; + ctx.beginPath(); + ctx.moveTo(branch.range.maxX, branch.range.maxY); + ctx.lineTo(branch.range.minX, branch.range.maxY); + ctx.stroke(); - // reposition point - this.dom.point.style.left = this.left + 'px'; - } - }; + ctx.beginPath(); + ctx.moveTo(branch.range.minX, branch.range.maxY); + ctx.lineTo(branch.range.minX, branch.range.minY); + ctx.stroke(); - /** - * Reposition the item vertically - * @Override - */ - PointItem.prototype.repositionY = function () { - var orientation = this.options.orientation.item; - var point = this.dom.point; - if (orientation == 'top') { - point.style.top = this.top + 'px'; - } else { - point.style.top = this.parent.height - this.top - this.height + 'px'; + /* + if (branch.mass > 0) { + ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); + ctx.stroke(); + } + */ } - }; - - /** - * Return the width of the item left from its start date - * @return {number} - */ - PointItem.prototype.getWidthLeft = function () { - return this.props.dot.width; - }; - - /** - * Return the width of the item right from its start date - * @return {number} - */ - PointItem.prototype.getWidthRight = function () { - return this.props.dot.width; - }; + }]); + return BarnesHutSolver; +}(); - module.exports = PointItem; +exports["default"] = BarnesHutSolver; /***/ }), -/* 133 */ +/* 121 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - var Hammer = __webpack_require__(113); - var Item = __webpack_require__(129); - var BackgroundGroup = __webpack_require__(130); - var RangeItem = __webpack_require__(128); - - /** - * @constructor BackgroundItem - * @extends Item - * @param {Object} data Object containing parameters start, end - * content, className. - * @param {{toScreen: function, toTime: function}} conversion - * Conversion functions from time to screen and vice versa - * @param {Object} [options] Configuration options - * // TODO: describe options - */ - // TODO: implement support for the BackgroundItem just having a start, then being displayed as a sort of an annotation - function BackgroundItem(data, conversion, options) { - this.props = { - content: { - width: 0 - } - }; - this.overflow = false; // if contents can overflow (css styling), this flag is set to true - - // validate data - if (data) { - if (data.start == undefined) { - throw new Error('Property "start" missing in item ' + data.id); - } - if (data.end == undefined) { - throw new Error('Property "end" missing in item ' + data.id); - } - } - - Item.call(this, data, conversion, options); - } - - BackgroundItem.prototype = new Item(null, null, null); - - BackgroundItem.prototype.baseClassName = 'vis-item vis-background'; - BackgroundItem.prototype.stack = false; - - /** - * Check whether this item is visible inside given range - * @returns {{start: Number, end: Number}} range with a timestamp for start and end - * @returns {boolean} True if visible - */ - BackgroundItem.prototype.isVisible = function (range) { - // determine visibility - return this.data.start < range.end && this.data.end > range.start; - }; - - /** - * Repaint the item - */ - BackgroundItem.prototype.redraw = function () { - var dom = this.dom; - if (!dom) { - // create DOM - this.dom = {}; - dom = this.dom; - - // background box - dom.box = document.createElement('div'); - // className is updated in redraw() - - // frame box (to prevent the item contents from overflowing - dom.frame = document.createElement('div'); - dom.frame.className = 'vis-item-overflow'; - dom.box.appendChild(dom.frame); - - // contents box - dom.content = document.createElement('div'); - dom.content.className = 'vis-item-content'; - dom.frame.appendChild(dom.content); - - // Note: we do NOT attach this item as attribute to the DOM, - // such that background items cannot be selected - //dom.box['timeline-item'] = this; - - this.dirty = true; - } - - // append DOM to parent DOM - if (!this.parent) { - throw new Error('Cannot redraw item: no parent attached'); - } - if (!dom.box.parentNode) { - var background = this.parent.dom.background; - if (!background) { - throw new Error('Cannot redraw item: parent has no background container element'); - } - background.appendChild(dom.box); - } - this.displayed = true; - - // Update DOM when item is marked dirty. An item is marked dirty when: - // - the item is not yet rendered - // - the item's data is changed - // - the item is selected/deselected - if (this.dirty) { - this._updateContents(this.dom.content); - this._updateDataAttributes(this.dom.content); - this._updateStyle(this.dom.box); +"use strict"; - // update class - var className = (this.data.className ? ' ' + this.data.className : '') + (this.selected ? ' vis-selected' : ''); - dom.box.className = this.baseClassName + className; - // determine from css whether this box has overflow - this.overflow = window.getComputedStyle(dom.content).overflow !== 'hidden'; +Object.defineProperty(exports, "__esModule", { + value: true +}); - // recalculate size - this.props.content.width = this.dom.content.offsetWidth; - this.height = 0; // set height zero, so this item will be ignored when stacking items +var _classCallCheck2 = __webpack_require__(0); - this.dirty = false; - } - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * Show the item in the DOM (when not already visible). The items DOM will - * be created when needed. - */ - BackgroundItem.prototype.show = RangeItem.prototype.show; +var _createClass2 = __webpack_require__(1); - /** - * Hide the item from the DOM (when visible) - * @return {Boolean} changed - */ - BackgroundItem.prototype.hide = RangeItem.prototype.hide; +var _createClass3 = _interopRequireDefault(_createClass2); - /** - * Reposition the item horizontally - * @Override - */ - BackgroundItem.prototype.repositionX = RangeItem.prototype.repositionX; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/** + * Central Gravity Solver + */ +var CentralGravitySolver = function () { /** - * Reposition the item vertically - * @Override + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options */ - BackgroundItem.prototype.repositionY = function (margin) { - var height; - var orientation = this.options.orientation.item; - - // special positioning for subgroups - if (this.data.subgroup !== undefined) { - // TODO: instead of calculating the top position of the subgroups here for every BackgroundItem, calculate the top of the subgroup once in Itemset - - var itemSubgroup = this.data.subgroup; - var subgroups = this.parent.subgroups; - var subgroupIndex = subgroups[itemSubgroup].index; - - this.dom.box.style.height = this.parent.subgroups[itemSubgroup].height + 'px'; - - if (orientation == 'top') { - this.dom.box.style.top = this.parent.top + this.parent.subgroups[itemSubgroup].top + 'px'; - } else { - this.dom.box.style.top = this.parent.top + this.parent.height - this.parent.subgroups[itemSubgroup].top - this.parent.subgroups[itemSubgroup].height + 'px'; - } - this.dom.box.style.bottom = ''; - } - // and in the case of no subgroups: - else { - // we want backgrounds with groups to only show in groups. - if (this.parent instanceof BackgroundGroup) { - // if the item is not in a group: - height = Math.max(this.parent.height, this.parent.itemSet.body.domProps.center.height, this.parent.itemSet.body.domProps.centerContainer.height); - this.dom.box.style.bottom = orientation == 'bottom' ? '0' : ''; - this.dom.box.style.top = orientation == 'top' ? '0' : ''; - } else { - height = this.parent.height; - // same alignment for items when orientation is top or bottom - this.dom.box.style.top = this.parent.top + 'px'; - this.dom.box.style.bottom = ''; - } - } - this.dom.box.style.height = height + 'px'; - }; - - module.exports = BackgroundItem; - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _classCallCheck2 = __webpack_require__(135); - - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + function CentralGravitySolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, CentralGravitySolver); - var _createClass2 = __webpack_require__(136); - - var _createClass3 = _interopRequireDefault(_createClass2); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + this.body = body; + this.physicsBody = physicsBody; + this.setOptions(options); + } /** - * Popup is a class to create a popup window with some text - * @param {Element} container The container object. - * @param {string} overflowMethod How the popup should act to overflowing ('flip' or 'cap') + * + * @param {Object} options */ - var Popup = function () { - function Popup(container, overflowMethod) { - (0, _classCallCheck3['default'])(this, Popup); - - this.container = container; - this.overflowMethod = overflowMethod || 'cap'; - this.x = 0; - this.y = 0; - this.padding = 5; - this.hidden = false; - // create the frame - this.frame = document.createElement('div'); - this.frame.className = 'vis-tooltip'; - this.container.appendChild(this.frame); + (0, _createClass3["default"])(CentralGravitySolver, [{ + key: "setOptions", + value: function setOptions(options) { + this.options = options; } /** - * @param {number} x Horizontal position of the popup window - * @param {number} y Vertical position of the popup window + * Calculates forces for each node */ + }, { + key: "solve", + value: function solve() { + var dx = void 0, + dy = void 0, + distance = void 0, + node = void 0; + var nodes = this.body.nodes; + var nodeIndices = this.physicsBody.physicsNodeIndices; + var forces = this.physicsBody.forces; - (0, _createClass3['default'])(Popup, [{ - key: 'setPosition', - value: function setPosition(x, y) { - this.x = parseInt(x); - this.y = parseInt(y); - } - - /** - * Set the content for the popup window. This can be HTML code or text. - * @param {string | Element} content - */ - - }, { - key: 'setText', - value: function setText(content) { - if (content instanceof Element) { - this.frame.innerHTML = ''; - this.frame.appendChild(content); - } else { - this.frame.innerHTML = content; // string containing text or HTML - } - } - - /** - * Show the popup window - * @param {boolean} [doShow] Show or hide the window - */ - - }, { - key: 'show', - value: function show(doShow) { - if (doShow === undefined) { - doShow = true; - } - - if (doShow === true) { - var height = this.frame.clientHeight; - var width = this.frame.clientWidth; - var maxHeight = this.frame.parentNode.clientHeight; - var maxWidth = this.frame.parentNode.clientWidth; - - var left = 0, - top = 0; - - if (this.overflowMethod == 'flip') { - var isLeft = false, - isTop = true; // Where around the position it's located - - if (this.y - height < this.padding) { - isTop = false; - } - - if (this.x + width > maxWidth - this.padding) { - isLeft = true; - } - - if (isLeft) { - left = this.x - width; - } else { - left = this.x; - } - - if (isTop) { - top = this.y - height; - } else { - top = this.y; - } - } else { - top = this.y - height; - if (top + height + this.padding > maxHeight) { - top = maxHeight - height - this.padding; - } - if (top < this.padding) { - top = this.padding; - } - - left = this.x; - if (left + width + this.padding > maxWidth) { - left = maxWidth - width - this.padding; - } - if (left < this.padding) { - left = this.padding; - } - } - - this.frame.style.left = left + "px"; - this.frame.style.top = top + "px"; - this.frame.style.visibility = "visible"; - this.hidden = false; - } else { - this.hide(); - } - } - - /** - * Hide the popup window - */ - - }, { - key: 'hide', - value: function hide() { - this.hidden = true; - this.frame.style.visibility = "hidden"; - } - - /** - * Remove the popup window - */ + for (var i = 0; i < nodeIndices.length; i++) { + var nodeId = nodeIndices[i]; + node = nodes[nodeId]; + dx = -node.x; + dy = -node.y; + distance = Math.sqrt(dx * dx + dy * dy); - }, { - key: 'destroy', - value: function destroy() { - this.frame.parentNode.removeChild(this.frame); // Remove element from DOM + this._calculateForces(distance, dx, dy, forces, node); } - }]); - return Popup; - }(); - - exports['default'] = Popup; - -/***/ }), -/* 135 */ -/***/ (function(module, exports) { - - "use strict"; + } - exports.__esModule = true; + /** + * Calculate the forces based on the distance. + * @param {number} distance + * @param {number} dx + * @param {number} dy + * @param {Object} forces + * @param {Node} node + * @private + */ - exports.default = function (instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + }, { + key: "_calculateForces", + value: function _calculateForces(distance, dx, dy, forces, node) { + var gravityForce = distance === 0 ? 0 : this.options.centralGravity / distance; + forces[node.id].x = dx * gravityForce; + forces[node.id].y = dy * gravityForce; } - }; + }]); + return CentralGravitySolver; +}(); + +exports["default"] = CentralGravitySolver; /***/ }), -/* 136 */ +/* 122 */ /***/ (function(module, exports, __webpack_require__) { - "use strict"; +"use strict"; - exports.__esModule = true; - var _defineProperty = __webpack_require__(137); - - var _defineProperty2 = _interopRequireDefault(_defineProperty); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - (0, _defineProperty2.default)(target, descriptor.key, descriptor); +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** + * This object contains all possible options. It will check if the types are correct, if required if the option is one + * of the allowed values. + * + * __any__ means that the name of the property does not matter. + * __type__ is a required field for all objects and contains the allowed types of all objects + */ +var string = 'string'; +var bool = 'boolean'; +var number = 'number'; +var array = 'array'; +var object = 'object'; // should only be in a __type__ property +var dom = 'dom'; +var any = 'any'; + +// List of endpoints +var endPoints = ['arrow', 'circle', 'bar']; + +var allOptions = { + configure: { + enabled: { boolean: bool }, + filter: { boolean: bool, string: string, array: array, 'function': 'function' }, + container: { dom: dom }, + showButton: { boolean: bool }, + __type__: { object: object, boolean: bool, string: string, array: array, 'function': 'function' } + }, + edges: { + arrows: { + to: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: endPoints }, __type__: { object: object, boolean: bool } }, + middle: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: endPoints }, __type__: { object: object, boolean: bool } }, + from: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: endPoints }, __type__: { object: object, boolean: bool } }, + __type__: { string: ['from', 'to', 'middle'], object: object } + }, + arrowStrikethrough: { boolean: bool }, + chosen: { + label: { boolean: bool, 'function': 'function' }, + edge: { boolean: bool, 'function': 'function' }, + __type__: { object: object, boolean: bool } + }, + color: { + color: { string: string }, + highlight: { string: string }, + hover: { string: string }, + inherit: { string: ['from', 'to', 'both'], boolean: bool }, + opacity: { number: number }, + __type__: { object: object, string: string } + }, + dashes: { boolean: bool, array: array }, + font: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + background: { string: string }, + strokeWidth: { number: number }, // px + strokeColor: { string: string }, + align: { string: ['horizontal', 'top', 'middle', 'bottom'] }, + vadjust: { number: number }, + multi: { boolean: bool, string: string }, + bold: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + boldital: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + ital: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + mono: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + __type__: { object: object, string: string } + }, + hidden: { boolean: bool }, + hoverWidth: { 'function': 'function', number: number }, + label: { string: string, 'undefined': 'undefined' }, + labelHighlightBold: { boolean: bool }, + length: { number: number, 'undefined': 'undefined' }, + physics: { boolean: bool }, + scaling: { + min: { number: number }, + max: { number: number }, + label: { + enabled: { boolean: bool }, + min: { number: number }, + max: { number: number }, + maxVisible: { number: number }, + drawThreshold: { number: number }, + __type__: { object: object, boolean: bool } + }, + customScalingFunction: { 'function': 'function' }, + __type__: { object: object } + }, + selectionWidth: { 'function': 'function', number: number }, + selfReferenceSize: { number: number }, + shadow: { + enabled: { boolean: bool }, + color: { string: string }, + size: { number: number }, + x: { number: number }, + y: { number: number }, + __type__: { object: object, boolean: bool } + }, + smooth: { + enabled: { boolean: bool }, + type: { string: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'] }, + roundness: { number: number }, + forceDirection: { string: ['horizontal', 'vertical', 'none'], boolean: bool }, + __type__: { object: object, boolean: bool } + }, + title: { string: string, 'undefined': 'undefined' }, + width: { number: number }, + widthConstraint: { + maximum: { number: number }, + __type__: { object: object, boolean: bool, number: number } + }, + value: { number: number, 'undefined': 'undefined' }, + __type__: { object: object } + }, + groups: { + useDefaultGroups: { boolean: bool }, + __any__: 'get from nodes, will be overwritten below', + __type__: { object: object } + }, + interaction: { + dragNodes: { boolean: bool }, + dragView: { boolean: bool }, + hideEdgesOnDrag: { boolean: bool }, + hideNodesOnDrag: { boolean: bool }, + hover: { boolean: bool }, + keyboard: { + enabled: { boolean: bool }, + speed: { x: { number: number }, y: { number: number }, zoom: { number: number }, __type__: { object: object } }, + bindToWindow: { boolean: bool }, + __type__: { object: object, boolean: bool } + }, + multiselect: { boolean: bool }, + navigationButtons: { boolean: bool }, + selectable: { boolean: bool }, + selectConnectedEdges: { boolean: bool }, + hoverConnectedEdges: { boolean: bool }, + tooltipDelay: { number: number }, + zoomView: { boolean: bool }, + __type__: { object: object } + }, + layout: { + randomSeed: { 'undefined': 'undefined', number: number }, + improvedLayout: { boolean: bool }, + hierarchical: { + enabled: { boolean: bool }, + levelSeparation: { number: number }, + nodeSpacing: { number: number }, + treeSpacing: { number: number }, + blockShifting: { boolean: bool }, + edgeMinimization: { boolean: bool }, + parentCentralization: { boolean: bool }, + direction: { string: ['UD', 'DU', 'LR', 'RL'] }, // UD, DU, LR, RL + sortMethod: { string: ['hubsize', 'directed'] }, // hubsize, directed + __type__: { object: object, boolean: bool } + }, + __type__: { object: object } + }, + manipulation: { + enabled: { boolean: bool }, + initiallyActive: { boolean: bool }, + addNode: { boolean: bool, 'function': 'function' }, + addEdge: { boolean: bool, 'function': 'function' }, + editNode: { 'function': 'function' }, + editEdge: { + editWithoutDrag: { 'function': 'function' }, + __type__: { object: object, boolean: bool, 'function': 'function' } + }, + deleteNode: { boolean: bool, 'function': 'function' }, + deleteEdge: { boolean: bool, 'function': 'function' }, + controlNodeStyle: 'get from nodes, will be overwritten below', + __type__: { object: object, boolean: bool } + }, + nodes: { + borderWidth: { number: number }, + borderWidthSelected: { number: number, 'undefined': 'undefined' }, + brokenImage: { string: string, 'undefined': 'undefined' }, + chosen: { + label: { boolean: bool, 'function': 'function' }, + node: { boolean: bool, 'function': 'function' }, + __type__: { object: object, boolean: bool } + }, + color: { + border: { string: string }, + background: { string: string }, + highlight: { + border: { string: string }, + background: { string: string }, + __type__: { object: object, string: string } + }, + hover: { + border: { string: string }, + background: { string: string }, + __type__: { object: object, string: string } + }, + __type__: { object: object, string: string } + }, + fixed: { + x: { boolean: bool }, + y: { boolean: bool }, + __type__: { object: object, boolean: bool } + }, + font: { + align: { string: string }, + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + background: { string: string }, + strokeWidth: { number: number }, // px + strokeColor: { string: string }, + vadjust: { number: number }, + multi: { boolean: bool, string: string }, + bold: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + boldital: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + ital: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + mono: { + color: { string: string }, + size: { number: number }, // px + face: { string: string }, + mod: { string: string }, + vadjust: { number: number }, + __type__: { object: object, string: string } + }, + __type__: { object: object, string: string } + }, + group: { string: string, number: number, 'undefined': 'undefined' }, + heightConstraint: { + minimum: { number: number }, + valign: { string: string }, + __type__: { object: object, boolean: bool, number: number } + }, + hidden: { boolean: bool }, + icon: { + face: { string: string }, + code: { string: string }, //'\uf007', + size: { number: number }, //50, + color: { string: string }, + __type__: { object: object } + }, + id: { string: string, number: number }, + image: { + selected: { string: string, 'undefined': 'undefined' }, // --> URL + unselected: { string: string, 'undefined': 'undefined' }, // --> URL + __type__: { object: object, string: string } + }, + label: { string: string, 'undefined': 'undefined' }, + labelHighlightBold: { boolean: bool }, + level: { number: number, 'undefined': 'undefined' }, + margin: { + top: { number: number }, + right: { number: number }, + bottom: { number: number }, + left: { number: number }, + __type__: { object: object, number: number } + }, + mass: { number: number }, + physics: { boolean: bool }, + scaling: { + min: { number: number }, + max: { number: number }, + label: { + enabled: { boolean: bool }, + min: { number: number }, + max: { number: number }, + maxVisible: { number: number }, + drawThreshold: { number: number }, + __type__: { object: object, boolean: bool } + }, + customScalingFunction: { 'function': 'function' }, + __type__: { object: object } + }, + shadow: { + enabled: { boolean: bool }, + color: { string: string }, + size: { number: number }, + x: { number: number }, + y: { number: number }, + __type__: { object: object, boolean: bool } + }, + shape: { string: ['ellipse', 'circle', 'database', 'box', 'text', 'image', 'circularImage', 'diamond', 'dot', 'star', 'triangle', 'triangleDown', 'square', 'icon', 'hexagon'] }, + shapeProperties: { + borderDashes: { boolean: bool, array: array }, + borderRadius: { number: number }, + interpolation: { boolean: bool }, + useImageSize: { boolean: bool }, + useBorderWithImage: { boolean: bool }, + __type__: { object: object } + }, + size: { number: number }, + title: { string: string, dom: dom, 'undefined': 'undefined' }, + value: { number: number, 'undefined': 'undefined' }, + widthConstraint: { + minimum: { number: number }, + maximum: { number: number }, + __type__: { object: object, boolean: bool, number: number } + }, + x: { number: number }, + y: { number: number }, + __type__: { object: object } + }, + physics: { + enabled: { boolean: bool }, + barnesHut: { + gravitationalConstant: { number: number }, + centralGravity: { number: number }, + springLength: { number: number }, + springConstant: { number: number }, + damping: { number: number }, + avoidOverlap: { number: number }, + __type__: { object: object } + }, + forceAtlas2Based: { + gravitationalConstant: { number: number }, + centralGravity: { number: number }, + springLength: { number: number }, + springConstant: { number: number }, + damping: { number: number }, + avoidOverlap: { number: number }, + __type__: { object: object } + }, + repulsion: { + centralGravity: { number: number }, + springLength: { number: number }, + springConstant: { number: number }, + nodeDistance: { number: number }, + damping: { number: number }, + __type__: { object: object } + }, + hierarchicalRepulsion: { + centralGravity: { number: number }, + springLength: { number: number }, + springConstant: { number: number }, + nodeDistance: { number: number }, + damping: { number: number }, + __type__: { object: object } + }, + maxVelocity: { number: number }, + minVelocity: { number: number }, // px/s + solver: { string: ['barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based'] }, + stabilization: { + enabled: { boolean: bool }, + iterations: { number: number }, // maximum number of iteration to stabilize + updateInterval: { number: number }, + onlyDynamicEdges: { boolean: bool }, + fit: { boolean: bool }, + __type__: { object: object, boolean: bool } + }, + timestep: { number: number }, + adaptiveTimestep: { boolean: bool }, + __type__: { object: object, boolean: bool } + }, + + //globals : + autoResize: { boolean: bool }, + clickToUse: { boolean: bool }, + locale: { string: string }, + locales: { + __any__: { any: any }, + __type__: { object: object } + }, + height: { string: string }, + width: { string: string }, + __type__: { object: object } +}; + +allOptions.groups.__any__ = allOptions.nodes; +allOptions.manipulation.controlNodeStyle = allOptions.nodes; + +var configureOptions = { + nodes: { + borderWidth: [1, 0, 10, 1], + borderWidthSelected: [2, 0, 10, 1], + color: { + border: ['color', '#2B7CE9'], + background: ['color', '#97C2FC'], + highlight: { + border: ['color', '#2B7CE9'], + background: ['color', '#D2E5FF'] + }, + hover: { + border: ['color', '#2B7CE9'], + background: ['color', '#D2E5FF'] } - } + }, + fixed: { + x: false, + y: false + }, + font: { + color: ['color', '#343434'], + size: [14, 0, 100, 1], // px + face: ['arial', 'verdana', 'tahoma'], + background: ['color', 'none'], + strokeWidth: [0, 0, 50, 1], // px + strokeColor: ['color', '#ffffff'] + }, + //group: 'string', + hidden: false, + labelHighlightBold: true, + //icon: { + // face: 'string', //'FontAwesome', + // code: 'string', //'\uf007', + // size: [50, 0, 200, 1], //50, + // color: ['color','#2B7CE9'] //'#aa00ff' + //}, + //image: 'string', // --> URL + physics: true, + scaling: { + min: [10, 0, 200, 1], + max: [30, 0, 200, 1], + label: { + enabled: false, + min: [14, 0, 200, 1], + max: [30, 0, 200, 1], + maxVisible: [30, 0, 200, 1], + drawThreshold: [5, 0, 20, 1] + } + }, + shadow: { + enabled: false, + color: 'rgba(0,0,0,0.5)', + size: [10, 0, 20, 1], + x: [5, -30, 30, 1], + y: [5, -30, 30, 1] + }, + shape: ['ellipse', 'box', 'circle', 'database', 'diamond', 'dot', 'square', 'star', 'text', 'triangle', 'triangleDown', 'hexagon'], + shapeProperties: { + borderDashes: false, + borderRadius: [6, 0, 20, 1], + interpolation: true, + useImageSize: false + }, + size: [25, 0, 200, 1] + }, + edges: { + arrows: { + to: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' }, + middle: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' }, + from: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' } + }, + arrowStrikethrough: true, + color: { + color: ['color', '#848484'], + highlight: ['color', '#848484'], + hover: ['color', '#848484'], + inherit: ['from', 'to', 'both', true, false], + opacity: [1, 0, 1, 0.05] + }, + dashes: false, + font: { + color: ['color', '#343434'], + size: [14, 0, 100, 1], // px + face: ['arial', 'verdana', 'tahoma'], + background: ['color', 'none'], + strokeWidth: [2, 0, 50, 1], // px + strokeColor: ['color', '#ffffff'], + align: ['horizontal', 'top', 'middle', 'bottom'] + }, + hidden: false, + hoverWidth: [1.5, 0, 5, 0.1], + labelHighlightBold: true, + physics: true, + scaling: { + min: [1, 0, 100, 1], + max: [15, 0, 100, 1], + label: { + enabled: true, + min: [14, 0, 200, 1], + max: [30, 0, 200, 1], + maxVisible: [30, 0, 200, 1], + drawThreshold: [5, 0, 20, 1] + } + }, + selectionWidth: [1.5, 0, 5, 0.1], + selfReferenceSize: [20, 0, 200, 1], + shadow: { + enabled: false, + color: 'rgba(0,0,0,0.5)', + size: [10, 0, 20, 1], + x: [5, -30, 30, 1], + y: [5, -30, 30, 1] + }, + smooth: { + enabled: true, + type: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'], + forceDirection: ['horizontal', 'vertical', 'none'], + roundness: [0.5, 0, 1, 0.05] + }, + width: [1, 0, 30, 1] + }, + layout: { + //randomSeed: [0, 0, 500, 1], + //improvedLayout: true, + hierarchical: { + enabled: false, + levelSeparation: [150, 20, 500, 5], + nodeSpacing: [100, 20, 500, 5], + treeSpacing: [200, 20, 500, 5], + blockShifting: true, + edgeMinimization: true, + parentCentralization: true, + direction: ['UD', 'DU', 'LR', 'RL'], // UD, DU, LR, RL + sortMethod: ['hubsize', 'directed'] // hubsize, directed + } + }, + interaction: { + dragNodes: true, + dragView: true, + hideEdgesOnDrag: false, + hideNodesOnDrag: false, + hover: false, + keyboard: { + enabled: false, + speed: { x: [10, 0, 40, 1], y: [10, 0, 40, 1], zoom: [0.02, 0, 0.1, 0.005] }, + bindToWindow: true + }, + multiselect: false, + navigationButtons: false, + selectable: true, + selectConnectedEdges: true, + hoverConnectedEdges: true, + tooltipDelay: [300, 0, 1000, 25], + zoomView: true + }, + manipulation: { + enabled: false, + initiallyActive: false + }, + physics: { + enabled: true, + barnesHut: { + //theta: [0.5, 0.1, 1, 0.05], + gravitationalConstant: [-2000, -30000, 0, 50], + centralGravity: [0.3, 0, 10, 0.05], + springLength: [95, 0, 500, 5], + springConstant: [0.04, 0, 1.2, 0.005], + damping: [0.09, 0, 1, 0.01], + avoidOverlap: [0, 0, 1, 0.01] + }, + forceAtlas2Based: { + //theta: [0.5, 0.1, 1, 0.05], + gravitationalConstant: [-50, -500, 0, 1], + centralGravity: [0.01, 0, 1, 0.005], + springLength: [95, 0, 500, 5], + springConstant: [0.08, 0, 1.2, 0.005], + damping: [0.4, 0, 1, 0.01], + avoidOverlap: [0, 0, 1, 0.01] + }, + repulsion: { + centralGravity: [0.2, 0, 10, 0.05], + springLength: [200, 0, 500, 5], + springConstant: [0.05, 0, 1.2, 0.005], + nodeDistance: [100, 0, 500, 5], + damping: [0.09, 0, 1, 0.01] + }, + hierarchicalRepulsion: { + centralGravity: [0.2, 0, 10, 0.05], + springLength: [100, 0, 500, 5], + springConstant: [0.01, 0, 1.2, 0.005], + nodeDistance: [120, 0, 500, 5], + damping: [0.09, 0, 1, 0.01] + }, + maxVelocity: [50, 0, 150, 1], + minVelocity: [0.1, 0.01, 0.5, 0.01], + solver: ['barnesHut', 'forceAtlas2Based', 'repulsion', 'hierarchicalRepulsion'], + timestep: [0.5, 0.01, 1, 0.01] + //adaptiveTimestep: true + } +}; - return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps); - if (staticProps) defineProperties(Constructor, staticProps); - return Constructor; - }; - }(); +exports.allOptions = allOptions; +exports.configureOptions = configureOptions; /***/ }), -/* 137 */ +/* 123 */ /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(138), __esModule: true }; +"use strict"; + + +var util = __webpack_require__(2); + +// Graph3d +util.extend(exports, __webpack_require__(159)); + +// Timeline & Graph2d +util.extend(exports, __webpack_require__(177)); + +// Network +util.extend(exports, __webpack_require__(181)); /***/ }), -/* 138 */ +/* 124 */ /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(139); - var $Object = __webpack_require__(17).Object; - module.exports = function defineProperty(it, key, desc){ - return $Object.defineProperty(it, key, desc); - }; +__webpack_require__(49); +__webpack_require__(60); +module.exports = __webpack_require__(136); + /***/ }), -/* 139 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { - var $export = __webpack_require__(15); - // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) - $export($export.S + $export.F * !__webpack_require__(25), 'Object', {defineProperty: __webpack_require__(21).f}); +"use strict"; + +var addToUnscopables = __webpack_require__(126); +var step = __webpack_require__(127); +var Iterators = __webpack_require__(31); +var toIObject = __webpack_require__(25); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() +module.exports = __webpack_require__(79)(Array, 'Array', function (iterated, kind) { + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() +}, function () { + var O = this._t; + var kind = this._k; + var index = this._i++; + if (!O || index >= O.length) { + this._t = undefined; + return step(1); + } + if (kind == 'keys') return step(0, index); + if (kind == 'values') return step(0, O[index]); + return step(0, [index, O[index]]); +}, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) +Iterators.Arguments = Iterators.Array; + +addToUnscopables('keys'); +addToUnscopables('values'); +addToUnscopables('entries'); + /***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { +/* 126 */ +/***/ (function(module, exports) { - 'use strict'; +module.exports = function () { /* empty */ }; - var _typeof2 = __webpack_require__(62); - var _typeof3 = _interopRequireDefault(_typeof2); +/***/ }), +/* 127 */ +/***/ (function(module, exports) { - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +module.exports = function (done, value) { + return { value: value, done: !!done }; +}; - var util = __webpack_require__(1); - var Component = __webpack_require__(121); - var TimeStep = __webpack_require__(125); - var DateUtil = __webpack_require__(122); - var moment = __webpack_require__(82); - /** - * A horizontal time axis - * @param {{dom: Object, domProps: Object, emitter: Emitter, range: Range}} body - * @param {Object} [options] See TimeAxis.setOptions for the available - * options. - * @constructor TimeAxis - * @extends Component - */ - function TimeAxis(body, options) { - this.dom = { - foreground: null, - lines: [], - majorTexts: [], - minorTexts: [], - redundant: { - lines: [], - majorTexts: [], - minorTexts: [] - } - }; - this.props = { - range: { - start: 0, - end: 0, - minimumStep: 0 - }, - lineTop: 0 - }; +/***/ }), +/* 128 */ +/***/ (function(module, exports) { - this.defaultOptions = { - orientation: { - axis: 'bottom' - }, // axis orientation: 'top' or 'bottom' - showMinorLabels: true, - showMajorLabels: true, - maxMinorChars: 7, - format: TimeStep.FORMAT, - moment: moment, - timeAxis: null - }; - this.options = util.extend({}, this.defaultOptions); +module.exports = function (it) { + if (typeof it != 'function') throw TypeError(it + ' is not a function!'); + return it; +}; - this.body = body; - // create the HTML DOM - this._create(); +/***/ }), +/* 129 */ +/***/ (function(module, exports, __webpack_require__) { - this.setOptions(options); - } +"use strict"; - TimeAxis.prototype = new Component(); +var create = __webpack_require__(54); +var descriptor = __webpack_require__(39); +var setToStringTag = __webpack_require__(59); +var IteratorPrototype = {}; - /** - * Set options for the TimeAxis. - * Parameters will be merged in current options. - * @param {Object} options Available options: - * {string} [orientation.axis] - * {boolean} [showMinorLabels] - * {boolean} [showMajorLabels] - */ - TimeAxis.prototype.setOptions = function (options) { - if (options) { - // copy all options that we know - util.selectiveExtend(['showMinorLabels', 'showMajorLabels', 'maxMinorChars', 'hiddenDates', 'timeAxis', 'moment', 'rtl'], this.options, options); - - // deep copy the format options - util.selectiveDeepExtend(['format'], this.options, options); - - if ('orientation' in options) { - if (typeof options.orientation === 'string') { - this.options.orientation.axis = options.orientation; - } else if ((0, _typeof3['default'])(options.orientation) === 'object' && 'axis' in options.orientation) { - this.options.orientation.axis = options.orientation.axis; - } - } +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() +__webpack_require__(26)(IteratorPrototype, __webpack_require__(13)('iterator'), function () { return this; }); - // apply locale to moment.js - // TODO: not so nice, this is applied globally to moment.js - if ('locale' in options) { - if (typeof moment.locale === 'function') { - // moment.js 2.8.1+ - moment.locale(options.locale); - } else { - moment.lang(options.locale); - } - } - } - }; +module.exports = function (Constructor, NAME, next) { + Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); + setToStringTag(Constructor, NAME + ' Iterator'); +}; - /** - * Create the HTML DOM for the TimeAxis - */ - TimeAxis.prototype._create = function () { - this.dom.foreground = document.createElement('div'); - this.dom.background = document.createElement('div'); - this.dom.foreground.className = 'vis-time-axis vis-foreground'; - this.dom.background.className = 'vis-time-axis vis-background'; - }; +/***/ }), +/* 130 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Destroy the TimeAxis - */ - TimeAxis.prototype.destroy = function () { - // remove from DOM - if (this.dom.foreground.parentNode) { - this.dom.foreground.parentNode.removeChild(this.dom.foreground); - } - if (this.dom.background.parentNode) { - this.dom.background.parentNode.removeChild(this.dom.background); - } +var dP = __webpack_require__(20); +var anObject = __webpack_require__(27); +var getKeys = __webpack_require__(33); - this.body = null; - }; +module.exports = __webpack_require__(21) ? Object.defineProperties : function defineProperties(O, Properties) { + anObject(O); + var keys = getKeys(Properties); + var length = keys.length; + var i = 0; + var P; + while (length > i) dP.f(O, P = keys[i++], Properties[P]); + return O; +}; - /** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ - TimeAxis.prototype.redraw = function () { - var props = this.props; - var foreground = this.dom.foreground; - var background = this.dom.background; - // determine the correct parent DOM element (depending on option orientation) - var parent = this.options.orientation.axis == 'top' ? this.body.dom.top : this.body.dom.bottom; - var parentChanged = foreground.parentNode !== parent; +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { - // calculate character width and height - this._calculateCharSize(); +// false -> Array#indexOf +// true -> Array#includes +var toIObject = __webpack_require__(25); +var toLength = __webpack_require__(132); +var toAbsoluteIndex = __webpack_require__(133); +module.exports = function (IS_INCLUDES) { + return function ($this, el, fromIndex) { + var O = toIObject($this); + var length = toLength(O.length); + var index = toAbsoluteIndex(fromIndex, length); + var value; + // Array#includes uses SameValueZero equality algorithm + // eslint-disable-next-line no-self-compare + if (IS_INCLUDES && el != el) while (length > index) { + value = O[index++]; + // eslint-disable-next-line no-self-compare + if (value != value) return true; + // Array#indexOf ignores holes, Array#includes - not + } else for (;length > index; index++) if (IS_INCLUDES || index in O) { + if (O[index] === el) return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; +}; - // TODO: recalculate sizes only needed when parent is resized or options is changed - var showMinorLabels = this.options.showMinorLabels && this.options.orientation.axis !== 'none'; - var showMajorLabels = this.options.showMajorLabels && this.options.orientation.axis !== 'none'; - // determine the width and height of the elemens for the axis - props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; - props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; - props.height = props.minorLabelHeight + props.majorLabelHeight; - props.width = foreground.offsetWidth; +/***/ }), +/* 132 */ +/***/ (function(module, exports, __webpack_require__) { - props.minorLineHeight = this.body.domProps.root.height - props.majorLabelHeight - (this.options.orientation.axis == 'top' ? this.body.domProps.bottom.height : this.body.domProps.top.height); - props.minorLineWidth = 1; // TODO: really calculate width - props.majorLineHeight = props.minorLineHeight + props.majorLabelHeight; - props.majorLineWidth = 1; // TODO: really calculate width +// 7.1.15 ToLength +var toInteger = __webpack_require__(55); +var min = Math.min; +module.exports = function (it) { + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; - // take foreground and background offline while updating (is almost twice as fast) - var foregroundNextSibling = foreground.nextSibling; - var backgroundNextSibling = background.nextSibling; - foreground.parentNode && foreground.parentNode.removeChild(foreground); - background.parentNode && background.parentNode.removeChild(background); - foreground.style.height = this.props.height + 'px'; +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { - this._repaintLabels(); +var toInteger = __webpack_require__(55); +var max = Math.max; +var min = Math.min; +module.exports = function (index, length) { + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); +}; - // put DOM online again (at the same place) - if (foregroundNextSibling) { - parent.insertBefore(foreground, foregroundNextSibling); - } else { - parent.appendChild(foreground); - } - if (backgroundNextSibling) { - this.body.dom.backgroundVertical.insertBefore(background, backgroundNextSibling); - } else { - this.body.dom.backgroundVertical.appendChild(background); - } - return this._isResized() || parentChanged; - }; - /** - * Repaint major and minor text labels and vertical grid lines - * @private - */ - TimeAxis.prototype._repaintLabels = function () { - var orientation = this.options.orientation.axis; +/***/ }), +/* 134 */ +/***/ (function(module, exports, __webpack_require__) { - // calculate range and step (step such that we have space for 7 characters per label) - var start = util.convert(this.body.range.start, 'Number'); - var end = util.convert(this.body.range.end, 'Number'); - var timeLabelsize = this.body.util.toTime((this.props.minorCharWidth || 10) * this.options.maxMinorChars).valueOf(); - var minimumStep = timeLabelsize - DateUtil.getHiddenDurationBefore(this.options.moment, this.body.hiddenDates, this.body.range, timeLabelsize); - minimumStep -= this.body.util.toTime(0).valueOf(); +var document = __webpack_require__(18).document; +module.exports = document && document.documentElement; - var step = new TimeStep(new Date(start), new Date(end), minimumStep, this.body.hiddenDates); - step.setMoment(this.options.moment); - if (this.options.format) { - step.setFormat(this.options.format); - } - if (this.options.timeAxis) { - step.setScale(this.options.timeAxis); - } - this.step = step; - // Move all DOM elements to a "redundant" list, where they - // can be picked for re-use, and clear the lists with lines and texts. - // At the end of the function _repaintLabels, left over elements will be cleaned up - var dom = this.dom; - dom.redundant.lines = dom.lines; - dom.redundant.majorTexts = dom.majorTexts; - dom.redundant.minorTexts = dom.minorTexts; - dom.lines = []; - dom.majorTexts = []; - dom.minorTexts = []; - - var current; - var next; - var x; - var xNext; - var isMajor, nextIsMajor; - var showMinorGrid; - var width = 0, - prevWidth; - var line; - var labelMinor; - var xFirstMajorLabel = undefined; - var count = 0; - var MAX = 1000; - var className; - - step.start(); - next = step.getCurrent(); - xNext = this.body.util.toScreen(next); - while (step.hasNext() && count < MAX) { - count++; +/***/ }), +/* 135 */ +/***/ (function(module, exports, __webpack_require__) { - isMajor = step.isMajor(); - className = step.getClassName(); - labelMinor = step.getLabelMinor(); +var toInteger = __webpack_require__(55); +var defined = __webpack_require__(51); +// true -> String#at +// false -> String#codePointAt +module.exports = function (TO_STRING) { + return function (that, pos) { + var s = String(defined(that)); + var i = toInteger(pos); + var l = s.length; + var a, b; + if (i < 0 || i >= l) return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; +}; - current = next; - x = xNext; - step.next(); - next = step.getCurrent(); - nextIsMajor = step.isMajor(); - xNext = this.body.util.toScreen(next); +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { - prevWidth = width; - width = xNext - x; - switch (step.scale) { - case 'week': - showMinorGrid = true;break; - default: - showMinorGrid = width >= prevWidth * 0.4;break; // prevent displaying of the 31th of the month on a scale of 5 days - } +var anObject = __webpack_require__(27); +var get = __webpack_require__(137); +module.exports = __webpack_require__(7).getIterator = function (it) { + var iterFn = get(it); + if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!'); + return anObject(iterFn.call(it)); +}; - if (this.options.showMinorLabels && showMinorGrid) { - var label = this._repaintMinorText(x, labelMinor, orientation, className); - label.style.width = width + 'px'; // set width to prevent overflow - } - if (isMajor && this.options.showMajorLabels) { - if (x > 0) { - if (xFirstMajorLabel == undefined) { - xFirstMajorLabel = x; - } - label = this._repaintMajorText(x, step.getLabelMajor(), orientation, className); - } - line = this._repaintMajorLine(x, width, orientation, className); - } else { - // minor line - if (showMinorGrid) { - line = this._repaintMinorLine(x, width, orientation, className); - } else { - if (line) { - // adjust the width of the previous grid - line.style.width = parseInt(line.style.width) + width + 'px'; - } - } - } - } +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { - if (count === MAX && !warnedForOverflow) { - console.warn('Something is wrong with the Timeline scale. Limited drawing of grid lines to ' + MAX + ' lines.'); - warnedForOverflow = true; - } +var classof = __webpack_require__(86); +var ITERATOR = __webpack_require__(13)('iterator'); +var Iterators = __webpack_require__(31); +module.exports = __webpack_require__(7).getIteratorMethod = function (it) { + if (it != undefined) return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; - // create a major label on the left when needed - if (this.options.showMajorLabels) { - var leftTime = this.body.util.toTime(0), - leftText = step.getLabelMajor(leftTime), - widthText = leftText.length * (this.props.majorCharWidth || 10) + 10; // upper bound estimation - if (xFirstMajorLabel == undefined || widthText < xFirstMajorLabel) { - this._repaintMajorText(0, leftText, orientation, className); - } - } +/***/ }), +/* 138 */ +/***/ (function(module, exports, __webpack_require__) { - // Cleanup leftover DOM elements from the redundant list - util.forEach(this.dom.redundant, function (arr) { - while (arr.length) { - var elem = arr.pop(); - if (elem && elem.parentNode) { - elem.parentNode.removeChild(elem); - } - } - }); - }; +__webpack_require__(139); +var $Object = __webpack_require__(7).Object; +module.exports = function create(P, D) { + return $Object.create(P, D); +}; - /** - * Create a minor label for the axis at position x - * @param {Number} x - * @param {String} text - * @param {String} orientation "top" or "bottom" (default) - * @param {String} className - * @return {Element} Returns the HTML element of the created label - * @private - */ - TimeAxis.prototype._repaintMinorText = function (x, text, orientation, className) { - // reuse redundant label - var label = this.dom.redundant.minorTexts.shift(); - if (!label) { - // create new label - var content = document.createTextNode(''); - label = document.createElement('div'); - label.appendChild(content); - this.dom.foreground.appendChild(label); - } - this.dom.minorTexts.push(label); - label.innerHTML = text; +/***/ }), +/* 139 */ +/***/ (function(module, exports, __webpack_require__) { - label.style.top = orientation == 'top' ? this.props.majorLabelHeight + 'px' : '0'; +var $export = __webpack_require__(17); +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +$export($export.S, 'Object', { create: __webpack_require__(54) }); - if (this.options.rtl) { - label.style.left = ""; - label.style.right = x + 'px'; - } else { - label.style.left = x + 'px'; - }; - label.className = 'vis-text vis-minor ' + className; - //label.title = title; // TODO: this is a heavy operation - return label; - }; +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Create a Major label for the axis at position x - * @param {Number} x - * @param {String} text - * @param {String} orientation "top" or "bottom" (default) - * @param {String} className - * @return {Element} Returns the HTML element of the created label - * @private - */ - TimeAxis.prototype._repaintMajorText = function (x, text, orientation, className) { - // reuse redundant label - var label = this.dom.redundant.majorTexts.shift(); +__webpack_require__(141); +module.exports = __webpack_require__(7).Object.keys; - if (!label) { - // create label - var content = document.createElement('div'); - label = document.createElement('div'); - label.appendChild(content); - this.dom.foreground.appendChild(label); - } - label.childNodes[0].innerHTML = text; - label.className = 'vis-text vis-major ' + className; - //label.title = title; // TODO: this is a heavy operation +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { - label.style.top = orientation == 'top' ? '0' : this.props.minorLabelHeight + 'px'; - if (this.options.rtl) { - label.style.left = ""; - label.style.right = x + 'px'; - } else { - label.style.left = x + 'px'; - }; +// 19.1.2.14 Object.keys(O) +var toObject = __webpack_require__(41); +var $keys = __webpack_require__(33); - this.dom.majorTexts.push(label); - return label; +__webpack_require__(87)('keys', function () { + return function keys(it) { + return $keys(toObject(it)); }; +}); - /** - * Create a minor line for the axis at position x - * @param {Number} x - * @param {Number} width - * @param {String} orientation "top" or "bottom" (default) - * @param {String} className - * @return {Element} Returns the created line - * @private - */ - TimeAxis.prototype._repaintMinorLine = function (x, width, orientation, className) { - // reuse redundant line - var line = this.dom.redundant.lines.shift(); - if (!line) { - // create vertical line - line = document.createElement('div'); - this.dom.background.appendChild(line); - } - this.dom.lines.push(line); - var props = this.props; - if (orientation == 'top') { - line.style.top = props.majorLabelHeight + 'px'; - } else { - line.style.top = this.body.domProps.top.height + 'px'; - } - line.style.height = props.minorLineHeight + 'px'; - if (this.options.rtl) { - line.style.left = ""; - line.style.right = x - props.minorLineWidth / 2 + 'px'; - line.className = 'vis-grid vis-vertical-rtl vis-minor ' + className; - } else { - line.style.left = x - props.minorLineWidth / 2 + 'px'; - line.className = 'vis-grid vis-vertical vis-minor ' + className; - }; - line.style.width = width + 'px'; +/***/ }), +/* 142 */ +/***/ (function(module, exports, __webpack_require__) { - return line; - }; +module.exports = { "default": __webpack_require__(143), __esModule: true }; - /** - * Create a Major line for the axis at position x - * @param {Number} x - * @param {Number} width - * @param {String} orientation "top" or "bottom" (default) - * @param {String} className - * @return {Element} Returns the created line - * @private - */ - TimeAxis.prototype._repaintMajorLine = function (x, width, orientation, className) { - // reuse redundant line - var line = this.dom.redundant.lines.shift(); - if (!line) { - // create vertical line - line = document.createElement('div'); - this.dom.background.appendChild(line); - } - this.dom.lines.push(line); +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { - var props = this.props; - if (orientation == 'top') { - line.style.top = '0'; - } else { - line.style.top = this.body.domProps.top.height + 'px'; - } +__webpack_require__(60); +__webpack_require__(49); +module.exports = __webpack_require__(61).f('iterator'); - if (this.options.rtl) { - line.style.left = ""; - line.style.right = x - props.majorLineWidth / 2 + 'px'; - line.className = 'vis-grid vis-vertical-rtl vis-major ' + className; - } else { - line.style.left = x - props.majorLineWidth / 2 + 'px'; - line.className = 'vis-grid vis-vertical vis-major ' + className; - } - line.style.height = props.majorLineHeight + 'px'; - line.style.width = width + 'px'; +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { - return line; - }; +module.exports = { "default": __webpack_require__(145), __esModule: true }; - /** - * Determine the size of text on the axis (both major and minor axis). - * The size is calculated only once and then cached in this.props. - * @private - */ - TimeAxis.prototype._calculateCharSize = function () { - // Note: We calculate char size with every redraw. Size may change, for - // example when any of the timelines parents had display:none for example. +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { - // determine the char width and height on the minor axis - if (!this.dom.measureCharMinor) { - this.dom.measureCharMinor = document.createElement('DIV'); - this.dom.measureCharMinor.className = 'vis-text vis-minor vis-measure'; - this.dom.measureCharMinor.style.position = 'absolute'; +__webpack_require__(146); +__webpack_require__(151); +__webpack_require__(152); +__webpack_require__(153); +module.exports = __webpack_require__(7).Symbol; - this.dom.measureCharMinor.appendChild(document.createTextNode('0')); - this.dom.foreground.appendChild(this.dom.measureCharMinor); - } - this.props.minorCharHeight = this.dom.measureCharMinor.clientHeight; - this.props.minorCharWidth = this.dom.measureCharMinor.clientWidth; - // determine the char width and height on the major axis - if (!this.dom.measureCharMajor) { - this.dom.measureCharMajor = document.createElement('DIV'); - this.dom.measureCharMajor.className = 'vis-text vis-major vis-measure'; - this.dom.measureCharMajor.style.position = 'absolute'; +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { - this.dom.measureCharMajor.appendChild(document.createTextNode('0')); - this.dom.foreground.appendChild(this.dom.measureCharMajor); - } - this.props.majorCharHeight = this.dom.measureCharMajor.clientHeight; - this.props.majorCharWidth = this.dom.measureCharMajor.clientWidth; +"use strict"; + +// ECMAScript 6 symbols shim +var global = __webpack_require__(18); +var has = __webpack_require__(22); +var DESCRIPTORS = __webpack_require__(21); +var $export = __webpack_require__(17); +var redefine = __webpack_require__(83); +var META = __webpack_require__(147).KEY; +var $fails = __webpack_require__(28); +var shared = __webpack_require__(57); +var setToStringTag = __webpack_require__(59); +var uid = __webpack_require__(40); +var wks = __webpack_require__(13); +var wksExt = __webpack_require__(61); +var wksDefine = __webpack_require__(62); +var enumKeys = __webpack_require__(148); +var isArray = __webpack_require__(149); +var anObject = __webpack_require__(27); +var toIObject = __webpack_require__(25); +var toPrimitive = __webpack_require__(53); +var createDesc = __webpack_require__(39); +var _create = __webpack_require__(54); +var gOPNExt = __webpack_require__(150); +var $GOPD = __webpack_require__(89); +var $DP = __webpack_require__(20); +var $keys = __webpack_require__(33); +var gOPD = $GOPD.f; +var dP = $DP.f; +var gOPN = gOPNExt.f; +var $Symbol = global.Symbol; +var $JSON = global.JSON; +var _stringify = $JSON && $JSON.stringify; +var PROTOTYPE = 'prototype'; +var HIDDEN = wks('_hidden'); +var TO_PRIMITIVE = wks('toPrimitive'); +var isEnum = {}.propertyIsEnumerable; +var SymbolRegistry = shared('symbol-registry'); +var AllSymbols = shared('symbols'); +var OPSymbols = shared('op-symbols'); +var ObjectProto = Object[PROTOTYPE]; +var USE_NATIVE = typeof $Symbol == 'function'; +var QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 +var setSymbolDesc = DESCRIPTORS && $fails(function () { + return _create(dP({}, 'a', { + get: function () { return dP(this, 'a', { value: 7 }).a; } + })).a != 7; +}) ? function (it, key, D) { + var protoDesc = gOPD(ObjectProto, key); + if (protoDesc) delete ObjectProto[key]; + dP(it, key, D); + if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); +} : dP; + +var wrap = function (tag) { + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; +}; + +var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + return it instanceof $Symbol; +}; + +var $defineProperty = function defineProperty(it, key, D) { + if (it === ObjectProto) $defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if (has(AllSymbols, key)) { + if (!D.enumerable) { + if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; + D = _create(D, { enumerable: createDesc(0, false) }); + } return setSymbolDesc(it, key, D); + } return dP(it, key, D); +}; +var $defineProperties = function defineProperties(it, P) { + anObject(it); + var keys = enumKeys(P = toIObject(P)); + var i = 0; + var l = keys.length; + var key; + while (l > i) $defineProperty(it, key = keys[i++], P[key]); + return it; +}; +var $create = function create(it, P) { + return P === undefined ? _create(it) : $defineProperties(_create(it), P); +}; +var $propertyIsEnumerable = function propertyIsEnumerable(key) { + var E = isEnum.call(this, key = toPrimitive(key, true)); + if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; +}; +var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { + it = toIObject(it); + key = toPrimitive(key, true); + if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; + var D = gOPD(it, key); + if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; + return D; +}; +var $getOwnPropertyNames = function getOwnPropertyNames(it) { + var names = gOPN(toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); + } return result; +}; +var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { + var IS_OP = it === ObjectProto; + var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); + var result = []; + var i = 0; + var key; + while (names.length > i) { + if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); + } return result; +}; + +// 19.4.1.1 Symbol([description]) +if (!USE_NATIVE) { + $Symbol = function Symbol() { + if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function (value) { + if (this === ObjectProto) $set.call(OPSymbols, value); + if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); + return wrap(tag); }; + redefine($Symbol[PROTOTYPE], 'toString', function toString() { + return this._k; + }); - var warnedForOverflow = false; + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + __webpack_require__(88).f = gOPNExt.f = $getOwnPropertyNames; + __webpack_require__(42).f = $propertyIsEnumerable; + __webpack_require__(63).f = $getOwnPropertySymbols; - module.exports = TimeAxis; + if (DESCRIPTORS && !__webpack_require__(52)) { + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { + wksExt.f = function (name) { + return wrap(wks(name)); + }; +} - 'use strict'; +$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); - var keycharm = __webpack_require__(116); - var Emitter = __webpack_require__(99); - var Hammer = __webpack_require__(113); - var util = __webpack_require__(1); +for (var es6Symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' +).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); - /** - * Turn an element into an clickToUse element. - * When not active, the element has a transparent overlay. When the overlay is - * clicked, the mode is changed to active. - * When active, the element is displayed with a blue border around it, and - * the interactive contents of the element can be used. When clicked outside - * the element, the elements mode is changed to inactive. - * @param {Element} container - * @constructor - */ - function Activator(container) { - this.active = false; +for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); - this.dom = { - container: container - }; +$export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function (key) { + return has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(sym) { + if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); + for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; + }, + useSetter: function () { setter = true; }, + useSimple: function () { setter = false; } +}); - this.dom.overlay = document.createElement('div'); - this.dom.overlay.className = 'vis-overlay'; +$export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols +}); - this.dom.container.appendChild(this.dom.overlay); +// 24.3.2 JSON.stringify(value [, replacer [, space]]) +$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; +})), 'JSON', { + stringify: function stringify(it) { + if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined + var args = [it]; + var i = 1; + var replacer, $replacer; + while (arguments.length > i) args.push(arguments[i++]); + replacer = args[1]; + if (typeof replacer == 'function') $replacer = replacer; + if ($replacer || !isArray(replacer)) replacer = function (key, value) { + if ($replacer) value = $replacer.call(this, key, value); + if (!isSymbol(value)) return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } +}); - this.hammer = Hammer(this.dom.overlay); - this.hammer.on('tap', this._onTapOverlay.bind(this)); +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) +$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(26)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] +setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] +setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] +setToStringTag(global.JSON, 'JSON', true); - // block all touch events (except tap) - var me = this; - var events = ['tap', 'doubletap', 'press', 'pinch', 'pan', 'panstart', 'panmove', 'panend']; - events.forEach(function (event) { - me.hammer.on(event, function (event) { - event.stopPropagation(); - }); - }); - // attach a click event to the window, in order to deactivate when clicking outside the timeline - if (document && document.body) { - this.onClick = function (event) { - if (!_hasParent(event.target, container)) { - me.deactivate(); - } - }; - document.body.addEventListener('click', this.onClick); - } +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.keycharm !== undefined) { - this.keycharm.destroy(); - } - this.keycharm = keycharm(); +var META = __webpack_require__(40)('meta'); +var isObject = __webpack_require__(32); +var has = __webpack_require__(22); +var setDesc = __webpack_require__(20).f; +var id = 0; +var isExtensible = Object.isExtensible || function () { + return true; +}; +var FREEZE = !__webpack_require__(28)(function () { + return isExtensible(Object.preventExtensions({})); +}); +var setMeta = function (it) { + setDesc(it, META, { value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + } }); +}; +var fastKey = function (it, create) { + // return primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; +}; +var getWeak = function (it, create) { + if (!has(it, META)) { + // can't set metadata to uncaught frozen object + if (!isExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; +}; +// add metadata on freeze-family methods calling +var onFreeze = function (it) { + if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); + return it; +}; +var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze +}; - // keycharm listener only bounded when active) - this.escListener = this.deactivate.bind(this); - } - // turn into an event emitter - Emitter(Activator.prototype); +/***/ }), +/* 148 */ +/***/ (function(module, exports, __webpack_require__) { + +// all enumerable object keys, includes symbols +var getKeys = __webpack_require__(33); +var gOPS = __webpack_require__(63); +var pIE = __webpack_require__(42); +module.exports = function (it) { + var result = getKeys(it); + var getSymbols = gOPS.f; + if (getSymbols) { + var symbols = getSymbols(it); + var isEnum = pIE.f; + var i = 0; + var key; + while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); + } return result; +}; - // The currently active activator - Activator.current = null; - /** - * Destroy the activator. Cleans up all created DOM and event listeners - */ - Activator.prototype.destroy = function () { - this.deactivate(); +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { - // remove dom - this.dom.overlay.parentNode.removeChild(this.dom.overlay); +// 7.2.2 IsArray(argument) +var cof = __webpack_require__(50); +module.exports = Array.isArray || function isArray(arg) { + return cof(arg) == 'Array'; +}; - // remove global event listener - if (this.onClick) { - document.body.removeEventListener('click', this.onClick); - } - // cleanup hammer instances - this.hammer.destroy(); - this.hammer = null; - // FIXME: cleaning up hammer instances doesn't work (Timeline not removed from memory) - }; +/***/ }), +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Activate the element - * Overlay is hidden, element is decorated with a blue shadow border - */ - Activator.prototype.activate = function () { - // we allow only one active activator at a time - if (Activator.current) { - Activator.current.deactivate(); - } - Activator.current = this; +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window +var toIObject = __webpack_require__(25); +var gOPN = __webpack_require__(88).f; +var toString = {}.toString; - this.active = true; - this.dom.overlay.style.display = 'none'; - util.addClassName(this.dom.container, 'vis-active'); +var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; - this.emit('change'); - this.emit('activate'); +var getWindowNames = function (it) { + try { + return gOPN(it); + } catch (e) { + return windowNames.slice(); + } +}; - // ugly hack: bind ESC after emitting the events, as the Network rebinds all - // keyboard events on a 'change' event - this.keycharm.bind('esc', this.escListener); - }; +module.exports.f = function getOwnPropertyNames(it) { + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); +}; - /** - * Deactivate the element - * Overlay is displayed on top of the element - */ - Activator.prototype.deactivate = function () { - this.active = false; - this.dom.overlay.style.display = ''; - util.removeClassName(this.dom.container, 'vis-active'); - this.keycharm.unbind('esc', this.escListener); - - this.emit('change'); - this.emit('deactivate'); - }; - /** - * Handle a tap event: activate the container - * @param event - * @private - */ - Activator.prototype._onTapOverlay = function (event) { - // activate the container - this.activate(); - event.stopPropagation(); - }; +/***/ }), +/* 151 */ +/***/ (function(module, exports) { - /** - * Test whether the element has the requested parent element somewhere in - * its chain of parent nodes. - * @param {HTMLElement} element - * @param {HTMLElement} parent - * @returns {boolean} Returns true when the parent is found somewhere in the - * chain of parent nodes. - * @private - */ - function _hasParent(element, parent) { - while (element) { - if (element === parent) { - return true; - } - element = element.parentNode; - } - return false; - } - module.exports = Activator; /***/ }), -/* 142 */ +/* 152 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +__webpack_require__(62)('asyncIterator'); - var Hammer = __webpack_require__(113); - var util = __webpack_require__(1); - var Component = __webpack_require__(121); - var moment = __webpack_require__(82); - var locales = __webpack_require__(143); - /** - * A custom time bar - * @param {{range: Range, dom: Object}} body - * @param {Object} [options] Available parameters: - * {number | string} id - * {string} locales - * {string} locale - * @constructor CustomTime - * @extends Component - */ +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { - function CustomTime(body, options) { - this.body = body; +__webpack_require__(62)('observable'); - // default options - this.defaultOptions = { - moment: moment, - locales: locales, - locale: 'en', - id: undefined, - title: undefined - }; - this.options = util.extend({}, this.defaultOptions); - if (options && options.time) { - this.customTime = options.time; +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js +//! version : 2.19.1 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com + +;(function (global, factory) { + true ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + global.moment = factory() +}(this, (function () { 'use strict'; + +var hookCallback; + +function hooks () { + return hookCallback.apply(null, arguments); +} + +// This is done to register the method called with moment() +// without creating circular dependencies. +function setHookCallback (callback) { + hookCallback = callback; +} + +function isArray(input) { + return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; +} + +function isObject(input) { + // IE8 will treat undefined and null as object if it wasn't for + // input != null + return input != null && Object.prototype.toString.call(input) === '[object Object]'; +} + +function isObjectEmpty(obj) { + if (Object.getOwnPropertyNames) { + return (Object.getOwnPropertyNames(obj).length === 0); } else { - this.customTime = new Date(); + var k; + for (k in obj) { + if (obj.hasOwnProperty(k)) { + return false; + } + } + return true; } +} - this.eventParams = {}; // stores state parameters while dragging the bar +function isUndefined(input) { + return input === void 0; +} - this.setOptions(options); +function isNumber(input) { + return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; +} - // create the DOM - this._create(); - } +function isDate(input) { + return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; +} - CustomTime.prototype = new Component(); +function map(arr, fn) { + var res = [], i; + for (i = 0; i < arr.length; ++i) { + res.push(fn(arr[i], i)); + } + return res; +} - /** - * Set options for the component. Options will be merged in current options. - * @param {Object} options Available parameters: - * {number | string} id - * {string} locales - * {string} locale - */ - CustomTime.prototype.setOptions = function (options) { - if (options) { - // copy all options that we know - util.selectiveExtend(['moment', 'locale', 'locales', 'id'], this.options, options); +function hasOwnProp(a, b) { + return Object.prototype.hasOwnProperty.call(a, b); +} + +function extend(a, b) { + for (var i in b) { + if (hasOwnProp(b, i)) { + a[i] = b[i]; + } } - }; - /** - * Create the DOM for the custom time - * @private - */ - CustomTime.prototype._create = function () { - var bar = document.createElement('div'); - bar['custom-time'] = this; - bar.className = 'vis-custom-time ' + (this.options.id || ''); - bar.style.position = 'absolute'; - bar.style.top = '0px'; - bar.style.height = '100%'; - this.bar = bar; - - var drag = document.createElement('div'); - drag.style.position = 'relative'; - drag.style.top = '0px'; - drag.style.left = '-10px'; - drag.style.height = '100%'; - drag.style.width = '20px'; - - function onMouseWheel(e) { - this.body.range._onMouseWheel(e); - } - - if (drag.addEventListener) { - // IE9, Chrome, Safari, Opera - drag.addEventListener("mousewheel", onMouseWheel.bind(this), false); - // Firefox - drag.addEventListener("DOMMouseScroll", onMouseWheel.bind(this), false); - } else { - // IE 6/7/8 - drag.attachEvent("onmousewheel", onMouseWheel.bind(this)); + if (hasOwnProp(b, 'toString')) { + a.toString = b.toString; } - bar.appendChild(drag); - // attach event listeners - this.hammer = new Hammer(drag); - this.hammer.on('panstart', this._onDragStart.bind(this)); - this.hammer.on('panmove', this._onDrag.bind(this)); - this.hammer.on('panend', this._onDragEnd.bind(this)); - this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_HORIZONTAL }); - }; + if (hasOwnProp(b, 'valueOf')) { + a.valueOf = b.valueOf; + } - /** - * Destroy the CustomTime bar - */ - CustomTime.prototype.destroy = function () { - this.hide(); + return a; +} - this.hammer.destroy(); - this.hammer = null; +function createUTC (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, true).utc(); +} - this.body = null; - }; +function defaultParsingFlags() { + // We need to deep clone this object. + return { + empty : false, + unusedTokens : [], + unusedInput : [], + overflow : -2, + charsLeftOver : 0, + nullInput : false, + invalidMonth : null, + invalidFormat : false, + userInvalidated : false, + iso : false, + parsedDateParts : [], + meridiem : null, + rfc2822 : false, + weekdayMismatch : false + }; +} - /** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ - CustomTime.prototype.redraw = function () { - var parent = this.body.dom.backgroundVertical; - if (this.bar.parentNode != parent) { - // attach to the dom - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - parent.appendChild(this.bar); +function getParsingFlags(m) { + if (m._pf == null) { + m._pf = defaultParsingFlags(); } + return m._pf; +} - var x = this.body.util.toScreen(this.customTime); +var some; +if (Array.prototype.some) { + some = Array.prototype.some; +} else { + some = function (fun) { + var t = Object(this); + var len = t.length >>> 0; - var locale = this.options.locales[this.options.locale]; - if (!locale) { - if (!this.warned) { - console.log('WARNING: options.locales[\'' + this.options.locale + '\'] not found. See http://visjs.org/docs/timeline/#Localization'); - this.warned = true; - } - locale = this.options.locales['en']; // fall back on english when not available - } + for (var i = 0; i < len; i++) { + if (i in t && fun.call(this, t[i], i, t)) { + return true; + } + } - var title = this.options.title; - // To hide the title completely use empty string ''. - if (title === undefined) { - title = locale.time + ': ' + this.options.moment(this.customTime).format('dddd, MMMM Do YYYY, H:mm:ss'); - title = title.charAt(0).toUpperCase() + title.substring(1); - } else if (typeof title === "function") { - title = title.call(this.customTime); - } + return false; + }; +} - this.bar.style.left = x + 'px'; - this.bar.title = title; +function isValid(m) { + if (m._isValid == null) { + var flags = getParsingFlags(m); + var parsedParts = some.call(flags.parsedDateParts, function (i) { + return i != null; + }); + var isNowValid = !isNaN(m._d.getTime()) && + flags.overflow < 0 && + !flags.empty && + !flags.invalidMonth && + !flags.invalidWeekday && + !flags.weekdayMismatch && + !flags.nullInput && + !flags.invalidFormat && + !flags.userInvalidated && + (!flags.meridiem || (flags.meridiem && parsedParts)); + + if (m._strict) { + isNowValid = isNowValid && + flags.charsLeftOver === 0 && + flags.unusedTokens.length === 0 && + flags.bigHour === undefined; + } + + if (Object.isFrozen == null || !Object.isFrozen(m)) { + m._isValid = isNowValid; + } + else { + return isNowValid; + } + } + return m._isValid; +} - return false; - }; +function createInvalid (flags) { + var m = createUTC(NaN); + if (flags != null) { + extend(getParsingFlags(m), flags); + } + else { + getParsingFlags(m).userInvalidated = true; + } - /** - * Remove the CustomTime from the DOM - */ - CustomTime.prototype.hide = function () { - // remove the line from the DOM - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); + return m; +} + +// Plugins that add properties should also add the key here (null value), +// so we can properly clone ourselves. +var momentProperties = hooks.momentProperties = []; + +function copyConfig(to, from) { + var i, prop, val; + + if (!isUndefined(from._isAMomentObject)) { + to._isAMomentObject = from._isAMomentObject; + } + if (!isUndefined(from._i)) { + to._i = from._i; + } + if (!isUndefined(from._f)) { + to._f = from._f; + } + if (!isUndefined(from._l)) { + to._l = from._l; + } + if (!isUndefined(from._strict)) { + to._strict = from._strict; + } + if (!isUndefined(from._tzm)) { + to._tzm = from._tzm; + } + if (!isUndefined(from._isUTC)) { + to._isUTC = from._isUTC; + } + if (!isUndefined(from._offset)) { + to._offset = from._offset; + } + if (!isUndefined(from._pf)) { + to._pf = getParsingFlags(from); + } + if (!isUndefined(from._locale)) { + to._locale = from._locale; } - }; - /** - * Set custom time. - * @param {Date | number | string} time - */ - CustomTime.prototype.setCustomTime = function (time) { - this.customTime = util.convert(time, 'Date'); - this.redraw(); - }; + if (momentProperties.length > 0) { + for (i = 0; i < momentProperties.length; i++) { + prop = momentProperties[i]; + val = from[prop]; + if (!isUndefined(val)) { + to[prop] = val; + } + } + } - /** - * Retrieve the current custom time. - * @return {Date} customTime - */ - CustomTime.prototype.getCustomTime = function () { - return new Date(this.customTime.valueOf()); - }; + return to; +} - /** - * Set custom title. - * @param {Date | number | string} title - */ - CustomTime.prototype.setCustomTitle = function (title) { - this.options.title = title; - }; +var updateInProgress = false; - /** - * Start moving horizontally - * @param {Event} event - * @private - */ - CustomTime.prototype._onDragStart = function (event) { - this.eventParams.dragging = true; - this.eventParams.customTime = this.customTime; +// Moment prototype object +function Moment(config) { + copyConfig(this, config); + this._d = new Date(config._d != null ? config._d.getTime() : NaN); + if (!this.isValid()) { + this._d = new Date(NaN); + } + // Prevent infinite loop in case updateOffset creates new moment + // objects. + if (updateInProgress === false) { + updateInProgress = true; + hooks.updateOffset(this); + updateInProgress = false; + } +} - event.stopPropagation(); - }; +function isMoment (obj) { + return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); +} - /** - * Perform moving operating. - * @param {Event} event - * @private - */ - CustomTime.prototype._onDrag = function (event) { - if (!this.eventParams.dragging) return; +function absFloor (number) { + if (number < 0) { + // -0 -> 0 + return Math.ceil(number) || 0; + } else { + return Math.floor(number); + } +} - var x = this.body.util.toScreen(this.eventParams.customTime) + event.deltaX; - var time = this.body.util.toTime(x); +function toInt(argumentForCoercion) { + var coercedNumber = +argumentForCoercion, + value = 0; - this.setCustomTime(time); + if (coercedNumber !== 0 && isFinite(coercedNumber)) { + value = absFloor(coercedNumber); + } - // fire a timechange event - this.body.emitter.emit('timechange', { - id: this.options.id, - time: new Date(this.customTime.valueOf()), - event: event - }); + return value; +} - event.stopPropagation(); - }; +// compare two arrays, return the number of differences +function compareArrays(array1, array2, dontConvert) { + var len = Math.min(array1.length, array2.length), + lengthDiff = Math.abs(array1.length - array2.length), + diffs = 0, + i; + for (i = 0; i < len; i++) { + if ((dontConvert && array1[i] !== array2[i]) || + (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { + diffs++; + } + } + return diffs + lengthDiff; +} - /** - * Stop moving operating. - * @param {Event} event - * @private - */ - CustomTime.prototype._onDragEnd = function (event) { - if (!this.eventParams.dragging) return; +function warn(msg) { + if (hooks.suppressDeprecationWarnings === false && + (typeof console !== 'undefined') && console.warn) { + console.warn('Deprecation warning: ' + msg); + } +} - // fire a timechanged event - this.body.emitter.emit('timechanged', { - id: this.options.id, - time: new Date(this.customTime.valueOf()), - event: event - }); +function deprecate(msg, fn) { + var firstTime = true; - event.stopPropagation(); - }; + return extend(function () { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(null, msg); + } + if (firstTime) { + var args = []; + var arg; + for (var i = 0; i < arguments.length; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (var key in arguments[0]) { + arg += key + ': ' + arguments[0][key] + ', '; + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); + firstTime = false; + } + return fn.apply(this, arguments); + }, fn); +} - /** - * Find a custom time from an event target: - * searches for the attribute 'custom-time' in the event target's element tree - * @param {Event} event - * @return {CustomTime | null} customTime - */ - CustomTime.customTimeFromTarget = function (event) { - var target = event.target; - while (target) { - if (target.hasOwnProperty('custom-time')) { - return target['custom-time']; - } - target = target.parentNode; +var deprecations = {}; + +function deprecateSimple(name, msg) { + if (hooks.deprecationHandler != null) { + hooks.deprecationHandler(name, msg); + } + if (!deprecations[name]) { + warn(msg); + deprecations[name] = true; } +} - return null; - }; +hooks.suppressDeprecationWarnings = false; +hooks.deprecationHandler = null; - module.exports = CustomTime; +function isFunction(input) { + return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; +} -/***/ }), -/* 143 */ -/***/ (function(module, exports) { +function set (config) { + var prop, i; + for (i in config) { + prop = config[i]; + if (isFunction(prop)) { + this[i] = prop; + } else { + this['_' + i] = prop; + } + } + this._config = config; + // Lenient ordinal parsing accepts just a number in addition to + // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. + // TODO: Remove "ordinalParse" fallback in next major release. + this._dayOfMonthOrdinalParseLenient = new RegExp( + (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + + '|' + (/\d{1,2}/).source); +} + +function mergeConfigs(parentConfig, childConfig) { + var res = extend({}, parentConfig), prop; + for (prop in childConfig) { + if (hasOwnProp(childConfig, prop)) { + if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { + res[prop] = {}; + extend(res[prop], parentConfig[prop]); + extend(res[prop], childConfig[prop]); + } else if (childConfig[prop] != null) { + res[prop] = childConfig[prop]; + } else { + delete res[prop]; + } + } + } + for (prop in parentConfig) { + if (hasOwnProp(parentConfig, prop) && + !hasOwnProp(childConfig, prop) && + isObject(parentConfig[prop])) { + // make sure changes to properties don't modify parent config + res[prop] = extend({}, res[prop]); + } + } + return res; +} - 'use strict'; +function Locale(config) { + if (config != null) { + this.set(config); + } +} - // English - exports['en'] = { - current: 'current', - time: 'time' - }; - exports['en_EN'] = exports['en']; - exports['en_US'] = exports['en']; +var keys; - // Italiano - exports['it'] = { - current: 'attuale', - time: 'tempo' - }; - exports['it_IT'] = exports['it']; - exports['it_CH'] = exports['it']; +if (Object.keys) { + keys = Object.keys; +} else { + keys = function (obj) { + var i, res = []; + for (i in obj) { + if (hasOwnProp(obj, i)) { + res.push(i); + } + } + return res; + }; +} + +var defaultCalendar = { + sameDay : '[Today at] LT', + nextDay : '[Tomorrow at] LT', + nextWeek : 'dddd [at] LT', + lastDay : '[Yesterday at] LT', + lastWeek : '[Last] dddd [at] LT', + sameElse : 'L' +}; + +function calendar (key, mom, now) { + var output = this._calendar[key] || this._calendar['sameElse']; + return isFunction(output) ? output.call(mom, now) : output; +} + +var defaultLongDateFormat = { + LTS : 'h:mm:ss A', + LT : 'h:mm A', + L : 'MM/DD/YYYY', + LL : 'MMMM D, YYYY', + LLL : 'MMMM D, YYYY h:mm A', + LLLL : 'dddd, MMMM D, YYYY h:mm A' +}; + +function longDateFormat (key) { + var format = this._longDateFormat[key], + formatUpper = this._longDateFormat[key.toUpperCase()]; + + if (format || !formatUpper) { + return format; + } + + this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { + return val.slice(1); + }); - // Dutch - exports['nl'] = { - current: 'huidige', - time: 'tijd' - }; - exports['nl_NL'] = exports['nl']; - exports['nl_BE'] = exports['nl']; + return this._longDateFormat[key]; +} - // German - exports['de'] = { - current: 'Aktuelle', - time: 'Zeit' - }; - exports['de_DE'] = exports['de']; +var defaultInvalidDate = 'Invalid date'; - // French - exports['fr'] = { - current: 'actuel', - time: 'heure' - }; - exports['fr_FR'] = exports['fr']; - exports['fr_CA'] = exports['fr']; - exports['fr_BE'] = exports['fr']; - - // Espanol - exports['es'] = { - current: 'corriente', - time: 'hora' - }; - exports['es_ES'] = exports['es']; +function invalidDate () { + return this._invalidDate; +} -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { +var defaultOrdinal = '%d'; +var defaultDayOfMonthOrdinalParse = /\d{1,2}/; - 'use strict'; +function ordinal (number) { + return this._ordinal.replace('%d', number); +} - var util = __webpack_require__(1); - var Component = __webpack_require__(121); - var moment = __webpack_require__(82); - var locales = __webpack_require__(143); +var defaultRelativeTime = { + future : 'in %s', + past : '%s ago', + s : 'a few seconds', + ss : '%d seconds', + m : 'a minute', + mm : '%d minutes', + h : 'an hour', + hh : '%d hours', + d : 'a day', + dd : '%d days', + M : 'a month', + MM : '%d months', + y : 'a year', + yy : '%d years' +}; - /** - * A current time bar - * @param {{range: Range, dom: Object, domProps: Object}} body - * @param {Object} [options] Available parameters: - * {Boolean} [showCurrentTime] - * @constructor CurrentTime - * @extends Component - */ - function CurrentTime(body, options) { - this.body = body; +function relativeTime (number, withoutSuffix, string, isFuture) { + var output = this._relativeTime[string]; + return (isFunction(output)) ? + output(number, withoutSuffix, string, isFuture) : + output.replace(/%d/i, number); +} - // default options - this.defaultOptions = { - rtl: false, - showCurrentTime: true, +function pastFuture (diff, output) { + var format = this._relativeTime[diff > 0 ? 'future' : 'past']; + return isFunction(format) ? format(output) : format.replace(/%s/i, output); +} - moment: moment, - locales: locales, - locale: 'en' - }; - this.options = util.extend({}, this.defaultOptions); - this.offset = 0; +var aliases = {}; - this._create(); +function addUnitAlias (unit, shorthand) { + var lowerCase = unit.toLowerCase(); + aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; +} - this.setOptions(options); - } +function normalizeUnits(units) { + return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; +} - CurrentTime.prototype = new Component(); +function normalizeObjectUnits(inputObject) { + var normalizedInput = {}, + normalizedProp, + prop; - /** - * Create the HTML DOM for the current time bar - * @private - */ - CurrentTime.prototype._create = function () { - var bar = document.createElement('div'); - bar.className = 'vis-current-time'; - bar.style.position = 'absolute'; - bar.style.top = '0px'; - bar.style.height = '100%'; - - this.bar = bar; - }; + for (prop in inputObject) { + if (hasOwnProp(inputObject, prop)) { + normalizedProp = normalizeUnits(prop); + if (normalizedProp) { + normalizedInput[normalizedProp] = inputObject[prop]; + } + } + } - /** - * Destroy the CurrentTime bar - */ - CurrentTime.prototype.destroy = function () { - this.options.showCurrentTime = false; - this.redraw(); // will remove the bar from the DOM and stop refreshing + return normalizedInput; +} - this.body = null; - }; +var priorities = {}; - /** - * Set options for the component. Options will be merged in current options. - * @param {Object} options Available parameters: - * {boolean} [showCurrentTime] - */ - CurrentTime.prototype.setOptions = function (options) { - if (options) { - // copy all options that we know - util.selectiveExtend(['rtl', 'showCurrentTime', 'moment', 'locale', 'locales'], this.options, options); +function addUnitPriority(unit, priority) { + priorities[unit] = priority; +} + +function getPrioritizedUnits(unitsObj) { + var units = []; + for (var u in unitsObj) { + units.push({unit: u, priority: priorities[u]}); } - }; + units.sort(function (a, b) { + return a.priority - b.priority; + }); + return units; +} + +function zeroFill(number, targetLength, forceSign) { + var absNumber = '' + Math.abs(number), + zerosToFill = targetLength - absNumber.length, + sign = number >= 0; + return (sign ? (forceSign ? '+' : '') : '-') + + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; +} + +var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; + +var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; + +var formatFunctions = {}; + +var formatTokenFunctions = {}; + +// token: 'M' +// padded: ['MM', 2] +// ordinal: 'Mo' +// callback: function () { this.month() + 1 } +function addFormatToken (token, padded, ordinal, callback) { + var func = callback; + if (typeof callback === 'string') { + func = function () { + return this[callback](); + }; + } + if (token) { + formatTokenFunctions[token] = func; + } + if (padded) { + formatTokenFunctions[padded[0]] = function () { + return zeroFill(func.apply(this, arguments), padded[1], padded[2]); + }; + } + if (ordinal) { + formatTokenFunctions[ordinal] = function () { + return this.localeData().ordinal(func.apply(this, arguments), token); + }; + } +} - /** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ - CurrentTime.prototype.redraw = function () { - if (this.options.showCurrentTime) { - var parent = this.body.dom.backgroundVertical; - if (this.bar.parentNode != parent) { - // attach to the dom - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - parent.appendChild(this.bar); +function removeFormattingTokens(input) { + if (input.match(/\[[\s\S]/)) { + return input.replace(/^\[|\]$/g, ''); + } + return input.replace(/\\/g, ''); +} - this.start(); - } +function makeFormatFunction(format) { + var array = format.match(formattingTokens), i, length; - var now = this.options.moment(new Date().valueOf() + this.offset); - var x = this.body.util.toScreen(now); + for (i = 0, length = array.length; i < length; i++) { + if (formatTokenFunctions[array[i]]) { + array[i] = formatTokenFunctions[array[i]]; + } else { + array[i] = removeFormattingTokens(array[i]); + } + } - var locale = this.options.locales[this.options.locale]; - if (!locale) { - if (!this.warned) { - console.log('WARNING: options.locales[\'' + this.options.locale + '\'] not found. See http://visjs.org/docs/timeline/#Localization'); - this.warned = true; + return function (mom) { + var output = '', i; + for (i = 0; i < length; i++) { + output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; } - locale = this.options.locales['en']; // fall back on english when not available - } - var title = locale.current + ' ' + locale.time + ': ' + now.format('dddd, MMMM Do YYYY, H:mm:ss'); - title = title.charAt(0).toUpperCase() + title.substring(1); + return output; + }; +} - if (this.options.rtl) { - this.bar.style.right = x + 'px'; - } else { - this.bar.style.left = x + 'px'; - } - this.bar.title = title; - } else { - // remove the line from the DOM - if (this.bar.parentNode) { - this.bar.parentNode.removeChild(this.bar); - } - this.stop(); +// format date using native date object +function formatMoment(m, format) { + if (!m.isValid()) { + return m.localeData().invalidDate(); } - return false; - }; + format = expandFormat(format, m.localeData()); + formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - /** - * Start auto refreshing the current time bar - */ - CurrentTime.prototype.start = function () { - var me = this; + return formatFunctions[format](m); +} + +function expandFormat(format, locale) { + var i = 5; + + function replaceLongDateFormatTokens(input) { + return locale.longDateFormat(input) || input; + } + + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { + format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); + localFormattingTokens.lastIndex = 0; + i -= 1; + } + + return format; +} - function update() { - me.stop(); +var match1 = /\d/; // 0 - 9 +var match2 = /\d\d/; // 00 - 99 +var match3 = /\d{3}/; // 000 - 999 +var match4 = /\d{4}/; // 0000 - 9999 +var match6 = /[+-]?\d{6}/; // -999999 - 999999 +var match1to2 = /\d\d?/; // 0 - 99 +var match3to4 = /\d\d\d\d?/; // 999 - 9999 +var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 +var match1to3 = /\d{1,3}/; // 0 - 999 +var match1to4 = /\d{1,4}/; // 0 - 9999 +var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - // determine interval to refresh - var scale = me.body.range.conversion(me.body.domProps.center.width).scale; - var interval = 1 / scale / 10; - if (interval < 30) interval = 30; - if (interval > 1000) interval = 1000; +var matchUnsigned = /\d+/; // 0 - inf +var matchSigned = /[+-]?\d+/; // -inf - inf - me.redraw(); - me.body.emitter.emit('currentTimeTick'); +var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z +var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - // start a renderTimer to adjust for the new time - me.currentTimeTimer = setTimeout(update, interval); +var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 + +// any word (or two) characters or numbers including two/three word month in arabic. +// includes scottish gaelic two word and hyphenated months +var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; + + +var regexes = {}; + +function addRegexToken (token, regex, strictRegex) { + regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { + return (isStrict && strictRegex) ? strictRegex : regex; + }; +} + +function getParseRegexForToken (token, config) { + if (!hasOwnProp(regexes, token)) { + return new RegExp(unescapeFormat(token)); } - update(); - }; + return regexes[token](config._strict, config._locale); +} - /** - * Stop auto refreshing the current time bar - */ - CurrentTime.prototype.stop = function () { - if (this.currentTimeTimer !== undefined) { - clearTimeout(this.currentTimeTimer); - delete this.currentTimeTimer; +// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript +function unescapeFormat(s) { + return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { + return p1 || p2 || p3 || p4; + })); +} + +function regexEscape(s) { + return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); +} + +var tokens = {}; + +function addParseToken (token, callback) { + var i, func = callback; + if (typeof token === 'string') { + token = [token]; } - }; + if (isNumber(callback)) { + func = function (input, array) { + array[callback] = toInt(input); + }; + } + for (i = 0; i < token.length; i++) { + tokens[token[i]] = func; + } +} - /** - * Set a current time. This can be used for example to ensure that a client's - * time is synchronized with a shared server time. - * @param {Date | String | Number} time A Date, unix timestamp, or - * ISO date string. - */ - CurrentTime.prototype.setCurrentTime = function (time) { - var t = util.convert(time, 'Date').valueOf(); - var now = new Date().valueOf(); - this.offset = t - now; - this.redraw(); - }; +function addWeekParseToken (token, callback) { + addParseToken(token, function (input, array, config, token) { + config._w = config._w || {}; + callback(input, config._w, config, token); + }); +} - /** - * Get the current time. - * @return {Date} Returns the current time. - */ - CurrentTime.prototype.getCurrentTime = function () { - return new Date(new Date().valueOf() + this.offset); - }; +function addTimeToArrayFromToken(token, input, config) { + if (input != null && hasOwnProp(tokens, token)) { + tokens[token](input, config._a, config, token); + } +} - module.exports = CurrentTime; +var YEAR = 0; +var MONTH = 1; +var DATE = 2; +var HOUR = 3; +var MINUTE = 4; +var SECOND = 5; +var MILLISECOND = 6; +var WEEK = 7; +var WEEKDAY = 8; -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { +// FORMATTING - 'use strict'; +addFormatToken('Y', 0, 0, function () { + var y = this.year(); + return y <= 9999 ? '' + y : '+' + y; +}); - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.printStyle = undefined; +addFormatToken(0, ['YY', 2], 0, function () { + return this.year() % 100; +}); - var _stringify = __webpack_require__(90); +addFormatToken(0, ['YYYY', 4], 0, 'year'); +addFormatToken(0, ['YYYYY', 5], 0, 'year'); +addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - var _stringify2 = _interopRequireDefault(_stringify); +// ALIASES - var _typeof2 = __webpack_require__(62); +addUnitAlias('year', 'y'); - var _typeof3 = _interopRequireDefault(_typeof2); +// PRIORITIES - var _keys = __webpack_require__(58); +addUnitPriority('year', 1); - var _keys2 = _interopRequireDefault(_keys); +// PARSING - var _classCallCheck2 = __webpack_require__(135); +addRegexToken('Y', matchSigned); +addRegexToken('YY', match1to2, match2); +addRegexToken('YYYY', match1to4, match4); +addRegexToken('YYYYY', match1to6, match6); +addRegexToken('YYYYYY', match1to6, match6); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +addParseToken(['YYYYY', 'YYYYYY'], YEAR); +addParseToken('YYYY', function (input, array) { + array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); +}); +addParseToken('YY', function (input, array) { + array[YEAR] = hooks.parseTwoDigitYear(input); +}); +addParseToken('Y', function (input, array) { + array[YEAR] = parseInt(input, 10); +}); - var _createClass2 = __webpack_require__(136); +// HELPERS - var _createClass3 = _interopRequireDefault(_createClass2); +function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; +} - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +function isLeapYear(year) { + return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; +} - var util = __webpack_require__(1); +// HOOKS - var errorFound = false; - var allOptions = void 0; - var printStyle = 'background: #FFeeee; color: #dd0000'; - /** - * Used to validate options. - */ +hooks.parseTwoDigitYear = function (input) { + return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); +}; - var Validator = function () { - function Validator() { - (0, _classCallCheck3['default'])(this, Validator); - } +// MOMENTS - /** - * Main function to be called - * @param options - * @param subObject - * @returns {boolean} - */ +var getSetYear = makeGetSet('FullYear', true); +function getIsLeapYear () { + return isLeapYear(this.year()); +} - (0, _createClass3['default'])(Validator, null, [{ - key: 'validate', - value: function validate(options, referenceOptions, subObject) { - errorFound = false; - allOptions = referenceOptions; - var usedOptions = referenceOptions; - if (subObject !== undefined) { - usedOptions = referenceOptions[subObject]; +function makeGetSet (unit, keepTime) { + return function (value) { + if (value != null) { + set$1(this, unit, value); + hooks.updateOffset(this, keepTime); + return this; + } else { + return get(this, unit); } - Validator.parse(options, usedOptions, []); - return errorFound; - } + }; +} - /** - * Will traverse an object recursively and check every value - * @param options - * @param referenceOptions - * @param path - */ +function get (mom, unit) { + return mom.isValid() ? + mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; +} - }, { - key: 'parse', - value: function parse(options, referenceOptions, path) { - for (var option in options) { - if (options.hasOwnProperty(option)) { - Validator.check(option, options, referenceOptions, path); - } +function set$1 (mom, unit, value) { + if (mom.isValid() && !isNaN(value)) { + if (unit === 'FullYear' && isLeapYear(mom.year())) { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); } - } + else { + mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); + } + } +} - /** - * Check every value. If the value is an object, call the parse function on that object. - * @param option - * @param options - * @param referenceOptions - * @param path - */ +// MOMENTS - }, { - key: 'check', - value: function check(option, options, referenceOptions, path) { - if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) { - Validator.getSuggestion(option, referenceOptions, path); - } else if (referenceOptions[option] === undefined && referenceOptions.__any__ !== undefined) { - // __any__ is a wildcard. Any value is accepted and will be further analysed by reference. - if (Validator.getType(options[option]) === 'object' && referenceOptions['__any__'].__type__ !== undefined) { - // if the any subgroup is not a predefined object int he configurator we do not look deeper into the object. - Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'].__type__, path); - } else { - Validator.checkFields(option, options, referenceOptions, '__any__', referenceOptions['__any__'], path); - } - } else { - // Since all options in the reference are objects, we can check whether they are supposed to be object to look for the __type__ field. - if (referenceOptions[option].__type__ !== undefined) { - // if this should be an object, we check if the correct type has been supplied to account for shorthand options. - Validator.checkFields(option, options, referenceOptions, option, referenceOptions[option].__type__, path); - } else { - Validator.checkFields(option, options, referenceOptions, option, referenceOptions[option], path); - } +function stringGet (units) { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](); + } + return this; +} + + +function stringSet (units, value) { + if (typeof units === 'object') { + units = normalizeObjectUnits(units); + var prioritized = getPrioritizedUnits(units); + for (var i = 0; i < prioritized.length; i++) { + this[prioritized[i].unit](units[prioritized[i].unit]); } - } + } else { + units = normalizeUnits(units); + if (isFunction(this[units])) { + return this[units](value); + } + } + return this; +} - /** - * - * @param {String} option | the option property - * @param {Object} options | The supplied options object - * @param {Object} referenceOptions | The reference options containing all options and their allowed formats - * @param {String} referenceOption | Usually this is the same as option, except when handling an __any__ tag. - * @param {String} refOptionType | This is the type object from the reference options - * @param {Array} path | where in the object is the option - */ +function mod(n, x) { + return ((n % x) + x) % x; +} - }, { - key: 'checkFields', - value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) { - var optionType = Validator.getType(options[option]); - var refOptionType = refOptionObj[optionType]; - if (refOptionType !== undefined) { - // if the type is correct, we check if it is supposed to be one of a few select values - if (Validator.getType(refOptionType) === 'array') { - if (refOptionType.indexOf(options[option]) === -1) { - console.log('%cInvalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle); - errorFound = true; - } else if (optionType === 'object' && referenceOption !== "__any__") { - path = util.copyAndExtendArray(path, option); - Validator.parse(options[option], referenceOptions[referenceOption], path); +var indexOf; + +if (Array.prototype.indexOf) { + indexOf = Array.prototype.indexOf; +} else { + indexOf = function (o) { + // I know + var i; + for (i = 0; i < this.length; ++i) { + if (this[i] === o) { + return i; } - } else if (optionType === 'object' && referenceOption !== "__any__") { - path = util.copyAndExtendArray(path, option); - Validator.parse(options[option], referenceOptions[referenceOption], path); - } - } else if (refOptionObj['any'] === undefined) { - // type of the field is incorrect and the field cannot be any - console.log('%cInvalid type received for "' + option + '". Expected: ' + Validator.print((0, _keys2['default'])(refOptionObj)) + '. Received [' + optionType + '] "' + options[option] + '"' + Validator.printLocation(path, option), printStyle); - errorFound = true; } - } - }, { - key: 'getType', - value: function getType(object) { - var type = typeof object === 'undefined' ? 'undefined' : (0, _typeof3['default'])(object); + return -1; + }; +} - if (type === 'object') { - if (object === null) { - return 'null'; - } - if (object instanceof Boolean) { - return 'boolean'; - } - if (object instanceof Number) { - return 'number'; - } - if (object instanceof String) { - return 'string'; - } - if (Array.isArray(object)) { - return 'array'; - } - if (object instanceof Date) { - return 'date'; - } - if (object.nodeType !== undefined) { - return 'dom'; - } - if (object._isAMomentObject === true) { - return 'moment'; - } - return 'object'; - } else if (type === 'number') { - return 'number'; - } else if (type === 'boolean') { - return 'boolean'; - } else if (type === 'string') { - return 'string'; - } else if (type === undefined) { - return 'undefined'; - } - return type; - } - }, { - key: 'getSuggestion', - value: function getSuggestion(option, options, path) { - var localSearch = Validator.findInOptions(option, options, path, false); - var globalSearch = Validator.findInOptions(option, allOptions, [], true); - - var localSearchThreshold = 8; - var globalSearchThreshold = 4; - - if (localSearch.indexMatch !== undefined) { - console.log('%cUnknown option detected: "' + option + '" in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was incomplete? Did you mean: "' + localSearch.indexMatch + '"?\n\n', printStyle); - } else if (globalSearch.distance <= globalSearchThreshold && localSearch.distance > globalSearch.distance) { - console.log('%cUnknown option detected: "' + option + '" in ' + Validator.printLocation(localSearch.path, option, '') + 'Perhaps it was misplaced? Matching option found at: ' + Validator.printLocation(globalSearch.path, globalSearch.closestMatch, ''), printStyle); - } else if (localSearch.distance <= localSearchThreshold) { - console.log('%cUnknown option detected: "' + option + '". Did you mean "' + localSearch.closestMatch + '"?' + Validator.printLocation(localSearch.path, option), printStyle); - } else { - console.log('%cUnknown option detected: "' + option + '". Did you mean one of these: ' + Validator.print((0, _keys2['default'])(options)) + Validator.printLocation(path, option), printStyle); - } +function daysInMonth(year, month) { + if (isNaN(year) || isNaN(month)) { + return NaN; + } + var modMonth = mod(month, 12); + year += (month - modMonth) / 12; + return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2); +} - errorFound = true; - } +// FORMATTING - /** - * traverse the options in search for a match. - * @param option - * @param options - * @param path - * @param recursive - * @returns {{closestMatch: string, path: Array, distance: number}} - */ +addFormatToken('M', ['MM', 2], 'Mo', function () { + return this.month() + 1; +}); - }, { - key: 'findInOptions', - value: function findInOptions(option, options, path) { - var recursive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; +addFormatToken('MMM', 0, 0, function (format) { + return this.localeData().monthsShort(this, format); +}); - var min = 1e9; - var closestMatch = ''; - var closestMatchPath = []; - var lowerCaseOption = option.toLowerCase(); - var indexMatch = undefined; - for (var op in options) { - var distance = void 0; - if (options[op].__type__ !== undefined && recursive === true) { - var result = Validator.findInOptions(option, options[op], util.copyAndExtendArray(path, op)); - if (min > result.distance) { - closestMatch = result.closestMatch; - closestMatchPath = result.path; - min = result.distance; - indexMatch = result.indexMatch; - } - } else { - if (op.toLowerCase().indexOf(lowerCaseOption) !== -1) { - indexMatch = op; +addFormatToken('MMMM', 0, 0, function (format) { + return this.localeData().months(this, format); +}); + +// ALIASES + +addUnitAlias('month', 'M'); + +// PRIORITY + +addUnitPriority('month', 8); + +// PARSING + +addRegexToken('M', match1to2); +addRegexToken('MM', match1to2, match2); +addRegexToken('MMM', function (isStrict, locale) { + return locale.monthsShortRegex(isStrict); +}); +addRegexToken('MMMM', function (isStrict, locale) { + return locale.monthsRegex(isStrict); +}); + +addParseToken(['M', 'MM'], function (input, array) { + array[MONTH] = toInt(input) - 1; +}); + +addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { + var month = config._locale.monthsParse(input, token, config._strict); + // if we didn't find a month name, mark the date as invalid. + if (month != null) { + array[MONTH] = month; + } else { + getParsingFlags(config).invalidMonth = input; + } +}); + +// LOCALES + +var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; +var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); +function localeMonths (m, format) { + if (!m) { + return isArray(this._months) ? this._months : + this._months['standalone']; + } + return isArray(this._months) ? this._months[m.month()] : + this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; +} + +var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); +function localeMonthsShort (m, format) { + if (!m) { + return isArray(this._monthsShort) ? this._monthsShort : + this._monthsShort['standalone']; + } + return isArray(this._monthsShort) ? this._monthsShort[m.month()] : + this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; +} + +function handleStrictParse(monthName, format, strict) { + var i, ii, mom, llc = monthName.toLocaleLowerCase(); + if (!this._monthsParse) { + // this is not used + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + for (i = 0; i < 12; ++i) { + mom = createUTC([2000, i]); + this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); + this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'MMM') { + ii = indexOf.call(this._shortMonthsParse, llc); + if (ii !== -1) { + return ii; } - distance = Validator.levenshteinDistance(option, op); - if (min > distance) { - closestMatch = op; - closestMatchPath = util.copyArray(path); - min = distance; + ii = indexOf.call(this._longMonthsParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._longMonthsParse, llc); + if (ii !== -1) { + return ii; } - } + ii = indexOf.call(this._shortMonthsParse, llc); + return ii !== -1 ? ii : null; } - return { closestMatch: closestMatch, path: closestMatchPath, distance: min, indexMatch: indexMatch }; - } - }, { - key: 'printLocation', - value: function printLocation(path, option) { - var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Problem value found at: \n'; + } +} - var str = '\n\n' + prefix + 'options = {\n'; - for (var i = 0; i < path.length; i++) { - for (var j = 0; j < i + 1; j++) { - str += ' '; - } - str += path[i] + ': {\n'; +function localeMonthsParse (monthName, format, strict) { + var i, mom, regex; + + if (this._monthsParseExact) { + return handleStrictParse.call(this, monthName, format, strict); + } + + if (!this._monthsParse) { + this._monthsParse = []; + this._longMonthsParse = []; + this._shortMonthsParse = []; + } + + // TODO: add sorting + // Sorting makes sure if one month (or abbr) is a prefix of another + // see sorting in computeMonthsParse + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + if (strict && !this._longMonthsParse[i]) { + this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); + this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); } - for (var _j = 0; _j < path.length + 1; _j++) { - str += ' '; + if (!strict && !this._monthsParse[i]) { + regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); + this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); } - str += option + '\n'; - for (var _i = 0; _i < path.length + 1; _i++) { - for (var _j2 = 0; _j2 < path.length - _i; _j2++) { - str += ' '; - } - str += '}\n'; + // test the regex + if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { + return i; + } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { + return i; + } else if (!strict && this._monthsParse[i].test(monthName)) { + return i; } - return str + '\n\n'; - } - }, { - key: 'print', - value: function print(options) { - return (0, _stringify2['default'])(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', '); - } + } +} - // Compute the edit distance between the two given strings - // http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript - /* - Copyright (c) 2011 Andrei Mackenzie - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +// MOMENTS - }, { - key: 'levenshteinDistance', - value: function levenshteinDistance(a, b) { - if (a.length === 0) return b.length; - if (b.length === 0) return a.length; +function setMonth (mom, value) { + var dayOfMonth; - var matrix = []; + if (!mom.isValid()) { + // No op + return mom; + } - // increment along the first column of each row - var i; - for (i = 0; i <= b.length; i++) { - matrix[i] = [i]; + if (typeof value === 'string') { + if (/^\d+$/.test(value)) { + value = toInt(value); + } else { + value = mom.localeData().monthsParse(value); + // TODO: Another silent failure? + if (!isNumber(value)) { + return mom; + } } + } - // increment each column in the first row - var j; - for (j = 0; j <= a.length; j++) { - matrix[0][j] = j; - } + dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); + mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); + return mom; +} - // Fill in the rest of the matrix - for (i = 1; i <= b.length; i++) { - for (j = 1; j <= a.length; j++) { - if (b.charAt(i - 1) == a.charAt(j - 1)) { - matrix[i][j] = matrix[i - 1][j - 1]; - } else { - matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution - Math.min(matrix[i][j - 1] + 1, // insertion - matrix[i - 1][j] + 1)); // deletion - } - } +function getSetMonth (value) { + if (value != null) { + setMonth(this, value); + hooks.updateOffset(this, true); + return this; + } else { + return get(this, 'Month'); + } +} + +function getDaysInMonth () { + return daysInMonth(this.year(), this.month()); +} + +var defaultMonthsShortRegex = matchWord; +function monthsShortRegex (isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsShortStrictRegex; + } else { + return this._monthsShortRegex; + } + } else { + if (!hasOwnProp(this, '_monthsShortRegex')) { + this._monthsShortRegex = defaultMonthsShortRegex; } + return this._monthsShortStrictRegex && isStrict ? + this._monthsShortStrictRegex : this._monthsShortRegex; + } +} - return matrix[b.length][a.length]; - } - }]); - return Validator; - }(); +var defaultMonthsRegex = matchWord; +function monthsRegex (isStrict) { + if (this._monthsParseExact) { + if (!hasOwnProp(this, '_monthsRegex')) { + computeMonthsParse.call(this); + } + if (isStrict) { + return this._monthsStrictRegex; + } else { + return this._monthsRegex; + } + } else { + if (!hasOwnProp(this, '_monthsRegex')) { + this._monthsRegex = defaultMonthsRegex; + } + return this._monthsStrictRegex && isStrict ? + this._monthsStrictRegex : this._monthsRegex; + } +} + +function computeMonthsParse () { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var shortPieces = [], longPieces = [], mixedPieces = [], + i, mom; + for (i = 0; i < 12; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, i]); + shortPieces.push(this.monthsShort(mom, '')); + longPieces.push(this.months(mom, '')); + mixedPieces.push(this.months(mom, '')); + mixedPieces.push(this.monthsShort(mom, '')); + } + // Sorting makes sure if one month (or abbr) is a prefix of another it + // will match the longer piece. + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 12; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + } + for (i = 0; i < 24; i++) { + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._monthsShortRegex = this._monthsRegex; + this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); + this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); +} + +function createDate (y, m, d, h, M, s, ms) { + // can't just apply() to create a date: + // https://stackoverflow.com/q/181348 + var date = new Date(y, m, d, h, M, s, ms); + + // the date constructor remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { + date.setFullYear(y); + } + return date; +} + +function createUTCDate (y) { + var date = new Date(Date.UTC.apply(null, arguments)); + + // the Date.UTC function remaps years 0-99 to 1900-1999 + if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { + date.setUTCFullYear(y); + } + return date; +} + +// start-of-first-week - start-of-year +function firstWeekOffset(year, dow, doy) { + var // first-week day -- which january is always in the first week (4 for iso, 1 for other) + fwd = 7 + dow - doy, + // first-week day local weekday -- which local weekday is fwd + fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; + + return -fwdlw + fwd - 1; +} + +// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday +function dayOfYearFromWeeks(year, week, weekday, dow, doy) { + var localWeekday = (7 + weekday - dow) % 7, + weekOffset = firstWeekOffset(year, dow, doy), + dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, + resYear, resDayOfYear; + + if (dayOfYear <= 0) { + resYear = year - 1; + resDayOfYear = daysInYear(resYear) + dayOfYear; + } else if (dayOfYear > daysInYear(year)) { + resYear = year + 1; + resDayOfYear = dayOfYear - daysInYear(year); + } else { + resYear = year; + resDayOfYear = dayOfYear; + } - exports['default'] = Validator; - exports.printStyle = printStyle; + return { + year: resYear, + dayOfYear: resDayOfYear + }; +} + +function weekOfYear(mom, dow, doy) { + var weekOffset = firstWeekOffset(mom.year(), dow, doy), + week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, + resWeek, resYear; + + if (week < 1) { + resYear = mom.year() - 1; + resWeek = week + weeksInYear(resYear, dow, doy); + } else if (week > weeksInYear(mom.year(), dow, doy)) { + resWeek = week - weeksInYear(mom.year(), dow, doy); + resYear = mom.year() + 1; + } else { + resYear = mom.year(); + resWeek = week; + } -/***/ }), -/* 146 */ -/***/ (function(module, exports) { + return { + week: resWeek, + year: resYear + }; +} - 'use strict'; +function weeksInYear(year, dow, doy) { + var weekOffset = firstWeekOffset(year, dow, doy), + weekOffsetNext = firstWeekOffset(year + 1, dow, doy); + return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; +} - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * This object contains all possible options. It will check if the types are correct, if required if the option is one - * of the allowed values. - * - * __any__ means that the name of the property does not matter. - * __type__ is a required field for all objects and contains the allowed types of all objects - */ - var string = 'string'; - var bool = 'boolean'; - var number = 'number'; - var array = 'array'; - var date = 'date'; - var object = 'object'; // should only be in a __type__ property - var dom = 'dom'; - var moment = 'moment'; - var any = 'any'; - - var allOptions = { - configure: { - enabled: { 'boolean': bool }, - filter: { 'boolean': bool, 'function': 'function' }, - container: { dom: dom }, - __type__: { object: object, 'boolean': bool, 'function': 'function' } - }, +// FORMATTING - //globals : - align: { string: string }, - rtl: { 'boolean': bool, 'undefined': 'undefined' }, - rollingMode: { - follow: { 'boolean': bool }, - offset: { number: number, 'undefined': 'undefined' }, - __type__: { object: object } - }, - verticalScroll: { 'boolean': bool, 'undefined': 'undefined' }, - horizontalScroll: { 'boolean': bool, 'undefined': 'undefined' }, - autoResize: { 'boolean': bool }, - throttleRedraw: { number: number }, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511 - clickToUse: { 'boolean': bool }, - dataAttributes: { string: string, array: array }, - editable: { - add: { 'boolean': bool, 'undefined': 'undefined' }, - remove: { 'boolean': bool, 'undefined': 'undefined' }, - updateGroup: { 'boolean': bool, 'undefined': 'undefined' }, - updateTime: { 'boolean': bool, 'undefined': 'undefined' }, - overrideItems: { 'boolean': bool, 'undefined': 'undefined' }, - __type__: { 'boolean': bool, object: object } - }, - end: { number: number, date: date, string: string, moment: moment }, - format: { - minorLabels: { - millisecond: { string: string, 'undefined': 'undefined' }, - second: { string: string, 'undefined': 'undefined' }, - minute: { string: string, 'undefined': 'undefined' }, - hour: { string: string, 'undefined': 'undefined' }, - weekday: { string: string, 'undefined': 'undefined' }, - day: { string: string, 'undefined': 'undefined' }, - week: { string: string, 'undefined': 'undefined' }, - month: { string: string, 'undefined': 'undefined' }, - year: { string: string, 'undefined': 'undefined' }, - __type__: { object: object, 'function': 'function' } - }, - majorLabels: { - millisecond: { string: string, 'undefined': 'undefined' }, - second: { string: string, 'undefined': 'undefined' }, - minute: { string: string, 'undefined': 'undefined' }, - hour: { string: string, 'undefined': 'undefined' }, - weekday: { string: string, 'undefined': 'undefined' }, - day: { string: string, 'undefined': 'undefined' }, - week: { string: string, 'undefined': 'undefined' }, - month: { string: string, 'undefined': 'undefined' }, - year: { string: string, 'undefined': 'undefined' }, - __type__: { object: object, 'function': 'function' } - }, - __type__: { object: object } - }, - moment: { 'function': 'function' }, - groupOrder: { string: string, 'function': 'function' }, - groupEditable: { - add: { 'boolean': bool, 'undefined': 'undefined' }, - remove: { 'boolean': bool, 'undefined': 'undefined' }, - order: { 'boolean': bool, 'undefined': 'undefined' }, - __type__: { 'boolean': bool, object: object } - }, - groupOrderSwap: { 'function': 'function' }, - height: { string: string, number: number }, - hiddenDates: { - start: { date: date, number: number, string: string, moment: moment }, - end: { date: date, number: number, string: string, moment: moment }, - repeat: { string: string }, - __type__: { object: object, array: array } - }, - itemsAlwaysDraggable: { - item: { 'boolean': bool, 'undefined': 'undefined' }, - range: { 'boolean': bool, 'undefined': 'undefined' }, - __type__: { 'boolean': bool, object: object } - }, - locale: { string: string }, - locales: { - __any__: { any: any }, - __type__: { object: object } - }, - margin: { - axis: { number: number }, - item: { - horizontal: { number: number, 'undefined': 'undefined' }, - vertical: { number: number, 'undefined': 'undefined' }, - __type__: { object: object, number: number } - }, - __type__: { object: object, number: number } - }, - max: { date: date, number: number, string: string, moment: moment }, - maxHeight: { number: number, string: string }, - maxMinorChars: { number: number }, - min: { date: date, number: number, string: string, moment: moment }, - minHeight: { number: number, string: string }, - moveable: { 'boolean': bool }, - multiselect: { 'boolean': bool }, - multiselectPerGroup: { 'boolean': bool }, - onAdd: { 'function': 'function' }, - onUpdate: { 'function': 'function' }, - onMove: { 'function': 'function' }, - onMoving: { 'function': 'function' }, - onRemove: { 'function': 'function' }, - onAddGroup: { 'function': 'function' }, - onMoveGroup: { 'function': 'function' }, - onRemoveGroup: { 'function': 'function' }, - order: { 'function': 'function' }, - orientation: { - axis: { string: string, 'undefined': 'undefined' }, - item: { string: string, 'undefined': 'undefined' }, - __type__: { string: string, object: object } - }, - selectable: { 'boolean': bool }, - showCurrentTime: { 'boolean': bool }, - showMajorLabels: { 'boolean': bool }, - showMinorLabels: { 'boolean': bool }, - stack: { 'boolean': bool }, - stackSubgroups: { 'boolean': bool }, - snap: { 'function': 'function', 'null': 'null' }, - start: { date: date, number: number, string: string, moment: moment }, - template: { 'function': 'function' }, - groupTemplate: { 'function': 'function' }, - visibleFrameTemplate: { string: string, 'function': 'function' }, - showTooltips: { 'boolean': bool }, - tooltip: { - followMouse: { 'boolean': bool }, - overflowMethod: { 'string': ['cap', 'flip'] }, - __type__: { object: object } - }, - tooltipOnItemUpdateTime: { - template: { 'function': 'function' }, - __type__: { 'boolean': bool, object: object } - }, - timeAxis: { - scale: { string: string, 'undefined': 'undefined' }, - step: { number: number, 'undefined': 'undefined' }, - __type__: { object: object } - }, - type: { string: string }, - width: { string: string, number: number }, - zoomable: { 'boolean': bool }, - zoomKey: { string: ['ctrlKey', 'altKey', 'metaKey', ''] }, - zoomMax: { number: number }, - zoomMin: { number: number }, +addFormatToken('w', ['ww', 2], 'wo', 'week'); +addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - __type__: { object: object } - }; +// ALIASES - var configureOptions = { - global: { - align: ['center', 'left', 'right'], - direction: false, - autoResize: true, - clickToUse: false, - // dataAttributes: ['all'], // FIXME: can be 'all' or string[] - editable: { - add: false, - remove: false, - updateGroup: false, - updateTime: false - }, - end: '', - format: { - minorLabels: { - millisecond: 'SSS', - second: 's', - minute: 'HH:mm', - hour: 'HH:mm', - weekday: 'ddd D', - day: 'D', - week: 'w', - month: 'MMM', - year: 'YYYY' - }, - majorLabels: { - millisecond: 'HH:mm:ss', - second: 'D MMMM HH:mm', - minute: 'ddd D MMMM', - hour: 'ddd D MMMM', - weekday: 'MMMM YYYY', - day: 'MMMM YYYY', - week: 'MMMM YYYY', - month: 'YYYY', - year: '' - } - }, +addUnitAlias('week', 'w'); +addUnitAlias('isoWeek', 'W'); - //groupOrder: {string, 'function': 'function'}, - groupsDraggable: false, - height: '', - //hiddenDates: {object, array}, - locale: '', - margin: { - axis: [20, 0, 100, 1], - item: { - horizontal: [10, 0, 100, 1], - vertical: [10, 0, 100, 1] - } - }, - max: '', - maxHeight: '', - maxMinorChars: [7, 0, 20, 1], - min: '', - minHeight: '', - moveable: false, - multiselect: false, - multiselectPerGroup: false, - //onAdd: {'function': 'function'}, - //onUpdate: {'function': 'function'}, - //onMove: {'function': 'function'}, - //onMoving: {'function': 'function'}, - //onRename: {'function': 'function'}, - //order: {'function': 'function'}, - orientation: { - axis: ['both', 'bottom', 'top'], - item: ['bottom', 'top'] - }, - selectable: true, - showCurrentTime: false, - showMajorLabels: true, - showMinorLabels: true, - stack: true, - stackSubgroups: true, - //snap: {'function': 'function', nada}, - start: '', - //template: {'function': 'function'}, - //timeAxis: { - // scale: ['millisecond', 'second', 'minute', 'hour', 'weekday', 'day', 'week', 'month', 'year'], - // step: [1, 1, 10, 1] - //}, - showTooltips: true, - tooltip: { - followMouse: false, - overflowMethod: 'flip' - }, - tooltipOnItemUpdateTime: false, - type: ['box', 'point', 'range', 'background'], - width: '100%', - zoomable: true, - zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''], - zoomMax: [315360000000000, 10, 315360000000000, 1], - zoomMin: [10, 10, 315360000000000, 1] - } - }; +// PRIORITIES - exports.allOptions = allOptions; - exports.configureOptions = configureOptions; +addUnitPriority('week', 5); +addUnitPriority('isoWeek', 5); -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { +// PARSING - 'use strict'; +addRegexToken('w', match1to2); +addRegexToken('ww', match1to2, match2); +addRegexToken('W', match1to2); +addRegexToken('WW', match1to2, match2); - Object.defineProperty(exports, "__esModule", { - value: true - }); +addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { + week[token.substr(0, 1)] = toInt(input); +}); - var _stringify = __webpack_require__(90); +// HELPERS - var _stringify2 = _interopRequireDefault(_stringify); +// LOCALES - var _typeof2 = __webpack_require__(62); +function localeWeek (mom) { + return weekOfYear(mom, this._week.dow, this._week.doy).week; +} - var _typeof3 = _interopRequireDefault(_typeof2); +var defaultLocaleWeek = { + dow : 0, // Sunday is the first day of the week. + doy : 6 // The week that contains Jan 1st is the first week of the year. +}; - var _classCallCheck2 = __webpack_require__(135); +function localeFirstDayOfWeek () { + return this._week.dow; +} - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +function localeFirstDayOfYear () { + return this._week.doy; +} - var _createClass2 = __webpack_require__(136); +// MOMENTS - var _createClass3 = _interopRequireDefault(_createClass2); +function getSetWeek (input) { + var week = this.localeData().week(this); + return input == null ? week : this.add((input - week) * 7, 'd'); +} - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +function getSetISOWeek (input) { + var week = weekOfYear(this, 1, 4).week; + return input == null ? week : this.add((input - week) * 7, 'd'); +} - var util = __webpack_require__(1); +// FORMATTING - var ColorPicker = __webpack_require__(148)['default']; +addFormatToken('d', 0, 'do', 'day'); - /** - * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. - * Boolean options are recognised as Boolean - * Number options should be written as array: [default value, min value, max value, stepsize] - * Colors should be written as array: ['color', '#ffffff'] - * Strings with should be written as array: [option1, option2, option3, ..] - * - * The options are matched with their counterparts in each of the modules and the values used in the configuration are - * - * @param parentModule | the location where parentModule.setOptions() can be called - * @param defaultContainer | the default container of the module - * @param configureOptions | the fully configured and predefined options set found in allOptions.js - * @param pixelRatio | canvas pixel ratio - */ +addFormatToken('dd', 0, 0, function (format) { + return this.localeData().weekdaysMin(this, format); +}); - var Configurator = function () { - function Configurator(parentModule, defaultContainer, configureOptions) { - var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; - (0, _classCallCheck3['default'])(this, Configurator); +addFormatToken('ddd', 0, 0, function (format) { + return this.localeData().weekdaysShort(this, format); +}); - this.parent = parentModule; - this.changedOptions = []; - this.container = defaultContainer; - this.allowCreation = false; +addFormatToken('dddd', 0, 0, function (format) { + return this.localeData().weekdays(this, format); +}); - this.options = {}; - this.initialized = false; - this.popupCounter = 0; - this.defaultOptions = { - enabled: false, - filter: true, - container: undefined, - showButton: true - }; - util.extend(this.options, this.defaultOptions); +addFormatToken('e', 0, 0, 'weekday'); +addFormatToken('E', 0, 0, 'isoWeekday'); - this.configureOptions = configureOptions; - this.moduleOptions = {}; - this.domElements = []; - this.popupDiv = {}; - this.popupLimit = 5; - this.popupHistory = {}; - this.colorPicker = new ColorPicker(pixelRatio); - this.wrapper = undefined; - } +// ALIASES - /** - * refresh all options. - * Because all modules parse their options by themselves, we just use their options. We copy them here. - * - * @param options - */ +addUnitAlias('day', 'd'); +addUnitAlias('weekday', 'e'); +addUnitAlias('isoWeekday', 'E'); +// PRIORITY +addUnitPriority('day', 11); +addUnitPriority('weekday', 11); +addUnitPriority('isoWeekday', 11); - (0, _createClass3['default'])(Configurator, [{ - key: 'setOptions', - value: function setOptions(options) { - if (options !== undefined) { - // reset the popup history because the indices may have been changed. - this.popupHistory = {}; - this._removePopup(); +// PARSING - var enabled = true; - if (typeof options === 'string') { - this.options.filter = options; - } else if (options instanceof Array) { - this.options.filter = options.join(); - } else if ((typeof options === 'undefined' ? 'undefined' : (0, _typeof3['default'])(options)) === 'object') { - if (options.container !== undefined) { - this.options.container = options.container; - } - if (options.filter !== undefined) { - this.options.filter = options.filter; - } - if (options.showButton !== undefined) { - this.options.showButton = options.showButton; - } - if (options.enabled !== undefined) { - enabled = options.enabled; - } - } else if (typeof options === 'boolean') { - this.options.filter = true; - enabled = options; - } else if (typeof options === 'function') { - this.options.filter = options; - enabled = true; - } - if (this.options.filter === false) { - enabled = false; - } +addRegexToken('d', match1to2); +addRegexToken('e', match1to2); +addRegexToken('E', match1to2); +addRegexToken('dd', function (isStrict, locale) { + return locale.weekdaysMinRegex(isStrict); +}); +addRegexToken('ddd', function (isStrict, locale) { + return locale.weekdaysShortRegex(isStrict); +}); +addRegexToken('dddd', function (isStrict, locale) { + return locale.weekdaysRegex(isStrict); +}); - this.options.enabled = enabled; - } - this._clean(); - } - }, { - key: 'setModuleOptions', - value: function setModuleOptions(moduleOptions) { - this.moduleOptions = moduleOptions; - if (this.options.enabled === true) { - this._clean(); - if (this.options.container !== undefined) { - this.container = this.options.container; - } - this._create(); - } - } +addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { + var weekday = config._locale.weekdaysParse(input, token, config._strict); + // if we didn't get a weekday name, mark the date as invalid + if (weekday != null) { + week.d = weekday; + } else { + getParsingFlags(config).invalidWeekday = input; + } +}); - /** - * Create all DOM elements - * @private - */ +addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { + week[token] = toInt(input); +}); - }, { - key: '_create', - value: function _create() { - var _this = this; +// HELPERS - this._clean(); - this.changedOptions = []; - - var filter = this.options.filter; - var counter = 0; - var show = false; - for (var option in this.configureOptions) { - if (this.configureOptions.hasOwnProperty(option)) { - this.allowCreation = false; - show = false; - if (typeof filter === 'function') { - show = filter(option, []); - show = show || this._handleObject(this.configureOptions[option], [option], true); - } else if (filter === true || filter.indexOf(option) !== -1) { - show = true; - } +function parseWeekday(input, locale) { + if (typeof input !== 'string') { + return input; + } - if (show !== false) { - this.allowCreation = true; + if (!isNaN(input)) { + return parseInt(input, 10); + } - // linebreak between categories - if (counter > 0) { - this._makeItem([]); - } - // a header for the category - this._makeHeader(option); + input = locale.weekdaysParse(input); + if (typeof input === 'number') { + return input; + } - // get the sub options - this._handleObject(this.configureOptions[option], [option]); + return null; +} + +function parseIsoWeekday(input, locale) { + if (typeof input === 'string') { + return locale.weekdaysParse(input) % 7 || 7; + } + return isNaN(input) ? null : input; +} + +// LOCALES + +var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); +function localeWeekdays (m, format) { + if (!m) { + return isArray(this._weekdays) ? this._weekdays : + this._weekdays['standalone']; + } + return isArray(this._weekdays) ? this._weekdays[m.day()] : + this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; +} + +var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); +function localeWeekdaysShort (m) { + return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; +} + +var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); +function localeWeekdaysMin (m) { + return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; +} + +function handleStrictParse$1(weekdayName, format, strict) { + var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._shortWeekdaysParse = []; + this._minWeekdaysParse = []; + + for (i = 0; i < 7; ++i) { + mom = createUTC([2000, 1]).day(i); + this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); + this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); + this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); + } + } + + if (strict) { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } + } else { + if (format === 'dddd') { + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else if (format === 'ddd') { + ii = indexOf.call(this._shortWeekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._minWeekdaysParse, llc); + return ii !== -1 ? ii : null; + } else { + ii = indexOf.call(this._minWeekdaysParse, llc); + if (ii !== -1) { + return ii; } - counter++; - } + ii = indexOf.call(this._weekdaysParse, llc); + if (ii !== -1) { + return ii; + } + ii = indexOf.call(this._shortWeekdaysParse, llc); + return ii !== -1 ? ii : null; } + } +} - if (this.options.showButton === true) { - var generateButton = document.createElement('div'); - generateButton.className = 'vis-configuration vis-config-button'; - generateButton.innerHTML = 'generate options'; - generateButton.onclick = function () { - _this._printOptions(); - }; - generateButton.onmouseover = function () { - generateButton.className = 'vis-configuration vis-config-button hover'; - }; - generateButton.onmouseout = function () { - generateButton.className = 'vis-configuration vis-config-button'; - }; - - this.optionsContainer = document.createElement('div'); - this.optionsContainer.className = 'vis-configuration vis-config-option-container'; +function localeWeekdaysParse (weekdayName, format, strict) { + var i, mom, regex; - this.domElements.push(this.optionsContainer); - this.domElements.push(generateButton); - } + if (this._weekdaysParseExact) { + return handleStrictParse$1.call(this, weekdayName, format, strict); + } - this._push(); - //~ this.colorPicker.insertTo(this.container); - } + if (!this._weekdaysParse) { + this._weekdaysParse = []; + this._minWeekdaysParse = []; + this._shortWeekdaysParse = []; + this._fullWeekdaysParse = []; + } - /** - * draw all DOM elements on the screen - * @private - */ + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already - }, { - key: '_push', - value: function _push() { - this.wrapper = document.createElement('div'); - this.wrapper.className = 'vis-configuration-wrapper'; - this.container.appendChild(this.wrapper); - for (var i = 0; i < this.domElements.length; i++) { - this.wrapper.appendChild(this.domElements[i]); + mom = createUTC([2000, 1]).day(i); + if (strict && !this._fullWeekdaysParse[i]) { + this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); + this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); + this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); + } + if (!this._weekdaysParse[i]) { + regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); + this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); } + // test the regex + if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { + return i; + } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { + return i; + } + } +} - this._showPopupIfNeeded(); - } +// MOMENTS - /** - * delete all DOM elements - * @private - */ +function getSetDayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + if (input != null) { + input = parseWeekday(input, this.localeData()); + return this.add(input - day, 'd'); + } else { + return day; + } +} - }, { - key: '_clean', - value: function _clean() { - for (var i = 0; i < this.domElements.length; i++) { - this.wrapper.removeChild(this.domElements[i]); - } +function getSetLocaleDayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } + var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; + return input == null ? weekday : this.add(input - weekday, 'd'); +} - if (this.wrapper !== undefined) { - this.container.removeChild(this.wrapper); - this.wrapper = undefined; - } - this.domElements = []; +function getSetISODayOfWeek (input) { + if (!this.isValid()) { + return input != null ? this : NaN; + } - this._removePopup(); - } + // behaves the same as moment#day except + // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) + // as a setter, sunday should belong to the previous week. - /** - * get the value from the actualOptions if it exists - * @param {array} path | where to look for the actual option - * @returns {*} - * @private - */ + if (input != null) { + var weekday = parseIsoWeekday(input, this.localeData()); + return this.day(this.day() % 7 ? weekday : weekday - 7); + } else { + return this.day() || 7; + } +} - }, { - key: '_getValue', - value: function _getValue(path) { - var base = this.moduleOptions; - for (var i = 0; i < path.length; i++) { - if (base[path[i]] !== undefined) { - base = base[path[i]]; - } else { - base = undefined; - break; - } +var defaultWeekdaysRegex = matchWord; +function weekdaysRegex (isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); } - return base; - } - - /** - * all option elements are wrapped in an item - * @param path - * @param domElements - * @private - */ - - }, { - key: '_makeItem', - value: function _makeItem(path) { - if (this.allowCreation === true) { - var item = document.createElement('div'); - item.className = 'vis-configuration vis-config-item vis-config-s' + path.length; - - for (var _len = arguments.length, domElements = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - domElements[_key - 1] = arguments[_key]; - } + if (isStrict) { + return this._weekdaysStrictRegex; + } else { + return this._weekdaysRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysRegex')) { + this._weekdaysRegex = defaultWeekdaysRegex; + } + return this._weekdaysStrictRegex && isStrict ? + this._weekdaysStrictRegex : this._weekdaysRegex; + } +} - domElements.forEach(function (element) { - item.appendChild(element); - }); - this.domElements.push(item); - return this.domElements.length; +var defaultWeekdaysShortRegex = matchWord; +function weekdaysShortRegex (isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); } - return 0; - } + if (isStrict) { + return this._weekdaysShortStrictRegex; + } else { + return this._weekdaysShortRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysShortRegex')) { + this._weekdaysShortRegex = defaultWeekdaysShortRegex; + } + return this._weekdaysShortStrictRegex && isStrict ? + this._weekdaysShortStrictRegex : this._weekdaysShortRegex; + } +} - /** - * header for major subjects - * @param name - * @private - */ +var defaultWeekdaysMinRegex = matchWord; +function weekdaysMinRegex (isStrict) { + if (this._weekdaysParseExact) { + if (!hasOwnProp(this, '_weekdaysRegex')) { + computeWeekdaysParse.call(this); + } + if (isStrict) { + return this._weekdaysMinStrictRegex; + } else { + return this._weekdaysMinRegex; + } + } else { + if (!hasOwnProp(this, '_weekdaysMinRegex')) { + this._weekdaysMinRegex = defaultWeekdaysMinRegex; + } + return this._weekdaysMinStrictRegex && isStrict ? + this._weekdaysMinStrictRegex : this._weekdaysMinRegex; + } +} + + +function computeWeekdaysParse () { + function cmpLenRev(a, b) { + return b.length - a.length; + } + + var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], + i, mom, minp, shortp, longp; + for (i = 0; i < 7; i++) { + // make the regex if we don't have it already + mom = createUTC([2000, 1]).day(i); + minp = this.weekdaysMin(mom, ''); + shortp = this.weekdaysShort(mom, ''); + longp = this.weekdays(mom, ''); + minPieces.push(minp); + shortPieces.push(shortp); + longPieces.push(longp); + mixedPieces.push(minp); + mixedPieces.push(shortp); + mixedPieces.push(longp); + } + // Sorting makes sure if one weekday (or abbr) is a prefix of another it + // will match the longer piece. + minPieces.sort(cmpLenRev); + shortPieces.sort(cmpLenRev); + longPieces.sort(cmpLenRev); + mixedPieces.sort(cmpLenRev); + for (i = 0; i < 7; i++) { + shortPieces[i] = regexEscape(shortPieces[i]); + longPieces[i] = regexEscape(longPieces[i]); + mixedPieces[i] = regexEscape(mixedPieces[i]); + } + + this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); + this._weekdaysShortRegex = this._weekdaysRegex; + this._weekdaysMinRegex = this._weekdaysRegex; + + this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); + this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); + this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); +} + +// FORMATTING + +function hFormat() { + return this.hours() % 12 || 12; +} + +function kFormat() { + return this.hours() || 24; +} + +addFormatToken('H', ['HH', 2], 0, 'hour'); +addFormatToken('h', ['hh', 2], 0, hFormat); +addFormatToken('k', ['kk', 2], 0, kFormat); + +addFormatToken('hmm', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); +}); - }, { - key: '_makeHeader', - value: function _makeHeader(name) { - var div = document.createElement('div'); - div.className = 'vis-configuration vis-config-header'; - div.innerHTML = name; - this._makeItem([], div); - } +addFormatToken('hmmss', 0, 0, function () { + return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2); +}); - /** - * make a label, if it is an object label, it gets different styling. - * @param name - * @param path - * @param objectLabel - * @returns {HTMLElement} - * @private - */ +addFormatToken('Hmm', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2); +}); - }, { - key: '_makeLabel', - value: function _makeLabel(name, path) { - var objectLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var div = document.createElement('div'); - div.className = 'vis-configuration vis-config-label vis-config-s' + path.length; - if (objectLabel === true) { - div.innerHTML = '' + name + ':'; - } else { - div.innerHTML = name + ':'; - } - return div; - } +addFormatToken('Hmmss', 0, 0, function () { + return '' + this.hours() + zeroFill(this.minutes(), 2) + + zeroFill(this.seconds(), 2); +}); - /** - * make a dropdown list for multiple possible string optoins - * @param arr - * @param value - * @param path - * @private - */ +function meridiem (token, lowercase) { + addFormatToken(token, 0, 0, function () { + return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); + }); +} - }, { - key: '_makeDropdown', - value: function _makeDropdown(arr, value, path) { - var select = document.createElement('select'); - select.className = 'vis-configuration vis-config-select'; - var selectedValue = 0; - if (value !== undefined) { - if (arr.indexOf(value) !== -1) { - selectedValue = arr.indexOf(value); - } - } +meridiem('a', true); +meridiem('A', false); - for (var i = 0; i < arr.length; i++) { - var option = document.createElement('option'); - option.value = arr[i]; - if (i === selectedValue) { - option.selected = 'selected'; - } - option.innerHTML = arr[i]; - select.appendChild(option); - } +// ALIASES - var me = this; - select.onchange = function () { - me._update(this.value, path); - }; +addUnitAlias('hour', 'h'); - var label = this._makeLabel(path[path.length - 1], path); - this._makeItem(path, label, select); - } +// PRIORITY +addUnitPriority('hour', 13); - /** - * make a range object for numeric options - * @param arr - * @param value - * @param path - * @private - */ +// PARSING - }, { - key: '_makeRange', - value: function _makeRange(arr, value, path) { - var defaultValue = arr[0]; - var min = arr[1]; - var max = arr[2]; - var step = arr[3]; - var range = document.createElement('input'); - range.className = 'vis-configuration vis-config-range'; - try { - range.type = 'range'; // not supported on IE9 - range.min = min; - range.max = max; - } catch (err) {} - range.step = step; - - // set up the popup settings in case they are needed. - var popupString = ''; - var popupValue = 0; - - if (value !== undefined) { - var factor = 1.20; - if (value < 0 && value * factor < min) { - range.min = Math.ceil(value * factor); - popupValue = range.min; - popupString = 'range increased'; - } else if (value / factor < min) { - range.min = Math.ceil(value / factor); - popupValue = range.min; - popupString = 'range increased'; - } - if (value * factor > max && max !== 1) { - range.max = Math.ceil(value * factor); - popupValue = range.max; - popupString = 'range increased'; - } - range.value = value; - } else { - range.value = defaultValue; - } +function matchMeridiem (isStrict, locale) { + return locale._meridiemParse; +} - var input = document.createElement('input'); - input.className = 'vis-configuration vis-config-rangeinput'; - input.value = range.value; +addRegexToken('a', matchMeridiem); +addRegexToken('A', matchMeridiem); +addRegexToken('H', match1to2); +addRegexToken('h', match1to2); +addRegexToken('k', match1to2); +addRegexToken('HH', match1to2, match2); +addRegexToken('hh', match1to2, match2); +addRegexToken('kk', match1to2, match2); - var me = this; - range.onchange = function () { - input.value = this.value;me._update(Number(this.value), path); - }; - range.oninput = function () { - input.value = this.value; - }; +addRegexToken('hmm', match3to4); +addRegexToken('hmmss', match5to6); +addRegexToken('Hmm', match3to4); +addRegexToken('Hmmss', match5to6); - var label = this._makeLabel(path[path.length - 1], path); - var itemIndex = this._makeItem(path, label, range, input); +addParseToken(['H', 'HH'], HOUR); +addParseToken(['k', 'kk'], function (input, array, config) { + var kInput = toInt(input); + array[HOUR] = kInput === 24 ? 0 : kInput; +}); +addParseToken(['a', 'A'], function (input, array, config) { + config._isPm = config._locale.isPM(input); + config._meridiem = input; +}); +addParseToken(['h', 'hh'], function (input, array, config) { + array[HOUR] = toInt(input); + getParsingFlags(config).bigHour = true; +}); +addParseToken('hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); + getParsingFlags(config).bigHour = true; +}); +addParseToken('hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); + getParsingFlags(config).bigHour = true; +}); +addParseToken('Hmm', function (input, array, config) { + var pos = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos)); + array[MINUTE] = toInt(input.substr(pos)); +}); +addParseToken('Hmmss', function (input, array, config) { + var pos1 = input.length - 4; + var pos2 = input.length - 2; + array[HOUR] = toInt(input.substr(0, pos1)); + array[MINUTE] = toInt(input.substr(pos1, 2)); + array[SECOND] = toInt(input.substr(pos2)); +}); - // if a popup is needed AND it has not been shown for this value, show it. - if (popupString !== '' && this.popupHistory[itemIndex] !== popupValue) { - this.popupHistory[itemIndex] = popupValue; - this._setupPopup(popupString, itemIndex); - } - } +// LOCALES - /** - * prepare the popup - * @param string - * @param index - * @private - */ +function localeIsPM (input) { + // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays + // Using charAt should be more compatible. + return ((input + '').toLowerCase().charAt(0) === 'p'); +} - }, { - key: '_setupPopup', - value: function _setupPopup(string, index) { - var _this2 = this; - - if (this.initialized === true && this.allowCreation === true && this.popupCounter < this.popupLimit) { - var div = document.createElement("div"); - div.id = "vis-configuration-popup"; - div.className = "vis-configuration-popup"; - div.innerHTML = string; - div.onclick = function () { - _this2._removePopup(); - }; - this.popupCounter += 1; - this.popupDiv = { html: div, index: index }; +var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; +function localeMeridiem (hours, minutes, isLower) { + if (hours > 11) { + return isLower ? 'pm' : 'PM'; + } else { + return isLower ? 'am' : 'AM'; + } +} + + +// MOMENTS + +// Setting the hour should keep the time, because the user explicitly +// specified which hour he wants. So trying to maintain the same hour (in +// a new timezone) makes sense. Adding/subtracting hours does not follow +// this rule. +var getSetHour = makeGetSet('Hours', true); + +// months +// week +// weekdays +// meridiem +var baseConfig = { + calendar: defaultCalendar, + longDateFormat: defaultLongDateFormat, + invalidDate: defaultInvalidDate, + ordinal: defaultOrdinal, + dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, + relativeTime: defaultRelativeTime, + + months: defaultLocaleMonths, + monthsShort: defaultLocaleMonthsShort, + + week: defaultLocaleWeek, + + weekdays: defaultLocaleWeekdays, + weekdaysMin: defaultLocaleWeekdaysMin, + weekdaysShort: defaultLocaleWeekdaysShort, + + meridiemParse: defaultLocaleMeridiemParse +}; + +// internal storage for locale config files +var locales = {}; +var localeFamilies = {}; +var globalLocale; + +function normalizeLocale(key) { + return key ? key.toLowerCase().replace('_', '-') : key; +} + +// pick the locale from the array +// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each +// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root +function chooseLocale(names) { + var i = 0, j, next, locale, split; + + while (i < names.length) { + split = normalizeLocale(names[i]).split('-'); + j = split.length; + next = normalizeLocale(names[i + 1]); + next = next ? next.split('-') : null; + while (j > 0) { + locale = loadLocale(split.slice(0, j).join('-')); + if (locale) { + return locale; + } + if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { + //the next array item is better than a shallower substring of this one + break; + } + j--; } - } + i++; + } + return null; +} - /** - * remove the popup from the dom - * @private - */ +function loadLocale(name) { + var oldLocale = null; + // TODO: Find a better way to register and load all the locales in Node + if (!locales[name] && (typeof module !== 'undefined') && + module && module.exports) { + try { + oldLocale = globalLocale._abbr; + var aliasedRequire = require; + !(function webpackMissingModule() { var e = new Error("Cannot find module \"./locale\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()); + getSetGlobalLocale(oldLocale); + } catch (e) {} + } + return locales[name]; +} + +// This function will load locale and then set the global locale. If +// no arguments are passed in, it will simply return the current global +// locale key. +function getSetGlobalLocale (key, values) { + var data; + if (key) { + if (isUndefined(values)) { + data = getLocale(key); + } + else { + data = defineLocale(key, values); + } - }, { - key: '_removePopup', - value: function _removePopup() { - if (this.popupDiv.html !== undefined) { - this.popupDiv.html.parentNode.removeChild(this.popupDiv.html); - clearTimeout(this.popupDiv.hideTimeout); - clearTimeout(this.popupDiv.deleteTimeout); - this.popupDiv = {}; + if (data) { + // moment.duration._locale = moment._locale = data; + globalLocale = data; } - } + } - /** - * Show the popup if it is needed. - * @private - */ + return globalLocale._abbr; +} - }, { - key: '_showPopupIfNeeded', - value: function _showPopupIfNeeded() { - var _this3 = this; +function defineLocale (name, config) { + if (config !== null) { + var parentConfig = baseConfig; + config.abbr = name; + if (locales[name] != null) { + deprecateSimple('defineLocaleOverride', + 'use moment.updateLocale(localeName, config) to change ' + + 'an existing locale. moment.defineLocale(localeName, ' + + 'config) should only be used for creating a new locale ' + + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); + parentConfig = locales[name]._config; + } else if (config.parentLocale != null) { + if (locales[config.parentLocale] != null) { + parentConfig = locales[config.parentLocale]._config; + } else { + if (!localeFamilies[config.parentLocale]) { + localeFamilies[config.parentLocale] = []; + } + localeFamilies[config.parentLocale].push({ + name: name, + config: config + }); + return null; + } + } + locales[name] = new Locale(mergeConfigs(parentConfig, config)); - if (this.popupDiv.html !== undefined) { - var correspondingElement = this.domElements[this.popupDiv.index]; - var rect = correspondingElement.getBoundingClientRect(); - this.popupDiv.html.style.left = rect.left + "px"; - this.popupDiv.html.style.top = rect.top - 30 + "px"; // 30 is the height; - document.body.appendChild(this.popupDiv.html); - this.popupDiv.hideTimeout = setTimeout(function () { - _this3.popupDiv.html.style.opacity = 0; - }, 1500); - this.popupDiv.deleteTimeout = setTimeout(function () { - _this3._removePopup(); - }, 1800); + if (localeFamilies[name]) { + localeFamilies[name].forEach(function (x) { + defineLocale(x.name, x.config); + }); } - } - /** - * make a checkbox for boolean options. - * @param defaultValue - * @param value - * @param path - * @private - */ + // backwards compat for now: also set the locale + // make sure we set the locale AFTER all child locales have been + // created, so we won't end up with the child locale set. + getSetGlobalLocale(name); - }, { - key: '_makeCheckbox', - value: function _makeCheckbox(defaultValue, value, path) { - var checkbox = document.createElement('input'); - checkbox.type = 'checkbox'; - checkbox.className = 'vis-configuration vis-config-checkbox'; - checkbox.checked = defaultValue; - if (value !== undefined) { - checkbox.checked = value; - if (value !== defaultValue) { - if ((typeof defaultValue === 'undefined' ? 'undefined' : (0, _typeof3['default'])(defaultValue)) === 'object') { - if (value !== defaultValue.enabled) { - this.changedOptions.push({ path: path, value: value }); - } - } else { - this.changedOptions.push({ path: path, value: value }); + + return locales[name]; + } else { + // useful for testing + delete locales[name]; + return null; + } +} + +function updateLocale(name, config) { + if (config != null) { + var locale, parentConfig = baseConfig; + // MERGE + if (locales[name] != null) { + parentConfig = locales[name]._config; + } + config = mergeConfigs(parentConfig, config); + locale = new Locale(config); + locale.parentLocale = locales[name]; + locales[name] = locale; + + // backwards compat for now: also set the locale + getSetGlobalLocale(name); + } else { + // pass null for config to unupdate, useful for tests + if (locales[name] != null) { + if (locales[name].parentLocale != null) { + locales[name] = locales[name].parentLocale; + } else if (locales[name] != null) { + delete locales[name]; } - } } + } + return locales[name]; +} - var me = this; - checkbox.onchange = function () { - me._update(this.checked, path); - }; +// returns locale data +function getLocale (key) { + var locale; - var label = this._makeLabel(path[path.length - 1], path); - this._makeItem(path, label, checkbox); - } + if (key && key._locale && key._locale._abbr) { + key = key._locale._abbr; + } - /** - * make a text input field for string options. - * @param defaultValue - * @param value - * @param path - * @private - */ + if (!key) { + return globalLocale; + } - }, { - key: '_makeTextInput', - value: function _makeTextInput(defaultValue, value, path) { - var checkbox = document.createElement('input'); - checkbox.type = 'text'; - checkbox.className = 'vis-configuration vis-config-text'; - checkbox.value = value; - if (value !== defaultValue) { - this.changedOptions.push({ path: path, value: value }); + if (!isArray(key)) { + //short-circuit everything else + locale = loadLocale(key); + if (locale) { + return locale; } + key = [key]; + } - var me = this; - checkbox.onchange = function () { - me._update(this.value, path); - }; - - var label = this._makeLabel(path[path.length - 1], path); - this._makeItem(path, label, checkbox); - } + return chooseLocale(key); +} - /** - * make a color field with a color picker for color fields - * @param arr - * @param value - * @param path - * @private - */ +function listLocales() { + return keys(locales); +} - }, { - key: '_makeColorField', - value: function _makeColorField(arr, value, path) { - var _this4 = this; +function checkOverflow (m) { + var overflow; + var a = m._a; - var defaultColor = arr[1]; - var div = document.createElement('div'); - value = value === undefined ? defaultColor : value; + if (a && getParsingFlags(m).overflow === -2) { + overflow = + a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : + a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : + a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : + a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : + a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : + a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : + -1; - if (value !== 'none') { - div.className = 'vis-configuration vis-config-colorBlock'; - div.style.backgroundColor = value; - } else { - div.className = 'vis-configuration vis-config-colorBlock none'; + if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { + overflow = DATE; + } + if (getParsingFlags(m)._overflowWeeks && overflow === -1) { + overflow = WEEK; + } + if (getParsingFlags(m)._overflowWeekday && overflow === -1) { + overflow = WEEKDAY; } - value = value === undefined ? defaultColor : value; - div.onclick = function () { - _this4._showColorPicker(value, div, path); - }; + getParsingFlags(m).overflow = overflow; + } - var label = this._makeLabel(path[path.length - 1], path); - this._makeItem(path, label, div); - } + return m; +} - /** - * used by the color buttons to call the color picker. - * @param event - * @param value - * @param div - * @param path - * @private - */ +// Pick the first defined of two or three arguments. +function defaults(a, b, c) { + if (a != null) { + return a; + } + if (b != null) { + return b; + } + return c; +} - }, { - key: '_showColorPicker', - value: function _showColorPicker(value, div, path) { - var _this5 = this; +function currentDateArray(config) { + // hooks is actually the exported moment object + var nowValue = new Date(hooks.now()); + if (config._useUTC) { + return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; + } + return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; +} - // clear the callback from this div - div.onclick = function () {}; +// convert an array to a date. +// the array should mirror the parameters below +// note: all values past the year are optional and will default to the lowest possible value. +// [year, month, day , hour, minute, second, millisecond] +function configFromArray (config) { + var i, date, input = [], currentDate, yearToUse; - this.colorPicker.insertTo(div); - this.colorPicker.show(); + if (config._d) { + return; + } - this.colorPicker.setColor(value); - this.colorPicker.setUpdateCallback(function (color) { - var colorString = 'rgba(' + color.r + ',' + color.g + ',' + color.b + ',' + color.a + ')'; - div.style.backgroundColor = colorString; - _this5._update(colorString, path); - }); + currentDate = currentDateArray(config); - // on close of the colorpicker, restore the callback. - this.colorPicker.setCloseCallback(function () { - div.onclick = function () { - _this5._showColorPicker(value, div, path); - }; - }); - } + //compute day of the year from weeks and weekdays + if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { + dayOfYearFromWeekInfo(config); + } - /** - * parse an object and draw the correct items - * @param obj - * @param path - * @private - */ + //if the day of the year is set, figure out what it is + if (config._dayOfYear != null) { + yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - }, { - key: '_handleObject', - value: function _handleObject(obj) { - var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - var checkOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var show = false; - var filter = this.options.filter; - var visibleInSet = false; - for (var subObj in obj) { - if (obj.hasOwnProperty(subObj)) { - show = true; - var item = obj[subObj]; - var newPath = util.copyAndExtendArray(path, subObj); - if (typeof filter === 'function') { - show = filter(subObj, path); - - // if needed we must go deeper into the object. - if (show === false) { - if (!(item instanceof Array) && typeof item !== 'string' && typeof item !== 'boolean' && item instanceof Object) { - this.allowCreation = false; - show = this._handleObject(item, newPath, true); - this.allowCreation = checkOnly === false; - } - } - } + if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) { + getParsingFlags(config)._overflowDayOfYear = true; + } - if (show !== false) { - visibleInSet = true; - var value = this._getValue(newPath); - - if (item instanceof Array) { - this._handleArray(item, value, newPath); - } else if (typeof item === 'string') { - this._makeTextInput(item, value, newPath); - } else if (typeof item === 'boolean') { - this._makeCheckbox(item, value, newPath); - } else if (item instanceof Object) { - // collapse the physics options that are not enabled - var draw = true; - if (path.indexOf('physics') !== -1) { - if (this.moduleOptions.physics.solver !== subObj) { - draw = false; - } - } + date = createUTCDate(yearToUse, 0, config._dayOfYear); + config._a[MONTH] = date.getUTCMonth(); + config._a[DATE] = date.getUTCDate(); + } - if (draw === true) { - // initially collapse options with an disabled enabled option. - if (item.enabled !== undefined) { - var enabledPath = util.copyAndExtendArray(newPath, 'enabled'); - var enabledValue = this._getValue(enabledPath); - if (enabledValue === true) { - var label = this._makeLabel(subObj, newPath, true); - this._makeItem(newPath, label); - visibleInSet = this._handleObject(item, newPath) || visibleInSet; - } else { - this._makeCheckbox(item, enabledValue, newPath); - } - } else { - var _label = this._makeLabel(subObj, newPath, true); - this._makeItem(newPath, _label); - visibleInSet = this._handleObject(item, newPath) || visibleInSet; - } - } - } else { - console.error('dont know how to handle', item, subObj, newPath); - } - } - } - } - return visibleInSet; - } + // Default to current date. + // * if no year, month, day of month are given, default to today + // * if day of month is given, default month and year + // * if month is given, default only year + // * if year is given, don't default anything + for (i = 0; i < 3 && config._a[i] == null; ++i) { + config._a[i] = input[i] = currentDate[i]; + } - /** - * handle the array type of option - * @param optionName - * @param arr - * @param value - * @param path - * @private - */ + // Zero out whatever was not defaulted, including time + for (; i < 7; i++) { + config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; + } - }, { - key: '_handleArray', - value: function _handleArray(arr, value, path) { - if (typeof arr[0] === 'string' && arr[0] === 'color') { - this._makeColorField(arr, value, path); - if (arr[1] !== value) { - this.changedOptions.push({ path: path, value: value }); - } - } else if (typeof arr[0] === 'string') { - this._makeDropdown(arr, value, path); - if (arr[0] !== value) { - this.changedOptions.push({ path: path, value: value }); - } - } else if (typeof arr[0] === 'number') { - this._makeRange(arr, value, path); - if (arr[0] !== value) { - this.changedOptions.push({ path: path, value: Number(value) }); - } - } - } + // Check for 24:00:00.000 + if (config._a[HOUR] === 24 && + config._a[MINUTE] === 0 && + config._a[SECOND] === 0 && + config._a[MILLISECOND] === 0) { + config._nextDay = true; + config._a[HOUR] = 0; + } - /** - * called to update the network with the new settings. - * @param value - * @param path - * @private - */ + config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); + // Apply timezone offset from input. The actual utcOffset can be changed + // with parseZone. + if (config._tzm != null) { + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); + } - }, { - key: '_update', - value: function _update(value, path) { - var options = this._constructOptions(value, path); + if (config._nextDay) { + config._a[HOUR] = 24; + } + + // check for mismatching day of week + if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) { + getParsingFlags(config).weekdayMismatch = true; + } +} + +function dayOfYearFromWeekInfo(config) { + var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) { - this.parent.body.emitter.emit("configChange", options); + w = config._w; + if (w.GG != null || w.W != null || w.E != null) { + dow = 1; + doy = 4; + + // TODO: We need to take the current isoWeekYear, but that depends on + // how we interpret now (local, utc, fixed offset). So create + // a now version of current config (take local/utc/offset flags, and + // create now). + weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); + week = defaults(w.W, 1); + weekday = defaults(w.E, 1); + if (weekday < 1 || weekday > 7) { + weekdayOverflow = true; } - this.initialized = true; - this.parent.setOptions(options); - } - }, { - key: '_constructOptions', - value: function _constructOptions(value, path) { - var optionsObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + } else { + dow = config._locale._week.dow; + doy = config._locale._week.doy; - var pointer = optionsObj; + var curWeek = weekOfYear(createLocal(), dow, doy); - // when dropdown boxes can be string or boolean, we typecast it into correct types - value = value === 'true' ? true : value; - value = value === 'false' ? false : value; + weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); - for (var i = 0; i < path.length; i++) { - if (path[i] !== 'global') { - if (pointer[path[i]] === undefined) { - pointer[path[i]] = {}; + // Default to current week. + week = defaults(w.w, curWeek.week); + + if (w.d != null) { + // weekday -- low day numbers are considered next week + weekday = w.d; + if (weekday < 0 || weekday > 6) { + weekdayOverflow = true; } - if (i !== path.length - 1) { - pointer = pointer[path[i]]; - } else { - pointer[path[i]] = value; + } else if (w.e != null) { + // local weekday -- counting starts from begining of week + weekday = w.e + dow; + if (w.e < 0 || w.e > 6) { + weekdayOverflow = true; } - } + } else { + // default to begining of week + weekday = dow; } - return optionsObj; - } - }, { - key: '_printOptions', - value: function _printOptions() { - var options = this.getOptions(); - this.optionsContainer.innerHTML = '
var options = ' + (0, _stringify2['default'])(options, null, 2) + '
'; - } - }, { - key: 'getOptions', - value: function getOptions() { - var options = {}; - for (var i = 0; i < this.changedOptions.length; i++) { - this._constructOptions(this.changedOptions[i].value, this.changedOptions[i].path, options); + } + if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { + getParsingFlags(config)._overflowWeeks = true; + } else if (weekdayOverflow != null) { + getParsingFlags(config)._overflowWeekday = true; + } else { + temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); + config._a[YEAR] = temp.year; + config._dayOfYear = temp.dayOfYear; + } +} + +// iso 8601 regex +// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) +var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; +var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; + +var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; + +var isoDates = [ + ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], + ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], + ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], + ['GGGG-[W]WW', /\d{4}-W\d\d/, false], + ['YYYY-DDD', /\d{4}-\d{3}/], + ['YYYY-MM', /\d{4}-\d\d/, false], + ['YYYYYYMMDD', /[+-]\d{10}/], + ['YYYYMMDD', /\d{8}/], + // YYYYMM is NOT allowed by the standard + ['GGGG[W]WWE', /\d{4}W\d{3}/], + ['GGGG[W]WW', /\d{4}W\d{2}/, false], + ['YYYYDDD', /\d{7}/] +]; + +// iso time formats and regexes +var isoTimes = [ + ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], + ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], + ['HH:mm:ss', /\d\d:\d\d:\d\d/], + ['HH:mm', /\d\d:\d\d/], + ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], + ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], + ['HHmmss', /\d\d\d\d\d\d/], + ['HHmm', /\d\d\d\d/], + ['HH', /\d\d/] +]; + +var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; + +// date from iso format +function configFromISO(config) { + var i, l, + string = config._i, + match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), + allowTime, dateFormat, timeFormat, tzFormat; + + if (match) { + getParsingFlags(config).iso = true; + + for (i = 0, l = isoDates.length; i < l; i++) { + if (isoDates[i][1].exec(match[1])) { + dateFormat = isoDates[i][0]; + allowTime = isoDates[i][2] !== false; + break; + } } - return options; - } - }]); - return Configurator; - }(); + if (dateFormat == null) { + config._isValid = false; + return; + } + if (match[3]) { + for (i = 0, l = isoTimes.length; i < l; i++) { + if (isoTimes[i][1].exec(match[3])) { + // match[2] should be 'T' or space + timeFormat = (match[2] || ' ') + isoTimes[i][0]; + break; + } + } + if (timeFormat == null) { + config._isValid = false; + return; + } + } + if (!allowTime && timeFormat != null) { + config._isValid = false; + return; + } + if (match[4]) { + if (tzRegex.exec(match[4])) { + tzFormat = 'Z'; + } else { + config._isValid = false; + return; + } + } + config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); + configFromStringAndFormat(config); + } else { + config._isValid = false; + } +} - exports['default'] = Configurator; +// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 +var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { +function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = [ + untruncateYear(yearStr), + defaultLocaleMonthsShort.indexOf(monthStr), + parseInt(dayStr, 10), + parseInt(hourStr, 10), + parseInt(minuteStr, 10) + ]; - 'use strict'; + if (secondStr) { + result.push(parseInt(secondStr, 10)); + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + return result; +} + +function untruncateYear(yearStr) { + var year = parseInt(yearStr, 10); + if (year <= 49) { + return 2000 + year; + } else if (year <= 999) { + return 1900 + year; + } + return year; +} + +function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim(); +} + +function checkWeekday(weekdayStr, parsedInput, config) { + if (weekdayStr) { + // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. + var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), + weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); + if (weekdayProvided !== weekdayActual) { + getParsingFlags(config).weekdayMismatch = true; + config._isValid = false; + return false; + } + } + return true; +} + +var obsOffsets = { + UT: 0, + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 +}; + +function calculateOffset(obsOffset, militaryOffset, numOffset) { + if (obsOffset) { + return obsOffsets[obsOffset]; + } else if (militaryOffset) { + // the only allowed military tz is Z + return 0; + } else { + var hm = parseInt(numOffset, 10); + var m = hm % 100, h = (hm - m) / 100; + return h * 60 + m; + } +} + +// date and time from ref 2822 format +function configFromRFC2822(config) { + var match = rfc2822.exec(preprocessRFC2822(config._i)); + if (match) { + var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); + if (!checkWeekday(match[1], parsedArray, config)) { + return; + } - var _stringify = __webpack_require__(90); + config._a = parsedArray; + config._tzm = calculateOffset(match[8], match[9], match[10]); - var _stringify2 = _interopRequireDefault(_stringify); + config._d = createUTCDate.apply(null, config._a); + config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - var _classCallCheck2 = __webpack_require__(135); + getParsingFlags(config).rfc2822 = true; + } else { + config._isValid = false; + } +} - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +// date from iso format or fallback +function configFromString(config) { + var matched = aspNetJsonRegex.exec(config._i); - var _createClass2 = __webpack_require__(136); + if (matched !== null) { + config._d = new Date(+matched[1]); + return; + } - var _createClass3 = _interopRequireDefault(_createClass2); + configFromISO(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + configFromRFC2822(config); + if (config._isValid === false) { + delete config._isValid; + } else { + return; + } - var Hammer = __webpack_require__(113); - var hammerUtil = __webpack_require__(120); - var util = __webpack_require__(1); + // Final attempt, use Input Fallback + hooks.createFromInputFallback(config); +} - var ColorPicker = function () { - function ColorPicker() { - var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; - (0, _classCallCheck3['default'])(this, ColorPicker); +hooks.createFromInputFallback = deprecate( + 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + + 'discouraged and will be removed in an upcoming major release. Please refer to ' + + 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', + function (config) { + config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); + } +); - this.pixelRatio = pixelRatio; - this.generated = false; - this.centerCoordinates = { x: 289 / 2, y: 289 / 2 }; - this.r = 289 * 0.49; - this.color = { r: 255, g: 255, b: 255, a: 1.0 }; - this.hueCircle = undefined; - this.initialColor = { r: 255, g: 255, b: 255, a: 1.0 }; - this.previousColor = undefined; - this.applied = false; +// constant that refers to the ISO standard +hooks.ISO_8601 = function () {}; - // bound by - this.updateCallback = function () {}; - this.closeCallback = function () {}; +// constant that refers to the RFC 2822 form +hooks.RFC_2822 = function () {}; - // create all DOM elements - this._create(); +// date from string and format string +function configFromStringAndFormat(config) { + // TODO: Move this to another part of the creation flow to prevent circular deps + if (config._f === hooks.ISO_8601) { + configFromISO(config); + return; + } + if (config._f === hooks.RFC_2822) { + configFromRFC2822(config); + return; } + config._a = []; + getParsingFlags(config).empty = true; - /** - * this inserts the colorPicker into a div from the DOM - * @param container - */ + // This array is used to make a Date, either with `new Date` or `Date.UTC` + var string = '' + config._i, + i, parsedInput, tokens, token, skipped, + stringLength = string.length, + totalParsedInputLength = 0; + tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - (0, _createClass3['default'])(ColorPicker, [{ - key: 'insertTo', - value: function insertTo(container) { - if (this.hammer !== undefined) { - this.hammer.destroy(); - this.hammer = undefined; + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; + // console.log('token', token, 'parsedInput', parsedInput, + // 'regex', getParseRegexForToken(token, config)); + if (parsedInput) { + skipped = string.substr(0, string.indexOf(parsedInput)); + if (skipped.length > 0) { + getParsingFlags(config).unusedInput.push(skipped); + } + string = string.slice(string.indexOf(parsedInput) + parsedInput.length); + totalParsedInputLength += parsedInput.length; + } + // don't parse if it's not a known token + if (formatTokenFunctions[token]) { + if (parsedInput) { + getParsingFlags(config).empty = false; + } + else { + getParsingFlags(config).unusedTokens.push(token); + } + addTimeToArrayFromToken(token, parsedInput, config); + } + else if (config._strict && !parsedInput) { + getParsingFlags(config).unusedTokens.push(token); } - this.container = container; - this.container.appendChild(this.frame); - this._bindHammer(); + } - this._setSize(); - } + // add remaining unparsed input length to the string + getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; + if (string.length > 0) { + getParsingFlags(config).unusedInput.push(string); + } - /** - * the callback is executed on apply and save. Bind it to the application - * @param callback - */ + // clear _12h flag if hour is <= 12 + if (config._a[HOUR] <= 12 && + getParsingFlags(config).bigHour === true && + config._a[HOUR] > 0) { + getParsingFlags(config).bigHour = undefined; + } - }, { - key: 'setUpdateCallback', - value: function setUpdateCallback(callback) { - if (typeof callback === 'function') { - this.updateCallback = callback; - } else { - throw new Error("Function attempted to set as colorPicker update callback is not a function."); - } - } + getParsingFlags(config).parsedDateParts = config._a.slice(0); + getParsingFlags(config).meridiem = config._meridiem; + // handle meridiem + config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - /** - * the callback is executed on apply and save. Bind it to the application - * @param callback - */ + configFromArray(config); + checkOverflow(config); +} - }, { - key: 'setCloseCallback', - value: function setCloseCallback(callback) { - if (typeof callback === 'function') { - this.closeCallback = callback; - } else { - throw new Error("Function attempted to set as colorPicker closing callback is not a function."); + +function meridiemFixWrap (locale, hour, meridiem) { + var isPm; + + if (meridiem == null) { + // nothing to do + return hour; + } + if (locale.meridiemHour != null) { + return locale.meridiemHour(hour, meridiem); + } else if (locale.isPM != null) { + // Fallback + isPm = locale.isPM(meridiem); + if (isPm && hour < 12) { + hour += 12; } - } - }, { - key: '_isColorString', - value: function _isColorString(color) { - var htmlColors = { black: '#000000', navy: '#000080', darkblue: '#00008B', mediumblue: '#0000CD', blue: '#0000FF', darkgreen: '#006400', green: '#008000', teal: '#008080', darkcyan: '#008B8B', deepskyblue: '#00BFFF', darkturquoise: '#00CED1', mediumspringgreen: '#00FA9A', lime: '#00FF00', springgreen: '#00FF7F', aqua: '#00FFFF', cyan: '#00FFFF', midnightblue: '#191970', dodgerblue: '#1E90FF', lightseagreen: '#20B2AA', forestgreen: '#228B22', seagreen: '#2E8B57', darkslategray: '#2F4F4F', limegreen: '#32CD32', mediumseagreen: '#3CB371', turquoise: '#40E0D0', royalblue: '#4169E1', steelblue: '#4682B4', darkslateblue: '#483D8B', mediumturquoise: '#48D1CC', indigo: '#4B0082', darkolivegreen: '#556B2F', cadetblue: '#5F9EA0', cornflowerblue: '#6495ED', mediumaquamarine: '#66CDAA', dimgray: '#696969', slateblue: '#6A5ACD', olivedrab: '#6B8E23', slategray: '#708090', lightslategray: '#778899', mediumslateblue: '#7B68EE', lawngreen: '#7CFC00', chartreuse: '#7FFF00', aquamarine: '#7FFFD4', maroon: '#800000', purple: '#800080', olive: '#808000', gray: '#808080', skyblue: '#87CEEB', lightskyblue: '#87CEFA', blueviolet: '#8A2BE2', darkred: '#8B0000', darkmagenta: '#8B008B', saddlebrown: '#8B4513', darkseagreen: '#8FBC8F', lightgreen: '#90EE90', mediumpurple: '#9370D8', darkviolet: '#9400D3', palegreen: '#98FB98', darkorchid: '#9932CC', yellowgreen: '#9ACD32', sienna: '#A0522D', brown: '#A52A2A', darkgray: '#A9A9A9', lightblue: '#ADD8E6', greenyellow: '#ADFF2F', paleturquoise: '#AFEEEE', lightsteelblue: '#B0C4DE', powderblue: '#B0E0E6', firebrick: '#B22222', darkgoldenrod: '#B8860B', mediumorchid: '#BA55D3', rosybrown: '#BC8F8F', darkkhaki: '#BDB76B', silver: '#C0C0C0', mediumvioletred: '#C71585', indianred: '#CD5C5C', peru: '#CD853F', chocolate: '#D2691E', tan: '#D2B48C', lightgrey: '#D3D3D3', palevioletred: '#D87093', thistle: '#D8BFD8', orchid: '#DA70D6', goldenrod: '#DAA520', crimson: '#DC143C', gainsboro: '#DCDCDC', plum: '#DDA0DD', burlywood: '#DEB887', lightcyan: '#E0FFFF', lavender: '#E6E6FA', darksalmon: '#E9967A', violet: '#EE82EE', palegoldenrod: '#EEE8AA', lightcoral: '#F08080', khaki: '#F0E68C', aliceblue: '#F0F8FF', honeydew: '#F0FFF0', azure: '#F0FFFF', sandybrown: '#F4A460', wheat: '#F5DEB3', beige: '#F5F5DC', whitesmoke: '#F5F5F5', mintcream: '#F5FFFA', ghostwhite: '#F8F8FF', salmon: '#FA8072', antiquewhite: '#FAEBD7', linen: '#FAF0E6', lightgoldenrodyellow: '#FAFAD2', oldlace: '#FDF5E6', red: '#FF0000', fuchsia: '#FF00FF', magenta: '#FF00FF', deeppink: '#FF1493', orangered: '#FF4500', tomato: '#FF6347', hotpink: '#FF69B4', coral: '#FF7F50', darkorange: '#FF8C00', lightsalmon: '#FFA07A', orange: '#FFA500', lightpink: '#FFB6C1', pink: '#FFC0CB', gold: '#FFD700', peachpuff: '#FFDAB9', navajowhite: '#FFDEAD', moccasin: '#FFE4B5', bisque: '#FFE4C4', mistyrose: '#FFE4E1', blanchedalmond: '#FFEBCD', papayawhip: '#FFEFD5', lavenderblush: '#FFF0F5', seashell: '#FFF5EE', cornsilk: '#FFF8DC', lemonchiffon: '#FFFACD', floralwhite: '#FFFAF0', snow: '#FFFAFA', yellow: '#FFFF00', lightyellow: '#FFFFE0', ivory: '#FFFFF0', white: '#FFFFFF' }; - if (typeof color === 'string') { - return htmlColors[color]; + if (!isPm && hour === 12) { + hour = 0; } - } - - /** - * Set the color of the colorPicker - * Supported formats: - * 'red' --> HTML color string - * '#ffffff' --> hex string - * 'rbg(255,255,255)' --> rgb string - * 'rgba(255,255,255,1.0)' --> rgba string - * {r:255,g:255,b:255} --> rgb object - * {r:255,g:255,b:255,a:1.0} --> rgba object - * @param color - * @param setInitial - */ + return hour; + } else { + // this is not supposed to happen + return hour; + } +} - }, { - key: 'setColor', - value: function setColor(color) { - var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; +// date from string and array of format strings +function configFromStringAndArray(config) { + var tempConfig, + bestMoment, - if (color === 'none') { - return; - } + scoreToBeat, + i, + currentScore; - var rgba = void 0; + if (config._f.length === 0) { + getParsingFlags(config).invalidFormat = true; + config._d = new Date(NaN); + return; + } - // if a html color shorthand is used, convert to hex - var htmlColor = this._isColorString(color); - if (htmlColor !== undefined) { - color = htmlColor; + for (i = 0; i < config._f.length; i++) { + currentScore = 0; + tempConfig = copyConfig({}, config); + if (config._useUTC != null) { + tempConfig._useUTC = config._useUTC; } + tempConfig._f = config._f[i]; + configFromStringAndFormat(tempConfig); - // check format - if (util.isString(color) === true) { - if (util.isValidRGB(color) === true) { - var rgbaArray = color.substr(4).substr(0, color.length - 5).split(','); - rgba = { r: rgbaArray[0], g: rgbaArray[1], b: rgbaArray[2], a: 1.0 }; - } else if (util.isValidRGBA(color) === true) { - var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(','); - rgba = { r: _rgbaArray[0], g: _rgbaArray[1], b: _rgbaArray[2], a: _rgbaArray[3] }; - } else if (util.isValidHex(color) === true) { - var rgbObj = util.hexToRGB(color); - rgba = { r: rgbObj.r, g: rgbObj.g, b: rgbObj.b, a: 1.0 }; - } - } else { - if (color instanceof Object) { - if (color.r !== undefined && color.g !== undefined && color.b !== undefined) { - var alpha = color.a !== undefined ? color.a : '1.0'; - rgba = { r: color.r, g: color.g, b: color.b, a: alpha }; - } - } + if (!isValid(tempConfig)) { + continue; } - // set color - if (rgba === undefined) { - throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + (0, _stringify2['default'])(color)); - } else { - this._setColor(rgba, setInitial); - } - } + // if there is any input that was not parsed add a penalty for that format + currentScore += getParsingFlags(tempConfig).charsLeftOver; - /** - * this shows the color picker. - * The hue circle is constructed once and stored. - */ + //or tokens + currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - }, { - key: 'show', - value: function show() { - if (this.closeCallback !== undefined) { - this.closeCallback(); - this.closeCallback = undefined; + getParsingFlags(tempConfig).score = currentScore; + + if (scoreToBeat == null || currentScore < scoreToBeat) { + scoreToBeat = currentScore; + bestMoment = tempConfig; } + } - this.applied = false; - this.frame.style.display = 'block'; - this._generateHueCircle(); - } + extend(config, bestMoment || tempConfig); +} - // ------------------------------------------ PRIVATE ----------------------------- // +function configFromObject(config) { + if (config._d) { + return; + } - /** - * Hide the picker. Is called by the cancel button. - * Optional boolean to store the previous color for easy access later on. - * @param storePrevious - * @private - */ + var i = normalizeObjectUnits(config._i); + config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { + return obj && parseInt(obj, 10); + }); - }, { - key: '_hide', - value: function _hide() { - var _this = this; + configFromArray(config); +} - var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; +function createFromConfig (config) { + var res = new Moment(checkOverflow(prepareConfig(config))); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } - // store the previous color for next time; - if (storePrevious === true) { - this.previousColor = util.extend({}, this.color); - } + return res; +} - if (this.applied === true) { - this.updateCallback(this.initialColor); - } +function prepareConfig (config) { + var input = config._i, + format = config._f; - this.frame.style.display = 'none'; + config._locale = config._locale || getLocale(config._l); - // call the closing callback, restoring the onclick method. - // this is in a setTimeout because it will trigger the show again before the click is done. - setTimeout(function () { - if (_this.closeCallback !== undefined) { - _this.closeCallback(); - _this.closeCallback = undefined; - } - }, 0); - } + if (input === null || (format === undefined && input === '')) { + return createInvalid({nullInput: true}); + } - /** - * bound to the save button. Saves and hides. - * @private - */ + if (typeof input === 'string') { + config._i = input = config._locale.preparse(input); + } - }, { - key: '_save', - value: function _save() { - this.updateCallback(this.color); - this.applied = false; - this._hide(); - } + if (isMoment(input)) { + return new Moment(checkOverflow(input)); + } else if (isDate(input)) { + config._d = input; + } else if (isArray(format)) { + configFromStringAndArray(config); + } else if (format) { + configFromStringAndFormat(config); + } else { + configFromInput(config); + } - /** - * Bound to apply button. Saves but does not close. Is undone by the cancel button. - * @private - */ + if (!isValid(config)) { + config._d = null; + } - }, { - key: '_apply', - value: function _apply() { - this.applied = true; - this.updateCallback(this.color); - this._updatePicker(this.color); - } + return config; +} - /** - * load the color from the previous session. - * @private - */ +function configFromInput(config) { + var input = config._i; + if (isUndefined(input)) { + config._d = new Date(hooks.now()); + } else if (isDate(input)) { + config._d = new Date(input.valueOf()); + } else if (typeof input === 'string') { + configFromString(config); + } else if (isArray(input)) { + config._a = map(input.slice(0), function (obj) { + return parseInt(obj, 10); + }); + configFromArray(config); + } else if (isObject(input)) { + configFromObject(config); + } else if (isNumber(input)) { + // from milliseconds + config._d = new Date(input); + } else { + hooks.createFromInputFallback(config); + } +} - }, { - key: '_loadLast', - value: function _loadLast() { - if (this.previousColor !== undefined) { - this.setColor(this.previousColor, false); - } else { - alert("There is no last color to load..."); - } - } +function createLocalOrUTC (input, format, locale, strict, isUTC) { + var c = {}; - /** - * set the color, place the picker - * @param rgba - * @param setInitial - * @private - */ + if (locale === true || locale === false) { + strict = locale; + locale = undefined; + } - }, { - key: '_setColor', - value: function _setColor(rgba) { - var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + if ((isObject(input) && isObjectEmpty(input)) || + (isArray(input) && input.length === 0)) { + input = undefined; + } + // object construction must be done this way. + // https://github.com/moment/moment/issues/1423 + c._isAMomentObject = true; + c._useUTC = c._isUTC = isUTC; + c._l = locale; + c._i = input; + c._f = format; + c._strict = strict; - // store the initial color - if (setInitial === true) { - this.initialColor = util.extend({}, rgba); - } + return createFromConfig(c); +} - this.color = rgba; - var hsv = util.RGBToHSV(rgba.r, rgba.g, rgba.b); +function createLocal (input, format, locale, strict) { + return createLocalOrUTC(input, format, locale, strict, false); +} - var angleConvert = 2 * Math.PI; - var radius = this.r * hsv.s; - var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h); - var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h); +var prototypeMin = deprecate( + 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other < this ? this : other; + } else { + return createInvalid(); + } + } +); - this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + 'px'; - this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + 'px'; +var prototypeMax = deprecate( + 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', + function () { + var other = createLocal.apply(null, arguments); + if (this.isValid() && other.isValid()) { + return other > this ? this : other; + } else { + return createInvalid(); + } + } +); - this._updatePicker(rgba); - } +// Pick a moment m from moments so that m[fn](other) is true for all +// other. This relies on the function fn to be transitive. +// +// moments should either be an array of moment objects or an array, whose +// first element is an array of moment objects. +function pickBy(fn, moments) { + var res, i; + if (moments.length === 1 && isArray(moments[0])) { + moments = moments[0]; + } + if (!moments.length) { + return createLocal(); + } + res = moments[0]; + for (i = 1; i < moments.length; ++i) { + if (!moments[i].isValid() || moments[i][fn](res)) { + res = moments[i]; + } + } + return res; +} - /** - * bound to opacity control - * @param value - * @private - */ +// TODO: Use [].sort instead? +function min () { + var args = [].slice.call(arguments, 0); - }, { - key: '_setOpacity', - value: function _setOpacity(value) { - this.color.a = value / 100; - this._updatePicker(this.color); - } + return pickBy('isBefore', args); +} - /** - * bound to brightness control - * @param value - * @private - */ +function max () { + var args = [].slice.call(arguments, 0); - }, { - key: '_setBrightness', - value: function _setBrightness(value) { - var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b); - hsv.v = value / 100; - var rgba = util.HSVToRGB(hsv.h, hsv.s, hsv.v); - rgba['a'] = this.color.a; - this.color = rgba; - this._updatePicker(); - } + return pickBy('isAfter', args); +} - /** - * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing. - * @param rgba - * @private - */ +var now = function () { + return Date.now ? Date.now() : +(new Date()); +}; - }, { - key: '_updatePicker', - value: function _updatePicker() { - var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color; +var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; - var hsv = util.RGBToHSV(rgba.r, rgba.g, rgba.b); - var ctx = this.colorPickerCanvas.getContext('2d'); - if (this.pixelRation === undefined) { - this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); +function isDurationValid(m) { + for (var key in m) { + if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) { + return false; } - ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); - - // clear the canvas - var w = this.colorPickerCanvas.clientWidth; - var h = this.colorPickerCanvas.clientHeight; - ctx.clearRect(0, 0, w, h); + } - ctx.putImageData(this.hueCircle, 0, 0); - ctx.fillStyle = 'rgba(0,0,0,' + (1 - hsv.v) + ')'; - ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); - ctx.fill(); + var unitHasDecimal = false; + for (var i = 0; i < ordering.length; ++i) { + if (m[ordering[i]]) { + if (unitHasDecimal) { + return false; // only allow non-integers for smallest unit + } + if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) { + unitHasDecimal = true; + } + } + } - this.brightnessRange.value = 100 * hsv.v; - this.opacityRange.value = 100 * rgba.a; + return true; +} + +function isValid$1() { + return this._isValid; +} + +function createInvalid$1() { + return createDuration(NaN); +} + +function Duration (duration) { + var normalizedInput = normalizeObjectUnits(duration), + years = normalizedInput.year || 0, + quarters = normalizedInput.quarter || 0, + months = normalizedInput.month || 0, + weeks = normalizedInput.week || 0, + days = normalizedInput.day || 0, + hours = normalizedInput.hour || 0, + minutes = normalizedInput.minute || 0, + seconds = normalizedInput.second || 0, + milliseconds = normalizedInput.millisecond || 0; + + this._isValid = isDurationValid(normalizedInput); + + // representation for dateAddRemove + this._milliseconds = +milliseconds + + seconds * 1e3 + // 1000 + minutes * 6e4 + // 1000 * 60 + hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 + // Because of dateAddRemove treats 24 hours as different from a + // day when working around DST, we need to store them separately + this._days = +days + + weeks * 7; + // It is impossible to translate months into days without knowing + // which months you are are talking about, so we have to store + // it separately. + this._months = +months + + quarters * 3 + + years * 12; - this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; - this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; - } + this._data = {}; - /** - * used by create to set the size of the canvas. - * @private - */ + this._locale = getLocale(); - }, { - key: '_setSize', - value: function _setSize() { - this.colorPickerCanvas.style.width = '100%'; - this.colorPickerCanvas.style.height = '100%'; + this._bubble(); +} - this.colorPickerCanvas.width = 289 * this.pixelRatio; - this.colorPickerCanvas.height = 289 * this.pixelRatio; - } +function isDuration (obj) { + return obj instanceof Duration; +} - /** - * create all dom elements - * TODO: cleanup, lots of similar dom elements - * @private - */ +function absRound (number) { + if (number < 0) { + return Math.round(-1 * number) * -1; + } else { + return Math.round(number); + } +} - }, { - key: '_create', - value: function _create() { - this.frame = document.createElement('div'); - this.frame.className = 'vis-color-picker'; - - this.colorPickerDiv = document.createElement('div'); - this.colorPickerSelector = document.createElement('div'); - this.colorPickerSelector.className = 'vis-selector'; - this.colorPickerDiv.appendChild(this.colorPickerSelector); - - this.colorPickerCanvas = document.createElement('canvas'); - this.colorPickerDiv.appendChild(this.colorPickerCanvas); - - if (!this.colorPickerCanvas.getContext) { - var noCanvas = document.createElement('DIV'); - noCanvas.style.color = 'red'; - noCanvas.style.fontWeight = 'bold'; - noCanvas.style.padding = '10px'; - noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; - this.colorPickerCanvas.appendChild(noCanvas); - } else { - var ctx = this.colorPickerCanvas.getContext("2d"); - this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); +// FORMATTING - this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); +function offset (token, separator) { + addFormatToken(token, 0, 0, function () { + var offset = this.utcOffset(); + var sign = '+'; + if (offset < 0) { + offset = -offset; + sign = '-'; } + return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); + }); +} - this.colorPickerDiv.className = 'vis-color'; +offset('Z', ':'); +offset('ZZ', ''); - this.opacityDiv = document.createElement('div'); - this.opacityDiv.className = 'vis-opacity'; +// PARSING - this.brightnessDiv = document.createElement('div'); - this.brightnessDiv.className = 'vis-brightness'; +addRegexToken('Z', matchShortOffset); +addRegexToken('ZZ', matchShortOffset); +addParseToken(['Z', 'ZZ'], function (input, array, config) { + config._useUTC = true; + config._tzm = offsetFromString(matchShortOffset, input); +}); - this.arrowDiv = document.createElement('div'); - this.arrowDiv.className = 'vis-arrow'; +// HELPERS - this.opacityRange = document.createElement('input'); - try { - this.opacityRange.type = 'range'; // Not supported on IE9 - this.opacityRange.min = '0'; - this.opacityRange.max = '100'; - } catch (err) {} - this.opacityRange.value = '100'; - this.opacityRange.className = 'vis-range'; - - this.brightnessRange = document.createElement('input'); - try { - this.brightnessRange.type = 'range'; // Not supported on IE9 - this.brightnessRange.min = '0'; - this.brightnessRange.max = '100'; - } catch (err) {} - this.brightnessRange.value = '100'; - this.brightnessRange.className = 'vis-range'; +// timezone chunker +// '+10:00' > ['10', '00'] +// '-1530' > ['-15', '30'] +var chunkOffset = /([\+\-]|\d\d)/gi; - this.opacityDiv.appendChild(this.opacityRange); - this.brightnessDiv.appendChild(this.brightnessRange); +function offsetFromString(matcher, string) { + var matches = (string || '').match(matcher); - var me = this; - this.opacityRange.onchange = function () { - me._setOpacity(this.value); - }; - this.opacityRange.oninput = function () { - me._setOpacity(this.value); - }; - this.brightnessRange.onchange = function () { - me._setBrightness(this.value); - }; - this.brightnessRange.oninput = function () { - me._setBrightness(this.value); - }; + if (matches === null) { + return null; + } - this.brightnessLabel = document.createElement("div"); - this.brightnessLabel.className = "vis-label vis-brightness"; - this.brightnessLabel.innerHTML = 'brightness:'; - - this.opacityLabel = document.createElement("div"); - this.opacityLabel.className = "vis-label vis-opacity"; - this.opacityLabel.innerHTML = 'opacity:'; - - this.newColorDiv = document.createElement("div"); - this.newColorDiv.className = "vis-new-color"; - this.newColorDiv.innerHTML = 'new'; - - this.initialColorDiv = document.createElement("div"); - this.initialColorDiv.className = "vis-initial-color"; - this.initialColorDiv.innerHTML = 'initial'; - - this.cancelButton = document.createElement("div"); - this.cancelButton.className = "vis-button vis-cancel"; - this.cancelButton.innerHTML = 'cancel'; - this.cancelButton.onclick = this._hide.bind(this, false); - - this.applyButton = document.createElement("div"); - this.applyButton.className = "vis-button vis-apply"; - this.applyButton.innerHTML = 'apply'; - this.applyButton.onclick = this._apply.bind(this); - - this.saveButton = document.createElement("div"); - this.saveButton.className = "vis-button vis-save"; - this.saveButton.innerHTML = 'save'; - this.saveButton.onclick = this._save.bind(this); - - this.loadButton = document.createElement("div"); - this.loadButton.className = "vis-button vis-load"; - this.loadButton.innerHTML = 'load last'; - this.loadButton.onclick = this._loadLast.bind(this); - - this.frame.appendChild(this.colorPickerDiv); - this.frame.appendChild(this.arrowDiv); - this.frame.appendChild(this.brightnessLabel); - this.frame.appendChild(this.brightnessDiv); - this.frame.appendChild(this.opacityLabel); - this.frame.appendChild(this.opacityDiv); - this.frame.appendChild(this.newColorDiv); - this.frame.appendChild(this.initialColorDiv); - - this.frame.appendChild(this.cancelButton); - this.frame.appendChild(this.applyButton); - this.frame.appendChild(this.saveButton); - this.frame.appendChild(this.loadButton); - } + var chunk = matches[matches.length - 1] || []; + var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; + var minutes = +(parts[1] * 60) + toInt(parts[2]); - /** - * bind hammer to the color picker - * @private - */ + return minutes === 0 ? + 0 : + parts[0] === '+' ? minutes : -minutes; +} - }, { - key: '_bindHammer', - value: function _bindHammer() { - var _this2 = this; +// Return a moment from input, that is local/utc/zone equivalent to model. +function cloneWithOffset(input, model) { + var res, diff; + if (model._isUTC) { + res = model.clone(); + diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); + // Use low-level api, because this fn is low-level api. + res._d.setTime(res._d.valueOf() + diff); + hooks.updateOffset(res, false); + return res; + } else { + return createLocal(input).local(); + } +} + +function getDateOffset (m) { + // On Firefox.24 Date#getTimezoneOffset returns a floating point. + // https://github.com/moment/moment/pull/1871 + return -Math.round(m._d.getTimezoneOffset() / 15) * 15; +} + +// HOOKS + +// This function will be called whenever a moment is mutated. +// It is intended to keep the offset in sync with the timezone. +hooks.updateOffset = function () {}; + +// MOMENTS + +// keepLocalTime = true means only change the timezone, without +// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> +// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset +// +0200, so we adjust the time as needed, to be valid. +// +// Keeping the time actually adds/subtracts (one hour) +// from the actual represented time. That is why we call updateOffset +// a second time. In case it wants us to change the offset again +// _changeInProgress == true case, then we have to adjust, because +// there is no such time in the given timezone. +function getSetOffset (input, keepLocalTime, keepMinutes) { + var offset = this._offset || 0, + localAdjust; + if (!this.isValid()) { + return input != null ? this : NaN; + } + if (input != null) { + if (typeof input === 'string') { + input = offsetFromString(matchShortOffset, input); + if (input === null) { + return this; + } + } else if (Math.abs(input) < 16 && !keepMinutes) { + input = input * 60; + } + if (!this._isUTC && keepLocalTime) { + localAdjust = getDateOffset(this); + } + this._offset = input; + this._isUTC = true; + if (localAdjust != null) { + this.add(localAdjust, 'm'); + } + if (offset !== input) { + if (!keepLocalTime || this._changeInProgress) { + addSubtract(this, createDuration(input - offset, 'm'), 1, false); + } else if (!this._changeInProgress) { + this._changeInProgress = true; + hooks.updateOffset(this, true); + this._changeInProgress = null; + } + } + return this; + } else { + return this._isUTC ? offset : getDateOffset(this); + } +} - this.drag = {}; - this.pinch = {}; - this.hammer = new Hammer(this.colorPickerCanvas); - this.hammer.get('pinch').set({ enable: true }); +function getSetZone (input, keepLocalTime) { + if (input != null) { + if (typeof input !== 'string') { + input = -input; + } - hammerUtil.onTouch(this.hammer, function (event) { - _this2._moveSelector(event); - }); - this.hammer.on('tap', function (event) { - _this2._moveSelector(event); - }); - this.hammer.on('panstart', function (event) { - _this2._moveSelector(event); - }); - this.hammer.on('panmove', function (event) { - _this2._moveSelector(event); - }); - this.hammer.on('panend', function (event) { - _this2._moveSelector(event); - }); - } + this.utcOffset(input, keepLocalTime); - /** - * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown. - * @private - */ + return this; + } else { + return -this.utcOffset(); + } +} - }, { - key: '_generateHueCircle', - value: function _generateHueCircle() { - if (this.generated === false) { - var ctx = this.colorPickerCanvas.getContext('2d'); - if (this.pixelRation === undefined) { - this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); - } - ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); - - // clear the canvas - var w = this.colorPickerCanvas.clientWidth; - var h = this.colorPickerCanvas.clientHeight; - ctx.clearRect(0, 0, w, h); +function setOffsetToUTC (keepLocalTime) { + return this.utcOffset(0, keepLocalTime); +} - // draw hue circle - var x = void 0, - y = void 0, - hue = void 0, - sat = void 0; - this.centerCoordinates = { x: w * 0.5, y: h * 0.5 }; - this.r = 0.49 * w; - var angleConvert = 2 * Math.PI / 360; - var hfac = 1 / 360; - var sfac = 1 / this.r; - var rgb = void 0; - for (hue = 0; hue < 360; hue++) { - for (sat = 0; sat < this.r; sat++) { - x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue); - y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue); - rgb = util.HSVToRGB(hue * hfac, sat * sfac, 1); - ctx.fillStyle = 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')'; - ctx.fillRect(x - 0.5, y - 0.5, 2, 2); - } - } - ctx.strokeStyle = 'rgba(0,0,0,1)'; - ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); - ctx.stroke(); +function setOffsetToLocal (keepLocalTime) { + if (this._isUTC) { + this.utcOffset(0, keepLocalTime); + this._isUTC = false; - this.hueCircle = ctx.getImageData(0, 0, w, h); + if (keepLocalTime) { + this.subtract(getDateOffset(this), 'm'); } - this.generated = true; - } - - /** - * move the selector. This is called by hammer functions. - * - * @param event - * @private - */ - - }, { - key: '_moveSelector', - value: function _moveSelector(event) { - var rect = this.colorPickerDiv.getBoundingClientRect(); - var left = event.center.x - rect.left; - var top = event.center.y - rect.top; - - var centerY = 0.5 * this.colorPickerDiv.clientHeight; - var centerX = 0.5 * this.colorPickerDiv.clientWidth; - - var x = left - centerX; - var y = top - centerY; - - var angle = Math.atan2(x, y); - var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX); - - var newTop = Math.cos(angle) * radius + centerY; - var newLeft = Math.sin(angle) * radius + centerX; - - this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + 'px'; - this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + 'px'; - - // set color - var h = angle / (2 * Math.PI); - h = h < 0 ? h + 1 : h; - var s = radius / this.r; - var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b); - hsv.h = h; - hsv.s = s; - var rgba = util.HSVToRGB(hsv.h, hsv.s, hsv.v); - rgba['a'] = this.color.a; - this.color = rgba; - - // update previews - this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; - this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; - } - }]); - return ColorPicker; - }(); + } + return this; +} - exports['default'] = ColorPicker; +function setOffsetToParsedOffset () { + if (this._tzm != null) { + this.utcOffset(this._tzm, false, true); + } else if (typeof this._i === 'string') { + var tZone = offsetFromString(matchOffset, this._i); + if (tZone != null) { + this.utcOffset(tZone); + } + else { + this.utcOffset(0, true); + } + } + return this; +} -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { +function hasAlignedHourOffset (input) { + if (!this.isValid()) { + return false; + } + input = input ? createLocal(input).utcOffset() : 0; - 'use strict'; + return (this.utcOffset() - input) % 60 === 0; +} - var Emitter = __webpack_require__(99); - var Hammer = __webpack_require__(113); - var moment = __webpack_require__(82); - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var Range = __webpack_require__(119); - var Core = __webpack_require__(123); - var TimeAxis = __webpack_require__(140); - var CurrentTime = __webpack_require__(144); - var CustomTime = __webpack_require__(142); - var LineGraph = __webpack_require__(150); - - var printStyle = __webpack_require__(145).printStyle; - var allOptions = __webpack_require__(158).allOptions; - var configureOptions = __webpack_require__(158).configureOptions; - - var Configurator = __webpack_require__(147)['default']; - var Validator = __webpack_require__(145)['default']; +function isDaylightSavingTime () { + return ( + this.utcOffset() > this.clone().month(0).utcOffset() || + this.utcOffset() > this.clone().month(5).utcOffset() + ); +} - /** - * Create a timeline visualization - * @param {HTMLElement} container - * @param {vis.DataSet | Array} [items] - * @param {Object} [options] See Graph2d.setOptions for the available options. - * @constructor - * @extends Core - */ - function Graph2d(container, items, groups, options) { - // if the third element is options, the forth is groups (optionally); - if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) { - var forthArgument = options; - options = groups; - groups = forthArgument; +function isDaylightSavingTimeShifted () { + if (!isUndefined(this._isDSTShifted)) { + return this._isDSTShifted; } - // TODO: REMOVE THIS in the next MAJOR release - // see https://github.com/almende/vis/issues/2511 - if (options && options.throttleRedraw) { - console.warn("Graph2d option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release."); - } + var c = {}; - var me = this; - this.defaultOptions = { - start: null, - end: null, + copyConfig(c, this); + c = prepareConfig(c); - autoResize: true, + if (c._a) { + var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); + this._isDSTShifted = this.isValid() && + compareArrays(c._a, other.toArray()) > 0; + } else { + this._isDSTShifted = false; + } - orientation: { - axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both' - item: 'bottom' // not relevant for Graph2d - }, + return this._isDSTShifted; +} - moment: moment, +function isLocal () { + return this.isValid() ? !this._isUTC : false; +} - width: null, - height: null, - maxHeight: null, - minHeight: null - }; - this.options = util.deepExtend({}, this.defaultOptions); +function isUtcOffset () { + return this.isValid() ? this._isUTC : false; +} - // Create the DOM, props, and emitter - this._create(container); +function isUtc () { + return this.isValid() ? this._isUTC && this._offset === 0 : false; +} - // all components listed here will be repainted automatically - this.components = []; +// ASP.NET json date format regex +var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; - this.body = { - dom: this.dom, - domProps: this.props, - emitter: { - on: this.on.bind(this), - off: this.off.bind(this), - emit: this.emit.bind(this) - }, - hiddenDates: [], - util: { - toScreen: me._toScreen.bind(me), - toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width - toTime: me._toTime.bind(me), - toGlobalTime: me._toGlobalTime.bind(me) - } - }; +// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html +// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere +// and further modified to allow for strings containing both week and day +var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; - // range - this.range = new Range(this.body); - this.components.push(this.range); - this.body.range = this.range; +function createDuration (input, key) { + var duration = input, + // matching against regexp is expensive, do it on demand + match = null, + sign, + ret, + diffRes; - // time axis - this.timeAxis = new TimeAxis(this.body); - this.components.push(this.timeAxis); - //this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); + if (isDuration(input)) { + duration = { + ms : input._milliseconds, + d : input._days, + M : input._months + }; + } else if (isNumber(input)) { + duration = {}; + if (key) { + duration[key] = input; + } else { + duration.milliseconds = input; + } + } else if (!!(match = aspNetRegex.exec(input))) { + sign = (match[1] === '-') ? -1 : 1; + duration = { + y : 0, + d : toInt(match[DATE]) * sign, + h : toInt(match[HOUR]) * sign, + m : toInt(match[MINUTE]) * sign, + s : toInt(match[SECOND]) * sign, + ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match + }; + } else if (!!(match = isoRegex.exec(input))) { + sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1; + duration = { + y : parseIso(match[2], sign), + M : parseIso(match[3], sign), + w : parseIso(match[4], sign), + d : parseIso(match[5], sign), + h : parseIso(match[6], sign), + m : parseIso(match[7], sign), + s : parseIso(match[8], sign) + }; + } else if (duration == null) {// checks for null or undefined + duration = {}; + } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { + diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); - // current time bar - this.currentTime = new CurrentTime(this.body); - this.components.push(this.currentTime); + duration = {}; + duration.ms = diffRes.milliseconds; + duration.M = diffRes.months; + } - // item set - this.linegraph = new LineGraph(this.body); + ret = new Duration(duration); - this.components.push(this.linegraph); + if (isDuration(input) && hasOwnProp(input, '_locale')) { + ret._locale = input._locale; + } - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet + return ret; +} +createDuration.fn = Duration.prototype; +createDuration.invalid = createInvalid$1; - this.on('tap', function (event) { - me.emit('click', me.getEventProperties(event)); - }); - this.on('doubletap', function (event) { - me.emit('doubleClick', me.getEventProperties(event)); - }); - this.dom.root.oncontextmenu = function (event) { - me.emit('contextmenu', me.getEventProperties(event)); - }; +function parseIso (inp, sign) { + // We'd normally use ~~inp for this, but unfortunately it also + // converts floats to ints. + // inp may be undefined, so careful calling replace on it. + var res = inp && parseFloat(inp.replace(',', '.')); + // apply sign while we're at it + return (isNaN(res) ? 0 : res) * sign; +} - // apply options - if (options) { - this.setOptions(options); - } +function positiveMomentsDifference(base, other) { + var res = {milliseconds: 0, months: 0}; - // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! - if (groups) { - this.setGroups(groups); + res.months = other.month() - base.month() + + (other.year() - base.year()) * 12; + if (base.clone().add(res.months, 'M').isAfter(other)) { + --res.months; } - // create itemset - if (items) { - this.setItems(items); - } + res.milliseconds = +other - +(base.clone().add(res.months, 'M')); - // draw for the first time - this._redraw(); - } + return res; +} - // Extend the functionality from Core - Graph2d.prototype = new Core(); +function momentsDifference(base, other) { + var res; + if (!(base.isValid() && other.isValid())) { + return {milliseconds: 0, months: 0}; + } - Graph2d.prototype.setOptions = function (options) { - // validate options - var errorFound = Validator.validate(options, allOptions); - if (errorFound === true) { - console.log('%cErrors have been found in the supplied options object.', printStyle); + other = cloneWithOffset(other, base); + if (base.isBefore(other)) { + res = positiveMomentsDifference(base, other); + } else { + res = positiveMomentsDifference(other, base); + res.milliseconds = -res.milliseconds; + res.months = -res.months; } - Core.prototype.setOptions.call(this, options); - }; + return res; +} - /** - * Set items - * @param {vis.DataSet | Array | null} items - */ - Graph2d.prototype.setItems = function (items) { - var initialLoad = this.itemsData == null; - - // convert to type DataSet when needed - var newDataSet; - if (!items) { - newDataSet = null; - } else if (items instanceof DataSet || items instanceof DataView) { - newDataSet = items; - } else { - // turn an array into a dataset - newDataSet = new DataSet(items, { - type: { - start: 'Date', - end: 'Date' +// TODO: remove 'name' arg after deprecation is removed +function createAdder(direction, name) { + return function (val, period) { + var dur, tmp; + //invert the arguments, but complain about it + if (period !== null && !isNaN(+period)) { + deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); + tmp = val; val = period; period = tmp; } - }); - } - // set items - this.itemsData = newDataSet; - this.linegraph && this.linegraph.setItems(newDataSet); + val = typeof val === 'string' ? +val : val; + dur = createDuration(val, period); + addSubtract(this, dur, direction); + return this; + }; +} - if (initialLoad) { - if (this.options.start != undefined || this.options.end != undefined) { - var start = this.options.start != undefined ? this.options.start : null; - var end = this.options.end != undefined ? this.options.end : null; - this.setWindow(start, end, { animation: false }); - } else { - this.fit({ animation: false }); - } - } - }; +function addSubtract (mom, duration, isAdding, updateOffset) { + var milliseconds = duration._milliseconds, + days = absRound(duration._days), + months = absRound(duration._months); - /** - * Set groups - * @param {vis.DataSet | Array} groups - */ - Graph2d.prototype.setGroups = function (groups) { - // convert to type DataSet when needed - var newDataSet; - if (!groups) { - newDataSet = null; - } else if (groups instanceof DataSet || groups instanceof DataView) { - newDataSet = groups; - } else { - // turn an array into a dataset - newDataSet = new DataSet(groups); + if (!mom.isValid()) { + // No op + return; } - this.groupsData = newDataSet; - this.linegraph.setGroups(newDataSet); - }; + updateOffset = updateOffset == null ? true : updateOffset; - /** - * Returns an object containing an SVG element with the icon of the group (size determined by iconWidth and iconHeight), the label of the group (content) and the yAxisOrientation of the group (left or right). - * @param groupId - * @param width - * @param height - */ - Graph2d.prototype.getLegend = function (groupId, width, height) { - if (width === undefined) { - width = 15; + if (months) { + setMonth(mom, get(mom, 'Month') + months * isAdding); } - if (height === undefined) { - height = 15; + if (days) { + set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); } - if (this.linegraph.groups[groupId] !== undefined) { - return this.linegraph.groups[groupId].getLegend(width, height); - } else { - return "cannot find group:'" + groupId + "'"; + if (milliseconds) { + mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); } - }; + if (updateOffset) { + hooks.updateOffset(mom, days || months); + } +} - /** - * This checks if the visible option of the supplied group (by ID) is true or false. - * @param groupId - * @returns {*} - */ - Graph2d.prototype.isGroupVisible = function (groupId) { - if (this.linegraph.groups[groupId] !== undefined) { - return this.linegraph.groups[groupId].visible && (this.linegraph.options.groups.visibility[groupId] === undefined || this.linegraph.options.groups.visibility[groupId] == true); - } else { - return false; - } - }; - - /** - * Get the data range of the item set. - * @returns {{min: Date, max: Date}} range A range with a start and end Date. - * When no minimum is found, min==null - * When no maximum is found, max==null - */ - Graph2d.prototype.getDataRange = function () { - var min = null; - var max = null; - - // calculate min from start filed - for (var groupId in this.linegraph.groups) { - if (this.linegraph.groups.hasOwnProperty(groupId)) { - if (this.linegraph.groups[groupId].visible == true) { - for (var i = 0; i < this.linegraph.groups[groupId].itemsData.length; i++) { - var item = this.linegraph.groups[groupId].itemsData[i]; - var value = util.convert(item.x, 'Date').valueOf(); - min = min == null ? value : min > value ? value : min; - max = max == null ? value : max < value ? value : max; - } - } - } - } - - return { - min: min != null ? new Date(min) : null, - max: max != null ? new Date(max) : null - }; - }; - - /** - * Generate Timeline related information from an event - * @param {Event} event - * @return {Object} An object with related information, like on which area - * The event happened, whether clicked on an item, etc. - */ - Graph2d.prototype.getEventProperties = function (event) { - var clientX = event.center ? event.center.x : event.clientX; - var clientY = event.center ? event.center.y : event.clientY; - var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer); - var y = clientY - util.getAbsoluteTop(this.dom.centerContainer); - var time = this._toTime(x); - - var customTime = CustomTime.customTimeFromTarget(event); - - var element = util.getTarget(event); - var what = null; - if (util.hasParent(element, this.timeAxis.dom.foreground)) { - what = 'axis'; - } else if (this.timeAxis2 && util.hasParent(element, this.timeAxis2.dom.foreground)) { - what = 'axis'; - } else if (util.hasParent(element, this.linegraph.yAxisLeft.dom.frame)) { - what = 'data-axis'; - } else if (util.hasParent(element, this.linegraph.yAxisRight.dom.frame)) { - what = 'data-axis'; - } else if (util.hasParent(element, this.linegraph.legendLeft.dom.frame)) { - what = 'legend'; - } else if (util.hasParent(element, this.linegraph.legendRight.dom.frame)) { - what = 'legend'; - } else if (customTime != null) { - what = 'custom-time'; - } else if (util.hasParent(element, this.currentTime.bar)) { - what = 'current-time'; - } else if (util.hasParent(element, this.dom.center)) { - what = 'background'; - } - - var value = []; - var yAxisLeft = this.linegraph.yAxisLeft; - var yAxisRight = this.linegraph.yAxisRight; - if (!yAxisLeft.hidden && this.itemsData.length > 0) { - value.push(yAxisLeft.screenToValue(y)); - } - if (!yAxisRight.hidden && this.itemsData.length > 0) { - value.push(yAxisRight.screenToValue(y)); - } - - return { - event: event, - what: what, - pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX, - pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY, - x: x, - y: y, - time: time, - value: value - }; - }; +var add = createAdder(1, 'add'); +var subtract = createAdder(-1, 'subtract'); - /** - * Load a configurator - * @return {Object} - * @private - */ - Graph2d.prototype._createConfigurator = function () { - return new Configurator(this, this.dom.container, configureOptions); - }; +function getCalendarFormat(myMoment, now) { + var diff = myMoment.diff(now, 'days', true); + return diff < -6 ? 'sameElse' : + diff < -1 ? 'lastWeek' : + diff < 0 ? 'lastDay' : + diff < 1 ? 'sameDay' : + diff < 2 ? 'nextDay' : + diff < 7 ? 'nextWeek' : 'sameElse'; +} - module.exports = Graph2d; +function calendar$1 (time, formats) { + // We want to compare the start of today, vs this. + // Getting start-of-today depends on whether we're local/utc/offset or not. + var now = time || createLocal(), + sod = cloneWithOffset(now, this).startOf('day'), + format = hooks.calendarFormat(this, sod) || 'sameElse'; -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { + var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); - 'use strict'; + return this.format(output || this.localeData().calendar(format, this, createLocal(now))); +} - var _typeof2 = __webpack_require__(62); +function clone () { + return new Moment(this); +} - var _typeof3 = _interopRequireDefault(_typeof2); +function isAfter (input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); + if (units === 'millisecond') { + return this.valueOf() > localInput.valueOf(); + } else { + return localInput.valueOf() < this.clone().startOf(units).valueOf(); + } +} - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +function isBefore (input, units) { + var localInput = isMoment(input) ? input : createLocal(input); + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); + if (units === 'millisecond') { + return this.valueOf() < localInput.valueOf(); + } else { + return this.clone().endOf(units).valueOf() < localInput.valueOf(); + } +} - var util = __webpack_require__(1); - var DOMutil = __webpack_require__(88); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var Component = __webpack_require__(121); - var DataAxis = __webpack_require__(151); - var GraphGroup = __webpack_require__(153); - var Legend = __webpack_require__(157); - var Bars = __webpack_require__(154); - var Lines = __webpack_require__(156); - var Points = __webpack_require__(155); +function isBetween (from, to, units, inclusivity) { + inclusivity = inclusivity || '()'; + return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && + (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); +} - var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items +function isSame (input, units) { + var localInput = isMoment(input) ? input : createLocal(input), + inputMs; + if (!(this.isValid() && localInput.isValid())) { + return false; + } + units = normalizeUnits(units || 'millisecond'); + if (units === 'millisecond') { + return this.valueOf() === localInput.valueOf(); + } else { + inputMs = localInput.valueOf(); + return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); + } +} - /** - * This is the constructor of the LineGraph. It requires a Timeline body and options. - * - * @param body - * @param options - * @constructor - */ - function LineGraph(body, options) { - this.id = util.randomUUID(); - this.body = body; +function isSameOrAfter (input, units) { + return this.isSame(input, units) || this.isAfter(input,units); +} - this.defaultOptions = { - yAxisOrientation: 'left', - defaultGroup: 'default', - sort: true, - sampling: true, - stack: false, - graphHeight: '400px', - shaded: { - enabled: false, - orientation: 'bottom' // top, bottom, zero - }, - style: 'line', // line, bar - barChart: { - width: 50, - sideBySide: false, - align: 'center' // left, center, right - }, - interpolation: { - enabled: true, - parametrization: 'centripetal', // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) - alpha: 0.5 - }, - drawPoints: { - enabled: true, - size: 6, - style: 'square' // square, circle - }, - dataAxis: {}, //Defaults are done on DataAxis level - legend: {}, //Defaults are done on Legend level - groups: { - visibility: {} - } - }; +function isSameOrBefore (input, units) { + return this.isSame(input, units) || this.isBefore(input,units); +} - // options is shared by this lineGraph and all its items - this.options = util.extend({}, this.defaultOptions); - this.dom = {}; - this.props = {}; - this.hammer = null; - this.groups = {}; - this.abortedGraphUpdate = false; - this.updateSVGheight = false; - this.updateSVGheightOnResize = false; - this.forceGraphUpdate = true; +function diff (input, units, asFloat) { + var that, + zoneDelta, + delta, output; - var me = this; - this.itemsData = null; // DataSet - this.groupsData = null; // DataSet + if (!this.isValid()) { + return NaN; + } - // listeners for the DataSet of the items - this.itemListeners = { - 'add': function add(event, params, senderId) { - me._onAdd(params.items); - }, - 'update': function update(event, params, senderId) { - me._onUpdate(params.items); - }, - 'remove': function remove(event, params, senderId) { - me._onRemove(params.items); - } - }; + that = cloneWithOffset(input, this); - // listeners for the DataSet of the groups - this.groupListeners = { - 'add': function add(event, params, senderId) { - me._onAddGroups(params.items); - }, - 'update': function update(event, params, senderId) { - me._onUpdateGroups(params.items); - }, - 'remove': function remove(event, params, senderId) { - me._onRemoveGroups(params.items); - } - }; + if (!that.isValid()) { + return NaN; + } - this.items = {}; // object with an Item for every data item - this.selection = []; // list with the ids of all selected nodes - this.lastStart = this.body.range.start; - this.touchParams = {}; // stores properties while dragging + zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - this.svgElements = {}; - this.setOptions(options); - this.groupsUsingDefaultStyles = [0]; - this.body.emitter.on('rangechanged', function () { - me.lastStart = me.body.range.start; - me.svg.style.left = util.option.asSize(-me.props.width); - - me.forceGraphUpdate = true; - //Is this local redraw necessary? (Core also does a change event!) - me.redraw.call(me); - }); + units = normalizeUnits(units); - // create the HTML DOM - this._create(); - this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups }; - } + switch (units) { + case 'year': output = monthDiff(this, that) / 12; break; + case 'month': output = monthDiff(this, that); break; + case 'quarter': output = monthDiff(this, that) / 3; break; + case 'second': output = (this - that) / 1e3; break; // 1000 + case 'minute': output = (this - that) / 6e4; break; // 1000 * 60 + case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60 + case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst + case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst + default: output = this - that; + } - LineGraph.prototype = new Component(); + return asFloat ? output : absFloor(output); +} - /** - * Create the HTML DOM for the ItemSet - */ - LineGraph.prototype._create = function () { - var frame = document.createElement('div'); - frame.className = 'vis-line-graph'; - this.dom.frame = frame; - - // create svg element for graph drawing. - this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - this.svg.style.position = 'relative'; - this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px'; - this.svg.style.display = 'block'; - frame.appendChild(this.svg); +function monthDiff (a, b) { + // difference in months + var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), + // b is in (anchor - 1 month, anchor + 1 month) + anchor = a.clone().add(wholeMonthDiff, 'months'), + anchor2, adjust; - // data axis - this.options.dataAxis.orientation = 'left'; - this.yAxisLeft = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups); + if (b - anchor < 0) { + anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor - anchor2); + } else { + anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); + // linear across the month + adjust = (b - anchor) / (anchor2 - anchor); + } + + //check for negative zero, return zero if negative zero + return -(wholeMonthDiff + adjust) || 0; +} + +hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; +hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; + +function toString () { + return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); +} + +function toISOString() { + if (!this.isValid()) { + return null; + } + var m = this.clone().utc(); + if (m.year() < 0 || m.year() > 9999) { + return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); + } + if (isFunction(Date.prototype.toISOString)) { + // native implementation is ~50x faster, use it when we can + return this.toDate().toISOString(); + } + return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); +} + +/** + * Return a human readable representation of a moment that can + * also be evaluated to get a new moment which is the same + * + * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects + */ +function inspect () { + if (!this.isValid()) { + return 'moment.invalid(/* ' + this._i + ' */)'; + } + var func = 'moment'; + var zone = ''; + if (!this.isLocal()) { + func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; + zone = 'Z'; + } + var prefix = '[' + func + '("]'; + var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; + var datetime = '-MM-DD[T]HH:mm:ss.SSS'; + var suffix = zone + '[")]'; + + return this.format(prefix + year + datetime + suffix); +} + +function format (inputString) { + if (!inputString) { + inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; + } + var output = formatMoment(this, inputString); + return this.localeData().postformat(output); +} + +function from (time, withoutSuffix) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + createLocal(time).isValid())) { + return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } +} - this.options.dataAxis.orientation = 'right'; - this.yAxisRight = new DataAxis(this.body, this.options.dataAxis, this.svg, this.options.groups); - delete this.options.dataAxis.orientation; +function fromNow (withoutSuffix) { + return this.from(createLocal(), withoutSuffix); +} - // legends - this.legendLeft = new Legend(this.body, this.options.legend, 'left', this.options.groups); - this.legendRight = new Legend(this.body, this.options.legend, 'right', this.options.groups); +function to (time, withoutSuffix) { + if (this.isValid() && + ((isMoment(time) && time.isValid()) || + createLocal(time).isValid())) { + return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); + } else { + return this.localeData().invalidDate(); + } +} - this.show(); - }; +function toNow (withoutSuffix) { + return this.to(createLocal(), withoutSuffix); +} - /** - * set the options of the LineGraph. the mergeOptions is used for subObjects that have an enabled element. - * @param {object} options - */ - LineGraph.prototype.setOptions = function (options) { - if (options) { - var fields = ['sampling', 'defaultGroup', 'stack', 'height', 'graphHeight', 'yAxisOrientation', 'style', 'barChart', 'dataAxis', 'sort', 'groups']; - if (options.graphHeight === undefined && options.height !== undefined) { - this.updateSVGheight = true; - this.updateSVGheightOnResize = true; - } else if (this.body.domProps.centerContainer.height !== undefined && options.graphHeight !== undefined) { - if (parseInt((options.graphHeight + '').replace("px", '')) < this.body.domProps.centerContainer.height) { - this.updateSVGheight = true; - } - } - util.selectiveDeepExtend(fields, this.options, options); - util.mergeOptions(this.options, options, 'interpolation'); - util.mergeOptions(this.options, options, 'drawPoints'); - util.mergeOptions(this.options, options, 'shaded'); - util.mergeOptions(this.options, options, 'legend'); - - if (options.interpolation) { - if ((0, _typeof3['default'])(options.interpolation) == 'object') { - if (options.interpolation.parametrization) { - if (options.interpolation.parametrization == 'uniform') { - this.options.interpolation.alpha = 0; - } else if (options.interpolation.parametrization == 'chordal') { - this.options.interpolation.alpha = 1.0; - } else { - this.options.interpolation.parametrization = 'centripetal'; - this.options.interpolation.alpha = 0.5; - } - } - } - } +// If passed a locale key, it will set the locale for this +// instance. Otherwise, it will return the locale configuration +// variables for this instance. +function locale (key) { + var newLocaleData; - if (this.yAxisLeft) { - if (options.dataAxis !== undefined) { - this.yAxisLeft.setOptions(this.options.dataAxis); - this.yAxisRight.setOptions(this.options.dataAxis); + if (key === undefined) { + return this._locale._abbr; + } else { + newLocaleData = getLocale(key); + if (newLocaleData != null) { + this._locale = newLocaleData; } - } + return this; + } +} - if (this.legendLeft) { - if (options.legend !== undefined) { - this.legendLeft.setOptions(this.options.legend); - this.legendRight.setOptions(this.options.legend); +var lang = deprecate( + 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', + function (key) { + if (key === undefined) { + return this.localeData(); + } else { + return this.locale(key); } - } - - if (this.groups.hasOwnProperty(UNGROUPED)) { - this.groups[UNGROUPED].setOptions(options); - } } +); - // this is used to redraw the graph if the visibility of the groups is changed. - if (this.dom.frame) { - //not on initial run? - this.forceGraphUpdate = true; - this.body.emitter.emit("_change", { queue: true }); - } - }; +function localeData () { + return this._locale; +} - /** - * Hide the component from the DOM - */ - LineGraph.prototype.hide = function () { - // remove the frame containing the items - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); +function startOf (units) { + units = normalizeUnits(units); + // the following switch intentionally omits break keywords + // to utilize falling through the cases. + switch (units) { + case 'year': + this.month(0); + /* falls through */ + case 'quarter': + case 'month': + this.date(1); + /* falls through */ + case 'week': + case 'isoWeek': + case 'day': + case 'date': + this.hours(0); + /* falls through */ + case 'hour': + this.minutes(0); + /* falls through */ + case 'minute': + this.seconds(0); + /* falls through */ + case 'second': + this.milliseconds(0); } - }; - /** - * Show the component in the DOM (when not already visible). - * @return {Boolean} changed - */ - LineGraph.prototype.show = function () { - // show frame containing the items - if (!this.dom.frame.parentNode) { - this.body.dom.center.appendChild(this.dom.frame); + // weeks are a special case + if (units === 'week') { + this.weekday(0); + } + if (units === 'isoWeek') { + this.isoWeekday(1); } - }; - /** - * Set items - * @param {vis.DataSet | null} items - */ - LineGraph.prototype.setItems = function (items) { - var me = this, - ids, - oldItemsData = this.itemsData; - - // replace the dataset - if (!items) { - this.itemsData = null; - } else if (items instanceof DataSet || items instanceof DataView) { - this.itemsData = items; - } else { - throw new TypeError('Data must be an instance of DataSet or DataView'); + // quarters are also special + if (units === 'quarter') { + this.month(Math.floor(this.month() / 3) * 3); } - if (oldItemsData) { - // unsubscribe from old dataset - util.forEach(this.itemListeners, function (callback, event) { - oldItemsData.off(event, callback); - }); + return this; +} - // remove all drawn items - ids = oldItemsData.getIds(); - this._onRemove(ids); +function endOf (units) { + units = normalizeUnits(units); + if (units === undefined || units === 'millisecond') { + return this; } - if (this.itemsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.itemListeners, function (callback, event) { - me.itemsData.on(event, callback, id); - }); - - // add all new items - ids = this.itemsData.getIds(); - this._onAdd(ids); + // 'date' is an alias for 'day', so it should be considered as such. + if (units === 'date') { + units = 'day'; } - }; - /** - * Set groups - * @param {vis.DataSet} groups - */ - LineGraph.prototype.setGroups = function (groups) { - var me = this; - var ids; + return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); +} - // unsubscribe from current dataset - if (this.groupsData) { - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.off(event, callback); - }); +function valueOf () { + return this._d.valueOf() - ((this._offset || 0) * 60000); +} - // remove all drawn groups - ids = this.groupsData.getIds(); - this.groupsData = null; - for (var i = 0; i < ids.length; i++) { - this._removeGroup(ids[i]); - } - } +function unix () { + return Math.floor(this.valueOf() / 1000); +} - // replace the dataset - if (!groups) { - this.groupsData = null; - } else if (groups instanceof DataSet || groups instanceof DataView) { - this.groupsData = groups; - } else { - throw new TypeError('Data must be an instance of DataSet or DataView'); - } +function toDate () { + return new Date(this.valueOf()); +} - if (this.groupsData) { - // subscribe to new dataset - var id = this.id; - util.forEach(this.groupListeners, function (callback, event) { - me.groupsData.on(event, callback, id); - }); +function toArray () { + var m = this; + return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; +} - // draw all ms - ids = this.groupsData.getIds(); - this._onAddGroups(ids); - } - }; +function toObject () { + var m = this; + return { + years: m.year(), + months: m.month(), + date: m.date(), + hours: m.hours(), + minutes: m.minutes(), + seconds: m.seconds(), + milliseconds: m.milliseconds() + }; +} - LineGraph.prototype._onUpdate = function (ids) { - this._updateAllGroupData(ids); - }; - LineGraph.prototype._onAdd = function (ids) { - this._onUpdate(ids); - }; - LineGraph.prototype._onRemove = function (ids) { - this._onUpdate(ids); - }; - LineGraph.prototype._onUpdateGroups = function (groupIds) { - this._updateAllGroupData(null, groupIds); - }; - LineGraph.prototype._onAddGroups = function (groupIds) { - this._onUpdateGroups(groupIds); - }; +function toJSON () { + // new Date(NaN).toJSON() === null + return this.isValid() ? this.toISOString() : null; +} - /** - * this cleans the group out off the legends and the dataaxis, updates the ungrouped and updates the graph - * @param {Array} groupIds - * @private - */ - LineGraph.prototype._onRemoveGroups = function (groupIds) { - for (var i = 0; i < groupIds.length; i++) { - this._removeGroup(groupIds[i]); - } - this.forceGraphUpdate = true; - this.body.emitter.emit("_change", { queue: true }); - }; +function isValid$2 () { + return isValid(this); +} - /** - * this cleans the group out off the legends and the dataaxis - * @param groupId - * @private - */ - LineGraph.prototype._removeGroup = function (groupId) { - if (this.groups.hasOwnProperty(groupId)) { - if (this.groups[groupId].options.yAxisOrientation == 'right') { - this.yAxisRight.removeGroup(groupId); - this.legendRight.removeGroup(groupId); - this.legendRight.redraw(); - } else { - this.yAxisLeft.removeGroup(groupId); - this.legendLeft.removeGroup(groupId); - this.legendLeft.redraw(); - } - delete this.groups[groupId]; - } - }; +function parsingFlags () { + return extend({}, getParsingFlags(this)); +} - /** - * update a group object with the group dataset entree - * - * @param group - * @param groupId - * @private - */ - LineGraph.prototype._updateGroup = function (group, groupId) { - if (!this.groups.hasOwnProperty(groupId)) { - this.groups[groupId] = new GraphGroup(group, groupId, this.options, this.groupsUsingDefaultStyles); - if (this.groups[groupId].options.yAxisOrientation == 'right') { - this.yAxisRight.addGroup(groupId, this.groups[groupId]); - this.legendRight.addGroup(groupId, this.groups[groupId]); - } else { - this.yAxisLeft.addGroup(groupId, this.groups[groupId]); - this.legendLeft.addGroup(groupId, this.groups[groupId]); - } - } else { - this.groups[groupId].update(group); - if (this.groups[groupId].options.yAxisOrientation == 'right') { - this.yAxisRight.updateGroup(groupId, this.groups[groupId]); - this.legendRight.updateGroup(groupId, this.groups[groupId]); - //If yAxisOrientation changed, clean out the group from the other axis. - this.yAxisLeft.removeGroup(groupId); - this.legendLeft.removeGroup(groupId); - } else { - this.yAxisLeft.updateGroup(groupId, this.groups[groupId]); - this.legendLeft.updateGroup(groupId, this.groups[groupId]); - //If yAxisOrientation changed, clean out the group from the other axis. - this.yAxisRight.removeGroup(groupId); - this.legendRight.removeGroup(groupId); - } - } - this.legendLeft.redraw(); - this.legendRight.redraw(); - }; +function invalidAt () { + return getParsingFlags(this).overflow; +} - /** - * this updates all groups, it is used when there is an update the the itemset. - * - * @param {Array} ids - * @param {Array} groupIds - * @private - */ - LineGraph.prototype._updateAllGroupData = function (ids, groupIds) { - if (this.itemsData != null) { - var groupsContent = {}; - var items = this.itemsData.get(); - var fieldId = this.itemsData._fieldId; - var idMap = {}; - if (ids) { - ids.map(function (id) { - idMap[id] = id; - }); - } +function creationData() { + return { + input: this._i, + format: this._f, + locale: this._locale, + isUTC: this._isUTC, + strict: this._strict + }; +} - //pre-Determine array sizes, for more efficient memory claim - var groupCounts = {}; - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var groupId = item.group; - if (groupId === null || groupId === undefined) { - groupId = UNGROUPED; - } - groupCounts.hasOwnProperty(groupId) ? groupCounts[groupId]++ : groupCounts[groupId] = 1; - } +// FORMATTING - //Pre-load arrays from existing groups if items are not changed (not in ids) - var existingItemsMap = {}; - if (!groupIds && ids) { - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - var group = this.groups[groupId]; - var existing_items = group.getItems(); +addFormatToken(0, ['gg', 2], 0, function () { + return this.weekYear() % 100; +}); - groupsContent[groupId] = existing_items.filter(function (item) { - existingItemsMap[item[fieldId]] = item[fieldId]; - return item[fieldId] !== idMap[item[fieldId]]; - }); - var newLength = groupCounts[groupId]; - groupCounts[groupId] -= groupsContent[groupId].length; - if (groupsContent[groupId].length < newLength) { - groupsContent[groupId][newLength - 1] = {}; - } - } - } - } +addFormatToken(0, ['GG', 2], 0, function () { + return this.isoWeekYear() % 100; +}); - //Now insert data into the arrays. - for (var i = 0; i < items.length; i++) { - var item = items[i]; - var groupId = item.group; - if (groupId === null || groupId === undefined) { - groupId = UNGROUPED; - } - if (!groupIds && ids && item[fieldId] !== idMap[item[fieldId]] && existingItemsMap.hasOwnProperty(item[fieldId])) { - continue; - } - if (!groupsContent.hasOwnProperty(groupId)) { - groupsContent[groupId] = new Array(groupCounts[groupId]); - } - //Copy data (because of unmodifiable DataView input. - var extended = util.bridgeObject(item); - extended.x = util.convert(item.x, 'Date'); - extended.end = util.convert(item.end, 'Date'); - extended.orginalY = item.y; //real Y - extended.y = Number(item.y); - extended[fieldId] = item[fieldId]; +function addWeekYearFormatToken (token, getter) { + addFormatToken(0, [token, token.length], 0, getter); +} - var index = groupsContent[groupId].length - groupCounts[groupId]--; - groupsContent[groupId][index] = extended; - } +addWeekYearFormatToken('gggg', 'weekYear'); +addWeekYearFormatToken('ggggg', 'weekYear'); +addWeekYearFormatToken('GGGG', 'isoWeekYear'); +addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - //Make sure all groups are present, to allow removal of old groups - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - if (!groupsContent.hasOwnProperty(groupId)) { - groupsContent[groupId] = new Array(0); - } - } - } +// ALIASES - //Update legendas, style and axis - for (var groupId in groupsContent) { - if (groupsContent.hasOwnProperty(groupId)) { - if (groupsContent[groupId].length == 0) { - if (this.groups.hasOwnProperty(groupId)) { - this._removeGroup(groupId); - } - } else { - var group = undefined; - if (this.groupsData != undefined) { - group = this.groupsData.get(groupId); - } - if (group == undefined) { - group = { id: groupId, content: this.options.defaultGroup + groupId }; - } - this._updateGroup(group, groupId); - this.groups[groupId].setItems(groupsContent[groupId]); - } - } - } - this.forceGraphUpdate = true; - this.body.emitter.emit("_change", { queue: true }); - } - }; +addUnitAlias('weekYear', 'gg'); +addUnitAlias('isoWeekYear', 'GG'); - /** - * Redraw the component, mandatory function - * @return {boolean} Returns true if the component is resized - */ - LineGraph.prototype.redraw = function () { - var resized = false; +// PRIORITY - // calculate actual size and position - this.props.width = this.dom.frame.offsetWidth; - this.props.height = this.body.domProps.centerContainer.height - this.body.domProps.border.top - this.body.domProps.border.bottom; +addUnitPriority('weekYear', 1); +addUnitPriority('isoWeekYear', 1); - // check if this component is resized - resized = this._isResized() || resized; - // check whether zoomed (in that case we need to re-stack everything) - var visibleInterval = this.body.range.end - this.body.range.start; - var zoomed = visibleInterval != this.lastVisibleInterval; - this.lastVisibleInterval = visibleInterval; +// PARSING - // the svg element is three times as big as the width, this allows for fully dragging left and right - // without reloading the graph. the controls for this are bound to events in the constructor - if (resized == true) { - this.svg.style.width = util.option.asSize(3 * this.props.width); - this.svg.style.left = util.option.asSize(-this.props.width); +addRegexToken('G', matchSigned); +addRegexToken('g', matchSigned); +addRegexToken('GG', match1to2, match2); +addRegexToken('gg', match1to2, match2); +addRegexToken('GGGG', match1to4, match4); +addRegexToken('gggg', match1to4, match4); +addRegexToken('GGGGG', match1to6, match6); +addRegexToken('ggggg', match1to6, match6); - // if the height of the graph is set as proportional, change the height of the svg - if ((this.options.height + '').indexOf("%") != -1 || this.updateSVGheightOnResize == true) { - this.updateSVGheight = true; - } - } +addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { + week[token.substr(0, 2)] = toInt(input); +}); - // update the height of the graph on each redraw of the graph. - if (this.updateSVGheight == true) { - if (this.options.graphHeight != this.props.height + 'px') { - this.options.graphHeight = this.props.height + 'px'; - this.svg.style.height = this.props.height + 'px'; - } - this.updateSVGheight = false; - } else { - this.svg.style.height = ('' + this.options.graphHeight).replace('px', '') + 'px'; - } +addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { + week[token] = hooks.parseTwoDigitYear(input); +}); - // zoomed is here to ensure that animations are shown correctly. - if (resized == true || zoomed == true || this.abortedGraphUpdate == true || this.forceGraphUpdate == true) { - resized = this._updateGraph() || resized; - this.forceGraphUpdate = false; +// MOMENTS + +function getSetWeekYear (input) { + return getSetWeekYearHelper.call(this, + input, + this.week(), + this.weekday(), + this.localeData()._week.dow, + this.localeData()._week.doy); +} + +function getSetISOWeekYear (input) { + return getSetWeekYearHelper.call(this, + input, this.isoWeek(), this.isoWeekday(), 1, 4); +} + +function getISOWeeksInYear () { + return weeksInYear(this.year(), 1, 4); +} + +function getWeeksInYear () { + var weekInfo = this.localeData()._week; + return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); +} + +function getSetWeekYearHelper(input, week, weekday, dow, doy) { + var weeksTarget; + if (input == null) { + return weekOfYear(this, dow, doy).year; } else { - // move the whole svg while dragging - if (this.lastStart != 0) { - var offset = this.body.range.start - this.lastStart; - var range = this.body.range.end - this.body.range.start; - if (this.props.width != 0) { - var rangePerPixelInv = this.props.width / range; - var xOffset = offset * rangePerPixelInv; - this.svg.style.left = -this.props.width - xOffset + 'px'; + weeksTarget = weeksInYear(input, dow, doy); + if (week > weeksTarget) { + week = weeksTarget; } - } + return setWeekAll.call(this, input, week, weekday, dow, doy); } - this.legendLeft.redraw(); - this.legendRight.redraw(); - return resized; - }; +} - LineGraph.prototype._getSortedGroupIds = function () { - // getting group Ids - var grouplist = []; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - var group = this.groups[groupId]; - if (group.visible == true && (this.options.groups.visibility[groupId] === undefined || this.options.groups.visibility[groupId] == true)) { - grouplist.push({ id: groupId, zIndex: group.options.zIndex }); - } - } - } - util.insertSort(grouplist, function (a, b) { - var az = a.zIndex; - var bz = b.zIndex; - if (az === undefined) az = 0; - if (bz === undefined) bz = 0; - return az == bz ? 0 : az < bz ? -1 : 1; - }); - var groupIds = new Array(grouplist.length); - for (var i = 0; i < grouplist.length; i++) { - groupIds[i] = grouplist[i].id; - } - return groupIds; - }; +function setWeekAll(weekYear, week, weekday, dow, doy) { + var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), + date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - /** - * Update and redraw the graph. - * - */ - LineGraph.prototype._updateGraph = function () { - // reset the svg elements - DOMutil.prepareElements(this.svgElements); - if (this.props.width != 0 && this.itemsData != null) { - var group, i; - var groupRanges = {}; - var changeCalled = false; - // this is the range of the SVG canvas - var minDate = this.body.util.toGlobalTime(-this.body.domProps.root.width); - var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); - - // getting group Ids - var groupIds = this._getSortedGroupIds(); - if (groupIds.length > 0) { - var groupsData = {}; - - // fill groups data, this only loads the data we require based on the timewindow - this._getRelevantData(groupIds, groupsData, minDate, maxDate); - - // apply sampling, if disabled, it will pass through this function. - this._applySampling(groupIds, groupsData); - - // we transform the X coordinates to detect collisions - for (i = 0; i < groupIds.length; i++) { - this._convertXcoordinates(groupsData[groupIds[i]]); - } - - // now all needed data has been collected we start the processing. - this._getYRanges(groupIds, groupsData, groupRanges); - - // update the Y axis first, we use this data to draw at the correct Y points - changeCalled = this._updateYAxis(groupIds, groupRanges); - - // at changeCalled, abort this update cycle as the graph needs another update with new Width input from the Redraw container. - // Cleanup SVG elements on abort. - if (changeCalled == true) { - DOMutil.cleanupElements(this.svgElements); - this.abortedGraphUpdate = true; - return true; - } - this.abortedGraphUpdate = false; - - // With the yAxis scaled correctly, use this to get the Y values of the points. - var below = undefined; - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - if (this.options.stack === true && this.options.style === 'line') { - if (group.options.excludeFromStacking == undefined || !group.options.excludeFromStacking) { - if (below != undefined) { - this._stack(groupsData[group.id], groupsData[below.id]); - if (group.options.shaded.enabled == true && group.options.shaded.orientation !== "group") { - if (group.options.shaded.orientation == "top" && below.options.shaded.orientation !== "group") { - below.options.shaded.orientation = "group"; - below.options.shaded.groupId = group.id; - } else { - group.options.shaded.orientation = "group"; - group.options.shaded.groupId = below.id; - } - } - } - below = group; - } - } - this._convertYcoordinates(groupsData[groupIds[i]], group); - } + this.year(date.getUTCFullYear()); + this.month(date.getUTCMonth()); + this.date(date.getUTCDate()); + return this; +} - //Precalculate paths and draw shading if appropriate. This will make sure the shading is always behind any lines. - var paths = {}; - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - if (group.options.style === 'line' && group.options.shaded.enabled == true) { - var dataset = groupsData[groupIds[i]]; - if (dataset == null || dataset.length == 0) { - continue; - } - if (!paths.hasOwnProperty(groupIds[i])) { - paths[groupIds[i]] = Lines.calcPath(dataset, group); - } - if (group.options.shaded.orientation === "group") { - var subGroupId = group.options.shaded.groupId; - if (groupIds.indexOf(subGroupId) === -1) { - console.log(group.id + ": Unknown shading group target given:" + subGroupId); - continue; - } - if (!paths.hasOwnProperty(subGroupId)) { - paths[subGroupId] = Lines.calcPath(groupsData[subGroupId], this.groups[subGroupId]); - } - Lines.drawShading(paths[groupIds[i]], group, paths[subGroupId], this.framework); - } else { - Lines.drawShading(paths[groupIds[i]], group, undefined, this.framework); - } - } - } +// FORMATTING - // draw the groups, calculating paths if still necessary. - Bars.draw(groupIds, groupsData, this.framework); - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - if (groupsData[groupIds[i]].length > 0) { - switch (group.options.style) { - case "line": - if (!paths.hasOwnProperty(groupIds[i])) { - paths[groupIds[i]] = Lines.calcPath(groupsData[groupIds[i]], group); - } - Lines.draw(paths[groupIds[i]], group, this.framework); - //explicit no break; - case "point": - //explicit no break; - case "points": - if (group.options.style == "point" || group.options.style == "points" || group.options.drawPoints.enabled == true) { - Points.draw(groupsData[groupIds[i]], group, this.framework); - } - break; - case "bar": - // bar needs to be drawn enmasse - //explicit no break - default: - //do nothing... - } - } - } - } - } - - // cleanup unused svg elements - DOMutil.cleanupElements(this.svgElements); - return false; - }; +addFormatToken('Q', 0, 'Qo', 'quarter'); - LineGraph.prototype._stack = function (data, subData) { - var index, dx, dy, subPrevPoint, subNextPoint; - index = 0; - // for each data point we look for a matching on in the set below - for (var j = 0; j < data.length; j++) { - subPrevPoint = undefined; - subNextPoint = undefined; - // we look for time matches or a before-after point - for (var k = index; k < subData.length; k++) { - // if times match exactly - if (subData[k].x === data[j].x) { - subPrevPoint = subData[k]; - subNextPoint = subData[k]; - index = k; - break; - } else if (subData[k].x > data[j].x) { - // overshoot - subNextPoint = subData[k]; - if (k == 0) { - subPrevPoint = subNextPoint; - } else { - subPrevPoint = subData[k - 1]; - } - index = k; - break; - } - } - // in case the last data point has been used, we assume it stays like this. - if (subNextPoint === undefined) { - subPrevPoint = subData[subData.length - 1]; - subNextPoint = subData[subData.length - 1]; - } - // linear interpolation - dx = subNextPoint.x - subPrevPoint.x; - dy = subNextPoint.y - subPrevPoint.y; - if (dx == 0) { - data[j].y = data[j].orginalY + subNextPoint.y; - } else { - data[j].y = data[j].orginalY + dy / dx * (data[j].x - subPrevPoint.x) + subPrevPoint.y; // ax + b where b is data[j].y - } - } - }; +// ALIASES - /** - * first select and preprocess the data from the datasets. - * the groups have their preselection of data, we now loop over this data to see - * what data we need to draw. Sorted data is much faster. - * more optimization is possible by doing the sampling before and using the binary search - * to find the end date to determine the increment. - * - * @param {array} groupIds - * @param {object} groupsData - * @param {date} minDate - * @param {date} maxDate - * @private - */ - LineGraph.prototype._getRelevantData = function (groupIds, groupsData, minDate, maxDate) { - var group, i, j, item; - if (groupIds.length > 0) { - for (i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - var itemsData = group.getItems(); - // optimization for sorted data - if (group.options.sort == true) { - var dateComparator = function dateComparator(a, b) { - return a.getTime() == b.getTime() ? 0 : a < b ? -1 : 1; - }; - var first = Math.max(0, util.binarySearchValue(itemsData, minDate, 'x', 'before', dateComparator)); - var last = Math.min(itemsData.length, util.binarySearchValue(itemsData, maxDate, 'x', 'after', dateComparator) + 1); - if (last <= 0) { - last = itemsData.length; - } - var dataContainer = new Array(last - first); - for (j = first; j < last; j++) { - item = group.itemsData[j]; - dataContainer[j - first] = item; - } - groupsData[groupIds[i]] = dataContainer; - } else { - // If unsorted data, all data is relevant, just returning entire structure - groupsData[groupIds[i]] = group.itemsData; - } - } - } - }; +addUnitAlias('quarter', 'Q'); - /** - * - * @param groupIds - * @param groupsData - * @private - */ - LineGraph.prototype._applySampling = function (groupIds, groupsData) { - var group; - if (groupIds.length > 0) { - for (var i = 0; i < groupIds.length; i++) { - group = this.groups[groupIds[i]]; - if (group.options.sampling == true) { - var dataContainer = groupsData[groupIds[i]]; - if (dataContainer.length > 0) { - var increment = 1; - var amountOfPoints = dataContainer.length; - - // the global screen is used because changing the width of the yAxis may affect the increment, resulting in an endless loop - // of width changing of the yAxis. - //TODO: This assumes sorted data, but that's not guaranteed! - var xDistance = this.body.util.toGlobalScreen(dataContainer[dataContainer.length - 1].x) - this.body.util.toGlobalScreen(dataContainer[0].x); - var pointsPerPixel = amountOfPoints / xDistance; - increment = Math.min(Math.ceil(0.2 * amountOfPoints), Math.max(1, Math.round(pointsPerPixel))); - - var sampledData = new Array(amountOfPoints); - for (var j = 0; j < amountOfPoints; j += increment) { - var idx = Math.round(j / increment); - sampledData[idx] = dataContainer[j]; - } - groupsData[groupIds[i]] = sampledData.splice(0, Math.round(amountOfPoints / increment)); - } - } - } - } - }; +// PRIORITY - /** - * - * - * @param {array} groupIds - * @param {object} groupsData - * @param {object} groupRanges | this is being filled here - * @private - */ - LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) { - var groupData, group, i; - var combinedDataLeft = []; - var combinedDataRight = []; - var options; - if (groupIds.length > 0) { - for (i = 0; i < groupIds.length; i++) { - groupData = groupsData[groupIds[i]]; - options = this.groups[groupIds[i]].options; - if (groupData.length > 0) { - group = this.groups[groupIds[i]]; - // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. - if (options.stack === true && options.style === 'bar') { - if (options.yAxisOrientation === 'left') { - combinedDataLeft = combinedDataLeft.concat(groupData); - } else { - combinedDataRight = combinedDataRight.concat(groupData); - } - } else { - groupRanges[groupIds[i]] = group.getYRange(groupData, groupIds[i]); - } - } - } +addUnitPriority('quarter', 7); - // if bar graphs are stacked, their range need to be handled differently and accumulated over all groups. - Bars.getStackedYRange(combinedDataLeft, groupRanges, groupIds, '__barStackLeft', 'left'); - Bars.getStackedYRange(combinedDataRight, groupRanges, groupIds, '__barStackRight', 'right'); - } - }; +// PARSING - /** - * this sets the Y ranges for the Y axis. It also determines which of the axis should be shown or hidden. - * @param {Array} groupIds - * @param {Object} groupRanges - * @private - */ - LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { - var resized = false; - var yAxisLeftUsed = false; - var yAxisRightUsed = false; - var minLeft = 1e9, - minRight = 1e9, - maxLeft = -1e9, - maxRight = -1e9, - minVal, - maxVal; - // if groups are present - if (groupIds.length > 0) { - // this is here to make sure that if there are no items in the axis but there are groups, that there is no infinite draw/redraw loop. - for (var i = 0; i < groupIds.length; i++) { - var group = this.groups[groupIds[i]]; - if (group && group.options.yAxisOrientation != 'right') { - yAxisLeftUsed = true; - minLeft = 1e9; - maxLeft = -1e9; - } else if (group && group.options.yAxisOrientation) { - yAxisRightUsed = true; - minRight = 1e9; - maxRight = -1e9; - } - } - - // if there are items: - for (var i = 0; i < groupIds.length; i++) { - if (groupRanges.hasOwnProperty(groupIds[i])) { - if (groupRanges[groupIds[i]].ignore !== true) { - minVal = groupRanges[groupIds[i]].min; - maxVal = groupRanges[groupIds[i]].max; - - if (groupRanges[groupIds[i]].yAxisOrientation != 'right') { - yAxisLeftUsed = true; - minLeft = minLeft > minVal ? minVal : minLeft; - maxLeft = maxLeft < maxVal ? maxVal : maxLeft; - } else { - yAxisRightUsed = true; - minRight = minRight > minVal ? minVal : minRight; - maxRight = maxRight < maxVal ? maxVal : maxRight; - } - } - } - } +addRegexToken('Q', match1); +addParseToken('Q', function (input, array) { + array[MONTH] = (toInt(input) - 1) * 3; +}); - if (yAxisLeftUsed == true) { - this.yAxisLeft.setRange(minLeft, maxLeft); - } - if (yAxisRightUsed == true) { - this.yAxisRight.setRange(minRight, maxRight); - } - } - resized = this._toggleAxisVisiblity(yAxisLeftUsed, this.yAxisLeft) || resized; - resized = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || resized; +// MOMENTS - if (yAxisRightUsed == true && yAxisLeftUsed == true) { - this.yAxisLeft.drawIcons = true; - this.yAxisRight.drawIcons = true; - } else { - this.yAxisLeft.drawIcons = false; - this.yAxisRight.drawIcons = false; - } - this.yAxisRight.master = !yAxisLeftUsed; - this.yAxisRight.masterAxis = this.yAxisLeft; +function getSetQuarter (input) { + return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); +} - if (this.yAxisRight.master == false) { - if (yAxisRightUsed == true) { - this.yAxisLeft.lineOffset = this.yAxisRight.width; - } else { - this.yAxisLeft.lineOffset = 0; - } +// FORMATTING - resized = this.yAxisLeft.redraw() || resized; - resized = this.yAxisRight.redraw() || resized; - } else { - resized = this.yAxisRight.redraw() || resized; - } +addFormatToken('D', ['DD', 2], 'Do', 'date'); - // clean the accumulated lists - var tempGroups = ['__barStackLeft', '__barStackRight', '__lineStackLeft', '__lineStackRight']; - for (var i = 0; i < tempGroups.length; i++) { - if (groupIds.indexOf(tempGroups[i]) != -1) { - groupIds.splice(groupIds.indexOf(tempGroups[i]), 1); - } - } +// ALIASES - return resized; - }; +addUnitAlias('date', 'D'); - /** - * This shows or hides the Y axis if needed. If there is a change, the changed event is emitted by the updateYAxis function - * - * @param {boolean} axisUsed - * @returns {boolean} - * @private - * @param axis - */ - LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { - var changed = false; - if (axisUsed == false) { - if (axis.dom.frame.parentNode && axis.hidden == false) { - axis.hide(); - changed = true; - } - } else { - if (!axis.dom.frame.parentNode && axis.hidden == true) { - axis.show(); - changed = true; - } - } - return changed; - }; +// PRIOROITY +addUnitPriority('date', 9); - /** - * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the - * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for - * the yAxis. - * - * @param datapoints - * @returns {Array} - * @private - */ - LineGraph.prototype._convertXcoordinates = function (datapoints) { - var toScreen = this.body.util.toScreen; - for (var i = 0; i < datapoints.length; i++) { - datapoints[i].screen_x = toScreen(datapoints[i].x) + this.props.width; - datapoints[i].screen_y = datapoints[i].y; //starting point for range calculations - if (datapoints[i].end != undefined) { - datapoints[i].screen_end = toScreen(datapoints[i].end) + this.props.width; - } else { - datapoints[i].screen_end = undefined; - } - } - }; +// PARSING - /** - * This uses the DataAxis object to generate the correct X coordinate on the SVG window. It uses the - * util function toScreen to get the x coordinate from the timestamp. It also pre-filters the data and get the minMax ranges for - * the yAxis. - * - * @param datapoints - * @param group - * @returns {Array} - * @private - */ - LineGraph.prototype._convertYcoordinates = function (datapoints, group) { - var axis = this.yAxisLeft; - var svgHeight = Number(this.svg.style.height.replace('px', '')); - if (group.options.yAxisOrientation == 'right') { - axis = this.yAxisRight; - } - for (var i = 0; i < datapoints.length; i++) { - datapoints[i].screen_y = Math.round(axis.convertValue(datapoints[i].y)); - } - group.setZeroPosition(Math.min(svgHeight, axis.convertValue(0))); - }; +addRegexToken('D', match1to2); +addRegexToken('DD', match1to2, match2); +addRegexToken('Do', function (isStrict, locale) { + // TODO: Remove "ordinalParse" fallback in next major release. + return isStrict ? + (locale._dayOfMonthOrdinalParse || locale._ordinalParse) : + locale._dayOfMonthOrdinalParseLenient; +}); - module.exports = LineGraph; +addParseToken(['D', 'DD'], DATE); +addParseToken('Do', function (input, array) { + array[DATE] = toInt(input.match(match1to2)[0], 10); +}); -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { +// MOMENTS - 'use strict'; +var getSetDayOfMonth = makeGetSet('Date', true); - var _keys = __webpack_require__(58); +// FORMATTING - var _keys2 = _interopRequireDefault(_keys); +addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +// ALIASES - var util = __webpack_require__(1); - var DOMutil = __webpack_require__(88); - var Component = __webpack_require__(121); - var DataScale = __webpack_require__(152); - /** - * A horizontal time axis - * @param {Object} [options] See DataAxis.setOptions for the available - * options. - * @constructor DataAxis - * @extends Component - * @param body - */ - function DataAxis(body, options, svg, linegraphOptions) { - this.id = util.randomUUID(); - this.body = body; +addUnitAlias('dayOfYear', 'DDD'); - this.defaultOptions = { - orientation: 'left', // supported: 'left', 'right' - showMinorLabels: true, - showMajorLabels: true, - icons: false, - majorLinesOffset: 7, - minorLinesOffset: 4, - labelOffsetX: 10, - labelOffsetY: 2, - iconWidth: 20, - width: '40px', - visible: true, - alignZeros: true, - left: { - range: { min: undefined, max: undefined }, - format: function format(value) { - return '' + parseFloat(value.toPrecision(3)); - }, - title: { text: undefined, style: undefined } - }, - right: { - range: { min: undefined, max: undefined }, - format: function format(value) { - return '' + parseFloat(value.toPrecision(3)); - }, - title: { text: undefined, style: undefined } - } - }; +// PRIORITY +addUnitPriority('dayOfYear', 4); - this.linegraphOptions = linegraphOptions; - this.linegraphSVG = svg; - this.props = {}; - this.DOMelements = { // dynamic elements - lines: {}, - labels: {}, - title: {} - }; +// PARSING - this.dom = {}; - this.scale = undefined; - this.range = { start: 0, end: 0 }; +addRegexToken('DDD', match1to3); +addRegexToken('DDDD', match3); +addParseToken(['DDD', 'DDDD'], function (input, array, config) { + config._dayOfYear = toInt(input); +}); - this.options = util.extend({}, this.defaultOptions); - this.conversionFactor = 1; +// HELPERS - this.setOptions(options); - this.width = Number(('' + this.options.width).replace("px", "")); - this.minWidth = this.width; - this.height = this.linegraphSVG.getBoundingClientRect().height; - this.hidden = false; +// MOMENTS - this.stepPixels = 25; - this.zeroCrossing = -1; - this.amountOfSteps = -1; +function getSetDayOfYear (input) { + var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; + return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); +} - this.lineOffset = 0; - this.master = true; - this.masterAxis = null; - this.svgElements = {}; - this.iconsRemoved = false; +// FORMATTING - this.groups = {}; - this.amountOfGroups = 0; +addFormatToken('m', ['mm', 2], 0, 'minute'); - // create the HTML DOM - this._create(); - this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups }; +// ALIASES - var me = this; - this.body.emitter.on("verticalDrag", function () { - me.dom.lineContainer.style.top = me.body.domProps.scrollTop + 'px'; - }); - } +addUnitAlias('minute', 'm'); - DataAxis.prototype = new Component(); +// PRIORITY - DataAxis.prototype.addGroup = function (label, graphOptions) { - if (!this.groups.hasOwnProperty(label)) { - this.groups[label] = graphOptions; - } - this.amountOfGroups += 1; - }; +addUnitPriority('minute', 14); - DataAxis.prototype.updateGroup = function (label, graphOptions) { - if (!this.groups.hasOwnProperty(label)) { - this.amountOfGroups += 1; - } - this.groups[label] = graphOptions; - }; +// PARSING - DataAxis.prototype.removeGroup = function (label) { - if (this.groups.hasOwnProperty(label)) { - delete this.groups[label]; - this.amountOfGroups -= 1; - } - }; +addRegexToken('m', match1to2); +addRegexToken('mm', match1to2, match2); +addParseToken(['m', 'mm'], MINUTE); - DataAxis.prototype.setOptions = function (options) { - if (options) { - var redraw = false; - if (this.options.orientation != options.orientation && options.orientation !== undefined) { - redraw = true; - } - var fields = ['orientation', 'showMinorLabels', 'showMajorLabels', 'icons', 'majorLinesOffset', 'minorLinesOffset', 'labelOffsetX', 'labelOffsetY', 'iconWidth', 'width', 'visible', 'left', 'right', 'alignZeros']; - util.selectiveDeepExtend(fields, this.options, options); +// MOMENTS - this.minWidth = Number(('' + this.options.width).replace("px", "")); - if (redraw === true && this.dom.frame) { - this.hide(); - this.show(); - } - } - }; +var getSetMinute = makeGetSet('Minutes', false); - /** - * Create the HTML DOM for the DataAxis - */ - DataAxis.prototype._create = function () { - this.dom.frame = document.createElement('div'); - this.dom.frame.style.width = this.options.width; - this.dom.frame.style.height = this.height; - - this.dom.lineContainer = document.createElement('div'); - this.dom.lineContainer.style.width = '100%'; - this.dom.lineContainer.style.height = this.height; - this.dom.lineContainer.style.position = 'relative'; - - // create svg element for graph drawing. - this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); - this.svg.style.position = "absolute"; - this.svg.style.top = '0px'; - this.svg.style.height = '100%'; - this.svg.style.width = '100%'; - this.svg.style.display = "block"; - this.dom.frame.appendChild(this.svg); - }; +// FORMATTING - DataAxis.prototype._redrawGroupIcons = function () { - DOMutil.prepareElements(this.svgElements); +addFormatToken('s', ['ss', 2], 0, 'second'); - var x; - var iconWidth = this.options.iconWidth; - var iconHeight = 15; - var iconOffset = 4; - var y = iconOffset + 0.5 * iconHeight; +// ALIASES - if (this.options.orientation === 'left') { - x = iconOffset; - } else { - x = this.width - iconWidth - iconOffset; - } +addUnitAlias('second', 's'); - var groupArray = (0, _keys2['default'])(this.groups); - groupArray.sort(function (a, b) { - return a < b ? -1 : 1; - }); +// PRIORITY - for (var i = 0; i < groupArray.length; i++) { - var groupId = groupArray[i]; - if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) { - this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y); - y += iconHeight + iconOffset; - } - } +addUnitPriority('second', 15); - DOMutil.cleanupElements(this.svgElements); - this.iconsRemoved = false; - }; +// PARSING - DataAxis.prototype._cleanupIcons = function () { - if (this.iconsRemoved === false) { - DOMutil.prepareElements(this.svgElements); - DOMutil.cleanupElements(this.svgElements); - this.iconsRemoved = true; - } - }; +addRegexToken('s', match1to2); +addRegexToken('ss', match1to2, match2); +addParseToken(['s', 'ss'], SECOND); - /** - * Create the HTML DOM for the DataAxis - */ - DataAxis.prototype.show = function () { - this.hidden = false; - if (!this.dom.frame.parentNode) { - if (this.options.orientation === 'left') { - this.body.dom.left.appendChild(this.dom.frame); - } else { - this.body.dom.right.appendChild(this.dom.frame); - } - } +// MOMENTS - if (!this.dom.lineContainer.parentNode) { - this.body.dom.backgroundHorizontal.appendChild(this.dom.lineContainer); - } - }; +var getSetSecond = makeGetSet('Seconds', false); - /** - * Create the HTML DOM for the DataAxis - */ - DataAxis.prototype.hide = function () { - this.hidden = true; - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); - } +// FORMATTING - if (this.dom.lineContainer.parentNode) { - this.dom.lineContainer.parentNode.removeChild(this.dom.lineContainer); - } - }; +addFormatToken('S', 0, 0, function () { + return ~~(this.millisecond() / 100); +}); - /** - * Set a range (start and end) - * @param end - * @param start - * @param end - */ - DataAxis.prototype.setRange = function (start, end) { - this.range.start = start; - this.range.end = end; - }; +addFormatToken(0, ['SS', 2], 0, function () { + return ~~(this.millisecond() / 10); +}); - /** - * Repaint the component - * @return {boolean} Returns true if the component is resized - */ - DataAxis.prototype.redraw = function () { - var resized = false; - var activeGroups = 0; +addFormatToken(0, ['SSS', 3], 0, 'millisecond'); +addFormatToken(0, ['SSSS', 4], 0, function () { + return this.millisecond() * 10; +}); +addFormatToken(0, ['SSSSS', 5], 0, function () { + return this.millisecond() * 100; +}); +addFormatToken(0, ['SSSSSS', 6], 0, function () { + return this.millisecond() * 1000; +}); +addFormatToken(0, ['SSSSSSS', 7], 0, function () { + return this.millisecond() * 10000; +}); +addFormatToken(0, ['SSSSSSSS', 8], 0, function () { + return this.millisecond() * 100000; +}); +addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { + return this.millisecond() * 1000000; +}); - // Make sure the line container adheres to the vertical scrolling. - this.dom.lineContainer.style.top = this.body.domProps.scrollTop + 'px'; - for (var groupId in this.groups) { - if (this.groups.hasOwnProperty(groupId)) { - if (this.groups[groupId].visible === true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] === true)) { - activeGroups++; - } - } +// ALIASES + +addUnitAlias('millisecond', 'ms'); + +// PRIORITY + +addUnitPriority('millisecond', 16); + +// PARSING + +addRegexToken('S', match1to3, match1); +addRegexToken('SS', match1to3, match2); +addRegexToken('SSS', match1to3, match3); + +var token; +for (token = 'SSSS'; token.length <= 9; token += 'S') { + addRegexToken(token, matchUnsigned); +} + +function parseMs(input, array) { + array[MILLISECOND] = toInt(('0.' + input) * 1000); +} + +for (token = 'S'; token.length <= 9; token += 'S') { + addParseToken(token, parseMs); +} +// MOMENTS + +var getSetMillisecond = makeGetSet('Milliseconds', false); + +// FORMATTING + +addFormatToken('z', 0, 0, 'zoneAbbr'); +addFormatToken('zz', 0, 0, 'zoneName'); + +// MOMENTS + +function getZoneAbbr () { + return this._isUTC ? 'UTC' : ''; +} + +function getZoneName () { + return this._isUTC ? 'Coordinated Universal Time' : ''; +} + +var proto = Moment.prototype; + +proto.add = add; +proto.calendar = calendar$1; +proto.clone = clone; +proto.diff = diff; +proto.endOf = endOf; +proto.format = format; +proto.from = from; +proto.fromNow = fromNow; +proto.to = to; +proto.toNow = toNow; +proto.get = stringGet; +proto.invalidAt = invalidAt; +proto.isAfter = isAfter; +proto.isBefore = isBefore; +proto.isBetween = isBetween; +proto.isSame = isSame; +proto.isSameOrAfter = isSameOrAfter; +proto.isSameOrBefore = isSameOrBefore; +proto.isValid = isValid$2; +proto.lang = lang; +proto.locale = locale; +proto.localeData = localeData; +proto.max = prototypeMax; +proto.min = prototypeMin; +proto.parsingFlags = parsingFlags; +proto.set = stringSet; +proto.startOf = startOf; +proto.subtract = subtract; +proto.toArray = toArray; +proto.toObject = toObject; +proto.toDate = toDate; +proto.toISOString = toISOString; +proto.inspect = inspect; +proto.toJSON = toJSON; +proto.toString = toString; +proto.unix = unix; +proto.valueOf = valueOf; +proto.creationData = creationData; + +// Year +proto.year = getSetYear; +proto.isLeapYear = getIsLeapYear; + +// Week Year +proto.weekYear = getSetWeekYear; +proto.isoWeekYear = getSetISOWeekYear; + +// Quarter +proto.quarter = proto.quarters = getSetQuarter; + +// Month +proto.month = getSetMonth; +proto.daysInMonth = getDaysInMonth; + +// Week +proto.week = proto.weeks = getSetWeek; +proto.isoWeek = proto.isoWeeks = getSetISOWeek; +proto.weeksInYear = getWeeksInYear; +proto.isoWeeksInYear = getISOWeeksInYear; + +// Day +proto.date = getSetDayOfMonth; +proto.day = proto.days = getSetDayOfWeek; +proto.weekday = getSetLocaleDayOfWeek; +proto.isoWeekday = getSetISODayOfWeek; +proto.dayOfYear = getSetDayOfYear; + +// Hour +proto.hour = proto.hours = getSetHour; + +// Minute +proto.minute = proto.minutes = getSetMinute; + +// Second +proto.second = proto.seconds = getSetSecond; + +// Millisecond +proto.millisecond = proto.milliseconds = getSetMillisecond; + +// Offset +proto.utcOffset = getSetOffset; +proto.utc = setOffsetToUTC; +proto.local = setOffsetToLocal; +proto.parseZone = setOffsetToParsedOffset; +proto.hasAlignedHourOffset = hasAlignedHourOffset; +proto.isDST = isDaylightSavingTime; +proto.isLocal = isLocal; +proto.isUtcOffset = isUtcOffset; +proto.isUtc = isUtc; +proto.isUTC = isUtc; + +// Timezone +proto.zoneAbbr = getZoneAbbr; +proto.zoneName = getZoneName; + +// Deprecations +proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); +proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); +proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); +proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); +proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); + +function createUnix (input) { + return createLocal(input * 1000); +} + +function createInZone () { + return createLocal.apply(null, arguments).parseZone(); +} + +function preParsePostFormat (string) { + return string; +} + +var proto$1 = Locale.prototype; + +proto$1.calendar = calendar; +proto$1.longDateFormat = longDateFormat; +proto$1.invalidDate = invalidDate; +proto$1.ordinal = ordinal; +proto$1.preparse = preParsePostFormat; +proto$1.postformat = preParsePostFormat; +proto$1.relativeTime = relativeTime; +proto$1.pastFuture = pastFuture; +proto$1.set = set; + +// Month +proto$1.months = localeMonths; +proto$1.monthsShort = localeMonthsShort; +proto$1.monthsParse = localeMonthsParse; +proto$1.monthsRegex = monthsRegex; +proto$1.monthsShortRegex = monthsShortRegex; + +// Week +proto$1.week = localeWeek; +proto$1.firstDayOfYear = localeFirstDayOfYear; +proto$1.firstDayOfWeek = localeFirstDayOfWeek; + +// Day of Week +proto$1.weekdays = localeWeekdays; +proto$1.weekdaysMin = localeWeekdaysMin; +proto$1.weekdaysShort = localeWeekdaysShort; +proto$1.weekdaysParse = localeWeekdaysParse; + +proto$1.weekdaysRegex = weekdaysRegex; +proto$1.weekdaysShortRegex = weekdaysShortRegex; +proto$1.weekdaysMinRegex = weekdaysMinRegex; + +// Hours +proto$1.isPM = localeIsPM; +proto$1.meridiem = localeMeridiem; + +function get$1 (format, index, field, setter) { + var locale = getLocale(); + var utc = createUTC().set(setter, index); + return locale[field](utc, format); +} + +function listMonthsImpl (format, index, field) { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + + if (index != null) { + return get$1(format, index, field, 'month'); } - if (this.amountOfGroups === 0 || activeGroups === 0) { - this.hide(); - } else { - this.show(); - this.height = Number(this.linegraphSVG.style.height.replace("px", "")); - - // svg offsetheight did not work in firefox and explorer... - this.dom.lineContainer.style.height = this.height + 'px'; - this.width = this.options.visible === true ? Number(('' + this.options.width).replace("px", "")) : 0; - - var props = this.props; - var frame = this.dom.frame; - - // update classname - frame.className = 'vis-data-axis'; - - // calculate character width and height - this._calculateCharSize(); - - var orientation = this.options.orientation; - var showMinorLabels = this.options.showMinorLabels; - var showMajorLabels = this.options.showMajorLabels; - - // determine the width and height of the elements for the axis - props.minorLabelHeight = showMinorLabels ? props.minorCharHeight : 0; - props.majorLabelHeight = showMajorLabels ? props.majorCharHeight : 0; - - props.minorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.minorLinesOffset; - props.minorLineHeight = 1; - props.majorLineWidth = this.body.dom.backgroundHorizontal.offsetWidth - this.lineOffset - this.width + 2 * this.options.majorLinesOffset; - props.majorLineHeight = 1; - - // take frame offline while updating (is almost twice as fast) - if (orientation === 'left') { - frame.style.top = '0'; - frame.style.left = '0'; - frame.style.bottom = ''; - frame.style.width = this.width + 'px'; - frame.style.height = this.height + "px"; - this.props.width = this.body.domProps.left.width; - this.props.height = this.body.domProps.left.height; - } else { - // right - frame.style.top = ''; - frame.style.bottom = '0'; - frame.style.left = '0'; - frame.style.width = this.width + 'px'; - frame.style.height = this.height + "px"; - this.props.width = this.body.domProps.right.width; - this.props.height = this.body.domProps.right.height; - } - resized = this._redrawLabels(); - resized = this._isResized() || resized; + var i; + var out = []; + for (i = 0; i < 12; i++) { + out[i] = get$1(format, i, field, 'month'); + } + return out; +} + +// () +// (5) +// (fmt, 5) +// (fmt) +// (true) +// (true, 5) +// (true, fmt, 5) +// (true, fmt) +function listWeekdaysImpl (localeSorted, format, index, field) { + if (typeof localeSorted === 'boolean') { + if (isNumber(format)) { + index = format; + format = undefined; + } + + format = format || ''; + } else { + format = localeSorted; + index = format; + localeSorted = false; - if (this.options.icons === true) { - this._redrawGroupIcons(); - } else { - this._cleanupIcons(); - } + if (isNumber(format)) { + index = format; + format = undefined; + } - this._redrawTitle(orientation); + format = format || ''; } - return resized; - }; - /** - * Repaint major and minor text labels and vertical grid lines - * @private - */ - DataAxis.prototype._redrawLabels = function () { - var _this = this; + var locale = getLocale(), + shift = localeSorted ? locale._week.dow : 0; - var resized = false; - DOMutil.prepareElements(this.DOMelements.lines); - DOMutil.prepareElements(this.DOMelements.labels); - var orientation = this.options['orientation']; - var customRange = this.options[orientation].range != undefined ? this.options[orientation].range : {}; - - //Override range with manual options: - var autoScaleEnd = true; - if (customRange.max != undefined) { - this.range.end = customRange.max; - autoScaleEnd = false; + if (index != null) { + return get$1(format, (index + shift) % 7, field, 'day'); } - var autoScaleStart = true; - if (customRange.min != undefined) { - this.range.start = customRange.min; - autoScaleStart = false; + + var i; + var out = []; + for (i = 0; i < 7; i++) { + out[i] = get$1(format, (i + shift) % 7, field, 'day'); + } + return out; +} + +function listMonths (format, index) { + return listMonthsImpl(format, index, 'months'); +} + +function listMonthsShort (format, index) { + return listMonthsImpl(format, index, 'monthsShort'); +} + +function listWeekdays (localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); +} + +function listWeekdaysShort (localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); +} + +function listWeekdaysMin (localeSorted, format, index) { + return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); +} + +getSetGlobalLocale('en', { + dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, + ordinal : function (number) { + var b = number % 10, + output = (toInt(number % 100 / 10) === 1) ? 'th' : + (b === 1) ? 'st' : + (b === 2) ? 'nd' : + (b === 3) ? 'rd' : 'th'; + return number + output; } +}); - this.scale = new DataScale(this.range.start, this.range.end, autoScaleStart, autoScaleEnd, this.dom.frame.offsetHeight, this.props.majorCharHeight, this.options.alignZeros, this.options[orientation].format); +// Side effect imports +hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); +hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); - if (this.master === false && this.masterAxis != undefined) { - this.scale.followScale(this.masterAxis.scale); - } +var mathAbs = Math.abs; - //Is updated in side-effect of _redrawLabel(): - this.maxLabelSize = 0; +function abs () { + var data = this._data; - var lines = this.scale.getLines(); - lines.forEach(function (line) { - var y = line.y; - var isMajor = line.major; - if (_this.options['showMinorLabels'] && isMajor === false) { - _this._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-minor', _this.props.minorCharHeight); - } - if (isMajor) { - if (y >= 0) { - _this._redrawLabel(y - 2, line.val, orientation, 'vis-y-axis vis-major', _this.props.majorCharHeight); - } - } - if (_this.master === true) { - if (isMajor) { - _this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-major', _this.options.majorLinesOffset, _this.props.majorLineWidth); - } else { - _this._redrawLine(y, orientation, 'vis-grid vis-horizontal vis-minor', _this.options.minorLinesOffset, _this.props.minorLineWidth); - } - } - }); + this._milliseconds = mathAbs(this._milliseconds); + this._days = mathAbs(this._days); + this._months = mathAbs(this._months); - // Note that title is rotated, so we're using the height, not width! - var titleWidth = 0; - if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) { - titleWidth = this.props.titleCharHeight; - } - var offset = this.options.icons === true ? Math.max(this.options.iconWidth, titleWidth) + this.options.labelOffsetX + 15 : titleWidth + this.options.labelOffsetX + 15; + data.milliseconds = mathAbs(data.milliseconds); + data.seconds = mathAbs(data.seconds); + data.minutes = mathAbs(data.minutes); + data.hours = mathAbs(data.hours); + data.months = mathAbs(data.months); + data.years = mathAbs(data.years); - // this will resize the yAxis to accommodate the labels. - if (this.maxLabelSize > this.width - offset && this.options.visible === true) { - this.width = this.maxLabelSize + offset; - this.options.width = this.width + "px"; - DOMutil.cleanupElements(this.DOMelements.lines); - DOMutil.cleanupElements(this.DOMelements.labels); - this.redraw(); - resized = true; - } - // this will resize the yAxis if it is too big for the labels. - else if (this.maxLabelSize < this.width - offset && this.options.visible === true && this.width > this.minWidth) { - this.width = Math.max(this.minWidth, this.maxLabelSize + offset); - this.options.width = this.width + "px"; - DOMutil.cleanupElements(this.DOMelements.lines); - DOMutil.cleanupElements(this.DOMelements.labels); - this.redraw(); - resized = true; - } else { - DOMutil.cleanupElements(this.DOMelements.lines); - DOMutil.cleanupElements(this.DOMelements.labels); - resized = false; - } + return this; +} - return resized; - }; +function addSubtract$1 (duration, input, value, direction) { + var other = createDuration(input, value); - DataAxis.prototype.convertValue = function (value) { - return this.scale.convertValue(value); - }; + duration._milliseconds += direction * other._milliseconds; + duration._days += direction * other._days; + duration._months += direction * other._months; - DataAxis.prototype.screenToValue = function (x) { - return this.scale.screenToValue(x); - }; + return duration._bubble(); +} - /** - * Create a label for the axis at position x - * @private - * @param y - * @param text - * @param orientation - * @param className - * @param characterHeight - */ - DataAxis.prototype._redrawLabel = function (y, text, orientation, className, characterHeight) { - // reuse redundant label - var label = DOMutil.getDOMElement('div', this.DOMelements.labels, this.dom.frame); //this.dom.redundant.labels.shift(); - label.className = className; - label.innerHTML = text; - if (orientation === 'left') { - label.style.left = '-' + this.options.labelOffsetX + 'px'; - label.style.textAlign = "right"; - } else { - label.style.right = '-' + this.options.labelOffsetX + 'px'; - label.style.textAlign = "left"; - } +// supports only 2.0-style add(1, 's') or add(duration) +function add$1 (input, value) { + return addSubtract$1(this, input, value, 1); +} - label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px'; +// supports only 2.0-style subtract(1, 's') or subtract(duration) +function subtract$1 (input, value) { + return addSubtract$1(this, input, value, -1); +} - text += ''; - - var largestWidth = Math.max(this.props.majorCharWidth, this.props.minorCharWidth); - if (this.maxLabelSize < text.length * largestWidth) { - this.maxLabelSize = text.length * largestWidth; +function absCeil (number) { + if (number < 0) { + return Math.floor(number); + } else { + return Math.ceil(number); } - }; +} - /** - * Create a minor line for the axis at position y - * @param y - * @param orientation - * @param className - * @param offset - * @param width - */ - DataAxis.prototype._redrawLine = function (y, orientation, className, offset, width) { - if (this.master === true) { - var line = DOMutil.getDOMElement('div', this.DOMelements.lines, this.dom.lineContainer); //this.dom.redundant.lines.shift(); - line.className = className; - line.innerHTML = ''; - - if (orientation === 'left') { - line.style.left = this.width - offset + 'px'; - } else { - line.style.right = this.width - offset + 'px'; - } +function bubble () { + var milliseconds = this._milliseconds; + var days = this._days; + var months = this._months; + var data = this._data; + var seconds, minutes, hours, years, monthsFromDays; - line.style.width = width + 'px'; - line.style.top = y + 'px'; + // if we have a mix of positive and negative values, bubble down first + // check: https://github.com/moment/moment/issues/2166 + if (!((milliseconds >= 0 && days >= 0 && months >= 0) || + (milliseconds <= 0 && days <= 0 && months <= 0))) { + milliseconds += absCeil(monthsToDays(months) + days) * 864e5; + days = 0; + months = 0; } - }; - /** - * Create a title for the axis - * @private - * @param orientation - */ - DataAxis.prototype._redrawTitle = function (orientation) { - DOMutil.prepareElements(this.DOMelements.title); + // The following code bubbles up values, see the tests for + // examples of what that means. + data.milliseconds = milliseconds % 1000; - // Check if the title is defined for this axes - if (this.options[orientation].title !== undefined && this.options[orientation].title.text !== undefined) { - var title = DOMutil.getDOMElement('div', this.DOMelements.title, this.dom.frame); - title.className = 'vis-y-axis vis-title vis-' + orientation; - title.innerHTML = this.options[orientation].title.text; + seconds = absFloor(milliseconds / 1000); + data.seconds = seconds % 60; - // Add style - if provided - if (this.options[orientation].title.style !== undefined) { - util.addCssText(title, this.options[orientation].title.style); - } + minutes = absFloor(seconds / 60); + data.minutes = minutes % 60; - if (orientation === 'left') { - title.style.left = this.props.titleCharHeight + 'px'; - } else { - title.style.right = this.props.titleCharHeight + 'px'; - } + hours = absFloor(minutes / 60); + data.hours = hours % 24; - title.style.width = this.height + 'px'; - } + days += absFloor(hours / 24); - // we need to clean up in case we did not use all elements. - DOMutil.cleanupElements(this.DOMelements.title); - }; + // convert days to months + monthsFromDays = absFloor(daysToMonths(days)); + months += monthsFromDays; + days -= absCeil(monthsToDays(monthsFromDays)); - /** - * Determine the size of text on the axis (both major and minor axis). - * The size is calculated only once and then cached in this.props. - * @private - */ - DataAxis.prototype._calculateCharSize = function () { - // determine the char width and height on the minor axis - if (!('minorCharHeight' in this.props)) { - var textMinor = document.createTextNode('0'); - var measureCharMinor = document.createElement('div'); - measureCharMinor.className = 'vis-y-axis vis-minor vis-measure'; - measureCharMinor.appendChild(textMinor); - this.dom.frame.appendChild(measureCharMinor); + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; - this.props.minorCharHeight = measureCharMinor.clientHeight; - this.props.minorCharWidth = measureCharMinor.clientWidth; + data.days = days; + data.months = months; + data.years = years; - this.dom.frame.removeChild(measureCharMinor); - } + return this; +} - if (!('majorCharHeight' in this.props)) { - var textMajor = document.createTextNode('0'); - var measureCharMajor = document.createElement('div'); - measureCharMajor.className = 'vis-y-axis vis-major vis-measure'; - measureCharMajor.appendChild(textMajor); - this.dom.frame.appendChild(measureCharMajor); +function daysToMonths (days) { + // 400 years have 146097 days (taking into account leap year rules) + // 400 years have 12 months === 4800 + return days * 4800 / 146097; +} - this.props.majorCharHeight = measureCharMajor.clientHeight; - this.props.majorCharWidth = measureCharMajor.clientWidth; +function monthsToDays (months) { + // the reverse of daysToMonths + return months * 146097 / 4800; +} - this.dom.frame.removeChild(measureCharMajor); +function as (units) { + if (!this.isValid()) { + return NaN; } + var days; + var months; + var milliseconds = this._milliseconds; - if (!('titleCharHeight' in this.props)) { - var textTitle = document.createTextNode('0'); - var measureCharTitle = document.createElement('div'); - measureCharTitle.className = 'vis-y-axis vis-title vis-measure'; - measureCharTitle.appendChild(textTitle); - this.dom.frame.appendChild(measureCharTitle); + units = normalizeUnits(units); - this.props.titleCharHeight = measureCharTitle.clientHeight; - this.props.titleCharWidth = measureCharTitle.clientWidth; + if (units === 'month' || units === 'year') { + days = this._days + milliseconds / 864e5; + months = this._months + daysToMonths(days); + return units === 'month' ? months : months / 12; + } else { + // handle milliseconds separately because of floating point math errors (issue #1867) + days = this._days + Math.round(monthsToDays(this._months)); + switch (units) { + case 'week' : return days / 7 + milliseconds / 6048e5; + case 'day' : return days + milliseconds / 864e5; + case 'hour' : return days * 24 + milliseconds / 36e5; + case 'minute' : return days * 1440 + milliseconds / 6e4; + case 'second' : return days * 86400 + milliseconds / 1000; + // Math.floor prevents floating point math errors here + case 'millisecond': return Math.floor(days * 864e5) + milliseconds; + default: throw new Error('Unknown unit ' + units); + } + } +} + +// TODO: Use this.as('ms')? +function valueOf$1 () { + if (!this.isValid()) { + return NaN; + } + return ( + this._milliseconds + + this._days * 864e5 + + (this._months % 12) * 2592e6 + + toInt(this._months / 12) * 31536e6 + ); +} + +function makeAs (alias) { + return function () { + return this.as(alias); + }; +} + +var asMilliseconds = makeAs('ms'); +var asSeconds = makeAs('s'); +var asMinutes = makeAs('m'); +var asHours = makeAs('h'); +var asDays = makeAs('d'); +var asWeeks = makeAs('w'); +var asMonths = makeAs('M'); +var asYears = makeAs('y'); + +function clone$1 () { + return createDuration(this); +} + +function get$2 (units) { + units = normalizeUnits(units); + return this.isValid() ? this[units + 's']() : NaN; +} + +function makeGetter(name) { + return function () { + return this.isValid() ? this._data[name] : NaN; + }; +} + +var milliseconds = makeGetter('milliseconds'); +var seconds = makeGetter('seconds'); +var minutes = makeGetter('minutes'); +var hours = makeGetter('hours'); +var days = makeGetter('days'); +var months = makeGetter('months'); +var years = makeGetter('years'); + +function weeks () { + return absFloor(this.days() / 7); +} + +var round = Math.round; +var thresholds = { + ss: 44, // a few seconds to seconds + s : 45, // seconds to minute + m : 45, // minutes to hour + h : 22, // hours to day + d : 26, // days to month + M : 11 // months to year +}; + +// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize +function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { + return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); +} + +function relativeTime$1 (posNegDuration, withoutSuffix, locale) { + var duration = createDuration(posNegDuration).abs(); + var seconds = round(duration.as('s')); + var minutes = round(duration.as('m')); + var hours = round(duration.as('h')); + var days = round(duration.as('d')); + var months = round(duration.as('M')); + var years = round(duration.as('y')); + + var a = seconds <= thresholds.ss && ['s', seconds] || + seconds < thresholds.s && ['ss', seconds] || + minutes <= 1 && ['m'] || + minutes < thresholds.m && ['mm', minutes] || + hours <= 1 && ['h'] || + hours < thresholds.h && ['hh', hours] || + days <= 1 && ['d'] || + days < thresholds.d && ['dd', days] || + months <= 1 && ['M'] || + months < thresholds.M && ['MM', months] || + years <= 1 && ['y'] || ['yy', years]; + + a[2] = withoutSuffix; + a[3] = +posNegDuration > 0; + a[4] = locale; + return substituteTimeAgo.apply(null, a); +} + +// This function allows you to set the rounding function for relative time strings +function getSetRelativeTimeRounding (roundingFunction) { + if (roundingFunction === undefined) { + return round; + } + if (typeof(roundingFunction) === 'function') { + round = roundingFunction; + return true; + } + return false; +} - this.dom.frame.removeChild(measureCharTitle); +// This function allows you to set a threshold for relative time strings +function getSetRelativeTimeThreshold (threshold, limit) { + if (thresholds[threshold] === undefined) { + return false; } - }; + if (limit === undefined) { + return thresholds[threshold]; + } + thresholds[threshold] = limit; + if (threshold === 's') { + thresholds.ss = limit - 1; + } + return true; +} + +function humanize (withSuffix) { + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var locale = this.localeData(); + var output = relativeTime$1(this, !withSuffix, locale); + + if (withSuffix) { + output = locale.pastFuture(+this, output); + } + + return locale.postformat(output); +} + +var abs$1 = Math.abs; + +function sign(x) { + return ((x > 0) - (x < 0)) || +x; +} + +function toISOString$1() { + // for ISO strings we do not use the normal bubbling rules: + // * milliseconds bubble up until they become hours + // * days do not bubble at all + // * months bubble up until they become years + // This is because there is no context-free conversion between hours and days + // (think of clock changes) + // and also not between days and months (28-31 days per month) + if (!this.isValid()) { + return this.localeData().invalidDate(); + } + + var seconds = abs$1(this._milliseconds) / 1000; + var days = abs$1(this._days); + var months = abs$1(this._months); + var minutes, hours, years; + + // 3600 seconds -> 60 minutes -> 1 hour + minutes = absFloor(seconds / 60); + hours = absFloor(minutes / 60); + seconds %= 60; + minutes %= 60; + + // 12 months -> 1 year + years = absFloor(months / 12); + months %= 12; + + + // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js + var Y = years; + var M = months; + var D = days; + var h = hours; + var m = minutes; + var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; + var total = this.asSeconds(); + + if (!total) { + // this is the same as C#'s (Noda) and python (isodate)... + // but not other JS (goog.date) + return 'P0D'; + } + + var totalSign = total < 0 ? '-' : ''; + var ymSign = sign(this._months) !== sign(total) ? '-' : ''; + var daysSign = sign(this._days) !== sign(total) ? '-' : ''; + var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; + + return totalSign + 'P' + + (Y ? ymSign + Y + 'Y' : '') + + (M ? ymSign + M + 'M' : '') + + (D ? daysSign + D + 'D' : '') + + ((h || m || s) ? 'T' : '') + + (h ? hmsSign + h + 'H' : '') + + (m ? hmsSign + m + 'M' : '') + + (s ? hmsSign + s + 'S' : ''); +} + +var proto$2 = Duration.prototype; + +proto$2.isValid = isValid$1; +proto$2.abs = abs; +proto$2.add = add$1; +proto$2.subtract = subtract$1; +proto$2.as = as; +proto$2.asMilliseconds = asMilliseconds; +proto$2.asSeconds = asSeconds; +proto$2.asMinutes = asMinutes; +proto$2.asHours = asHours; +proto$2.asDays = asDays; +proto$2.asWeeks = asWeeks; +proto$2.asMonths = asMonths; +proto$2.asYears = asYears; +proto$2.valueOf = valueOf$1; +proto$2._bubble = bubble; +proto$2.clone = clone$1; +proto$2.get = get$2; +proto$2.milliseconds = milliseconds; +proto$2.seconds = seconds; +proto$2.minutes = minutes; +proto$2.hours = hours; +proto$2.days = days; +proto$2.weeks = weeks; +proto$2.months = months; +proto$2.years = years; +proto$2.humanize = humanize; +proto$2.toISOString = toISOString$1; +proto$2.toString = toISOString$1; +proto$2.toJSON = toISOString$1; +proto$2.locale = locale; +proto$2.localeData = localeData; + +// Deprecations +proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); +proto$2.lang = lang; + +// Side effect imports + +// FORMATTING + +addFormatToken('X', 0, 0, 'unix'); +addFormatToken('x', 0, 0, 'valueOf'); + +// PARSING + +addRegexToken('x', matchSigned); +addRegexToken('X', matchTimestamp); +addParseToken('X', function (input, array, config) { + config._d = new Date(parseFloat(input, 10) * 1000); +}); +addParseToken('x', function (input, array, config) { + config._d = new Date(toInt(input)); +}); - module.exports = DataAxis; +// Side effect imports + + +hooks.version = '2.19.1'; + +setHookCallback(createLocal); + +hooks.fn = proto; +hooks.min = min; +hooks.max = max; +hooks.now = now; +hooks.utc = createUTC; +hooks.unix = createUnix; +hooks.months = listMonths; +hooks.isDate = isDate; +hooks.locale = getSetGlobalLocale; +hooks.invalid = createInvalid; +hooks.duration = createDuration; +hooks.isMoment = isMoment; +hooks.weekdays = listWeekdays; +hooks.parseZone = createInZone; +hooks.localeData = getLocale; +hooks.isDuration = isDuration; +hooks.monthsShort = listMonthsShort; +hooks.weekdaysMin = listWeekdaysMin; +hooks.defineLocale = defineLocale; +hooks.updateLocale = updateLocale; +hooks.locales = listLocales; +hooks.weekdaysShort = listWeekdaysShort; +hooks.normalizeUnits = normalizeUnits; +hooks.relativeTimeRounding = getSetRelativeTimeRounding; +hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; +hooks.calendarFormat = getCalendarFormat; +hooks.prototype = proto; + +return hooks; + +}))); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(155)(module))) /***/ }), -/* 152 */ +/* 155 */ /***/ (function(module, exports) { - 'use strict'; +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; - /** - * Created by ludo on 25-1-16. - */ - function DataScale(start, end, autoScaleStart, autoScaleEnd, containerHeight, majorCharHeight) { - var zeroAlign = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; - var formattingFunction = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false; +/***/ }), +/* 156 */ +/***/ (function(module, exports) { + +function webpackEmptyContext(req) { + throw new Error("Cannot find module '" + req + "'."); +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 156; - this.majorSteps = [1, 2, 5, 10]; - this.minorSteps = [0.25, 0.5, 1, 2]; - this.customLines = null; +/***/ }), +/* 157 */ +/***/ (function(module, exports, __webpack_require__) { - this.containerHeight = containerHeight; - this.majorCharHeight = majorCharHeight; - this._start = start; - this._end = end; +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { - this.scale = 1; - this.minorStepIdx = -1; - this.magnitudefactor = 1; - this.determineScale(); +/* eslint-disable require-jsdoc */ - this.zeroAlign = zeroAlign; - this.autoScaleStart = autoScaleStart; - this.autoScaleEnd = autoScaleEnd; +var _rng; - this.formattingFunction = formattingFunction; +var globalVar = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : null; - if (autoScaleStart || autoScaleEnd) { - var me = this; - var roundToMinor = function roundToMinor(value) { - var rounded = value - value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]); - if (value % (me.magnitudefactor * me.minorSteps[me.minorStepIdx]) > 0.5 * (me.magnitudefactor * me.minorSteps[me.minorStepIdx])) { - return rounded + me.magnitudefactor * me.minorSteps[me.minorStepIdx]; - } else { - return rounded; - } - }; - if (autoScaleStart) { - this._start -= this.magnitudefactor * 2 * this.minorSteps[this.minorStepIdx]; - this._start = roundToMinor(this._start); - } +if (globalVar && globalVar.crypto && crypto.getRandomValues) { + // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto + // Moderately fast, high quality + var _rnds8 = new Uint8Array(16); + _rng = function whatwgRNG() { + crypto.getRandomValues(_rnds8); + return _rnds8; + }; +} - if (autoScaleEnd) { - this._end += this.magnitudefactor * this.minorSteps[this.minorStepIdx]; - this._end = roundToMinor(this._end); - } - this.determineScale(); +if (!_rng) { + // Math.random()-based (RNG) + // + // If all else fails, use Math.random(). It's fast, but is of unspecified + // quality. + var _rnds = new Array(16); + _rng = function _rng() { + for (var i = 0, r; i < 16; i++) { + if ((i & 0x03) === 0) r = Math.random() * 0x100000000; + _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; } - } - DataScale.prototype.setCharHeight = function (majorCharHeight) { - this.majorCharHeight = majorCharHeight; + return _rnds; }; +} - DataScale.prototype.setHeight = function (containerHeight) { - this.containerHeight = containerHeight; - }; +// uuid.js +// +// Copyright (c) 2010-2012 Robert Kieffer +// MIT License - http://opensource.org/licenses/mit-license.php - DataScale.prototype.determineScale = function () { - var range = this._end - this._start; - this.scale = this.containerHeight / range; - var minimumStepValue = this.majorCharHeight / this.scale; - var orderOfMagnitude = range > 0 ? Math.round(Math.log(range) / Math.LN10) : 0; +// Unique ID creation requires a high quality random # generator. We feature +// detect to determine the best RNG source, normalizing to a function that +// returns 128-bits of randomness, since that's what's usually required - this.minorStepIdx = -1; - this.magnitudefactor = Math.pow(10, orderOfMagnitude); +//var _rng = require('./rng'); - var start = 0; - if (orderOfMagnitude < 0) { - start = orderOfMagnitude; - } +// Maps for number <-> hex string conversion +var _byteToHex = []; +var _hexToByte = {}; +for (var i = 0; i < 256; i++) { + _byteToHex[i] = (i + 0x100).toString(16).substr(1); + _hexToByte[_byteToHex[i]] = i; +} - var solutionFound = false; - for (var l = start; Math.abs(l) <= Math.abs(orderOfMagnitude); l++) { - this.magnitudefactor = Math.pow(10, l); - for (var j = 0; j < this.minorSteps.length; j++) { - var stepSize = this.magnitudefactor * this.minorSteps[j]; - if (stepSize >= minimumStepValue) { - solutionFound = true; - this.minorStepIdx = j; - break; - } - } - if (solutionFound === true) { - break; - } +// **`parse()` - Parse a UUID into it's component bytes** +function parse(s, buf, offset) { + var i = buf && offset || 0, + ii = 0; + + buf = buf || []; + s.toLowerCase().replace(/[0-9a-f]{2}/g, function (oct) { + if (ii < 16) { + // Don't overflow! + buf[i + ii++] = _hexToByte[oct]; } - }; + }); - DataScale.prototype.is_major = function (value) { - return value % (this.magnitudefactor * this.majorSteps[this.minorStepIdx]) === 0; - }; + // Zero out remaining bytes if string was short + while (ii < 16) { + buf[i + ii++] = 0; + } - DataScale.prototype.getStep = function () { - return this.magnitudefactor * this.minorSteps[this.minorStepIdx]; - }; + return buf; +} - DataScale.prototype.getFirstMajor = function () { - var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx]; - return this.convertValue(this._start + (majorStep - this._start % majorStep) % majorStep); - }; +// **`unparse()` - Convert UUID byte array (ala parse()) into a string** +function unparse(buf, offset) { + var i = offset || 0, + bth = _byteToHex; + return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; +} - DataScale.prototype.formatValue = function (current) { - var returnValue = current.toPrecision(5); - if (typeof this.formattingFunction === 'function') { - returnValue = this.formattingFunction(current); - } +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html - if (typeof returnValue === 'number') { - return '' + returnValue; - } else if (typeof returnValue === 'string') { - return returnValue; - } else { - return current.toPrecision(5); - } - }; +// random #'s we need to init node and clockseq +var _seedBytes = _rng(); - DataScale.prototype.getLines = function () { - var lines = []; - var step = this.getStep(); - var bottomOffset = (step - this._start % step) % step; - for (var i = this._start + bottomOffset; this._end - i > 0.00001; i += step) { - if (i != this._start) { - //Skip the bottom line - lines.push({ major: this.is_major(i), y: this.convertValue(i), val: this.formatValue(i) }); - } - } - return lines; - }; +// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) +var _nodeId = [_seedBytes[0] | 0x01, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]]; - DataScale.prototype.followScale = function (other) { - var oldStepIdx = this.minorStepIdx; - var oldStart = this._start; - var oldEnd = this._end; +// Per 4.2.2, randomize (14 bit) clockseq +var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; - var me = this; - var increaseMagnitude = function increaseMagnitude() { - me.magnitudefactor *= 2; - }; - var decreaseMagnitude = function decreaseMagnitude() { - me.magnitudefactor /= 2; - }; +// Previous uuid creation time +var _lastMSecs = 0, + _lastNSecs = 0; - if (other.minorStepIdx <= 1 && this.minorStepIdx <= 1 || other.minorStepIdx > 1 && this.minorStepIdx > 1) { - //easy, no need to change stepIdx nor multiplication factor - } else if (other.minorStepIdx < this.minorStepIdx) { - //I'm 5, they are 4 per major. - this.minorStepIdx = 1; - if (oldStepIdx == 2) { - increaseMagnitude(); - } else { - increaseMagnitude(); - increaseMagnitude(); - } - } else { - //I'm 4, they are 5 per major - this.minorStepIdx = 2; - if (oldStepIdx == 1) { - decreaseMagnitude(); - } else { - decreaseMagnitude(); - decreaseMagnitude(); - } - } +// See https://github.com/broofa/node-uuid for API details +function v1(options, buf, offset) { + var i = buf && offset || 0; + var b = buf || []; - //Get masters stats: - var lines = other.getLines(); - var otherZero = other.convertValue(0); - var otherStep = other.getStep() * other.scale; + options = options || {}; - var done = false; - var count = 0; - //Loop until magnitude is correct for given constrains. - while (!done && count++ < 5) { + var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; - //Get my stats: - this.scale = otherStep / (this.minorSteps[this.minorStepIdx] * this.magnitudefactor); - var newRange = this.containerHeight / this.scale; + // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); - //For the case the magnitudefactor has changed: - this._start = oldStart; - this._end = this._start + newRange; + // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; - var myOriginalZero = this._end * this.scale; - var majorStep = this.magnitudefactor * this.majorSteps[this.minorStepIdx]; - var majorOffset = this.getFirstMajor() - other.getFirstMajor(); + // Time since last uuid creation (in msecs) + var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; - if (this.zeroAlign) { - var zeroOffset = otherZero - myOriginalZero; - this._end += zeroOffset / this.scale; - this._start = this._end - newRange; - } else { - if (!this.autoScaleStart) { - this._start += majorStep - majorOffset / this.scale; - this._end = this._start + newRange; - } else { - this._start -= majorOffset / this.scale; - this._end = this._start + newRange; - } - } - if (!this.autoScaleEnd && this._end > oldEnd + 0.00001) { - //Need to decrease magnitude to prevent scale overshoot! (end) - decreaseMagnitude(); - done = false; - continue; - } - if (!this.autoScaleStart && this._start < oldStart - 0.00001) { - if (this.zeroAlign && oldStart >= 0) { - console.warn("Can't adhere to given 'min' range, due to zeroalign"); - } else { - //Need to decrease magnitude to prevent scale overshoot! (start) - decreaseMagnitude(); - done = false; - continue; - } - } - if (this.autoScaleStart && this.autoScaleEnd && newRange < oldEnd - oldStart) { - increaseMagnitude(); - done = false; - continue; - } - done = true; - } - }; + // Per 4.2.1.2, Bump clockseq on clock regression + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } - DataScale.prototype.convertValue = function (value) { - return this.containerHeight - (value - this._start) * this.scale; - }; + // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } - DataScale.prototype.screenToValue = function (pixels) { - return (this.containerHeight - pixels) / this.scale + this._start; - }; + // Per 4.2.1.2 Throw error if too many uuids are requested + if (nsecs >= 10000) { + throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); + } - module.exports = DataScale; + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { + // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + msecs += 12219292800000; - 'use strict'; + // `time_low` + var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; - var _typeof2 = __webpack_require__(62); + // `time_mid` + var tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; - var _typeof3 = _interopRequireDefault(_typeof2); + // `time_high_and_version` + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + b[i++] = tmh >>> 16 & 0xff; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + b[i++] = clockseq >>> 8 | 0x80; - var util = __webpack_require__(1); - var DOMutil = __webpack_require__(88); - var Bars = __webpack_require__(154); - var Lines = __webpack_require__(156); - var Points = __webpack_require__(155); + // `clock_seq_low` + b[i++] = clockseq & 0xff; - /** - * /** - * @param {object} group | the object of the group from the dataset - * @param {string} groupId | ID of the group - * @param {object} options | the default options - * @param {array} groupsUsingDefaultStyles | this array has one entree. - * It is passed as an array so it is passed by reference. - * It enumerates through the default styles - * @constructor - */ - function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { - this.id = groupId; - var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex', 'excludeFromStacking', 'excludeFromLegend']; - this.options = util.selectiveBridgeObject(fields, options); - this.usingDefaultStyle = group.className === undefined; - this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; - this.zeroPosition = 0; - this.update(group); - if (this.usingDefaultStyle == true) { - this.groupsUsingDefaultStyles[0] += 1; - } - this.itemsData = []; - this.visible = group.visible === undefined ? true : group.visible; + // `node` + var node = options.node || _nodeId; + for (var n = 0; n < 6; n++) { + b[i + n] = node[n]; } - /** - * this loads a reference to all items in this group into this group. - * @param {array} items - */ - GraphGroup.prototype.setItems = function (items) { - if (items != null) { - this.itemsData = items; - if (this.options.sort == true) { - util.insertSort(this.itemsData, function (a, b) { - return a.x > b.x ? 1 : -1; - }); - } - } else { - this.itemsData = []; - } - }; + return buf ? buf : unparse(b); +} - GraphGroup.prototype.getItems = function () { - return this.itemsData; - }; +// **`v4()` - Generate random UUID** - /** - * this is used for barcharts and shading, this way, we only have to calculate it once. - * @param pos - */ - GraphGroup.prototype.setZeroPosition = function (pos) { - this.zeroPosition = pos; - }; +// See https://github.com/broofa/node-uuid for API details +function v4(options, buf, offset) { + // Deprecated - 'format' argument, as supported in v1.2 + var i = buf && offset || 0; - /** - * set the options of the graph group over the default options. - * @param options - */ - GraphGroup.prototype.setOptions = function (options) { - if (options !== undefined) { - var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'zIndex', 'excludeFromStacking', 'excludeFromLegend']; - util.selectiveDeepExtend(fields, this.options, options); - - // if the group's drawPoints is a function delegate the callback to the onRender property - if (typeof options.drawPoints == 'function') { - options.drawPoints = { - onRender: options.drawPoints - }; - } + if (typeof options == 'string') { + buf = options == 'binary' ? new Array(16) : null; + options = null; + } + options = options || {}; - util.mergeOptions(this.options, options, 'interpolation'); - util.mergeOptions(this.options, options, 'drawPoints'); - util.mergeOptions(this.options, options, 'shaded'); + var rnds = options.random || (options.rng || _rng)(); - if (options.interpolation) { - if ((0, _typeof3['default'])(options.interpolation) == 'object') { - if (options.interpolation.parametrization) { - if (options.interpolation.parametrization == 'uniform') { - this.options.interpolation.alpha = 0; - } else if (options.interpolation.parametrization == 'chordal') { - this.options.interpolation.alpha = 1.0; - } else { - this.options.interpolation.parametrization = 'centripetal'; - this.options.interpolation.alpha = 0.5; - } - } - } - } + // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; + + // Copy bytes to buffer, if provided + if (buf) { + for (var ii = 0; ii < 16; ii++) { + buf[i + ii] = rnds[ii]; } - }; + } - /** - * this updates the current group class with the latest group dataset entree, used in _updateGroup in linegraph - * @param group - */ - GraphGroup.prototype.update = function (group) { - this.group = group; - this.content = group.content || 'graph'; - this.className = group.className || this.className || 'vis-graph-group' + this.groupsUsingDefaultStyles[0] % 10; - this.visible = group.visible === undefined ? true : group.visible; - this.style = group.style; - this.setOptions(group.options); - }; + return buf || unparse(rnds); +} - /** - * return the legend entree for this group. - * - * @param iconWidth - * @param iconHeight - * @returns {{icon: HTMLElement, label: (group.content|*|string), orientation: (.options.yAxisOrientation|*)}} - */ - GraphGroup.prototype.getLegend = function (iconWidth, iconHeight, framework, x, y) { - if (framework == undefined || framework == null) { - var svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); - framework = { svg: svg, svgElements: {}, options: this.options, groups: [this] }; - } - if (x == undefined || x == null) { - x = 0; - } - if (y == undefined || y == null) { - y = 0.5 * iconHeight; - } - switch (this.options.style) { - case "line": - Lines.drawIcon(this, x, y, iconWidth, iconHeight, framework); - break; - case "points": //explicit no break - case "point": - Points.drawIcon(this, x, y, iconWidth, iconHeight, framework); - break; - case "bar": - Bars.drawIcon(this, x, y, iconWidth, iconHeight, framework); - break; - } - return { icon: framework.svg, label: this.content, orientation: this.options.yAxisOrientation }; - }; +// Export public API +var uuid = v4; +uuid.v1 = v1; +uuid.v4 = v4; +uuid.parse = parse; +uuid.unparse = unparse; - GraphGroup.prototype.getYRange = function (groupData) { - var yMin = groupData[0].y; - var yMax = groupData[0].y; - for (var j = 0; j < groupData.length; j++) { - yMin = yMin > groupData[j].y ? groupData[j].y : yMin; - yMax = yMax < groupData[j].y ? groupData[j].y : yMax; - } - return { min: yMin, max: yMax, yAxisOrientation: this.options.yAxisOrientation }; - }; +module.exports = uuid; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(158))) + +/***/ }), +/* 158 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; - module.exports = GraphGroup; /***/ }), -/* 154 */ +/* 159 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - var DOMutil = __webpack_require__(88); - var Points = __webpack_require__(155); - function Bargraph(groupId, options) {} +// utils +exports.util = __webpack_require__(2); +exports.DOMutil = __webpack_require__(14); - Bargraph.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { - var fillHeight = iconHeight * 0.5; - var path, fillPath; +// data +exports.DataSet = __webpack_require__(11); +exports.DataView = __webpack_require__(12); +exports.Queue = __webpack_require__(43); - var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); - outline.setAttributeNS(null, "x", x); - outline.setAttributeNS(null, "y", y - fillHeight); - outline.setAttributeNS(null, "width", iconWidth); - outline.setAttributeNS(null, "height", 2 * fillHeight); - outline.setAttributeNS(null, "class", "vis-outline"); +// Graph3d +exports.Graph3d = __webpack_require__(161); +exports.graph3d = { + Camera: __webpack_require__(95), + Filter: __webpack_require__(96), + Point2d: __webpack_require__(91), + Point3d: __webpack_require__(34), + Slider: __webpack_require__(92), + StepNumber: __webpack_require__(93) +}; - var barWidth = Math.round(0.3 * iconWidth); - var originalWidth = group.options.barChart.width; - var scale = originalWidth / barWidth; - var bar1Height = Math.round(0.4 * iconHeight); - var bar2Height = Math.round(0.75 * iconHeight); +// bundled external libraries +exports.moment = __webpack_require__(9); +exports.Hammer = __webpack_require__(10); +exports.keycharm = __webpack_require__(35); - var offset = Math.round((iconWidth - 2 * barWidth) / 3); +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { - DOMutil.drawBar(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, barWidth, bar1Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); - DOMutil.drawBar(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, barWidth, bar2Height, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); +var core = __webpack_require__(7); +var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify }); +module.exports = function stringify(it) { // eslint-disable-line no-unused-vars + return $JSON.stringify.apply($JSON, arguments); +}; - if (group.options.drawPoints.enabled == true) { - var groupTemplate = { - style: group.options.drawPoints.style, - styles: group.options.drawPoints.styles, - size: group.options.drawPoints.size / scale, - className: group.className - }; - DOMutil.drawPoint(x + 0.5 * barWidth + offset, y + fillHeight - bar1Height - 1, groupTemplate, framework.svgElements, framework.svg); - DOMutil.drawPoint(x + 1.5 * barWidth + offset + 2, y + fillHeight - bar2Height - 1, groupTemplate, framework.svgElements, framework.svg); - } - }; - /** - * draw a bar graph - * - * @param groupIds - * @param processedGroupData - */ - Bargraph.draw = function (groupIds, processedGroupData, framework) { - var combinedData = []; - var intersections = {}; - var coreDistance; - var key, drawData; - var group; - var i, j; - var barPoints = 0; +/***/ }), +/* 161 */ +/***/ (function(module, exports, __webpack_require__) { - // combine all barchart data - for (i = 0; i < groupIds.length; i++) { - group = framework.groups[groupIds[i]]; - if (group.options.style === 'bar') { - if (group.visible === true && (framework.options.groups.visibility[groupIds[i]] === undefined || framework.options.groups.visibility[groupIds[i]] === true)) { - for (j = 0; j < processedGroupData[groupIds[i]].length; j++) { - combinedData.push({ - screen_x: processedGroupData[groupIds[i]][j].screen_x, - screen_end: processedGroupData[groupIds[i]][j].screen_end, - screen_y: processedGroupData[groupIds[i]][j].screen_y, - x: processedGroupData[groupIds[i]][j].x, - end: processedGroupData[groupIds[i]][j].end, - y: processedGroupData[groupIds[i]][j].y, - groupId: groupIds[i], - label: processedGroupData[groupIds[i]][j].label - }); - barPoints += 1; - } - } - } - } +"use strict"; - if (barPoints === 0) { - return; - } - // sort by time and by group - combinedData.sort(function (a, b) { - if (a.screen_x === b.screen_x) { - return a.groupId < b.groupId ? -1 : 1; - } else { - return a.screen_x - b.screen_x; - } - }); +var _assign = __webpack_require__(90); - // get intersections - Bargraph._getDataIntersections(intersections, combinedData); +var _assign2 = _interopRequireDefault(_assign); - // plot barchart - for (i = 0; i < combinedData.length; i++) { - group = framework.groups[combinedData[i].groupId]; - var minWidth = group.options.barChart.minWidth != undefined ? group.options.barChart.minWidth : 0.1 * group.options.barChart.width; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - key = combinedData[i].screen_x; - var heightOffset = 0; - if (intersections[key] === undefined) { - if (i + 1 < combinedData.length) { - coreDistance = Math.abs(combinedData[i + 1].screen_x - key); - } - drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); - } else { - var nextKey = i + (intersections[key].amount - intersections[key].resolved); - var prevKey = i - (intersections[key].resolved + 1); - if (nextKey < combinedData.length) { - coreDistance = Math.abs(combinedData[nextKey].screen_x - key); - } - drawData = Bargraph._getSafeDrawData(coreDistance, group, minWidth); - intersections[key].resolved += 1; - - if (group.options.stack === true && group.options.excludeFromStacking !== true) { - if (combinedData[i].screen_y < group.zeroPosition) { - heightOffset = intersections[key].accumulatedNegative; - intersections[key].accumulatedNegative += group.zeroPosition - combinedData[i].screen_y; - } else { - heightOffset = intersections[key].accumulatedPositive; - intersections[key].accumulatedPositive += group.zeroPosition - combinedData[i].screen_y; - } - } else if (group.options.barChart.sideBySide === true) { - drawData.width = drawData.width / intersections[key].amount; - drawData.offset += intersections[key].resolved * drawData.width - 0.5 * drawData.width * (intersections[key].amount + 1); - } - } +var Emitter = __webpack_require__(44); +var util = __webpack_require__(2); +var Point3d = __webpack_require__(34); +var Point2d = __webpack_require__(91); +var Slider = __webpack_require__(92); +var StepNumber = __webpack_require__(93); +var Settings = __webpack_require__(94); +var Validator = __webpack_require__(15)['default']; - var dataWidth = drawData.width; - var start = combinedData[i].screen_x; +var _require = __webpack_require__(15), + printStyle = _require.printStyle; - // are we drawing explicit boxes? (we supplied an end value) - if (combinedData[i].screen_end != undefined) { - dataWidth = combinedData[i].screen_end - combinedData[i].screen_x; - start += dataWidth * 0.5; - } else { - start += drawData.offset; - } +var _require2 = __webpack_require__(172), + allOptions = _require2.allOptions; - DOMutil.drawBar(start, combinedData[i].screen_y - heightOffset, dataWidth, group.zeroPosition - combinedData[i].screen_y, group.className + ' vis-bar', framework.svgElements, framework.svg, group.style); +var DataGroup = __webpack_require__(173); - // draw points - if (group.options.drawPoints.enabled === true) { - var pointData = { - screen_x: combinedData[i].screen_x, - screen_y: combinedData[i].screen_y - heightOffset, - x: combinedData[i].x, - y: combinedData[i].y, - groupId: combinedData[i].groupId, - label: combinedData[i].label - }; - Points.draw([pointData], group, framework, drawData.offset); - //DOMutil.drawPoint(combinedData[i].x + drawData.offset, combinedData[i].y, group, framework.svgElements, framework.svg); - } - } - }; +/// enumerate the available styles +Graph3d.STYLE = Settings.STYLE; - /** - * Fill the intersections object with counters of how many datapoints share the same x coordinates - * @param intersections - * @param combinedData - * @private - */ - Bargraph._getDataIntersections = function (intersections, combinedData) { - // get intersections - var coreDistance; - for (var i = 0; i < combinedData.length; i++) { - if (i + 1 < combinedData.length) { - coreDistance = Math.abs(combinedData[i + 1].screen_x - combinedData[i].screen_x); - } - if (i > 0) { - coreDistance = Math.min(coreDistance, Math.abs(combinedData[i - 1].screen_x - combinedData[i].screen_x)); - } - if (coreDistance === 0) { - if (intersections[combinedData[i].screen_x] === undefined) { - intersections[combinedData[i].screen_x] = { - amount: 0, - resolved: 0, - accumulatedPositive: 0, - accumulatedNegative: 0 - }; - } - intersections[combinedData[i].screen_x].amount += 1; - } - } - }; +/** + * Following label is used in the settings to describe values which should be + * determined by the code while running, from the current data and graph style. + * + * Using 'undefined' directly achieves the same thing, but this is more + * descriptive by describing the intent. + */ +var autoByDefault = undefined; - /** - * Get the width and offset for bargraphs based on the coredistance between datapoints - * - * @param coreDistance - * @param group - * @param minWidth - * @returns {{width: Number, offset: Number}} - * @private - */ - Bargraph._getSafeDrawData = function (coreDistance, group, minWidth) { - var width, offset; - if (coreDistance < group.options.barChart.width && coreDistance > 0) { - width = coreDistance < minWidth ? minWidth : coreDistance; +/** + * Default values for option settings. + * + * These are the values used when a Graph3d instance is initialized without + * custom settings. + * + * If a field is not in this list, a default value of 'autoByDefault' is assumed, + * which is just an alias for 'undefined'. + */ +Graph3d.DEFAULTS = { + width: '400px', + height: '400px', + filterLabel: 'time', + legendLabel: 'value', + xLabel: 'x', + yLabel: 'y', + zLabel: 'z', + xValueLabel: function xValueLabel(v) { + return v; + }, + yValueLabel: function yValueLabel(v) { + return v; + }, + zValueLabel: function zValueLabel(v) { + return v; + }, + showXAxis: true, + showYAxis: true, + showZAxis: true, + showGrid: true, + showPerspective: true, + showShadow: false, + keepAspectRatio: true, + verticalRatio: 0.5, // 0.1 to 1.0, where 1.0 results in a 'cube' + + dotSizeRatio: 0.02, // size of the dots as a fraction of the graph width + dotSizeMinFraction: 0.5, // size of min-value dot as a fraction of dotSizeRatio + dotSizeMaxFraction: 2.5, // size of max-value dot as a fraction of dotSizeRatio + + showAnimationControls: autoByDefault, + animationInterval: 1000, // milliseconds + animationPreload: false, + animationAutoStart: autoByDefault, + + axisColor: '#4D4D4D', + gridColor: '#D3D3D3', + xCenter: '55%', + yCenter: '50%', + + style: Graph3d.STYLE.DOT, + tooltip: false, + + tooltipStyle: { + content: { + padding: '10px', + border: '1px solid #4d4d4d', + color: '#1a1a1a', + background: 'rgba(255,255,255,0.7)', + borderRadius: '2px', + boxShadow: '5px 5px 10px rgba(128,128,128,0.5)' + }, + line: { + height: '40px', + width: '0', + borderLeft: '1px solid #4d4d4d' + }, + dot: { + height: '0', + width: '0', + border: '5px solid #4d4d4d', + borderRadius: '5px' + } + }, + + dataColor: { + fill: '#7DC1FF', + stroke: '#3267D2', + strokeWidth: 1 // px + }, + + cameraPosition: { + horizontal: 1.0, + vertical: 0.5, + distance: 1.7 + }, - offset = 0; // recalculate offset with the new width; - if (group.options.barChart.align === 'left') { - offset -= 0.5 * coreDistance; - } else if (group.options.barChart.align === 'right') { - offset += 0.5 * coreDistance; - } - } else { - // default settings - width = group.options.barChart.width; - offset = 0; - if (group.options.barChart.align === 'left') { - offset -= 0.5 * group.options.barChart.width; - } else if (group.options.barChart.align === 'right') { - offset += 0.5 * group.options.barChart.width; - } - } + /* + The following fields are 'auto by default', see above. + */ + showLegend: autoByDefault, // determined by graph style + backgroundColor: autoByDefault, + + xBarWidth: autoByDefault, + yBarWidth: autoByDefault, + valueMin: autoByDefault, + valueMax: autoByDefault, + xMin: autoByDefault, + xMax: autoByDefault, + xStep: autoByDefault, + yMin: autoByDefault, + yMax: autoByDefault, + yStep: autoByDefault, + zMin: autoByDefault, + zMax: autoByDefault, + zStep: autoByDefault +}; + +// ----------------------------------------------------------------------------- +// Class Graph3d +// ----------------------------------------------------------------------------- - return { width: width, offset: offset }; - }; - Bargraph.getStackedYRange = function (combinedData, groupRanges, groupIds, groupLabel, orientation) { - if (combinedData.length > 0) { - // sort by time and by group - combinedData.sort(function (a, b) { - if (a.screen_x === b.screen_x) { - return a.groupId < b.groupId ? -1 : 1; - } else { - return a.screen_x - b.screen_x; - } - }); - var intersections = {}; +/** + * Graph3d displays data in 3d. + * + * Graph3d is developed in javascript as a Google Visualization Chart. + * + * @constructor Graph3d + * @param {Element} container The DOM element in which the Graph3d will + * be created. Normally a div element. + * @param {DataSet | DataView | Array} [data] + * @param {Object} [options] + */ +function Graph3d(container, data, options) { + if (!(this instanceof Graph3d)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } - Bargraph._getDataIntersections(intersections, combinedData); - groupRanges[groupLabel] = Bargraph._getStackedYRange(intersections, combinedData); - groupRanges[groupLabel].yAxisOrientation = orientation; - groupIds.push(groupLabel); - } - }; + // create variables and set default values + this.containerElement = container; - Bargraph._getStackedYRange = function (intersections, combinedData) { - var key; - var yMin = combinedData[0].screen_y; - var yMax = combinedData[0].screen_y; - for (var i = 0; i < combinedData.length; i++) { - key = combinedData[i].screen_x; - if (intersections[key] === undefined) { - yMin = yMin > combinedData[i].screen_y ? combinedData[i].screen_y : yMin; - yMax = yMax < combinedData[i].screen_y ? combinedData[i].screen_y : yMax; - } else { - if (combinedData[i].screen_y < 0) { - intersections[key].accumulatedNegative += combinedData[i].screen_y; - } else { - intersections[key].accumulatedPositive += combinedData[i].screen_y; - } - } - } - for (var xpos in intersections) { - if (intersections.hasOwnProperty(xpos)) { - yMin = yMin > intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMin; - yMin = yMin > intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMin; - yMax = yMax < intersections[xpos].accumulatedNegative ? intersections[xpos].accumulatedNegative : yMax; - yMax = yMax < intersections[xpos].accumulatedPositive ? intersections[xpos].accumulatedPositive : yMax; - } - } + this.dataGroup = new DataGroup(); + this.dataPoints = null; // The table with point objects - return { min: yMin, max: yMax }; - }; + // create a frame and canvas + this.create(); - module.exports = Bargraph; + Settings.setDefaults(Graph3d.DEFAULTS, this); -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { + // the column indexes + this.colX = undefined; + this.colY = undefined; + this.colZ = undefined; + this.colValue = undefined; - 'use strict'; + // TODO: customize axis range - var _typeof2 = __webpack_require__(62); + // apply options (also when undefined) + this.setOptions(options); - var _typeof3 = _interopRequireDefault(_typeof2); + // apply data + this.setData(data); +} - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +// Extend Graph3d with an Emitter mixin +Emitter(Graph3d.prototype); - var DOMutil = __webpack_require__(88); +/** + * Calculate the scaling values, dependent on the range in x, y, and z direction + */ +Graph3d.prototype._setScale = function () { + this.scale = new Point3d(1 / this.xRange.range(), 1 / this.yRange.range(), 1 / this.zRange.range()); + + // keep aspect ration between x and y scale if desired + if (this.keepAspectRatio) { + if (this.scale.x < this.scale.y) { + //noinspection JSSuspiciousNameCombination + this.scale.y = this.scale.x; + } else { + //noinspection JSSuspiciousNameCombination + this.scale.x = this.scale.y; + } + } - function Points(groupId, options) {} + // scale the vertical axis + this.scale.z *= this.verticalRatio; + // TODO: can this be automated? verticalRatio? - /** - * draw the data points - * - * @param {Array} dataset - * @param {Object} JSONcontainer - * @param {Object} svg | SVG DOM element - * @param {GraphGroup} group - * @param {Number} [offset] - */ - Points.draw = function (dataset, group, framework, offset) { - offset = offset || 0; - var callback = getCallback(framework, group); - - for (var i = 0; i < dataset.length; i++) { - if (!callback) { - // draw the point the simple way. - DOMutil.drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group), framework.svgElements, framework.svg, dataset[i].label); - } else { - var callbackResult = callback(dataset[i], group); // result might be true, false or an object - if (callbackResult === true || (typeof callbackResult === 'undefined' ? 'undefined' : (0, _typeof3['default'])(callbackResult)) === 'object') { - DOMutil.drawPoint(dataset[i].screen_x + offset, dataset[i].screen_y, getGroupTemplate(group, callbackResult), framework.svgElements, framework.svg, dataset[i].label); - } - } - } - }; + // determine scale for (optional) value + if (this.valueRange !== undefined) { + this.scale.value = 1 / this.valueRange.range(); + } - Points.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { - var fillHeight = iconHeight * 0.5; - var path, fillPath; + // position the camera arm + var xCenter = this.xRange.center() * this.scale.x; + var yCenter = this.yRange.center() * this.scale.y; + var zCenter = this.zRange.center() * this.scale.z; + this.camera.setArmLocation(xCenter, yCenter, zCenter); +}; - var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); - outline.setAttributeNS(null, "x", x); - outline.setAttributeNS(null, "y", y - fillHeight); - outline.setAttributeNS(null, "width", iconWidth); - outline.setAttributeNS(null, "height", 2 * fillHeight); - outline.setAttributeNS(null, "class", "vis-outline"); +/** + * Convert a 3D location to a 2D location on screen + * Source: ttp://en.wikipedia.org/wiki/3D_projection + * + * @param {Point3d} point3d A 3D point with parameters x, y, z + * @returns {Point2d} point2d A 2D point with parameters x, y + */ +Graph3d.prototype._convert3Dto2D = function (point3d) { + var translation = this._convertPointToTranslation(point3d); + return this._convertTranslationToScreen(translation); +}; - //Don't call callback on icon - DOMutil.drawPoint(x + 0.5 * iconWidth, y, getGroupTemplate(group), framework.svgElements, framework.svg); - }; +/** + * Convert a 3D location its translation seen from the camera + * Source: http://en.wikipedia.org/wiki/3D_projection + * + * @param {Point3d} point3d A 3D point with parameters x, y, z + * @returns {Point3d} translation A 3D point with parameters x, y, z This is + * the translation of the point, seen from the + * camera. + */ +Graph3d.prototype._convertPointToTranslation = function (point3d) { + var cameraLocation = this.camera.getCameraLocation(), + cameraRotation = this.camera.getCameraRotation(), + ax = point3d.x * this.scale.x, + ay = point3d.y * this.scale.y, + az = point3d.z * this.scale.z, + cx = cameraLocation.x, + cy = cameraLocation.y, + cz = cameraLocation.z, + + + // calculate angles + sinTx = Math.sin(cameraRotation.x), + cosTx = Math.cos(cameraRotation.x), + sinTy = Math.sin(cameraRotation.y), + cosTy = Math.cos(cameraRotation.y), + sinTz = Math.sin(cameraRotation.z), + cosTz = Math.cos(cameraRotation.z), + + + // calculate translation + dx = cosTy * (sinTz * (ay - cy) + cosTz * (ax - cx)) - sinTy * (az - cz), + dy = sinTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) + cosTx * (cosTz * (ay - cy) - sinTz * (ax - cx)), + dz = cosTx * (cosTy * (az - cz) + sinTy * (sinTz * (ay - cy) + cosTz * (ax - cx))) - sinTx * (cosTz * (ay - cy) - sinTz * (ax - cx)); + + return new Point3d(dx, dy, dz); +}; - function getGroupTemplate(group, callbackResult) { - callbackResult = typeof callbackResult === 'undefined' ? {} : callbackResult; - return { - style: callbackResult.style || group.options.drawPoints.style, - styles: callbackResult.styles || group.options.drawPoints.styles, - size: callbackResult.size || group.options.drawPoints.size, - className: callbackResult.className || group.className - }; +/** + * Convert a translation point to a point on the screen + * + * @param {Point3d} translation A 3D point with parameters x, y, z This is + * the translation of the point, seen from the + * camera. + * @returns {Point2d} point2d A 2D point with parameters x, y + */ +Graph3d.prototype._convertTranslationToScreen = function (translation) { + var ex = this.eye.x, + ey = this.eye.y, + ez = this.eye.z, + dx = translation.x, + dy = translation.y, + dz = translation.z; + + // calculate position on screen from translation + var bx; + var by; + if (this.showPerspective) { + bx = (dx - ex) * (ez / dz); + by = (dy - ey) * (ez / dz); + } else { + bx = dx * -(ez / this.camera.getArmLength()); + by = dy * -(ez / this.camera.getArmLength()); } - function getCallback(framework, group) { - var callback = undefined; - // check for the graph2d onRender - if (framework.options && framework.options.drawPoints && framework.options.drawPoints.onRender && typeof framework.options.drawPoints.onRender == 'function') { - callback = framework.options.drawPoints.onRender; - } + // shift and scale the point to the center of the screen + // use the width of the graph to scale both horizontally and vertically. + return new Point2d(this.currentXCenter + bx * this.frame.canvas.clientWidth, this.currentYCenter - by * this.frame.canvas.clientWidth); +}; - // override it with the group onRender if defined - if (group.group.options && group.group.options.drawPoints && group.group.options.drawPoints.onRender && typeof group.group.options.drawPoints.onRender == 'function') { - callback = group.group.options.drawPoints.onRender; - } - return callback; +/** + * Calculate the translations and screen positions of all points + * + * @param {Array.} points + * @private + */ +Graph3d.prototype._calcTranslations = function (points) { + for (var i = 0; i < points.length; i++) { + var point = points[i]; + point.trans = this._convertPointToTranslation(point.point); + point.screen = this._convertTranslationToScreen(point.trans); + + // calculate the translation of the point at the bottom (needed for sorting) + var transBottom = this._convertPointToTranslation(point.bottom); + point.dist = this.showPerspective ? transBottom.length() : -transBottom.z; } - module.exports = Points; + // sort the points on depth of their (x,y) position (not on z) + var sortDepth = function sortDepth(a, b) { + return b.dist - a.dist; + }; + points.sort(sortDepth); +}; -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Transfer min/max values to the Graph3d instance. + */ +Graph3d.prototype._initializeRanges = function () { + // TODO: later on, all min/maxes of all datagroups will be combined here + var dg = this.dataGroup; + this.xRange = dg.xRange; + this.yRange = dg.yRange; + this.zRange = dg.zRange; + this.valueRange = dg.valueRange; + + // Values currently needed but which need to be sorted out for + // the multiple graph case. + this.xStep = dg.xStep; + this.yStep = dg.yStep; + this.zStep = dg.zStep; + this.xBarWidth = dg.xBarWidth; + this.yBarWidth = dg.yBarWidth; + this.colX = dg.colX; + this.colY = dg.colY; + this.colZ = dg.colZ; + this.colValue = dg.colValue; + + // set the scale dependent on the ranges. + this._setScale(); +}; + +/** + * Return all data values as a list of Point3d objects + * + * @param {vis.DataSet} data + * @returns {Array.} + */ +Graph3d.prototype.getDataPoints = function (data) { + var dataPoints = []; - "use strict"; + for (var i = 0; i < data.length; i++) { + var point = new Point3d(); + point.x = data[i][this.colX] || 0; + point.y = data[i][this.colY] || 0; + point.z = data[i][this.colZ] || 0; + point.data = data[i]; - var DOMutil = __webpack_require__(88); + if (this.colValue !== undefined) { + point.value = data[i][this.colValue] || 0; + } - function Line(groupId, options) {} + var obj = {}; + obj.point = point; + obj.bottom = new Point3d(point.x, point.y, this.zRange.min); + obj.trans = undefined; + obj.screen = undefined; - Line.calcPath = function (dataset, group) { - if (dataset != null) { - if (dataset.length > 0) { - var d = []; + dataPoints.push(obj); + } - // construct path from dataset - if (group.options.interpolation.enabled == true) { - d = Line._catmullRom(dataset, group); - } else { - d = Line._linear(dataset); - } - return d; - } - } - }; + return dataPoints; +}; - Line.drawIcon = function (group, x, y, iconWidth, iconHeight, framework) { - var fillHeight = iconHeight * 0.5; - var path, fillPath; +/** + * Filter the data based on the current filter + * + * @param {Array} data + * @returns {Array} dataPoints Array with point objects which can be drawn on + * screen + */ +Graph3d.prototype._getDataPoints = function (data) { + // TODO: store the created matrix dataPoints in the filters instead of + // reloading each time. + var x, y, i, obj; - var outline = DOMutil.getSVGElement("rect", framework.svgElements, framework.svg); - outline.setAttributeNS(null, "x", x); - outline.setAttributeNS(null, "y", y - fillHeight); - outline.setAttributeNS(null, "width", iconWidth); - outline.setAttributeNS(null, "height", 2 * fillHeight); - outline.setAttributeNS(null, "class", "vis-outline"); + var dataPoints = []; - path = DOMutil.getSVGElement("path", framework.svgElements, framework.svg); - path.setAttributeNS(null, "class", group.className); - if (group.style !== undefined) { - path.setAttributeNS(null, "style", group.style); - } + if (this.style === Graph3d.STYLE.GRID || this.style === Graph3d.STYLE.SURFACE) { + // copy all values from the data table to a matrix + // the provided values are supposed to form a grid of (x,y) positions - path.setAttributeNS(null, "d", "M" + x + "," + y + " L" + (x + iconWidth) + "," + y + ""); - if (group.options.shaded.enabled == true) { - fillPath = DOMutil.getSVGElement("path", framework.svgElements, framework.svg); - if (group.options.shaded.orientation == 'top') { - fillPath.setAttributeNS(null, "d", "M" + x + ", " + (y - fillHeight) + "L" + x + "," + y + " L" + (x + iconWidth) + "," + y + " L" + (x + iconWidth) + "," + (y - fillHeight)); - } else { - fillPath.setAttributeNS(null, "d", "M" + x + "," + y + " " + "L" + x + "," + (y + fillHeight) + " " + "L" + (x + iconWidth) + "," + (y + fillHeight) + "L" + (x + iconWidth) + "," + y); - } - fillPath.setAttributeNS(null, "class", group.className + " vis-icon-fill"); - if (group.options.shaded.style !== undefined && group.options.shaded.style !== "") { - fillPath.setAttributeNS(null, "style", group.options.shaded.style); - } - } + // create two lists with all present x and y values + var dataX = this.dataGroup.getDistinctValues(this.colX, data); + var dataY = this.dataGroup.getDistinctValues(this.colY, data); - if (group.options.drawPoints.enabled == true) { - var groupTemplate = { - style: group.options.drawPoints.style, - styles: group.options.drawPoints.styles, - size: group.options.drawPoints.size, - className: group.className - }; - DOMutil.drawPoint(x + 0.5 * iconWidth, y, groupTemplate, framework.svgElements, framework.svg); - } - }; + dataPoints = this.getDataPoints(data); - Line.drawShading = function (pathArray, group, subPathArray, framework) { - // append shading to the path - if (group.options.shaded.enabled == true) { - var svgHeight = Number(framework.svg.style.height.replace('px', '')); - var fillPath = DOMutil.getSVGElement('path', framework.svgElements, framework.svg); - var type = "L"; - if (group.options.interpolation.enabled == true) { - type = "C"; - } - var dFill; - var zero = 0; - if (group.options.shaded.orientation == 'top') { - zero = 0; - } else if (group.options.shaded.orientation == 'bottom') { - zero = svgHeight; - } else { - zero = Math.min(Math.max(0, group.zeroPosition), svgHeight); - } - if (group.options.shaded.orientation == 'group' && subPathArray != null && subPathArray != undefined) { - dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' L' + subPathArray[subPathArray.length - 1][0] + "," + subPathArray[subPathArray.length - 1][1] + " " + this.serializePath(subPathArray, type, true) + subPathArray[0][0] + "," + subPathArray[0][1] + " Z"; - } else { - dFill = 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false) + ' V' + zero + ' H' + pathArray[0][0] + " Z"; - } + // create a grid, a 2d matrix, with all values. + var dataMatrix = []; // temporary data matrix + for (i = 0; i < dataPoints.length; i++) { + obj = dataPoints[i]; - fillPath.setAttributeNS(null, 'class', group.className + ' vis-fill'); - if (group.options.shaded.style !== undefined) { - fillPath.setAttributeNS(null, 'style', group.options.shaded.style); - } - fillPath.setAttributeNS(null, 'd', dFill); + // TODO: implement Array().indexOf() for Internet Explorer + var xIndex = dataX.indexOf(obj.point.x); + var yIndex = dataY.indexOf(obj.point.y); + + if (dataMatrix[xIndex] === undefined) { + dataMatrix[xIndex] = []; } - }; - /** - * draw a line graph - * - * @param dataset - * @param group - */ - Line.draw = function (pathArray, group, framework) { - if (pathArray != null && pathArray != undefined) { - var path = DOMutil.getSVGElement('path', framework.svgElements, framework.svg); - path.setAttributeNS(null, "class", group.className); - if (group.style !== undefined) { - path.setAttributeNS(null, "style", group.style); - } + dataMatrix[xIndex][yIndex] = obj; + } - var type = "L"; - if (group.options.interpolation.enabled == true) { - type = "C"; - } - // copy properties to path for drawing. - path.setAttributeNS(null, 'd', 'M' + pathArray[0][0] + "," + pathArray[0][1] + " " + this.serializePath(pathArray, type, false)); + // fill in the pointers to the neighbors. + for (x = 0; x < dataMatrix.length; x++) { + for (y = 0; y < dataMatrix[x].length; y++) { + if (dataMatrix[x][y]) { + dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined; + dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined; + dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined; + } } - }; + } + } else { + // 'dot', 'dot-line', etc. + this._checkValueField(data); + dataPoints = this.getDataPoints(data); - Line.serializePath = function (pathArray, type, inverse) { - if (pathArray.length < 2) { - //Too little data to create a path. - return ""; - } - var d = type; - if (inverse) { - for (var i = pathArray.length - 2; i > 0; i--) { - d += pathArray[i][0] + "," + pathArray[i][1] + " "; - } - } else { - for (var i = 1; i < pathArray.length; i++) { - d += pathArray[i][0] + "," + pathArray[i][1] + " "; - } + if (this.style === Graph3d.STYLE.LINE) { + // Add next member points for line drawing + for (i = 0; i < dataPoints.length; i++) { + if (i > 0) { + dataPoints[i - 1].pointNext = dataPoints[i]; + } } - return d; - }; + } + } - /** - * This uses an uniform parametrization of the interpolation algorithm: - * 'On the Parameterization of Catmull-Rom Curves' by Cem Yuksel et al. - * @param data - * @returns {string} - * @private - */ - Line._catmullRomUniform = function (data) { - // catmull rom - var p0, p1, p2, p3, bp1, bp2; - var d = []; - d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]); - var normalization = 1 / 6; - var length = data.length; - for (var i = 0; i < length - 1; i++) { - - p0 = i == 0 ? data[0] : data[i - 1]; - p1 = data[i]; - p2 = data[i + 1]; - p3 = i + 2 < length ? data[i + 2] : p2; - - // Catmull-Rom to Cubic Bezier conversion matrix - // 0 1 0 0 - // -1/6 1 1/6 0 - // 0 1/6 1 -1/6 - // 0 0 1 0 - - // bp0 = { x: p1.x, y: p1.y }; - bp1 = { - screen_x: (-p0.screen_x + 6 * p1.screen_x + p2.screen_x) * normalization, - screen_y: (-p0.screen_y + 6 * p1.screen_y + p2.screen_y) * normalization - }; - bp2 = { - screen_x: (p1.screen_x + 6 * p2.screen_x - p3.screen_x) * normalization, - screen_y: (p1.screen_y + 6 * p2.screen_y - p3.screen_y) * normalization - }; - // bp0 = { x: p2.x, y: p2.y }; + return dataPoints; +}; - d.push([bp1.screen_x, bp1.screen_y]); - d.push([bp2.screen_x, bp2.screen_y]); - d.push([p2.screen_x, p2.screen_y]); - } +/** + * Create the main frame for the Graph3d. + * + * This function is executed once when a Graph3d object is created. The frame + * contains a canvas, and this canvas contains all objects like the axis and + * nodes. + */ +Graph3d.prototype.create = function () { + // remove all elements from the container element. + while (this.containerElement.hasChildNodes()) { + this.containerElement.removeChild(this.containerElement.firstChild); + } + + this.frame = document.createElement('div'); + this.frame.style.position = 'relative'; + this.frame.style.overflow = 'hidden'; + + // create the graph canvas (HTML canvas element) + this.frame.canvas = document.createElement('canvas'); + this.frame.canvas.style.position = 'relative'; + this.frame.appendChild(this.frame.canvas); + //if (!this.frame.canvas.getContext) { + { + var noCanvas = document.createElement('DIV'); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold'; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.frame.canvas.appendChild(noCanvas); + } + + this.frame.filter = document.createElement('div'); + this.frame.filter.style.position = 'absolute'; + this.frame.filter.style.bottom = '0px'; + this.frame.filter.style.left = '0px'; + this.frame.filter.style.width = '100%'; + this.frame.appendChild(this.frame.filter); + + // add event listeners to handle moving and zooming the contents + var me = this; + var onmousedown = function onmousedown(event) { + me._onMouseDown(event); + }; + var ontouchstart = function ontouchstart(event) { + me._onTouchStart(event); + }; + var onmousewheel = function onmousewheel(event) { + me._onWheel(event); + }; + var ontooltip = function ontooltip(event) { + me._onTooltip(event); + }; + var onclick = function onclick(event) { + me._onClick(event); + }; + // TODO: these events are never cleaned up... can give a 'memory leakage' + + util.addEventListener(this.frame.canvas, 'mousedown', onmousedown); + util.addEventListener(this.frame.canvas, 'touchstart', ontouchstart); + util.addEventListener(this.frame.canvas, 'mousewheel', onmousewheel); + util.addEventListener(this.frame.canvas, 'mousemove', ontooltip); + util.addEventListener(this.frame.canvas, 'click', onclick); + + // add the new graph to the container element + this.containerElement.appendChild(this.frame); +}; - return d; - }; +/** + * Set a new size for the graph + * + * @param {number} width + * @param {number} height + * @private + */ +Graph3d.prototype._setSize = function (width, height) { + this.frame.style.width = width; + this.frame.style.height = height; - /** - * This uses either the chordal or centripetal parameterization of the catmull-rom algorithm. - * By default, the centripetal parameterization is used because this gives the nicest results. - * These parameterizations are relatively heavy because the distance between 4 points have to be calculated. - * - * One optimization can be used to reuse distances since this is a sliding window approach. - * @param data - * @param group - * @returns {string} - * @private - */ - Line._catmullRom = function (data, group) { - var alpha = group.options.interpolation.alpha; - if (alpha == 0 || alpha === undefined) { - return this._catmullRomUniform(data); - } else { - var p0, p1, p2, p3, bp1, bp2, d1, d2, d3, A, B, N, M; - var d3powA, d2powA, d3pow2A, d2pow2A, d1pow2A, d1powA; - var d = []; - d.push([Math.round(data[0].screen_x), Math.round(data[0].screen_y)]); - var length = data.length; - for (var i = 0; i < length - 1; i++) { - - p0 = i == 0 ? data[0] : data[i - 1]; - p1 = data[i]; - p2 = data[i + 1]; - p3 = i + 2 < length ? data[i + 2] : p2; - - d1 = Math.sqrt(Math.pow(p0.screen_x - p1.screen_x, 2) + Math.pow(p0.screen_y - p1.screen_y, 2)); - d2 = Math.sqrt(Math.pow(p1.screen_x - p2.screen_x, 2) + Math.pow(p1.screen_y - p2.screen_y, 2)); - d3 = Math.sqrt(Math.pow(p2.screen_x - p3.screen_x, 2) + Math.pow(p2.screen_y - p3.screen_y, 2)); - - // Catmull-Rom to Cubic Bezier conversion matrix - - // A = 2d1^2a + 3d1^a * d2^a + d3^2a - // B = 2d3^2a + 3d3^a * d2^a + d2^2a - - // [ 0 1 0 0 ] - // [ -d2^2a /N A/N d1^2a /N 0 ] - // [ 0 d3^2a /M B/M -d2^2a /M ] - // [ 0 0 1 0 ] - - d3powA = Math.pow(d3, alpha); - d3pow2A = Math.pow(d3, 2 * alpha); - d2powA = Math.pow(d2, alpha); - d2pow2A = Math.pow(d2, 2 * alpha); - d1powA = Math.pow(d1, alpha); - d1pow2A = Math.pow(d1, 2 * alpha); - - A = 2 * d1pow2A + 3 * d1powA * d2powA + d2pow2A; - B = 2 * d3pow2A + 3 * d3powA * d2powA + d2pow2A; - N = 3 * d1powA * (d1powA + d2powA); - if (N > 0) { - N = 1 / N; - } - M = 3 * d3powA * (d3powA + d2powA); - if (M > 0) { - M = 1 / M; - } + this._resizeCanvas(); +}; - bp1 = { - screen_x: (-d2pow2A * p0.screen_x + A * p1.screen_x + d1pow2A * p2.screen_x) * N, - screen_y: (-d2pow2A * p0.screen_y + A * p1.screen_y + d1pow2A * p2.screen_y) * N - }; +/** + * Resize the canvas to the current size of the frame + */ +Graph3d.prototype._resizeCanvas = function () { + this.frame.canvas.style.width = '100%'; + this.frame.canvas.style.height = '100%'; - bp2 = { - screen_x: (d3pow2A * p1.screen_x + B * p2.screen_x - d2pow2A * p3.screen_x) * M, - screen_y: (d3pow2A * p1.screen_y + B * p2.screen_y - d2pow2A * p3.screen_y) * M - }; + this.frame.canvas.width = this.frame.canvas.clientWidth; + this.frame.canvas.height = this.frame.canvas.clientHeight; - if (bp1.screen_x == 0 && bp1.screen_y == 0) { - bp1 = p1; - } - if (bp2.screen_x == 0 && bp2.screen_y == 0) { - bp2 = p2; - } - d.push([bp1.screen_x, bp1.screen_y]); - d.push([bp2.screen_x, bp2.screen_y]); - d.push([p2.screen_x, p2.screen_y]); - } + // adjust with for margin + this.frame.filter.style.width = this.frame.canvas.clientWidth - 2 * 10 + 'px'; +}; - return d; - } - }; +/** + * Start playing the animation, if requested and filter present. Only applicable + * when animation data is available. + */ +Graph3d.prototype.animationStart = function () { + // start animation when option is true + if (!this.animationAutoStart || !this.dataGroup.dataFilter) return; - /** - * this generates the SVG path for a linear drawing between datapoints. - * @param data - * @returns {string} - * @private - */ - Line._linear = function (data) { - // linear - var d = []; - for (var i = 0; i < data.length; i++) { - d.push([data[i].screen_x, data[i].screen_y]); - } - return d; - }; + if (!this.frame.filter || !this.frame.filter.slider) throw new Error('No animation available'); - module.exports = Line; + this.frame.filter.slider.play(); +}; -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Stop animation + */ +Graph3d.prototype.animationStop = function () { + if (!this.frame.filter || !this.frame.filter.slider) return; - 'use strict'; + this.frame.filter.slider.stop(); +}; - var _keys = __webpack_require__(58); +/** + * Resize the center position based on the current values in this.xCenter + * and this.yCenter (which are strings with a percentage or a value + * in pixels). The center positions are the variables this.currentXCenter + * and this.currentYCenter + */ +Graph3d.prototype._resizeCenter = function () { + // calculate the horizontal center position + if (this.xCenter.charAt(this.xCenter.length - 1) === '%') { + this.currentXCenter = parseFloat(this.xCenter) / 100 * this.frame.canvas.clientWidth; + } else { + this.currentXCenter = parseFloat(this.xCenter); // supposed to be in px + } - var _keys2 = _interopRequireDefault(_keys); + // calculate the vertical center position + if (this.yCenter.charAt(this.yCenter.length - 1) === '%') { + this.currentYCenter = parseFloat(this.yCenter) / 100 * (this.frame.canvas.clientHeight - this.frame.filter.clientHeight); + } else { + this.currentYCenter = parseFloat(this.yCenter); // supposed to be in px + } +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +/** + * Retrieve the current camera rotation + * + * @returns {object} An object with parameters horizontal, vertical, and + * distance + */ +Graph3d.prototype.getCameraPosition = function () { + var pos = this.camera.getArmRotation(); + pos.distance = this.camera.getArmLength(); + return pos; +}; - var util = __webpack_require__(1); - var DOMutil = __webpack_require__(88); - var Component = __webpack_require__(121); +/** + * Load data into the 3D Graph + * + * @param {vis.DataSet} data + * @private + */ +Graph3d.prototype._readData = function (data) { + // read the data + this.dataPoints = this.dataGroup.initializeData(this, data, this.style); - /** - * Legend for Graph2d - */ - function Legend(body, options, side, linegraphOptions) { - this.body = body; - this.defaultOptions = { - enabled: false, - icons: true, - iconSize: 20, - iconSpacing: 6, - left: { - visible: true, - position: 'top-left' // top/bottom - left,center,right - }, - right: { - visible: true, - position: 'top-right' // top/bottom - left,center,right - } - }; + this._initializeRanges(); + this._redrawFilter(); +}; + +/** + * Replace the dataset of the Graph3d + * + * @param {Array | DataSet | DataView} data + */ +Graph3d.prototype.setData = function (data) { + if (data === undefined || data === null) return; - this.side = side; - this.options = util.extend({}, this.defaultOptions); - this.linegraphOptions = linegraphOptions; + this._readData(data); + this.redraw(); + this.animationStart(); +}; - this.svgElements = {}; - this.dom = {}; - this.groups = {}; - this.amountOfGroups = 0; - this._create(); - this.framework = { svg: this.svg, svgElements: this.svgElements, options: this.options, groups: this.groups }; +/** + * Update the options. Options will be merged with current options + * + * @param {Object} options + */ +Graph3d.prototype.setOptions = function (options) { + if (options === undefined) return; - this.setOptions(options); + var errorFound = Validator.validate(options, allOptions); + if (errorFound === true) { + console.log('%cErrors have been found in the supplied options object.', printStyle); } - Legend.prototype = new Component(); + this.animationStop(); - Legend.prototype.clear = function () { - this.groups = {}; - this.amountOfGroups = 0; - }; + Settings.setOptions(options, this); + this.setPointDrawingMethod(); + this._setSize(this.width, this.height); - Legend.prototype.addGroup = function (label, graphOptions) { + this.setData(this.dataGroup.getDataTable()); + this.animationStart(); +}; - // Include a group only if the group option 'excludeFromLegend: false' is not set. - if (graphOptions.options.excludeFromLegend != true) { - if (!this.groups.hasOwnProperty(label)) { - this.groups[label] = graphOptions; - } - this.amountOfGroups += 1; - } - }; +/** + * Determine which point drawing method to use for the current graph style. + */ +Graph3d.prototype.setPointDrawingMethod = function () { + var method = undefined; + + switch (this.style) { + case Graph3d.STYLE.BAR: + method = Graph3d.prototype._redrawBarGraphPoint; + break; + case Graph3d.STYLE.BARCOLOR: + method = Graph3d.prototype._redrawBarColorGraphPoint; + break; + case Graph3d.STYLE.BARSIZE: + method = Graph3d.prototype._redrawBarSizeGraphPoint; + break; + case Graph3d.STYLE.DOT: + method = Graph3d.prototype._redrawDotGraphPoint; + break; + case Graph3d.STYLE.DOTLINE: + method = Graph3d.prototype._redrawDotLineGraphPoint; + break; + case Graph3d.STYLE.DOTCOLOR: + method = Graph3d.prototype._redrawDotColorGraphPoint; + break; + case Graph3d.STYLE.DOTSIZE: + method = Graph3d.prototype._redrawDotSizeGraphPoint; + break; + case Graph3d.STYLE.SURFACE: + method = Graph3d.prototype._redrawSurfaceGraphPoint; + break; + case Graph3d.STYLE.GRID: + method = Graph3d.prototype._redrawGridGraphPoint; + break; + case Graph3d.STYLE.LINE: + method = Graph3d.prototype._redrawLineGraphPoint; + break; + default: + throw new Error('Can not determine point drawing method ' + 'for graph style \'' + this.style + '\''); + } + + this._pointDrawingMethod = method; +}; - Legend.prototype.updateGroup = function (label, graphOptions) { - this.groups[label] = graphOptions; - }; +/** + * Redraw the Graph. + */ +Graph3d.prototype.redraw = function () { + if (this.dataPoints === undefined) { + throw new Error('Graph data not initialized'); + } - Legend.prototype.removeGroup = function (label) { - if (this.groups.hasOwnProperty(label)) { - delete this.groups[label]; - this.amountOfGroups -= 1; - } - }; + this._resizeCanvas(); + this._resizeCenter(); + this._redrawSlider(); + this._redrawClear(); + this._redrawAxis(); - Legend.prototype._create = function () { - this.dom.frame = document.createElement('div'); - this.dom.frame.className = 'vis-legend'; - this.dom.frame.style.position = "absolute"; - this.dom.frame.style.top = "10px"; - this.dom.frame.style.display = "block"; - - this.dom.textArea = document.createElement('div'); - this.dom.textArea.className = 'vis-legend-text'; - this.dom.textArea.style.position = "relative"; - this.dom.textArea.style.top = "0px"; - - this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); - this.svg.style.position = 'absolute'; - this.svg.style.top = 0 + 'px'; - this.svg.style.width = this.options.iconSize + 5 + 'px'; - this.svg.style.height = '100%'; - - this.dom.frame.appendChild(this.svg); - this.dom.frame.appendChild(this.dom.textArea); - }; + this._redrawDataGraph(); - /** - * Hide the component from the DOM - */ - Legend.prototype.hide = function () { - // remove the frame containing the items - if (this.dom.frame.parentNode) { - this.dom.frame.parentNode.removeChild(this.dom.frame); - } - }; + this._redrawInfo(); + this._redrawLegend(); +}; - /** - * Show the component in the DOM (when not already visible). - * @return {Boolean} changed - */ - Legend.prototype.show = function () { - // show frame containing the items - if (!this.dom.frame.parentNode) { - this.body.dom.center.appendChild(this.dom.frame); - } - }; +/** + * Get drawing context without exposing canvas + * + * @returns {CanvasRenderingContext2D} + * @private + */ +Graph3d.prototype._getContext = function () { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); - Legend.prototype.setOptions = function (options) { - var fields = ['enabled', 'orientation', 'icons', 'left', 'right']; - util.selectiveDeepExtend(fields, this.options, options); - }; + ctx.lineJoin = 'round'; + ctx.lineCap = 'round'; - Legend.prototype.redraw = function () { - var activeGroups = 0; - var groupArray = (0, _keys2['default'])(this.groups); - groupArray.sort(function (a, b) { - return a < b ? -1 : 1; - }); + return ctx; +}; - for (var i = 0; i < groupArray.length; i++) { - var groupId = groupArray[i]; - if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { - activeGroups++; - } - } +/** + * Clear the canvas before redrawing + */ +Graph3d.prototype._redrawClear = function () { + var canvas = this.frame.canvas; + var ctx = canvas.getContext('2d'); - if (this.options[this.side].visible == false || this.amountOfGroups == 0 || this.options.enabled == false || activeGroups == 0) { - this.hide(); - } else { - this.show(); - if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { - this.dom.frame.style.left = '4px'; - this.dom.frame.style.textAlign = "left"; - this.dom.textArea.style.textAlign = "left"; - this.dom.textArea.style.left = this.options.iconSize + 15 + 'px'; - this.dom.textArea.style.right = ''; - this.svg.style.left = 0 + 'px'; - this.svg.style.right = ''; - } else { - this.dom.frame.style.right = '4px'; - this.dom.frame.style.textAlign = "right"; - this.dom.textArea.style.textAlign = "right"; - this.dom.textArea.style.right = this.options.iconSize + 15 + 'px'; - this.dom.textArea.style.left = ''; - this.svg.style.right = 0 + 'px'; - this.svg.style.left = ''; - } - - if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { - this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; - this.dom.frame.style.bottom = ''; - } else { - var scrollableHeight = this.body.domProps.center.height - this.body.domProps.centerContainer.height; - this.dom.frame.style.bottom = 4 + scrollableHeight + Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; - this.dom.frame.style.top = ''; - } + ctx.clearRect(0, 0, canvas.width, canvas.height); +}; - if (this.options.icons == false) { - this.dom.frame.style.width = this.dom.textArea.offsetWidth + 10 + 'px'; - this.dom.textArea.style.right = ''; - this.dom.textArea.style.left = ''; - this.svg.style.width = '0px'; - } else { - this.dom.frame.style.width = this.options.iconSize + 15 + this.dom.textArea.offsetWidth + 10 + 'px'; - this.drawLegendIcons(); - } +Graph3d.prototype._dotSize = function () { + return this.frame.clientWidth * this.dotSizeRatio; +}; - var content = ''; - for (var i = 0; i < groupArray.length; i++) { - var groupId = groupArray[i]; - if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { - content += this.groups[groupId].content + '
'; - } - } - this.dom.textArea.innerHTML = content; - this.dom.textArea.style.lineHeight = 0.75 * this.options.iconSize + this.options.iconSpacing + 'px'; +/** + * Get legend width + * + * @returns {*} + * @private + */ +Graph3d.prototype._getLegendWidth = function () { + var width; + + if (this.style === Graph3d.STYLE.DOTSIZE) { + var dotSize = this._dotSize(); + //width = dotSize / 2 + dotSize * 2; + width = dotSize * this.dotSizeMaxFraction; + } else if (this.style === Graph3d.STYLE.BARSIZE) { + width = this.xBarWidth; + } else { + width = 20; + } + return width; +}; + +/** + * Redraw the legend based on size, dot color, or surface height + */ +Graph3d.prototype._redrawLegend = function () { + + //Return without drawing anything, if no legend is specified + if (this.showLegend !== true) { + return; + } + + // Do not draw legend when graph style does not support + if (this.style === Graph3d.STYLE.LINE || this.style === Graph3d.STYLE.BARSIZE //TODO add legend support for BARSIZE + ) { + return; } - }; - Legend.prototype.drawLegendIcons = function () { - if (this.dom.frame.parentNode) { - var groupArray = (0, _keys2['default'])(this.groups); - groupArray.sort(function (a, b) { - return a < b ? -1 : 1; - }); + // Legend types - size and color. Determine if size legend. + var isSizeLegend = this.style === Graph3d.STYLE.BARSIZE || this.style === Graph3d.STYLE.DOTSIZE; - // this resets the elements so the order is maintained - DOMutil.resetElements(this.svgElements); + // Legend is either tracking z values or style values. This flag if false means use z values. + var isValueLegend = this.style === Graph3d.STYLE.DOTSIZE || this.style === Graph3d.STYLE.DOTCOLOR || this.style === Graph3d.STYLE.BARCOLOR; - var padding = window.getComputedStyle(this.dom.frame).paddingTop; - var iconOffset = Number(padding.replace('px', '')); - var x = iconOffset; - var iconWidth = this.options.iconSize; - var iconHeight = 0.75 * this.options.iconSize; - var y = iconOffset + 0.5 * iconHeight + 3; + var height = Math.max(this.frame.clientHeight * 0.25, 100); + var top = this.margin; + var width = this._getLegendWidth(); // px - overwritten by size legend + var right = this.frame.clientWidth - this.margin; + var left = right - width; + var bottom = top + height; - this.svg.style.width = iconWidth + 5 + iconOffset + 'px'; + var ctx = this._getContext(); + ctx.lineWidth = 1; + ctx.font = '14px arial'; // TODO: put in options - for (var i = 0; i < groupArray.length; i++) { - var groupId = groupArray[i]; - if (this.groups[groupId].visible == true && (this.linegraphOptions.visibility[groupId] === undefined || this.linegraphOptions.visibility[groupId] == true)) { - this.groups[groupId].getLegend(iconWidth, iconHeight, this.framework, x, y); - y += iconHeight + this.options.iconSpacing; - } - } + if (isSizeLegend === false) { + // draw the color bar + var ymin = 0; + var ymax = height; // Todo: make height customizable + var y; + + for (y = ymin; y < ymax; y++) { + var f = (y - ymin) / (ymax - ymin); + var hue = f * 240; + var color = this._hsv2rgb(hue, 1, 1); + + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(left, top + y); + ctx.lineTo(right, top + y); + ctx.stroke(); } - }; + ctx.strokeStyle = this.axisColor; + ctx.strokeRect(left, top, width, height); + } else { - module.exports = Legend; + // draw the size legend box + var widthMin; + if (this.style === Graph3d.STYLE.DOTSIZE) { + // Get the proportion to max and min right + widthMin = width * (this.dotSizeMinFraction / this.dotSizeMaxFraction); + } else if (this.style === Graph3d.STYLE.BARSIZE) { + //widthMin = this.xBarWidth * 0.2 this is wrong - barwidth measures in terms of xvalues + } + ctx.strokeStyle = this.axisColor; + ctx.fillStyle = this.dataColor.fill; + ctx.beginPath(); + ctx.moveTo(left, top); + ctx.lineTo(right, top); + ctx.lineTo(left + widthMin, bottom); + ctx.lineTo(left, bottom); + ctx.closePath(); + ctx.fill(); + ctx.stroke(); + } -/***/ }), -/* 158 */ -/***/ (function(module, exports) { + // print value text along the legend edge + var gridLineLen = 5; // px - 'use strict'; + var legendMin = isValueLegend ? this.valueRange.min : this.zRange.min; + var legendMax = isValueLegend ? this.valueRange.max : this.zRange.max; + var step = new StepNumber(legendMin, legendMax, (legendMax - legendMin) / 5, true); + step.start(true); - Object.defineProperty(exports, "__esModule", { - value: true - }); - /** - * This object contains all possible options. It will check if the types are correct, if required if the option is one - * of the allowed values. - * - * __any__ means that the name of the property does not matter. - * __type__ is a required field for all objects and contains the allowed types of all objects - */ - var string = 'string'; - var bool = 'boolean'; - var number = 'number'; - var array = 'array'; - var date = 'date'; - var object = 'object'; // should only be in a __type__ property - var dom = 'dom'; - var moment = 'moment'; - var any = 'any'; - - var allOptions = { - configure: { - enabled: { 'boolean': bool }, - filter: { 'boolean': bool, 'function': 'function' }, - container: { dom: dom }, - __type__: { object: object, 'boolean': bool, 'function': 'function' } - }, + var from; + var to; + while (!step.end()) { + y = bottom - (step.getCurrent() - legendMin) / (legendMax - legendMin) * height; + from = new Point2d(left - gridLineLen, y); + to = new Point2d(left, y); + this._line(ctx, from, to); - //globals : - yAxisOrientation: { string: ['left', 'right'] }, - defaultGroup: { string: string }, - sort: { 'boolean': bool }, - sampling: { 'boolean': bool }, - stack: { 'boolean': bool }, - graphHeight: { string: string, number: number }, - shaded: { - enabled: { 'boolean': bool }, - orientation: { string: ['bottom', 'top', 'zero', 'group'] }, // top, bottom, zero, group - groupId: { object: object }, - __type__: { 'boolean': bool, object: object } - }, - style: { string: ['line', 'bar', 'points'] }, // line, bar - barChart: { - width: { number: number }, - minWidth: { number: number }, - sideBySide: { 'boolean': bool }, - align: { string: ['left', 'center', 'right'] }, - __type__: { object: object } - }, - interpolation: { - enabled: { 'boolean': bool }, - parametrization: { string: ['centripetal', 'chordal', 'uniform'] }, // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) - alpha: { number: number }, - __type__: { object: object, 'boolean': bool } - }, - drawPoints: { - enabled: { 'boolean': bool }, - onRender: { 'function': 'function' }, - size: { number: number }, - style: { string: ['square', 'circle'] }, // square, circle - __type__: { object: object, 'boolean': bool, 'function': 'function' } - }, - dataAxis: { - showMinorLabels: { 'boolean': bool }, - showMajorLabels: { 'boolean': bool }, - icons: { 'boolean': bool }, - width: { string: string, number: number }, - visible: { 'boolean': bool }, - alignZeros: { 'boolean': bool }, - left: { - range: { min: { number: number, 'undefined': 'undefined' }, max: { number: number, 'undefined': 'undefined' }, __type__: { object: object } }, - format: { 'function': 'function' }, - title: { text: { string: string, number: number, 'undefined': 'undefined' }, style: { string: string, 'undefined': 'undefined' }, __type__: { object: object } }, - __type__: { object: object } - }, - right: { - range: { min: { number: number, 'undefined': 'undefined' }, max: { number: number, 'undefined': 'undefined' }, __type__: { object: object } }, - format: { 'function': 'function' }, - title: { text: { string: string, number: number, 'undefined': 'undefined' }, style: { string: string, 'undefined': 'undefined' }, __type__: { object: object } }, - __type__: { object: object } - }, - __type__: { object: object } - }, - legend: { - enabled: { 'boolean': bool }, - icons: { 'boolean': bool }, - left: { - visible: { 'boolean': bool }, - position: { string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] }, - __type__: { object: object } - }, - right: { - visible: { 'boolean': bool }, - position: { string: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] }, - __type__: { object: object } - }, - __type__: { object: object, 'boolean': bool } - }, - groups: { - visibility: { any: any }, - __type__: { object: object } - }, + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.axisColor; + ctx.fillText(step.getCurrent(), left - 2 * gridLineLen, y); - autoResize: { 'boolean': bool }, - throttleRedraw: { number: number }, // TODO: DEPRICATED see https://github.com/almende/vis/issues/2511 - clickToUse: { 'boolean': bool }, - end: { number: number, date: date, string: string, moment: moment }, - format: { - minorLabels: { - millisecond: { string: string, 'undefined': 'undefined' }, - second: { string: string, 'undefined': 'undefined' }, - minute: { string: string, 'undefined': 'undefined' }, - hour: { string: string, 'undefined': 'undefined' }, - weekday: { string: string, 'undefined': 'undefined' }, - day: { string: string, 'undefined': 'undefined' }, - month: { string: string, 'undefined': 'undefined' }, - year: { string: string, 'undefined': 'undefined' }, - __type__: { object: object } - }, - majorLabels: { - millisecond: { string: string, 'undefined': 'undefined' }, - second: { string: string, 'undefined': 'undefined' }, - minute: { string: string, 'undefined': 'undefined' }, - hour: { string: string, 'undefined': 'undefined' }, - weekday: { string: string, 'undefined': 'undefined' }, - day: { string: string, 'undefined': 'undefined' }, - month: { string: string, 'undefined': 'undefined' }, - year: { string: string, 'undefined': 'undefined' }, - __type__: { object: object } - }, - __type__: { object: object } - }, - moment: { 'function': 'function' }, - height: { string: string, number: number }, - hiddenDates: { - start: { date: date, number: number, string: string, moment: moment }, - end: { date: date, number: number, string: string, moment: moment }, - repeat: { string: string }, - __type__: { object: object, array: array } - }, - locale: { string: string }, - locales: { - __any__: { any: any }, - __type__: { object: object } - }, - max: { date: date, number: number, string: string, moment: moment }, - maxHeight: { number: number, string: string }, - maxMinorChars: { number: number }, - min: { date: date, number: number, string: string, moment: moment }, - minHeight: { number: number, string: string }, - moveable: { 'boolean': bool }, - multiselect: { 'boolean': bool }, - orientation: { string: string }, - showCurrentTime: { 'boolean': bool }, - showMajorLabels: { 'boolean': bool }, - showMinorLabels: { 'boolean': bool }, - start: { date: date, number: number, string: string, moment: moment }, - timeAxis: { - scale: { string: string, 'undefined': 'undefined' }, - step: { number: number, 'undefined': 'undefined' }, - __type__: { object: object } - }, - width: { string: string, number: number }, - zoomable: { 'boolean': bool }, - zoomKey: { string: ['ctrlKey', 'altKey', 'metaKey', ''] }, - zoomMax: { number: number }, - zoomMin: { number: number }, - zIndex: { number: number }, - __type__: { object: object } - }; + step.next(); + } - var configureOptions = { - global: { - //yAxisOrientation: ['left','right'], // TDOO: enable as soon as Grahp2d doesn't crash when changing this on the fly - sort: true, - sampling: true, - stack: false, - shaded: { - enabled: false, - orientation: ['zero', 'top', 'bottom', 'group'] // zero, top, bottom - }, - style: ['line', 'bar', 'points'], // line, bar - barChart: { - width: [50, 5, 100, 5], - minWidth: [50, 5, 100, 5], - sideBySide: false, - align: ['left', 'center', 'right'] // left, center, right - }, - interpolation: { - enabled: true, - parametrization: ['centripetal', 'chordal', 'uniform'] // uniform (alpha = 0.0), chordal (alpha = 1.0), centripetal (alpha = 0.5) - }, - drawPoints: { - enabled: true, - size: [6, 2, 30, 1], - style: ['square', 'circle'] // square, circle - }, - dataAxis: { - showMinorLabels: true, - showMajorLabels: true, - icons: false, - width: [40, 0, 200, 1], - visible: true, - alignZeros: true, - left: { - //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined}, - //format: function (value) {return value;}, - title: { text: '', style: '' } - }, - right: { - //range: {min:'undefined': 'undefined'ined,max:'undefined': 'undefined'ined}, - //format: function (value) {return value;}, - title: { text: '', style: '' } - } - }, - legend: { - enabled: false, - icons: true, - left: { - visible: true, - position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right - }, - right: { - visible: true, - position: ['top-right', 'bottom-right', 'top-left', 'bottom-left'] // top/bottom - left,right - } - }, + ctx.textAlign = 'right'; + ctx.textBaseline = 'top'; + var label = this.legendLabel; + ctx.fillText(label, right, bottom + this.margin); +}; - autoResize: true, - clickToUse: false, - end: '', - format: { - minorLabels: { - millisecond: 'SSS', - second: 's', - minute: 'HH:mm', - hour: 'HH:mm', - weekday: 'ddd D', - day: 'D', - month: 'MMM', - year: 'YYYY' - }, - majorLabels: { - millisecond: 'HH:mm:ss', - second: 'D MMMM HH:mm', - minute: 'ddd D MMMM', - hour: 'ddd D MMMM', - weekday: 'MMMM YYYY', - day: 'MMMM YYYY', - month: 'YYYY', - year: '' - } - }, +/** + * Redraw the filter + */ +Graph3d.prototype._redrawFilter = function () { + var dataFilter = this.dataGroup.dataFilter; + var filter = this.frame.filter; + filter.innerHTML = ''; - height: '', - locale: '', - max: '', - maxHeight: '', - maxMinorChars: [7, 0, 20, 1], - min: '', - minHeight: '', - moveable: true, - orientation: ['both', 'bottom', 'top'], - showCurrentTime: false, - showMajorLabels: true, - showMinorLabels: true, - start: '', - width: '100%', - zoomable: true, - zoomKey: ['ctrlKey', 'altKey', 'metaKey', ''], - zoomMax: [315360000000000, 10, 315360000000000, 1], - zoomMin: [10, 10, 315360000000000, 1], - zIndex: 0 - } + if (!dataFilter) { + filter.slider = undefined; + return; + } + + var options = { + 'visible': this.showAnimationControls }; + var slider = new Slider(filter, options); + filter.slider = slider; - exports.allOptions = allOptions; - exports.configureOptions = configureOptions; + // TODO: css here is not nice here... + filter.style.padding = '10px'; + //this.frame.filter.style.backgroundColor = '#EFEFEF'; -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { + slider.setValues(dataFilter.values); + slider.setPlayInterval(this.animationInterval); - 'use strict'; + // create an event handler + var me = this; + var onchange = function onchange() { + var dataFilter = me.dataGroup.dataFilter; + var index = slider.getIndex(); - // utils - exports.util = __webpack_require__(1); - exports.DOMutil = __webpack_require__(88); - - // data - exports.DataSet = __webpack_require__(89); - exports.DataView = __webpack_require__(93); - exports.Queue = __webpack_require__(92); - - // Network - exports.Network = __webpack_require__(160); - exports.network = { - Images: __webpack_require__(165), - dotparser: __webpack_require__(162), - gephiParser: __webpack_require__(163), - allOptions: __webpack_require__(230) - }; - exports.network.convertDot = function (input) { - return exports.network.dotparser.DOTToGraph(input); - }; - exports.network.convertGephi = function (input, options) { - return exports.network.gephiParser.parseGephi(input, options); + dataFilter.selectValue(index); + me.dataPoints = dataFilter._getDataPoints(); + + me.redraw(); }; - // bundled external libraries - exports.moment = __webpack_require__(82); - exports.Hammer = __webpack_require__(113); - exports.keycharm = __webpack_require__(116); + slider.setOnChangeCallback(onchange); +}; -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Redraw the slider + */ +Graph3d.prototype._redrawSlider = function () { + if (this.frame.filter.slider !== undefined) { + this.frame.filter.slider.redraw(); + } +}; - 'use strict'; +/** + * Redraw common information + */ +Graph3d.prototype._redrawInfo = function () { + var info = this.dataGroup.getInfo(); + if (info === undefined) return; - // Load custom shapes into CanvasRenderingContext2D - __webpack_require__(161); - - var Emitter = __webpack_require__(99); - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); - var dotparser = __webpack_require__(162); - var gephiParser = __webpack_require__(163); - var Activator = __webpack_require__(141); - var locales = __webpack_require__(164); - - var Images = __webpack_require__(165)['default']; - var Groups = __webpack_require__(167)['default']; - var NodesHandler = __webpack_require__(168)['default']; - var EdgesHandler = __webpack_require__(201)['default']; - var PhysicsEngine = __webpack_require__(212)['default']; - var ClusterEngine = __webpack_require__(221)['default']; - var CanvasRenderer = __webpack_require__(223)['default']; - var Canvas = __webpack_require__(224)['default']; - var View = __webpack_require__(225)['default']; - var InteractionHandler = __webpack_require__(226)['default']; - var SelectionHandler = __webpack_require__(228)['default']; - var LayoutEngine = __webpack_require__(210)['default']; - var ManipulationSystem = __webpack_require__(229)['default']; - var Configurator = __webpack_require__(147)['default']; - var Validator = __webpack_require__(145)['default']; - - var _require = __webpack_require__(145), - printStyle = _require.printStyle; - - var _require2 = __webpack_require__(230), - allOptions = _require2.allOptions, - configureOptions = _require2.configureOptions; - - var KamadaKawai = __webpack_require__(231)['default']; + var ctx = this._getContext(); - /** - * @constructor Network - * Create a network visualization, displaying nodes and edges. - * - * @param {Element} container The DOM element in which the Network will - * be created. Normally a div element. - * @param {Object} data An object containing parameters - * {Array} nodes - * {Array} edges - * @param {Object} options Options - */ - function Network(container, data, options) { - var _this = this; + ctx.font = '14px arial'; // TODO: put in options + ctx.lineStyle = 'gray'; + ctx.fillStyle = 'gray'; + ctx.textAlign = 'left'; + ctx.textBaseline = 'top'; - if (!(this instanceof Network)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } + var x = this.margin; + var y = this.margin; + ctx.fillText(info, x, y); +}; - // set constant values - this.options = {}; - this.defaultOptions = { - locale: 'en', - locales: locales, - clickToUse: false - }; - util.extend(this.options, this.defaultOptions); +/** + * Draw a line between 2d points 'from' and 'to'. + * + * If stroke style specified, set that as well. + * + * @param {CanvasRenderingContext2D} ctx + * @param {vis.Point2d} from + * @param {vis.Point2d} to + * @param {string} [strokeStyle] + * @private + */ +Graph3d.prototype._line = function (ctx, from, to, strokeStyle) { + if (strokeStyle !== undefined) { + ctx.strokeStyle = strokeStyle; + } + + ctx.beginPath(); + ctx.moveTo(from.x, from.y); + ctx.lineTo(to.x, to.y); + ctx.stroke(); +}; - /** - * Containers for nodes and edges. - * - * 'edges' and 'nodes' contain the full definitions of all the network elements. - * 'nodeIndices' and 'edgeIndices' contain the id's of the active elements. - * - * The distinction is important, because a defined node need not be active, i.e. - * visible on the canvas. This happens in particular when clusters are defined, in - * that case there will be nodes and edges not displayed. - * The bottom line is that all code with actions related to visibility, *must* use - * 'nodeIndices' and 'edgeIndices', not 'nodes' and 'edges' directly. - */ - this.body = { - container: container, +/** + * + * @param {CanvasRenderingContext2D} ctx + * @param {vis.Point3d} point3d + * @param {string} text + * @param {number} armAngle + * @param {number} [yMargin=0] + */ +Graph3d.prototype.drawAxisLabelX = function (ctx, point3d, text, armAngle, yMargin) { + if (yMargin === undefined) { + yMargin = 0; + } - // See comment above for following fields - nodes: {}, - nodeIndices: [], - edges: {}, - edgeIndices: [], + var point2d = this._convert3Dto2D(point3d); - emitter: { - on: this.on.bind(this), - off: this.off.bind(this), - emit: this.emit.bind(this), - once: this.once.bind(this) - }, - eventListeners: { - onTap: function onTap() {}, - onTouch: function onTouch() {}, - onDoubleTap: function onDoubleTap() {}, - onHold: function onHold() {}, - onDragStart: function onDragStart() {}, - onDrag: function onDrag() {}, - onDragEnd: function onDragEnd() {}, - onMouseWheel: function onMouseWheel() {}, - onPinch: function onPinch() {}, - onMouseMove: function onMouseMove() {}, - onRelease: function onRelease() {}, - onContext: function onContext() {} - }, - data: { - nodes: null, // A DataSet or DataView - edges: null // A DataSet or DataView - }, - functions: { - createNode: function createNode() {}, - createEdge: function createEdge() {}, - getPointer: function getPointer() {} - }, - modules: {}, - view: { - scale: 1, - translation: { x: 0, y: 0 } - } - }; + if (Math.cos(armAngle * 2) > 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + point2d.y += yMargin; + } else if (Math.sin(armAngle * 2) < 0) { + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; + } - // bind the event listeners - this.bindEventListeners(); + ctx.fillStyle = this.axisColor; + ctx.fillText(text, point2d.x, point2d.y); +}; - // setting up all modules - this.images = new Images(function () { - return _this.body.emitter.emit("_requestRedraw"); - }); // object with images - this.groups = new Groups(); // object with groups - this.canvas = new Canvas(this.body); // DOM handler - this.selectionHandler = new SelectionHandler(this.body, this.canvas); // Selection handler - this.interactionHandler = new InteractionHandler(this.body, this.canvas, this.selectionHandler); // Interaction handler handles all the hammer bindings (that are bound by canvas), key - this.view = new View(this.body, this.canvas); // camera handler, does animations and zooms - this.renderer = new CanvasRenderer(this.body, this.canvas); // renderer, starts renderloop, has events that modules can hook into - this.physics = new PhysicsEngine(this.body); // physics engine, does all the simulations - this.layoutEngine = new LayoutEngine(this.body); // layout engine for inital layout and hierarchical layout - this.clustering = new ClusterEngine(this.body); // clustering api - this.manipulation = new ManipulationSystem(this.body, this.canvas, this.selectionHandler); // data manipulation system - - this.nodesHandler = new NodesHandler(this.body, this.images, this.groups, this.layoutEngine); // Handle adding, deleting and updating of nodes as well as global options - this.edgesHandler = new EdgesHandler(this.body, this.images, this.groups); // Handle adding, deleting and updating of edges as well as global options - - this.body.modules["kamadaKawai"] = new KamadaKawai(this.body, 150, 0.05); // Layouting algorithm. - this.body.modules["clustering"] = this.clustering; - - // create the DOM elements - this.canvas._create(); - - // apply options - this.setOptions(options); +/** + * + * @param {CanvasRenderingContext2D} ctx + * @param {vis.Point3d} point3d + * @param {string} text + * @param {number} armAngle + * @param {number} [yMargin=0] + */ +Graph3d.prototype.drawAxisLabelY = function (ctx, point3d, text, armAngle, yMargin) { + if (yMargin === undefined) { + yMargin = 0; + } - // load data (the disable start variable will be the same as the enabled clustering) - this.setData(data); + var point2d = this._convert3Dto2D(point3d); + + if (Math.cos(armAngle * 2) < 0) { + ctx.textAlign = 'center'; + ctx.textBaseline = 'top'; + point2d.y += yMargin; + } else if (Math.sin(armAngle * 2) > 0) { + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + } else { + ctx.textAlign = 'left'; + ctx.textBaseline = 'middle'; } - // Extend Network with an Emitter mixin - Emitter(Network.prototype); + ctx.fillStyle = this.axisColor; + ctx.fillText(text, point2d.x, point2d.y); +}; - /** - * Set options - * @param {Object} options - */ - Network.prototype.setOptions = function (options) { - var _this2 = this; +/** + * + * @param {CanvasRenderingContext2D} ctx + * @param {vis.Point3d} point3d + * @param {string} text + * @param {number} [offset=0] + */ +Graph3d.prototype.drawAxisLabelZ = function (ctx, point3d, text, offset) { + if (offset === undefined) { + offset = 0; + } + + var point2d = this._convert3Dto2D(point3d); + ctx.textAlign = 'right'; + ctx.textBaseline = 'middle'; + ctx.fillStyle = this.axisColor; + ctx.fillText(text, point2d.x - offset, point2d.y); +}; - if (options !== undefined) { - var errorFound = Validator.validate(options, allOptions); - if (errorFound === true) { - console.log('%cErrors have been found in the supplied options object.', printStyle); - } +/** + + +/** + * Draw a line between 2d points 'from' and 'to'. + * + * If stroke style specified, set that as well. + * + * @param {CanvasRenderingContext2D} ctx + * @param {vis.Point2d} from + * @param {vis.Point2d} to + * @param {string} [strokeStyle] + * @private + */ +Graph3d.prototype._line3d = function (ctx, from, to, strokeStyle) { + var from2d = this._convert3Dto2D(from); + var to2d = this._convert3Dto2D(to); + + this._line(ctx, from2d, to2d, strokeStyle); +}; - // copy the global fields over - var fields = ['locale', 'locales', 'clickToUse']; - util.selectiveDeepExtend(fields, this.options, options); +/** + * Redraw the axis + */ +Graph3d.prototype._redrawAxis = function () { + var ctx = this._getContext(), + from, + to, + step, + prettyStep, + text, + xText, + yText, + zText, + offset, + xOffset, + yOffset; + + // TODO: get the actual rendered style of the containerElement + //ctx.font = this.containerElement.style.font; + ctx.font = 24 / this.camera.getArmLength() + 'px arial'; + + // calculate the length for the short grid lines + var gridLenX = 0.025 / this.scale.x; + var gridLenY = 0.025 / this.scale.y; + var textMargin = 5 / this.camera.getArmLength(); // px + var armAngle = this.camera.getArmRotation().horizontal; + var armVector = new Point2d(Math.cos(armAngle), Math.sin(armAngle)); + + var xRange = this.xRange; + var yRange = this.yRange; + var zRange = this.zRange; + var point3d; + + // draw x-grid lines + ctx.lineWidth = 1; + prettyStep = this.defaultXStep === undefined; + step = new StepNumber(xRange.min, xRange.max, this.xStep, prettyStep); + step.start(true); + + while (!step.end()) { + var x = step.getCurrent(); + + if (this.showGrid) { + from = new Point3d(x, yRange.min, zRange.min); + to = new Point3d(x, yRange.max, zRange.min); + this._line3d(ctx, from, to, this.gridColor); + } else if (this.showXAxis) { + from = new Point3d(x, yRange.min, zRange.min); + to = new Point3d(x, yRange.min + gridLenX, zRange.min); + this._line3d(ctx, from, to, this.axisColor); - // the hierarchical system can adapt the edges and the physics to it's own options because not all combinations work with the hierarichical system. - options = this.layoutEngine.setOptions(options.layout, options); + from = new Point3d(x, yRange.max, zRange.min); + to = new Point3d(x, yRange.max - gridLenX, zRange.min); + this._line3d(ctx, from, to, this.axisColor); + } - this.canvas.setOptions(options); // options for canvas are in globals + if (this.showXAxis) { + yText = armVector.x > 0 ? yRange.min : yRange.max; + point3d = new Point3d(x, yText, zRange.min); + var msg = ' ' + this.xValueLabel(x) + ' '; + this.drawAxisLabelX(ctx, point3d, msg, armAngle, textMargin); + } - // pass the options to the modules - this.groups.setOptions(options.groups); - this.nodesHandler.setOptions(options.nodes); - this.edgesHandler.setOptions(options.edges); - this.physics.setOptions(options.physics); - this.manipulation.setOptions(options.manipulation, options, this.options); // manipulation uses the locales in the globals + step.next(); + } - this.interactionHandler.setOptions(options.interaction); - this.renderer.setOptions(options.interaction); // options for rendering are in interaction - this.selectionHandler.setOptions(options.interaction); // options for selection are in interaction + // draw y-grid lines + ctx.lineWidth = 1; + prettyStep = this.defaultYStep === undefined; + step = new StepNumber(yRange.min, yRange.max, this.yStep, prettyStep); + step.start(true); - // reload the settings of the nodes to apply changes in groups that are not referenced by pointer. - if (options.groups !== undefined) { - this.body.emitter.emit("refreshNodes"); - } - // these two do not have options at the moment, here for completeness - //this.view.setOptions(options.view); - //this.clustering.setOptions(options.clustering); + while (!step.end()) { + var y = step.getCurrent(); - if ('configure' in options) { - if (!this.configurator) { - this.configurator = new Configurator(this, this.body.container, configureOptions, this.canvas.pixelRatio); - } + if (this.showGrid) { + from = new Point3d(xRange.min, y, zRange.min); + to = new Point3d(xRange.max, y, zRange.min); + this._line3d(ctx, from, to, this.gridColor); + } else if (this.showYAxis) { + from = new Point3d(xRange.min, y, zRange.min); + to = new Point3d(xRange.min + gridLenY, y, zRange.min); + this._line3d(ctx, from, to, this.axisColor); - this.configurator.setOptions(options.configure); - } + from = new Point3d(xRange.max, y, zRange.min); + to = new Point3d(xRange.max - gridLenY, y, zRange.min); + this._line3d(ctx, from, to, this.axisColor); + } - // if the configuration system is enabled, copy all options and put them into the config system - if (this.configurator && this.configurator.options.enabled === true) { - var networkOptions = { nodes: {}, edges: {}, layout: {}, interaction: {}, manipulation: {}, physics: {}, global: {} }; - util.deepExtend(networkOptions.nodes, this.nodesHandler.options); - util.deepExtend(networkOptions.edges, this.edgesHandler.options); - util.deepExtend(networkOptions.layout, this.layoutEngine.options); - // load the selectionHandler and render default options in to the interaction group - util.deepExtend(networkOptions.interaction, this.selectionHandler.options); - util.deepExtend(networkOptions.interaction, this.renderer.options); + if (this.showYAxis) { + xText = armVector.y > 0 ? xRange.min : xRange.max; + point3d = new Point3d(xText, y, zRange.min); + var _msg = ' ' + this.yValueLabel(y) + ' '; + this.drawAxisLabelY(ctx, point3d, _msg, armAngle, textMargin); + } - util.deepExtend(networkOptions.interaction, this.interactionHandler.options); - util.deepExtend(networkOptions.manipulation, this.manipulation.options); - util.deepExtend(networkOptions.physics, this.physics.options); + step.next(); + } - // load globals into the global object - util.deepExtend(networkOptions.global, this.canvas.options); - util.deepExtend(networkOptions.global, this.options); + // draw z-grid lines and axis + if (this.showZAxis) { + ctx.lineWidth = 1; + prettyStep = this.defaultZStep === undefined; + step = new StepNumber(zRange.min, zRange.max, this.zStep, prettyStep); + step.start(true); - this.configurator.setModuleOptions(networkOptions); - } + xText = armVector.x > 0 ? xRange.min : xRange.max; + yText = armVector.y < 0 ? yRange.min : yRange.max; - // handle network global options - if (options.clickToUse !== undefined) { - if (options.clickToUse === true) { - if (this.activator === undefined) { - this.activator = new Activator(this.canvas.frame); - this.activator.on('change', function () { - _this2.body.emitter.emit("activate"); - }); - } - } else { - if (this.activator !== undefined) { - this.activator.destroy(); - delete this.activator; - } - this.body.emitter.emit("activate"); - } - } else { - this.body.emitter.emit("activate"); - } + while (!step.end()) { + var z = step.getCurrent(); - this.canvas.setSize(); - // start the physics simulation. Can be safely called multiple times. - this.body.emitter.emit("startSimulation"); - } - }; + // TODO: make z-grid lines really 3d? + var from3d = new Point3d(xText, yText, z); + var from2d = this._convert3Dto2D(from3d); + to = new Point2d(from2d.x - textMargin, from2d.y); + this._line(ctx, from2d, to, this.axisColor); - /** - * Update the this.body.nodeIndices with the most recent node index list - * @private - */ - Network.prototype._updateVisibleIndices = function () { - var nodes = this.body.nodes; - var edges = this.body.edges; - this.body.nodeIndices = []; - this.body.edgeIndices = []; + var _msg2 = this.zValueLabel(z) + ' '; + this.drawAxisLabelZ(ctx, from3d, _msg2, 5); - for (var nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - if (nodes[nodeId].options.hidden === false) { - this.body.nodeIndices.push(nodes[nodeId].id); - } - } + step.next(); } - for (var edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - if (edges[edgeId].options.hidden === false) { - this.body.edgeIndices.push(edges[edgeId].id); - } - } - } - }; + ctx.lineWidth = 1; + from = new Point3d(xText, yText, zRange.min); + to = new Point3d(xText, yText, zRange.max); + this._line3d(ctx, from, to, this.axisColor); + } - /** - * Bind all events - */ - Network.prototype.bindEventListeners = function () { - var _this3 = this; + // draw x-axis + if (this.showXAxis) { + var xMin2d; + var xMax2d; + ctx.lineWidth = 1; - // this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed. - this.body.emitter.on("_dataChanged", function () { - // update shortcut lists - _this3._updateVisibleIndices(); - _this3.body.emitter.emit("_requestRedraw"); - // call the dataUpdated event because the only difference between the two is the updating of the indices - _this3.body.emitter.emit("_dataUpdated"); - }); + // line at yMin + xMin2d = new Point3d(xRange.min, yRange.min, zRange.min); + xMax2d = new Point3d(xRange.max, yRange.min, zRange.min); + this._line3d(ctx, xMin2d, xMax2d, this.axisColor); + // line at ymax + xMin2d = new Point3d(xRange.min, yRange.max, zRange.min); + xMax2d = new Point3d(xRange.max, yRange.max, zRange.min); + this._line3d(ctx, xMin2d, xMax2d, this.axisColor); + } - // this is called when options of EXISTING nodes or edges have changed. - this.body.emitter.on("_dataUpdated", function () { - // update values - _this3._updateValueRange(_this3.body.nodes); - _this3._updateValueRange(_this3.body.edges); - // start simulation (can be called safely, even if already running) - _this3.body.emitter.emit("startSimulation"); - _this3.body.emitter.emit("_requestRedraw"); - }); - }; + // draw y-axis + if (this.showYAxis) { + ctx.lineWidth = 1; + // line at xMin + from = new Point3d(xRange.min, yRange.min, zRange.min); + to = new Point3d(xRange.min, yRange.max, zRange.min); + this._line3d(ctx, from, to, this.axisColor); + // line at xMax + from = new Point3d(xRange.max, yRange.min, zRange.min); + to = new Point3d(xRange.max, yRange.max, zRange.min); + this._line3d(ctx, from, to, this.axisColor); + } + + // draw x-label + var xLabel = this.xLabel; + if (xLabel.length > 0 && this.showXAxis) { + yOffset = 0.1 / this.scale.y; + xText = (xRange.max + 3 * xRange.min) / 4; + yText = armVector.x > 0 ? yRange.min - yOffset : yRange.max + yOffset; + text = new Point3d(xText, yText, zRange.min); + this.drawAxisLabelX(ctx, text, xLabel, armAngle); + } + + // draw y-label + var yLabel = this.yLabel; + if (yLabel.length > 0 && this.showYAxis) { + xOffset = 0.1 / this.scale.x; + xText = armVector.y > 0 ? xRange.min - xOffset : xRange.max + xOffset; + yText = (yRange.max + 3 * yRange.min) / 4; + text = new Point3d(xText, yText, zRange.min); + + this.drawAxisLabelY(ctx, text, yLabel, armAngle); + } + + // draw z-label + var zLabel = this.zLabel; + if (zLabel.length > 0 && this.showZAxis) { + offset = 30; // pixels. // TODO: relate to the max width of the values on the z axis? + xText = armVector.x > 0 ? xRange.min : xRange.max; + yText = armVector.y < 0 ? yRange.min : yRange.max; + zText = (zRange.max + 3 * zRange.min) / 4; + text = new Point3d(xText, yText, zText); + + this.drawAxisLabelZ(ctx, text, zLabel, offset); + } +}; - /** - * Set nodes and edges, and optionally options as well. - * - * @param {Object} data Object containing parameters: - * {Array | DataSet | DataView} [nodes] Array with nodes - * {Array | DataSet | DataView} [edges] Array with edges - * {String} [dot] String containing data in DOT format - * {String} [gephi] String containing data in gephi JSON format - * {Options} [options] Object with options - */ - Network.prototype.setData = function (data) { - // reset the physics engine. - this.body.emitter.emit("resetPhysics"); - this.body.emitter.emit("_resetData"); - - // unselect all to ensure no selections from old data are carried over. - this.selectionHandler.unselectAll(); - - if (data && data.dot && (data.nodes || data.edges)) { - throw new SyntaxError('Data must contain either parameter "dot" or ' + ' parameter pair "nodes" and "edges", but not both.'); - } - - // set options - this.setOptions(data && data.options); - // set all data - if (data && data.dot) { - console.log('The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);'); - // parse DOT file - var dotData = dotparser.DOTToGraph(data.dot); - this.setData(dotData); - return; - } else if (data && data.gephi) { - // parse DOT file - console.log('The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);'); - var gephiData = gephiParser.parseGephi(data.gephi); - this.setData(gephiData); - return; +/** + * Calculate the color based on the given value. + * @param {number} H Hue, a value be between 0 and 360 + * @param {number} S Saturation, a value between 0 and 1 + * @param {number} V Value, a value between 0 and 1 + * @returns {string} + * @private + */ +Graph3d.prototype._hsv2rgb = function (H, S, V) { + var R, G, B, C, Hi, X; + + C = V * S; + Hi = Math.floor(H / 60); // hi = 0,1,2,3,4,5 + X = C * (1 - Math.abs(H / 60 % 2 - 1)); + + switch (Hi) { + case 0: + R = C;G = X;B = 0;break; + case 1: + R = X;G = C;B = 0;break; + case 2: + R = 0;G = C;B = X;break; + case 3: + R = 0;G = X;B = C;break; + case 4: + R = X;G = 0;B = C;break; + case 5: + R = C;G = 0;B = X;break; + + default: + R = 0;G = 0;B = 0;break; + } + + return 'RGB(' + parseInt(R * 255) + ',' + parseInt(G * 255) + ',' + parseInt(B * 255) + ')'; +}; + +/** + * + * @param {vis.Point3d} point + * @returns {*} + * @private + */ +Graph3d.prototype._getStrokeWidth = function (point) { + if (point !== undefined) { + if (this.showPerspective) { + return 1 / -point.trans.z * this.dataColor.strokeWidth; } else { - this.nodesHandler.setData(data && data.nodes, true); - this.edgesHandler.setData(data && data.edges, true); + return -(this.eye.z / this.camera.getArmLength()) * this.dataColor.strokeWidth; } + } - // emit change in data - this.body.emitter.emit("_dataChanged"); + return this.dataColor.strokeWidth; +}; - // emit data loaded - this.body.emitter.emit("_dataLoaded"); +// ----------------------------------------------------------------------------- +// Drawing primitives for the graphs +// ----------------------------------------------------------------------------- - // find a stable position or start animating to a stable position - this.body.emitter.emit("initPhysics"); - }; - /** - * Cleans up all bindings of the network, removing it fully from the memory IF the variable is set to null after calling this function. - * var network = new vis.Network(..); - * network.destroy(); - * network = null; - */ - Network.prototype.destroy = function () { - this.body.emitter.emit("destroy"); - // clear events - this.body.emitter.off(); - this.off(); - - // delete modules - delete this.groups; - delete this.canvas; - delete this.selectionHandler; - delete this.interactionHandler; - delete this.view; - delete this.renderer; - delete this.physics; - delete this.layoutEngine; - delete this.clustering; - delete this.manipulation; - delete this.nodesHandler; - delete this.edgesHandler; - delete this.configurator; - delete this.images; - - for (var nodeId in this.body.nodes) { - delete this.body.nodes[nodeId]; - } - for (var edgeId in this.body.edges) { - delete this.body.edges[edgeId]; - } - - // remove the container and everything inside it recursively - util.recursiveDOMDelete(this.body.container); - }; +/** + * Draw a bar element in the view with the given properties. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @param {number} xWidth + * @param {number} yWidth + * @param {string} color + * @param {string} borderColor + * @private + */ +Graph3d.prototype._redrawBar = function (ctx, point, xWidth, yWidth, color, borderColor) { + var surface; + + // calculate all corner points + var me = this; + var point3d = point.point; + var zMin = this.zRange.min; + var top = [{ point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, point3d.z) }, { point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, point3d.z) }, { point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, point3d.z) }, { point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, point3d.z) }]; + var bottom = [{ point: new Point3d(point3d.x - xWidth, point3d.y - yWidth, zMin) }, { point: new Point3d(point3d.x + xWidth, point3d.y - yWidth, zMin) }, { point: new Point3d(point3d.x + xWidth, point3d.y + yWidth, zMin) }, { point: new Point3d(point3d.x - xWidth, point3d.y + yWidth, zMin) }]; + + // calculate screen location of the points + top.forEach(function (obj) { + obj.screen = me._convert3Dto2D(obj.point); + }); + bottom.forEach(function (obj) { + obj.screen = me._convert3Dto2D(obj.point); + }); - /** - * Update the values of all object in the given array according to the current - * value range of the objects in the array. - * @param {Object} obj An object containing a set of Edges or Nodes - * The objects must have a method getValue() and - * setValueRange(min, max). - * @private - */ - Network.prototype._updateValueRange = function (obj) { - var id; + // create five sides, calculate both corner points and center points + var surfaces = [{ corners: top, center: Point3d.avg(bottom[0].point, bottom[2].point) }, { corners: [top[0], top[1], bottom[1], bottom[0]], center: Point3d.avg(bottom[1].point, bottom[0].point) }, { corners: [top[1], top[2], bottom[2], bottom[1]], center: Point3d.avg(bottom[2].point, bottom[1].point) }, { corners: [top[2], top[3], bottom[3], bottom[2]], center: Point3d.avg(bottom[3].point, bottom[2].point) }, { corners: [top[3], top[0], bottom[0], bottom[3]], center: Point3d.avg(bottom[0].point, bottom[3].point) }]; + point.surfaces = surfaces; - // determine the range of the objects - var valueMin = undefined; - var valueMax = undefined; - var valueTotal = 0; - for (id in obj) { - if (obj.hasOwnProperty(id)) { - var value = obj[id].getValue(); - if (value !== undefined) { - valueMin = valueMin === undefined ? value : Math.min(value, valueMin); - valueMax = valueMax === undefined ? value : Math.max(value, valueMax); - valueTotal += value; - } - } - } + // calculate the distance of each of the surface centers to the camera + for (var j = 0; j < surfaces.length; j++) { + surface = surfaces[j]; + var transCenter = this._convertPointToTranslation(surface.center); + surface.dist = this.showPerspective ? transCenter.length() : -transCenter.z; + // TODO: this dept calculation doesn't work 100% of the cases due to perspective, + // but the current solution is fast/simple and works in 99.9% of all cases + // the issue is visible in example 14, with graph.setCameraPosition({horizontal: 2.97, vertical: 0.5, distance: 0.9}) + } - // adjust the range of all objects - if (valueMin !== undefined && valueMax !== undefined) { - for (id in obj) { - if (obj.hasOwnProperty(id)) { - obj[id].setValueRange(valueMin, valueMax, valueTotal); - } - } - } - }; + // order the surfaces by their (translated) depth + surfaces.sort(function (a, b) { + var diff = b.dist - a.dist; + if (diff) return diff; - /** - * Returns true when the Network is active. - * @returns {boolean} - */ - Network.prototype.isActive = function () { - return !this.activator || this.activator.active; - }; + // if equal depth, sort the top surface last + if (a.corners === top) return 1; + if (b.corners === top) return -1; - Network.prototype.setSize = function () { - return this.canvas.setSize.apply(this.canvas, arguments); - }; - Network.prototype.canvasToDOM = function () { - return this.canvas.canvasToDOM.apply(this.canvas, arguments); - }; - Network.prototype.DOMtoCanvas = function () { - return this.canvas.DOMtoCanvas.apply(this.canvas, arguments); - }; - Network.prototype.findNode = function () { - return this.clustering.findNode.apply(this.clustering, arguments); - }; - Network.prototype.isCluster = function () { - return this.clustering.isCluster.apply(this.clustering, arguments); - }; - Network.prototype.openCluster = function () { - return this.clustering.openCluster.apply(this.clustering, arguments); - }; - Network.prototype.cluster = function () { - return this.clustering.cluster.apply(this.clustering, arguments); - }; - Network.prototype.getNodesInCluster = function () { - return this.clustering.getNodesInCluster.apply(this.clustering, arguments); - }; - Network.prototype.clusterByConnection = function () { - return this.clustering.clusterByConnection.apply(this.clustering, arguments); - }; - Network.prototype.clusterByHubsize = function () { - return this.clustering.clusterByHubsize.apply(this.clustering, arguments); - }; - Network.prototype.clusterOutliers = function () { - return this.clustering.clusterOutliers.apply(this.clustering, arguments); - }; - Network.prototype.getSeed = function () { - return this.layoutEngine.getSeed.apply(this.layoutEngine, arguments); - }; - Network.prototype.enableEditMode = function () { - return this.manipulation.enableEditMode.apply(this.manipulation, arguments); - }; - Network.prototype.disableEditMode = function () { - return this.manipulation.disableEditMode.apply(this.manipulation, arguments); - }; - Network.prototype.addNodeMode = function () { - return this.manipulation.addNodeMode.apply(this.manipulation, arguments); - }; - Network.prototype.editNode = function () { - return this.manipulation.editNode.apply(this.manipulation, arguments); - }; - Network.prototype.editNodeMode = function () { - console.log("Deprecated: Please use editNode instead of editNodeMode.");return this.manipulation.editNode.apply(this.manipulation, arguments); - }; - Network.prototype.addEdgeMode = function () { - return this.manipulation.addEdgeMode.apply(this.manipulation, arguments); - }; - Network.prototype.editEdgeMode = function () { - return this.manipulation.editEdgeMode.apply(this.manipulation, arguments); - }; - Network.prototype.deleteSelected = function () { - return this.manipulation.deleteSelected.apply(this.manipulation, arguments); - }; - Network.prototype.getPositions = function () { - return this.nodesHandler.getPositions.apply(this.nodesHandler, arguments); - }; - Network.prototype.storePositions = function () { - return this.nodesHandler.storePositions.apply(this.nodesHandler, arguments); - }; - Network.prototype.moveNode = function () { - return this.nodesHandler.moveNode.apply(this.nodesHandler, arguments); - }; - Network.prototype.getBoundingBox = function () { - return this.nodesHandler.getBoundingBox.apply(this.nodesHandler, arguments); - }; - Network.prototype.getConnectedNodes = function (objectId) { - if (this.body.nodes[objectId] !== undefined) { - return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler, arguments); - } else { - return this.edgesHandler.getConnectedNodes.apply(this.edgesHandler, arguments); - } - }; - Network.prototype.getConnectedEdges = function () { - return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler, arguments); - }; - Network.prototype.startSimulation = function () { - return this.physics.startSimulation.apply(this.physics, arguments); - }; - Network.prototype.stopSimulation = function () { - return this.physics.stopSimulation.apply(this.physics, arguments); - }; - Network.prototype.stabilize = function () { - return this.physics.stabilize.apply(this.physics, arguments); - }; - Network.prototype.getSelection = function () { - return this.selectionHandler.getSelection.apply(this.selectionHandler, arguments); - }; - Network.prototype.setSelection = function () { - return this.selectionHandler.setSelection.apply(this.selectionHandler, arguments); - }; - Network.prototype.getSelectedNodes = function () { - return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler, arguments); - }; - Network.prototype.getSelectedEdges = function () { - return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler, arguments); - }; - Network.prototype.getNodeAt = function () { - var node = this.selectionHandler.getNodeAt.apply(this.selectionHandler, arguments); - if (node !== undefined && node.id !== undefined) { - return node.id; - } - return node; - }; - Network.prototype.getEdgeAt = function () { - var edge = this.selectionHandler.getEdgeAt.apply(this.selectionHandler, arguments); - if (edge !== undefined && edge.id !== undefined) { - return edge.id; - } - return edge; - }; - Network.prototype.selectNodes = function () { - return this.selectionHandler.selectNodes.apply(this.selectionHandler, arguments); - }; - Network.prototype.selectEdges = function () { - return this.selectionHandler.selectEdges.apply(this.selectionHandler, arguments); - }; - Network.prototype.unselectAll = function () { - this.selectionHandler.unselectAll.apply(this.selectionHandler, arguments); - this.redraw(); - }; - Network.prototype.redraw = function () { - return this.renderer.redraw.apply(this.renderer, arguments); - }; - Network.prototype.getScale = function () { - return this.view.getScale.apply(this.view, arguments); - }; - Network.prototype.getViewPosition = function () { - return this.view.getViewPosition.apply(this.view, arguments); - }; - Network.prototype.fit = function () { - return this.view.fit.apply(this.view, arguments); - }; - Network.prototype.moveTo = function () { - return this.view.moveTo.apply(this.view, arguments); - }; - Network.prototype.focus = function () { - return this.view.focus.apply(this.view, arguments); - }; - Network.prototype.releaseNode = function () { - return this.view.releaseNode.apply(this.view, arguments); + // both are equal + return 0; + }); + + // draw the ordered surfaces + ctx.lineWidth = this._getStrokeWidth(point); + ctx.strokeStyle = borderColor; + ctx.fillStyle = color; + // NOTE: we start at j=2 instead of j=0 as we don't need to draw the two surfaces at the backside + for (var _j = 2; _j < surfaces.length; _j++) { + surface = surfaces[_j]; + this._polygon(ctx, surface.corners); + } +}; + +/** + * Draw a polygon using the passed points and fill it with the passed style and stroke. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Array.} points an array of points. + * @param {string} [fillStyle] the fill style to set + * @param {string} [strokeStyle] the stroke style to set + */ +Graph3d.prototype._polygon = function (ctx, points, fillStyle, strokeStyle) { + if (points.length < 2) { + return; + } + + if (fillStyle !== undefined) { + ctx.fillStyle = fillStyle; + } + if (strokeStyle !== undefined) { + ctx.strokeStyle = strokeStyle; + } + ctx.beginPath(); + ctx.moveTo(points[0].screen.x, points[0].screen.y); + + for (var i = 1; i < points.length; ++i) { + var point = points[i]; + ctx.lineTo(point.screen.x, point.screen.y); + } + + ctx.closePath(); + ctx.fill(); + ctx.stroke(); // TODO: only draw stroke when strokeWidth > 0 +}; + +/** + * @param {CanvasRenderingContext2D} ctx + * @param {object} point + * @param {string} color + * @param {string} borderColor + * @param {number} [size=this._dotSize()] + * @private + */ +Graph3d.prototype._drawCircle = function (ctx, point, color, borderColor, size) { + var radius = this._calcRadius(point, size); + + ctx.lineWidth = this._getStrokeWidth(point); + ctx.strokeStyle = borderColor; + ctx.fillStyle = color; + ctx.beginPath(); + ctx.arc(point.screen.x, point.screen.y, radius, 0, Math.PI * 2, true); + ctx.fill(); + ctx.stroke(); +}; + +/** + * Determine the colors for the 'regular' graph styles. + * + * @param {object} point + * @returns {{fill, border}} + * @private + */ +Graph3d.prototype._getColorsRegular = function (point) { + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + var hue = (1 - (point.point.z - this.zRange.min) * this.scale.z / this.verticalRatio) * 240; + var color = this._hsv2rgb(hue, 1, 1); + var borderColor = this._hsv2rgb(hue, 1, 0.8); + + return { + fill: color, + border: borderColor + }; +}; + +/** + * Get the colors for the 'color' graph styles. + * These styles are currently: 'bar-color' and 'dot-color' + * Color may be set as a string representation of HTML color, like #ff00ff, + * or calculated from a number, for example, distance from this point + * The first option is useful when we have some pre-given legend, to which we have to adjust ourselves + * The second option is useful when we are interested in automatically setting the color, from some value, + * using some color scale + * @param {object} point + * @returns {{fill: *, border: *}} + * @private + */ +Graph3d.prototype._getColorsColor = function (point) { + // calculate the color based on the value + var color, borderColor; + + if (typeof point.point.value === "string") { + color = point.point.value; + borderColor = point.point.value; + } else { + var hue = (1 - (point.point.value - this.valueRange.min) * this.scale.value) * 240; + color = this._hsv2rgb(hue, 1, 1); + borderColor = this._hsv2rgb(hue, 1, 0.8); + } + return { + fill: color, + border: borderColor }; - Network.prototype.getOptionsFromConfigurator = function () { - var options = {}; - if (this.configurator) { - options = this.configurator.getOptions.apply(this.configurator); - } - return options; +}; + +/** + * Get the colors for the 'size' graph styles. + * These styles are currently: 'bar-size' and 'dot-size' + * + * @returns {{fill: *, border: (string|colorOptions.stroke|{string, undefined}|string|colorOptions.stroke|{string}|*)}} + * @private + */ +Graph3d.prototype._getColorsSize = function () { + return { + fill: this.dataColor.fill, + border: this.dataColor.stroke }; +}; - module.exports = Network; +/** + * Determine the size of a point on-screen, as determined by the + * distance to the camera. + * + * @param {Object} point + * @param {number} [size=this._dotSize()] the size that needs to be translated to screen coordinates. + * optional; if not passed, use the default point size. + * @returns {number} + * @private + */ +Graph3d.prototype._calcRadius = function (point, size) { + if (size === undefined) { + size = this._dotSize(); + } + + var radius; + if (this.showPerspective) { + radius = size / -point.trans.z; + } else { + radius = size * -(this.eye.z / this.camera.getArmLength()); + } + if (radius < 0) { + radius = 0; + } -/***/ }), -/* 161 */ -/***/ (function(module, exports) { + return radius; +}; - 'use strict'; +// ----------------------------------------------------------------------------- +// Methods for drawing points per graph style. +// ----------------------------------------------------------------------------- - /** - * Canvas shapes used by Network - */ - if (typeof CanvasRenderingContext2D !== 'undefined') { - /** - * Draw a circle shape - */ - CanvasRenderingContext2D.prototype.circle = function (x, y, r) { - this.beginPath(); - this.arc(x, y, r, 0, 2 * Math.PI, false); - this.closePath(); - }; +/** + * Draw single datapoint for graph style 'bar'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawBarGraphPoint = function (ctx, point) { + var xWidth = this.xBarWidth / 2; + var yWidth = this.yBarWidth / 2; + var colors = this._getColorsRegular(point); + + this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border); +}; - /** - * Draw a square shape - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r size, width and height of the square - */ - CanvasRenderingContext2D.prototype.square = function (x, y, r) { - this.beginPath(); - this.rect(x - r, y - r, r * 2, r * 2); - this.closePath(); - }; +/** + * Draw single datapoint for graph style 'bar-color'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawBarColorGraphPoint = function (ctx, point) { + var xWidth = this.xBarWidth / 2; + var yWidth = this.yBarWidth / 2; + var colors = this._getColorsColor(point); + + this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border); +}; - /** - * Draw a triangle shape - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius, half the length of the sides of the triangle - */ - CanvasRenderingContext2D.prototype.triangle = function (x, y, r) { - // http://en.wikipedia.org/wiki/Equilateral_triangle - this.beginPath(); +/** + * Draw single datapoint for graph style 'bar-size'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawBarSizeGraphPoint = function (ctx, point) { + // calculate size for the bar + var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range(); + var xWidth = this.xBarWidth / 2 * (fraction * 0.8 + 0.2); + var yWidth = this.yBarWidth / 2 * (fraction * 0.8 + 0.2); - // the change in radius and the offset is here to center the shape - r *= 1.15; - y += 0.275 * r; + var colors = this._getColorsSize(); - var s = r * 2; - var s2 = s / 2; - var ir = Math.sqrt(3) / 6 * s; // radius of inner circle - var h = Math.sqrt(s * s - s2 * s2); // height + this._redrawBar(ctx, point, xWidth, yWidth, colors.fill, colors.border); +}; +/** + * Draw single datapoint for graph style 'dot'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawDotGraphPoint = function (ctx, point) { + var colors = this._getColorsRegular(point); - this.moveTo(x, y - (h - ir)); - this.lineTo(x + s2, y + ir); - this.lineTo(x - s2, y + ir); - this.lineTo(x, y - (h - ir)); - this.closePath(); - }; + this._drawCircle(ctx, point, colors.fill, colors.border); +}; - /** - * Draw a triangle shape in downward orientation - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius - */ - CanvasRenderingContext2D.prototype.triangleDown = function (x, y, r) { - // http://en.wikipedia.org/wiki/Equilateral_triangle - this.beginPath(); +/** + * Draw single datapoint for graph style 'dot-line'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawDotLineGraphPoint = function (ctx, point) { + // draw a vertical line from the XY-plane to the graph value + var from = this._convert3Dto2D(point.bottom); + ctx.lineWidth = 1; + this._line(ctx, from, point.screen, this.gridColor); + + this._redrawDotGraphPoint(ctx, point); +}; - // the change in radius and the offset is here to center the shape - r *= 1.15; - y -= 0.275 * r; +/** + * Draw single datapoint for graph style 'dot-color'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawDotColorGraphPoint = function (ctx, point) { + var colors = this._getColorsColor(point); - var s = r * 2; - var s2 = s / 2; - var ir = Math.sqrt(3) / 6 * s; // radius of inner circle - var h = Math.sqrt(s * s - s2 * s2); // height + this._drawCircle(ctx, point, colors.fill, colors.border); +}; - this.moveTo(x, y + (h - ir)); - this.lineTo(x + s2, y - ir); - this.lineTo(x - s2, y - ir); - this.lineTo(x, y + (h - ir)); - this.closePath(); - }; +/** + * Draw single datapoint for graph style 'dot-size'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawDotSizeGraphPoint = function (ctx, point) { + var dotSize = this._dotSize(); + var fraction = (point.point.value - this.valueRange.min) / this.valueRange.range(); - /** - * Draw a star shape, a star with 5 points - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius, half the length of the sides of the triangle - */ - CanvasRenderingContext2D.prototype.star = function (x, y, r) { - // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ - this.beginPath(); + var sizeMin = dotSize * this.dotSizeMinFraction; + var sizeRange = dotSize * this.dotSizeMaxFraction - sizeMin; + var size = sizeMin + sizeRange * fraction; - // the change in radius and the offset is here to center the shape - r *= 0.82; - y += 0.1 * r; + var colors = this._getColorsSize(); - for (var n = 0; n < 10; n++) { - var radius = n % 2 === 0 ? r * 1.3 : r * 0.5; - this.lineTo(x + radius * Math.sin(n * 2 * Math.PI / 10), y - radius * Math.cos(n * 2 * Math.PI / 10)); - } + this._drawCircle(ctx, point, colors.fill, colors.border, size); +}; - this.closePath(); - }; +/** + * Draw single datapoint for graph style 'surface'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawSurfaceGraphPoint = function (ctx, point) { + var right = point.pointRight; + var top = point.pointTop; + var cross = point.pointCross; - /** - * Draw a Diamond shape - * @param {Number} x horizontal center - * @param {Number} y vertical center - * @param {Number} r radius, half the length of the sides of the triangle - */ - CanvasRenderingContext2D.prototype.diamond = function (x, y, r) { - // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ - this.beginPath(); + if (point === undefined || right === undefined || top === undefined || cross === undefined) { + return; + } - this.lineTo(x, y + r); - this.lineTo(x + r, y); - this.lineTo(x, y - r); - this.lineTo(x - r, y); + var topSideVisible = true; + var fillStyle; + var strokeStyle; - this.closePath(); - }; + if (this.showGrayBottom || this.showShadow) { + // calculate the cross product of the two vectors from center + // to left and right, in order to know whether we are looking at the + // bottom or at the top side. We can also use the cross product + // for calculating light intensity + var aDiff = Point3d.subtract(cross.trans, point.trans); + var bDiff = Point3d.subtract(top.trans, right.trans); + var crossproduct = Point3d.crossProduct(aDiff, bDiff); + var len = crossproduct.length(); + // FIXME: there is a bug with determining the surface side (shadow or colored) - /** - * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas - */ - CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { - var r2d = Math.PI / 180; - if (w - 2 * r < 0) { - r = w / 2; - } //ensure that the radius isn't too large for x - if (h - 2 * r < 0) { - r = h / 2; - } //ensure that the radius isn't too large for y - this.beginPath(); - this.moveTo(x + r, y); - this.lineTo(x + w - r, y); - this.arc(x + w - r, y + r, r, r2d * 270, r2d * 360, false); - this.lineTo(x + w, y + h - r); - this.arc(x + w - r, y + h - r, r, 0, r2d * 90, false); - this.lineTo(x + r, y + h); - this.arc(x + r, y + h - r, r, r2d * 90, r2d * 180, false); - this.lineTo(x, y + r); - this.arc(x + r, y + r, r, r2d * 180, r2d * 270, false); - this.closePath(); - }; + topSideVisible = crossproduct.z > 0; + } - /** - * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas - * - * Postfix '_vis' added to discern it from standard method ellipse(). - */ - CanvasRenderingContext2D.prototype.ellipse_vis = function (x, y, w, h) { - var kappa = .5522848, - ox = w / 2 * kappa, - // control point offset horizontal - oy = h / 2 * kappa, - // control point offset vertical - xe = x + w, - // x-end - ye = y + h, - // y-end - xm = x + w / 2, - // x-middle - ym = y + h / 2; // y-middle - - this.beginPath(); - this.moveTo(x, ym); - this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); - this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); - this.closePath(); - }; + if (topSideVisible) { - /** - * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas - */ - CanvasRenderingContext2D.prototype.database = function (x, y, w, h) { - var f = 1 / 3; - var wEllipse = w; - var hEllipse = h * f; + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + var zAvg = (point.point.z + right.point.z + top.point.z + cross.point.z) / 4; + var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240; + var s = 1; // saturation + var v; - var kappa = .5522848, - ox = wEllipse / 2 * kappa, - // control point offset horizontal - oy = hEllipse / 2 * kappa, - // control point offset vertical - xe = x + wEllipse, - // x-end - ye = y + hEllipse, - // y-end - xm = x + wEllipse / 2, - // x-middle - ym = y + hEllipse / 2, - // y-middle - ymb = y + (h - hEllipse / 2), - // y-midlle, bottom ellipse - yeb = y + h; // y-end, bottom ellipse + if (this.showShadow) { + v = Math.min(1 + crossproduct.x / len / 2, 1); // value. TODO: scale + fillStyle = this._hsv2rgb(h, s, v); + strokeStyle = fillStyle; + } else { + v = 1; + fillStyle = this._hsv2rgb(h, s, v); + strokeStyle = this.axisColor; // TODO: should be customizable + } + } else { + fillStyle = 'gray'; + strokeStyle = this.axisColor; + } - this.beginPath(); - this.moveTo(xe, ym); + ctx.lineWidth = this._getStrokeWidth(point); + // TODO: only draw stroke when strokeWidth > 0 - this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + var points = [point, right, cross, top]; + this._polygon(ctx, points, fillStyle, strokeStyle); +}; - this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); +/** + * Helper method for _redrawGridGraphPoint() + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} from + * @param {Object} to + * @private + */ +Graph3d.prototype._drawGridLine = function (ctx, from, to) { + if (from === undefined || to === undefined) { + return; + } - this.lineTo(xe, ymb); + // calculate Hue from the current value. At zMin the hue is 240, at zMax the hue is 0 + var zAvg = (from.point.z + to.point.z) / 2; + var h = (1 - (zAvg - this.zRange.min) * this.scale.z / this.verticalRatio) * 240; - this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb); - this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb); + ctx.lineWidth = this._getStrokeWidth(from) * 2; + ctx.strokeStyle = this._hsv2rgb(h, 1, 1); + this._line(ctx, from.screen, to.screen); +}; - this.lineTo(x, ym); - }; +/** + * Draw single datapoint for graph style 'Grid'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawGridGraphPoint = function (ctx, point) { + this._drawGridLine(ctx, point, point.pointRight); + this._drawGridLine(ctx, point, point.pointTop); +}; - /** - * Draw an arrow at the end of a line with the given angle. - */ - CanvasRenderingContext2D.prototype.arrowEndpoint = function (x, y, angle, length) { - // tail - var xt = x - length * Math.cos(angle); - var yt = y - length * Math.sin(angle); +/** + * Draw single datapoint for graph style 'line'. + * + * @param {CanvasRenderingContext2D} ctx + * @param {Object} point + * @private + */ +Graph3d.prototype._redrawLineGraphPoint = function (ctx, point) { + if (point.pointNext === undefined) { + return; + } - // inner tail - var xi = x - length * 0.9 * Math.cos(angle); - var yi = y - length * 0.9 * Math.sin(angle); + ctx.lineWidth = this._getStrokeWidth(point); + ctx.strokeStyle = this.dataColor.stroke; - // left - var xl = xt + length / 3 * Math.cos(angle + 0.5 * Math.PI); - var yl = yt + length / 3 * Math.sin(angle + 0.5 * Math.PI); + this._line(ctx, point.screen, point.pointNext.screen); +}; - // right - var xr = xt + length / 3 * Math.cos(angle - 0.5 * Math.PI); - var yr = yt + length / 3 * Math.sin(angle - 0.5 * Math.PI); - - this.beginPath(); - this.moveTo(x, y); - this.lineTo(xl, yl); - this.lineTo(xi, yi); - this.lineTo(xr, yr); - this.closePath(); - }; +/** + * Draw all datapoints for currently selected graph style. + * + */ +Graph3d.prototype._redrawDataGraph = function () { + var ctx = this._getContext(); + var i; - /** - * Draw an circle an the end of an line with the given angle. - */ - CanvasRenderingContext2D.prototype.circleEndpoint = function (x, y, angle, length) { - var radius = length * 0.4; - var xc = x - radius * Math.cos(angle); - var yc = y - radius * Math.sin(angle); - this.circle(xc, yc, radius); - }; + if (this.dataPoints === undefined || this.dataPoints.length <= 0) return; // TODO: throw exception? - /** - * Sets up the dashedLine functionality for drawing - * Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas - * @author David Jordan - * @date 2012-08-08 - */ - CanvasRenderingContext2D.prototype.dashedLine = function (x, y, x2, y2, pattern) { - this.beginPath(); - this.moveTo(x, y); + this._calcTranslations(this.dataPoints); - var patternLength = pattern.length; - var dx = x2 - x; - var dy = y2 - y; - var slope = dy / dx; - var distRemaining = Math.sqrt(dx * dx + dy * dy); - var patternIndex = 0; - var draw = true; - var xStep = 0; - var dashLength = pattern[0]; + for (i = 0; i < this.dataPoints.length; i++) { + var point = this.dataPoints[i]; - while (distRemaining >= 0.1) { - dashLength = pattern[patternIndex++ % patternLength]; - if (dashLength > distRemaining) { - dashLength = distRemaining; - } + // Using call() ensures that the correct context is used + this._pointDrawingMethod.call(this, ctx, point); + } +}; - xStep = Math.sqrt(dashLength * dashLength / (1 + slope * slope)); - xStep = dx < 0 ? -xStep : xStep; - x += xStep; - y += slope * xStep; +// ----------------------------------------------------------------------------- +// End methods for drawing points per graph style. +// ----------------------------------------------------------------------------- - if (draw === true) { - this.lineTo(x, y); - } else { - this.moveTo(x, y); - } +/** + * Store startX, startY and startOffset for mouse operations + * + * @param {Event} event The event that occurred + */ +Graph3d.prototype._storeMousePosition = function (event) { + // get mouse position (different code for IE and all other browsers) + this.startMouseX = getMouseX(event); + this.startMouseY = getMouseY(event); - distRemaining -= dashLength; - draw = !draw; - } - }; - } + this._startCameraOffset = this.camera.getOffset(); +}; -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Start a moving operation inside the provided parent element + * @param {Event} event The event that occurred (required for + * retrieving the mouse position) + */ +Graph3d.prototype._onMouseDown = function (event) { + event = event || window.event; + + // check if mouse is still down (may be up when focus is lost for example + // in an iframe) + if (this.leftButtonDown) { + this._onMouseUp(event); + } - 'use strict'; + // only react on left mouse button down + this.leftButtonDown = event.which ? event.which === 1 : event.button === 1; + if (!this.leftButtonDown && !this.touchDown) return; - var _create = __webpack_require__(55); + this._storeMousePosition(event); - var _create2 = _interopRequireDefault(_create); + this.startStart = new Date(this.start); + this.startEnd = new Date(this.end); + this.startArmRotation = this.camera.getArmRotation(); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + this.frame.style.cursor = 'move'; - /** - * Parse a text source containing data in DOT language into a JSON object. - * The object contains two lists: one with nodes and one with edges. - * - * DOT language reference: http://www.graphviz.org/doc/info/lang.html - * - * DOT language attributes: http://graphviz.org/content/attrs - * - * @param {String} data Text containing a graph in DOT-notation - * @return {Object} graph An object containing two parameters: - * {Object[]} nodes - * {Object[]} edges - * - * ------------------------------------------- - * TODO - * ==== - * - * For label handling, this is an incomplete implementation. From docs (quote #3015): - * - * > the escape sequences "\n", "\l" and "\r" divide the label into lines, centered, - * > left-justified, and right-justified, respectively. - * - * Source: http://www.graphviz.org/content/attrs#kescString - * - * > As another aid for readability, dot allows double-quoted strings to span multiple physical - * > lines using the standard C convention of a backslash immediately preceding a newline - * > character - * > In addition, double-quoted strings can be concatenated using a '+' operator. - * > As HTML strings can contain newline characters, which are used solely for formatting, - * > the language does not allow escaped newlines or concatenation operators to be used - * > within them. - * - * - Currently, only '\\n' is handled - * - Note that text explicitly says 'labels'; the dot parser currently handles escape - * sequences in **all** strings. - */ - function parseDOT(data) { - dot = data; - return parseGraph(); - } - - // mapping of attributes from DOT (the keys) to vis.js (the values) - var NODE_ATTR_MAPPING = { - 'fontsize': 'font.size', - 'fontcolor': 'font.color', - 'labelfontcolor': 'font.color', - 'fontname': 'font.face', - 'color': ['color.border', 'color.background'], - 'fillcolor': 'color.background', - 'tooltip': 'title', - 'labeltooltip': 'title' + // add event listeners to handle moving the contents + // we store the function onmousemove and onmouseup in the graph, so we can + // remove the eventlisteners lateron in the function mouseUp() + var me = this; + this.onmousemove = function (event) { + me._onMouseMove(event); }; - var EDGE_ATTR_MAPPING = (0, _create2['default'])(NODE_ATTR_MAPPING); - EDGE_ATTR_MAPPING.color = 'color.color'; - - // token types enumeration - var TOKENTYPE = { - NULL: 0, - DELIMITER: 1, - IDENTIFIER: 2, - UNKNOWN: 3 + this.onmouseup = function (event) { + me._onMouseUp(event); }; + util.addEventListener(document, 'mousemove', me.onmousemove); + util.addEventListener(document, 'mouseup', me.onmouseup); + util.preventDefault(event); +}; - // map with all delimiters - var DELIMITERS = { - '{': true, - '}': true, - '[': true, - ']': true, - ';': true, - '=': true, - ',': true, - - '->': true, - '--': true - }; +/** + * Perform moving operating. + * This function activated from within the funcion Graph.mouseDown(). + * @param {Event} event Well, eehh, the event + */ +Graph3d.prototype._onMouseMove = function (event) { + this.moving = true; + event = event || window.event; + + // calculate change in mouse position + var diffX = parseFloat(getMouseX(event)) - this.startMouseX; + var diffY = parseFloat(getMouseY(event)) - this.startMouseY; + + // move with ctrl or rotate by other + if (event && event.ctrlKey === true) { + // calculate change in mouse position + var scaleX = this.frame.clientWidth * 0.5; + var scaleY = this.frame.clientHeight * 0.5; - var dot = ''; // current dot file - var index = 0; // current index in dot file - var c = ''; // current token character in expr - var token = ''; // current token - var tokenType = TOKENTYPE.NULL; // type of the token + var offXNew = (this._startCameraOffset.x || 0) - diffX / scaleX * this.camera.armLength * 0.8; + var offYNew = (this._startCameraOffset.y || 0) + diffY / scaleY * this.camera.armLength * 0.8; - /** - * Get the first character from the dot file. - * The character is stored into the char c. If the end of the dot file is - * reached, the function puts an empty string in c. - */ - function first() { - index = 0; - c = dot.charAt(0); - } + this.camera.setOffset(offXNew, offYNew); + this._storeMousePosition(event); + } else { + var horizontalNew = this.startArmRotation.horizontal + diffX / 200; + var verticalNew = this.startArmRotation.vertical + diffY / 200; - /** - * Get the next character from the dot file. - * The character is stored into the char c. If the end of the dot file is - * reached, the function puts an empty string in c. - */ - function next() { - index++; - c = dot.charAt(index); + var snapAngle = 4; // degrees + var snapValue = Math.sin(snapAngle / 360 * 2 * Math.PI); + + // snap horizontally to nice angles at 0pi, 0.5pi, 1pi, 1.5pi, etc... + // the -0.001 is to take care that the vertical axis is always drawn at the left front corner + if (Math.abs(Math.sin(horizontalNew)) < snapValue) { + horizontalNew = Math.round(horizontalNew / Math.PI) * Math.PI - 0.001; + } + if (Math.abs(Math.cos(horizontalNew)) < snapValue) { + horizontalNew = (Math.round(horizontalNew / Math.PI - 0.5) + 0.5) * Math.PI - 0.001; + } + + // snap vertically to nice angles + if (Math.abs(Math.sin(verticalNew)) < snapValue) { + verticalNew = Math.round(verticalNew / Math.PI) * Math.PI; + } + if (Math.abs(Math.cos(verticalNew)) < snapValue) { + verticalNew = (Math.round(verticalNew / Math.PI - 0.5) + 0.5) * Math.PI; + } + this.camera.setArmRotation(horizontalNew, verticalNew); } - /** - * Preview the next character from the dot file. - * @return {String} cNext - */ - function nextPreview() { - return dot.charAt(index + 1); + this.redraw(); + + // fire a cameraPositionChange event + var parameters = this.getCameraPosition(); + this.emit('cameraPositionChange', parameters); + + util.preventDefault(event); +}; + +/** + * Stop moving operating. + * This function activated from within the funcion Graph.mouseDown(). + * @param {Event} event The event + */ +Graph3d.prototype._onMouseUp = function (event) { + this.frame.style.cursor = 'auto'; + this.leftButtonDown = false; + + // remove event listeners here + util.removeEventListener(document, 'mousemove', this.onmousemove); + util.removeEventListener(document, 'mouseup', this.onmouseup); + util.preventDefault(event); +}; + +/** + * @param {Event} event The event + */ +Graph3d.prototype._onClick = function (event) { + if (!this.onclick_callback) return; + if (!this.moving) { + var boundingRect = this.frame.getBoundingClientRect(); + var mouseX = getMouseX(event) - boundingRect.left; + var mouseY = getMouseY(event) - boundingRect.top; + var dataPoint = this._dataPointFromXY(mouseX, mouseY); + if (dataPoint) this.onclick_callback(dataPoint.point.data); + } else { + // disable onclick callback, if it came immediately after rotate/pan + this.moving = false; } + util.preventDefault(event); +}; - /** - * Test whether given character is alphabetic or numeric - * @param {String} c - * @return {Boolean} isAlphaNumeric - */ - var regexAlphaNumeric = /[a-zA-Z_0-9.:#]/; - function isAlphaNumeric(c) { - return regexAlphaNumeric.test(c); +/** + * After having moved the mouse, a tooltip should pop up when the mouse is resting on a data point + * @param {Event} event A mouse move event + */ +Graph3d.prototype._onTooltip = function (event) { + var delay = 300; // ms + var boundingRect = this.frame.getBoundingClientRect(); + var mouseX = getMouseX(event) - boundingRect.left; + var mouseY = getMouseY(event) - boundingRect.top; + + if (!this.showTooltip) { + return; } - /** - * Merge all options of object b into object b - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - function merge(a, b) { - if (!a) { - a = {}; - } + if (this.tooltipTimeout) { + clearTimeout(this.tooltipTimeout); + } - if (b) { - for (var name in b) { - if (b.hasOwnProperty(name)) { - a[name] = b[name]; - } - } - } - return a; + // (delayed) display of a tooltip only if no mouse button is down + if (this.leftButtonDown) { + this._hideTooltip(); + return; } - /** - * Set a value in an object, where the provided parameter name can be a - * path with nested parameters. For example: - * - * var obj = {a: 2}; - * setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}} - * - * @param {Object} obj - * @param {String} path A parameter name or dot-separated parameter path, - * like "color.highlight.border". - * @param {*} value - */ - function setValue(obj, path, value) { - var keys = path.split('.'); - var o = obj; - while (keys.length) { - var key = keys.shift(); - if (keys.length) { - // this isn't the end point - if (!o[key]) { - o[key] = {}; - } - o = o[key]; + if (this.tooltip && this.tooltip.dataPoint) { + // tooltip is currently visible + var dataPoint = this._dataPointFromXY(mouseX, mouseY); + if (dataPoint !== this.tooltip.dataPoint) { + // datapoint changed + if (dataPoint) { + this._showTooltip(dataPoint); } else { - // this is the end point - o[key] = value; + this._hideTooltip(); } } - } + } else { + // tooltip is currently not visible + var me = this; + this.tooltipTimeout = setTimeout(function () { + me.tooltipTimeout = null; - /** - * Add a node to a graph object. If there is already a node with - * the same id, their attributes will be merged. - * @param {Object} graph - * @param {Object} node - */ - function addNode(graph, node) { - var i, len; - var current = null; - - // find root graph (in case of subgraph) - var graphs = [graph]; // list with all graphs from current graph to root graph - var root = graph; - while (root.parent) { - graphs.push(root.parent); - root = root.parent; - } - - // find existing node (at root level) by its id - if (root.nodes) { - for (i = 0, len = root.nodes.length; i < len; i++) { - if (node.id === root.nodes[i].id) { - current = root.nodes[i]; - break; - } + // show a tooltip if we have a data point + var dataPoint = me._dataPointFromXY(mouseX, mouseY); + if (dataPoint) { + me._showTooltip(dataPoint); } - } + }, delay); + } +}; - if (!current) { - // this is a new node - current = { - id: node.id - }; - if (graph.node) { - // clone default attributes - current.attr = merge(current.attr, graph.node); - } - } +/** + * Event handler for touchstart event on mobile devices + * @param {Event} event The event + */ +Graph3d.prototype._onTouchStart = function (event) { + this.touchDown = true; - // add node to this (sub)graph and all its parent graphs - for (i = graphs.length - 1; i >= 0; i--) { - var g = graphs[i]; + var me = this; + this.ontouchmove = function (event) { + me._onTouchMove(event); + }; + this.ontouchend = function (event) { + me._onTouchEnd(event); + }; + util.addEventListener(document, 'touchmove', me.ontouchmove); + util.addEventListener(document, 'touchend', me.ontouchend); - if (!g.nodes) { - g.nodes = []; - } - if (g.nodes.indexOf(current) === -1) { - g.nodes.push(current); - } - } + this._onMouseDown(event); +}; - // merge attributes - if (node.attr) { - current.attr = merge(current.attr, node.attr); - } - } +/** + * Event handler for touchmove event on mobile devices + * @param {Event} event The event + */ +Graph3d.prototype._onTouchMove = function (event) { + this._onMouseMove(event); +}; - /** - * Add an edge to a graph object - * @param {Object} graph - * @param {Object} edge - */ - function addEdge(graph, edge) { - if (!graph.edges) { - graph.edges = []; - } - graph.edges.push(edge); - if (graph.edge) { - var attr = merge({}, graph.edge); // clone default attributes - edge.attr = merge(attr, edge.attr); // merge attributes - } - } +/** + * Event handler for touchend event on mobile devices + * @param {Event} event The event + */ +Graph3d.prototype._onTouchEnd = function (event) { + this.touchDown = false; - /** - * Create an edge to a graph object - * @param {Object} graph - * @param {String | Number | Object} from - * @param {String | Number | Object} to - * @param {String} type - * @param {Object | null} attr - * @return {Object} edge - */ - function createEdge(graph, from, to, type, attr) { - var edge = { - from: from, - to: to, - type: type - }; + util.removeEventListener(document, 'touchmove', this.ontouchmove); + util.removeEventListener(document, 'touchend', this.ontouchend); - if (graph.edge) { - edge.attr = merge({}, graph.edge); // clone default attributes - } - edge.attr = merge(edge.attr || {}, attr); // merge attributes + this._onMouseUp(event); +}; + +/** + * Event handler for mouse wheel event, used to zoom the graph + * Code from http://adomas.org/javascript-mouse-wheel/ + * @param {Event} event The event + */ +Graph3d.prototype._onWheel = function (event) { + if (!event) /* For IE. */ + event = window.event; + + // retrieve delta + var delta = 0; + if (event.wheelDelta) { + /* IE/Opera. */ + delta = event.wheelDelta / 120; + } else if (event.detail) { + /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail / 3; + } + + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta) { + var oldLength = this.camera.getArmLength(); + var newLength = oldLength * (1 - delta / 10); + + this.camera.setArmLength(newLength); + this.redraw(); - return edge; + this._hideTooltip(); } + // fire a cameraPositionChange event + var parameters = this.getCameraPosition(); + this.emit('cameraPositionChange', parameters); + + // Prevent default actions caused by mouse wheel. + // That might be ugly, but we handle scrolls somehow + // anyway, so don't bother here.. + util.preventDefault(event); +}; + +/** + * Test whether a point lies inside given 2D triangle + * + * @param {vis.Point2d} point + * @param {vis.Point2d[]} triangle + * @returns {boolean} true if given point lies inside or on the edge of the + * triangle, false otherwise + * @private + */ +Graph3d.prototype._insideTriangle = function (point, triangle) { + var a = triangle[0], + b = triangle[1], + c = triangle[2]; + /** - * Get next token in the current dot file. - * The token and token type are available as token and tokenType + * + * @param {number} x + * @returns {number} */ - function getToken() { - tokenType = TOKENTYPE.NULL; - token = ''; + function sign(x) { + return x > 0 ? 1 : x < 0 ? -1 : 0; + } - // skip over whitespaces - while (c === ' ' || c === '\t' || c === '\n' || c === '\r') { - // space, tab, enter - next(); - } + var as = sign((b.x - a.x) * (point.y - a.y) - (b.y - a.y) * (point.x - a.x)); + var bs = sign((c.x - b.x) * (point.y - b.y) - (c.y - b.y) * (point.x - b.x)); + var cs = sign((a.x - c.x) * (point.y - c.y) - (a.y - c.y) * (point.x - c.x)); - do { - var isComment = false; + // each of the three signs must be either equal to each other or zero + return (as == 0 || bs == 0 || as == bs) && (bs == 0 || cs == 0 || bs == cs) && (as == 0 || cs == 0 || as == cs); +}; - // skip comment - if (c === '#') { - // find the previous non-space character - var i = index - 1; - while (dot.charAt(i) === ' ' || dot.charAt(i) === '\t') { - i--; - } - if (dot.charAt(i) === '\n' || dot.charAt(i) === '') { - // the # is at the start of a line, this is indeed a line comment - while (c != '' && c != '\n') { - next(); +/** + * Find a data point close to given screen position (x, y) + * + * @param {number} x + * @param {number} y + * @returns {Object | null} The closest data point or null if not close to any + * data point + * @private + */ +Graph3d.prototype._dataPointFromXY = function (x, y) { + var i, + distMax = 100, + // px + dataPoint = null, + closestDataPoint = null, + closestDist = null, + center = new Point2d(x, y); + + if (this.style === Graph3d.STYLE.BAR || this.style === Graph3d.STYLE.BARCOLOR || this.style === Graph3d.STYLE.BARSIZE) { + // the data points are ordered from far away to closest + for (i = this.dataPoints.length - 1; i >= 0; i--) { + dataPoint = this.dataPoints[i]; + var surfaces = dataPoint.surfaces; + if (surfaces) { + for (var s = surfaces.length - 1; s >= 0; s--) { + // split each surface in two triangles, and see if the center point is inside one of these + var surface = surfaces[s]; + var corners = surface.corners; + var triangle1 = [corners[0].screen, corners[1].screen, corners[2].screen]; + var triangle2 = [corners[2].screen, corners[3].screen, corners[0].screen]; + if (this._insideTriangle(center, triangle1) || this._insideTriangle(center, triangle2)) { + // return immediately at the first hit + return dataPoint; } - isComment = true; - } - } - if (c === '/' && nextPreview() === '/') { - // skip line comment - while (c != '' && c != '\n') { - next(); } - isComment = true; } - if (c === '/' && nextPreview() === '*') { - // skip block comment - while (c != '') { - if (c === '*' && nextPreview() === '/') { - // end of block comment found. skip these last two characters - next(); - next(); - break; - } else { - next(); - } + } + } else { + // find the closest data point, using distance to the center of the point on 2d screen + for (i = 0; i < this.dataPoints.length; i++) { + dataPoint = this.dataPoints[i]; + var point = dataPoint.screen; + if (point) { + var distX = Math.abs(x - point.x); + var distY = Math.abs(y - point.y); + var dist = Math.sqrt(distX * distX + distY * distY); + + if ((closestDist === null || dist < closestDist) && dist < distMax) { + closestDist = dist; + closestDataPoint = dataPoint; } - isComment = true; } + } + } - // skip over whitespaces - while (c === ' ' || c === '\t' || c === '\n' || c === '\r') { - // space, tab, enter - next(); + return closestDataPoint; +}; + +/** + * Determine if the given style has bars + * + * @param {number} style the style to check + * @returns {boolean} true if bar style, false otherwise + */ +Graph3d.prototype.hasBars = function (style) { + return style == Graph3d.STYLE.BAR || style == Graph3d.STYLE.BARCOLOR || style == Graph3d.STYLE.BARSIZE; +}; + +/** + * Display a tooltip for given data point + * @param {Object} dataPoint + * @private + */ +Graph3d.prototype._showTooltip = function (dataPoint) { + var content, line, dot; + + if (!this.tooltip) { + content = document.createElement('div'); + (0, _assign2['default'])(content.style, {}, this.tooltipStyle.content); + content.style.position = 'absolute'; + + line = document.createElement('div'); + (0, _assign2['default'])(line.style, {}, this.tooltipStyle.line); + line.style.position = 'absolute'; + + dot = document.createElement('div'); + (0, _assign2['default'])(dot.style, {}, this.tooltipStyle.dot); + dot.style.position = 'absolute'; + + this.tooltip = { + dataPoint: null, + dom: { + content: content, + line: line, + dot: dot } - } while (isComment); + }; + } else { + content = this.tooltip.dom.content; + line = this.tooltip.dom.line; + dot = this.tooltip.dom.dot; + } - // check for end of dot file - if (c === '') { - // token is still empty - tokenType = TOKENTYPE.DELIMITER; - return; - } + this._hideTooltip(); - // check for delimiters consisting of 2 characters - var c2 = c + nextPreview(); - if (DELIMITERS[c2]) { - tokenType = TOKENTYPE.DELIMITER; - token = c2; - next(); - next(); - return; - } + this.tooltip.dataPoint = dataPoint; + if (typeof this.showTooltip === 'function') { + content.innerHTML = this.showTooltip(dataPoint.point); + } else { + content.innerHTML = '' + '' + '' + '' + '
' + this.xLabel + ':' + dataPoint.point.x + '
' + this.yLabel + ':' + dataPoint.point.y + '
' + this.zLabel + ':' + dataPoint.point.z + '
'; + } - // check for delimiters consisting of 1 character - if (DELIMITERS[c]) { - tokenType = TOKENTYPE.DELIMITER; - token = c; - next(); - return; - } + content.style.left = '0'; + content.style.top = '0'; + this.frame.appendChild(content); + this.frame.appendChild(line); + this.frame.appendChild(dot); - // check for an identifier (number or string) - // TODO: more precise parsing of numbers/strings (and the port separator ':') - if (isAlphaNumeric(c) || c === '-') { - token += c; - next(); + // calculate sizes + var contentWidth = content.offsetWidth; + var contentHeight = content.offsetHeight; + var lineHeight = line.offsetHeight; + var dotWidth = dot.offsetWidth; + var dotHeight = dot.offsetHeight; - while (isAlphaNumeric(c)) { - token += c; - next(); - } - if (token === 'false') { - token = false; // convert to boolean - } else if (token === 'true') { - token = true; // convert to boolean - } else if (!isNaN(Number(token))) { - token = Number(token); // convert to number - } - tokenType = TOKENTYPE.IDENTIFIER; - return; - } + var left = dataPoint.screen.x - contentWidth / 2; + left = Math.min(Math.max(left, 10), this.frame.clientWidth - 10 - contentWidth); - // check for a string enclosed by double quotes - if (c === '"') { - next(); - while (c != '' && (c != '"' || c === '"' && nextPreview() === '"')) { - if (c === '"') { - // skip the escape character - token += c; - next(); - } else if (c === '\\' && nextPreview() === 'n') { - // Honor a newline escape sequence - token += '\n'; - next(); - } else { - token += c; + line.style.left = dataPoint.screen.x + 'px'; + line.style.top = dataPoint.screen.y - lineHeight + 'px'; + content.style.left = left + 'px'; + content.style.top = dataPoint.screen.y - lineHeight - contentHeight + 'px'; + dot.style.left = dataPoint.screen.x - dotWidth / 2 + 'px'; + dot.style.top = dataPoint.screen.y - dotHeight / 2 + 'px'; +}; + +/** + * Hide the tooltip when displayed + * @private + */ +Graph3d.prototype._hideTooltip = function () { + if (this.tooltip) { + this.tooltip.dataPoint = null; + + for (var prop in this.tooltip.dom) { + if (this.tooltip.dom.hasOwnProperty(prop)) { + var elem = this.tooltip.dom[prop]; + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); } - next(); - } - if (c != '"') { - throw newSyntaxError('End of string " expected'); } - next(); - tokenType = TOKENTYPE.IDENTIFIER; - return; - } - - // something unknown is found, wrong characters, a syntax error - tokenType = TOKENTYPE.UNKNOWN; - while (c != '') { - token += c; - next(); } - throw new SyntaxError('Syntax error in part "' + chop(token, 30) + '"'); } +}; - /** - * Parse a graph. - * @returns {Object} graph - */ - function parseGraph() { - var graph = {}; +/**--------------------------------------------------------------------------**/ - first(); - getToken(); +/** + * Get the horizontal mouse position from a mouse event + * + * @param {Event} event + * @returns {number} mouse x + */ +function getMouseX(event) { + if ('clientX' in event) return event.clientX; + return event.targetTouches[0] && event.targetTouches[0].clientX || 0; +} - // optional strict keyword - if (token === 'strict') { - graph.strict = true; - getToken(); - } +/** + * Get the vertical mouse position from a mouse event + * + * @param {Event} event + * @returns {number} mouse y + */ +function getMouseY(event) { + if ('clientY' in event) return event.clientY; + return event.targetTouches[0] && event.targetTouches[0].clientY || 0; +} + +// ----------------------------------------------------------------------------- +// Public methods for specific settings +// ----------------------------------------------------------------------------- - // graph or digraph keyword - if (token === 'graph' || token === 'digraph') { - graph.type = token; - getToken(); - } +/** + * Set the rotation and distance of the camera + * + * @param {Object} pos An object with the camera position + * @param {number} [pos.horizontal] The horizontal rotation, between 0 and 2*PI. + * Optional, can be left undefined. + * @param {number} [pos.vertical] The vertical rotation, between 0 and 0.5*PI. + * if vertical=0.5*PI, the graph is shown from + * the top. Optional, can be left undefined. + * @param {number} [pos.distance] The (normalized) distance of the camera to the + * center of the graph, a value between 0.71 and + * 5.0. Optional, can be left undefined. + */ +Graph3d.prototype.setCameraPosition = function (pos) { + Settings.setCameraPosition(pos, this); + this.redraw(); +}; - // optional graph id - if (tokenType === TOKENTYPE.IDENTIFIER) { - graph.id = token; - getToken(); - } +/** + * Set a new size for the graph + * + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') + */ +Graph3d.prototype.setSize = function (width, height) { + this._setSize(width, height); + this.redraw(); +}; - // open angle bracket - if (token != '{') { - throw newSyntaxError('Angle bracket { expected'); - } - getToken(); +// ----------------------------------------------------------------------------- +// End public methods for specific settings +// ----------------------------------------------------------------------------- - // statements - parseStatements(graph); - // close angle bracket - if (token != '}') { - throw newSyntaxError('Angle bracket } expected'); - } - getToken(); +module.exports = Graph3d; - // end of file - if (token !== '') { - throw newSyntaxError('End of file expected'); - } - getToken(); +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { - // remove temporary default options - delete graph.node; - delete graph.edge; - delete graph.graph; +__webpack_require__(163); +module.exports = __webpack_require__(7).Object.assign; - return graph; - } - /** - * Parse a list with statements. - * @param {Object} graph - */ - function parseStatements(graph) { - while (token !== '' && token != '}') { - parseStatement(graph); - if (token === ';') { - getToken(); - } - } - } +/***/ }), +/* 163 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Parse a single statement. Can be a an attribute statement, node - * statement, a series of node statements and edge statements, or a - * parameter. - * @param {Object} graph - */ - function parseStatement(graph) { - // parse subgraph - var subgraph = parseSubgraph(graph); - if (subgraph) { - // edge statements - parseEdge(graph, subgraph); +// 19.1.3.1 Object.assign(target, source) +var $export = __webpack_require__(17); - return; - } +$export($export.S + $export.F, 'Object', { assign: __webpack_require__(164) }); - // parse an attribute statement - var attr = parseAttributeStatement(graph); - if (attr) { - return; - } - // parse node - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier expected'); - } - var id = token; // id can be a string or a number - getToken(); +/***/ }), +/* 164 */ +/***/ (function(module, exports, __webpack_require__) { - if (token === '=') { - // id statement - getToken(); - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier expected'); - } - graph[id] = token; - getToken(); - // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " - } else { - parseNodeStatement(graph, id); - } - } +"use strict"; + +// 19.1.2.1 Object.assign(target, source, ...) +var getKeys = __webpack_require__(33); +var gOPS = __webpack_require__(63); +var pIE = __webpack_require__(42); +var toObject = __webpack_require__(41); +var IObject = __webpack_require__(78); +var $assign = Object.assign; + +// should work with symbols and should have deterministic property order (V8 bug) +module.exports = !$assign || __webpack_require__(28)(function () { + var A = {}; + var B = {}; + // eslint-disable-next-line no-undef + var S = Symbol(); + var K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function (k) { B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; +}) ? function assign(target, source) { // eslint-disable-line no-unused-vars + var T = toObject(target); + var aLen = arguments.length; + var index = 1; + var getSymbols = gOPS.f; + var isEnum = pIE.f; + while (aLen > index) { + var S = IObject(arguments[index++]); + var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); + var length = keys.length; + var j = 0; + var key; + while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; + } return T; +} : $assign; - /** - * Parse a subgraph - * @param {Object} graph parent graph object - * @return {Object | null} subgraph - */ - function parseSubgraph(graph) { - var subgraph = null; - // optional subgraph keyword - if (token === 'subgraph') { - subgraph = {}; - subgraph.type = 'subgraph'; - getToken(); +/***/ }), +/* 165 */ +/***/ (function(module, exports, __webpack_require__) { - // optional graph id - if (tokenType === TOKENTYPE.IDENTIFIER) { - subgraph.id = token; - getToken(); - } - } +module.exports = { "default": __webpack_require__(166), __esModule: true }; - // open angle bracket - if (token === '{') { - getToken(); +/***/ }), +/* 166 */ +/***/ (function(module, exports, __webpack_require__) { - if (!subgraph) { - subgraph = {}; - } - subgraph.parent = graph; - subgraph.node = graph.node; - subgraph.edge = graph.edge; - subgraph.graph = graph.graph; +__webpack_require__(167); +module.exports = __webpack_require__(7).Math.sign; - // statements - parseStatements(subgraph); - // close angle bracket - if (token != '}') { - throw newSyntaxError('Angle bracket } expected'); - } - getToken(); +/***/ }), +/* 167 */ +/***/ (function(module, exports, __webpack_require__) { - // remove temporary default options - delete subgraph.node; - delete subgraph.edge; - delete subgraph.graph; - delete subgraph.parent; +// 20.2.2.28 Math.sign(x) +var $export = __webpack_require__(17); - // register at the parent graph - if (!graph.subgraphs) { - graph.subgraphs = []; - } - graph.subgraphs.push(subgraph); - } +$export($export.S, 'Math', { sign: __webpack_require__(168) }); - return subgraph; - } - /** - * parse an attribute statement like "node [shape=circle fontSize=16]". - * Available keywords are 'node', 'edge', 'graph'. - * The previous list with default attributes will be replaced - * @param {Object} graph - * @returns {String | null} keyword Returns the name of the parsed attribute - * (node, edge, graph), or null if nothing - * is parsed. - */ - function parseAttributeStatement(graph) { - // attribute statements - if (token === 'node') { - getToken(); +/***/ }), +/* 168 */ +/***/ (function(module, exports) { - // node attributes - graph.node = parseAttributeList(); - return 'node'; - } else if (token === 'edge') { - getToken(); +// 20.2.2.28 Math.sign(x) +module.exports = Math.sign || function sign(x) { + // eslint-disable-next-line no-self-compare + return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; +}; - // edge attributes - graph.edge = parseAttributeList(); - return 'edge'; - } else if (token === 'graph') { - getToken(); - // graph attributes - graph.graph = parseAttributeList(); - return 'graph'; - } +/***/ }), +/* 169 */ +/***/ (function(module, exports, __webpack_require__) { - return null; - } +module.exports = { "default": __webpack_require__(170), __esModule: true }; - /** - * parse a node statement - * @param {Object} graph - * @param {String | Number} id - */ - function parseNodeStatement(graph, id) { - // node statement - var node = { - id: id - }; - var attr = parseAttributeList(); - if (attr) { - node.attr = attr; - } - addNode(graph, node); +/***/ }), +/* 170 */ +/***/ (function(module, exports, __webpack_require__) { - // edge statements - parseEdge(graph, id); - } +__webpack_require__(171); +var $Object = __webpack_require__(7).Object; +module.exports = function defineProperty(it, key, desc) { + return $Object.defineProperty(it, key, desc); +}; - /** - * Parse an edge or a series of edges - * @param {Object} graph - * @param {String | Number} from Id of the from node - */ - function parseEdge(graph, from) { - while (token === '->' || token === '--') { - var to; - var type = token; - getToken(); - var subgraph = parseSubgraph(graph); - if (subgraph) { - to = subgraph; - } else { - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Identifier or subgraph expected'); - } - to = token; - addNode(graph, { - id: to - }); - getToken(); - } +/***/ }), +/* 171 */ +/***/ (function(module, exports, __webpack_require__) { - // parse edge attributes - var attr = parseAttributeList(); +var $export = __webpack_require__(17); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) +$export($export.S + $export.F * !__webpack_require__(21), 'Object', { defineProperty: __webpack_require__(20).f }); - // create edge - var edge = createEdge(graph, from, to, type, attr); - addEdge(graph, edge); - from = to; - } - } +/***/ }), +/* 172 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Parse a set with attributes, - * for example [label="1.000", shape=solid] - * @return {Object | null} attr - */ - function parseAttributeList() { - var attr = null; +"use strict"; - while (token === '[') { - getToken(); - attr = {}; - while (token !== '' && token != ']') { - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Attribute name expected'); - } - var name = token; - getToken(); - if (token != '=') { - throw newSyntaxError('Equal sign = expected'); - } - getToken(); +Object.defineProperty(exports, "__esModule", { + value: true +}); +/** + * This object contains all possible options. It will check if the types are correct, if required if the option is one + * of the allowed values. + * + * __any__ means that the name of the property does not matter. + * __type__ is a required field for all objects and contains the allowed types of all objects + */ +var string = 'string'; +var bool = 'boolean'; +var number = 'number'; +var object = 'object'; // should only be in a __type__ property +// Following not used here, but useful for reference +//let array = 'array'; +//let dom = 'dom'; +//let any = 'any'; + + +var colorOptions = { + fill: { string: string }, + stroke: { string: string }, + strokeWidth: { number: number }, + __type__: { string: string, object: object, 'undefined': 'undefined' } +}; - if (tokenType != TOKENTYPE.IDENTIFIER) { - throw newSyntaxError('Attribute value expected'); - } - var value = token; - setValue(attr, name, value); // name can be a path +/** + * Order attempted to be alphabetical. + * - x/y/z-prefixes ignored in sorting + * - __type__ always at end + * - globals at end + */ +var allOptions = { + animationAutoStart: { boolean: bool, 'undefined': 'undefined' }, + animationInterval: { number: number }, + animationPreload: { boolean: bool }, + axisColor: { string: string }, + backgroundColor: colorOptions, + xBarWidth: { number: number, 'undefined': 'undefined' }, + yBarWidth: { number: number, 'undefined': 'undefined' }, + cameraPosition: { + distance: { number: number }, + horizontal: { number: number }, + vertical: { number: number }, + __type__: { object: object } + }, + xCenter: { string: string }, + yCenter: { string: string }, + dataColor: colorOptions, + dotSizeMinFraction: { number: number }, + dotSizeMaxFraction: { number: number }, + dotSizeRatio: { number: number }, + filterLabel: { string: string }, + gridColor: { string: string }, + onclick: { 'function': 'function' }, + keepAspectRatio: { boolean: bool }, + xLabel: { string: string }, + yLabel: { string: string }, + zLabel: { string: string }, + legendLabel: { string: string }, + xMin: { number: number, 'undefined': 'undefined' }, + yMin: { number: number, 'undefined': 'undefined' }, + zMin: { number: number, 'undefined': 'undefined' }, + xMax: { number: number, 'undefined': 'undefined' }, + yMax: { number: number, 'undefined': 'undefined' }, + zMax: { number: number, 'undefined': 'undefined' }, + showAnimationControls: { boolean: bool, 'undefined': 'undefined' }, + showGrid: { boolean: bool }, + showLegend: { boolean: bool, 'undefined': 'undefined' }, + showPerspective: { boolean: bool }, + showShadow: { boolean: bool }, + showXAxis: { boolean: bool }, + showYAxis: { boolean: bool }, + showZAxis: { boolean: bool }, + xStep: { number: number, 'undefined': 'undefined' }, + yStep: { number: number, 'undefined': 'undefined' }, + zStep: { number: number, 'undefined': 'undefined' }, + style: { + number: number, // TODO: either Graph3d.DEFAULT has string, or number allowed in documentation + string: ['bar', 'bar-color', 'bar-size', 'dot', 'dot-line', 'dot-color', 'dot-size', 'line', 'grid', 'surface'] + }, + tooltip: { boolean: bool, 'function': 'function' }, + tooltipStyle: { + content: { + color: { string: string }, + background: { string: string }, + border: { string: string }, + borderRadius: { string: string }, + boxShadow: { string: string }, + padding: { string: string }, + __type__: { object: object } + }, + line: { + borderLeft: { string: string }, + height: { string: string }, + width: { string: string }, + __type__: { object: object } + }, + dot: { + border: { string: string }, + borderRadius: { string: string }, + height: { string: string }, + width: { string: string }, + __type__: { object: object } + }, + __type__: { object: object } + }, + xValueLabel: { 'function': 'function' }, + yValueLabel: { 'function': 'function' }, + zValueLabel: { 'function': 'function' }, + valueMax: { number: number, 'undefined': 'undefined' }, + valueMin: { number: number, 'undefined': 'undefined' }, + verticalRatio: { number: number }, + + //globals : + height: { string: string }, + width: { string: string }, + __type__: { object: object } +}; + +exports.allOptions = allOptions; - getToken(); - if (token == ',') { - getToken(); - } - } +/***/ }), +/* 173 */ +/***/ (function(module, exports, __webpack_require__) { - if (token != ']') { - throw newSyntaxError('Bracket ] expected'); - } - getToken(); - } +"use strict"; - return attr; - } - /** - * Create a syntax error with extra information on current token and index. - * @param {String} message - * @returns {SyntaxError} err - */ - function newSyntaxError(message) { - return new SyntaxError(message + ', got "' + chop(token, 30) + '" (char ' + index + ')'); - } +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var Range = __webpack_require__(174); +var Filter = __webpack_require__(96); +var Settings = __webpack_require__(94); +var Point3d = __webpack_require__(34); - /** - * Chop off text after a maximum length - * @param {String} text - * @param {Number} maxLength - * @returns {String} - */ - function chop(text, maxLength) { - return text.length <= maxLength ? text : text.substr(0, 27) + '...'; - } +/** + * Creates a container for all data of one specific 3D-graph. + * + * On construction, the container is totally empty; the data + * needs to be initialized with method initializeData(). + * Failure to do so will result in the following exception begin thrown + * on instantiation of Graph3D: + * + * Error: Array, DataSet, or DataView expected + * + * @constructor DataGroup + */ +function DataGroup() { + this.dataTable = null; // The original data table +} - /** - * Execute a function fn for each pair of elements in two arrays - * @param {Array | *} array1 - * @param {Array | *} array2 - * @param {function} fn - */ - function forEach2(array1, array2, fn) { - if (Array.isArray(array1)) { - array1.forEach(function (elem1) { - if (Array.isArray(array2)) { - array2.forEach(function (elem2) { - fn(elem1, elem2); - }); - } else { - fn(elem1, array2); - } - }); - } else { - if (Array.isArray(array2)) { - array2.forEach(function (elem2) { - fn(array1, elem2); - }); - } else { - fn(array1, array2); - } - } +/** + * Initializes the instance from the passed data. + * + * Calculates minimum and maximum values and column index values. + * + * The graph3d instance is used internally to access the settings for + * the given instance. + * TODO: Pass settings only instead. + * + * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance. + * @param {Array | DataSet | DataView} rawData The data containing the items for + * the Graph. + * @param {number} style Style Number + * @returns {Array.} + */ +DataGroup.prototype.initializeData = function (graph3d, rawData, style) { + if (rawData === undefined) return; + + if (Array.isArray(rawData)) { + rawData = new DataSet(rawData); + } + + var data; + if (rawData instanceof DataSet || rawData instanceof DataView) { + data = rawData.get(); + } else { + throw new Error('Array, DataSet, or DataView expected'); } - /** - * Set a nested property on an object - * When nested objects are missing, they will be created. - * For example setProp({}, 'font.color', 'red') will return {font: {color: 'red'}} - * @param {Object} object - * @param {string} path A dot separated string like 'font.color' - * @param {*} value Value for the property - * @return {Object} Returns the original object, allows for chaining. - */ - function setProp(object, path, value) { - var names = path.split('.'); - var prop = names.pop(); - - // traverse over the nested objects - var obj = object; - for (var i = 0; i < names.length; i++) { - var name = names[i]; - if (!(name in obj)) { - obj[name] = {}; - } - obj = obj[name]; - } + if (data.length == 0) return; - // set the property value - obj[prop] = value; + this.style = style; - return object; + // unsubscribe from the dataTable + if (this.dataSet) { + this.dataSet.off('*', this._onChange); } - /** - * Convert an object with DOT attributes to their vis.js equivalents. - * @param {Object} attr Object with DOT attributes - * @param {Object} mapping - * @return {Object} Returns an object with vis.js attributes - */ - function convertAttr(attr, mapping) { - var converted = {}; - - for (var prop in attr) { - if (attr.hasOwnProperty(prop)) { - var visProp = mapping[prop]; - if (Array.isArray(visProp)) { - visProp.forEach(function (visPropI) { - setProp(converted, visPropI, attr[prop]); - }); - } else if (typeof visProp === 'string') { - setProp(converted, visProp, attr[prop]); - } else { - setProp(converted, prop, attr[prop]); - } - } + this.dataSet = rawData; + this.dataTable = data; + + // subscribe to changes in the dataset + var me = this; + this._onChange = function () { + graph3d.setData(me.dataSet); + }; + this.dataSet.on('*', this._onChange); + + // determine the location of x,y,z,value,filter columns + this.colX = 'x'; + this.colY = 'y'; + this.colZ = 'z'; + + var withBars = graph3d.hasBars(style); + + // determine barWidth from data + if (withBars) { + if (graph3d.defaultXBarWidth !== undefined) { + this.xBarWidth = graph3d.defaultXBarWidth; + } else { + this.xBarWidth = this.getSmallestDifference(data, this.colX) || 1; } - return converted; + if (graph3d.defaultYBarWidth !== undefined) { + this.yBarWidth = graph3d.defaultYBarWidth; + } else { + this.yBarWidth = this.getSmallestDifference(data, this.colY) || 1; + } } - /** - * Convert a string containing a graph in DOT language into a map containing - * with nodes and edges in the format of graph. - * @param {String} data Text containing a graph in DOT-notation - * @return {Object} graphData - */ - function DOTToGraph(data) { - // parse the DOT file - var dotData = parseDOT(data); - var graphData = { - nodes: [], - edges: [], - options: {} - }; + // calculate minima and maxima + this._initializeRange(data, this.colX, graph3d, withBars); + this._initializeRange(data, this.colY, graph3d, withBars); + this._initializeRange(data, this.colZ, graph3d, false); - // copy the nodes - if (dotData.nodes) { - dotData.nodes.forEach(function (dotNode) { - var graphNode = { - id: dotNode.id, - label: String(dotNode.label || dotNode.id) - }; - merge(graphNode, convertAttr(dotNode.attr, NODE_ATTR_MAPPING)); - if (graphNode.image) { - graphNode.shape = 'image'; - } - graphData.nodes.push(graphNode); + if (data[0].hasOwnProperty('style')) { + this.colValue = 'style'; + var valueRange = this.getColumnRange(data, this.colValue); + this._setRangeDefaults(valueRange, graph3d.defaultValueMin, graph3d.defaultValueMax); + this.valueRange = valueRange; + } + + // Initialize data filter if a filter column is provided + var table = this.getDataTable(); + if (table[0].hasOwnProperty('filter')) { + if (this.dataFilter === undefined) { + this.dataFilter = new Filter(this, 'filter', graph3d); + this.dataFilter.setOnLoadCallback(function () { + graph3d.redraw(); }); } + } - // copy the edges - if (dotData.edges) { - /** - * Convert an edge in DOT format to an edge with VisGraph format - * @param {Object} dotEdge - * @returns {Object} graphEdge - */ - var convertEdge = function convertEdge(dotEdge) { - var graphEdge = { - from: dotEdge.from, - to: dotEdge.to - }; - merge(graphEdge, convertAttr(dotEdge.attr, EDGE_ATTR_MAPPING)); - graphEdge.arrows = dotEdge.type === '->' ? 'to' : undefined; + var dataPoints; + if (this.dataFilter) { + // apply filtering + dataPoints = this.dataFilter._getDataPoints(); + } else { + // no filtering. load all data + dataPoints = this._getDataPoints(this.getDataTable()); + } + return dataPoints; +}; - return graphEdge; - }; +/** + * Collect the range settings for the given data column. + * + * This internal method is intended to make the range + * initalization more generic. + * + * TODO: if/when combined settings per axis defined, get rid of this. + * + * @private + * + * @param {'x'|'y'|'z'} column The data column to process + * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance; + * required for access to settings + * @returns {Object} + */ +DataGroup.prototype._collectRangeSettings = function (column, graph3d) { + var index = ['x', 'y', 'z'].indexOf(column); - dotData.edges.forEach(function (dotEdge) { - var from, to; - if (dotEdge.from instanceof Object) { - from = dotEdge.from.nodes; - } else { - from = { - id: dotEdge.from - }; - } + if (index == -1) { + throw new Error('Column \'' + column + '\' invalid'); + } - // TODO: support of solid/dotted/dashed edges (attr = 'style') - // TODO: support for attributes 'dir' and 'arrowhead' (edge arrows) + var upper = column.toUpperCase(); - if (dotEdge.to instanceof Object) { - to = dotEdge.to.nodes; - } else { - to = { - id: dotEdge.to - }; - } + return { + barWidth: this[column + 'BarWidth'], + min: graph3d['default' + upper + 'Min'], + max: graph3d['default' + upper + 'Max'], + step: graph3d['default' + upper + 'Step'], + range_label: column + 'Range', // Name of instance field to write to + step_label: column + 'Step' // Name of instance field to write to + }; +}; - if (dotEdge.from instanceof Object && dotEdge.from.edges) { - dotEdge.from.edges.forEach(function (subEdge) { - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); - } +/** + * Initializes the settings per given column. + * + * TODO: if/when combined settings per axis defined, rewrite this. + * + * @private + * + * @param {DataSet | DataView} data The data containing the items for the Graph + * @param {'x'|'y'|'z'} column The data column to process + * @param {vis.Graph3d} graph3d Reference to the calling Graph3D instance; + * required for access to settings + * @param {boolean} withBars True if initializing for bar graph + */ +DataGroup.prototype._initializeRange = function (data, column, graph3d, withBars) { + var NUMSTEPS = 5; + var settings = this._collectRangeSettings(column, graph3d); + + var range = this.getColumnRange(data, column); + if (withBars && column != 'z') { + // Safeguard for 'z'; it doesn't have a bar width + range.expand(settings.barWidth / 2); + } + + this._setRangeDefaults(range, settings.min, settings.max); + this[settings.range_label] = range; + this[settings.step_label] = settings.step !== undefined ? settings.step : range.range() / NUMSTEPS; +}; - forEach2(from, to, function (from, to) { - var subEdge = createEdge(graphData, from.id, to.id, dotEdge.type, dotEdge.attr); - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); +/** + * Creates a list with all the different values in the data for the given column. + * + * If no data passed, use the internal data of this instance. + * + * @param {'x'|'y'|'z'} column The data column to process + * @param {DataSet|DataView|undefined} data The data containing the items for the Graph + * + * @returns {Array} All distinct values in the given column data, sorted ascending. + */ +DataGroup.prototype.getDistinctValues = function (column, data) { + if (data === undefined) { + data = this.dataTable; + } - if (dotEdge.to instanceof Object && dotEdge.to.edges) { - dotEdge.to.edges.forEach(function (subEdge) { - var graphEdge = convertEdge(subEdge); - graphData.edges.push(graphEdge); - }); - } - }); - } + var values = []; - // copy the options - if (dotData.attr) { - graphData.options = dotData.attr; + for (var i = 0; i < data.length; i++) { + var value = data[i][column] || 0; + if (values.indexOf(value) === -1) { + values.push(value); } - - return graphData; } - // exports - exports.parseDOT = parseDOT; - exports.DOTToGraph = DOTToGraph; + return values.sort(function (a, b) { + return a - b; + }); +}; -/***/ }), -/* 163 */ -/***/ (function(module, exports) { +/** + * Determine the smallest difference between the values for given + * column in the passed data set. + * + * @param {DataSet|DataView|undefined} data The data containing the items for the Graph + * @param {'x'|'y'|'z'} column The data column to process + * + * @returns {number|null} Smallest difference value or + * null, if it can't be determined. + */ +DataGroup.prototype.getSmallestDifference = function (data, column) { + var values = this.getDistinctValues(data, column); - 'use strict'; + // Get all the distinct diffs + // Array values is assumed to be sorted here + var smallest_diff = null; - function parseGephi(gephiJSON, optionsObj) { - var edges = []; - var nodes = []; - var options = { - edges: { - inheritColor: false - }, - nodes: { - fixed: false, - parseColor: false - } - }; + for (var i = 1; i < values.length; i++) { + var diff = values[i] - values[i - 1]; - if (optionsObj !== undefined) { - if (optionsObj.fixed !== undefined) { - options.nodes.fixed = optionsObj.fixed; - } - if (optionsObj.parseColor !== undefined) { - options.nodes.parseColor = optionsObj.parseColor; - } - if (optionsObj.inheritColor !== undefined) { - options.edges.inheritColor = optionsObj.inheritColor; - } - } - - var gEdges = gephiJSON.edges; - var gNodes = gephiJSON.nodes; - for (var i = 0; i < gEdges.length; i++) { - var edge = {}; - var gEdge = gEdges[i]; - edge['id'] = gEdge.id; - edge['from'] = gEdge.source; - edge['to'] = gEdge.target; - edge['attributes'] = gEdge.attributes; - edge['label'] = gEdge.label; - edge['title'] = gEdge.attributes !== undefined ? gEdge.attributes.title : undefined; - if (gEdge['type'] === 'Directed') { - edge['arrows'] = 'to'; - } - // edge['value'] = gEdge.attributes !== undefined ? gEdge.attributes.Weight : undefined; - // edge['width'] = edge['value'] !== undefined ? undefined : edgegEdge.size; - if (gEdge.color && options.inheritColor === false) { - edge['color'] = gEdge.color; - } - edges.push(edge); - } - - for (var i = 0; i < gNodes.length; i++) { - var node = {}; - var gNode = gNodes[i]; - node['id'] = gNode.id; - node['attributes'] = gNode.attributes; - node['x'] = gNode.x; - node['y'] = gNode.y; - node['label'] = gNode.label; - node['title'] = gNode.attributes !== undefined ? gNode.attributes.title : gNode.title; - if (options.nodes.parseColor === true) { - node['color'] = gNode.color; - } else { - node['color'] = gNode.color !== undefined ? { background: gNode.color, border: gNode.color, highlight: { background: gNode.color, border: gNode.color }, hover: { background: gNode.color, border: gNode.color } } : undefined; - } - node['size'] = gNode.size; - node['fixed'] = options.nodes.fixed && gNode.x !== undefined && gNode.y !== undefined; - nodes.push(node); + if (smallest_diff == null || smallest_diff > diff) { + smallest_diff = diff; } + } + + return smallest_diff; +}; + +/** + * Get the absolute min/max values for the passed data column. + * + * @param {DataSet|DataView|undefined} data The data containing the items for the Graph + * @param {'x'|'y'|'z'} column The data column to process + * + * @returns {Range} A Range instance with min/max members properly set. + */ +DataGroup.prototype.getColumnRange = function (data, column) { + var range = new Range(); - return { nodes: nodes, edges: edges }; + // Adjust the range so that it covers all values in the passed data elements. + for (var i = 0; i < data.length; i++) { + var item = data[i][column]; + range.adjust(item); } - exports.parseGephi = parseGephi; + return range; +}; -/***/ }), -/* 164 */ -/***/ (function(module, exports) { +/** + * Determines the number of rows in the current data. + * + * @returns {number} + */ +DataGroup.prototype.getNumberOfRows = function () { + return this.dataTable.length; +}; - 'use strict'; +/** + * Set default values for range + * + * The default values override the range values, if defined. + * + * Because it's possible that only defaultMin or defaultMax is set, it's better + * to pass in a range already set with the min/max set from the data. Otherwise, + * it's quite hard to process the min/max properly. + * + * @param {vis.Range} range + * @param {number} [defaultMin=range.min] + * @param {number} [defaultMax=range.max] + * @private + */ +DataGroup.prototype._setRangeDefaults = function (range, defaultMin, defaultMax) { + if (defaultMin !== undefined) { + range.min = defaultMin; + } - // English - exports['en'] = { - edit: 'Edit', - del: 'Delete selected', - back: 'Back', - addNode: 'Add Node', - addEdge: 'Add Edge', - editNode: 'Edit Node', - editEdge: 'Edit Edge', - addDescription: 'Click in an empty space to place a new node.', - edgeDescription: 'Click on a node and drag the edge to another node to connect them.', - editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.', - createEdgeError: 'Cannot link edges to a cluster.', - deleteClusterError: 'Clusters cannot be deleted.', - editClusterError: 'Clusters cannot be edited.' - }; - exports['en_EN'] = exports['en']; - exports['en_US'] = exports['en']; - - // German - exports['de'] = { - edit: 'Editieren', - del: 'L\xF6sche Auswahl', - back: 'Zur\xFCck', - addNode: 'Knoten hinzuf\xFCgen', - addEdge: 'Kante hinzuf\xFCgen', - editNode: 'Knoten editieren', - editEdge: 'Kante editieren', - addDescription: 'Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.', - edgeDescription: 'Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.', - editEdgeDescription: 'Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.', - createEdgeError: 'Es ist nicht m\xF6glich, Kanten mit Clustern zu verbinden.', - deleteClusterError: 'Cluster k\xF6nnen nicht gel\xF6scht werden.', - editClusterError: 'Cluster k\xF6nnen nicht editiert werden.' - }; - exports['de_DE'] = exports['de']; - - // Spanish - exports['es'] = { - edit: 'Editar', - del: 'Eliminar selecci\xF3n', - back: '\xC1tras', - addNode: 'A\xF1adir nodo', - addEdge: 'A\xF1adir arista', - editNode: 'Editar nodo', - editEdge: 'Editar arista', - addDescription: 'Haga clic en un lugar vac\xEDo para colocar un nuevo nodo.', - edgeDescription: 'Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.', - editEdgeDescription: 'Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.', - createEdgeError: 'No se puede conectar una arista a un grupo.', - deleteClusterError: 'No es posible eliminar grupos.', - editClusterError: 'No es posible editar grupos.' - }; - exports['es_ES'] = exports['es']; - - //Italiano - exports['it'] = { - edit: 'Modifica', - del: 'Cancella la selezione', - back: 'Indietro', - addNode: 'Aggiungi un nodo', - addEdge: 'Aggiungi un vertice', - editNode: 'Modifica il nodo', - editEdge: 'Modifica il vertice', - addDescription: 'Clicca per aggiungere un nuovo nodo', - edgeDescription: 'Clicca su un nodo e trascinalo ad un altro nodo per connetterli.', - editEdgeDescription: 'Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.', - createEdgeError: 'Non si possono collegare vertici ad un cluster', - deleteClusterError: 'I cluster non possono essere cancellati', - editClusterError: 'I clusters non possono essere modificati.' - }; - exports['it_IT'] = exports['it']; - - // Dutch - exports['nl'] = { - edit: 'Wijzigen', - del: 'Selectie verwijderen', - back: 'Terug', - addNode: 'Node toevoegen', - addEdge: 'Link toevoegen', - editNode: 'Node wijzigen', - editEdge: 'Link wijzigen', - addDescription: 'Klik op een leeg gebied om een nieuwe node te maken.', - edgeDescription: 'Klik op een node en sleep de link naar een andere node om ze te verbinden.', - editEdgeDescription: 'Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.', - createEdgeError: 'Kan geen link maken naar een cluster.', - deleteClusterError: 'Clusters kunnen niet worden verwijderd.', - editClusterError: 'Clusters kunnen niet worden aangepast.' - }; - exports['nl_NL'] = exports['nl']; - exports['nl_BE'] = exports['nl']; - - // Portuguese Brazil - exports['pt-br'] = { - edit: 'Editar', - del: 'Remover selecionado', - back: 'Voltar', - addNode: 'Adicionar nó', - addEdge: 'Adicionar aresta', - editNode: 'Editar nó', - editEdge: 'Editar aresta', - addDescription: 'Clique em um espaço em branco para adicionar um novo nó', - edgeDescription: 'Clique em um nó e arraste a aresta até outro nó para conectá-los', - editEdgeDescription: 'Clique nos pontos de controle e os arraste para um nó para conectá-los', - createEdgeError: 'Não foi possível linkar arestas a um cluster.', - deleteClusterError: 'Clusters não puderam ser removidos.', - editClusterError: 'Clusters não puderam ser editados.' - }; - exports['pt-BR'] = exports['pt-br']; - exports['pt_BR'] = exports['pt-br']; - exports['pt_br'] = exports['pt-br']; - - // Russian - exports['ru'] = { - edit: 'Редактировать', - del: 'Удалить выбранное', - back: 'Назад', - addNode: 'Добавить узел', - addEdge: 'Добавить ребро', - editNode: 'Редактировать узел', - editEdge: 'Редактировать ребро', - addDescription: 'Кликните в свободное место, чтобы добавить новый узел.', - edgeDescription: 'Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.', - editEdgeDescription: 'Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.', - createEdgeError: 'Невозможно соединить ребра в кластер.', - deleteClusterError: 'Кластеры не могут быть удалены', - editClusterError: 'Кластеры недоступны для редактирования.' - }; - exports['ru_RU'] = exports['ru']; + if (defaultMax !== undefined) { + range.max = defaultMax; + } -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { + // This is the original way that the default min/max values were adjusted. + // TODO: Perhaps it's better if an error is thrown if the values do not agree. + // But this will change the behaviour. + if (range.max <= range.min) range.max = range.min + 1; +}; - "use strict"; +DataGroup.prototype.getDataTable = function () { + return this.dataTable; +}; - Object.defineProperty(exports, "__esModule", { - value: true - }); +DataGroup.prototype.getDataSet = function () { + return this.dataSet; +}; - var _classCallCheck2 = __webpack_require__(135); +/** + * Return all data values as a list of Point3d objects + * @param {Array.} data + * @returns {Array.} + */ +DataGroup.prototype.getDataPoints = function (data) { + var dataPoints = []; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + for (var i = 0; i < data.length; i++) { + var point = new Point3d(); + point.x = data[i][this.colX] || 0; + point.y = data[i][this.colY] || 0; + point.z = data[i][this.colZ] || 0; + point.data = data[i]; - var _createClass2 = __webpack_require__(136); + if (this.colValue !== undefined) { + point.value = data[i][this.colValue] || 0; + } - var _createClass3 = _interopRequireDefault(_createClass2); + var obj = {}; + obj.point = point; + obj.bottom = new Point3d(point.x, point.y, this.zRange.min); + obj.trans = undefined; + obj.screen = undefined; - var _CachedImage = __webpack_require__(166); + dataPoints.push(obj); + } - var _CachedImage2 = _interopRequireDefault(_CachedImage); + return dataPoints; +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/** + * Copy all values from the data table to a matrix. + * + * The provided values are supposed to form a grid of (x,y) positions. + * @param {Array.} data + * @returns {Array.} + * @private + */ +DataGroup.prototype.initDataAsMatrix = function (data) { + // TODO: store the created matrix dataPoints in the filters instead of + // reloading each time. + var x, y, i, obj; - /** - * @class Images - * This class loads images and keeps them stored. - */ - var Images = function () { - function Images(callback) { - (0, _classCallCheck3["default"])(this, Images); + // create two lists with all present x and y values + var dataX = this.getDistinctValues(this.colX, data); + var dataY = this.getDistinctValues(this.colY, data); - this.images = {}; - this.imageBroken = {}; - this.callback = callback; - } + var dataPoints = this.getDataPoints(data); - /** - * @param {string} url The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image - * @param {string} brokenUrl Url the broken image to try and load - * @return {Image} imageToLoadBrokenUrlOn The image object - */ + // create a grid, a 2d matrix, with all values. + var dataMatrix = []; // temporary data matrix + for (i = 0; i < dataPoints.length; i++) { + obj = dataPoints[i]; + // TODO: implement Array().indexOf() for Internet Explorer + var xIndex = dataX.indexOf(obj.point.x); + var yIndex = dataY.indexOf(obj.point.y); - (0, _createClass3["default"])(Images, [{ - key: "_tryloadBrokenUrl", - value: function _tryloadBrokenUrl(url, brokenUrl, imageToLoadBrokenUrlOn) { - //If these parameters aren't specified then exit the function because nothing constructive can be done - if (url === undefined || imageToLoadBrokenUrlOn === undefined) return; - if (brokenUrl === undefined) { - console.warn("No broken url image defined"); - return; - } + if (dataMatrix[xIndex] === undefined) { + dataMatrix[xIndex] = []; + } - //Clear the old subscription to the error event and put a new in place that only handle errors in loading the brokenImageUrl - imageToLoadBrokenUrlOn.onerror = function () { - console.error("Could not load brokenImage:", brokenUrl); - // cache item will contain empty image, this should be OK for default - }; + dataMatrix[xIndex][yIndex] = obj; + } - //Set the source of the image to the brokenUrl, this is actually what kicks off the loading of the broken image - imageToLoadBrokenUrlOn.image.src = brokenUrl; - } + // fill in the pointers to the neighbors. + for (x = 0; x < dataMatrix.length; x++) { + for (y = 0; y < dataMatrix[x].length; y++) { + if (dataMatrix[x][y]) { + dataMatrix[x][y].pointRight = x < dataMatrix.length - 1 ? dataMatrix[x + 1][y] : undefined; + dataMatrix[x][y].pointTop = y < dataMatrix[x].length - 1 ? dataMatrix[x][y + 1] : undefined; + dataMatrix[x][y].pointCross = x < dataMatrix.length - 1 && y < dataMatrix[x].length - 1 ? dataMatrix[x + 1][y + 1] : undefined; + } + } + } - /** - * @return {Image} imageToRedrawWith The images that will be passed to the callback when it is invoked - */ + return dataPoints; +}; - }, { - key: "_redrawWithImage", - value: function _redrawWithImage(imageToRedrawWith) { - if (this.callback) { - this.callback(imageToRedrawWith); - } - } +/** + * Return common information, if present + * + * @returns {string} + */ +DataGroup.prototype.getInfo = function () { + var dataFilter = this.dataFilter; + if (!dataFilter) return undefined; + + return dataFilter.getLabel() + ': ' + dataFilter.getSelectedValue(); +}; + +/** + * Reload the data + */ +DataGroup.prototype.reload = function () { + if (this.dataTable) { + this.setData(this.dataTable); + } +}; - /** - * @param {string} url Url of the image - * @param {string} brokenUrl Url of an image to use if the url image is not found - * @return {Image} img The image object - */ +/** + * Filter the data based on the current filter + * + * @param {Array} data + * @returns {Array} dataPoints Array with point objects which can be drawn on + * screen + */ +DataGroup.prototype._getDataPoints = function (data) { + var dataPoints = []; + + if (this.style === Settings.STYLE.GRID || this.style === Settings.STYLE.SURFACE) { + dataPoints = this.initDataAsMatrix(data); + } else { + // 'dot', 'dot-line', etc. + this._checkValueField(data); + dataPoints = this.getDataPoints(data); - }, { - key: "load", - value: function load(url, brokenUrl, id) { - var _this = this; + if (this.style === Settings.STYLE.LINE) { + // Add next member points for line drawing + for (var i = 0; i < dataPoints.length; i++) { + if (i > 0) { + dataPoints[i - 1].pointNext = dataPoints[i]; + } + } + } + } - //Try and get the image from the cache, if successful then return the cached image - var cachedImage = this.images[url]; - if (cachedImage) return cachedImage; + return dataPoints; +}; - //Create a new image - var img = new _CachedImage2["default"](); +/** + * Check if the state is consistent for the use of the value field. + * + * Throws if a problem is detected. + * + * @param {Array.} data + * @private + */ +DataGroup.prototype._checkValueField = function (data) { - // Need to add to cache here, otherwise final return will spawn different copies of the same image, - // Also, there will be multiple loads of the same image. - this.images[url] = img; + var hasValueField = this.style === Settings.STYLE.BARCOLOR || this.style === Settings.STYLE.BARSIZE || this.style === Settings.STYLE.DOTCOLOR || this.style === Settings.STYLE.DOTSIZE; - //Subscribe to the event that is raised if the image loads successfully - img.image.onload = function () { - // Properly init the cached item and then request a redraw - _this._fixImageCoordinates(img.image); - img.init(); - _this._redrawWithImage(img); - }; + if (!hasValueField) { + return; // No need to check further + } - //Subscribe to the event that is raised if the image fails to load - img.image.onerror = function () { - console.error("Could not load image:", url); - //Try and load the image specified by the brokenUrl using - _this._tryloadBrokenUrl(url, brokenUrl, img); - }; + // Following field must be present for the current graph style + if (this.colValue === undefined) { + throw new Error('Expected data to have ' + ' field \'style\' ' + ' for graph style \'' + this.style + '\''); + } - //Set the source of the image to the url, this is what actually kicks off the loading of the image - img.image.src = url; - - //Return the new image - return img; - } - - /** - * IE11 fix -- thanks dponch! - * - * Local helper function - * - * @private - */ - - }, { - key: "_fixImageCoordinates", - value: function _fixImageCoordinates(imageToCache) { - if (imageToCache.width === 0) { - document.body.appendChild(imageToCache); - imageToCache.width = imageToCache.offsetWidth; - imageToCache.height = imageToCache.offsetHeight; - document.body.removeChild(imageToCache); - } - } - }]); - return Images; - }(); + // The data must also contain this field. + // Note that only first data element is checked. + if (data[0][this.colValue] === undefined) { + throw new Error('Expected data to have ' + ' field \'' + this.colValue + '\' ' + ' for graph style \'' + this.style + '\''); + } +}; - exports["default"] = Images; +module.exports = DataGroup; /***/ }), -/* 166 */ +/* 174 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _classCallCheck2 = __webpack_require__(135); +/** + * @prototype Range + * + * Helper class to make working with related min and max values easier. + * + * The range is inclusive; a given value is considered part of the range if: + * + * this.min <= value <= this.max + */ +function Range() { + this.min = undefined; + this.max = undefined; +} - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +/** + * Adjust the range so that the passed value fits in it. + * + * If the value is outside of the current extremes, adjust + * the min or max so that the value is within the range. + * + * @param {number} value Numeric value to fit in range + */ +Range.prototype.adjust = function (value) { + if (value === undefined) return; - var _createClass2 = __webpack_require__(136); + if (this.min === undefined || this.min > value) { + this.min = value; + } - var _createClass3 = _interopRequireDefault(_createClass2); + if (this.max === undefined || this.max < value) { + this.max = value; + } +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +/** + * Adjust the current range so that the passed range fits in it. + * + * @param {Range} range Range instance to fit in current instance + */ +Range.prototype.combine = function (range) { + this.add(range.min); + this.add(range.max); +}; - /** - * Associates a canvas to a given image, containing a number of renderings - * of the image at various sizes. - * - * This technique is known as 'mipmapping'. - * - * NOTE: Images can also be of type 'data:svg+xml`. This code also works - * for svg, but the mipmapping may not be necessary. - */ - var CachedImage = function () { - function CachedImage(image) { - (0, _classCallCheck3['default'])(this, CachedImage); +/** + * Expand the range by the given value + * + * min will be lowered by given value; + * max will be raised by given value + * + * Shrinking by passing a negative value is allowed. + * + * @param {number} val Amount by which to expand or shrink current range with + */ +Range.prototype.expand = function (val) { + if (val === undefined) { + return; + } - this.NUM_ITERATIONS = 4; // Number of items in the coordinates array + var newMin = this.min - val; + var newMax = this.max + val; - this.image = new Image(); - this.canvas = document.createElement('canvas'); - } + // Note that following allows newMin === newMax. + // This should be OK, since method expand() allows this also. + if (newMin > newMax) { + throw new Error('Passed expansion value makes range invalid'); + } - /** - * Called when the image has been succesfully loaded. - */ + this.min = newMin; + this.max = newMax; +}; +/** + * Determine the full range width of current instance. + * + * @returns {num} The calculated width of this range + */ +Range.prototype.range = function () { + return this.max - this.min; +}; - (0, _createClass3['default'])(CachedImage, [{ - key: 'init', - value: function init() { - if (this.initialized()) return; +/** + * Determine the central point of current instance. + * + * @returns {number} the value in the middle of min and max + */ +Range.prototype.center = function () { + return (this.min + this.max) / 2; +}; - this.src = this.image.src; // For same interface with Image - var w = this.image.width; - var h = this.image.height; +module.exports = Range; - // Ease external access - this.width = w; - this.height = h; +/***/ }), +/* 175 */ +/***/ (function(module, exports, __webpack_require__) { - // Make canvas as small as possible - this.canvas.width = 3 * w / 4; - this.canvas.height = h / 2; +"use strict"; +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; - // Coordinates and sizes of images contained in the canvas - // Values per row: [top x, left y, width, height] - this.coordinates = [[0, 0, w / 2, h / 2], [w / 2, 0, w / 4, h / 4], [w / 2, h / 4, w / 8, h / 8], [5 * w / 8, h / 4, w / 16, h / 16]]; +(function (factory) { + if (true) { + // AMD. Register as an anonymous module. + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(); + } else { + // Browser globals (root is window) + window.propagating = factory(); + } +}(function () { + var _firstTarget = null; // singleton, will contain the target element where the touch event started - this._fillMipMap(); - } + /** + * Extend an Hammer.js instance with event propagation. + * + * Features: + * - Events emitted by hammer will propagate in order from child to parent + * elements. + * - Events are extended with a function `event.stopPropagation()` to stop + * propagation to parent elements. + * - An option `preventDefault` to stop all default browser behavior. + * + * Usage: + * var hammer = propagatingHammer(new Hammer(element)); + * var hammer = propagatingHammer(new Hammer(element), {preventDefault: true}); + * + * @param {Hammer.Manager} hammer An hammer instance. + * @param {Object} [options] Available options: + * - `preventDefault: true | false | 'mouse' | 'touch' | 'pen'`. + * Enforce preventing the default browser behavior. + * Cannot be set to `false`. + * @return {Hammer.Manager} Returns the same hammer instance with extended + * functionality + */ + return function propagating(hammer, options) { + var _options = options || { + preventDefault: false + }; - /** - * @return {Boolean} true if init() has been called, false otherwise. - */ + if (hammer.Manager) { + // This looks like the Hammer constructor. + // Overload the constructors with our own. + var Hammer = hammer; - }, { - key: 'initialized', - value: function initialized() { - return this.coordinates !== undefined; - } + var PropagatingHammer = function(element, options) { + var o = Object.create(_options); + if (options) Hammer.assign(o, options); + return propagating(new Hammer(element, o), o); + }; + Hammer.assign(PropagatingHammer, Hammer); - /** - * Redraw main image in various sizes to the context. - * - * The rationale behind this is to reduce artefacts due to interpolation - * at differing zoom levels. - * - * Source: http://stackoverflow.com/q/18761404/1223531 - * - * This methods takes the resizing out of the drawing loop, in order to - * reduce performance overhead. - * - * TODO: The code assumes that a 2D context can always be gotten. This is - * not necessarily true! OTOH, if not true then usage of this class - * is senseless. - * - * @private - */ + PropagatingHammer.Manager = function (element, options) { + var o = Object.create(_options); + if (options) Hammer.assign(o, options); + return propagating(new Hammer.Manager(element, o), o); + }; - }, { - key: '_fillMipMap', - value: function _fillMipMap() { - var ctx = this.canvas.getContext('2d'); + return PropagatingHammer; + } - // First zoom-level comes from the image - var to = this.coordinates[0]; - ctx.drawImage(this.image, to[0], to[1], to[2], to[3]); + // create a wrapper object which will override the functions + // `on`, `off`, `destroy`, and `emit` of the hammer instance + var wrapper = Object.create(hammer); - // The rest are copy actions internal to the canvas/context - for (var iterations = 1; iterations < this.NUM_ITERATIONS; iterations++) { - var from = this.coordinates[iterations - 1]; - var _to = this.coordinates[iterations]; + // attach to DOM element + var element = hammer.element; - ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], _to[0], _to[1], _to[2], _to[3]); - } - } + if(!element.hammer) element.hammer = []; + element.hammer.push(wrapper); - /** - * Draw the image, using the mipmap if necessary. - * - * MipMap is only used if param factor > 2; otherwise, original bitmap - * is resized. This is also used to skip mipmap usage, e.g. by setting factor = 1 - * - * Credits to 'Alex de Mulder' for original implementation. - * - * ctx {Context} context on which to draw zoomed image - * factor {Float} scale factor at which to draw - */ + // register an event to catch the start of a gesture and store the + // target in a singleton + hammer.on('hammer.input', function (event) { + if (_options.preventDefault === true || (_options.preventDefault === event.pointerType)) { + event.preventDefault(); + } + if (event.isFirst) { + _firstTarget = event.target; + } + }); - }, { - key: 'drawImageAtPosition', - value: function drawImageAtPosition(ctx, factor, left, top, width, height) { - if (factor > 2 && this.initialized()) { - // Determine which zoomed image to use - factor *= 0.5; - var iterations = 0; - while (factor > 2 && iterations < this.NUM_ITERATIONS) { - factor *= 0.5; - iterations += 1; - } + /** @type {Object.>} */ + wrapper._handlers = {}; - if (iterations >= this.NUM_ITERATIONS) { - iterations = this.NUM_ITERATIONS - 1; - } - //console.log("iterations: " + iterations); + /** + * Register a handler for one or multiple events + * @param {String} events A space separated string with events + * @param {function} handler A callback function, called as handler(event) + * @returns {Hammer.Manager} Returns the hammer instance + */ + wrapper.on = function (events, handler) { + // register the handler + split(events).forEach(function (event) { + var _handlers = wrapper._handlers[event]; + if (!_handlers) { + wrapper._handlers[event] = _handlers = []; - var from = this.coordinates[iterations]; - ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], left, top, width, height); - } else if (this._isImageOk()) { - // Draw image directly - ctx.drawImage(this.image, left, top, width, height); + // register the static, propagated handler + hammer.on(event, propagatedHandler); } - } + _handlers.push(handler); + }); - /** - * Check if image is loaded - * - * Source: http://stackoverflow.com/a/1977898/1223531 - * - * @private - */ + return wrapper; + }; - }, { - key: '_isImageOk', - value: function _isImageOk(img) { - var img = this.image; - - // During the onload event, IE correctly identifies any images that - // weren’t downloaded as not complete. Others should too. Gecko-based - // browsers act like NS4 in that they report this incorrectly. - if (!img.complete) { - return false; + /** + * Unregister a handler for one or multiple events + * @param {String} events A space separated string with events + * @param {function} [handler] Optional. The registered handler. If not + * provided, all handlers for given events + * are removed. + * @returns {Hammer.Manager} Returns the hammer instance + */ + wrapper.off = function (events, handler) { + // unregister the handler + split(events).forEach(function (event) { + var _handlers = wrapper._handlers[event]; + if (_handlers) { + _handlers = handler ? _handlers.filter(function (h) { + return h !== handler; + }) : []; + + if (_handlers.length > 0) { + wrapper._handlers[event] = _handlers; + } + else { + // remove static, propagated handler + hammer.off(event, propagatedHandler); + delete wrapper._handlers[event]; + } } + }); - // However, they do have two very useful properties: naturalWidth and - // naturalHeight. These give the true size of the image. If it failed - // to load, either of these should be zero. + return wrapper; + }; - if (typeof img.naturalWidth !== "undefined" && img.naturalWidth === 0) { - return false; - } + /** + * Emit to the event listeners + * @param {string} eventType + * @param {Event} event + */ + wrapper.emit = function(eventType, event) { + _firstTarget = event.target; + hammer.emit(eventType, event); + }; - // No other way of checking: assume it’s ok. - return true; - } - }]); - return CachedImage; - }(); + wrapper.destroy = function () { + // Detach from DOM element + var hammers = hammer.element.hammer; + var idx = hammers.indexOf(wrapper); + if(idx !== -1) hammers.splice(idx,1); + if(!hammers.length) delete hammer.element.hammer; - exports['default'] = CachedImage; + // clear all handlers + wrapper._handlers = {}; -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { + // call original hammer destroy + hammer.destroy(); + }; - "use strict"; + // split a string with space separated words + function split(events) { + return events.match(/[^ ]+/g); + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * A static event handler, applying event propagation. + * @param {Object} event + */ + function propagatedHandler(event) { + // let only a single hammer instance handle this event + if (event.type !== 'hammer.input') { + // it is possible that the same srcEvent is used with multiple hammer events, + // we keep track on which events are handled in an object _handled + if (!event.srcEvent._handled) { + event.srcEvent._handled = {}; + } + + if (event.srcEvent._handled[event.type]) { + return; + } + else { + event.srcEvent._handled[event.type] = true; + } + } - var _classCallCheck2 = __webpack_require__(135); + // attach a stopPropagation function to the event + var stopped = false; + event.stopPropagation = function () { + stopped = true; + }; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + //wrap the srcEvent's stopPropagation to also stop hammer propagation: + var srcStop = event.srcEvent.stopPropagation.bind(event.srcEvent); + if(typeof srcStop == "function") { + event.srcEvent.stopPropagation = function(){ + srcStop(); + event.stopPropagation(); + } + } - var _createClass2 = __webpack_require__(136); + // attach firstTarget property to the event + event.firstTarget = _firstTarget; - var _createClass3 = _interopRequireDefault(_createClass2); + // propagate over all elements (until stopped) + var elem = _firstTarget; + while (elem && !stopped) { + var elemHammer = elem.hammer; + if(elemHammer){ + var _handlers; + for(var k = 0; k < elemHammer.length; k++){ + _handlers = elemHammer[k]._handlers[event.type]; + if(_handlers) for (var i = 0; i < _handlers.length && !stopped; i++) { + _handlers[i](event); + } + } + } + elem = elem.parentNode; + } + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + return wrapper; + }; +})); - var util = __webpack_require__(1); - /** - * @class Groups - * This class can store groups and options specific for groups. - */ +/***/ }), +/* 176 */ +/***/ (function(module, exports, __webpack_require__) { - var Groups = function () { - function Groups() { - (0, _classCallCheck3["default"])(this, Groups); +var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.7 - 2016-04-22 + * http://hammerjs.github.io/ + * + * Copyright (c) 2016 Jorik Tangelder; + * Licensed under the MIT license */ +(function(window, document, exportName, undefined) { + 'use strict'; - this.clear(); - this.defaultIndex = 0; - this.groupsArray = []; - this.groupIndex = 0; - - this.defaultGroups = [{ border: "#2B7CE9", background: "#97C2FC", highlight: { border: "#2B7CE9", background: "#D2E5FF" }, hover: { border: "#2B7CE9", background: "#D2E5FF" } }, // 0: blue - { border: "#FFA500", background: "#FFFF00", highlight: { border: "#FFA500", background: "#FFFFA3" }, hover: { border: "#FFA500", background: "#FFFFA3" } }, // 1: yellow - { border: "#FA0A10", background: "#FB7E81", highlight: { border: "#FA0A10", background: "#FFAFB1" }, hover: { border: "#FA0A10", background: "#FFAFB1" } }, // 2: red - { border: "#41A906", background: "#7BE141", highlight: { border: "#41A906", background: "#A1EC76" }, hover: { border: "#41A906", background: "#A1EC76" } }, // 3: green - { border: "#E129F0", background: "#EB7DF4", highlight: { border: "#E129F0", background: "#F0B3F5" }, hover: { border: "#E129F0", background: "#F0B3F5" } }, // 4: magenta - { border: "#7C29F0", background: "#AD85E4", highlight: { border: "#7C29F0", background: "#D3BDF0" }, hover: { border: "#7C29F0", background: "#D3BDF0" } }, // 5: purple - { border: "#C37F00", background: "#FFA807", highlight: { border: "#C37F00", background: "#FFCA66" }, hover: { border: "#C37F00", background: "#FFCA66" } }, // 6: orange - { border: "#4220FB", background: "#6E6EFD", highlight: { border: "#4220FB", background: "#9B9BFD" }, hover: { border: "#4220FB", background: "#9B9BFD" } }, // 7: darkblue - { border: "#FD5A77", background: "#FFC0CB", highlight: { border: "#FD5A77", background: "#FFD1D9" }, hover: { border: "#FD5A77", background: "#FFD1D9" } }, // 8: pink - { border: "#4AD63A", background: "#C2FABC", highlight: { border: "#4AD63A", background: "#E6FFE3" }, hover: { border: "#4AD63A", background: "#E6FFE3" } }, // 9: mint - - { border: "#990000", background: "#EE0000", highlight: { border: "#BB0000", background: "#FF3333" }, hover: { border: "#BB0000", background: "#FF3333" } }, // 10:bright red - - { border: "#FF6000", background: "#FF6000", highlight: { border: "#FF6000", background: "#FF6000" }, hover: { border: "#FF6000", background: "#FF6000" } }, // 12: real orange - { border: "#97C2FC", background: "#2B7CE9", highlight: { border: "#D2E5FF", background: "#2B7CE9" }, hover: { border: "#D2E5FF", background: "#2B7CE9" } }, // 13: blue - { border: "#399605", background: "#255C03", highlight: { border: "#399605", background: "#255C03" }, hover: { border: "#399605", background: "#255C03" } }, // 14: green - { border: "#B70054", background: "#FF007E", highlight: { border: "#B70054", background: "#FF007E" }, hover: { border: "#B70054", background: "#FF007E" } }, // 15: magenta - { border: "#AD85E4", background: "#7C29F0", highlight: { border: "#D3BDF0", background: "#7C29F0" }, hover: { border: "#D3BDF0", background: "#7C29F0" } }, // 16: purple - { border: "#4557FA", background: "#000EA1", highlight: { border: "#6E6EFD", background: "#000EA1" }, hover: { border: "#6E6EFD", background: "#000EA1" } }, // 17: darkblue - { border: "#FFC0CB", background: "#FD5A77", highlight: { border: "#FFD1D9", background: "#FD5A77" }, hover: { border: "#FFD1D9", background: "#FD5A77" } }, // 18: pink - { border: "#C2FABC", background: "#74D66A", highlight: { border: "#E6FFE3", background: "#74D66A" }, hover: { border: "#E6FFE3", background: "#74D66A" } }, // 19: mint - - { border: "#EE0000", background: "#990000", highlight: { border: "#FF3333", background: "#BB0000" }, hover: { border: "#FF3333", background: "#BB0000" } // 20:bright red - }]; - - this.options = {}; - this.defaultOptions = { - useDefaultGroups: true - }; - util.extend(this.options, this.defaultOptions); +var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; +var TEST_ELEMENT = document.createElement('div'); + +var TYPE_FUNCTION = 'function'; + +var round = Math.round; +var abs = Math.abs; +var now = Date.now; + +/** + * set a timeout with a given scope + * @param {Function} fn + * @param {Number} timeout + * @param {Object} context + * @returns {number} + */ +function setTimeoutContext(fn, timeout, context) { + return setTimeout(bindFn(fn, context), timeout); +} + +/** + * if the argument is an array, we want to execute the fn on each entry + * if it aint an array we don't want to do a thing. + * this is used by all the methods that accept a single and array argument. + * @param {*|Array} arg + * @param {String} fn + * @param {Object} [context] + * @returns {Boolean} + */ +function invokeArrayArg(arg, fn, context) { + if (Array.isArray(arg)) { + each(arg, context[fn], context); + return true; } + return false; +} + +/** + * walk objects and arrays + * @param {Object} obj + * @param {Function} iterator + * @param {Object} context + */ +function each(obj, iterator, context) { + var i; - (0, _createClass3["default"])(Groups, [{ - key: "setOptions", - value: function setOptions(options) { - var optionFields = ['useDefaultGroups']; + if (!obj) { + return; + } - if (options !== undefined) { - for (var groupName in options) { - if (options.hasOwnProperty(groupName)) { - if (optionFields.indexOf(groupName) === -1) { - var group = options[groupName]; - this.add(groupName, group); - } + if (obj.forEach) { + obj.forEach(iterator, context); + } else if (obj.length !== undefined) { + i = 0; + while (i < obj.length) { + iterator.call(context, obj[i], i, obj); + i++; + } + } else { + for (i in obj) { + obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); + } + } +} + +/** + * wrap a method with a deprecation warning and stack trace + * @param {Function} method + * @param {String} name + * @param {String} message + * @returns {Function} A new function wrapping the supplied method. + */ +function deprecate(method, name, message) { + var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n'; + return function() { + var e = new Error('get-stack-trace'); + var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '') + .replace(/^\s+at\s+/gm, '') + .replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; + + var log = window.console && (window.console.warn || window.console.log); + if (log) { + log.call(window.console, deprecationMessage, stack); + } + return method.apply(this, arguments); + }; +} + +/** + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} target + * @param {...Object} objects_to_assign + * @returns {Object} target + */ +var assign; +if (typeof Object.assign !== 'function') { + assign = function assign(target) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } } - } } - } + return output; + }; +} else { + assign = Object.assign; +} + +/** + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} dest + * @param {Object} src + * @param {Boolean} [merge=false] + * @returns {Object} dest + */ +var extend = deprecate(function extend(dest, src, merge) { + var keys = Object.keys(src); + var i = 0; + while (i < keys.length) { + if (!merge || (merge && dest[keys[i]] === undefined)) { + dest[keys[i]] = src[keys[i]]; + } + i++; + } + return dest; +}, 'extend', 'Use `assign`.'); + +/** + * merge the values from src in the dest. + * means that properties that exist in dest will not be overwritten by src + * @param {Object} dest + * @param {Object} src + * @returns {Object} dest + */ +var merge = deprecate(function merge(dest, src) { + return extend(dest, src, true); +}, 'merge', 'Use `assign`.'); + +/** + * simple class inheritance + * @param {Function} child + * @param {Function} base + * @param {Object} [properties] + */ +function inherit(child, base, properties) { + var baseP = base.prototype, + childP; + + childP = child.prototype = Object.create(baseP); + childP.constructor = child; + childP._super = baseP; + + if (properties) { + assign(childP, properties); + } +} + +/** + * simple function bind + * @param {Function} fn + * @param {Object} context + * @returns {Function} + */ +function bindFn(fn, context) { + return function boundFn() { + return fn.apply(context, arguments); + }; +} + +/** + * let a boolean value also be a function that must return a boolean + * this first item in args will be used as the context + * @param {Boolean|Function} val + * @param {Array} [args] + * @returns {Boolean} + */ +function boolOrFn(val, args) { + if (typeof val == TYPE_FUNCTION) { + return val.apply(args ? args[0] || undefined : undefined, args); + } + return val; +} + +/** + * use the val2 when val1 is undefined + * @param {*} val1 + * @param {*} val2 + * @returns {*} + */ +function ifUndefined(val1, val2) { + return (val1 === undefined) ? val2 : val1; +} + +/** + * addEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ +function addEventListeners(target, types, handler) { + each(splitStr(types), function(type) { + target.addEventListener(type, handler, false); + }); +} + +/** + * removeEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ +function removeEventListeners(target, types, handler) { + each(splitStr(types), function(type) { + target.removeEventListener(type, handler, false); + }); +} + +/** + * find if a node is in the given parent + * @method hasParent + * @param {HTMLElement} node + * @param {HTMLElement} parent + * @return {Boolean} found + */ +function hasParent(node, parent) { + while (node) { + if (node == parent) { + return true; + } + node = node.parentNode; + } + return false; +} + +/** + * small indexOf wrapper + * @param {String} str + * @param {String} find + * @returns {Boolean} found + */ +function inStr(str, find) { + return str.indexOf(find) > -1; +} + +/** + * split string on whitespace + * @param {String} str + * @returns {Array} words + */ +function splitStr(str) { + return str.trim().split(/\s+/g); +} + +/** + * find if a array contains the object using indexOf or a simple polyFill + * @param {Array} src + * @param {String} find + * @param {String} [findByKey] + * @return {Boolean|Number} false when not found, or the index + */ +function inArray(src, find, findByKey) { + if (src.indexOf && !findByKey) { + return src.indexOf(find); + } else { + var i = 0; + while (i < src.length) { + if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { + return i; + } + i++; + } + return -1; + } +} + +/** + * convert array-like objects to real arrays + * @param {Object} obj + * @returns {Array} + */ +function toArray(obj) { + return Array.prototype.slice.call(obj, 0); +} + +/** + * unique array with objects based on a key (like 'id') or just by the array's value + * @param {Array} src [{id:1},{id:2},{id:1}] + * @param {String} [key] + * @param {Boolean} [sort=False] + * @returns {Array} [{id:1},{id:2}] + */ +function uniqueArray(src, key, sort) { + var results = []; + var values = []; + var i = 0; - /** - * Clear all groups - */ + while (i < src.length) { + var val = key ? src[i][key] : src[i]; + if (inArray(values, val) < 0) { + results.push(src[i]); + } + values[i] = val; + i++; + } - }, { - key: "clear", - value: function clear() { - this.groups = {}; - this.groupsArray = []; - } + if (sort) { + if (!key) { + results = results.sort(); + } else { + results = results.sort(function sortUniqueArray(a, b) { + return a[key] > b[key]; + }); + } + } - /** - * get group options of a groupname. If groupname is not found, a new group - * is added. - * @param {*} groupname Can be a number, string, Date, etc. - * @return {Object} group The created group, containing all group options - */ + return results; +} - }, { - key: "get", - value: function get(groupname) { - var group = this.groups[groupname]; - if (group === undefined) { - if (this.options.useDefaultGroups === false && this.groupsArray.length > 0) { - // create new group - var index = this.groupIndex % this.groupsArray.length; - this.groupIndex++; - group = {}; - group.color = this.groups[this.groupsArray[index]]; - this.groups[groupname] = group; - } else { - // create new group - var _index = this.defaultIndex % this.defaultGroups.length; - this.defaultIndex++; - group = {}; - group.color = this.defaultGroups[_index]; - this.groups[groupname] = group; - } +/** + * get the prefixed property + * @param {Object} obj + * @param {String} property + * @returns {String|Undefined} prefixed + */ +function prefixed(obj, property) { + var prefix, prop; + var camelProp = property[0].toUpperCase() + property.slice(1); + + var i = 0; + while (i < VENDOR_PREFIXES.length) { + prefix = VENDOR_PREFIXES[i]; + prop = (prefix) ? prefix + camelProp : property; + + if (prop in obj) { + return prop; + } + i++; + } + return undefined; +} + +/** + * get a unique id + * @returns {number} uniqueId + */ +var _uniqueId = 1; +function uniqueId() { + return _uniqueId++; +} + +/** + * get the window object of an element + * @param {HTMLElement} element + * @returns {DocumentView|Window} + */ +function getWindowForElement(element) { + var doc = element.ownerDocument || element; + return (doc.defaultView || doc.parentWindow || window); +} + +var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; + +var SUPPORT_TOUCH = ('ontouchstart' in window); +var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; +var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); + +var INPUT_TYPE_TOUCH = 'touch'; +var INPUT_TYPE_PEN = 'pen'; +var INPUT_TYPE_MOUSE = 'mouse'; +var INPUT_TYPE_KINECT = 'kinect'; + +var COMPUTE_INTERVAL = 25; + +var INPUT_START = 1; +var INPUT_MOVE = 2; +var INPUT_END = 4; +var INPUT_CANCEL = 8; + +var DIRECTION_NONE = 1; +var DIRECTION_LEFT = 2; +var DIRECTION_RIGHT = 4; +var DIRECTION_UP = 8; +var DIRECTION_DOWN = 16; + +var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; +var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; +var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; + +var PROPS_XY = ['x', 'y']; +var PROPS_CLIENT_XY = ['clientX', 'clientY']; + +/** + * create new input type manager + * @param {Manager} manager + * @param {Function} callback + * @returns {Input} + * @constructor + */ +function Input(manager, callback) { + var self = this; + this.manager = manager; + this.callback = callback; + this.element = manager.element; + this.target = manager.options.inputTarget; + + // smaller wrapper around the handler, for the scope and the enabled state of the manager, + // so when disabled the input events are completely bypassed. + this.domHandler = function(ev) { + if (boolOrFn(manager.options.enable, [manager])) { + self.handler(ev); } + }; - return group; - } + this.init(); - /** - * Add a custom group style - * @param {String} groupName - * @param {Object} style An object containing borderColor, - * backgroundColor, etc. - * @return {Object} group The created group object - */ +} - }, { - key: "add", - value: function add(groupName, style) { - this.groups[groupName] = style; - this.groupsArray.push(groupName); - return style; - } - }]); - return Groups; - }(); +Input.prototype = { + /** + * should handle the inputEvent data and trigger the callback + * @virtual + */ + handler: function() { }, - exports["default"] = Groups; + /** + * bind the events + */ + init: function() { + this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }, -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * unbind the events + */ + destroy: function() { + this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + } +}; + +/** + * create new input type manager + * called by the Manager constructor + * @param {Hammer} manager + * @returns {Input} + */ +function createInputInstance(manager) { + var Type; + var inputClass = manager.options.inputClass; + + if (inputClass) { + Type = inputClass; + } else if (SUPPORT_POINTER_EVENTS) { + Type = PointerEventInput; + } else if (SUPPORT_ONLY_TOUCH) { + Type = TouchInput; + } else if (!SUPPORT_TOUCH) { + Type = MouseInput; + } else { + Type = TouchMouseInput; + } + return new (Type)(manager, inputHandler); +} - 'use strict'; +/** + * handle input events + * @param {Manager} manager + * @param {String} eventType + * @param {Object} input + */ +function inputHandler(manager, eventType, input) { + var pointersLen = input.pointers.length; + var changedPointersLen = input.changedPointers.length; + var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); + var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); - Object.defineProperty(exports, "__esModule", { - value: true - }); + input.isFirst = !!isFirst; + input.isFinal = !!isFinal; - var _classCallCheck2 = __webpack_require__(135); + if (isFirst) { + manager.session = {}; + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // source event is the normalized value of the domEvents + // like 'touchstart, mouseup, pointerdown' + input.eventType = eventType; - var _createClass2 = __webpack_require__(136); + // compute scale, rotation etc + computeInputData(manager, input); - var _createClass3 = _interopRequireDefault(_createClass2); + // emit secret event + manager.emit('hammer.input', input); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + manager.recognize(input); + manager.session.prevInput = input; +} - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); +/** + * extend the data with some usable properties like scale, rotate, velocity etc + * @param {Object} manager + * @param {Object} input + */ +function computeInputData(manager, input) { + var session = manager.session; + var pointers = input.pointers; + var pointersLength = pointers.length; - var Node = __webpack_require__(169)['default']; - var Label = __webpack_require__(170)['default']; + // store the first input to calculate the distance and direction + if (!session.firstInput) { + session.firstInput = simpleCloneInputData(input); + } - var NodesHandler = function () { - function NodesHandler(body, images, groups, layoutEngine) { - var _this = this; + // to compute scale and rotation we need to store the multiple touches + if (pointersLength > 1 && !session.firstMultiple) { + session.firstMultiple = simpleCloneInputData(input); + } else if (pointersLength === 1) { + session.firstMultiple = false; + } - (0, _classCallCheck3['default'])(this, NodesHandler); + var firstInput = session.firstInput; + var firstMultiple = session.firstMultiple; + var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; - this.body = body; - this.images = images; - this.groups = groups; - this.layoutEngine = layoutEngine; + var center = input.center = getCenter(pointers); + input.timeStamp = now(); + input.deltaTime = input.timeStamp - firstInput.timeStamp; - // create the node API in the body container - this.body.functions.createNode = this.create.bind(this); + input.angle = getAngle(offsetCenter, center); + input.distance = getDistance(offsetCenter, center); - this.nodesListeners = { - add: function add(event, params) { - _this.add(params.items); - }, - update: function update(event, params) { - _this.update(params.items, params.data); - }, - remove: function remove(event, params) { - _this.remove(params.items); - } - }; + computeDeltaXY(session, input); + input.offsetDirection = getDirection(input.deltaX, input.deltaY); - this.options = {}; - this.defaultOptions = { - borderWidth: 1, - borderWidthSelected: 2, - brokenImage: undefined, - color: { - border: '#2B7CE9', - background: '#97C2FC', - highlight: { - border: '#2B7CE9', - background: '#D2E5FF' - }, - hover: { - border: '#2B7CE9', - background: '#D2E5FF' - } - }, - fixed: { - x: false, - y: false - }, - font: { - color: '#343434', - size: 14, // px - face: 'arial', - background: 'none', - strokeWidth: 0, // px - strokeColor: '#ffffff', - align: 'center', - vadjust: 0, - multi: false, - bold: { - mod: 'bold' - }, - boldital: { - mod: 'bold italic' - }, - ital: { - mod: 'italic' - }, - mono: { - mod: '', - size: 15, // px - face: 'monospace', - vadjust: 2 - } - }, - group: undefined, - hidden: false, - icon: { - face: 'FontAwesome', //'FontAwesome', - code: undefined, //'\uf007', - size: 50, //50, - color: '#2B7CE9' //'#aa00ff' - }, - image: undefined, // --> URL - label: undefined, - labelHighlightBold: true, - level: undefined, - margin: { - top: 5, - right: 5, - bottom: 5, - left: 5 - }, - mass: 1, - physics: true, - scaling: { - min: 10, - max: 30, - label: { - enabled: false, - min: 14, - max: 30, - maxVisible: 30, - drawThreshold: 5 - }, - customScalingFunction: function customScalingFunction(min, max, total, value) { - if (max === min) { - return 0.5; - } else { - var scale = 1 / (max - min); - return Math.max(0, (value - min) * scale); - } - } - }, - shadow: { - enabled: false, - color: 'rgba(0,0,0,0.5)', - size: 10, - x: 5, - y: 5 - }, - shape: 'ellipse', - shapeProperties: { - borderDashes: false, // only for borders - borderRadius: 6, // only for box shape - interpolation: true, // only for image and circularImage shapes - useImageSize: false, // only for image and circularImage shapes - useBorderWithImage: false // only for image shape - }, - size: 25, - title: undefined, - value: undefined, - x: undefined, - y: undefined - }; + var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); + input.overallVelocityX = overallVelocity.x; + input.overallVelocityY = overallVelocity.y; + input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y; - // Protect from idiocy - if (this.defaultOptions.mass <= 0) { - throw 'Internal error: mass in defaultOptions of NodesHandler may not be zero or negative'; - } + input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; + input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; + + input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length > + session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers); - util.extend(this.options, this.defaultOptions); + computeIntervalInputData(session, input); - this.bindEventListeners(); + // find the correct target + var target = manager.element; + if (hasParent(input.srcEvent.target, target)) { + target = input.srcEvent.target; } + input.target = target; +} - (0, _createClass3['default'])(NodesHandler, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this2 = this; +function computeDeltaXY(session, input) { + var center = input.center; + var offset = session.offsetDelta || {}; + var prevDelta = session.prevDelta || {}; + var prevInput = session.prevInput || {}; - // refresh the nodes. Used when reverting from hierarchical layout - this.body.emitter.on('refreshNodes', this.refresh.bind(this)); - this.body.emitter.on('refresh', this.refresh.bind(this)); - this.body.emitter.on('destroy', function () { - util.forEach(_this2.nodesListeners, function (callback, event) { - if (_this2.body.data.nodes) _this2.body.data.nodes.off(event, callback); - }); - delete _this2.body.functions.createNode; - delete _this2.nodesListeners.add; - delete _this2.nodesListeners.update; - delete _this2.nodesListeners.remove; - delete _this2.nodesListeners; - }); - } - }, { - key: 'setOptions', - value: function setOptions(options) { - this.nodeOptions = options; - if (options !== undefined) { - Node.parseOptions(this.options, options); - - // update the shape in all nodes - if (options.shape !== undefined) { - for (var nodeId in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(nodeId)) { - this.body.nodes[nodeId].updateShape(); - } - } - } + if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { + prevDelta = session.prevDelta = { + x: prevInput.deltaX || 0, + y: prevInput.deltaY || 0 + }; - // update the font in all nodes - if (options.font !== undefined) { - Label.parseOptions(this.options.font, options); - for (var _nodeId in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(_nodeId)) { - this.body.nodes[_nodeId].updateLabelModule(); - this.body.nodes[_nodeId].needsRefresh(); - } - } - } + offset = session.offsetDelta = { + x: center.x, + y: center.y + }; + } - // update the shape size in all nodes - if (options.size !== undefined) { - for (var _nodeId2 in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(_nodeId2)) { - this.body.nodes[_nodeId2].needsRefresh(); - } - } - } + input.deltaX = prevDelta.x + (center.x - offset.x); + input.deltaY = prevDelta.y + (center.y - offset.y); +} - // update the state of the variables if needed - if (options.hidden !== undefined || options.physics !== undefined) { - this.body.emitter.emit('_dataChanged'); - } - } - } +/** + * velocity is calculated every x ms + * @param {Object} session + * @param {Object} input + */ +function computeIntervalInputData(session, input) { + var last = session.lastInterval || input, + deltaTime = input.timeStamp - last.timeStamp, + velocity, velocityX, velocityY, direction; - /** - * Set a data set with nodes for the network - * @param {Array | DataSet | DataView} nodes The data containing the nodes. - * @private - */ + if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { + var deltaX = input.deltaX - last.deltaX; + var deltaY = input.deltaY - last.deltaY; - }, { - key: 'setData', - value: function setData(nodes) { - var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - - var oldNodesData = this.body.data.nodes; - - if (nodes instanceof DataSet || nodes instanceof DataView) { - this.body.data.nodes = nodes; - } else if (Array.isArray(nodes)) { - this.body.data.nodes = new DataSet(); - this.body.data.nodes.add(nodes); - } else if (!nodes) { - this.body.data.nodes = new DataSet(); - } else { - throw new TypeError('Array or DataSet expected'); - } + var v = getVelocity(deltaTime, deltaX, deltaY); + velocityX = v.x; + velocityY = v.y; + velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; + direction = getDirection(deltaX, deltaY); - if (oldNodesData) { - // unsubscribe from old dataset - util.forEach(this.nodesListeners, function (callback, event) { - oldNodesData.off(event, callback); - }); - } + session.lastInterval = input; + } else { + // use latest velocity info if it doesn't overtake a minimum period + velocity = last.velocity; + velocityX = last.velocityX; + velocityY = last.velocityY; + direction = last.direction; + } + + input.velocity = velocity; + input.velocityX = velocityX; + input.velocityY = velocityY; + input.direction = direction; +} + +/** + * create a simple clone from the input used for storage of firstInput and firstMultiple + * @param {Object} input + * @returns {Object} clonedInputData + */ +function simpleCloneInputData(input) { + // make a simple copy of the pointers because we will get a reference if we don't + // we only need clientXY for the calculations + var pointers = []; + var i = 0; + while (i < input.pointers.length) { + pointers[i] = { + clientX: round(input.pointers[i].clientX), + clientY: round(input.pointers[i].clientY) + }; + i++; + } - // remove drawn nodes - this.body.nodes = {}; + return { + timeStamp: now(), + pointers: pointers, + center: getCenter(pointers), + deltaX: input.deltaX, + deltaY: input.deltaY + }; +} + +/** + * get the center of all the pointers + * @param {Array} pointers + * @return {Object} center contains `x` and `y` properties + */ +function getCenter(pointers) { + var pointersLength = pointers.length; + + // no need to loop when only one touch + if (pointersLength === 1) { + return { + x: round(pointers[0].clientX), + y: round(pointers[0].clientY) + }; + } - if (this.body.data.nodes) { - // subscribe to new dataset - var me = this; - util.forEach(this.nodesListeners, function (callback, event) { - me.body.data.nodes.on(event, callback); - }); + var x = 0, y = 0, i = 0; + while (i < pointersLength) { + x += pointers[i].clientX; + y += pointers[i].clientY; + i++; + } - // draw all new nodes - var ids = this.body.data.nodes.getIds(); - this.add(ids, true); - } + return { + x: round(x / pointersLength), + y: round(y / pointersLength) + }; +} + +/** + * calculate the velocity between two points. unit is in px per ms. + * @param {Number} deltaTime + * @param {Number} x + * @param {Number} y + * @return {Object} velocity `x` and `y` + */ +function getVelocity(deltaTime, x, y) { + return { + x: x / deltaTime || 0, + y: y / deltaTime || 0 + }; +} + +/** + * get the direction between two points + * @param {Number} x + * @param {Number} y + * @return {Number} direction + */ +function getDirection(x, y) { + if (x === y) { + return DIRECTION_NONE; + } + + if (abs(x) >= abs(y)) { + return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; +} + +/** + * calculate the absolute distance between two points + * @param {Object} p1 {x, y} + * @param {Object} p2 {x, y} + * @param {Array} [props] containing x and y keys + * @return {Number} distance + */ +function getDistance(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + var x = p2[props[0]] - p1[props[0]], + y = p2[props[1]] - p1[props[1]]; + + return Math.sqrt((x * x) + (y * y)); +} + +/** + * calculate the angle between two coordinates + * @param {Object} p1 + * @param {Object} p2 + * @param {Array} [props] containing x and y keys + * @return {Number} angle + */ +function getAngle(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + var x = p2[props[0]] - p1[props[0]], + y = p2[props[1]] - p1[props[1]]; + return Math.atan2(y, x) * 180 / Math.PI; +} + +/** + * calculate the rotation degrees between two pointersets + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} rotation + */ +function getRotation(start, end) { + return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); +} + +/** + * calculate the scale factor between two pointersets + * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} scale + */ +function getScale(start, end) { + return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); +} + +var MOUSE_INPUT_MAP = { + mousedown: INPUT_START, + mousemove: INPUT_MOVE, + mouseup: INPUT_END +}; + +var MOUSE_ELEMENT_EVENTS = 'mousedown'; +var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; + +/** + * Mouse events input + * @constructor + * @extends Input + */ +function MouseInput() { + this.evEl = MOUSE_ELEMENT_EVENTS; + this.evWin = MOUSE_WINDOW_EVENTS; + + this.pressed = false; // mousedown state + + Input.apply(this, arguments); +} + +inherit(MouseInput, Input, { + /** + * handle mouse events + * @param {Object} ev + */ + handler: function MEhandler(ev) { + var eventType = MOUSE_INPUT_MAP[ev.type]; - if (doNotEmit === false) { - this.body.emitter.emit("_dataChanged"); + // on start we want to have the left mouse button down + if (eventType & INPUT_START && ev.button === 0) { + this.pressed = true; } - } - /** - * Add nodes - * @param {Number[] | String[]} ids - * @private - */ + if (eventType & INPUT_MOVE && ev.which !== 1) { + eventType = INPUT_END; + } - }, { - key: 'add', - value: function add(ids) { - var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + // mouse must be down + if (!this.pressed) { + return; + } - var id = void 0; - var newNodes = []; - for (var i = 0; i < ids.length; i++) { - id = ids[i]; - var properties = this.body.data.nodes.get(id); - var node = this.create(properties); - newNodes.push(node); - this.body.nodes[id] = node; // note: this may replace an existing node + if (eventType & INPUT_END) { + this.pressed = false; } - this.layoutEngine.positionInitially(newNodes); + this.callback(this.manager, eventType, { + pointers: [ev], + changedPointers: [ev], + pointerType: INPUT_TYPE_MOUSE, + srcEvent: ev + }); + } +}); - if (doNotEmit === false) { - this.body.emitter.emit("_dataChanged"); - } - } +var POINTER_INPUT_MAP = { + pointerdown: INPUT_START, + pointermove: INPUT_MOVE, + pointerup: INPUT_END, + pointercancel: INPUT_CANCEL, + pointerout: INPUT_CANCEL +}; + +// in IE10 the pointer types is defined as an enum +var IE10_POINTER_TYPE_ENUM = { + 2: INPUT_TYPE_TOUCH, + 3: INPUT_TYPE_PEN, + 4: INPUT_TYPE_MOUSE, + 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 +}; + +var POINTER_ELEMENT_EVENTS = 'pointerdown'; +var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; + +// IE10 has prefixed support, and case-sensitive +if (window.MSPointerEvent && !window.PointerEvent) { + POINTER_ELEMENT_EVENTS = 'MSPointerDown'; + POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; +} + +/** + * Pointer events input + * @constructor + * @extends Input + */ +function PointerEventInput() { + this.evEl = POINTER_ELEMENT_EVENTS; + this.evWin = POINTER_WINDOW_EVENTS; + + Input.apply(this, arguments); + + this.store = (this.manager.session.pointerEvents = []); +} + +inherit(PointerEventInput, Input, { + /** + * handle mouse events + * @param {Object} ev + */ + handler: function PEhandler(ev) { + var store = this.store; + var removePointer = false; - /** - * Update existing nodes, or create them when not yet existing - * @param {Number[] | String[]} ids - * @private - */ + var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); + var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; + var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; - }, { - key: 'update', - value: function update(ids, changedData) { - var nodes = this.body.nodes; - var dataChanged = false; - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - var node = nodes[id]; - var data = changedData[i]; - if (node !== undefined) { - // update node - dataChanged = node.setOptions(data); - } else { - dataChanged = true; - // create node - node = this.create(data); - nodes[id] = node; - } + var isTouch = (pointerType == INPUT_TYPE_TOUCH); + + // get index of the event in the store + var storeIndex = inArray(store, ev.pointerId, 'pointerId'); + + // start and mouse must be down + if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { + if (storeIndex < 0) { + store.push(ev); + storeIndex = store.length - 1; + } + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + removePointer = true; } - if (dataChanged === true) { - this.body.emitter.emit("_dataChanged"); - } else { - this.body.emitter.emit("_dataUpdated"); + + // it not found, so the pointer hasn't been down (so it's probably a hover) + if (storeIndex < 0) { + return; } - } - /** - * Remove existing nodes. If nodes do not exist, the method will just ignore it. - * @param {Number[] | String[]} ids - * @private - */ + // update the event in the store + store[storeIndex] = ev; - }, { - key: 'remove', - value: function remove(ids) { - var nodes = this.body.nodes; + this.callback(this.manager, eventType, { + pointers: store, + changedPointers: [ev], + pointerType: pointerType, + srcEvent: ev + }); - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - delete nodes[id]; + if (removePointer) { + // remove from the store + store.splice(storeIndex, 1); } + } +}); - this.body.emitter.emit("_dataChanged"); - } +var SINGLE_TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL +}; - /** - * create a node - * @param properties - * @param constructorClass - */ +var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; +var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; - }, { - key: 'create', - value: function create(properties) { - var constructorClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Node; +/** + * Touch events input + * @constructor + * @extends Input + */ +function SingleTouchInput() { + this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; + this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; + this.started = false; - return new constructorClass(properties, this.body, this.images, this.groups, this.options, this.defaultOptions, this.nodeOptions); - } - }, { - key: 'refresh', - value: function refresh() { - var clearPositions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + Input.apply(this, arguments); +} - var nodes = this.body.nodes; - for (var nodeId in nodes) { - var node = undefined; - if (nodes.hasOwnProperty(nodeId)) { - node = nodes[nodeId]; - } - var data = this.body.data.nodes.get(nodeId); - if (node !== undefined && data !== undefined) { - if (clearPositions === true) { - node.setOptions({ x: null, y: null }); - } - node.setOptions({ fixed: false }); - node.setOptions(data); - } - } - } +inherit(SingleTouchInput, Input, { + handler: function TEhandler(ev) { + var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; - /** - * Returns the positions of the nodes. - * @param ids --> optional, can be array of nodeIds, can be string - * @returns {{}} - */ + // should we handle the touch events? + if (type === INPUT_START) { + this.started = true; + } - }, { - key: 'getPositions', - value: function getPositions(ids) { - var dataArray = {}; - if (ids !== undefined) { - if (Array.isArray(ids) === true) { - for (var i = 0; i < ids.length; i++) { - if (this.body.nodes[ids[i]] !== undefined) { - var node = this.body.nodes[ids[i]]; - dataArray[ids[i]] = { x: Math.round(node.x), y: Math.round(node.y) }; - } - } - } else { - if (this.body.nodes[ids] !== undefined) { - var _node = this.body.nodes[ids]; - dataArray[ids] = { x: Math.round(_node.x), y: Math.round(_node.y) }; - } - } - } else { - for (var _i = 0; _i < this.body.nodeIndices.length; _i++) { - var _node2 = this.body.nodes[this.body.nodeIndices[_i]]; - dataArray[this.body.nodeIndices[_i]] = { x: Math.round(_node2.x), y: Math.round(_node2.y) }; - } + if (!this.started) { + return; } - return dataArray; - } - /** - * Load the XY positions of the nodes into the dataset. - */ + var touches = normalizeSingleTouches.call(this, ev, type); - }, { - key: 'storePositions', - value: function storePositions() { - // todo: add support for clusters and hierarchical. - var dataArray = []; - var dataset = this.body.data.nodes.getDataSet(); - - for (var nodeId in dataset._data) { - if (dataset._data.hasOwnProperty(nodeId)) { - var node = this.body.nodes[nodeId]; - if (dataset._data[nodeId].x != Math.round(node.x) || dataset._data[nodeId].y != Math.round(node.y)) { - dataArray.push({ id: node.id, x: Math.round(node.x), y: Math.round(node.y) }); - } - } + // when done, reset the started state + if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { + this.started = false; } - dataset.update(dataArray); - } - /** - * get the bounding box of a node. - * @param nodeId - * @returns {j|*} - */ + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + } +}); - }, { - key: 'getBoundingBox', - value: function getBoundingBox(nodeId) { - if (this.body.nodes[nodeId] !== undefined) { - return this.body.nodes[nodeId].shape.boundingBox; +/** + * @this {TouchInput} + * @param {Object} ev + * @param {Number} type flag + * @returns {undefined|Array} [all, changed] + */ +function normalizeSingleTouches(ev, type) { + var all = toArray(ev.touches); + var changed = toArray(ev.changedTouches); + + if (type & (INPUT_END | INPUT_CANCEL)) { + all = uniqueArray(all.concat(changed), 'identifier', true); + } + + return [all, changed]; +} + +var TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL +}; + +var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; + +/** + * Multi-user touch events input + * @constructor + * @extends Input + */ +function TouchInput() { + this.evTarget = TOUCH_TARGET_EVENTS; + this.targetIds = {}; + + Input.apply(this, arguments); +} + +inherit(TouchInput, Input, { + handler: function MTEhandler(ev) { + var type = TOUCH_INPUT_MAP[ev.type]; + var touches = getTouches.call(this, ev, type); + if (!touches) { + return; } - } - /** - * Get the Ids of nodes connected to this node. - * @param nodeId - * @param direction {String|undefined} values 'from' and 'to' select respectively parent and child nodes only. - * Any other value returns both parent and child nodes. - * @returns {Array} - */ + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + } +}); - }, { - key: 'getConnectedNodes', - value: function getConnectedNodes(nodeId, direction) { - var nodeList = []; - if (this.body.nodes[nodeId] !== undefined) { - var node = this.body.nodes[nodeId]; - var nodeObj = {}; // used to quickly check if node already exists - for (var i = 0; i < node.edges.length; i++) { - var edge = node.edges[i]; - if (direction !== 'to' && edge.toId == node.id) { - // these are double equals since ids can be numeric or string - if (nodeObj[edge.fromId] === undefined) { - nodeList.push(edge.fromId); - nodeObj[edge.fromId] = true; - } - } else if (direction !== 'from' && edge.fromId == node.id) { - // these are double equals since ids can be numeric or string - if (nodeObj[edge.toId] === undefined) { - nodeList.push(edge.toId); - nodeObj[edge.toId] = true; - } - } - } +/** + * @this {TouchInput} + * @param {Object} ev + * @param {Number} type flag + * @returns {undefined|Array} [all, changed] + */ +function getTouches(ev, type) { + var allTouches = toArray(ev.touches); + var targetIds = this.targetIds; + + // when there is only one touch, the process can be simplified + if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { + targetIds[allTouches[0].identifier] = true; + return [allTouches, allTouches]; + } + + var i, + targetTouches, + changedTouches = toArray(ev.changedTouches), + changedTargetTouches = [], + target = this.target; + + // get target touches from touches + targetTouches = allTouches.filter(function(touch) { + return hasParent(touch.target, target); + }); + + // collect touches + if (type === INPUT_START) { + i = 0; + while (i < targetTouches.length) { + targetIds[targetTouches[i].identifier] = true; + i++; } - return nodeList; - } + } - /** - * Get the ids of the edges connected to this node. - * @param nodeId - * @returns {*} - */ + // filter changed touches to only contain touches that exist in the collected target ids + i = 0; + while (i < changedTouches.length) { + if (targetIds[changedTouches[i].identifier]) { + changedTargetTouches.push(changedTouches[i]); + } - }, { - key: 'getConnectedEdges', - value: function getConnectedEdges(nodeId) { - var edgeList = []; - if (this.body.nodes[nodeId] !== undefined) { - var node = this.body.nodes[nodeId]; - for (var i = 0; i < node.edges.length; i++) { - edgeList.push(node.edges[i].id); - } - } else { - console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId); + // cleanup removed touches + if (type & (INPUT_END | INPUT_CANCEL)) { + delete targetIds[changedTouches[i].identifier]; } - return edgeList; - } + i++; + } - /** - * Move a node. - * @param String nodeId - * @param Number x - * @param Number y - */ + if (!changedTargetTouches.length) { + return; + } - }, { - key: 'moveNode', - value: function moveNode(nodeId, x, y) { - var _this3 = this; - - if (this.body.nodes[nodeId] !== undefined) { - this.body.nodes[nodeId].x = Number(x); - this.body.nodes[nodeId].y = Number(y); - setTimeout(function () { - _this3.body.emitter.emit("startSimulation"); - }, 0); - } else { - console.log("Node id supplied to moveNode does not exist. Provided: ", nodeId); + return [ + // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' + uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), + changedTargetTouches + ]; +} + +/** + * Combined touch and mouse input + * + * Touch has a higher priority then mouse, and while touching no mouse events are allowed. + * This because touch devices also emit mouse events while doing a touch. + * + * @constructor + * @extends Input + */ + +var DEDUP_TIMEOUT = 2500; +var DEDUP_DISTANCE = 25; + +function TouchMouseInput() { + Input.apply(this, arguments); + + var handler = bindFn(this.handler, this); + this.touch = new TouchInput(this.manager, handler); + this.mouse = new MouseInput(this.manager, handler); + + this.primaryTouch = null; + this.lastTouches = []; +} + +inherit(TouchMouseInput, Input, { + /** + * handle mouse and touch events + * @param {Hammer} manager + * @param {String} inputEvent + * @param {Object} inputData + */ + handler: function TMEhandler(manager, inputEvent, inputData) { + var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), + isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); + + if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { + return; } - } - }]); - return NodesHandler; - }(); - exports['default'] = NodesHandler; + // when we're in a touch event, record touches to de-dupe synthetic mouse event + if (isTouch) { + recordTouches.call(this, inputEvent, inputData); + } else if (isMouse && isSyntheticEvent.call(this, inputData)) { + return; + } -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { + this.callback(manager, inputEvent, inputData); + }, - 'use strict'; + /** + * remove the event listeners + */ + destroy: function destroy() { + this.touch.destroy(); + this.mouse.destroy(); + } +}); - Object.defineProperty(exports, "__esModule", { - value: true - }); +function recordTouches(eventType, eventData) { + if (eventType & INPUT_START) { + this.primaryTouch = eventData.changedPointers[0].identifier; + setLastTouch.call(this, eventData); + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + setLastTouch.call(this, eventData); + } +} - var _typeof2 = __webpack_require__(62); +function setLastTouch(eventData) { + var touch = eventData.changedPointers[0]; - var _typeof3 = _interopRequireDefault(_typeof2); + if (touch.identifier === this.primaryTouch) { + var lastTouch = {x: touch.clientX, y: touch.clientY}; + this.lastTouches.push(lastTouch); + var lts = this.lastTouches; + var removeLastTouch = function() { + var i = lts.indexOf(lastTouch); + if (i > -1) { + lts.splice(i, 1); + } + }; + setTimeout(removeLastTouch, DEDUP_TIMEOUT); + } +} - var _classCallCheck2 = __webpack_require__(135); +function isSyntheticEvent(eventData) { + var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY; + for (var i = 0; i < this.lastTouches.length; i++) { + var t = this.lastTouches[i]; + var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y); + if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { + return true; + } + } + return false; +} + +var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); +var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; + +// magical touchAction value +var TOUCH_ACTION_COMPUTE = 'compute'; +var TOUCH_ACTION_AUTO = 'auto'; +var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented +var TOUCH_ACTION_NONE = 'none'; +var TOUCH_ACTION_PAN_X = 'pan-x'; +var TOUCH_ACTION_PAN_Y = 'pan-y'; +var TOUCH_ACTION_MAP = getTouchActionProps(); + +/** + * Touch Action + * sets the touchAction property or uses the js alternative + * @param {Manager} manager + * @param {String} value + * @constructor + */ +function TouchAction(manager, value) { + this.manager = manager; + this.set(value); +} + +TouchAction.prototype = { + /** + * set the touchAction value on the element or enable the polyfill + * @param {String} value + */ + set: function(value) { + // find out the touch-action by the event handlers + if (value == TOUCH_ACTION_COMPUTE) { + value = this.compute(); + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { + this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; + } + this.actions = value.toLowerCase().trim(); + }, - var _createClass2 = __webpack_require__(136); + /** + * just re-set the touchAction value + */ + update: function() { + this.set(this.manager.options.touchAction); + }, - var _createClass3 = _interopRequireDefault(_createClass2); + /** + * compute the value for the touchAction property based on the recognizer's settings + * @returns {String} value + */ + compute: function() { + var actions = []; + each(this.manager.recognizers, function(recognizer) { + if (boolOrFn(recognizer.options.enable, [recognizer])) { + actions = actions.concat(recognizer.getTouchAction()); + } + }); + return cleanTouchActions(actions.join(' ')); + }, - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * this method is called on each input cycle and provides the preventing of the browser behavior + * @param {Object} input + */ + preventDefaults: function(input) { + var srcEvent = input.srcEvent; + var direction = input.offsetDirection; - var util = __webpack_require__(1); + // if the touch action did prevented once this session + if (this.manager.session.prevented) { + srcEvent.preventDefault(); + return; + } - var Label = __webpack_require__(170)['default']; + var actions = this.actions; + var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; - var Box = __webpack_require__(175)['default']; - var Circle = __webpack_require__(186)['default']; - var CircularImage = __webpack_require__(188)['default']; - var Database = __webpack_require__(189)['default']; - var Diamond = __webpack_require__(190)['default']; - var Dot = __webpack_require__(192)['default']; - var Ellipse = __webpack_require__(193)['default']; - var Icon = __webpack_require__(194)['default']; - var Image = __webpack_require__(195)['default']; - var Square = __webpack_require__(196)['default']; - var Star = __webpack_require__(197)['default']; - var Text = __webpack_require__(198)['default']; - var Triangle = __webpack_require__(199)['default']; - var TriangleDown = __webpack_require__(200)['default']; - var Validator = __webpack_require__(145)['default']; + if (hasNone) { + //do not prevent defaults if this is a tap gesture - var _require = __webpack_require__(145), - printStyle = _require.printStyle; + var isTapPointer = input.pointers.length === 1; + var isTapMovement = input.distance < 2; + var isTapTouchTime = input.deltaTime < 250; - /** - * @class Node - * A node. A node can be connected to other nodes via one or multiple edges. - * @param {object} options An object containing options for the node. All - * options are optional, except for the id. - * {number} id Id of the node. Required - * {string} label Text label for the node - * {number} x Horizontal position of the node - * {number} y Vertical position of the node - * {string} shape Node shape, available: - * "database", "circle", "ellipse", - * "box", "image", "text", "dot", - * "star", "triangle", "triangleDown", - * "square", "icon" - * {string} image An image url - * {string} title An title text, can be HTML - * {anytype} group A group name or number - * @param {Network.Images} imagelist A list with images. Only needed - * when the node has an image - * @param {Network.Groups} grouplist A list with groups. Needed for - * retrieving group options - * @param {Object} constants An object with default values for - * example for the color - * - */ + if (isTapPointer && isTapMovement && isTapTouchTime) { + return; + } + } + if (hasPanX && hasPanY) { + // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent + return; + } - var Node = function () { - function Node(options, body, imagelist, grouplist, globalOptions, defaultOptions, nodeOptions) { - (0, _classCallCheck3['default'])(this, Node); + if (hasNone || + (hasPanY && direction & DIRECTION_HORIZONTAL) || + (hasPanX && direction & DIRECTION_VERTICAL)) { + return this.preventSrc(srcEvent); + } + }, - this.options = util.bridgeObject(globalOptions); - this.globalOptions = globalOptions; - this.defaultOptions = defaultOptions; - this.nodeOptions = nodeOptions; - this.body = body; + /** + * call preventDefault to prevent the browser's default behavior (scrolling in most cases) + * @param {Object} srcEvent + */ + preventSrc: function(srcEvent) { + this.manager.session.prevented = true; + srcEvent.preventDefault(); + } +}; - this.edges = []; // all edges connected to this node +/** + * when the touchActions are collected they are not a valid value, so we need to clean things up. * + * @param {String} actions + * @returns {*} + */ +function cleanTouchActions(actions) { + // none + if (inStr(actions, TOUCH_ACTION_NONE)) { + return TOUCH_ACTION_NONE; + } - // set defaults for the options - this.id = undefined; - this.imagelist = imagelist; - this.grouplist = grouplist; + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); - // state options - this.x = undefined; - this.y = undefined; - this.baseSize = this.options.size; - this.baseFontSize = this.options.font.size; - this.predefinedPosition = false; // used to check if initial fit should just take the range or approximate - this.selected = false; - this.hover = false; + // if both pan-x and pan-y are set (different recognizers + // for different directions, e.g. horizontal pan but vertical swipe?) + // we need none (as otherwise with pan-x pan-y combined none of these + // recognizers will work, since the browser would handle all panning + if (hasPanX && hasPanY) { + return TOUCH_ACTION_NONE; + } - this.labelModule = new Label(this.body, this.options, false /* Not edge label */); - this.setOptions(options); + // pan-x OR pan-y + if (hasPanX || hasPanY) { + return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; } - /** - * Attach a edge to the node - * @param {Edge} edge - */ + // manipulation + if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { + return TOUCH_ACTION_MANIPULATION; + } + return TOUCH_ACTION_AUTO; +} - (0, _createClass3['default'])(Node, [{ - key: 'attachEdge', - value: function attachEdge(edge) { - if (this.edges.indexOf(edge) === -1) { - this.edges.push(edge); - } - } +function getTouchActionProps() { + if (!NATIVE_TOUCH_ACTION) { + return false; + } + var touchMap = {}; + var cssSupports = window.CSS && window.CSS.supports; + ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) { - /** - * Detach a edge from the node - * @param {Edge} edge - */ + // If css.supports is not supported but there is native touch-action assume it supports + // all values. This is the case for IE 10 and 11. + touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true; + }); + return touchMap; +} + +/** + * Recognizer flow explained; * + * All recognizers have the initial state of POSSIBLE when a input session starts. + * The definition of a input session is from the first input until the last input, with all it's movement in it. * + * Example session for mouse-input: mousedown -> mousemove -> mouseup + * + * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed + * which determines with state it should be. + * + * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to + * POSSIBLE to give it another change on the next cycle. + * + * Possible + * | + * +-----+---------------+ + * | | + * +-----+-----+ | + * | | | + * Failed Cancelled | + * +-------+------+ + * | | + * Recognized Began + * | + * Changed + * | + * Ended/Recognized + */ +var STATE_POSSIBLE = 1; +var STATE_BEGAN = 2; +var STATE_CHANGED = 4; +var STATE_ENDED = 8; +var STATE_RECOGNIZED = STATE_ENDED; +var STATE_CANCELLED = 16; +var STATE_FAILED = 32; + +/** + * Recognizer + * Every recognizer needs to extend from this class. + * @constructor + * @param {Object} options + */ +function Recognizer(options) { + this.options = assign({}, this.defaults, options || {}); + + this.id = uniqueId(); + + this.manager = null; + + // default is enable true + this.options.enable = ifUndefined(this.options.enable, true); + + this.state = STATE_POSSIBLE; + + this.simultaneous = {}; + this.requireFail = []; +} + +Recognizer.prototype = { + /** + * @virtual + * @type {Object} + */ + defaults: {}, - }, { - key: 'detachEdge', - value: function detachEdge(edge) { - var index = this.edges.indexOf(edge); - if (index != -1) { - this.edges.splice(index, 1); - } - } + /** + * set options + * @param {Object} options + * @return {Recognizer} + */ + set: function(options) { + assign(this.options, options); - /** - * Set or overwrite options for the node - * @param {Object} options an object with options - * @param {Object} constants and object with default, global options - */ + // also update the touchAction, in case something changed about the directions/enabled state + this.manager && this.manager.touchAction.update(); + return this; + }, - }, { - key: 'setOptions', - value: function setOptions(options) { - var currentShape = this.options.shape; - if (!options) { - return; + /** + * recognize simultaneous with an other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + recognizeWith: function(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { + return this; } - // basic options - if (options.id !== undefined) { - this.id = options.id; + var simultaneous = this.simultaneous; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + if (!simultaneous[otherRecognizer.id]) { + simultaneous[otherRecognizer.id] = otherRecognizer; + otherRecognizer.recognizeWith(this); } + return this; + }, - if (this.id === undefined) { - throw "Node must have an id"; + /** + * drop the simultaneous link. it doesnt remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + dropRecognizeWith: function(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { + return this; } - Node.checkMass(options, this.id); + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + delete this.simultaneous[otherRecognizer.id]; + return this; + }, - // set these options locally - // clear x and y positions - if (options.x !== undefined) { - if (options.x === null) { - this.x = undefined;this.predefinedPosition = false; - } else { - this.x = parseInt(options.x);this.predefinedPosition = true; - } - } - if (options.y !== undefined) { - if (options.y === null) { - this.y = undefined;this.predefinedPosition = false; - } else { - this.y = parseInt(options.y);this.predefinedPosition = true; - } + /** + * recognizer can only run when an other is failing + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + requireFailure: function(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { + return this; } - if (options.size !== undefined) { - this.baseSize = options.size; + + var requireFail = this.requireFail; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + if (inArray(requireFail, otherRecognizer) === -1) { + requireFail.push(otherRecognizer); + otherRecognizer.requireFailure(this); } - if (options.value !== undefined) { - options.value = parseFloat(options.value); + return this; + }, + + /** + * drop the requireFailure link. it does not remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + dropRequireFailure: function(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { + return this; } - // copy group options - if (typeof options.group === 'number' || typeof options.group === 'string' && options.group != '') { - var groupObj = this.grouplist.get(options.group); - util.deepExtend(this.options, groupObj); - // the color object needs to be completely defined. Since groups can partially overwrite the colors, we parse it again, just in case. - this.options.color = util.parseColor(this.options.color); + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + var index = inArray(this.requireFail, otherRecognizer); + if (index > -1) { + this.requireFail.splice(index, 1); } + return this; + }, - // this transforms all shorthands into fully defined options - Node.parseOptions(this.options, options, true, this.globalOptions); + /** + * has require failures boolean + * @returns {boolean} + */ + hasRequireFailures: function() { + return this.requireFail.length > 0; + }, - this.choosify(options); + /** + * if the recognizer can recognize simultaneous with an other recognizer + * @param {Recognizer} otherRecognizer + * @returns {Boolean} + */ + canRecognizeWith: function(otherRecognizer) { + return !!this.simultaneous[otherRecognizer.id]; + }, - this._load_images(); - this.updateLabelModule(options); - this.updateShape(currentShape); - this.labelModule.propagateFonts(this.nodeOptions, options, this.defaultOptions); + /** + * You should use `tryEmit` instead of `emit` directly to check + * that all the needed recognizers has failed before emitting. + * @param {Object} input + */ + emit: function(input) { + var self = this; + var state = this.state; - if (options.hidden !== undefined || options.physics !== undefined) { - return true; + function emit(event) { + self.manager.emit(event, input); } - return false; - } - - /** - * Load the images from the options, for the nodes that need them. - * - * TODO: The imageObj members should be moved to CircularImageBase. - * It's the only place where they are required. - * - * @private - */ - }, { - key: '_load_images', - value: function _load_images() { - // Don't bother loading for nodes without images - if (this.options.shape !== 'circularImage' && this.options.shape !== 'image') { - return; + // 'panstart' and 'panmove' + if (state < STATE_ENDED) { + emit(self.options.event + stateStr(state)); } - if (this.options.image === undefined) { - throw "Option image must be defined for node type '" + this.options.shape + "'"; - } + emit(self.options.event); // simple 'eventName' events - if (this.imagelist === undefined) { - throw "Internal Error: No images provided"; + if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...) + emit(input.additionalEvent); } - if (typeof this.options.image === 'string') { - this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); - } else { - if (this.options.image.unselected === undefined) { - throw "No unselected image provided"; - } - - this.imageObj = this.imagelist.load(this.options.image.unselected, this.options.brokenImage, this.id); - - if (this.options.image.selected !== undefined) { - this.imageObjAlt = this.imagelist.load(this.options.image.selected, this.options.brokenImage, this.id); - } else { - this.imageObjAlt = undefined; - } + // panend and pancancel + if (state >= STATE_ENDED) { + emit(self.options.event + stateStr(state)); } - } - - /** - * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. - * Static so it can also be used by the handler. - * @param parentOptions - * @param newOptions - * @param allowDeletion - * @param globalOptions - */ - - }, { - key: 'choosify', - value: function choosify(options) { - this.chooser = true; - - var pile = [options, this.options, this.defaultOptions]; + }, - var chosen = util.topMost(pile, 'chosen'); - if (typeof chosen === 'boolean') { - this.chooser = chosen; - } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') { - var chosenNode = util.topMost(pile, ['chosen', 'node']); - if (typeof chosenNode === 'boolean' || typeof chosenNode === 'function') { - this.chooser = chosenNode; - } + /** + * Check that all the require failure recognizers has failed, + * if true, it emits a gesture event, + * otherwise, setup the state to FAILED. + * @param {Object} input + */ + tryEmit: function(input) { + if (this.canEmit()) { + return this.emit(input); } - } - }, { - key: 'getFormattingValues', - value: function getFormattingValues() { - var values = { - color: this.options.color.background, - borderWidth: this.options.borderWidth, - borderColor: this.options.color.border, - size: this.options.size, - borderDashes: this.options.shapeProperties.borderDashes, - borderRadius: this.options.shapeProperties.borderRadius, - shadow: this.options.shadow.enabled, - shadowColor: this.options.shadow.color, - shadowSize: this.options.shadow.size, - shadowX: this.options.shadow.x, - shadowY: this.options.shadow.y - }; - if (this.selected || this.hover) { - if (this.chooser === true) { - if (this.selected) { - values.borderWidth *= 2; - values.color = this.options.color.highlight.background; - values.borderColor = this.options.color.highlight.border; - values.shadow = this.options.shadow.enabled; - } else if (this.hover) { - values.color = this.options.color.hover.background; - values.borderColor = this.options.color.hover.border; - values.shadow = this.options.shadow.enabled; - } - } else if (typeof this.chooser === 'function') { - this.chooser(values, this.options.id, this.selected, this.hover); - if (values.shadow === false) { - if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) { - values.shadow = true; - } + // it's failing anyway + this.state = STATE_FAILED; + }, + + /** + * can we emit? + * @returns {boolean} + */ + canEmit: function() { + var i = 0; + while (i < this.requireFail.length) { + if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { + return false; } - } - } else { - values.shadow = this.options.shadow.enabled; - } - return values; - } - }, { - key: 'updateLabelModule', - value: function updateLabelModule(options) { - if (this.options.label === undefined || this.options.label === null) { - this.options.label = ''; + i++; } - this.labelModule.setOptions(this.options, true); - if (this.labelModule.baseSize !== undefined) { - this.baseFontSize = this.labelModule.baseSize; + return true; + }, + + /** + * update the recognizer + * @param {Object} inputData + */ + recognize: function(inputData) { + // make a new copy of the inputData + // so we can change the inputData without messing up the other recognizers + var inputDataClone = assign({}, inputData); + + // is is enabled and allow recognizing? + if (!boolOrFn(this.options.enable, [this, inputDataClone])) { + this.reset(); + this.state = STATE_FAILED; + return; } - this.labelModule.constrain(this.nodeOptions, options, this.defaultOptions); - this.labelModule.choosify(this.nodeOptions, options, this.defaultOptions); - } - }, { - key: 'updateShape', - value: function updateShape(currentShape) { - if (currentShape === this.options.shape && this.shape) { - this.shape.setOptions(this.options, this.imageObj, this.imageObjAlt); - } else { - // choose draw method depending on the shape - switch (this.options.shape) { - case 'box': - this.shape = new Box(this.options, this.body, this.labelModule); - break; - case 'circle': - this.shape = new Circle(this.options, this.body, this.labelModule); - break; - case 'circularImage': - this.shape = new CircularImage(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); - break; - case 'database': - this.shape = new Database(this.options, this.body, this.labelModule); - break; - case 'diamond': - this.shape = new Diamond(this.options, this.body, this.labelModule); - break; - case 'dot': - this.shape = new Dot(this.options, this.body, this.labelModule); - break; - case 'ellipse': - this.shape = new Ellipse(this.options, this.body, this.labelModule); - break; - case 'icon': - this.shape = new Icon(this.options, this.body, this.labelModule); - break; - case 'image': - this.shape = new Image(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); - break; - case 'square': - this.shape = new Square(this.options, this.body, this.labelModule); - break; - case 'star': - this.shape = new Star(this.options, this.body, this.labelModule); - break; - case 'text': - this.shape = new Text(this.options, this.body, this.labelModule); - break; - case 'triangle': - this.shape = new Triangle(this.options, this.body, this.labelModule); - break; - case 'triangleDown': - this.shape = new TriangleDown(this.options, this.body, this.labelModule); - break; - default: - this.shape = new Ellipse(this.options, this.body, this.labelModule); - break; - } + + // reset when we've reached the end + if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { + this.state = STATE_POSSIBLE; } - this.needsRefresh(); - } - /** - * select this node - */ + this.state = this.process(inputDataClone); - }, { - key: 'select', - value: function select() { - this.selected = true; - this.needsRefresh(); - } + // the recognizer has recognized a gesture + // so trigger an event + if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { + this.tryEmit(inputDataClone); + } + }, - /** - * unselect this node - */ + /** + * return the state of the recognizer + * the actual recognizing happens in this method + * @virtual + * @param {Object} inputData + * @returns {Const} STATE + */ + process: function(inputData) { }, // jshint ignore:line - }, { - key: 'unselect', - value: function unselect() { - this.selected = false; - this.needsRefresh(); - } + /** + * return the preferred touch-action + * @virtual + * @returns {Array} + */ + getTouchAction: function() { }, - /** - * Reset the calculated size of the node, forces it to recalculate its size - */ + /** + * called when the gesture isn't allowed to recognize + * like when another is being recognized or it is disabled + * @virtual + */ + reset: function() { } +}; + +/** + * get a usable string, used as event postfix + * @param {Const} state + * @returns {String} state + */ +function stateStr(state) { + if (state & STATE_CANCELLED) { + return 'cancel'; + } else if (state & STATE_ENDED) { + return 'end'; + } else if (state & STATE_CHANGED) { + return 'move'; + } else if (state & STATE_BEGAN) { + return 'start'; + } + return ''; +} + +/** + * direction cons to string + * @param {Const} direction + * @returns {String} + */ +function directionStr(direction) { + if (direction == DIRECTION_DOWN) { + return 'down'; + } else if (direction == DIRECTION_UP) { + return 'up'; + } else if (direction == DIRECTION_LEFT) { + return 'left'; + } else if (direction == DIRECTION_RIGHT) { + return 'right'; + } + return ''; +} + +/** + * get a recognizer by name if it is bound to a manager + * @param {Recognizer|String} otherRecognizer + * @param {Recognizer} recognizer + * @returns {Recognizer} + */ +function getRecognizerByNameIfManager(otherRecognizer, recognizer) { + var manager = recognizer.manager; + if (manager) { + return manager.get(otherRecognizer); + } + return otherRecognizer; +} + +/** + * This recognizer is just used as a base for the simple attribute recognizers. + * @constructor + * @extends Recognizer + */ +function AttrRecognizer() { + Recognizer.apply(this, arguments); +} + +inherit(AttrRecognizer, Recognizer, { + /** + * @namespace + * @memberof AttrRecognizer + */ + defaults: { + /** + * @type {Number} + * @default 1 + */ + pointers: 1 + }, - }, { - key: 'needsRefresh', - value: function needsRefresh() { - this.shape.refreshNeeded = true; - } + /** + * Used to check if it the recognizer receives valid input, like input.distance > 10. + * @memberof AttrRecognizer + * @param {Object} input + * @returns {Boolean} recognized + */ + attrTest: function(input) { + var optionPointers = this.options.pointers; + return optionPointers === 0 || input.pointers.length === optionPointers; + }, - /** - * get the title of this node. - * @return {string} title The title of the node, or undefined when no title - * has been set. - */ + /** + * Process the input and return the state for the recognizer + * @memberof AttrRecognizer + * @param {Object} input + * @returns {*} State + */ + process: function(input) { + var state = this.state; + var eventType = input.eventType; - }, { - key: 'getTitle', - value: function getTitle() { - return this.options.title; - } - - /** - * Calculate the distance to the border of the Node - * @param {CanvasRenderingContext2D} ctx - * @param {Number} angle Angle in radians - * @returns {number} distance Distance to the border in pixels - */ - - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this.shape.distanceToBorder(ctx, angle); - } - - /** - * Check if this node has a fixed x and y position - * @return {boolean} true if fixed, false if not - */ - - }, { - key: 'isFixed', - value: function isFixed() { - return this.options.fixed.x && this.options.fixed.y; - } - - /** - * check if this node is selecte - * @return {boolean} selected True if node is selected, else false - */ + var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); + var isValid = this.attrTest(input); - }, { - key: 'isSelected', - value: function isSelected() { - return this.selected; - } + // on cancel input and we've recognized before, return STATE_CANCELLED + if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { + return state | STATE_CANCELLED; + } else if (isRecognized || isValid) { + if (eventType & INPUT_END) { + return state | STATE_ENDED; + } else if (!(state & STATE_BEGAN)) { + return STATE_BEGAN; + } + return state | STATE_CHANGED; + } + return STATE_FAILED; + } +}); - /** - * Retrieve the value of the node. Can be undefined - * @return {Number} value - */ +/** + * Pan + * Recognized when the pointer is down and moved in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ +function PanRecognizer() { + AttrRecognizer.apply(this, arguments); - }, { - key: 'getValue', - value: function getValue() { - return this.options.value; - } + this.pX = null; + this.pY = null; +} - /** - * Adjust the value range of the node. The node will adjust it's size - * based on its value. - * @param {Number} min - * @param {Number} max - */ +inherit(PanRecognizer, AttrRecognizer, { + /** + * @namespace + * @memberof PanRecognizer + */ + defaults: { + event: 'pan', + threshold: 10, + pointers: 1, + direction: DIRECTION_ALL + }, - }, { - key: 'setValueRange', - value: function setValueRange(min, max, total) { - if (this.options.value !== undefined) { - var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); - var sizeDiff = this.options.scaling.max - this.options.scaling.min; - if (this.options.scaling.label.enabled === true) { - var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; - this.options.font.size = this.options.scaling.label.min + scale * fontDiff; - } - this.options.size = this.options.scaling.min + scale * sizeDiff; - } else { - this.options.size = this.baseSize; - this.options.font.size = this.baseFontSize; + getTouchAction: function() { + var direction = this.options.direction; + var actions = []; + if (direction & DIRECTION_HORIZONTAL) { + actions.push(TOUCH_ACTION_PAN_Y); } + if (direction & DIRECTION_VERTICAL) { + actions.push(TOUCH_ACTION_PAN_X); + } + return actions; + }, - this.updateLabelModule(); - } - - /** - * Draw this node in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - */ - - }, { - key: 'draw', - value: function draw(ctx) { - var values = this.getFormattingValues(); - this.shape.draw(ctx, this.x, this.y, this.selected, this.hover, values); - } + directionTest: function(input) { + var options = this.options; + var hasMoved = true; + var distance = input.distance; + var direction = input.direction; + var x = input.deltaX; + var y = input.deltaY; + + // lock to axis? + if (!(direction & options.direction)) { + if (options.direction & DIRECTION_HORIZONTAL) { + direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; + hasMoved = x != this.pX; + distance = Math.abs(input.deltaX); + } else { + direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; + hasMoved = y != this.pY; + distance = Math.abs(input.deltaY); + } + } + input.direction = direction; + return hasMoved && distance > options.threshold && direction & options.direction; + }, - /** - * Update the bounding box of the shape - */ + attrTest: function(input) { + return AttrRecognizer.prototype.attrTest.call(this, input) && + (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); + }, - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(ctx) { - this.shape.updateBoundingBox(this.x, this.y, ctx); - } + emit: function(input) { - /** - * Recalculate the size of this node in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - */ + this.pX = input.deltaX; + this.pY = input.deltaY; - }, { - key: 'resize', - value: function resize(ctx) { - var values = this.getFormattingValues(); - this.shape.resize(ctx, this.selected, this.hover, values); - } + var direction = directionStr(input.direction); - /** - * Check if this object is overlapping with the provided object - * @param {Object} obj an object with parameters left, top, right, bottom - * @return {boolean} True if location is located on node - */ + if (direction) { + input.additionalEvent = this.options.event + direction; + } + this._super.emit.call(this, input); + } +}); - }, { - key: 'isOverlappingWith', - value: function isOverlappingWith(obj) { - return this.shape.left < obj.right && this.shape.left + this.shape.width > obj.left && this.shape.top < obj.bottom && this.shape.top + this.shape.height > obj.top; - } +/** + * Pinch + * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). + * @constructor + * @extends AttrRecognizer + */ +function PinchRecognizer() { + AttrRecognizer.apply(this, arguments); +} + +inherit(PinchRecognizer, AttrRecognizer, { + /** + * @namespace + * @memberof PinchRecognizer + */ + defaults: { + event: 'pinch', + threshold: 0, + pointers: 2 + }, - /** - * Check if this object is overlapping with the provided object - * @param {Object} obj an object with parameters left, top, right, bottom - * @return {boolean} True if location is located on node - */ + getTouchAction: function() { + return [TOUCH_ACTION_NONE]; + }, - }, { - key: 'isBoundingBoxOverlappingWith', - value: function isBoundingBoxOverlappingWith(obj) { - return this.shape.boundingBox.left < obj.right && this.shape.boundingBox.right > obj.left && this.shape.boundingBox.top < obj.bottom && this.shape.boundingBox.bottom > obj.top; - } + attrTest: function(input) { + return this._super.attrTest.call(this, input) && + (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); + }, - /** - * Check valid values for mass - * - * The mass may not be negative or zero. If it is, reset to 1 - */ + emit: function(input) { + if (input.scale !== 1) { + var inOut = input.scale < 1 ? 'in' : 'out'; + input.additionalEvent = this.options.event + inOut; + } + this._super.emit.call(this, input); + } +}); - }], [{ - key: 'parseOptions', - value: function parseOptions(parentOptions, newOptions) { - var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; +/** + * Press + * Recognized when the pointer is down for x ms without any movement. + * @constructor + * @extends Recognizer + */ +function PressRecognizer() { + Recognizer.apply(this, arguments); - var fields = ['color', 'font', 'fixed', 'shadow']; - util.selectiveNotDeepExtend(fields, parentOptions, newOptions, allowDeletion); + this._timer = null; + this._input = null; +} - Node.checkMass(newOptions); +inherit(PressRecognizer, Recognizer, { + /** + * @namespace + * @memberof PressRecognizer + */ + defaults: { + event: 'press', + pointers: 1, + time: 251, // minimal time of the pointer to be pressed + threshold: 9 // a minimal movement is ok, but keep it low + }, - // merge the shadow options into the parent. - util.mergeOptions(parentOptions, newOptions, 'shadow', allowDeletion, globalOptions); + getTouchAction: function() { + return [TOUCH_ACTION_AUTO]; + }, - // individual shape newOptions - if (newOptions.color !== undefined && newOptions.color !== null) { - var parsedColor = util.parseColor(newOptions.color); - util.fillIfDefined(parentOptions.color, parsedColor); - } else if (allowDeletion === true && newOptions.color === null) { - parentOptions.color = util.bridgeObject(globalOptions.color); // set the object back to the global options - } + process: function(input) { + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTime = input.deltaTime > options.time; + + this._input = input; + + // we only allow little movement + // and we've reached an end event, so a tap is possible + if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { + this.reset(); + } else if (input.eventType & INPUT_START) { + this.reset(); + this._timer = setTimeoutContext(function() { + this.state = STATE_RECOGNIZED; + this.tryEmit(); + }, options.time, this); + } else if (input.eventType & INPUT_END) { + return STATE_RECOGNIZED; + } + return STATE_FAILED; + }, - // handle the fixed options - if (newOptions.fixed !== undefined && newOptions.fixed !== null) { - if (typeof newOptions.fixed === 'boolean') { - parentOptions.fixed.x = newOptions.fixed; - parentOptions.fixed.y = newOptions.fixed; - } else { - if (newOptions.fixed.x !== undefined && typeof newOptions.fixed.x === 'boolean') { - parentOptions.fixed.x = newOptions.fixed.x; - } - if (newOptions.fixed.y !== undefined && typeof newOptions.fixed.y === 'boolean') { - parentOptions.fixed.y = newOptions.fixed.y; - } - } - } + reset: function() { + clearTimeout(this._timer); + }, - // handle the font options - if (newOptions.font !== undefined && newOptions.font !== null) { - Label.parseOptions(parentOptions.font, newOptions); - } else if (allowDeletion === true && newOptions.font === null) { - parentOptions.font = util.bridgeObject(globalOptions.font); // set the object back to the global options + emit: function(input) { + if (this.state !== STATE_RECOGNIZED) { + return; } - // handle the scaling options, specifically the label part - if (newOptions.scaling !== undefined) { - util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', allowDeletion, globalOptions.scaling); - } - } - }, { - key: 'checkMass', - value: function checkMass(options, id) { - if (options.mass !== undefined && options.mass <= 0) { - var strId = ''; - if (id !== undefined) { - strId = ' in node id: ' + id; - } - console.log('%cNegative or zero mass disallowed' + strId + ', setting mass to 1.', printStyle); - options.mass = 1; + if (input && (input.eventType & INPUT_END)) { + this.manager.emit(this.options.event + 'up', input); + } else { + this._input.timeStamp = now(); + this.manager.emit(this.options.event, this._input); } - } - }]); - return Node; - }(); - - exports['default'] = Node; - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { + } +}); - 'use strict'; +/** + * Rotate + * Recognized when two or more pointer are moving in a circular motion. + * @constructor + * @extends AttrRecognizer + */ +function RotateRecognizer() { + AttrRecognizer.apply(this, arguments); +} + +inherit(RotateRecognizer, AttrRecognizer, { + /** + * @namespace + * @memberof RotateRecognizer + */ + defaults: { + event: 'rotate', + threshold: 0, + pointers: 2 + }, - Object.defineProperty(exports, "__esModule", { - value: true - }); + getTouchAction: function() { + return [TOUCH_ACTION_NONE]; + }, - var _slicedToArray2 = __webpack_require__(171); + attrTest: function(input) { + return this._super.attrTest.call(this, input) && + (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); + } +}); - var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); +/** + * Swipe + * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ +function SwipeRecognizer() { + AttrRecognizer.apply(this, arguments); +} + +inherit(SwipeRecognizer, AttrRecognizer, { + /** + * @namespace + * @memberof SwipeRecognizer + */ + defaults: { + event: 'swipe', + threshold: 10, + velocity: 0.3, + direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, + pointers: 1 + }, - var _getIterator2 = __webpack_require__(2); + getTouchAction: function() { + return PanRecognizer.prototype.getTouchAction.call(this); + }, - var _getIterator3 = _interopRequireDefault(_getIterator2); + attrTest: function(input) { + var direction = this.options.direction; + var velocity; - var _typeof2 = __webpack_require__(62); + if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { + velocity = input.overallVelocity; + } else if (direction & DIRECTION_HORIZONTAL) { + velocity = input.overallVelocityX; + } else if (direction & DIRECTION_VERTICAL) { + velocity = input.overallVelocityY; + } - var _typeof3 = _interopRequireDefault(_typeof2); + return this._super.attrTest.call(this, input) && + direction & input.offsetDirection && + input.distance > this.options.threshold && + input.maxPointers == this.options.pointers && + abs(velocity) > this.options.velocity && input.eventType & INPUT_END; + }, - var _classCallCheck2 = __webpack_require__(135); + emit: function(input) { + var direction = directionStr(input.offsetDirection); + if (direction) { + this.manager.emit(this.options.event + direction, input); + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + this.manager.emit(this.options.event, input); + } +}); - var _createClass2 = __webpack_require__(136); +/** + * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur + * between the given interval and position. The delay option can be used to recognize multi-taps without firing + * a single tap. + * + * The eventData from the emitted event contains the property `tapCount`, which contains the amount of + * multi-taps being recognized. + * @constructor + * @extends Recognizer + */ +function TapRecognizer() { + Recognizer.apply(this, arguments); + + // previous time and center, + // used for tap counting + this.pTime = false; + this.pCenter = false; + + this._timer = null; + this._input = null; + this.count = 0; +} + +inherit(TapRecognizer, Recognizer, { + /** + * @namespace + * @memberof PinchRecognizer + */ + defaults: { + event: 'tap', + pointers: 1, + taps: 1, + interval: 300, // max time between the multi-tap taps + time: 250, // max time of the pointer to be down (like finger on the screen) + threshold: 9, // a minimal movement is ok, but keep it low + posThreshold: 10 // a multi-tap can be a bit off the initial position + }, - var _createClass3 = _interopRequireDefault(_createClass2); + getTouchAction: function() { + return [TOUCH_ACTION_MANIPULATION]; + }, - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + process: function(input) { + var options = this.options; - var util = __webpack_require__(1); + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTouchTime = input.deltaTime < options.time; - var Label = function () { - function Label(body, options) { - var edgelabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - (0, _classCallCheck3['default'])(this, Label); + this.reset(); - this.body = body; + if ((input.eventType & INPUT_START) && (this.count === 0)) { + return this.failTimeout(); + } - this.pointToSelf = false; - this.baseSize = undefined; - this.fontOptions = {}; - this.setOptions(options); - this.size = { top: 0, left: 0, width: 0, height: 0, yLine: 0 }; // could be cached - this.isEdgeLabel = edgelabel; - } + // we only allow little movement + // and we've reached an end event, so a tap is possible + if (validMovement && validTouchTime && validPointers) { + if (input.eventType != INPUT_END) { + return this.failTimeout(); + } - (0, _createClass3['default'])(Label, [{ - key: 'setOptions', - value: function setOptions(options) { - var allowDeletion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; + var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; - this.elementOptions = options; + this.pTime = input.timeStamp; + this.pCenter = input.center; - // We want to keep the font options seperated from the node options. - // The node options have to mirror the globals when they are not overruled. - this.fontOptions = util.deepExtend({}, options.font, true); + if (!validMultiTap || !validInterval) { + this.count = 1; + } else { + this.count += 1; + } - if (options.label !== undefined) { - this.labelDirty = true; - } + this._input = input; - if (options.font !== undefined) { - Label.parseOptions(this.fontOptions, options, allowDeletion); - if (typeof options.font === 'string') { - this.baseSize = this.fontOptions.size; - } else if ((0, _typeof3['default'])(options.font) === 'object') { - if (options.font.size !== undefined) { - this.baseSize = options.font.size; + // if tap count matches we have recognized it, + // else it has began recognizing... + var tapCount = this.count % options.taps; + if (tapCount === 0) { + // no failing requirements, immediately trigger the tap event + // or wait as long as the multitap interval to trigger + if (!this.hasRequireFailures()) { + return STATE_RECOGNIZED; + } else { + this._timer = setTimeoutContext(function() { + this.state = STATE_RECOGNIZED; + this.tryEmit(); + }, options.interval, this); + return STATE_BEGAN; + } } - } } - } - }, { - key: 'constrain', - - - // set the width and height constraints based on 'nearest' value - value: function constrain(elementOptions, options, defaultOptions) { - this.fontOptions.constrainWidth = false; - this.fontOptions.maxWdt = -1; - this.fontOptions.minWdt = -1; - - var pile = [options, elementOptions, defaultOptions]; + return STATE_FAILED; + }, - var widthConstraint = util.topMost(pile, 'widthConstraint'); - if (typeof widthConstraint === 'number') { - this.fontOptions.maxWdt = Number(widthConstraint); - this.fontOptions.minWdt = Number(widthConstraint); - } else if ((typeof widthConstraint === 'undefined' ? 'undefined' : (0, _typeof3['default'])(widthConstraint)) === 'object') { - var widthConstraintMaximum = util.topMost(pile, ['widthConstraint', 'maximum']); - if (typeof widthConstraintMaximum === 'number') { - this.fontOptions.maxWdt = Number(widthConstraintMaximum); - } - var widthConstraintMinimum = util.topMost(pile, ['widthConstraint', 'minimum']); - if (typeof widthConstraintMinimum === 'number') { - this.fontOptions.minWdt = Number(widthConstraintMinimum); - } - } + failTimeout: function() { + this._timer = setTimeoutContext(function() { + this.state = STATE_FAILED; + }, this.options.interval, this); + return STATE_FAILED; + }, - this.fontOptions.constrainHeight = false; - this.fontOptions.minHgt = -1; - this.fontOptions.valign = 'middle'; + reset: function() { + clearTimeout(this._timer); + }, - var heightConstraint = util.topMost(pile, 'heightConstraint'); - if (typeof heightConstraint === 'number') { - this.fontOptions.minHgt = Number(heightConstraint); - } else if ((typeof heightConstraint === 'undefined' ? 'undefined' : (0, _typeof3['default'])(heightConstraint)) === 'object') { - var heightConstraintMinimum = util.topMost(pile, ['heightConstraint', 'minimum']); - if (typeof heightConstraintMinimum === 'number') { - this.fontOptions.minHgt = Number(heightConstraintMinimum); - } - var heightConstraintValign = util.topMost(pile, ['heightConstraint', 'valign']); - if (typeof heightConstraintValign === 'string') { - if (heightConstraintValign === 'top' || heightConstraintValign === 'bottom') { - this.fontOptions.valign = heightConstraintValign; - } - } + emit: function() { + if (this.state == STATE_RECOGNIZED) { + this._input.tapCount = this.count; + this.manager.emit(this.options.event, this._input); } - } + } +}); - // set the selected functions based on 'nearest' value +/** + * Simple way to create a manager with a default set of recognizers. + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ +function Hammer(element, options) { + options = options || {}; + options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); + return new Manager(element, options); +} + +/** + * @const {string} + */ +Hammer.VERSION = '2.0.7'; + +/** + * default settings + * @namespace + */ +Hammer.defaults = { + /** + * set if DOM events are being triggered. + * But this is slower and unused by simple implementations, so disabled by default. + * @type {Boolean} + * @default false + */ + domEvents: false, - }, { - key: 'choosify', - value: function choosify(elementOptions, options, defaultOptions) { - this.fontOptions.chooser = true; + /** + * The value for the touchAction property/fallback. + * When set to `compute` it will magically set the correct value based on the added recognizers. + * @type {String} + * @default compute + */ + touchAction: TOUCH_ACTION_COMPUTE, - var pile = [options, elementOptions, defaultOptions]; + /** + * @type {Boolean} + * @default true + */ + enable: true, - var chosen = util.topMost(pile, 'chosen'); - if (typeof chosen === 'boolean') { - this.fontOptions.chooser = chosen; - } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') { - var chosenLabel = util.topMost(pile, ['chosen', 'label']); - if (typeof chosenLabel === 'boolean' || typeof chosenLabel === 'function') { - this.fontOptions.chooser = chosenLabel; - } - } - } + /** + * EXPERIMENTAL FEATURE -- can be removed/changed + * Change the parent input target element. + * If Null, then it is being set the to main element. + * @type {Null|EventTarget} + * @default null + */ + inputTarget: null, - // When margins are set in an element, adjust sizes is called to remove them - // from the width/height constraints. This must be done prior to label sizing. + /** + * force an input class + * @type {Null|Function} + * @default null + */ + inputClass: null, - }, { - key: 'adjustSizes', - value: function adjustSizes(margins) { - var widthBias = margins ? margins.right + margins.left : 0; - if (this.fontOptions.constrainWidth) { - this.fontOptions.maxWdt -= widthBias; - this.fontOptions.minWdt -= widthBias; - } - var heightBias = margins ? margins.top + margins.bottom : 0; - if (this.fontOptions.constrainHeight) { - this.fontOptions.minHgt -= heightBias; - } - } + /** + * Default recognizer setup when calling `Hammer()` + * When creating a new Manager these will be skipped. + * @type {Array} + */ + preset: [ + // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] + [RotateRecognizer, {enable: false}], + [PinchRecognizer, {enable: false}, ['rotate']], + [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}], + [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']], + [TapRecognizer], + [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']], + [PressRecognizer] + ], - /** - * Collapse the font options for the multi-font to single objects, from - * the chain of option objects passed. - * - * If an option for a specific multi-font is not present, the parent - * option is checked for the given option. - * - * NOTE: naming of 'groupOptions' is a misnomer; the actual value passed - * is the new values to set from setOptions(). - */ + /** + * Some CSS properties can be used to improve the working of Hammer. + * Add them to this method and they will be set when creating a new Manager. + * @namespace + */ + cssProps: { + /** + * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userSelect: 'none', - }, { - key: 'propagateFonts', - value: function propagateFonts(options, groupOptions, defaultOptions) { - if (!this.fontOptions.multi) return; + /** + * Disable the Windows Phone grippers when pressing an element. + * @type {String} + * @default 'none' + */ + touchSelect: 'none', + + /** + * Disables the default callout shown when you touch and hold a touch target. + * On iOS, when you touch and hold a touch target such as a link, Safari displays + * a callout containing information about the link. This property allows you to disable that callout. + * @type {String} + * @default 'none' + */ + touchCallout: 'none', - /** - * Resolve the font options path. - * If valid, return a reference to the object in question. - * Otherwise, just return null. - * - * param 'mod' is optional. - * - * options {Object} base object to determine path from - * mod {string|undefined} if present, sub path for the mod-font + /** + * Specifies whether zooming is enabled. Used by IE10> + * @type {String} + * @default 'none' */ - var pathP = function pathP(options, mod) { - if (!options || !options.font) return null; + contentZooming: 'none', - var opt = options.font; + /** + * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userDrag: 'none', - if (mod) { - if (!opt[mod]) return null; - opt = opt[mod]; - } + /** + * Overrides the highlight color shown when the user taps a link or a JavaScript + * clickable element in iOS. This property obeys the alpha value, if specified. + * @type {String} + * @default 'rgba(0,0,0,0)' + */ + tapHighlightColor: 'rgba(0,0,0,0)' + } +}; - return opt; - }; +var STOP = 1; +var FORCED_STOP = 2; - /** - * Get property value from options.font[mod][property] if present. - * If mod not passed, use property value from options.font[property]. - * - * @return value if found, null otherwise. - */ - var getP = function getP(options, mod, property) { - var opt = pathP(options, mod); +/** + * Manager + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ +function Manager(element, options) { + this.options = assign({}, Hammer.defaults, options || {}); - if (opt && opt.hasOwnProperty(property)) { - return opt[property]; - } + this.options.inputTarget = this.options.inputTarget || element; - return null; - }; + this.handlers = {}; + this.session = {}; + this.recognizers = []; + this.oldCssProps = {}; - var mods = ['bold', 'ital', 'boldital', 'mono']; - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; + this.element = element; + this.input = createInputInstance(this); + this.touchAction = new TouchAction(this, this.options.touchAction); - try { - for (var _iterator = (0, _getIterator3['default'])(mods), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var mod = _step.value; + toggleCssProps(this, true); - var modOptions = this.fontOptions[mod]; - var modDefaults = defaultOptions.font[mod]; + each(this.options.recognizers, function(item) { + var recognizer = this.add(new (item[0])(item[1])); + item[2] && recognizer.recognizeWith(item[2]); + item[3] && recognizer.requireFailure(item[3]); + }, this); +} - if (Label.parseFontString(modOptions, pathP(options, mod))) { - modOptions.vadjust = this.fontOptions.vadjust; - modOptions.mod = modDefaults.mod; - } else { +Manager.prototype = { + /** + * set options + * @param {Object} options + * @returns {Manager} + */ + set: function(options) { + assign(this.options, options); - // We need to be crafty about loading the modded fonts. We want as - // much 'natural' versatility as we can get, so a simple global - // change propagates in an expected way, even if not stictly logical. + // Options that need a little more setup + if (options.touchAction) { + this.touchAction.update(); + } + if (options.inputTarget) { + // Clean up existing event listeners and reinitialize + this.input.destroy(); + this.input.target = options.inputTarget; + this.input.init(); + } + return this; + }, - // 'face' has a special exception for mono, since we probably - // don't want to sync to the base font face. - modOptions.face = getP(options, mod, 'face') || getP(groupOptions, mod, 'face') || (mod === 'mono' ? modDefaults.face : null) || getP(groupOptions, null, 'face') || this.fontOptions.face; + /** + * stop recognizing for this session. + * This session will be discarded, when a new [input]start event is fired. + * When forced, the recognizer cycle is stopped immediately. + * @param {Boolean} [force] + */ + stop: function(force) { + this.session.stopped = force ? FORCED_STOP : STOP; + }, - // 'color' follows the standard flow - modOptions.color = getP(options, mod, 'color') || getP(groupOptions, mod, 'color') || getP(groupOptions, null, 'color') || this.fontOptions.color; + /** + * run the recognizers! + * called by the inputHandler function on every movement of the pointers (touches) + * it walks through all the recognizers and tries to detect the gesture that is being made + * @param {Object} inputData + */ + recognize: function(inputData) { + var session = this.session; + if (session.stopped) { + return; + } - // 'mode' follows the standard flow - modOptions.mod = getP(options, mod, 'mod') || getP(groupOptions, mod, 'mod') || getP(groupOptions, null, 'mod') || modDefaults.mod; + // run the touch-action polyfill + this.touchAction.preventDefaults(inputData); - // It's important that we size up defaults similarly if we're - // using default faces unless overriden. We want to preserve the - // ratios closely - but if faces have changed, all bets are off. - var ratio = void 0; + var recognizer; + var recognizers = this.recognizers; - // NOTE: Following condition always fails, because modDefaults - // has no explicit font property. This is deliberate, see - // var's 'NodesHandler.defaultOptions.font[mod]'. - // However, I want to keep the original logic while refactoring; - // it appears to be working fine even if ratio is never set. - // TODO: examine if this is a bug, fix if necessary. - // - if (modOptions.face === modDefaults.face && this.fontOptions.face === defaultOptions.font.face) { + // this holds the recognizer that is being recognized. + // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED + // if no recognizer is detecting a thing, it is set to `null` + var curRecognizer = session.curRecognizer; - ratio = this.fontOptions.size / Number(defaultOptions.font.size); - } + // reset when the last recognizer is recognized + // or when we're in a new session + if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { + curRecognizer = session.curRecognizer = null; + } - modOptions.size = getP(options, mod, 'size') || getP(groupOptions, mod, 'size') || (ratio ? modDefaults.size * ratio : null) || // Scale the mod size using the same ratio - getP(groupOptions, null, 'size') || this.fontOptions.size; + var i = 0; + while (i < recognizers.length) { + recognizer = recognizers[i]; - modOptions.vadjust = getP(options, mod, 'vadjust') || getP(groupOptions, mod, 'vadjust') || (ratio ? modDefaults.vadjust * Math.round(ratio) : null) || // Scale it using the same ratio - this.fontOptions.vadjust; + // find out if we are allowed try to recognize the input for this one. + // 1. allow if the session is NOT forced stopped (see the .stop() method) + // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one + // that is being recognized. + // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. + // this can be setup with the `recognizeWith()` method on the recognizer. + if (session.stopped !== FORCED_STOP && ( // 1 + !curRecognizer || recognizer == curRecognizer || // 2 + recognizer.canRecognizeWith(curRecognizer))) { // 3 + recognizer.recognize(inputData); + } else { + recognizer.reset(); } - modOptions.size = Number(modOptions.size); - modOptions.vadjust = Number(modOptions.vadjust); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { - try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; + // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the + // current active recognizer. but only if we don't already have an active recognizer + if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { + curRecognizer = session.curRecognizer = recognizer; } - } + i++; } - } + }, - /** - * Main function. This is called from anything that wants to draw a label. - * @param ctx - * @param x - * @param y - * @param selected - * @param baseline - */ + /** + * get a recognizer by its event name. + * @param {Recognizer|String} recognizer + * @returns {Recognizer|Null} + */ + get: function(recognizer) { + if (recognizer instanceof Recognizer) { + return recognizer; + } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover) { - var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle'; + var recognizers = this.recognizers; + for (var i = 0; i < recognizers.length; i++) { + if (recognizers[i].options.event == recognizer) { + return recognizers[i]; + } + } + return null; + }, - // if no label, return - if (this.elementOptions.label === undefined) return; + /** + * add a recognizer to the manager + * existing recognizers with the same event name will be removed + * @param {Recognizer} recognizer + * @returns {Recognizer|Manager} + */ + add: function(recognizer) { + if (invokeArrayArg(recognizer, 'add', this)) { + return this; + } - // check if we have to render the label - var viewFontSize = this.fontOptions.size * this.body.view.scale; - if (this.elementOptions.label && viewFontSize < this.elementOptions.scaling.label.drawThreshold - 1) return; + // remove existing + var existing = this.get(recognizer.options.event); + if (existing) { + this.remove(existing); + } - // update the size cache if required - this.calculateLabelSize(ctx, selected, hover, x, y, baseline); + this.recognizers.push(recognizer); + recognizer.manager = this; - // create the fontfill background - this._drawBackground(ctx); - // draw text - this._drawText(ctx, selected, hover, x, y, baseline); - } + this.touchAction.update(); + return recognizer; + }, - /** - * Draws the label background - * @param {CanvasRenderingContext2D} ctx - * @private - */ + /** + * remove a recognizer by name or instance + * @param {Recognizer|String} recognizer + * @returns {Manager} + */ + remove: function(recognizer) { + if (invokeArrayArg(recognizer, 'remove', this)) { + return this; + } - }, { - key: '_drawBackground', - value: function _drawBackground(ctx) { - if (this.fontOptions.background !== undefined && this.fontOptions.background !== "none") { - ctx.fillStyle = this.fontOptions.background; + recognizer = this.get(recognizer); - var lineMargin = 2; + // let's make sure this recognizer exists + if (recognizer) { + var recognizers = this.recognizers; + var index = inArray(recognizers, recognizer); - if (this.isEdgeLabel) { - switch (this.fontOptions.align) { - case 'middle': - ctx.fillRect(-this.size.width * 0.5, -this.size.height * 0.5, this.size.width, this.size.height); - break; - case 'top': - ctx.fillRect(-this.size.width * 0.5, -(this.size.height + lineMargin), this.size.width, this.size.height); - break; - case 'bottom': - ctx.fillRect(-this.size.width * 0.5, lineMargin, this.size.width, this.size.height); - break; - default: - ctx.fillRect(this.size.left, this.size.top - 0.5 * lineMargin, this.size.width, this.size.height); - break; + if (index !== -1) { + recognizers.splice(index, 1); + this.touchAction.update(); } - } else { - ctx.fillRect(this.size.left, this.size.top - 0.5 * lineMargin, this.size.width, this.size.height); - } } - } - - /** - * - * @param ctx - * @param x - * @param baseline - * @private - */ - }, { - key: '_drawText', - value: function _drawText(ctx, selected, hover, x, y) { - var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle'; + return this; + }, - var fontSize = this.fontOptions.size; - var viewFontSize = fontSize * this.body.view.scale; - // this ensures that there will not be HUGE letters on screen by setting an upper limit on the visible text size (regardless of zoomLevel) - if (viewFontSize >= this.elementOptions.scaling.label.maxVisible) { - fontSize = Number(this.elementOptions.scaling.label.maxVisible) / this.body.view.scale; + /** + * bind event + * @param {String} events + * @param {Function} handler + * @returns {EventEmitter} this + */ + on: function(events, handler) { + if (events === undefined) { + return; + } + if (handler === undefined) { + return; } - var yLine = this.size.yLine; - - var _setAlignment2 = this._setAlignment(ctx, x, yLine, baseline); + var handlers = this.handlers; + each(splitStr(events), function(event) { + handlers[event] = handlers[event] || []; + handlers[event].push(handler); + }); + return this; + }, - var _setAlignment3 = (0, _slicedToArray3['default'])(_setAlignment2, 2); + /** + * unbind event, leave emit blank to remove all handlers + * @param {String} events + * @param {Function} [handler] + * @returns {EventEmitter} this + */ + off: function(events, handler) { + if (events === undefined) { + return; + } - x = _setAlignment3[0]; - yLine = _setAlignment3[1]; + var handlers = this.handlers; + each(splitStr(events), function(event) { + if (!handler) { + delete handlers[event]; + } else { + handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); + } + }); + return this; + }, + /** + * emit event to the listeners + * @param {String} event + * @param {Object} data + */ + emit: function(event, data) { + // we also want to trigger dom events + if (this.options.domEvents) { + triggerDomEvent(event, data); + } - ctx.textAlign = 'left'; - x = x - this.size.width / 2; // Shift label 1/2-distance to the left - if (this.fontOptions.valign && this.size.height > this.size.labelHeight) { - if (this.fontOptions.valign === 'top') { - yLine -= (this.size.height - this.size.labelHeight) / 2; - } - if (this.fontOptions.valign === 'bottom') { - yLine += (this.size.height - this.size.labelHeight) / 2; - } + // no handlers, so skip it all + var handlers = this.handlers[event] && this.handlers[event].slice(); + if (!handlers || !handlers.length) { + return; } - // draw the text - for (var i = 0; i < this.lineCount; i++) { - if (this.lines[i] && this.lines[i].blocks) { - var width = 0; - if (this.isEdgeLabel || this.fontOptions.align === 'center') { - width += (this.size.width - this.lines[i].width) / 2; - } else if (this.fontOptions.align === 'right') { - width += this.size.width - this.lines[i].width; - } - for (var j = 0; j < this.lines[i].blocks.length; j++) { - var block = this.lines[i].blocks[j]; - ctx.font = block.font; - - var _getColor2 = this._getColor(block.color, viewFontSize, block.strokeColor), - _getColor3 = (0, _slicedToArray3['default'])(_getColor2, 2), - fontColor = _getColor3[0], - strokeColor = _getColor3[1]; - - if (block.strokeWidth > 0) { - ctx.lineWidth = block.strokeWidth; - ctx.strokeStyle = strokeColor; - ctx.lineJoin = 'round'; - } - ctx.fillStyle = fontColor; + data.type = event; + data.preventDefault = function() { + data.srcEvent.preventDefault(); + }; - if (block.strokeWidth > 0) { - ctx.strokeText(block.text, x + width, yLine + block.vadjust); - } - ctx.fillText(block.text, x + width, yLine + block.vadjust); - width += block.width; - } - yLine += this.lines[i].height; - } + var i = 0; + while (i < handlers.length) { + handlers[i](data); + i++; } - } - }, { - key: '_setAlignment', - value: function _setAlignment(ctx, x, yLine, baseline) { - // check for label alignment (for edges) - // TODO: make alignment for nodes - if (this.isEdgeLabel && this.fontOptions.align !== 'horizontal' && this.pointToSelf === false) { - x = 0; - yLine = 0; - - var lineMargin = 2; - if (this.fontOptions.align === 'top') { - ctx.textBaseline = 'alphabetic'; - yLine -= 2 * lineMargin; // distance from edge, required because we use alphabetic. Alphabetic has less difference between browsers - } else if (this.fontOptions.align === 'bottom') { - ctx.textBaseline = 'hanging'; - yLine += 2 * lineMargin; // distance from edge, required because we use hanging. Hanging has less difference between browsers - } else { - ctx.textBaseline = 'middle'; - } + }, + + /** + * destroy the manager and unbinds all events + * it doesn't unbind dom events, that is the user own responsibility + */ + destroy: function() { + this.element && toggleCssProps(this, false); + + this.handlers = {}; + this.session = {}; + this.input.destroy(); + this.element = null; + } +}; + +/** + * add/remove the css properties as defined in manager.options.cssProps + * @param {Manager} manager + * @param {Boolean} add + */ +function toggleCssProps(manager, add) { + var element = manager.element; + if (!element.style) { + return; + } + var prop; + each(manager.options.cssProps, function(value, name) { + prop = prefixed(element.style, name); + if (add) { + manager.oldCssProps[prop] = element.style[prop]; + element.style[prop] = value; } else { - ctx.textBaseline = baseline; + element.style[prop] = manager.oldCssProps[prop] || ''; } - return [x, yLine]; - } + }); + if (!add) { + manager.oldCssProps = {}; + } +} + +/** + * trigger dom event + * @param {String} event + * @param {Object} data + */ +function triggerDomEvent(event, data) { + var gestureEvent = document.createEvent('Event'); + gestureEvent.initEvent(event, true, true); + gestureEvent.gesture = data; + data.target.dispatchEvent(gestureEvent); +} + +assign(Hammer, { + INPUT_START: INPUT_START, + INPUT_MOVE: INPUT_MOVE, + INPUT_END: INPUT_END, + INPUT_CANCEL: INPUT_CANCEL, + + STATE_POSSIBLE: STATE_POSSIBLE, + STATE_BEGAN: STATE_BEGAN, + STATE_CHANGED: STATE_CHANGED, + STATE_ENDED: STATE_ENDED, + STATE_RECOGNIZED: STATE_RECOGNIZED, + STATE_CANCELLED: STATE_CANCELLED, + STATE_FAILED: STATE_FAILED, + + DIRECTION_NONE: DIRECTION_NONE, + DIRECTION_LEFT: DIRECTION_LEFT, + DIRECTION_RIGHT: DIRECTION_RIGHT, + DIRECTION_UP: DIRECTION_UP, + DIRECTION_DOWN: DIRECTION_DOWN, + DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, + DIRECTION_VERTICAL: DIRECTION_VERTICAL, + DIRECTION_ALL: DIRECTION_ALL, + + Manager: Manager, + Input: Input, + TouchAction: TouchAction, + + TouchInput: TouchInput, + MouseInput: MouseInput, + PointerEventInput: PointerEventInput, + TouchMouseInput: TouchMouseInput, + SingleTouchInput: SingleTouchInput, + + Recognizer: Recognizer, + AttrRecognizer: AttrRecognizer, + Tap: TapRecognizer, + Pan: PanRecognizer, + Swipe: SwipeRecognizer, + Pinch: PinchRecognizer, + Rotate: RotateRecognizer, + Press: PressRecognizer, + + on: addEventListeners, + off: removeEventListeners, + each: each, + merge: merge, + extend: extend, + assign: assign, + inherit: inherit, + bindFn: bindFn, + prefixed: prefixed +}); - /** - * fade in when relative scale is between threshold and threshold - 1. - * If the relative scale would be smaller than threshold -1 the draw function would have returned before coming here. - * - * @param viewFontSize - * @returns {*[]} - * @private - */ +// this prevents errors when Hammer is loaded in the presence of an AMD +// style loader but by script tag, not by the loader. +var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line +freeGlobal.Hammer = Hammer; - }, { - key: '_getColor', - value: function _getColor(color, viewFontSize, initialStrokeColor) { - var fontColor = color || '#000000'; - var strokeColor = initialStrokeColor || '#ffffff'; - if (viewFontSize <= this.elementOptions.scaling.label.drawThreshold) { - var opacity = Math.max(0, Math.min(1, 1 - (this.elementOptions.scaling.label.drawThreshold - viewFontSize))); - fontColor = util.overrideOpacity(fontColor, opacity); - strokeColor = util.overrideOpacity(strokeColor, opacity); - } - return [fontColor, strokeColor]; - } +if (true) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { + return Hammer; + }.call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); +} else if (typeof module != 'undefined' && module.exports) { + module.exports = Hammer; +} else { + window[exportName] = Hammer; +} - /** - * - * @param ctx - * @param selected - * @returns {{width: number, height: number}} - */ +})(window, document, 'Hammer'); - }, { - key: 'getTextSize', - value: function getTextSize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - this._processLabel(ctx, selected, hover); - return { - width: this.size.width, - height: this.size.height, - lineCount: this.lineCount - }; - } +/***/ }), +/* 177 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * - * @param ctx - * @param selected - * @param x - * @param y - * @param baseline - */ +"use strict"; + + +// utils +exports.util = __webpack_require__(2); +exports.DOMutil = __webpack_require__(14); + +// data +exports.DataSet = __webpack_require__(11); +exports.DataView = __webpack_require__(12); +exports.Queue = __webpack_require__(43); + +// Timeline +exports.Timeline = __webpack_require__(178); +exports.Graph2d = __webpack_require__(180); +exports.timeline = { + Core: __webpack_require__(65), + DateUtil: __webpack_require__(36), + Range: __webpack_require__(64), + stack: __webpack_require__(100), + TimeStep: __webpack_require__(66), + + components: { + items: { + Item: __webpack_require__(38), + BackgroundItem: __webpack_require__(103), + BoxItem: __webpack_require__(101), + PointItem: __webpack_require__(102), + RangeItem: __webpack_require__(70) + }, - }, { - key: 'calculateLabelSize', - value: function calculateLabelSize(ctx, selected, hover) { - var x = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; - var y = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; - var baseline = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'middle'; + BackgroundGroup: __webpack_require__(69), + Component: __webpack_require__(16), + CurrentTime: __webpack_require__(67), + CustomTime: __webpack_require__(46), + DataAxis: __webpack_require__(107), + DataScale: __webpack_require__(108), + GraphGroup: __webpack_require__(109), + Group: __webpack_require__(68), + ItemSet: __webpack_require__(99), + Legend: __webpack_require__(112), + LineGraph: __webpack_require__(106), + TimeAxis: __webpack_require__(45) + } +}; + +// bundled external libraries +exports.moment = __webpack_require__(9); +exports.Hammer = __webpack_require__(10); +exports.keycharm = __webpack_require__(35); - if (this.labelDirty === true) { - this._processLabel(ctx, selected, hover); - } - this.size.left = x - this.size.width * 0.5; - this.size.top = y - this.size.height * 0.5; - this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.fontOptions.size; - if (baseline === "hanging") { - this.size.top += 0.5 * this.fontOptions.size; - this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers - this.size.yLine += 4; // distance from node - } - this.labelDirty = false; - } +/***/ }), +/* 178 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * normalize the markup system - */ +"use strict"; - }, { - key: 'decodeMarkupSystem', - value: function decodeMarkupSystem(markupSystem) { - var system = 'none'; - if (markupSystem === 'markdown' || markupSystem === 'md') { - system = 'markdown'; - } else if (markupSystem === true || markupSystem === 'html') { - system = 'html'; - } - return system; - } - /** - * Explodes a piece of text into single-font blocks using a given markup - * @param text - * @param markupSystem - * @returns [{ text, mod }] - */ +var moment = __webpack_require__(9); +var util = __webpack_require__(2); +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var Range = __webpack_require__(64); +var Core = __webpack_require__(65); +var TimeAxis = __webpack_require__(45); +var CurrentTime = __webpack_require__(67); +var CustomTime = __webpack_require__(46); +var ItemSet = __webpack_require__(99); - }, { - key: 'splitBlocks', - value: function splitBlocks(text, markupSystem) { - var system = this.decodeMarkupSystem(markupSystem); - if (system === 'none') { - return [{ - text: text, - mod: 'normal' - }]; - } else if (system === 'markdown') { - return this.splitMarkdownBlocks(text); - } else if (system === 'html') { - return this.splitHtmlBlocks(text); - } - } - }, { - key: 'splitMarkdownBlocks', - value: function splitMarkdownBlocks(text) { - var blocks = []; - var s = { - bold: false, - ital: false, - mono: false, - beginable: true, - spacing: false, - position: 0, - buffer: "", - modStack: [] - }; - s.mod = function () { - return this.modStack.length === 0 ? 'normal' : this.modStack[0]; - }; - s.modName = function () { - if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else { - if (s.bold && s.ital) { - return 'boldital'; - } else if (s.bold) { - return 'bold'; - } else if (s.ital) { - return 'ital'; - } - } - }; - s.emitBlock = function () { - var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; +var printStyle = __webpack_require__(15).printStyle; +var allOptions = __webpack_require__(105).allOptions; +var configureOptions = __webpack_require__(105).configureOptions; - if (this.spacing) { - this.add(" "); - this.spacing = false; - } - if (this.buffer.length > 0) { - blocks.push({ text: this.buffer, mod: this.modName() }); - this.buffer = ""; - } - }; - s.add = function (text) { - if (text === " ") { - s.spacing = true; - } - if (s.spacing) { - this.buffer += " "; - this.spacing = false; - } - if (text != " ") { - this.buffer += text; - } - }; - while (s.position < text.length) { - var ch = text.charAt(s.position); - if (/[ \t]/.test(ch)) { - if (!s.mono) { - s.spacing = true; - } else { - s.add(ch); - } - s.beginable = true; - } else if (/\\/.test(ch)) { - if (s.position < text.length + 1) { - s.position++; - ch = text.charAt(s.position); - if (/ \t/.test(ch)) { - s.spacing = true; - } else { - s.add(ch); - s.beginable = false; - } - } - } else if (!s.mono && !s.bold && (s.beginable || s.spacing) && /\*/.test(ch)) { - s.emitBlock(); - s.bold = true; - s.modStack.unshift("bold"); - } else if (!s.mono && !s.ital && (s.beginable || s.spacing) && /\_/.test(ch)) { - s.emitBlock(); - s.ital = true; - s.modStack.unshift("ital"); - } else if (!s.mono && (s.beginable || s.spacing) && /`/.test(ch)) { - s.emitBlock(); - s.mono = true; - s.modStack.unshift("mono"); - } else if (!s.mono && s.mod() === "bold" && /\*/.test(ch)) { - if (s.position === text.length - 1 || /[.,_` \t\n]/.test(text.charAt(s.position + 1))) { - s.emitBlock(); - s.bold = false; - s.modStack.shift(); - } else { - s.add(ch); - } - } else if (!s.mono && s.mod() === "ital" && /\_/.test(ch)) { - if (s.position === text.length - 1 || /[.,*` \t\n]/.test(text.charAt(s.position + 1))) { - s.emitBlock(); - s.ital = false; - s.modStack.shift(); - } else { - s.add(ch); - } - } else if (s.mono && s.mod() === "mono" && /`/.test(ch)) { - if (s.position === text.length - 1 || /[.,*_ \t\n]/.test(text.charAt(s.position + 1))) { - s.emitBlock(); - s.mono = false; - s.modStack.shift(); - } else { - s.add(ch); - } - } else { - s.add(ch); - s.beginable = false; - } - s.position++; - } - s.emitBlock(); - return blocks; - } - }, { - key: 'splitHtmlBlocks', - value: function splitHtmlBlocks(text) { - var blocks = []; - var s = { - bold: false, - ital: false, - mono: false, - spacing: false, - position: 0, - buffer: "", - modStack: [] - }; - s.mod = function () { - return this.modStack.length === 0 ? 'normal' : this.modStack[0]; - }; - s.modName = function () { - if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else { - if (s.bold && s.ital) { - return 'boldital'; - } else if (s.bold) { - return 'bold'; - } else if (s.ital) { - return 'ital'; - } - } - }; - s.emitBlock = function () { - var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; +var Configurator = __webpack_require__(71)['default']; +var Validator = __webpack_require__(15)['default']; - if (this.spacing) { - this.add(" "); - this.spacing = false; - } - if (this.buffer.length > 0) { - blocks.push({ text: this.buffer, mod: this.modName() }); - this.buffer = ""; - } - }; - s.add = function (text) { - if (text === " ") { - s.spacing = true; - } - if (s.spacing) { - this.buffer += " "; - this.spacing = false; - } - if (text != " ") { - this.buffer += text; - } - }; - while (s.position < text.length) { - var ch = text.charAt(s.position); - if (/[ \t]/.test(ch)) { - if (!s.mono) { - s.spacing = true; - } else { - s.add(ch); - } - } else if (//.test(text.substr(s.position, 3))) { - s.emitBlock(); - s.bold = true; - s.modStack.unshift("bold"); - s.position += 2; - } else if (!s.mono && !s.ital && //.test(text.substr(s.position, 3))) { - s.emitBlock(); - s.ital = true; - s.modStack.unshift("ital"); - s.position += 2; - } else if (!s.mono && //.test(text.substr(s.position, 6))) { - s.emitBlock(); - s.mono = true; - s.modStack.unshift("mono"); - s.position += 5; - } else if (!s.mono && s.mod() === 'bold' && /<\/b>/.test(text.substr(s.position, 4))) { - s.emitBlock(); - s.bold = false; - s.modStack.shift(); - s.position += 3; - } else if (!s.mono && s.mod() === 'ital' && /<\/i>/.test(text.substr(s.position, 4))) { - s.emitBlock(); - s.ital = false; - s.modStack.shift(); - s.position += 3; - } else if (s.mod() === 'mono' && /<\/code>/.test(text.substr(s.position, 7))) { - s.emitBlock(); - s.mono = false; - s.modStack.shift(); - s.position += 6; - } else { - s.add(ch); - } - } else if (/&/.test(ch)) { - if (/</.test(text.substr(s.position, 4))) { - s.add("<"); - s.position += 3; - } else if (/&/.test(text.substr(s.position, 5))) { - s.add("&"); - s.position += 4; - } else { - s.add("&"); - } - } else { - s.add(ch); - } - s.position++; - } - s.emitBlock(); - return blocks; - } - }, { - key: 'getFormattingValues', - value: function getFormattingValues(ctx, selected, hover, mod) { - var getValue = function getValue(fontOptions, mod, option) { - if (mod === "normal") { - if (option === 'mod') return ""; - return fontOptions[option]; - } +/** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | vis.DataView | Array} [items] + * @param {vis.DataSet | vis.DataView | Array} [groups] + * @param {Object} [options] See Timeline.setOptions for the available options. + * @constructor Timeline + * @extends Core + */ +function Timeline(container, items, groups, options) { + + if (!(this instanceof Timeline)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + + // if the third element is options, the forth is groups (optionally); + if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) { + var forthArgument = options; + options = groups; + groups = forthArgument; + } + + // TODO: REMOVE THIS in the next MAJOR release + // see https://github.com/almende/vis/issues/2511 + if (options && options.throttleRedraw) { + console.warn("Timeline option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release."); + } + + var me = this; + this.defaultOptions = { + start: null, + end: null, + autoResize: true, + orientation: { + axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both' + item: 'bottom' // not relevant + }, + moment: moment, + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = util.deepExtend({}, this.defaultOptions); + + // Create the DOM, props, and emitter + this._create(container); + if (!options || options && typeof options.rtl == "undefined") { + this.dom.root.style.visibility = 'hidden'; + var directionFromDom, + domNode = this.dom.root; + while (!directionFromDom && domNode) { + directionFromDom = window.getComputedStyle(domNode, null).direction; + domNode = domNode.parentElement; + } + this.options.rtl = directionFromDom && directionFromDom.toLowerCase() == "rtl"; + } else { + this.options.rtl = options.rtl; + } - if (fontOptions[mod][option]) { - return fontOptions[mod][option]; - } else { - // Take from parent font option - return fontOptions[option]; - } - }; + this.options.rollingMode = options && options.rollingMode; + this.options.onInitialDrawComplete = options && options.onInitialDrawComplete; - var values = { - color: getValue(this.fontOptions, mod, 'color'), - size: getValue(this.fontOptions, mod, 'size'), - face: getValue(this.fontOptions, mod, 'face'), - mod: getValue(this.fontOptions, mod, 'mod'), - vadjust: getValue(this.fontOptions, mod, 'vadjust'), - strokeWidth: this.fontOptions.strokeWidth, - strokeColor: this.fontOptions.strokeColor - }; - if (selected || hover) { - if (mod === "normal" && this.fontOptions.chooser === true && this.elementOptions.labelHighlightBold) { - values.mod = 'bold'; - } else { - if (typeof this.fontOptions.chooser === 'function') { - this.fontOptions.chooser(values, this.elementOptions.id, selected, hover); - } - } - } - ctx.font = (values.mod + " " + values.size + "px " + values.face).replace(/"/g, ""); - values.font = ctx.font; - values.height = values.size; - return values; - } - }, { - key: 'differentState', - value: function differentState(selected, hover) { - return selected !== this.fontOptions.selectedState && hover !== this.fontOptions.hoverState; - } + // all components listed here will be repainted automatically + this.components = []; - /** - * This explodes the label string into lines and sets the width, height and number of lines. - * @param ctx - * @param selected - * @private - */ + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this) + }, + hiddenDates: [], + util: { + getScale: function getScale() { + return me.timeAxis.step.scale; + }, + getStep: function getStep() { + return me.timeAxis.step.step; + }, - }, { - key: '_processLabel', - value: function _processLabel(ctx, selected, hover) { - var width = 0; - var height = 0; - var nlLines = []; - var lines = []; - var k = 0; - lines.add = function (l, text, font, color, width, height, vadjust, mod, strokeWidth, strokeColor) { - if (this.length == l) { - this[l] = { width: 0, height: 0, blocks: [] }; - } - this[l].blocks.push({ text: text, font: font, color: color, width: width, height: height, vadjust: vadjust, mod: mod, strokeWidth: strokeWidth, strokeColor: strokeColor }); - }; - lines.accumulate = function (l, width, height) { - this[l].width += width; - this[l].height = height > this[l].height ? height : this[l].height; - }; - lines.addAndAccumulate = function (l, text, font, color, width, height, vadjust, mod, strokeWidth, strokeColor) { - this.add(l, text, font, color, width, height, vadjust, mod, strokeWidth, strokeColor); - this.accumulate(l, width, height); - }; - if (this.elementOptions.label !== undefined) { - var _nlLines = String(this.elementOptions.label).split('\n'); - var lineCount = _nlLines.length; - if (this.elementOptions.font.multi) { - for (var i = 0; i < lineCount; i++) { - var blocks = this.splitBlocks(_nlLines[i], this.elementOptions.font.multi); - var lineWidth = 0; - var lineHeight = 0; - if (blocks) { - if (blocks.length == 0) { - var values = this.getFormattingValues(ctx, selected, hover, "normal"); - lines.addAndAccumulate(k, "", values.font, values.color, 0, values.size, values.vadjust, "normal", values.strokeWidth, values.strokeColor); - height += lines[k].height; - k++; - continue; - } - for (var j = 0; j < blocks.length; j++) { - if (this.fontOptions.maxWdt > 0) { - var _values = this.getFormattingValues(ctx, selected, hover, blocks[j].mod); - var words = blocks[j].text.split(" "); - var atStart = true; - var text = ""; - var measure = { width: 0 }; - var lastMeasure = void 0; - var w = 0; - while (w < words.length) { - var pre = atStart ? "" : " "; - lastMeasure = measure; - measure = ctx.measureText(text + pre + words[w]); - if (lineWidth + measure.width > this.fontOptions.maxWdt && lastMeasure.width != 0) { - lineHeight = _values.height > lineHeight ? _values.height : lineHeight; - lines.add(k, text, _values.font, _values.color, lastMeasure.width, _values.height, _values.vadjust, blocks[j].mod, _values.strokeWidth, _values.strokeColor); - lines.accumulate(k, lastMeasure.width, lineHeight); - text = ""; - atStart = true; - lineWidth = 0; - width = lines[k].width > width ? lines[k].width : width; - height += lines[k].height; - k++; - } else { - text = text + pre + words[w]; - if (w === words.length - 1) { - lineHeight = _values.height > lineHeight ? _values.height : lineHeight; - lineWidth += measure.width; - lines.add(k, text, _values.font, _values.color, measure.width, _values.height, _values.vadjust, blocks[j].mod, _values.strokeWidth, _values.strokeColor); - lines.accumulate(k, measure.width, lineHeight); - if (j === blocks.length - 1) { - width = lines[k].width > width ? lines[k].width : width; - height += lines[k].height; - k++; - } - } - w++; - atStart = false; - } - } - } else { - var _values2 = this.getFormattingValues(ctx, selected, hover, blocks[j].mod); - var _measure = ctx.measureText(blocks[j].text); - lines.addAndAccumulate(k, blocks[j].text, _values2.font, _values2.color, _measure.width, _values2.height, _values2.vadjust, blocks[j].mod, _values2.strokeWidth, _values2.strokeColor); - width = lines[k].width > width ? lines[k].width : width; - if (blocks.length - 1 === j) { - height += lines[k].height; - k++; - } - } - } - } - } - } else { - for (var _i = 0; _i < lineCount; _i++) { - var _values3 = this.getFormattingValues(ctx, selected, hover, "normal"); - if (this.fontOptions.maxWdt > 0) { - var _words = _nlLines[_i].split(" "); - var _text = ""; - var _measure2 = { width: 0 }; - var _lastMeasure = void 0; - var _w = 0; - while (_w < _words.length) { - var _pre = _text === "" ? "" : " "; - _lastMeasure = _measure2; - _measure2 = ctx.measureText(_text + _pre + _words[_w]); - if (_measure2.width > this.fontOptions.maxWdt && _lastMeasure.width != 0) { - lines.addAndAccumulate(k, _text, _values3.font, _values3.color, _lastMeasure.width, _values3.size, _values3.vadjust, "normal", _values3.strokeWidth, _values3.strokeColor); - width = lines[k].width > width ? lines[k].width : width; - height += lines[k].height; - _text = ""; - k++; - } else { - _text = _text + _pre + _words[_w]; - if (_w === _words.length - 1) { - lines.addAndAccumulate(k, _text, _values3.font, _values3.color, _measure2.width, _values3.size, _values3.vadjust, "normal", _values3.strokeWidth, _values3.strokeColor); - width = lines[k].width > width ? lines[k].width : width; - height += lines[k].height; - k++; - } - _w++; - } - } - } else { - var _text2 = _nlLines[_i]; - var _measure3 = ctx.measureText(_text2); - lines.addAndAccumulate(k, _text2, _values3.font, _values3.color, _measure3.width, _values3.size, _values3.vadjust, "normal", _values3.strokeWidth, _values3.strokeColor); - width = lines[k].width > width ? lines[k].width : width; - height += lines[k].height; - k++; - } - } - } - } - if (this.fontOptions.minWdt > 0 && width < this.fontOptions.minWdt) { - width = this.fontOptions.minWdt; - } - this.size.labelHeight = height; - if (this.fontOptions.minHgt > 0 && height < this.fontOptions.minHgt) { - height = this.fontOptions.minHgt; - } - this.lines = lines; - this.lineCount = lines.length; - this.size.width = width; - this.size.height = height; - this.selectedState = selected; - this.hoverState = hover; - } - }], [{ - key: 'parseOptions', - value: function parseOptions(parentOptions, newOptions) { - var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + toScreen: me._toScreen.bind(me), + toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width + toTime: me._toTime.bind(me), + toGlobalTime: me._toGlobalTime.bind(me) + } + }; - if (Label.parseFontString(parentOptions, newOptions.font)) { - parentOptions.vadjust = 0; - } else if ((0, _typeof3['default'])(newOptions.font) === 'object') { - util.fillIfDefined(parentOptions, newOptions.font, allowDeletion); - } - parentOptions.size = Number(parentOptions.size); - parentOptions.vadjust = Number(parentOptions.vadjust); - } + // range + this.range = new Range(this.body, this.options); + this.components.push(this.range); + this.body.range = this.range; - /** - * If in-variable is a string, parse it as a font specifier. - * - * Note that following is not done here and have to be done after the call: - * - No number conversion (size) - * - Not all font options are set (vadjust, mod) - * - * @param inOptions {Object} font options to parse - * @param outOptions {Object} out-parameter, object in which to store the parse results (if any) - * - * @return true if font parsed as string, false otherwise - */ + // time axis + this.timeAxis = new TimeAxis(this.body, this.options); + this.timeAxis2 = null; // used in case of orientation option 'both' + this.components.push(this.timeAxis); - }, { - key: 'parseFontString', - value: function parseFontString(outOptions, inOptions) { - if (!inOptions || typeof inOptions !== 'string') return false; + // current time bar + this.currentTime = new CurrentTime(this.body, this.options); + this.components.push(this.currentTime); - var newOptionsArray = inOptions.split(" "); + // item set + this.itemSet = new ItemSet(this.body, this.options); + this.components.push(this.itemSet); - outOptions.size = newOptionsArray[0].replace("px", ''); - outOptions.face = newOptionsArray[1]; - outOptions.color = newOptionsArray[2]; + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - return true; - } - }]); - return Label; - }(); + this.dom.root.onclick = function (event) { + me.emit('click', me.getEventProperties(event)); + }; + this.dom.root.ondblclick = function (event) { + me.emit('doubleClick', me.getEventProperties(event)); + }; + this.dom.root.oncontextmenu = function (event) { + me.emit('contextmenu', me.getEventProperties(event)); + }; + this.dom.root.onmouseover = function (event) { + me.emit('mouseOver', me.getEventProperties(event)); + }; + if (window.PointerEvent) { + this.dom.root.onpointerdown = function (event) { + me.emit('mouseDown', me.getEventProperties(event)); + }; + this.dom.root.onpointermove = function (event) { + me.emit('mouseMove', me.getEventProperties(event)); + }; + this.dom.root.onpointerup = function (event) { + me.emit('mouseUp', me.getEventProperties(event)); + }; + } else { + this.dom.root.onmousemove = function (event) { + me.emit('mouseMove', me.getEventProperties(event)); + }; + this.dom.root.onmousedown = function (event) { + me.emit('mouseDown', me.getEventProperties(event)); + }; + this.dom.root.onmouseup = function (event) { + me.emit('mouseUp', me.getEventProperties(event)); + }; + } - exports['default'] = Label; + //Single time autoscale/fit + this.initialFitDone = false; + this.on('changed', function () { + if (this.itemsData == null || this.options.rollingMode) return; + if (!me.initialFitDone) { + me.initialFitDone = true; + if (me.options.start != undefined || me.options.end != undefined) { + if (me.options.start == undefined || me.options.end == undefined) { + var range = me.getItemRange(); + } -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { + var start = me.options.start != undefined ? me.options.start : range.min; + var end = me.options.end != undefined ? me.options.end : range.max; + me.setWindow(start, end, { animation: false }); + } else { + me.fit({ animation: false }); + } + } - "use strict"; + if (!me.initialDrawDone && me.initialRangeChangeDone) { + me.initialDrawDone = true; + me.dom.root.style.visibility = 'visible'; + if (me.options.onInitialDrawComplete) { + setTimeout(function () { + return me.options.onInitialDrawComplete(); + }, 0); + } + } + }); - exports.__esModule = true; + // apply options + if (options) { + this.setOptions(options); + } - var _isIterable2 = __webpack_require__(172); + // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! + if (groups) { + this.setGroups(groups); + } - var _isIterable3 = _interopRequireDefault(_isIterable2); + // create itemset + if (items) { + this.setItems(items); + } - var _getIterator2 = __webpack_require__(2); + // draw for the first time + this._redraw(); +} - var _getIterator3 = _interopRequireDefault(_getIterator2); +// Extend the functionality from Core +Timeline.prototype = new Core(); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Load a configurator + * @return {Object} + * @private + */ +Timeline.prototype._createConfigurator = function () { + return new Configurator(this, this.dom.container, configureOptions); +}; - exports.default = function () { - function sliceIterator(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; +/** + * Force a redraw. The size of all items will be recalculated. + * Can be useful to manually redraw when option autoResize=false and the window + * has been resized, or when the items CSS has been changed. + * + * Note: this function will be overridden on construction with a trottled version + */ +Timeline.prototype.redraw = function () { + this.itemSet && this.itemSet.markDirty({ refreshItems: true }); + this._redraw(); +}; - try { - for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); +Timeline.prototype.setOptions = function (options) { + // validate options + var errorFound = Validator.validate(options, allOptions); - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"]) _i["return"](); - } finally { - if (_d) throw _e; - } - } + if (errorFound === true) { + console.log('%cErrors have been found in the supplied options object.', printStyle); + } + Core.prototype.setOptions.call(this, options); - return _arr; - } + if ('type' in options) { + if (options.type !== this.options.type) { + this.options.type = options.type; - return function (arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if ((0, _isIterable3.default)(Object(arr))) { - return sliceIterator(arr, i); - } else { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); + // force recreation of all items + var itemsData = this.itemsData; + if (itemsData) { + var selection = this.getSelection(); + this.setItems(null); // remove all + this.setItems(itemsData); // add all + this.setSelection(selection); // restore selection } - }; - }(); + } + } +}; -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Set items + * @param {vis.DataSet | Array | null} items + */ +Timeline.prototype.setItems = function (items) { + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } else if (items instanceof DataSet || items instanceof DataView) { + newDataSet = items; + } else { + // turn an array into a dataset + newDataSet = new DataSet(items, { + type: { + start: 'Date', + end: 'Date' + } + }); + } - module.exports = { "default": __webpack_require__(173), __esModule: true }; + // set items + this.itemsData = newDataSet; + this.itemSet && this.itemSet.setItems(newDataSet); +}; -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Set groups + * @param {vis.DataSet | Array} groups + */ +Timeline.prototype.setGroups = function (groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } else { + var filter = function filter(group) { + return group.visible !== false; + }; + if (groups instanceof DataSet || groups instanceof DataView) { + newDataSet = new DataView(groups, { filter: filter }); + } else { + // turn an array into a dataset + newDataSet = new DataSet(groups.filter(filter)); + } + } - __webpack_require__(4); - __webpack_require__(50); - module.exports = __webpack_require__(174); + this.groupsData = newDataSet; + this.itemSet.setGroups(newDataSet); +}; -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Set both items and groups in one go + * @param {{items: (Array | vis.DataSet), groups: (Array | vis.DataSet)}} data + */ +Timeline.prototype.setData = function (data) { + if (data && data.groups) { + this.setGroups(data.groups); + } - var classof = __webpack_require__(54) - , ITERATOR = __webpack_require__(47)('iterator') - , Iterators = __webpack_require__(8); - module.exports = __webpack_require__(17).isIterable = function(it){ - var O = Object(it); - return O[ITERATOR] !== undefined - || '@@iterator' in O - || Iterators.hasOwnProperty(classof(O)); - }; + if (data && data.items) { + this.setItems(data.items); + } +}; -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Set selected items by their id. Replaces the current selection + * Unknown id's are silently ignored. + * @param {string[] | string} [ids] An array with zero or more id's of the items to be + * selected. If ids is an empty array, all items will be + * unselected. + * @param {Object} [options] Available options: + * `focus: boolean` + * If true, focus will be set to the selected item(s) + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * Only applicable when option focus is true. + */ +Timeline.prototype.setSelection = function (ids, options) { + this.itemSet && this.itemSet.setSelection(ids); + + if (options && options.focus) { + this.focus(ids, options); + } +}; - 'use strict'; +/** + * Get the selected items by their id + * @return {Array} ids The ids of the selected items + */ +Timeline.prototype.getSelection = function () { + return this.itemSet && this.itemSet.getSelection() || []; +}; - Object.defineProperty(exports, "__esModule", { - value: true +/** + * Adjust the visible window such that the selected item (or multiple items) + * are centered on screen. + * @param {string | String[]} id An item id or array with item ids + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + */ +Timeline.prototype.focus = function (id, options) { + if (!this.itemsData || id == undefined) return; + + var ids = Array.isArray(id) ? id : [id]; + + // get the specified item(s) + var itemsData = this.itemsData.getDataSet().get(ids, { + type: { + start: 'Date', + end: 'Date' + } }); - var _getPrototypeOf = __webpack_require__(176); + // calculate minimum start and maximum end of specified items + var start = null; + var end = null; + itemsData.forEach(function (itemData) { + var s = itemData.start.valueOf(); + var e = 'end' in itemData ? itemData.end.valueOf() : itemData.start.valueOf(); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + if (start === null || s < start) { + start = s; + } - var _classCallCheck2 = __webpack_require__(135); + if (end === null || e > end) { + end = e; + } + }); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + if (start !== null && end !== null) { + var me = this; + // Use the first item for the vertical focus + var item = this.itemSet.items[ids[0]]; + var startPos = this._getScrollTop() * -1; + var initialVerticalScroll = null; - var _createClass2 = __webpack_require__(136); + // Setup a handler for each frame of the vertical scroll + var verticalAnimationFrame = function verticalAnimationFrame(ease, willDraw, done) { + var verticalScroll = getItemVerticalScroll(me, item); - var _createClass3 = _interopRequireDefault(_createClass2); + if (!initialVerticalScroll) { + initialVerticalScroll = verticalScroll; + } - var _possibleConstructorReturn2 = __webpack_require__(179); + if (initialVerticalScroll.itemTop == verticalScroll.itemTop && !initialVerticalScroll.shouldScroll) { + return; // We don't need to scroll, so do nothing + } else if (initialVerticalScroll.itemTop != verticalScroll.itemTop && verticalScroll.shouldScroll) { + // The redraw shifted elements, so reset the animation to correct + initialVerticalScroll = verticalScroll; + startPos = me._getScrollTop() * -1; + } - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + var from = startPos; + var to = initialVerticalScroll.scrollOffset; + var scrollTop = done ? to : from + (to - from) * ease; - var _inherits2 = __webpack_require__(180); + me._setScrollTop(-scrollTop); - var _inherits3 = _interopRequireDefault(_inherits2); + if (!willDraw) { + me._redraw(); + } + }; - var _NodeBase2 = __webpack_require__(185); + // Enforces the final vertical scroll position + var setFinalVerticalPosition = function setFinalVerticalPosition() { + var finalVerticalScroll = getItemVerticalScroll(me, item); - var _NodeBase3 = _interopRequireDefault(_NodeBase2); + if (finalVerticalScroll.shouldScroll && finalVerticalScroll.itemTop != initialVerticalScroll.itemTop) { + me._setScrollTop(-finalVerticalScroll.scrollOffset); + me._redraw(); + } + }; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + // Perform one last check at the end to make sure the final vertical + // position is correct + var finalVerticalCallback = function finalVerticalCallback() { + // Double check we ended at the proper scroll position + setFinalVerticalPosition(); - var Box = function (_NodeBase) { - (0, _inherits3['default'])(Box, _NodeBase); + // Let the redraw settle and finalize the position. + setTimeout(setFinalVerticalPosition, 100); + }; - function Box(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Box); + // calculate the new middle and interval for the window + var middle = (start + end) / 2; + var interval = Math.max(this.range.end - this.range.start, (end - start) * 1.1); - var _this = (0, _possibleConstructorReturn3['default'])(this, (Box.__proto__ || (0, _getPrototypeOf2['default'])(Box)).call(this, options, body, labelModule)); + var animation = options && options.animation !== undefined ? options.animation : true; - _this._setMargins(labelModule); - return _this; + if (!animation) { + // We aren't animating so set a default so that the final callback forces the vertical location + initialVerticalScroll = { shouldScroll: false, scrollOffset: -1, itemTop: -1 }; } - (0, _createClass3['default'])(Box, [{ - key: 'resize', - value: function resize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; + this.range.setRange(middle - interval / 2, middle + interval / 2, { animation: animation }, finalVerticalCallback, verticalAnimationFrame); + } +}; - if (this.needsRefresh(selected, hover)) { - this.textSize = this.labelModule.getTextSize(ctx, selected, hover); - this.width = this.textSize.width + this.margin.right + this.margin.left; - this.height = this.textSize.height + this.margin.top + this.margin.bottom; - this.radius = this.width / 2; - } - } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.resize(ctx, selected, hover); - this.left = x - this.width / 2; - this.top = y - this.height / 2; +/** + * Set Timeline window such that it fits all items + * @param {Object} [options] Available options: + * `animation: boolean | {duration: number, easingFunction: string}` + * If true (default), the range is animated + * smoothly to the new window. An object can be + * provided to specify duration and easing function. + * Default duration is 500 ms, and default easing + * function is 'easeInOutQuad'. + * @param {function} [callback] + */ +Timeline.prototype.fit = function (options, callback) { + var animation = options && options.animation !== undefined ? options.animation : true; + var range; + + var dataset = this.itemsData && this.itemsData.getDataSet(); + if (dataset.length === 1 && dataset.get()[0].end === undefined) { + // a single item -> don't fit, just show a range around the item from -4 to +3 days + range = this.getDataRange(); + this.moveTo(range.min.valueOf(), { animation: animation }, callback); + } else { + // exactly fit the items (plus a small margin) + range = this.getItemRange(); + this.range.setRange(range.min, range.max, { animation: animation }, callback); + } +}; - this.initContextForDraw(ctx, values); - ctx.roundRect(this.left, this.top, this.width, this.height, values.borderRadius); - this.performFill(ctx, values); +/** + * + * @param {vis.Item} item + * @returns {number} + */ +function getStart(item) { + return util.convert(item.data.start, 'Date').valueOf(); +} - this.updateBoundingBox(x, y, ctx, selected, hover); - this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); - } - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y, ctx, selected, hover) { - this._updateBoundingBox(x, y, ctx, selected, hover); +/** + * + * @param {vis.Item} item + * @returns {number} + */ +function getEnd(item) { + var end = item.data.end != undefined ? item.data.end : item.data.start; + return util.convert(end, 'Date').valueOf(); +} - var borderRadius = this.options.shapeProperties.borderRadius; // only effective for box - this._addBoundingBoxMargin(borderRadius); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - this.resize(ctx); - var borderWidth = this.options.borderWidth; +/** + * @param {vis.Timeline} timeline + * @param {vis.Item} item + * @return {{shouldScroll: bool, scrollOffset: number, itemTop: number}} + */ +function getItemVerticalScroll(timeline, item) { + var leftHeight = timeline.props.leftContainer.height; + var contentHeight = timeline.props.left.height; + + var group = item.parent; + var offset = group.top; + var shouldScroll = true; + var orientation = timeline.timeAxis.options.orientation.axis; + + var itemTop = function itemTop() { + if (orientation == "bottom") { + return group.height - item.top - item.height; + } else { + return item.top; + } + }; - return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; - } - }]); - return Box; - }(_NodeBase3['default']); + var currentScrollHeight = timeline._getScrollTop() * -1; + var targetOffset = offset + itemTop(); + var height = item.height; - exports['default'] = Box; + if (targetOffset < currentScrollHeight) { + if (offset + leftHeight <= offset + itemTop() + height) { + offset += itemTop() - timeline.itemSet.options.margin.item.vertical; + } + } else if (targetOffset + height > currentScrollHeight + leftHeight) { + offset += itemTop() + height - leftHeight + timeline.itemSet.options.margin.item.vertical; + } else { + shouldScroll = false; + } -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { + offset = Math.min(offset, contentHeight - leftHeight); - module.exports = { "default": __webpack_require__(177), __esModule: true }; + return { shouldScroll: shouldScroll, scrollOffset: offset, itemTop: targetOffset }; +} -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Determine the range of the items, taking into account their actual width + * and a margin of 10 pixels on both sides. + * + * @returns {{min: Date, max: Date}} + */ +Timeline.prototype.getItemRange = function () { + // get a rough approximation for the range based on the items start and end dates + var range = this.getDataRange(); + var min = range.min !== null ? range.min.valueOf() : null; + var max = range.max !== null ? range.max.valueOf() : null; + var minItem = null; + var maxItem = null; + + if (min != null && max != null) { + var interval = max - min; // ms + if (interval <= 0) { + interval = 10; + } + var factor = interval / this.props.center.width; + + var redrawQueue = {}; + var redrawQueueLength = 0; + + // collect redraw functions + util.forEach(this.itemSet.items, function (item, key) { + if (item.groupShowing) { + var returnQueue = true; + redrawQueue[key] = item.redraw(returnQueue); + redrawQueueLength = redrawQueue[key].length; + } + }); - __webpack_require__(178); - module.exports = __webpack_require__(17).Object.getPrototypeOf; + var needRedraw = redrawQueueLength > 0; + if (needRedraw) { + // redraw all regular items + for (var i = 0; i < redrawQueueLength; i++) { + util.forEach(redrawQueue, function (fns) { + fns[i](); + }); + } + } -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { + // calculate the date of the left side and right side of the items given + util.forEach(this.itemSet.items, function (item) { + var start = getStart(item); + var end = getEnd(item); + var startSide; + var endSide; - // 19.1.2.9 Object.getPrototypeOf(O) - var toObject = __webpack_require__(49) - , $getPrototypeOf = __webpack_require__(48); + if (this.options.rtl) { + startSide = start - (item.getWidthRight() + 10) * factor; + endSide = end + (item.getWidthLeft() + 10) * factor; + } else { + startSide = start - (item.getWidthLeft() + 10) * factor; + endSide = end + (item.getWidthRight() + 10) * factor; + } - __webpack_require__(61)('getPrototypeOf', function(){ - return function getPrototypeOf(it){ - return $getPrototypeOf(toObject(it)); - }; - }); + if (startSide < min) { + min = startSide; + minItem = item; + } + if (endSide > max) { + max = endSide; + maxItem = item; + } + }.bind(this)); -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { + if (minItem && maxItem) { + var lhs = minItem.getWidthLeft() + 10; + var rhs = maxItem.getWidthRight() + 10; + var delta = this.props.center.width - lhs - rhs; // px + + if (delta > 0) { + if (this.options.rtl) { + min = getStart(minItem) - rhs * interval / delta; // ms + max = getEnd(maxItem) + lhs * interval / delta; // ms + } else { + min = getStart(minItem) - lhs * interval / delta; // ms + max = getEnd(maxItem) + rhs * interval / delta; // ms + } + } + } + } - "use strict"; + return { + min: min != null ? new Date(min) : null, + max: max != null ? new Date(max) : null + }; +}; - exports.__esModule = true; +/** + * Calculate the data range of the items start and end dates + * @returns {{min: Date, max: Date}} + */ +Timeline.prototype.getDataRange = function () { + var min = null; + var max = null; + + var dataset = this.itemsData && this.itemsData.getDataSet(); + if (dataset) { + dataset.forEach(function (item) { + var start = util.convert(item.start, 'Date').valueOf(); + var end = util.convert(item.end != undefined ? item.end : item.start, 'Date').valueOf(); + if (min === null || start < min) { + min = start; + } + if (max === null || end > max) { + max = end; + } + }); + } - var _typeof2 = __webpack_require__(62); + return { + min: min != null ? new Date(min) : null, + max: max != null ? new Date(max) : null + }; +}; - var _typeof3 = _interopRequireDefault(_typeof2); +/** + * Generate Timeline related information from an event + * @param {Event} event + * @return {Object} An object with related information, like on which area + * The event happened, whether clicked on an item, etc. + */ +Timeline.prototype.getEventProperties = function (event) { + var clientX = event.center ? event.center.x : event.clientX; + var clientY = event.center ? event.center.y : event.clientY; + var x; + if (this.options.rtl) { + x = util.getAbsoluteRight(this.dom.centerContainer) - clientX; + } else { + x = clientX - util.getAbsoluteLeft(this.dom.centerContainer); + } + var y = clientY - util.getAbsoluteTop(this.dom.centerContainer); + + var item = this.itemSet.itemFromTarget(event); + var group = this.itemSet.groupFromTarget(event); + var customTime = CustomTime.customTimeFromTarget(event); + + var snap = this.itemSet.options.snap || null; + var scale = this.body.util.getScale(); + var step = this.body.util.getStep(); + var time = this._toTime(x); + var snappedTime = snap ? snap(time, scale, step) : time; + + var element = util.getTarget(event); + var what = null; + if (item != null) { + what = 'item'; + } else if (customTime != null) { + what = 'custom-time'; + } else if (util.hasParent(element, this.timeAxis.dom.foreground)) { + what = 'axis'; + } else if (this.timeAxis2 && util.hasParent(element, this.timeAxis2.dom.foreground)) { + what = 'axis'; + } else if (util.hasParent(element, this.itemSet.dom.labelSet)) { + what = 'group-label'; + } else if (util.hasParent(element, this.currentTime.bar)) { + what = 'current-time'; + } else if (util.hasParent(element, this.dom.center)) { + what = 'background'; + } + + return { + event: event, + item: item ? item.id : null, + group: group ? group.groupId : null, + what: what, + pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX, + pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY, + x: x, + y: y, + time: time, + snappedTime: snappedTime + }; +}; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Toggle Timeline rolling mode + */ - exports.default = function (self, call) { - if (!self) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); +Timeline.prototype.toggleRollingMode = function () { + if (this.range.rolling) { + this.range.stopRolling(); + } else { + if (this.options.rollingMode == undefined) { + this.setOptions(this.options); } + this.range.startRolling(); + } +}; - return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; - }; +module.exports = Timeline; /***/ }), -/* 180 */ +/* 179 */ /***/ (function(module, exports, __webpack_require__) { - "use strict"; +"use strict"; - exports.__esModule = true; - var _setPrototypeOf = __webpack_require__(181); - - var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _create = __webpack_require__(55); +var _stringify = __webpack_require__(19); - var _create2 = _interopRequireDefault(_create); +var _stringify2 = _interopRequireDefault(_stringify); - var _typeof2 = __webpack_require__(62); +var _classCallCheck2 = __webpack_require__(0); - var _typeof3 = _interopRequireDefault(_typeof2); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _createClass2 = __webpack_require__(1); - exports.default = function (subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); - } +var _createClass3 = _interopRequireDefault(_createClass2); - subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { - constructor: { - value: subClass, - enumerable: false, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { +var Hammer = __webpack_require__(10); +var hammerUtil = __webpack_require__(37); +var util = __webpack_require__(2); - module.exports = { "default": __webpack_require__(182), __esModule: true }; +/** + * @param {number} [pixelRatio=1] + */ -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { +var ColorPicker = function () { + /** + * @param {number} [pixelRatio=1] + */ + function ColorPicker() { + var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + (0, _classCallCheck3['default'])(this, ColorPicker); - __webpack_require__(183); - module.exports = __webpack_require__(17).Object.setPrototypeOf; + this.pixelRatio = pixelRatio; + this.generated = false; + this.centerCoordinates = { x: 289 / 2, y: 289 / 2 }; + this.r = 289 * 0.49; + this.color = { r: 255, g: 255, b: 255, a: 1.0 }; + this.hueCircle = undefined; + this.initialColor = { r: 255, g: 255, b: 255, a: 1.0 }; + this.previousColor = undefined; + this.applied = false; -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { + // bound by + this.updateCallback = function () {}; + this.closeCallback = function () {}; - // 19.1.3.19 Object.setPrototypeOf(O, proto) - var $export = __webpack_require__(15); - $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(184).set}); + // create all DOM elements + this._create(); + } -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * this inserts the colorPicker into a div from the DOM + * @param {Element} container + */ - // Works with __proto__ only. Old v8 can't work with null proto objects. - /* eslint-disable no-proto */ - var isObject = __webpack_require__(23) - , anObject = __webpack_require__(22); - var check = function(O, proto){ - anObject(O); - if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); - }; - module.exports = { - set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line - function(test, buggy, set){ - try { - set = __webpack_require__(18)(Function.call, __webpack_require__(78).f(Object.prototype, '__proto__').set, 2); - set(test, []); - buggy = !(test instanceof Array); - } catch(e){ buggy = true; } - return function setPrototypeOf(O, proto){ - check(O, proto); - if(buggy)O.__proto__ = proto; - else set(O, proto); - return O; - }; - }({}, false) : undefined), - check: check - }; -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { + (0, _createClass3['default'])(ColorPicker, [{ + key: 'insertTo', + value: function insertTo(container) { + if (this.hammer !== undefined) { + this.hammer.destroy(); + this.hammer = undefined; + } + this.container = container; + this.container.appendChild(this.frame); + this._bindHammer(); - 'use strict'; + this._setSize(); + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * the callback is executed on apply and save. Bind it to the application + * @param {function} callback + */ - var _typeof2 = __webpack_require__(62); + }, { + key: 'setUpdateCallback', + value: function setUpdateCallback(callback) { + if (typeof callback === 'function') { + this.updateCallback = callback; + } else { + throw new Error("Function attempted to set as colorPicker update callback is not a function."); + } + } - var _typeof3 = _interopRequireDefault(_typeof2); + /** + * the callback is executed on apply and save. Bind it to the application + * @param {function} callback + */ - var _classCallCheck2 = __webpack_require__(135); + }, { + key: 'setCloseCallback', + value: function setCloseCallback(callback) { + if (typeof callback === 'function') { + this.closeCallback = callback; + } else { + throw new Error("Function attempted to set as colorPicker closing callback is not a function."); + } + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + /** + * + * @param {string} color + * @returns {String} + * @private + */ - var _createClass2 = __webpack_require__(136); + }, { + key: '_isColorString', + value: function _isColorString(color) { + var htmlColors = { black: '#000000', navy: '#000080', darkblue: '#00008B', mediumblue: '#0000CD', blue: '#0000FF', darkgreen: '#006400', green: '#008000', teal: '#008080', darkcyan: '#008B8B', deepskyblue: '#00BFFF', darkturquoise: '#00CED1', mediumspringgreen: '#00FA9A', lime: '#00FF00', springgreen: '#00FF7F', aqua: '#00FFFF', cyan: '#00FFFF', midnightblue: '#191970', dodgerblue: '#1E90FF', lightseagreen: '#20B2AA', forestgreen: '#228B22', seagreen: '#2E8B57', darkslategray: '#2F4F4F', limegreen: '#32CD32', mediumseagreen: '#3CB371', turquoise: '#40E0D0', royalblue: '#4169E1', steelblue: '#4682B4', darkslateblue: '#483D8B', mediumturquoise: '#48D1CC', indigo: '#4B0082', darkolivegreen: '#556B2F', cadetblue: '#5F9EA0', cornflowerblue: '#6495ED', mediumaquamarine: '#66CDAA', dimgray: '#696969', slateblue: '#6A5ACD', olivedrab: '#6B8E23', slategray: '#708090', lightslategray: '#778899', mediumslateblue: '#7B68EE', lawngreen: '#7CFC00', chartreuse: '#7FFF00', aquamarine: '#7FFFD4', maroon: '#800000', purple: '#800080', olive: '#808000', gray: '#808080', skyblue: '#87CEEB', lightskyblue: '#87CEFA', blueviolet: '#8A2BE2', darkred: '#8B0000', darkmagenta: '#8B008B', saddlebrown: '#8B4513', darkseagreen: '#8FBC8F', lightgreen: '#90EE90', mediumpurple: '#9370D8', darkviolet: '#9400D3', palegreen: '#98FB98', darkorchid: '#9932CC', yellowgreen: '#9ACD32', sienna: '#A0522D', brown: '#A52A2A', darkgray: '#A9A9A9', lightblue: '#ADD8E6', greenyellow: '#ADFF2F', paleturquoise: '#AFEEEE', lightsteelblue: '#B0C4DE', powderblue: '#B0E0E6', firebrick: '#B22222', darkgoldenrod: '#B8860B', mediumorchid: '#BA55D3', rosybrown: '#BC8F8F', darkkhaki: '#BDB76B', silver: '#C0C0C0', mediumvioletred: '#C71585', indianred: '#CD5C5C', peru: '#CD853F', chocolate: '#D2691E', tan: '#D2B48C', lightgrey: '#D3D3D3', palevioletred: '#D87093', thistle: '#D8BFD8', orchid: '#DA70D6', goldenrod: '#DAA520', crimson: '#DC143C', gainsboro: '#DCDCDC', plum: '#DDA0DD', burlywood: '#DEB887', lightcyan: '#E0FFFF', lavender: '#E6E6FA', darksalmon: '#E9967A', violet: '#EE82EE', palegoldenrod: '#EEE8AA', lightcoral: '#F08080', khaki: '#F0E68C', aliceblue: '#F0F8FF', honeydew: '#F0FFF0', azure: '#F0FFFF', sandybrown: '#F4A460', wheat: '#F5DEB3', beige: '#F5F5DC', whitesmoke: '#F5F5F5', mintcream: '#F5FFFA', ghostwhite: '#F8F8FF', salmon: '#FA8072', antiquewhite: '#FAEBD7', linen: '#FAF0E6', lightgoldenrodyellow: '#FAFAD2', oldlace: '#FDF5E6', red: '#FF0000', fuchsia: '#FF00FF', magenta: '#FF00FF', deeppink: '#FF1493', orangered: '#FF4500', tomato: '#FF6347', hotpink: '#FF69B4', coral: '#FF7F50', darkorange: '#FF8C00', lightsalmon: '#FFA07A', orange: '#FFA500', lightpink: '#FFB6C1', pink: '#FFC0CB', gold: '#FFD700', peachpuff: '#FFDAB9', navajowhite: '#FFDEAD', moccasin: '#FFE4B5', bisque: '#FFE4C4', mistyrose: '#FFE4E1', blanchedalmond: '#FFEBCD', papayawhip: '#FFEFD5', lavenderblush: '#FFF0F5', seashell: '#FFF5EE', cornsilk: '#FFF8DC', lemonchiffon: '#FFFACD', floralwhite: '#FFFAF0', snow: '#FFFAFA', yellow: '#FFFF00', lightyellow: '#FFFFE0', ivory: '#FFFFF0', white: '#FFFFFF' }; + if (typeof color === 'string') { + return htmlColors[color]; + } + } - var _createClass3 = _interopRequireDefault(_createClass2); + /** + * Set the color of the colorPicker + * Supported formats: + * 'red' --> HTML color string + * '#ffffff' --> hex string + * 'rbg(255,255,255)' --> rgb string + * 'rgba(255,255,255,1.0)' --> rgba string + * {r:255,g:255,b:255} --> rgb object + * {r:255,g:255,b:255,a:1.0} --> rgba object + * @param {string|Object} color + * @param {boolean} [setInitial=true] + */ - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + }, { + key: 'setColor', + value: function setColor(color) { + var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var NodeBase = function () { - function NodeBase(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, NodeBase); + if (color === 'none') { + return; + } - this.body = body; - this.labelModule = labelModule; - this.setOptions(options); - this.top = undefined; - this.left = undefined; - this.height = undefined; - this.width = undefined; - this.radius = undefined; - this.margin = undefined; - this.refreshNeeded = true; - this.boundingBox = { top: 0, left: 0, right: 0, bottom: 0 }; - } + var rgba = void 0; - (0, _createClass3['default'])(NodeBase, [{ - key: 'setOptions', - value: function setOptions(options) { - this.options = options; - } - }, { - key: '_setMargins', - value: function _setMargins(labelModule) { - this.margin = {}; - if (this.options.margin) { - if ((0, _typeof3['default'])(this.options.margin) == 'object') { - this.margin.top = this.options.margin.top; - this.margin.right = this.options.margin.right; - this.margin.bottom = this.options.margin.bottom; - this.margin.left = this.options.margin.left; - } else { - this.margin.top = this.options.margin; - this.margin.right = this.options.margin; - this.margin.bottom = this.options.margin; - this.margin.left = this.options.margin; - } - } - labelModule.adjustSizes(this.margin); - } - }, { - key: '_distanceToBorder', - value: function _distanceToBorder(ctx, angle) { - var borderWidth = this.options.borderWidth; - this.resize(ctx); - return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; - } - }, { - key: 'enableShadow', - value: function enableShadow(ctx, values) { - if (values.shadow) { - ctx.shadowColor = values.shadowColor; - ctx.shadowBlur = values.shadowSize; - ctx.shadowOffsetX = values.shadowX; - ctx.shadowOffsetY = values.shadowY; - } + // if a html color shorthand is used, convert to hex + var htmlColor = this._isColorString(color); + if (htmlColor !== undefined) { + color = htmlColor; } - }, { - key: 'disableShadow', - value: function disableShadow(ctx, values) { - if (values.shadow) { - ctx.shadowColor = 'rgba(0,0,0,0)'; - ctx.shadowBlur = 0; - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - } - } - }, { - key: 'enableBorderDashes', - value: function enableBorderDashes(ctx, values) { - if (values.borderDashes !== false) { - if (ctx.setLineDash !== undefined) { - var dashes = values.borderDashes; - if (dashes === true) { - dashes = [5, 15]; - } - ctx.setLineDash(dashes); - } else { - console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); - this.options.shapeProperties.borderDashes = false; - values.borderDashes = false; - } + + // check format + if (util.isString(color) === true) { + if (util.isValidRGB(color) === true) { + var rgbaArray = color.substr(4).substr(0, color.length - 5).split(','); + rgba = { r: rgbaArray[0], g: rgbaArray[1], b: rgbaArray[2], a: 1.0 }; + } else if (util.isValidRGBA(color) === true) { + var _rgbaArray = color.substr(5).substr(0, color.length - 6).split(','); + rgba = { r: _rgbaArray[0], g: _rgbaArray[1], b: _rgbaArray[2], a: _rgbaArray[3] }; + } else if (util.isValidHex(color) === true) { + var rgbObj = util.hexToRGB(color); + rgba = { r: rgbObj.r, g: rgbObj.g, b: rgbObj.b, a: 1.0 }; } - } - }, { - key: 'disableBorderDashes', - value: function disableBorderDashes(ctx, values) { - if (values.borderDashes !== false) { - if (ctx.setLineDash !== undefined) { - ctx.setLineDash([0]); - } else { - console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); - this.options.shapeProperties.borderDashes = false; - values.borderDashes = false; + } else { + if (color instanceof Object) { + if (color.r !== undefined && color.g !== undefined && color.b !== undefined) { + var alpha = color.a !== undefined ? color.a : '1.0'; + rgba = { r: color.r, g: color.g, b: color.b, a: alpha }; } } } - /** - * Determine if the shape of a node needs to be recalculated. - * - * @protected - */ - - }, { - key: 'needsRefresh', - value: function needsRefresh(selected, hover) { - if (this.refreshNeeded === true) { - // This is probably not the best location to reset this member. - // However, in the current logic, it is the most convenient one. - this.refreshNeeded = false; - return true; - } - - return this.width === undefined || this.labelModule.differentState(selected, hover); + // set color + if (rgba === undefined) { + throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + (0, _stringify2['default'])(color)); + } else { + this._setColor(rgba, setInitial); } - }, { - key: 'initContextForDraw', - value: function initContextForDraw(ctx, values) { - var borderWidth = values.borderWidth / this.body.view.scale; + } - ctx.lineWidth = Math.min(this.width, borderWidth); - ctx.strokeStyle = values.borderColor; - ctx.fillStyle = values.color; - } - }, { - key: 'performStroke', - value: function performStroke(ctx, values) { - var borderWidth = values.borderWidth / this.body.view.scale; + /** + * this shows the color picker. + * The hue circle is constructed once and stored. + */ - //draw dashed border if enabled, save and restore is required for firefox not to crash on unix. - ctx.save(); - // if borders are zero width, they will be drawn with width 1 by default. This prevents that - if (borderWidth > 0) { - this.enableBorderDashes(ctx, values); - //draw the border - ctx.stroke(); - //disable dashed border for other elements - this.disableBorderDashes(ctx, values); - } - ctx.restore(); + }, { + key: 'show', + value: function show() { + if (this.closeCallback !== undefined) { + this.closeCallback(); + this.closeCallback = undefined; } - }, { - key: 'performFill', - value: function performFill(ctx, values) { - // draw shadow if enabled - this.enableShadow(ctx, values); - // draw the background - ctx.fill(); - // disable shadows for other elements. - this.disableShadow(ctx, values); - this.performStroke(ctx, values); - } - }, { - key: '_addBoundingBoxMargin', - value: function _addBoundingBoxMargin(margin) { - this.boundingBox.left -= margin; - this.boundingBox.top -= margin; - this.boundingBox.bottom += margin; - this.boundingBox.right += margin; - } + this.applied = false; + this.frame.style.display = 'block'; + this._generateHueCircle(); + } - /** - * Actual implementation of this method call. - * - * Doing it like this makes it easier to override - * in the child classes. - */ + // ------------------------------------------ PRIVATE ----------------------------- // - }, { - key: '_updateBoundingBox', - value: function _updateBoundingBox(x, y, ctx, selected, hover) { - if (ctx !== undefined) { - this.resize(ctx, selected, hover); - } + /** + * Hide the picker. Is called by the cancel button. + * Optional boolean to store the previous color for easy access later on. + * @param {boolean} [storePrevious=true] + * @private + */ - this.left = x - this.width / 2; - this.top = y - this.height / 2; + }, { + key: '_hide', + value: function _hide() { + var _this = this; - this.boundingBox.left = this.left; - this.boundingBox.top = this.top; - this.boundingBox.bottom = this.top + this.height; - this.boundingBox.right = this.left + this.width; - } + var storePrevious = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - /** - * Default implementation of this method call. - * - * This acts as a stub which can be overridden. - */ + // store the previous color for next time; + if (storePrevious === true) { + this.previousColor = util.extend({}, this.color); + } - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y, ctx, selected, hover) { - this._updateBoundingBox(x, y, ctx, selected, hover); + if (this.applied === true) { + this.updateCallback(this.initialColor); } - }]); - return NodeBase; - }(); - exports['default'] = NodeBase; + this.frame.style.display = 'none'; -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _getPrototypeOf = __webpack_require__(176); - - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + // call the closing callback, restoring the onclick method. + // this is in a setTimeout because it will trigger the show again before the click is done. + setTimeout(function () { + if (_this.closeCallback !== undefined) { + _this.closeCallback(); + _this.closeCallback = undefined; + } + }, 0); + } - var _classCallCheck2 = __webpack_require__(135); + /** + * bound to the save button. Saves and hides. + * @private + */ - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + }, { + key: '_save', + value: function _save() { + this.updateCallback(this.color); + this.applied = false; + this._hide(); + } - var _createClass2 = __webpack_require__(136); + /** + * Bound to apply button. Saves but does not close. Is undone by the cancel button. + * @private + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: '_apply', + value: function _apply() { + this.applied = true; + this.updateCallback(this.color); + this._updatePicker(this.color); + } - var _possibleConstructorReturn2 = __webpack_require__(179); + /** + * load the color from the previous session. + * @private + */ - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + }, { + key: '_loadLast', + value: function _loadLast() { + if (this.previousColor !== undefined) { + this.setColor(this.previousColor, false); + } else { + alert("There is no last color to load..."); + } + } - var _inherits2 = __webpack_require__(180); + /** + * set the color, place the picker + * @param {Object} rgba + * @param {boolean} [setInitial=true] + * @private + */ - var _inherits3 = _interopRequireDefault(_inherits2); + }, { + key: '_setColor', + value: function _setColor(rgba) { + var setInitial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var _CircleImageBase2 = __webpack_require__(187); + // store the initial color + if (setInitial === true) { + this.initialColor = util.extend({}, rgba); + } - var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2); + this.color = rgba; + var hsv = util.RGBToHSV(rgba.r, rgba.g, rgba.b); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var angleConvert = 2 * Math.PI; + var radius = this.r * hsv.s; + var x = this.centerCoordinates.x + radius * Math.sin(angleConvert * hsv.h); + var y = this.centerCoordinates.y + radius * Math.cos(angleConvert * hsv.h); - var Circle = function (_CircleImageBase) { - (0, _inherits3['default'])(Circle, _CircleImageBase); + this.colorPickerSelector.style.left = x - 0.5 * this.colorPickerSelector.clientWidth + 'px'; + this.colorPickerSelector.style.top = y - 0.5 * this.colorPickerSelector.clientHeight + 'px'; - function Circle(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Circle); + this._updatePicker(rgba); + } - var _this = (0, _possibleConstructorReturn3['default'])(this, (Circle.__proto__ || (0, _getPrototypeOf2['default'])(Circle)).call(this, options, body, labelModule)); + /** + * bound to opacity control + * @param {number} value + * @private + */ - _this._setMargins(labelModule); - return _this; + }, { + key: '_setOpacity', + value: function _setOpacity(value) { + this.color.a = value / 100; + this._updatePicker(this.color); } - (0, _createClass3['default'])(Circle, [{ - key: 'resize', - value: function resize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; + /** + * bound to brightness control + * @param {number} value + * @private + */ - if (this.needsRefresh(selected, hover)) { - this.textSize = this.labelModule.getTextSize(ctx, selected, hover); - var diameter = Math.max(this.textSize.width + this.margin.right + this.margin.left, this.textSize.height + this.margin.top + this.margin.bottom); - this.options.size = diameter / 2; + }, { + key: '_setBrightness', + value: function _setBrightness(value) { + var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b); + hsv.v = value / 100; + var rgba = util.HSVToRGB(hsv.h, hsv.s, hsv.v); + rgba['a'] = this.color.a; + this.color = rgba; + this._updatePicker(); + } - this.width = diameter; - this.height = diameter; - this.radius = this.width / 2; - } - } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.resize(ctx, selected, hover); - this.left = x - this.width / 2; - this.top = y - this.height / 2; + /** + * update the color picker. A black circle overlays the hue circle to mimic the brightness decreasing. + * @param {Object} rgba + * @private + */ - this._drawRawCircle(ctx, x, y, values); + }, { + key: '_updatePicker', + value: function _updatePicker() { + var rgba = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.color; - this.updateBoundingBox(x, y); - this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, y, selected, hover); - } - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y) { - this.boundingBox.top = y - this.options.size; - this.boundingBox.left = x - this.options.size; - this.boundingBox.right = x + this.options.size; - this.boundingBox.bottom = y + this.options.size; - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - this.resize(ctx); - return this.width * 0.5; + var hsv = util.RGBToHSV(rgba.r, rgba.g, rgba.b); + var ctx = this.colorPickerCanvas.getContext('2d'); + if (this.pixelRation === undefined) { + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); } - }]); - return Circle; - }(_CircleImageBase3['default']); + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); - exports['default'] = Circle; + // clear the canvas + var w = this.colorPickerCanvas.clientWidth; + var h = this.colorPickerCanvas.clientHeight; + ctx.clearRect(0, 0, w, h); -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { + ctx.putImageData(this.hueCircle, 0, 0); + ctx.fillStyle = 'rgba(0,0,0,' + (1 - hsv.v) + ')'; + ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); + ctx.fill(); - 'use strict'; + this.brightnessRange.value = 100 * hsv.v; + this.opacityRange.value = 100 * rgba.a; - Object.defineProperty(exports, "__esModule", { - value: true - }); + this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; + this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; + } - var _getPrototypeOf = __webpack_require__(176); + /** + * used by create to set the size of the canvas. + * @private + */ - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + }, { + key: '_setSize', + value: function _setSize() { + this.colorPickerCanvas.style.width = '100%'; + this.colorPickerCanvas.style.height = '100%'; - var _classCallCheck2 = __webpack_require__(135); + this.colorPickerCanvas.width = 289 * this.pixelRatio; + this.colorPickerCanvas.height = 289 * this.pixelRatio; + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + /** + * create all dom elements + * TODO: cleanup, lots of similar dom elements + * @private + */ - var _createClass2 = __webpack_require__(136); + }, { + key: '_create', + value: function _create() { + this.frame = document.createElement('div'); + this.frame.className = 'vis-color-picker'; + + this.colorPickerDiv = document.createElement('div'); + this.colorPickerSelector = document.createElement('div'); + this.colorPickerSelector.className = 'vis-selector'; + this.colorPickerDiv.appendChild(this.colorPickerSelector); + + this.colorPickerCanvas = document.createElement('canvas'); + this.colorPickerDiv.appendChild(this.colorPickerCanvas); + + if (!this.colorPickerCanvas.getContext) { + var noCanvas = document.createElement('DIV'); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold'; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.colorPickerCanvas.appendChild(noCanvas); + } else { + var ctx = this.colorPickerCanvas.getContext("2d"); + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); - var _createClass3 = _interopRequireDefault(_createClass2); + this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + } - var _possibleConstructorReturn2 = __webpack_require__(179); + this.colorPickerDiv.className = 'vis-color'; - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + this.opacityDiv = document.createElement('div'); + this.opacityDiv.className = 'vis-opacity'; - var _inherits2 = __webpack_require__(180); + this.brightnessDiv = document.createElement('div'); + this.brightnessDiv.className = 'vis-brightness'; - var _inherits3 = _interopRequireDefault(_inherits2); + this.arrowDiv = document.createElement('div'); + this.arrowDiv.className = 'vis-arrow'; - var _NodeBase2 = __webpack_require__(185); + this.opacityRange = document.createElement('input'); + try { + this.opacityRange.type = 'range'; // Not supported on IE9 + this.opacityRange.min = '0'; + this.opacityRange.max = '100'; + } + // TODO: Add some error handling and remove this lint exception + catch (err) {} // eslint-disable-line no-empty + this.opacityRange.value = '100'; + this.opacityRange.className = 'vis-range'; - var _NodeBase3 = _interopRequireDefault(_NodeBase2); + this.brightnessRange = document.createElement('input'); + try { + this.brightnessRange.type = 'range'; // Not supported on IE9 + this.brightnessRange.min = '0'; + this.brightnessRange.max = '100'; + } + // TODO: Add some error handling and remove this lint exception + catch (err) {} // eslint-disable-line no-empty + this.brightnessRange.value = '100'; + this.brightnessRange.className = 'vis-range'; - var _CachedImage = __webpack_require__(166); + this.opacityDiv.appendChild(this.opacityRange); + this.brightnessDiv.appendChild(this.brightnessRange); - var _CachedImage2 = _interopRequireDefault(_CachedImage); + var me = this; + this.opacityRange.onchange = function () { + me._setOpacity(this.value); + }; + this.opacityRange.oninput = function () { + me._setOpacity(this.value); + }; + this.brightnessRange.onchange = function () { + me._setBrightness(this.value); + }; + this.brightnessRange.oninput = function () { + me._setBrightness(this.value); + }; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + this.brightnessLabel = document.createElement("div"); + this.brightnessLabel.className = "vis-label vis-brightness"; + this.brightnessLabel.innerHTML = 'brightness:'; + + this.opacityLabel = document.createElement("div"); + this.opacityLabel.className = "vis-label vis-opacity"; + this.opacityLabel.innerHTML = 'opacity:'; + + this.newColorDiv = document.createElement("div"); + this.newColorDiv.className = "vis-new-color"; + this.newColorDiv.innerHTML = 'new'; + + this.initialColorDiv = document.createElement("div"); + this.initialColorDiv.className = "vis-initial-color"; + this.initialColorDiv.innerHTML = 'initial'; + + this.cancelButton = document.createElement("div"); + this.cancelButton.className = "vis-button vis-cancel"; + this.cancelButton.innerHTML = 'cancel'; + this.cancelButton.onclick = this._hide.bind(this, false); + + this.applyButton = document.createElement("div"); + this.applyButton.className = "vis-button vis-apply"; + this.applyButton.innerHTML = 'apply'; + this.applyButton.onclick = this._apply.bind(this); + + this.saveButton = document.createElement("div"); + this.saveButton.className = "vis-button vis-save"; + this.saveButton.innerHTML = 'save'; + this.saveButton.onclick = this._save.bind(this); + + this.loadButton = document.createElement("div"); + this.loadButton.className = "vis-button vis-load"; + this.loadButton.innerHTML = 'load last'; + this.loadButton.onclick = this._loadLast.bind(this); + + this.frame.appendChild(this.colorPickerDiv); + this.frame.appendChild(this.arrowDiv); + this.frame.appendChild(this.brightnessLabel); + this.frame.appendChild(this.brightnessDiv); + this.frame.appendChild(this.opacityLabel); + this.frame.appendChild(this.opacityDiv); + this.frame.appendChild(this.newColorDiv); + this.frame.appendChild(this.initialColorDiv); + + this.frame.appendChild(this.cancelButton); + this.frame.appendChild(this.applyButton); + this.frame.appendChild(this.saveButton); + this.frame.appendChild(this.loadButton); + } - /** - * NOTE: This is a bad base class - * - * Child classes are: - * - * Image - uses *only* image methods - * Circle - uses *only* _drawRawCircle - * CircleImage - uses all - * - * TODO: Refactor, move _drawRawCircle to different module, derive Circle from NodeBase - * Rename this to ImageBase - * Consolidate common code in Image and CircleImage to base class - */ - var CircleImageBase = function (_NodeBase) { - (0, _inherits3['default'])(CircleImageBase, _NodeBase); + /** + * bind hammer to the color picker + * @private + */ - function CircleImageBase(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, CircleImageBase); + }, { + key: '_bindHammer', + value: function _bindHammer() { + var _this2 = this; - var _this = (0, _possibleConstructorReturn3['default'])(this, (CircleImageBase.__proto__ || (0, _getPrototypeOf2['default'])(CircleImageBase)).call(this, options, body, labelModule)); + this.drag = {}; + this.pinch = {}; + this.hammer = new Hammer(this.colorPickerCanvas); + this.hammer.get('pinch').set({ enable: true }); - _this.labelOffset = 0; - _this.selected = false; - return _this; + hammerUtil.onTouch(this.hammer, function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('tap', function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('panstart', function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('panmove', function (event) { + _this2._moveSelector(event); + }); + this.hammer.on('panend', function (event) { + _this2._moveSelector(event); + }); } - (0, _createClass3['default'])(CircleImageBase, [{ - key: 'setOptions', - value: function setOptions(options, imageObj, imageObjAlt) { - this.options = options; + /** + * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown. + * @private + */ - if (!(imageObj === undefined && imageObjAlt === undefined)) { - this.setImages(imageObj, imageObjAlt); + }, { + key: '_generateHueCircle', + value: function _generateHueCircle() { + if (this.generated === false) { + var ctx = this.colorPickerCanvas.getContext('2d'); + if (this.pixelRation === undefined) { + this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); } - } + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); - /** - * Set the images for this node. - * - * The images can be updated after the initial setting of options; - * therefore, this method needs to be reentrant. - * - * For correct working in error cases, it is necessary to properly set - * field 'nodes.brokenImage' in the options. - * - * @param {Image} imageObj required; main image to show for this node - * @param {Image|undefined} optional; image to show when node is selected - */ + // clear the canvas + var w = this.colorPickerCanvas.clientWidth; + var h = this.colorPickerCanvas.clientHeight; + ctx.clearRect(0, 0, w, h); - }, { - key: 'setImages', - value: function setImages(imageObj, imageObjAlt) { - if (imageObjAlt && this.selected) { - this.imageObj = imageObjAlt; - this.imageObjAlt = imageObj; - } else { - this.imageObj = imageObj; - this.imageObjAlt = imageObjAlt; - } + // draw hue circle + var x = void 0, + y = void 0, + hue = void 0, + sat = void 0; + this.centerCoordinates = { x: w * 0.5, y: h * 0.5 }; + this.r = 0.49 * w; + var angleConvert = 2 * Math.PI / 360; + var hfac = 1 / 360; + var sfac = 1 / this.r; + var rgb = void 0; + for (hue = 0; hue < 360; hue++) { + for (sat = 0; sat < this.r; sat++) { + x = this.centerCoordinates.x + sat * Math.sin(angleConvert * hue); + y = this.centerCoordinates.y + sat * Math.cos(angleConvert * hue); + rgb = util.HSVToRGB(hue * hfac, sat * sfac, 1); + ctx.fillStyle = 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')'; + ctx.fillRect(x - 0.5, y - 0.5, 2, 2); + } + } + ctx.strokeStyle = 'rgba(0,0,0,1)'; + ctx.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r); + ctx.stroke(); + + this.hueCircle = ctx.getImageData(0, 0, w, h); } + this.generated = true; + } - /** - * Set selection and switch between the base and the selected image. - * - * Do the switch only if imageObjAlt exists. - * - * @param {true|false} selected value of new selected state for current node - */ + /** + * move the selector. This is called by hammer functions. + * + * @param {Event} event The event + * @private + */ - }, { - key: 'switchImages', - value: function switchImages(selected) { - var selection_changed = selected && !this.selected || !selected && this.selected; - this.selected = selected; // Remember new selection + }, { + key: '_moveSelector', + value: function _moveSelector(event) { + var rect = this.colorPickerDiv.getBoundingClientRect(); + var left = event.center.x - rect.left; + var top = event.center.y - rect.top; - if (this.imageObjAlt !== undefined && selection_changed) { - var imageTmp = this.imageObj; - this.imageObj = this.imageObjAlt; - this.imageObjAlt = imageTmp; - } - } + var centerY = 0.5 * this.colorPickerDiv.clientHeight; + var centerX = 0.5 * this.colorPickerDiv.clientWidth; - /** - * Adjust the node dimensions for a loaded image. - * - * Pre: this.imageObj is valid - */ + var x = left - centerX; + var y = top - centerY; - }, { - key: '_resizeImage', - value: function _resizeImage() { - var width, height; - - if (this.options.shapeProperties.useImageSize === false) { - // Use the size property - var ratio_width = 1; - var ratio_height = 1; - - // Only calculate the proper ratio if both width and height not zero - if (this.imageObj.width && this.imageObj.height) { - if (this.imageObj.width > this.imageObj.height) { - ratio_width = this.imageObj.width / this.imageObj.height; - } else { - ratio_height = this.imageObj.height / this.imageObj.width; - } - } + var angle = Math.atan2(x, y); + var radius = 0.98 * Math.min(Math.sqrt(x * x + y * y), centerX); - width = this.options.size * 2 * ratio_width; - height = this.options.size * 2 * ratio_height; - } else { - // Use the image size - width = this.imageObj.width; - height = this.imageObj.height; - } + var newTop = Math.cos(angle) * radius + centerY; + var newLeft = Math.sin(angle) * radius + centerX; - this.width = width; - this.height = height; - this.radius = 0.5 * this.width; - } - }, { - key: '_drawRawCircle', - value: function _drawRawCircle(ctx, x, y, values) { - this.initContextForDraw(ctx, values); - ctx.circle(x, y, values.size); - this.performFill(ctx, values); - } - }, { - key: '_drawImageAtPosition', - value: function _drawImageAtPosition(ctx, values) { - if (this.imageObj.width != 0) { - // draw the image - ctx.globalAlpha = 1.0; + this.colorPickerSelector.style.top = newTop - 0.5 * this.colorPickerSelector.clientHeight + 'px'; + this.colorPickerSelector.style.left = newLeft - 0.5 * this.colorPickerSelector.clientWidth + 'px'; - // draw shadow if enabled - this.enableShadow(ctx, values); + // set color + var h = angle / (2 * Math.PI); + h = h < 0 ? h + 1 : h; + var s = radius / this.r; + var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b); + hsv.h = h; + hsv.s = s; + var rgba = util.HSVToRGB(hsv.h, hsv.s, hsv.v); + rgba['a'] = this.color.a; + this.color = rgba; - var factor = 1; - if (this.options.shapeProperties.interpolation === true) { - factor = this.imageObj.width / this.width / this.body.view.scale; - } + // update previews + this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; + this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; + } + }]); + return ColorPicker; +}(); - this.imageObj.drawImageAtPosition(ctx, factor, this.left, this.top, this.width, this.height); +exports['default'] = ColorPicker; - // disable shadows for other elements. - this.disableShadow(ctx, values); - } - } - }, { - key: '_drawImageLabel', - value: function _drawImageLabel(ctx, x, y, selected, hover) { - var yLabel; - var offset = 0; +/***/ }), +/* 180 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.height !== undefined) { - offset = this.height * 0.5; - var labelDimensions = this.labelModule.getTextSize(ctx, selected, hover); - if (labelDimensions.lineCount >= 1) { - offset += labelDimensions.height / 2; - } - } +"use strict"; - yLabel = y + offset; - if (this.options.label) { - this.labelOffset = offset; - } - this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging'); - } - }]); - return CircleImageBase; - }(_NodeBase3['default']); +var moment = __webpack_require__(9); +var util = __webpack_require__(2); +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var Range = __webpack_require__(64); +var Core = __webpack_require__(65); +var TimeAxis = __webpack_require__(45); +var CurrentTime = __webpack_require__(67); +var CustomTime = __webpack_require__(46); +var LineGraph = __webpack_require__(106); - exports['default'] = CircleImageBase; +var printStyle = __webpack_require__(15).printStyle; +var allOptions = __webpack_require__(113).allOptions; +var configureOptions = __webpack_require__(113).configureOptions; -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { +var Configurator = __webpack_require__(71)['default']; +var Validator = __webpack_require__(15)['default']; - 'use strict'; +/** + * Create a timeline visualization + * @param {HTMLElement} container + * @param {vis.DataSet | Array} [items] + * @param {vis.DataSet | Array | vis.DataView | Object} [groups] + * @param {Object} [options] See Graph2d.setOptions for the available options. + * @constructor Graph2d + * @extends Core + */ +function Graph2d(container, items, groups, options) { + // if the third element is options, the forth is groups (optionally); + if (!(Array.isArray(groups) || groups instanceof DataSet || groups instanceof DataView) && groups instanceof Object) { + var forthArgument = options; + options = groups; + groups = forthArgument; + } + + // TODO: REMOVE THIS in the next MAJOR release + // see https://github.com/almende/vis/issues/2511 + if (options && options.throttleRedraw) { + console.warn("Graph2d option \"throttleRedraw\" is DEPRICATED and no longer supported. It will be removed in the next MAJOR release."); + } + + var me = this; + this.defaultOptions = { + start: null, + end: null, + + autoResize: true, - Object.defineProperty(exports, "__esModule", { - value: true - }); + orientation: { + axis: 'bottom', // axis orientation: 'bottom', 'top', or 'both' + item: 'bottom' // not relevant for Graph2d + }, - var _getPrototypeOf = __webpack_require__(176); + moment: moment, - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + width: null, + height: null, + maxHeight: null, + minHeight: null + }; + this.options = util.deepExtend({}, this.defaultOptions); - var _classCallCheck2 = __webpack_require__(135); + // Create the DOM, props, and emitter + this._create(container); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // all components listed here will be repainted automatically + this.components = []; - var _createClass2 = __webpack_require__(136); + this.body = { + dom: this.dom, + domProps: this.props, + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this) + }, + hiddenDates: [], + util: { + toScreen: me._toScreen.bind(me), + toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width + toTime: me._toTime.bind(me), + toGlobalTime: me._toGlobalTime.bind(me) + } + }; - var _createClass3 = _interopRequireDefault(_createClass2); + // range + this.range = new Range(this.body); + this.components.push(this.range); + this.body.range = this.range; - var _possibleConstructorReturn2 = __webpack_require__(179); + // time axis + this.timeAxis = new TimeAxis(this.body); + this.components.push(this.timeAxis); + //this.body.util.snap = this.timeAxis.snap.bind(this.timeAxis); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + // current time bar + this.currentTime = new CurrentTime(this.body); + this.components.push(this.currentTime); - var _inherits2 = __webpack_require__(180); + // item set + this.linegraph = new LineGraph(this.body); - var _inherits3 = _interopRequireDefault(_inherits2); + this.components.push(this.linegraph); - var _CircleImageBase2 = __webpack_require__(187); + this.itemsData = null; // DataSet + this.groupsData = null; // DataSet - var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + this.on('tap', function (event) { + me.emit('click', me.getEventProperties(event)); + }); + this.on('doubletap', function (event) { + me.emit('doubleClick', me.getEventProperties(event)); + }); + this.dom.root.oncontextmenu = function (event) { + me.emit('contextmenu', me.getEventProperties(event)); + }; - var CircularImage = function (_CircleImageBase) { - (0, _inherits3['default'])(CircularImage, _CircleImageBase); + // apply options + if (options) { + this.setOptions(options); + } - function CircularImage(options, body, labelModule, imageObj, imageObjAlt) { - (0, _classCallCheck3['default'])(this, CircularImage); + // IMPORTANT: THIS HAPPENS BEFORE SET ITEMS! + if (groups) { + this.setGroups(groups); + } - var _this = (0, _possibleConstructorReturn3['default'])(this, (CircularImage.__proto__ || (0, _getPrototypeOf2['default'])(CircularImage)).call(this, options, body, labelModule)); + // create itemset + if (items) { + this.setItems(items); + } - _this.setImages(imageObj, imageObjAlt); - return _this; - } + // draw for the first time + this._redraw(); +} - (0, _createClass3['default'])(CircularImage, [{ - key: 'resize', - value: function resize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; +// Extend the functionality from Core +Graph2d.prototype = new Core(); - var imageAbsent = this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined; +Graph2d.prototype.setOptions = function (options) { + // validate options + var errorFound = Validator.validate(options, allOptions); + if (errorFound === true) { + console.log('%cErrors have been found in the supplied options object.', printStyle); + } - if (imageAbsent) { - var diameter = this.options.size * 2; - this.width = diameter; - this.height = diameter; - this.radius = 0.5 * this.width; - return; - } + Core.prototype.setOptions.call(this, options); +}; - // At this point, an image is present, i.e. this.imageObj is valid. - if (this.needsRefresh(selected, hover)) { - this._resizeImage(); - } +/** + * Set items + * @param {vis.DataSet | Array | null} items + */ +Graph2d.prototype.setItems = function (items) { + var initialLoad = this.itemsData == null; + + // convert to type DataSet when needed + var newDataSet; + if (!items) { + newDataSet = null; + } else if (items instanceof DataSet || items instanceof DataView) { + newDataSet = items; + } else { + // turn an array into a dataset + newDataSet = new DataSet(items, { + type: { + start: 'Date', + end: 'Date' } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.switchImages(selected); - this.resize(); - this.left = x - this.width / 2; - this.top = y - this.height / 2; + }); + } - // draw the background circle. IMPORTANT: the stroke in this method is used by the clip method below. - this._drawRawCircle(ctx, x, y, values); + // set items + this.itemsData = newDataSet; + this.linegraph && this.linegraph.setItems(newDataSet); - // now we draw in the circle, we save so we can revert the clip operation after drawing. - ctx.save(); - // clip is used to use the stroke in drawRawCircle as an area that we can draw in. - ctx.clip(); - // draw the image - this._drawImageAtPosition(ctx, values); - // restore so we can again draw on the full canvas - ctx.restore(); + if (initialLoad) { + if (this.options.start != undefined || this.options.end != undefined) { + var start = this.options.start != undefined ? this.options.start : null; + var end = this.options.end != undefined ? this.options.end : null; + this.setWindow(start, end, { animation: false }); + } else { + this.fit({ animation: false }); + } + } +}; - this._drawImageLabel(ctx, x, y, selected, hover); +/** + * Set groups + * @param {vis.DataSet | Array} groups + */ +Graph2d.prototype.setGroups = function (groups) { + // convert to type DataSet when needed + var newDataSet; + if (!groups) { + newDataSet = null; + } else if (groups instanceof DataSet || groups instanceof DataView) { + newDataSet = groups; + } else { + // turn an array into a dataset + newDataSet = new DataSet(groups); + } - this.updateBoundingBox(x, y); - } + this.groupsData = newDataSet; + this.linegraph.setGroups(newDataSet); +}; - // TODO: compare with Circle.updateBoundingBox(), consolidate? More stuff is happening here +/** + * Returns an object containing an SVG element with the icon of the group (size determined by iconWidth and iconHeight), the label of the group (content) and the yAxisOrientation of the group (left or right). + * @param {vis.GraphGroup.id} groupId + * @param {number} width + * @param {number} height + * @returns {{icon: SVGElement, label: string, orientation: string}|string} + */ +Graph2d.prototype.getLegend = function (groupId, width, height) { + if (width === undefined) { + width = 15; + } + if (height === undefined) { + height = 15; + } + if (this.linegraph.groups[groupId] !== undefined) { + return this.linegraph.groups[groupId].getLegend(width, height); + } else { + return "cannot find group:'" + groupId + "'"; + } +}; - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y) { - this.boundingBox.top = y - this.options.size; - this.boundingBox.left = x - this.options.size; - this.boundingBox.right = x + this.options.size; - this.boundingBox.bottom = y + this.options.size; - - // TODO: compare with Image.updateBoundingBox(), consolidate? - this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); - this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); - this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - this.resize(ctx); - return this.width * 0.5; - } - }]); - return CircularImage; - }(_CircleImageBase3['default']); +/** + * This checks if the visible option of the supplied group (by ID) is true or false. + * @param {vis.GraphGroup.id} groupId + * @returns {boolean} + */ +Graph2d.prototype.isGroupVisible = function (groupId) { + if (this.linegraph.groups[groupId] !== undefined) { + return this.linegraph.groups[groupId].visible && (this.linegraph.options.groups.visibility[groupId] === undefined || this.linegraph.options.groups.visibility[groupId] == true); + } else { + return false; + } +}; - exports['default'] = CircularImage; +/** + * Get the data range of the item set. + * @returns {{min: Date, max: Date}} range A range with a start and end Date. + * When no minimum is found, min==null + * When no maximum is found, max==null + */ +Graph2d.prototype.getDataRange = function () { + var min = null; + var max = null; -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { + // calculate min from start filed + for (var groupId in this.linegraph.groups) { + if (this.linegraph.groups.hasOwnProperty(groupId)) { + if (this.linegraph.groups[groupId].visible == true) { + for (var i = 0; i < this.linegraph.groups[groupId].itemsData.length; i++) { + var item = this.linegraph.groups[groupId].itemsData[i]; + var value = util.convert(item.x, 'Date').valueOf(); + min = min == null ? value : min > value ? value : min; + max = max == null ? value : max < value ? value : max; + } + } + } + } - 'use strict'; + return { + min: min != null ? new Date(min) : null, + max: max != null ? new Date(max) : null + }; +}; - Object.defineProperty(exports, "__esModule", { - value: true - }); +/** + * Generate Timeline related information from an event + * @param {Event} event + * @return {Object} An object with related information, like on which area + * The event happened, whether clicked on an item, etc. + */ +Graph2d.prototype.getEventProperties = function (event) { + var clientX = event.center ? event.center.x : event.clientX; + var clientY = event.center ? event.center.y : event.clientY; + var x = clientX - util.getAbsoluteLeft(this.dom.centerContainer); + var y = clientY - util.getAbsoluteTop(this.dom.centerContainer); + var time = this._toTime(x); + + var customTime = CustomTime.customTimeFromTarget(event); + + var element = util.getTarget(event); + var what = null; + if (util.hasParent(element, this.timeAxis.dom.foreground)) { + what = 'axis'; + } else if (this.timeAxis2 && util.hasParent(element, this.timeAxis2.dom.foreground)) { + what = 'axis'; + } else if (util.hasParent(element, this.linegraph.yAxisLeft.dom.frame)) { + what = 'data-axis'; + } else if (util.hasParent(element, this.linegraph.yAxisRight.dom.frame)) { + what = 'data-axis'; + } else if (util.hasParent(element, this.linegraph.legendLeft.dom.frame)) { + what = 'legend'; + } else if (util.hasParent(element, this.linegraph.legendRight.dom.frame)) { + what = 'legend'; + } else if (customTime != null) { + what = 'custom-time'; + } else if (util.hasParent(element, this.currentTime.bar)) { + what = 'current-time'; + } else if (util.hasParent(element, this.dom.center)) { + what = 'background'; + } + + var value = []; + var yAxisLeft = this.linegraph.yAxisLeft; + var yAxisRight = this.linegraph.yAxisRight; + if (!yAxisLeft.hidden && this.itemsData.length > 0) { + value.push(yAxisLeft.screenToValue(y)); + } + if (!yAxisRight.hidden && this.itemsData.length > 0) { + value.push(yAxisRight.screenToValue(y)); + } + + return { + event: event, + what: what, + pageX: event.srcEvent ? event.srcEvent.pageX : event.pageX, + pageY: event.srcEvent ? event.srcEvent.pageY : event.pageY, + x: x, + y: y, + time: time, + value: value + }; +}; - var _getPrototypeOf = __webpack_require__(176); +/** + * Load a configurator + * @return {Object} + * @private + */ +Graph2d.prototype._createConfigurator = function () { + return new Configurator(this, this.dom.container, configureOptions); +}; - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +module.exports = Graph2d; - var _classCallCheck2 = __webpack_require__(135); +/***/ }), +/* 181 */ +/***/ (function(module, exports, __webpack_require__) { - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +"use strict"; + + +// utils +exports.util = __webpack_require__(2); +exports.DOMutil = __webpack_require__(14); + +// data +exports.DataSet = __webpack_require__(11); +exports.DataView = __webpack_require__(12); +exports.Queue = __webpack_require__(43); + +// Network +exports.Network = __webpack_require__(182); +exports.network = { + Images: __webpack_require__(116), + dotparser: __webpack_require__(114), + gephiParser: __webpack_require__(115), + allOptions: __webpack_require__(122) +}; +exports.network.convertDot = function (input) { + return exports.network.dotparser.DOTToGraph(input); +}; +exports.network.convertGephi = function (input, options) { + return exports.network.gephiParser.parseGephi(input, options); +}; + +// bundled external libraries +exports.moment = __webpack_require__(9); +exports.Hammer = __webpack_require__(10); +exports.keycharm = __webpack_require__(35); - var _createClass2 = __webpack_require__(136); +/***/ }), +/* 182 */ +/***/ (function(module, exports, __webpack_require__) { - var _createClass3 = _interopRequireDefault(_createClass2); +"use strict"; - var _possibleConstructorReturn2 = __webpack_require__(179); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +// Load custom shapes into CanvasRenderingContext2D +__webpack_require__(183); - var _inherits2 = __webpack_require__(180); +var Emitter = __webpack_require__(44); +var util = __webpack_require__(2); +var dotparser = __webpack_require__(114); +var gephiParser = __webpack_require__(115); +var Activator = __webpack_require__(97); +var locales = __webpack_require__(184); - var _inherits3 = _interopRequireDefault(_inherits2); +var Images = __webpack_require__(116)['default']; +var Groups = __webpack_require__(186)['default']; +var NodesHandler = __webpack_require__(187)['default']; +var EdgesHandler = __webpack_require__(214)['default']; +var PhysicsEngine = __webpack_require__(220)['default']; +var ClusterEngine = __webpack_require__(227)['default']; +var CanvasRenderer = __webpack_require__(229)['default']; +var Canvas = __webpack_require__(230)['default']; +var View = __webpack_require__(231)['default']; +var InteractionHandler = __webpack_require__(232)['default']; +var SelectionHandler = __webpack_require__(234)['default']; +var LayoutEngine = __webpack_require__(235)['default']; +var ManipulationSystem = __webpack_require__(237)['default']; +var Configurator = __webpack_require__(71)['default']; +var Validator = __webpack_require__(15)['default']; - var _NodeBase2 = __webpack_require__(185); +var _require = __webpack_require__(15), + printStyle = _require.printStyle; - var _NodeBase3 = _interopRequireDefault(_NodeBase2); +var _require2 = __webpack_require__(122), + allOptions = _require2.allOptions, + configureOptions = _require2.configureOptions; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var KamadaKawai = __webpack_require__(238)['default']; - var Database = function (_NodeBase) { - (0, _inherits3['default'])(Database, _NodeBase); +/** + * Create a network visualization, displaying nodes and edges. + * + * @param {Element} container The DOM element in which the Network will + * be created. Normally a div element. + * @param {Object} data An object containing parameters + * {Array} nodes + * {Array} edges + * @param {Object} options Options + * @constructor Network + */ +function Network(container, data, options) { + var _this = this; - function Database(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Database); + if (!(this instanceof Network)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } - var _this = (0, _possibleConstructorReturn3['default'])(this, (Database.__proto__ || (0, _getPrototypeOf2['default'])(Database)).call(this, options, body, labelModule)); + // set constant values + this.options = {}; + this.defaultOptions = { + locale: 'en', + locales: locales, + clickToUse: false + }; + util.extend(this.options, this.defaultOptions); - _this._setMargins(labelModule); - return _this; + /** + * Containers for nodes and edges. + * + * 'edges' and 'nodes' contain the full definitions of all the network elements. + * 'nodeIndices' and 'edgeIndices' contain the id's of the active elements. + * + * The distinction is important, because a defined node need not be active, i.e. + * visible on the canvas. This happens in particular when clusters are defined, in + * that case there will be nodes and edges not displayed. + * The bottom line is that all code with actions related to visibility, *must* use + * 'nodeIndices' and 'edgeIndices', not 'nodes' and 'edges' directly. + */ + this.body = { + container: container, + + // See comment above for following fields + nodes: {}, + nodeIndices: [], + edges: {}, + edgeIndices: [], + + emitter: { + on: this.on.bind(this), + off: this.off.bind(this), + emit: this.emit.bind(this), + once: this.once.bind(this) + }, + eventListeners: { + onTap: function onTap() {}, + onTouch: function onTouch() {}, + onDoubleTap: function onDoubleTap() {}, + onHold: function onHold() {}, + onDragStart: function onDragStart() {}, + onDrag: function onDrag() {}, + onDragEnd: function onDragEnd() {}, + onMouseWheel: function onMouseWheel() {}, + onPinch: function onPinch() {}, + onMouseMove: function onMouseMove() {}, + onRelease: function onRelease() {}, + onContext: function onContext() {} + }, + data: { + nodes: null, // A DataSet or DataView + edges: null // A DataSet or DataView + }, + functions: { + createNode: function createNode() {}, + createEdge: function createEdge() {}, + getPointer: function getPointer() {} + }, + modules: {}, + view: { + scale: 1, + translation: { x: 0, y: 0 } } + }; - (0, _createClass3['default'])(Database, [{ - key: 'resize', - value: function resize(ctx, selected, hover) { - if (this.needsRefresh(selected, hover)) { - this.textSize = this.labelModule.getTextSize(ctx, selected, hover); - var size = this.textSize.width + this.margin.right + this.margin.left; - this.width = size; - this.height = size; - this.radius = this.width / 2; - } - } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.resize(ctx, selected, hover); - this.left = x - this.width / 2; - this.top = y - this.height / 2; + // bind the event listeners + this.bindEventListeners(); - this.initContextForDraw(ctx, values); - ctx.database(x - this.width / 2, y - this.height / 2, this.width, this.height); - this.performFill(ctx, values); + // setting up all modules + this.images = new Images(function () { + return _this.body.emitter.emit("_requestRedraw"); + }); // object with images + this.groups = new Groups(); // object with groups + this.canvas = new Canvas(this.body); // DOM handler + this.selectionHandler = new SelectionHandler(this.body, this.canvas); // Selection handler + this.interactionHandler = new InteractionHandler(this.body, this.canvas, this.selectionHandler); // Interaction handler handles all the hammer bindings (that are bound by canvas), key + this.view = new View(this.body, this.canvas); // camera handler, does animations and zooms + this.renderer = new CanvasRenderer(this.body, this.canvas); // renderer, starts renderloop, has events that modules can hook into + this.physics = new PhysicsEngine(this.body); // physics engine, does all the simulations + this.layoutEngine = new LayoutEngine(this.body); // layout engine for inital layout and hierarchical layout + this.clustering = new ClusterEngine(this.body); // clustering api + this.manipulation = new ManipulationSystem(this.body, this.canvas, this.selectionHandler); // data manipulation system - this.updateBoundingBox(x, y, ctx, selected, hover); - this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); - } - }]); - return Database; - }(_NodeBase3['default']); + this.nodesHandler = new NodesHandler(this.body, this.images, this.groups, this.layoutEngine); // Handle adding, deleting and updating of nodes as well as global options + this.edgesHandler = new EdgesHandler(this.body, this.images, this.groups); // Handle adding, deleting and updating of edges as well as global options - exports['default'] = Database; + this.body.modules["kamadaKawai"] = new KamadaKawai(this.body, 150, 0.05); // Layouting algorithm. + this.body.modules["clustering"] = this.clustering; -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { + // create the DOM elements + this.canvas._create(); - 'use strict'; + // apply options + this.setOptions(options); - Object.defineProperty(exports, "__esModule", { - value: true - }); + // load data (the disable start variable will be the same as the enabled clustering) + this.setData(data); +} - var _getPrototypeOf = __webpack_require__(176); +// Extend Network with an Emitter mixin +Emitter(Network.prototype); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +/** + * Set options + * @param {Object} options + */ +Network.prototype.setOptions = function (options) { + var _this2 = this; - var _classCallCheck2 = __webpack_require__(135); + if (options !== undefined) { + var errorFound = Validator.validate(options, allOptions); + if (errorFound === true) { + console.log('%cErrors have been found in the supplied options object.', printStyle); + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // copy the global fields over + var fields = ['locale', 'locales', 'clickToUse']; + util.selectiveDeepExtend(fields, this.options, options); - var _createClass2 = __webpack_require__(136); + // the hierarchical system can adapt the edges and the physics to it's own options because not all combinations work with the hierarichical system. + options = this.layoutEngine.setOptions(options.layout, options); - var _createClass3 = _interopRequireDefault(_createClass2); + this.canvas.setOptions(options); // options for canvas are in globals - var _possibleConstructorReturn2 = __webpack_require__(179); + // pass the options to the modules + this.groups.setOptions(options.groups); + this.nodesHandler.setOptions(options.nodes); + this.edgesHandler.setOptions(options.edges); + this.physics.setOptions(options.physics); + this.manipulation.setOptions(options.manipulation, options, this.options); // manipulation uses the locales in the globals - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + this.interactionHandler.setOptions(options.interaction); + this.renderer.setOptions(options.interaction); // options for rendering are in interaction + this.selectionHandler.setOptions(options.interaction); // options for selection are in interaction - var _inherits2 = __webpack_require__(180); + // reload the settings of the nodes to apply changes in groups that are not referenced by pointer. + if (options.groups !== undefined) { + this.body.emitter.emit("refreshNodes"); + } + // these two do not have options at the moment, here for completeness + //this.view.setOptions(options.view); + //this.clustering.setOptions(options.clustering); - var _inherits3 = _interopRequireDefault(_inherits2); + if ('configure' in options) { + if (!this.configurator) { + this.configurator = new Configurator(this, this.body.container, configureOptions, this.canvas.pixelRatio); + } - var _ShapeBase2 = __webpack_require__(191); + this.configurator.setOptions(options.configure); + } - var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); + // if the configuration system is enabled, copy all options and put them into the config system + if (this.configurator && this.configurator.options.enabled === true) { + var networkOptions = { nodes: {}, edges: {}, layout: {}, interaction: {}, manipulation: {}, physics: {}, global: {} }; + util.deepExtend(networkOptions.nodes, this.nodesHandler.options); + util.deepExtend(networkOptions.edges, this.edgesHandler.options); + util.deepExtend(networkOptions.layout, this.layoutEngine.options); + // load the selectionHandler and render default options in to the interaction group + util.deepExtend(networkOptions.interaction, this.selectionHandler.options); + util.deepExtend(networkOptions.interaction, this.renderer.options); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + util.deepExtend(networkOptions.interaction, this.interactionHandler.options); + util.deepExtend(networkOptions.manipulation, this.manipulation.options); + util.deepExtend(networkOptions.physics, this.physics.options); - var Diamond = function (_ShapeBase) { - (0, _inherits3['default'])(Diamond, _ShapeBase); + // load globals into the global object + util.deepExtend(networkOptions.global, this.canvas.options); + util.deepExtend(networkOptions.global, this.options); - function Diamond(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Diamond); - return (0, _possibleConstructorReturn3['default'])(this, (Diamond.__proto__ || (0, _getPrototypeOf2['default'])(Diamond)).call(this, options, body, labelModule)); + this.configurator.setModuleOptions(networkOptions); } - (0, _createClass3['default'])(Diamond, [{ - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this._drawShape(ctx, 'diamond', 4, x, y, selected, hover, values); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); + // handle network global options + if (options.clickToUse !== undefined) { + if (options.clickToUse === true) { + if (this.activator === undefined) { + this.activator = new Activator(this.canvas.frame); + this.activator.on('change', function () { + _this2.body.emitter.emit("activate"); + }); + } + } else { + if (this.activator !== undefined) { + this.activator.destroy(); + delete this.activator; + } + this.body.emitter.emit("activate"); } - }]); - return Diamond; - }(_ShapeBase3['default']); - - exports['default'] = Diamond; - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); + } else { + this.body.emitter.emit("activate"); + } - var _getPrototypeOf = __webpack_require__(176); + this.canvas.setSize(); + // start the physics simulation. Can be safely called multiple times. + this.body.emitter.emit("startSimulation"); + } +}; - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +/** + * Update the visible nodes and edges list with the most recent node state. + * + * Visible nodes are stored in this.body.nodeIndices. + * Visible edges are stored in this.body.edgeIndices. + * A node or edges is visible if it is not hidden or clustered. + * + * @private + */ +Network.prototype._updateVisibleIndices = function () { + var nodes = this.body.nodes; + var edges = this.body.edges; + this.body.nodeIndices = []; + this.body.edgeIndices = []; - var _classCallCheck2 = __webpack_require__(135); + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + if (!this.clustering._isClusteredNode(nodeId) && nodes[nodeId].options.hidden === false) { + this.body.nodeIndices.push(nodes[nodeId].id); + } + } + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + for (var edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + var edge = edges[edgeId]; - var _createClass2 = __webpack_require__(136); + // It can happen that this is executed *after* a node edge has been removed, + // but *before* the edge itself has been removed. Taking this into account. + var fromNode = nodes[edge.fromId]; + var toNode = nodes[edge.toId]; + var edgeNodesPresent = fromNode !== undefined && toNode !== undefined; - var _createClass3 = _interopRequireDefault(_createClass2); + var isVisible = !this.clustering._isClusteredEdge(edgeId) && edge.options.hidden === false && edgeNodesPresent && fromNode.options.hidden === false // Also hidden if any of its connecting nodes are hidden + && toNode.options.hidden === false; // idem - var _possibleConstructorReturn2 = __webpack_require__(179); + if (isVisible) { + this.body.edgeIndices.push(edge.id); + } + } + } +}; - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +/** + * Bind all events + */ +Network.prototype.bindEventListeners = function () { + var _this3 = this; + + // This event will trigger a rebuilding of the cache everything. + // Used when nodes or edges have been added or removed. + this.body.emitter.on("_dataChanged", function () { + _this3.edgesHandler._updateState(); + _this3.body.emitter.emit("_dataUpdated"); + }); - var _inherits2 = __webpack_require__(180); + // this is called when options of EXISTING nodes or edges have changed. + this.body.emitter.on("_dataUpdated", function () { + // Order important in following block + _this3.clustering._updateState(); + _this3._updateVisibleIndices(); + + _this3._updateValueRange(_this3.body.nodes); + _this3._updateValueRange(_this3.body.edges); + // start simulation (can be called safely, even if already running) + _this3.body.emitter.emit("startSimulation"); + _this3.body.emitter.emit("_requestRedraw"); + }); +}; - var _inherits3 = _interopRequireDefault(_inherits2); +/** + * Set nodes and edges, and optionally options as well. + * + * @param {Object} data Object containing parameters: + * {Array | DataSet | DataView} [nodes] Array with nodes + * {Array | DataSet | DataView} [edges] Array with edges + * {String} [dot] String containing data in DOT format + * {String} [gephi] String containing data in gephi JSON format + * {Options} [options] Object with options + */ +Network.prototype.setData = function (data) { + // reset the physics engine. + this.body.emitter.emit("resetPhysics"); + this.body.emitter.emit("_resetData"); + + // unselect all to ensure no selections from old data are carried over. + this.selectionHandler.unselectAll(); + + if (data && data.dot && (data.nodes || data.edges)) { + throw new SyntaxError('Data must contain either parameter "dot" or ' + ' parameter pair "nodes" and "edges", but not both.'); + } + + // set options + this.setOptions(data && data.options); + // set all data + if (data && data.dot) { + console.log('The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);'); + // parse DOT file + var dotData = dotparser.DOTToGraph(data.dot); + this.setData(dotData); + return; + } else if (data && data.gephi) { + // parse DOT file + console.log('The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);'); + var gephiData = gephiParser.parseGephi(data.gephi); + this.setData(gephiData); + return; + } else { + this.nodesHandler.setData(data && data.nodes, true); + this.edgesHandler.setData(data && data.edges, true); + } - var _NodeBase2 = __webpack_require__(185); + // emit change in data + this.body.emitter.emit("_dataChanged"); - var _NodeBase3 = _interopRequireDefault(_NodeBase2); + // emit data loaded + this.body.emitter.emit("_dataLoaded"); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + // find a stable position or start animating to a stable position + this.body.emitter.emit("initPhysics"); +}; - var ShapeBase = function (_NodeBase) { - (0, _inherits3['default'])(ShapeBase, _NodeBase); +/** + * Cleans up all bindings of the network, removing it fully from the memory IF the variable is set to null after calling this function. + * var network = new vis.Network(..); + * network.destroy(); + * network = null; + */ +Network.prototype.destroy = function () { + this.body.emitter.emit("destroy"); + // clear events + this.body.emitter.off(); + this.off(); + + // delete modules + delete this.groups; + delete this.canvas; + delete this.selectionHandler; + delete this.interactionHandler; + delete this.view; + delete this.renderer; + delete this.physics; + delete this.layoutEngine; + delete this.clustering; + delete this.manipulation; + delete this.nodesHandler; + delete this.edgesHandler; + delete this.configurator; + delete this.images; + + for (var nodeId in this.body.nodes) { + if (!this.body.nodes.hasOwnProperty(nodeId)) continue; + delete this.body.nodes[nodeId]; + } + + for (var edgeId in this.body.edges) { + if (!this.body.edges.hasOwnProperty(edgeId)) continue; + delete this.body.edges[edgeId]; + } + + // remove the container and everything inside it recursively + util.recursiveDOMDelete(this.body.container); +}; - function ShapeBase(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, ShapeBase); - return (0, _possibleConstructorReturn3['default'])(this, (ShapeBase.__proto__ || (0, _getPrototypeOf2['default'])(ShapeBase)).call(this, options, body, labelModule)); +/** + * Update the values of all object in the given array according to the current + * value range of the objects in the array. + * @param {Object} obj An object containing a set of Edges or Nodes + * The objects must have a method getValue() and + * setValueRange(min, max). + * @private + */ +Network.prototype._updateValueRange = function (obj) { + var id; + + // determine the range of the objects + var valueMin = undefined; + var valueMax = undefined; + var valueTotal = 0; + for (id in obj) { + if (obj.hasOwnProperty(id)) { + var value = obj[id].getValue(); + if (value !== undefined) { + valueMin = valueMin === undefined ? value : Math.min(value, valueMin); + valueMax = valueMax === undefined ? value : Math.max(value, valueMax); + valueTotal += value; + } + } + } + + // adjust the range of all objects + if (valueMin !== undefined && valueMax !== undefined) { + for (id in obj) { + if (obj.hasOwnProperty(id)) { + obj[id].setValueRange(valueMin, valueMax, valueTotal); + } } + } +}; - (0, _createClass3['default'])(ShapeBase, [{ - key: 'resize', - value: function resize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; - var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { size: this.options.size }; +/** + * Returns true when the Network is active. + * @returns {boolean} + */ +Network.prototype.isActive = function () { + return !this.activator || this.activator.active; +}; + +Network.prototype.setSize = function () { + return this.canvas.setSize.apply(this.canvas, arguments); +}; +Network.prototype.canvasToDOM = function () { + return this.canvas.canvasToDOM.apply(this.canvas, arguments); +}; +Network.prototype.DOMtoCanvas = function () { + return this.canvas.DOMtoCanvas.apply(this.canvas, arguments); +}; +Network.prototype.findNode = function () { + return this.clustering.findNode.apply(this.clustering, arguments); +}; +Network.prototype.isCluster = function () { + return this.clustering.isCluster.apply(this.clustering, arguments); +}; +Network.prototype.openCluster = function () { + return this.clustering.openCluster.apply(this.clustering, arguments); +}; +Network.prototype.cluster = function () { + return this.clustering.cluster.apply(this.clustering, arguments); +}; +Network.prototype.getNodesInCluster = function () { + return this.clustering.getNodesInCluster.apply(this.clustering, arguments); +}; +Network.prototype.clusterByConnection = function () { + return this.clustering.clusterByConnection.apply(this.clustering, arguments); +}; +Network.prototype.clusterByHubsize = function () { + return this.clustering.clusterByHubsize.apply(this.clustering, arguments); +}; +Network.prototype.clusterOutliers = function () { + return this.clustering.clusterOutliers.apply(this.clustering, arguments); +}; +Network.prototype.getSeed = function () { + return this.layoutEngine.getSeed.apply(this.layoutEngine, arguments); +}; +Network.prototype.enableEditMode = function () { + return this.manipulation.enableEditMode.apply(this.manipulation, arguments); +}; +Network.prototype.disableEditMode = function () { + return this.manipulation.disableEditMode.apply(this.manipulation, arguments); +}; +Network.prototype.addNodeMode = function () { + return this.manipulation.addNodeMode.apply(this.manipulation, arguments); +}; +Network.prototype.editNode = function () { + return this.manipulation.editNode.apply(this.manipulation, arguments); +}; +Network.prototype.editNodeMode = function () { + console.log("Deprecated: Please use editNode instead of editNodeMode.");return this.manipulation.editNode.apply(this.manipulation, arguments); +}; +Network.prototype.addEdgeMode = function () { + return this.manipulation.addEdgeMode.apply(this.manipulation, arguments); +}; +Network.prototype.editEdgeMode = function () { + return this.manipulation.editEdgeMode.apply(this.manipulation, arguments); +}; +Network.prototype.deleteSelected = function () { + return this.manipulation.deleteSelected.apply(this.manipulation, arguments); +}; +Network.prototype.getPositions = function () { + return this.nodesHandler.getPositions.apply(this.nodesHandler, arguments); +}; +Network.prototype.storePositions = function () { + return this.nodesHandler.storePositions.apply(this.nodesHandler, arguments); +}; +Network.prototype.moveNode = function () { + return this.nodesHandler.moveNode.apply(this.nodesHandler, arguments); +}; +Network.prototype.getBoundingBox = function () { + return this.nodesHandler.getBoundingBox.apply(this.nodesHandler, arguments); +}; +Network.prototype.getConnectedNodes = function (objectId) { + if (this.body.nodes[objectId] !== undefined) { + return this.nodesHandler.getConnectedNodes.apply(this.nodesHandler, arguments); + } else { + return this.edgesHandler.getConnectedNodes.apply(this.edgesHandler, arguments); + } +}; +Network.prototype.getConnectedEdges = function () { + return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler, arguments); +}; +Network.prototype.startSimulation = function () { + return this.physics.startSimulation.apply(this.physics, arguments); +}; +Network.prototype.stopSimulation = function () { + return this.physics.stopSimulation.apply(this.physics, arguments); +}; +Network.prototype.stabilize = function () { + return this.physics.stabilize.apply(this.physics, arguments); +}; +Network.prototype.getSelection = function () { + return this.selectionHandler.getSelection.apply(this.selectionHandler, arguments); +}; +Network.prototype.setSelection = function () { + return this.selectionHandler.setSelection.apply(this.selectionHandler, arguments); +}; +Network.prototype.getSelectedNodes = function () { + return this.selectionHandler.getSelectedNodes.apply(this.selectionHandler, arguments); +}; +Network.prototype.getSelectedEdges = function () { + return this.selectionHandler.getSelectedEdges.apply(this.selectionHandler, arguments); +}; +Network.prototype.getNodeAt = function () { + var node = this.selectionHandler.getNodeAt.apply(this.selectionHandler, arguments); + if (node !== undefined && node.id !== undefined) { + return node.id; + } + return node; +}; +Network.prototype.getEdgeAt = function () { + var edge = this.selectionHandler.getEdgeAt.apply(this.selectionHandler, arguments); + if (edge !== undefined && edge.id !== undefined) { + return edge.id; + } + return edge; +}; +Network.prototype.selectNodes = function () { + return this.selectionHandler.selectNodes.apply(this.selectionHandler, arguments); +}; +Network.prototype.selectEdges = function () { + return this.selectionHandler.selectEdges.apply(this.selectionHandler, arguments); +}; +Network.prototype.unselectAll = function () { + this.selectionHandler.unselectAll.apply(this.selectionHandler, arguments); + this.redraw(); +}; +Network.prototype.redraw = function () { + return this.renderer.redraw.apply(this.renderer, arguments); +}; +Network.prototype.getScale = function () { + return this.view.getScale.apply(this.view, arguments); +}; +Network.prototype.getViewPosition = function () { + return this.view.getViewPosition.apply(this.view, arguments); +}; +Network.prototype.fit = function () { + return this.view.fit.apply(this.view, arguments); +}; +Network.prototype.moveTo = function () { + return this.view.moveTo.apply(this.view, arguments); +}; +Network.prototype.focus = function () { + return this.view.focus.apply(this.view, arguments); +}; +Network.prototype.releaseNode = function () { + return this.view.releaseNode.apply(this.view, arguments); +}; +Network.prototype.getOptionsFromConfigurator = function () { + var options = {}; + if (this.configurator) { + options = this.configurator.getOptions.apply(this.configurator); + } + return options; +}; + +module.exports = Network; - if (this.needsRefresh(selected, hover)) { - this.labelModule.getTextSize(ctx, selected, hover); - var size = 2 * values.size; - this.width = size; - this.height = size; - this.radius = 0.5 * this.width; - } - } - }, { - key: '_drawShape', - value: function _drawShape(ctx, shape, sizeMultiplier, x, y, selected, hover, values) { - this.resize(ctx, selected, hover, values); - this.left = x - this.width / 2; - this.top = y - this.height / 2; +/***/ }), +/* 183 */ +/***/ (function(module, exports, __webpack_require__) { - this.initContextForDraw(ctx, values); - ctx[shape](x, y, values.size); - this.performFill(ctx, values); +"use strict"; - if (this.options.label !== undefined) { - // Need to call following here in order to ensure value for `this.labelModule.size.height` - this.labelModule.calculateLabelSize(ctx, selected, hover, x, y, 'hanging'); - var yLabel = y + 0.5 * this.height + 0.5 * this.labelModule.size.height; - this.labelModule.draw(ctx, x, yLabel, selected, hover, 'hanging'); - } - this.updateBoundingBox(x, y); - } - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y) { - this.boundingBox.top = y - this.options.size; - this.boundingBox.left = x - this.options.size; - this.boundingBox.right = x + this.options.size; - this.boundingBox.bottom = y + this.options.size; +/** + * Canvas shapes used by Network + */ +if (typeof CanvasRenderingContext2D !== 'undefined') { - if (this.options.label !== undefined && this.labelModule.size.width > 0) { - this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); - this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); - this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height); - } - } - }]); - return ShapeBase; - }(_NodeBase3['default']); + /** + * Draw a circle shape + * + * @param {number} x + * @param {number} y + * @param {number} r + */ + CanvasRenderingContext2D.prototype.circle = function (x, y, r) { + this.beginPath(); + this.arc(x, y, r, 0, 2 * Math.PI, false); + this.closePath(); + }; - exports['default'] = ShapeBase; + /** + * Draw a square shape + * @param {number} x horizontal center + * @param {number} y vertical center + * @param {number} r size, width and height of the square + */ + CanvasRenderingContext2D.prototype.square = function (x, y, r) { + this.beginPath(); + this.rect(x - r, y - r, r * 2, r * 2); + this.closePath(); + }; -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Draw a triangle shape + * @param {number} x horizontal center + * @param {number} y vertical center + * @param {number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.triangle = function (x, y, r) { + // http://en.wikipedia.org/wiki/Equilateral_triangle + this.beginPath(); - 'use strict'; + // the change in radius and the offset is here to center the shape + r *= 1.15; + y += 0.275 * r; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var s = r * 2; + var s2 = s / 2; + var ir = Math.sqrt(3) / 6 * s; // radius of inner circle + var h = Math.sqrt(s * s - s2 * s2); // height - var _getPrototypeOf = __webpack_require__(176); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + this.moveTo(x, y - (h - ir)); + this.lineTo(x + s2, y + ir); + this.lineTo(x - s2, y + ir); + this.lineTo(x, y - (h - ir)); + this.closePath(); + }; - var _classCallCheck2 = __webpack_require__(135); + /** + * Draw a triangle shape in downward orientation + * @param {number} x horizontal center + * @param {number} y vertical center + * @param {number} r radius + */ + CanvasRenderingContext2D.prototype.triangleDown = function (x, y, r) { + // http://en.wikipedia.org/wiki/Equilateral_triangle + this.beginPath(); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // the change in radius and the offset is here to center the shape + r *= 1.15; + y -= 0.275 * r; - var _createClass2 = __webpack_require__(136); + var s = r * 2; + var s2 = s / 2; + var ir = Math.sqrt(3) / 6 * s; // radius of inner circle + var h = Math.sqrt(s * s - s2 * s2); // height - var _createClass3 = _interopRequireDefault(_createClass2); + this.moveTo(x, y + (h - ir)); + this.lineTo(x + s2, y - ir); + this.lineTo(x - s2, y - ir); + this.lineTo(x, y + (h - ir)); + this.closePath(); + }; - var _possibleConstructorReturn2 = __webpack_require__(179); + /** + * Draw a star shape, a star with 5 points + * @param {number} x horizontal center + * @param {number} y vertical center + * @param {number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.star = function (x, y, r) { + // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ + this.beginPath(); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + // the change in radius and the offset is here to center the shape + r *= 0.82; + y += 0.1 * r; - var _inherits2 = __webpack_require__(180); + for (var n = 0; n < 10; n++) { + var radius = n % 2 === 0 ? r * 1.3 : r * 0.5; + this.lineTo(x + radius * Math.sin(n * 2 * Math.PI / 10), y - radius * Math.cos(n * 2 * Math.PI / 10)); + } - var _inherits3 = _interopRequireDefault(_inherits2); + this.closePath(); + }; - var _ShapeBase2 = __webpack_require__(191); + /** + * Draw a Diamond shape + * @param {number} x horizontal center + * @param {number} y vertical center + * @param {number} r radius, half the length of the sides of the triangle + */ + CanvasRenderingContext2D.prototype.diamond = function (x, y, r) { + // http://www.html5canvastutorials.com/labs/html5-canvas-star-spinner/ + this.beginPath(); - var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); + this.lineTo(x, y + r); + this.lineTo(x + r, y); + this.lineTo(x, y - r); + this.lineTo(x - r, y); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + this.closePath(); + }; - var Dot = function (_ShapeBase) { - (0, _inherits3['default'])(Dot, _ShapeBase); + /** + * http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas + * + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + * @param {number} r + */ + CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { + var r2d = Math.PI / 180; + if (w - 2 * r < 0) { + r = w / 2; + } //ensure that the radius isn't too large for x + if (h - 2 * r < 0) { + r = h / 2; + } //ensure that the radius isn't too large for y + this.beginPath(); + this.moveTo(x + r, y); + this.lineTo(x + w - r, y); + this.arc(x + w - r, y + r, r, r2d * 270, r2d * 360, false); + this.lineTo(x + w, y + h - r); + this.arc(x + w - r, y + h - r, r, 0, r2d * 90, false); + this.lineTo(x + r, y + h); + this.arc(x + r, y + h - r, r, r2d * 90, r2d * 180, false); + this.lineTo(x, y + r); + this.arc(x + r, y + r, r, r2d * 180, r2d * 270, false); + this.closePath(); + }; + + /** + * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + * + * Postfix '_vis' added to discern it from standard method ellipse(). + * + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + */ + CanvasRenderingContext2D.prototype.ellipse_vis = function (x, y, w, h) { + var kappa = .5522848, + ox = w / 2 * kappa, + // control point offset horizontal + oy = h / 2 * kappa, + // control point offset vertical + xe = x + w, + // x-end + ye = y + h, + // y-end + xm = x + w / 2, + // x-middle + ym = y + h / 2; // y-middle + + this.beginPath(); + this.moveTo(x, ym); + this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + this.closePath(); + }; + + /** + * http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas + * + * @param {number} x + * @param {number} y + * @param {number} w + * @param {number} h + */ + CanvasRenderingContext2D.prototype.database = function (x, y, w, h) { + var f = 1 / 3; + var wEllipse = w; + var hEllipse = h * f; + + var kappa = .5522848, + ox = wEllipse / 2 * kappa, + // control point offset horizontal + oy = hEllipse / 2 * kappa, + // control point offset vertical + xe = x + wEllipse, + // x-end + ye = y + hEllipse, + // y-end + xm = x + wEllipse / 2, + // x-middle + ym = y + hEllipse / 2, + // y-middle + ymb = y + (h - hEllipse / 2), + // y-midlle, bottom ellipse + yeb = y + h; // y-end, bottom ellipse + + this.beginPath(); + this.moveTo(xe, ym); + + this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); + this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); + + this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); + this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); + + this.lineTo(xe, ymb); + + this.bezierCurveTo(xe, ymb + oy, xm + ox, yeb, xm, yeb); + this.bezierCurveTo(xm - ox, yeb, x, ymb + oy, x, ymb); + + this.lineTo(x, ym); + }; + + /** + * Sets up the dashedLine functionality for drawing + * Original code came from http://stackoverflow.com/questions/4576724/dotted-stroke-in-canvas + * @author David Jordan + * @date 2012-08-08 + * + * @param {number} x + * @param {number} y + * @param {number} x2 + * @param {number} y2 + * @param {string} pattern + */ + CanvasRenderingContext2D.prototype.dashedLine = function (x, y, x2, y2, pattern) { + this.beginPath(); + this.moveTo(x, y); + + var patternLength = pattern.length; + var dx = x2 - x; + var dy = y2 - y; + var slope = dy / dx; + var distRemaining = Math.sqrt(dx * dx + dy * dy); + var patternIndex = 0; + var draw = true; + var xStep = 0; + var dashLength = pattern[0]; + + while (distRemaining >= 0.1) { + dashLength = pattern[patternIndex++ % patternLength]; + if (dashLength > distRemaining) { + dashLength = distRemaining; + } + + xStep = Math.sqrt(dashLength * dashLength / (1 + slope * slope)); + xStep = dx < 0 ? -xStep : xStep; + x += xStep; + y += slope * xStep; + + if (draw === true) { + this.lineTo(x, y); + } else { + this.moveTo(x, y); + } - function Dot(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Dot); - return (0, _possibleConstructorReturn3['default'])(this, (Dot.__proto__ || (0, _getPrototypeOf2['default'])(Dot)).call(this, options, body, labelModule)); + distRemaining -= dashLength; + draw = !draw; } + }; - (0, _createClass3['default'])(Dot, [{ - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this._drawShape(ctx, 'circle', 2, x, y, selected, hover, values); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - this.resize(ctx); - return this.options.size; - } - }]); - return Dot; - }(_ShapeBase3['default']); - - exports['default'] = Dot; + /** + * Draw a Hexagon shape with 6 sides + * @param {Number} x horizontal center + * @param {Number} y vertical center + * @param {Number} r radius + */ + CanvasRenderingContext2D.prototype.hexagon = function (x, y, r) { + this.beginPath(); + var sides = 6; + var a = Math.PI * 2 / sides; + this.moveTo(x + r, y); + for (var i = 1; i < sides; i++) { + this.lineTo(x + r * Math.cos(a * i), y + r * Math.sin(a * i)); + } + this.closePath(); + }; +} /***/ }), -/* 193 */ +/* 184 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; + + +// English +exports['en'] = { + edit: 'Edit', + del: 'Delete selected', + back: 'Back', + addNode: 'Add Node', + addEdge: 'Add Edge', + editNode: 'Edit Node', + editEdge: 'Edit Edge', + addDescription: 'Click in an empty space to place a new node.', + edgeDescription: 'Click on a node and drag the edge to another node to connect them.', + editEdgeDescription: 'Click on the control points and drag them to a node to connect to it.', + createEdgeError: 'Cannot link edges to a cluster.', + deleteClusterError: 'Clusters cannot be deleted.', + editClusterError: 'Clusters cannot be edited.' +}; +exports['en_EN'] = exports['en']; +exports['en_US'] = exports['en']; + +// German +exports['de'] = { + edit: 'Editieren', + del: 'L\xF6sche Auswahl', + back: 'Zur\xFCck', + addNode: 'Knoten hinzuf\xFCgen', + addEdge: 'Kante hinzuf\xFCgen', + editNode: 'Knoten editieren', + editEdge: 'Kante editieren', + addDescription: 'Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.', + edgeDescription: 'Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.', + editEdgeDescription: 'Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.', + createEdgeError: 'Es ist nicht m\xF6glich, Kanten mit Clustern zu verbinden.', + deleteClusterError: 'Cluster k\xF6nnen nicht gel\xF6scht werden.', + editClusterError: 'Cluster k\xF6nnen nicht editiert werden.' +}; +exports['de_DE'] = exports['de']; + +// Spanish +exports['es'] = { + edit: 'Editar', + del: 'Eliminar selecci\xF3n', + back: '\xC1tras', + addNode: 'A\xF1adir nodo', + addEdge: 'A\xF1adir arista', + editNode: 'Editar nodo', + editEdge: 'Editar arista', + addDescription: 'Haga clic en un lugar vac\xEDo para colocar un nuevo nodo.', + edgeDescription: 'Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.', + editEdgeDescription: 'Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.', + createEdgeError: 'No se puede conectar una arista a un grupo.', + deleteClusterError: 'No es posible eliminar grupos.', + editClusterError: 'No es posible editar grupos.' +}; +exports['es_ES'] = exports['es']; + +//Italiano +exports['it'] = { + edit: 'Modifica', + del: 'Cancella la selezione', + back: 'Indietro', + addNode: 'Aggiungi un nodo', + addEdge: 'Aggiungi un vertice', + editNode: 'Modifica il nodo', + editEdge: 'Modifica il vertice', + addDescription: 'Clicca per aggiungere un nuovo nodo', + edgeDescription: 'Clicca su un nodo e trascinalo ad un altro nodo per connetterli.', + editEdgeDescription: 'Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.', + createEdgeError: 'Non si possono collegare vertici ad un cluster', + deleteClusterError: 'I cluster non possono essere cancellati', + editClusterError: 'I clusters non possono essere modificati.' +}; +exports['it_IT'] = exports['it']; + +// Dutch +exports['nl'] = { + edit: 'Wijzigen', + del: 'Selectie verwijderen', + back: 'Terug', + addNode: 'Node toevoegen', + addEdge: 'Link toevoegen', + editNode: 'Node wijzigen', + editEdge: 'Link wijzigen', + addDescription: 'Klik op een leeg gebied om een nieuwe node te maken.', + edgeDescription: 'Klik op een node en sleep de link naar een andere node om ze te verbinden.', + editEdgeDescription: 'Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.', + createEdgeError: 'Kan geen link maken naar een cluster.', + deleteClusterError: 'Clusters kunnen niet worden verwijderd.', + editClusterError: 'Clusters kunnen niet worden aangepast.' +}; +exports['nl_NL'] = exports['nl']; +exports['nl_BE'] = exports['nl']; + +// Portuguese Brazil +exports['pt-br'] = { + edit: 'Editar', + del: 'Remover selecionado', + back: 'Voltar', + addNode: 'Adicionar nó', + addEdge: 'Adicionar aresta', + editNode: 'Editar nó', + editEdge: 'Editar aresta', + addDescription: 'Clique em um espaço em branco para adicionar um novo nó', + edgeDescription: 'Clique em um nó e arraste a aresta até outro nó para conectá-los', + editEdgeDescription: 'Clique nos pontos de controle e os arraste para um nó para conectá-los', + createEdgeError: 'Não foi possível linkar arestas a um cluster.', + deleteClusterError: 'Clusters não puderam ser removidos.', + editClusterError: 'Clusters não puderam ser editados.' +}; +exports['pt-BR'] = exports['pt-br']; +exports['pt_BR'] = exports['pt-br']; +exports['pt_br'] = exports['pt-br']; + +// Russian +exports['ru'] = { + edit: 'Редактировать', + del: 'Удалить выбранное', + back: 'Назад', + addNode: 'Добавить узел', + addEdge: 'Добавить ребро', + editNode: 'Редактировать узел', + editEdge: 'Редактировать ребро', + addDescription: 'Кликните в свободное место, чтобы добавить новый узел.', + edgeDescription: 'Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.', + editEdgeDescription: 'Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.', + createEdgeError: 'Невозможно соединить ребра в кластер.', + deleteClusterError: 'Кластеры не могут быть удалены', + editClusterError: 'Кластеры недоступны для редактирования.' +}; +exports['ru_RU'] = exports['ru']; + +// Chinese +exports['cn'] = { + edit: '编辑', + del: '删除选定', + back: '返回', + addNode: '添加节点', + addEdge: '添加连接线', + editNode: '编辑节点', + editEdge: '编辑连接线', + addDescription: '单击空白处放置新节点。', + edgeDescription: '单击某个节点并将该连接线拖动到另一个节点以连接它们。', + editEdgeDescription: '单击控制节点并将它们拖到节点上连接。', + createEdgeError: '无法将连接线连接到群集。', + deleteClusterError: '无法删除群集。', + editClusterError: '无法编辑群集。' +}; +exports['zh_CN'] = exports['cn']; - Object.defineProperty(exports, "__esModule", { - value: true - }); +/***/ }), +/* 185 */ +/***/ (function(module, exports, __webpack_require__) { - var _getPrototypeOf = __webpack_require__(176); +"use strict"; - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var _classCallCheck2 = __webpack_require__(135); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _classCallCheck2 = __webpack_require__(0); - var _createClass2 = __webpack_require__(136); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _createClass3 = _interopRequireDefault(_createClass2); +var _createClass2 = __webpack_require__(1); - var _possibleConstructorReturn2 = __webpack_require__(179); +var _createClass3 = _interopRequireDefault(_createClass2); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _inherits2 = __webpack_require__(180); +/** + * Associates a canvas to a given image, containing a number of renderings + * of the image at various sizes. + * + * This technique is known as 'mipmapping'. + * + * NOTE: Images can also be of type 'data:svg+xml`. This code also works + * for svg, but the mipmapping may not be necessary. + * + * @param {Image} image + */ +var CachedImage = function () { + /** + * @ignore + */ + function CachedImage() { + (0, _classCallCheck3['default'])(this, CachedImage); + // eslint-disable-line no-unused-vars + this.NUM_ITERATIONS = 4; // Number of items in the coordinates array - var _inherits3 = _interopRequireDefault(_inherits2); + this.image = new Image(); + this.canvas = document.createElement('canvas'); + } - var _NodeBase2 = __webpack_require__(185); + /** + * Called when the image has been successfully loaded. + */ - var _NodeBase3 = _interopRequireDefault(_NodeBase2); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + (0, _createClass3['default'])(CachedImage, [{ + key: 'init', + value: function init() { + if (this.initialized()) return; - var Ellipse = function (_NodeBase) { - (0, _inherits3['default'])(Ellipse, _NodeBase); + this.src = this.image.src; // For same interface with Image + var w = this.image.width; + var h = this.image.height; - function Ellipse(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Ellipse); - return (0, _possibleConstructorReturn3['default'])(this, (Ellipse.__proto__ || (0, _getPrototypeOf2['default'])(Ellipse)).call(this, options, body, labelModule)); - } + // Ease external access + this.width = w; + this.height = h; - (0, _createClass3['default'])(Ellipse, [{ - key: 'resize', - value: function resize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; + var h2 = Math.floor(h / 2); + var h4 = Math.floor(h / 4); + var h8 = Math.floor(h / 8); + var h16 = Math.floor(h / 16); - if (this.needsRefresh(selected, hover)) { - var textSize = this.labelModule.getTextSize(ctx, selected, hover); + var w2 = Math.floor(w / 2); + var w4 = Math.floor(w / 4); + var w8 = Math.floor(w / 8); + var w16 = Math.floor(w / 16); - this.height = textSize.height * 2; - this.width = textSize.width + this.height; - this.radius = 0.5 * this.width; - } - } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.resize(ctx, selected, hover); - this.left = x - this.width * 0.5; - this.top = y - this.height * 0.5; + // Make canvas as small as possible + this.canvas.width = 3 * w4; + this.canvas.height = h2; - this.initContextForDraw(ctx, values); - ctx.ellipse_vis(this.left, this.top, this.width, this.height); - this.performFill(ctx, values); + // Coordinates and sizes of images contained in the canvas + // Values per row: [top x, left y, width, height] - this.updateBoundingBox(x, y, ctx, selected, hover); - this.labelModule.draw(ctx, x, y, selected, hover); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - this.resize(ctx); - var a = this.width * 0.5; - var b = this.height * 0.5; - var w = Math.sin(angle) * a; - var h = Math.cos(angle) * b; - return a * b / Math.sqrt(w * w + h * h); - } - }]); - return Ellipse; - }(_NodeBase3['default']); + this.coordinates = [[0, 0, w2, h2], [w2, 0, w4, h4], [w2, h4, w8, h8], [5 * w8, h4, w16, h16]]; - exports['default'] = Ellipse; + this._fillMipMap(); + } -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @return {Boolean} true if init() has been called, false otherwise. + */ - 'use strict'; + }, { + key: 'initialized', + value: function initialized() { + return this.coordinates !== undefined; + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * Redraw main image in various sizes to the context. + * + * The rationale behind this is to reduce artefacts due to interpolation + * at differing zoom levels. + * + * Source: http://stackoverflow.com/q/18761404/1223531 + * + * This methods takes the resizing out of the drawing loop, in order to + * reduce performance overhead. + * + * TODO: The code assumes that a 2D context can always be gotten. This is + * not necessarily true! OTOH, if not true then usage of this class + * is senseless. + * + * @private + */ - var _getPrototypeOf = __webpack_require__(176); + }, { + key: '_fillMipMap', + value: function _fillMipMap() { + var ctx = this.canvas.getContext('2d'); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + // First zoom-level comes from the image + var to = this.coordinates[0]; + ctx.drawImage(this.image, to[0], to[1], to[2], to[3]); - var _classCallCheck2 = __webpack_require__(135); + // The rest are copy actions internal to the canvas/context + for (var iterations = 1; iterations < this.NUM_ITERATIONS; iterations++) { + var from = this.coordinates[iterations - 1]; + var _to = this.coordinates[iterations]; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], _to[0], _to[1], _to[2], _to[3]); + } + } - var _createClass2 = __webpack_require__(136); + /** + * Draw the image, using the mipmap if necessary. + * + * MipMap is only used if param factor > 2; otherwise, original bitmap + * is resized. This is also used to skip mipmap usage, e.g. by setting factor = 1 + * + * Credits to 'Alex de Mulder' for original implementation. + * + * @param {CanvasRenderingContext2D} ctx context on which to draw zoomed image + * @param {Float} factor scale factor at which to draw + * @param {number} left + * @param {number} top + * @param {number} width + * @param {number} height + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'drawImageAtPosition', + value: function drawImageAtPosition(ctx, factor, left, top, width, height) { - var _possibleConstructorReturn2 = __webpack_require__(179); + if (!this.initialized()) return; //can't draw image yet not intialized - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + if (factor > 2) { + // Determine which zoomed image to use + factor *= 0.5; + var iterations = 0; + while (factor > 2 && iterations < this.NUM_ITERATIONS) { + factor *= 0.5; + iterations += 1; + } - var _inherits2 = __webpack_require__(180); + if (iterations >= this.NUM_ITERATIONS) { + iterations = this.NUM_ITERATIONS - 1; + } + //console.log("iterations: " + iterations); - var _inherits3 = _interopRequireDefault(_inherits2); + var from = this.coordinates[iterations]; + ctx.drawImage(this.canvas, from[0], from[1], from[2], from[3], left, top, width, height); + } else { + // Draw image directly + ctx.drawImage(this.image, left, top, width, height); + } + } + }]); + return CachedImage; +}(); - var _NodeBase2 = __webpack_require__(185); +exports['default'] = CachedImage; - var _NodeBase3 = _interopRequireDefault(_NodeBase2); +/***/ }), +/* 186 */ +/***/ (function(module, exports, __webpack_require__) { - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +"use strict"; - var Icon = function (_NodeBase) { - (0, _inherits3['default'])(Icon, _NodeBase); - function Icon(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Icon); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _this = (0, _possibleConstructorReturn3['default'])(this, (Icon.__proto__ || (0, _getPrototypeOf2['default'])(Icon)).call(this, options, body, labelModule)); +var _classCallCheck2 = __webpack_require__(0); - _this._setMargins(labelModule); - return _this; - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - (0, _createClass3['default'])(Icon, [{ - key: 'resize', - value: function resize(ctx, selected, hover) { - if (this.needsRefresh(selected, hover)) { - this.iconSize = { - width: Number(this.options.icon.size), - height: Number(this.options.icon.size) - }; - this.width = this.iconSize.width + this.margin.right + this.margin.left; - this.height = this.iconSize.height + this.margin.top + this.margin.bottom; - this.radius = 0.5 * this.width; - } - } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.resize(ctx, selected, hover); - this.options.icon.size = this.options.icon.size || 50; +var _createClass2 = __webpack_require__(1); - this.left = x - this.width / 2; - this.top = y - this.height / 2; - this._icon(ctx, x, y, selected, hover, values); +var _createClass3 = _interopRequireDefault(_createClass2); - if (this.options.label !== undefined) { - var iconTextSpacing = 5; - this.labelModule.draw(ctx, this.left + this.iconSize.width / 2 + this.margin.left, y + this.height / 2 + iconTextSpacing, selected); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - this.updateBoundingBox(x, y); - } - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y) { - this.boundingBox.top = y - this.options.icon.size * 0.5; - this.boundingBox.left = x - this.options.icon.size * 0.5; - this.boundingBox.right = x + this.options.icon.size * 0.5; - this.boundingBox.bottom = y + this.options.icon.size * 0.5; +var util = __webpack_require__(2); - if (this.options.label !== undefined && this.labelModule.size.width > 0) { - var iconTextSpacing = 5; - this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); - this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); - this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + iconTextSpacing); - } - } - }, { - key: '_icon', - value: function _icon(ctx, x, y, selected, hover, values) { - var iconSize = Number(this.options.icon.size); +/** + * This class can store groups and options specific for groups. + */ + +var Groups = function () { + /** + * @ignore + */ + function Groups() { + (0, _classCallCheck3["default"])(this, Groups); + + this.clear(); + this.defaultIndex = 0; + this.groupsArray = []; + this.groupIndex = 0; + + this.defaultGroups = [{ border: "#2B7CE9", background: "#97C2FC", highlight: { border: "#2B7CE9", background: "#D2E5FF" }, hover: { border: "#2B7CE9", background: "#D2E5FF" } }, // 0: blue + { border: "#FFA500", background: "#FFFF00", highlight: { border: "#FFA500", background: "#FFFFA3" }, hover: { border: "#FFA500", background: "#FFFFA3" } }, // 1: yellow + { border: "#FA0A10", background: "#FB7E81", highlight: { border: "#FA0A10", background: "#FFAFB1" }, hover: { border: "#FA0A10", background: "#FFAFB1" } }, // 2: red + { border: "#41A906", background: "#7BE141", highlight: { border: "#41A906", background: "#A1EC76" }, hover: { border: "#41A906", background: "#A1EC76" } }, // 3: green + { border: "#E129F0", background: "#EB7DF4", highlight: { border: "#E129F0", background: "#F0B3F5" }, hover: { border: "#E129F0", background: "#F0B3F5" } }, // 4: magenta + { border: "#7C29F0", background: "#AD85E4", highlight: { border: "#7C29F0", background: "#D3BDF0" }, hover: { border: "#7C29F0", background: "#D3BDF0" } }, // 5: purple + { border: "#C37F00", background: "#FFA807", highlight: { border: "#C37F00", background: "#FFCA66" }, hover: { border: "#C37F00", background: "#FFCA66" } }, // 6: orange + { border: "#4220FB", background: "#6E6EFD", highlight: { border: "#4220FB", background: "#9B9BFD" }, hover: { border: "#4220FB", background: "#9B9BFD" } }, // 7: darkblue + { border: "#FD5A77", background: "#FFC0CB", highlight: { border: "#FD5A77", background: "#FFD1D9" }, hover: { border: "#FD5A77", background: "#FFD1D9" } }, // 8: pink + { border: "#4AD63A", background: "#C2FABC", highlight: { border: "#4AD63A", background: "#E6FFE3" }, hover: { border: "#4AD63A", background: "#E6FFE3" } }, // 9: mint + + { border: "#990000", background: "#EE0000", highlight: { border: "#BB0000", background: "#FF3333" }, hover: { border: "#BB0000", background: "#FF3333" } }, // 10:bright red + + { border: "#FF6000", background: "#FF6000", highlight: { border: "#FF6000", background: "#FF6000" }, hover: { border: "#FF6000", background: "#FF6000" } }, // 12: real orange + { border: "#97C2FC", background: "#2B7CE9", highlight: { border: "#D2E5FF", background: "#2B7CE9" }, hover: { border: "#D2E5FF", background: "#2B7CE9" } }, // 13: blue + { border: "#399605", background: "#255C03", highlight: { border: "#399605", background: "#255C03" }, hover: { border: "#399605", background: "#255C03" } }, // 14: green + { border: "#B70054", background: "#FF007E", highlight: { border: "#B70054", background: "#FF007E" }, hover: { border: "#B70054", background: "#FF007E" } }, // 15: magenta + { border: "#AD85E4", background: "#7C29F0", highlight: { border: "#D3BDF0", background: "#7C29F0" }, hover: { border: "#D3BDF0", background: "#7C29F0" } }, // 16: purple + { border: "#4557FA", background: "#000EA1", highlight: { border: "#6E6EFD", background: "#000EA1" }, hover: { border: "#6E6EFD", background: "#000EA1" } }, // 17: darkblue + { border: "#FFC0CB", background: "#FD5A77", highlight: { border: "#FFD1D9", background: "#FD5A77" }, hover: { border: "#FFD1D9", background: "#FD5A77" } }, // 18: pink + { border: "#C2FABC", background: "#74D66A", highlight: { border: "#E6FFE3", background: "#74D66A" }, hover: { border: "#E6FFE3", background: "#74D66A" } }, // 19: mint + + { border: "#EE0000", background: "#990000", highlight: { border: "#FF3333", background: "#BB0000" }, hover: { border: "#FF3333", background: "#BB0000" } // 20:bright red + }]; - if (this.options.icon.code !== undefined) { - ctx.font = (selected ? "bold " : "") + iconSize + "px " + this.options.icon.face; + this.options = {}; + this.defaultOptions = { + useDefaultGroups: true + }; + util.extend(this.options, this.defaultOptions); + } - // draw icon - ctx.fillStyle = this.options.icon.color || "black"; - ctx.textAlign = "center"; - ctx.textBaseline = "middle"; + /** + * + * @param {Object} options + */ - // draw shadow if enabled - this.enableShadow(ctx, values); - ctx.fillText(this.options.icon.code, x, y); - // disable shadows for other elements. - this.disableShadow(ctx, values); - } else { - console.error('When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.'); + (0, _createClass3["default"])(Groups, [{ + key: "setOptions", + value: function setOptions(options) { + var optionFields = ['useDefaultGroups']; + + if (options !== undefined) { + for (var groupName in options) { + if (options.hasOwnProperty(groupName)) { + if (optionFields.indexOf(groupName) === -1) { + var group = options[groupName]; + this.add(groupName, group); + } + } } } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); - } - }]); - return Icon; - }(_NodeBase3['default']); - - exports['default'] = Icon; + } -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Clear all groups + */ - 'use strict'; + }, { + key: "clear", + value: function clear() { + this.groups = {}; + this.groupsArray = []; + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * Get group options of a groupname. + * If groupname is not found, a new group may be created. + * + * @param {*} groupname Can be a number, string, Date, etc. + * @param {boolean} [shouldCreate=true] If true, create a new group + * @return {Object} The found or created group + */ - var _getPrototypeOf = __webpack_require__(176); + }, { + key: "get", + value: function get(groupname) { + var shouldCreate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + var group = this.groups[groupname]; + + if (group === undefined && shouldCreate) { + if (this.options.useDefaultGroups === false && this.groupsArray.length > 0) { + // create new group + var index = this.groupIndex % this.groupsArray.length; + this.groupIndex++; + group = {}; + group.color = this.groups[this.groupsArray[index]]; + this.groups[groupname] = group; + } else { + // create new group + var _index = this.defaultIndex % this.defaultGroups.length; + this.defaultIndex++; + group = {}; + group.color = this.defaultGroups[_index]; + this.groups[groupname] = group; + } + } - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + return group; + } - var _classCallCheck2 = __webpack_require__(135); + /** + * Add a custom group style + * @param {string} groupName + * @param {Object} style An object containing borderColor, + * backgroundColor, etc. + * @return {Object} group The created group object + */ - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + }, { + key: "add", + value: function add(groupName, style) { + this.groups[groupName] = style; + this.groupsArray.push(groupName); + return style; + } + }]); + return Groups; +}(); - var _createClass2 = __webpack_require__(136); +exports["default"] = Groups; - var _createClass3 = _interopRequireDefault(_createClass2); +/***/ }), +/* 187 */ +/***/ (function(module, exports, __webpack_require__) { - var _possibleConstructorReturn2 = __webpack_require__(179); +"use strict"; - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _inherits2 = __webpack_require__(180); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _inherits3 = _interopRequireDefault(_inherits2); +var _classCallCheck2 = __webpack_require__(0); - var _CircleImageBase2 = __webpack_require__(187); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2); +var _createClass2 = __webpack_require__(1); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _createClass3 = _interopRequireDefault(_createClass2); - var Image = function (_CircleImageBase) { - (0, _inherits3['default'])(Image, _CircleImageBase); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - function Image(options, body, labelModule, imageObj, imageObjAlt) { - (0, _classCallCheck3['default'])(this, Image); +var util = __webpack_require__(2); +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var Node = __webpack_require__(47)['default']; - var _this = (0, _possibleConstructorReturn3['default'])(this, (Image.__proto__ || (0, _getPrototypeOf2['default'])(Image)).call(this, options, body, labelModule)); +/** + * Handler for Nodes + */ - _this.setImages(imageObj, imageObjAlt); - return _this; - } +var NodesHandler = function () { + /** + * @param {Object} body + * @param {Images} images + * @param {Array.} groups + * @param {LayoutEngine} layoutEngine + */ + function NodesHandler(body, images, groups, layoutEngine) { + var _this = this; - (0, _createClass3['default'])(Image, [{ - key: 'resize', - value: function resize(ctx) { - var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; - var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; + (0, _classCallCheck3['default'])(this, NodesHandler); - var imageAbsent = this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined; + this.body = body; + this.images = images; + this.groups = groups; + this.layoutEngine = layoutEngine; - if (imageAbsent) { - var side = this.options.size * 2; - this.width = side; - this.height = side; - return; - } + // create the node API in the body container + this.body.functions.createNode = this.create.bind(this); - if (this.needsRefresh(selected, hover)) { - this._resizeImage(); - } + this.nodesListeners = { + add: function add(event, params) { + _this.add(params.items); + }, + update: function update(event, params) { + _this.update(params.items, params.data, params.oldData); + }, + remove: function remove(event, params) { + _this.remove(params.items); } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.switchImages(selected); - this.resize(); - this.left = x - this.width / 2; - this.top = y - this.height / 2; - - if (this.options.shapeProperties.useBorderWithImage === true) { - var neutralborderWidth = this.options.borderWidth; - var selectionLineWidth = this.options.borderWidthSelected || 2 * this.options.borderWidth; - var borderWidth = (selected ? selectionLineWidth : neutralborderWidth) / this.body.view.scale; - ctx.lineWidth = Math.min(this.width, borderWidth); - - ctx.beginPath(); + }; - // setup the line properties. - ctx.strokeStyle = selected ? this.options.color.highlight.border : hover ? this.options.color.hover.border : this.options.color.border; - - // set a fillstyle - ctx.fillStyle = selected ? this.options.color.highlight.background : hover ? this.options.color.hover.background : this.options.color.background; - - // draw a rectangle to form the border around. This rectangle is filled so the opacity of a picture (in future vis releases?) can be used to tint the image - ctx.rect(this.left - 0.5 * ctx.lineWidth, this.top - 0.5 * ctx.lineWidth, this.width + ctx.lineWidth, this.height + ctx.lineWidth); - ctx.fill(); - - this.performStroke(ctx, values); - - ctx.closePath(); + this.defaultOptions = { + borderWidth: 1, + borderWidthSelected: 2, + brokenImage: undefined, + color: { + border: '#2B7CE9', + background: '#97C2FC', + highlight: { + border: '#2B7CE9', + background: '#D2E5FF' + }, + hover: { + border: '#2B7CE9', + background: '#D2E5FF' } - - this._drawImageAtPosition(ctx, values); - - this._drawImageLabel(ctx, x, y, selected, hover); - - this.updateBoundingBox(x, y); - } - }, { - key: 'updateBoundingBox', - value: function updateBoundingBox(x, y) { - this.resize(); - this._updateBoundingBox(x, y); - - if (this.options.label !== undefined && this.labelModule.size.width > 0) { - this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); - this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); - this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset); + }, + fixed: { + x: false, + y: false + }, + font: { + color: '#343434', + size: 14, // px + face: 'arial', + background: 'none', + strokeWidth: 0, // px + strokeColor: '#ffffff', + align: 'center', + vadjust: 0, + multi: false, + bold: { + mod: 'bold' + }, + boldital: { + mod: 'bold italic' + }, + ital: { + mod: 'italic' + }, + mono: { + mod: '', + size: 15, // px + face: 'monospace', + vadjust: 2 } - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); - } - }]); - return Image; - }(_CircleImageBase3['default']); - - exports['default'] = Image; - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; + }, + group: undefined, + hidden: false, + icon: { + face: 'FontAwesome', //'FontAwesome', + code: undefined, //'\uf007', + size: 50, //50, + color: '#2B7CE9' //'#aa00ff' + }, + image: undefined, // --> URL + label: undefined, + labelHighlightBold: true, + level: undefined, + margin: { + top: 5, + right: 5, + bottom: 5, + left: 5 + }, + mass: 1, + physics: true, + scaling: { + min: 10, + max: 30, + label: { + enabled: false, + min: 14, + max: 30, + maxVisible: 30, + drawThreshold: 5 + }, + customScalingFunction: function customScalingFunction(min, max, total, value) { + if (max === min) { + return 0.5; + } else { + var scale = 1 / (max - min); + return Math.max(0, (value - min) * scale); + } + } + }, + shadow: { + enabled: false, + color: 'rgba(0,0,0,0.5)', + size: 10, + x: 5, + y: 5 + }, + shape: 'ellipse', + shapeProperties: { + borderDashes: false, // only for borders + borderRadius: 6, // only for box shape + interpolation: true, // only for image and circularImage shapes + useImageSize: false, // only for image and circularImage shapes + useBorderWithImage: false // only for image shape + }, + size: 25, + title: undefined, + value: undefined, + x: undefined, + y: undefined + }; - Object.defineProperty(exports, "__esModule", { - value: true - }); + // Protect from idiocy + if (this.defaultOptions.mass <= 0) { + throw 'Internal error: mass in defaultOptions of NodesHandler may not be zero or negative'; + } - var _getPrototypeOf = __webpack_require__(176); + this.options = util.bridgeObject(this.defaultOptions); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + this.bindEventListeners(); + } - var _classCallCheck2 = __webpack_require__(135); + /** + * Binds event listeners + */ - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _createClass2 = __webpack_require__(136); + (0, _createClass3['default'])(NodesHandler, [{ + key: 'bindEventListeners', + value: function bindEventListeners() { + var _this2 = this; - var _createClass3 = _interopRequireDefault(_createClass2); + // refresh the nodes. Used when reverting from hierarchical layout + this.body.emitter.on('refreshNodes', this.refresh.bind(this)); + this.body.emitter.on('refresh', this.refresh.bind(this)); + this.body.emitter.on('destroy', function () { + util.forEach(_this2.nodesListeners, function (callback, event) { + if (_this2.body.data.nodes) _this2.body.data.nodes.off(event, callback); + }); + delete _this2.body.functions.createNode; + delete _this2.nodesListeners.add; + delete _this2.nodesListeners.update; + delete _this2.nodesListeners.remove; + delete _this2.nodesListeners; + }); + } - var _possibleConstructorReturn2 = __webpack_require__(179); + /** + * + * @param {Object} options + */ - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + }, { + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + Node.parseOptions(this.options, options); - var _inherits2 = __webpack_require__(180); + // update the shape in all nodes + if (options.shape !== undefined) { + for (var nodeId in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(nodeId)) { + this.body.nodes[nodeId].updateShape(); + } + } + } - var _inherits3 = _interopRequireDefault(_inherits2); + // update the font in all nodes + if (options.font !== undefined) { + for (var _nodeId in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(_nodeId)) { + this.body.nodes[_nodeId].updateLabelModule(); + this.body.nodes[_nodeId].needsRefresh(); + } + } + } - var _ShapeBase2 = __webpack_require__(191); + // update the shape size in all nodes + if (options.size !== undefined) { + for (var _nodeId2 in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(_nodeId2)) { + this.body.nodes[_nodeId2].needsRefresh(); + } + } + } - var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); + // update the state of the variables if needed + if (options.hidden !== undefined || options.physics !== undefined) { + this.body.emitter.emit('_dataChanged'); + } + } + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * Set a data set with nodes for the network + * @param {Array | DataSet | DataView} nodes The data containing the nodes. + * @param {boolean} [doNotEmit=false] + * @private + */ - var Square = function (_ShapeBase) { - (0, _inherits3['default'])(Square, _ShapeBase); + }, { + key: 'setData', + value: function setData(nodes) { + var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - function Square(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Square); - return (0, _possibleConstructorReturn3['default'])(this, (Square.__proto__ || (0, _getPrototypeOf2['default'])(Square)).call(this, options, body, labelModule)); - } + var oldNodesData = this.body.data.nodes; - (0, _createClass3['default'])(Square, [{ - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this._drawShape(ctx, 'square', 2, x, y, selected, hover, values); + if (nodes instanceof DataSet || nodes instanceof DataView) { + this.body.data.nodes = nodes; + } else if (Array.isArray(nodes)) { + this.body.data.nodes = new DataSet(); + this.body.data.nodes.add(nodes); + } else if (!nodes) { + this.body.data.nodes = new DataSet(); + } else { + throw new TypeError('Array or DataSet expected'); } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); + + if (oldNodesData) { + // unsubscribe from old dataset + util.forEach(this.nodesListeners, function (callback, event) { + oldNodesData.off(event, callback); + }); } - }]); - return Square; - }(_ShapeBase3['default']); - exports['default'] = Square; + // remove drawn nodes + this.body.nodes = {}; -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.body.data.nodes) { + // subscribe to new dataset + var me = this; + util.forEach(this.nodesListeners, function (callback, event) { + me.body.data.nodes.on(event, callback); + }); - 'use strict'; + // draw all new nodes + var ids = this.body.data.nodes.getIds(); + this.add(ids, true); + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + if (doNotEmit === false) { + this.body.emitter.emit("_dataChanged"); + } + } + + /** + * Add nodes + * @param {number[] | string[]} ids + * @param {boolean} [doNotEmit=false] + * @private + */ - var _getPrototypeOf = __webpack_require__(176); + }, { + key: 'add', + value: function add(ids) { + var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + var id = void 0; + var newNodes = []; + for (var i = 0; i < ids.length; i++) { + id = ids[i]; + var properties = this.body.data.nodes.get(id); + var node = this.create(properties); + newNodes.push(node); + this.body.nodes[id] = node; // note: this may replace an existing node + } - var _classCallCheck2 = __webpack_require__(135); + this.layoutEngine.positionInitially(newNodes); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + if (doNotEmit === false) { + this.body.emitter.emit("_dataChanged"); + } + } - var _createClass2 = __webpack_require__(136); + /** + * Update existing nodes, or create them when not yet existing + * @param {number[] | string[]} ids id's of changed nodes + * @param {Array} changedData array with changed data + * @param {Array|undefined} oldData optional; array with previous data + * @private + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'update', + value: function update(ids, changedData, oldData) { + var nodes = this.body.nodes; + var dataChanged = false; + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + var node = nodes[id]; + var data = changedData[i]; + if (node !== undefined) { + // update node + if (node.setOptions(data)) { + dataChanged = true; + } + } else { + dataChanged = true; + // create node + node = this.create(data); + nodes[id] = node; + } + } - var _possibleConstructorReturn2 = __webpack_require__(179); + if (!dataChanged && oldData !== undefined) { + // Check for any changes which should trigger a layout recalculation + // For now, this is just 'level' for hierarchical layout + // Assumption: old and new data arranged in same order; at time of writing, this holds. + dataChanged = changedData.some(function (newValue, index) { + var oldValue = oldData[index]; + return oldValue && oldValue.level !== newValue.level; + }); + } - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + if (dataChanged === true) { + this.body.emitter.emit("_dataChanged"); + } else { + this.body.emitter.emit("_dataUpdated"); + } + } - var _inherits2 = __webpack_require__(180); + /** + * Remove existing nodes. If nodes do not exist, the method will just ignore it. + * @param {number[] | string[]} ids + * @private + */ - var _inherits3 = _interopRequireDefault(_inherits2); + }, { + key: 'remove', + value: function remove(ids) { + var nodes = this.body.nodes; - var _ShapeBase2 = __webpack_require__(191); + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + delete nodes[id]; + } - var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); + this.body.emitter.emit("_dataChanged"); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * create a node + * @param {Object} properties + * @param {class} [constructorClass=Node.default] + * @returns {*} + */ - var Star = function (_ShapeBase) { - (0, _inherits3['default'])(Star, _ShapeBase); + }, { + key: 'create', + value: function create(properties) { + var constructorClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Node; - function Star(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Star); - return (0, _possibleConstructorReturn3['default'])(this, (Star.__proto__ || (0, _getPrototypeOf2['default'])(Star)).call(this, options, body, labelModule)); + return new constructorClass(properties, this.body, this.images, this.groups, this.options, this.defaultOptions); } - (0, _createClass3['default'])(Star, [{ - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this._drawShape(ctx, 'star', 4, x, y, selected, hover, values); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); - } - }]); - return Star; - }(_ShapeBase3['default']); + /** + * + * @param {boolean} [clearPositions=false] + */ - exports['default'] = Star; + }, { + key: 'refresh', + value: function refresh() { + var _this3 = this; -/***/ }), -/* 198 */ -/***/ (function(module, exports, __webpack_require__) { + var clearPositions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - 'use strict'; + util.forEach(this.body.nodes, function (node, nodeId) { + var data = _this3.body.data.nodes.get(nodeId); + if (data !== undefined) { + if (clearPositions === true) { + node.setOptions({ x: null, y: null }); + } + node.setOptions({ fixed: false }); + node.setOptions(data); + } + }); + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * Returns the positions of the nodes. + * @param {Array.|String} [ids] --> optional, can be array of nodeIds, can be string + * @returns {{}} + */ - var _getPrototypeOf = __webpack_require__(176); + }, { + key: 'getPositions', + value: function getPositions(ids) { + var dataArray = {}; + if (ids !== undefined) { + if (Array.isArray(ids) === true) { + for (var i = 0; i < ids.length; i++) { + if (this.body.nodes[ids[i]] !== undefined) { + var node = this.body.nodes[ids[i]]; + dataArray[ids[i]] = { x: Math.round(node.x), y: Math.round(node.y) }; + } + } + } else { + if (this.body.nodes[ids] !== undefined) { + var _node = this.body.nodes[ids]; + dataArray[ids] = { x: Math.round(_node.x), y: Math.round(_node.y) }; + } + } + } else { + for (var _i = 0; _i < this.body.nodeIndices.length; _i++) { + var _node2 = this.body.nodes[this.body.nodeIndices[_i]]; + dataArray[this.body.nodeIndices[_i]] = { x: Math.round(_node2.x), y: Math.round(_node2.y) }; + } + } + return dataArray; + } - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + /** + * Load the XY positions of the nodes into the dataset. + */ - var _classCallCheck2 = __webpack_require__(135); + }, { + key: 'storePositions', + value: function storePositions() { + // todo: add support for clusters and hierarchical. + var dataArray = []; + var dataset = this.body.data.nodes.getDataSet(); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + for (var nodeId in dataset._data) { + if (dataset._data.hasOwnProperty(nodeId)) { + var node = this.body.nodes[nodeId]; + if (dataset._data[nodeId].x != Math.round(node.x) || dataset._data[nodeId].y != Math.round(node.y)) { + dataArray.push({ id: node.id, x: Math.round(node.x), y: Math.round(node.y) }); + } + } + } + dataset.update(dataArray); + } - var _createClass2 = __webpack_require__(136); + /** + * get the bounding box of a node. + * @param {Node.id} nodeId + * @returns {j|*} + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'getBoundingBox', + value: function getBoundingBox(nodeId) { + if (this.body.nodes[nodeId] !== undefined) { + return this.body.nodes[nodeId].shape.boundingBox; + } + } - var _possibleConstructorReturn2 = __webpack_require__(179); + /** + * Get the Ids of nodes connected to this node. + * @param {Node.id} nodeId + * @param {'to'|'from'|undefined} direction values 'from' and 'to' select respectively parent and child nodes only. + * Any other value returns both parent and child nodes. + * @returns {Array} + */ - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + }, { + key: 'getConnectedNodes', + value: function getConnectedNodes(nodeId, direction) { + var nodeList = []; + if (this.body.nodes[nodeId] !== undefined) { + var node = this.body.nodes[nodeId]; + var nodeObj = {}; // used to quickly check if node already exists + for (var i = 0; i < node.edges.length; i++) { + var edge = node.edges[i]; + if (direction !== 'to' && edge.toId == node.id) { + // these are double equals since ids can be numeric or string + if (nodeObj[edge.fromId] === undefined) { + nodeList.push(edge.fromId); + nodeObj[edge.fromId] = true; + } + } else if (direction !== 'from' && edge.fromId == node.id) { + // these are double equals since ids can be numeric or string + if (nodeObj[edge.toId] === undefined) { + nodeList.push(edge.toId); + nodeObj[edge.toId] = true; + } + } + } + } + return nodeList; + } - var _inherits2 = __webpack_require__(180); + /** + * Get the ids of the edges connected to this node. + * @param {Node.id} nodeId + * @returns {*} + */ - var _inherits3 = _interopRequireDefault(_inherits2); + }, { + key: 'getConnectedEdges', + value: function getConnectedEdges(nodeId) { + var edgeList = []; + if (this.body.nodes[nodeId] !== undefined) { + var node = this.body.nodes[nodeId]; + for (var i = 0; i < node.edges.length; i++) { + edgeList.push(node.edges[i].id); + } + } else { + console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId); + } + return edgeList; + } - var _NodeBase2 = __webpack_require__(185); + /** + * Move a node. + * + * @param {Node.id} nodeId + * @param {number} x + * @param {number} y + */ - var _NodeBase3 = _interopRequireDefault(_NodeBase2); + }, { + key: 'moveNode', + value: function moveNode(nodeId, x, y) { + var _this4 = this; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + if (this.body.nodes[nodeId] !== undefined) { + this.body.nodes[nodeId].x = Number(x); + this.body.nodes[nodeId].y = Number(y); + setTimeout(function () { + _this4.body.emitter.emit("startSimulation"); + }, 0); + } else { + console.log("Node id supplied to moveNode does not exist. Provided: ", nodeId); + } + } + }]); + return NodesHandler; +}(); - var Text = function (_NodeBase) { - (0, _inherits3['default'])(Text, _NodeBase); +exports['default'] = NodesHandler; - function Text(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Text); +/***/ }), +/* 188 */ +/***/ (function(module, exports, __webpack_require__) { - var _this = (0, _possibleConstructorReturn3['default'])(this, (Text.__proto__ || (0, _getPrototypeOf2['default'])(Text)).call(this, options, body, labelModule)); +module.exports = { "default": __webpack_require__(189), __esModule: true }; - _this._setMargins(labelModule); - return _this; - } +/***/ }), +/* 189 */ +/***/ (function(module, exports, __webpack_require__) { - (0, _createClass3['default'])(Text, [{ - key: 'resize', - value: function resize(ctx, selected, hover) { - if (this.needsRefresh(selected, hover)) { - this.textSize = this.labelModule.getTextSize(ctx, selected, hover); - this.width = this.textSize.width + this.margin.right + this.margin.left; - this.height = this.textSize.height + this.margin.top + this.margin.bottom; - this.radius = 0.5 * this.width; - } - } - }, { - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this.resize(ctx, selected, hover); - this.left = x - this.width / 2; - this.top = y - this.height / 2; +__webpack_require__(49); +__webpack_require__(60); +module.exports = __webpack_require__(190); - // draw shadow if enabled - this.enableShadow(ctx, values); - this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); - // disable shadows for other elements. - this.disableShadow(ctx, values); +/***/ }), +/* 190 */ +/***/ (function(module, exports, __webpack_require__) { - this.updateBoundingBox(x, y, ctx, selected, hover); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); - } - }]); - return Text; - }(_NodeBase3['default']); +var classof = __webpack_require__(86); +var ITERATOR = __webpack_require__(13)('iterator'); +var Iterators = __webpack_require__(31); +module.exports = __webpack_require__(7).isIterable = function (it) { + var O = Object(it); + return O[ITERATOR] !== undefined + || '@@iterator' in O + // eslint-disable-next-line no-prototype-builtins + || Iterators.hasOwnProperty(classof(O)); +}; - exports['default'] = Text; /***/ }), -/* 199 */ +/* 191 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _getPrototypeOf = __webpack_require__(176); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +var _classCallCheck2 = __webpack_require__(0); - var _classCallCheck2 = __webpack_require__(135); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _createClass2 = __webpack_require__(1); - var _createClass2 = __webpack_require__(136); +var _createClass3 = _interopRequireDefault(_createClass2); - var _createClass3 = _interopRequireDefault(_createClass2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _possibleConstructorReturn2 = __webpack_require__(179); +var LabelAccumulator = __webpack_require__(192)['default']; +var ComponentUtil = __webpack_require__(48)['default']; - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +/** + * Helper class for Label which explodes the label text into lines and blocks within lines + * + * @private + */ - var _inherits2 = __webpack_require__(180); +var LabelSplitter = function () { - var _inherits3 = _interopRequireDefault(_inherits2); + /** + * @param {CanvasRenderingContext2D} ctx Canvas rendering context + * @param {Label} parent reference to the Label instance using current instance + * @param {boolean} selected + * @param {boolean} hover + */ + function LabelSplitter(ctx, parent, selected, hover) { + var _this = this; - var _ShapeBase2 = __webpack_require__(191); + (0, _classCallCheck3['default'])(this, LabelSplitter); - var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); + this.ctx = ctx; + this.parent = parent; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * Callback to determine text width; passed to LabelAccumulator instance + * + * @param {String} text string to determine width of + * @param {String} mod font type to use for this text + * @return {Object} { width, values} width in pixels and font attributes + */ + var textWidth = function textWidth(text, mod) { + if (text === undefined) return 0; - var Triangle = function (_ShapeBase) { - (0, _inherits3['default'])(Triangle, _ShapeBase); + // TODO: This can be done more efficiently with caching + var values = _this.parent.getFormattingValues(ctx, selected, hover, mod); - function Triangle(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, Triangle); - return (0, _possibleConstructorReturn3['default'])(this, (Triangle.__proto__ || (0, _getPrototypeOf2['default'])(Triangle)).call(this, options, body, labelModule)); - } - - (0, _createClass3['default'])(Triangle, [{ - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this._drawShape(ctx, 'triangle', 3, x, y, selected, hover, values); + var width = 0; + if (text !== '') { + // NOTE: The following may actually be *incorrect* for the mod fonts! + // This returns the size with a regular font, bold etc. may + // have different sizes. + var measure = _this.ctx.measureText(text); + width = measure.width; } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); + + return { width: width, values: values }; + }; + + this.lines = new LabelAccumulator(textWidth); + } + + /** + * Split passed text of a label into lines and blocks. + * + * # NOTE + * + * The handling of spacing is option dependent: + * + * - if `font.multi : false`, all spaces are retained + * - if `font.multi : true`, every sequence of spaces is compressed to a single space + * + * This might not be the best way to do it, but this is as it has been working till now. + * In order not to break existing functionality, for the time being this behaviour will + * be retained in any code changes. + * + * @param {string} text text to split + * @returns {Array} + */ + + + (0, _createClass3['default'])(LabelSplitter, [{ + key: 'process', + value: function process(text) { + if (!ComponentUtil.isValidLabel(text)) { + return this.lines.finalize(); } - }]); - return Triangle; - }(_ShapeBase3['default']); - exports['default'] = Triangle; + var font = this.parent.fontOptions; -/***/ }), -/* 200 */ -/***/ (function(module, exports, __webpack_require__) { + // Normalize the end-of-line's to a single representation - order important + text = text.replace(/\r\n/g, '\n'); // Dos EOL's + text = text.replace(/\r/g, '\n'); // Mac EOL's - 'use strict'; + // Note that at this point, there can be no \r's in the text. + // This is used later on splitStringIntoLines() to split multifont texts. - Object.defineProperty(exports, "__esModule", { - value: true - }); + var nlLines = String(text).split('\n'); + var lineCount = nlLines.length; - var _getPrototypeOf = __webpack_require__(176); + if (font.multi) { + // Multi-font case: styling tags active + for (var i = 0; i < lineCount; i++) { + var blocks = this.splitBlocks(nlLines[i], font.multi); + // Post: Sequences of tabs and spaces are reduced to single space - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + if (blocks === undefined) continue; - var _classCallCheck2 = __webpack_require__(135); + if (blocks.length === 0) { + this.lines.newLine(""); + continue; + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + if (font.maxWdt > 0) { + // widthConstraint.maximum defined + //console.log('Running widthConstraint multi, max: ' + this.fontOptions.maxWdt); + for (var j = 0; j < blocks.length; j++) { + var mod = blocks[j].mod; + var _text = blocks[j].text; + this.splitStringIntoLines(_text, mod, true); + } + } else { + // widthConstraint.maximum NOT defined + for (var _j = 0; _j < blocks.length; _j++) { + var _mod = blocks[_j].mod; + var _text2 = blocks[_j].text; + this.lines.append(_text2, _mod); + } + } - var _createClass2 = __webpack_require__(136); + this.lines.newLine(); + } + } else { + // Single-font case + if (font.maxWdt > 0) { + // widthConstraint.maximum defined + // console.log('Running widthConstraint normal, max: ' + this.fontOptions.maxWdt); + for (var _i = 0; _i < lineCount; _i++) { + this.splitStringIntoLines(nlLines[_i]); + } + } else { + // widthConstraint.maximum NOT defined + for (var _i2 = 0; _i2 < lineCount; _i2++) { + this.lines.newLine(nlLines[_i2]); + } + } + } - var _createClass3 = _interopRequireDefault(_createClass2); + return this.lines.finalize(); + } - var _possibleConstructorReturn2 = __webpack_require__(179); + /** + * normalize the markup system + * + * @param {boolean|'md'|'markdown'|'html'} markupSystem + * @returns {string} + */ - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + }, { + key: 'decodeMarkupSystem', + value: function decodeMarkupSystem(markupSystem) { + var system = 'none'; + if (markupSystem === 'markdown' || markupSystem === 'md') { + system = 'markdown'; + } else if (markupSystem === true || markupSystem === 'html') { + system = 'html'; + } + return system; + } - var _inherits2 = __webpack_require__(180); + /** + * + * @param {string} text + * @returns {Array} + */ - var _inherits3 = _interopRequireDefault(_inherits2); + }, { + key: 'splitHtmlBlocks', + value: function splitHtmlBlocks(text) { + var blocks = []; + + // TODO: consolidate following + methods/closures with splitMarkdownBlocks() + // NOTE: sequences of tabs and spaces are reduced to single space; scan usage of `this.spacing` within method + var s = { + bold: false, + ital: false, + mono: false, + spacing: false, + position: 0, + buffer: "", + modStack: [] + }; - var _ShapeBase2 = __webpack_require__(191); + s.mod = function () { + return this.modStack.length === 0 ? 'normal' : this.modStack[0]; + }; - var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); + s.modName = function () { + if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else { + if (s.bold && s.ital) { + return 'boldital'; + } else if (s.bold) { + return 'bold'; + } else if (s.ital) { + return 'ital'; + } + } + }; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + s.emitBlock = function () { + var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + // eslint-disable-line no-unused-vars + if (this.spacing) { + this.add(" "); + this.spacing = false; + } + if (this.buffer.length > 0) { + blocks.push({ text: this.buffer, mod: this.modName() }); + this.buffer = ""; + } + }; - var TriangleDown = function (_ShapeBase) { - (0, _inherits3['default'])(TriangleDown, _ShapeBase); + s.add = function (text) { + if (text === " ") { + s.spacing = true; + } + if (s.spacing) { + this.buffer += " "; + this.spacing = false; + } + if (text != " ") { + this.buffer += text; + } + }; - function TriangleDown(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, TriangleDown); - return (0, _possibleConstructorReturn3['default'])(this, (TriangleDown.__proto__ || (0, _getPrototypeOf2['default'])(TriangleDown)).call(this, options, body, labelModule)); + while (s.position < text.length) { + var ch = text.charAt(s.position); + if (/[ \t]/.test(ch)) { + if (!s.mono) { + s.spacing = true; + } else { + s.add(ch); + } + } else if (//.test(text.substr(s.position, 3))) { + s.emitBlock(); + s.bold = true; + s.modStack.unshift("bold"); + s.position += 2; + } else if (!s.mono && !s.ital && //.test(text.substr(s.position, 3))) { + s.emitBlock(); + s.ital = true; + s.modStack.unshift("ital"); + s.position += 2; + } else if (!s.mono && //.test(text.substr(s.position, 6))) { + s.emitBlock(); + s.mono = true; + s.modStack.unshift("mono"); + s.position += 5; + } else if (!s.mono && s.mod() === 'bold' && /<\/b>/.test(text.substr(s.position, 4))) { + s.emitBlock(); + s.bold = false; + s.modStack.shift(); + s.position += 3; + } else if (!s.mono && s.mod() === 'ital' && /<\/i>/.test(text.substr(s.position, 4))) { + s.emitBlock(); + s.ital = false; + s.modStack.shift(); + s.position += 3; + } else if (s.mod() === 'mono' && /<\/code>/.test(text.substr(s.position, 7))) { + s.emitBlock(); + s.mono = false; + s.modStack.shift(); + s.position += 6; + } else { + s.add(ch); + } + } else if (/&/.test(ch)) { + if (/</.test(text.substr(s.position, 4))) { + s.add("<"); + s.position += 3; + } else if (/&/.test(text.substr(s.position, 5))) { + s.add("&"); + s.position += 4; + } else { + s.add("&"); + } + } else { + s.add(ch); + } + s.position++; + } + s.emitBlock(); + return blocks; } - (0, _createClass3['default'])(TriangleDown, [{ - key: 'draw', - value: function draw(ctx, x, y, selected, hover, values) { - this._drawShape(ctx, 'triangleDown', 3, x, y, selected, hover, values); - } - }, { - key: 'distanceToBorder', - value: function distanceToBorder(ctx, angle) { - return this._distanceToBorder(ctx, angle); - } - }]); - return TriangleDown; - }(_ShapeBase3['default']); + /** + * + * @param {string} text + * @returns {Array} + */ - exports['default'] = TriangleDown; + }, { + key: 'splitMarkdownBlocks', + value: function splitMarkdownBlocks(text) { + var blocks = []; + + // TODO: consolidate following + methods/closures with splitHtmlBlocks() + // NOTE: sequences of tabs and spaces are reduced to single space; scan usage of `this.spacing` within method + var s = { + bold: false, + ital: false, + mono: false, + beginable: true, + spacing: false, + position: 0, + buffer: "", + modStack: [] + }; -/***/ }), -/* 201 */ -/***/ (function(module, exports, __webpack_require__) { + s.mod = function () { + return this.modStack.length === 0 ? 'normal' : this.modStack[0]; + }; - 'use strict'; + s.modName = function () { + if (this.modStack.length === 0) return 'normal';else if (this.modStack[0] === 'mono') return 'mono';else { + if (s.bold && s.ital) { + return 'boldital'; + } else if (s.bold) { + return 'bold'; + } else if (s.ital) { + return 'ital'; + } + } + }; - Object.defineProperty(exports, "__esModule", { - value: true - }); + s.emitBlock = function () { + var override = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + // eslint-disable-line no-unused-vars + if (this.spacing) { + this.add(" "); + this.spacing = false; + } + if (this.buffer.length > 0) { + blocks.push({ text: this.buffer, mod: this.modName() }); + this.buffer = ""; + } + }; - var _classCallCheck2 = __webpack_require__(135); + s.add = function (text) { + if (text === " ") { + s.spacing = true; + } + if (s.spacing) { + this.buffer += " "; + this.spacing = false; + } + if (text != " ") { + this.buffer += text; + } + }; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + while (s.position < text.length) { + var ch = text.charAt(s.position); + if (/[ \t]/.test(ch)) { + if (!s.mono) { + s.spacing = true; + } else { + s.add(ch); + } + s.beginable = true; + } else if (/\\/.test(ch)) { + if (s.position < text.length + 1) { + s.position++; + ch = text.charAt(s.position); + if (/ \t/.test(ch)) { + s.spacing = true; + } else { + s.add(ch); + s.beginable = false; + } + } + } else if (!s.mono && !s.bold && (s.beginable || s.spacing) && /\*/.test(ch)) { + s.emitBlock(); + s.bold = true; + s.modStack.unshift("bold"); + } else if (!s.mono && !s.ital && (s.beginable || s.spacing) && /\_/.test(ch)) { + s.emitBlock(); + s.ital = true; + s.modStack.unshift("ital"); + } else if (!s.mono && (s.beginable || s.spacing) && /`/.test(ch)) { + s.emitBlock(); + s.mono = true; + s.modStack.unshift("mono"); + } else if (!s.mono && s.mod() === "bold" && /\*/.test(ch)) { + if (s.position === text.length - 1 || /[.,_` \t\n]/.test(text.charAt(s.position + 1))) { + s.emitBlock(); + s.bold = false; + s.modStack.shift(); + } else { + s.add(ch); + } + } else if (!s.mono && s.mod() === "ital" && /\_/.test(ch)) { + if (s.position === text.length - 1 || /[.,*` \t\n]/.test(text.charAt(s.position + 1))) { + s.emitBlock(); + s.ital = false; + s.modStack.shift(); + } else { + s.add(ch); + } + } else if (s.mono && s.mod() === "mono" && /`/.test(ch)) { + if (s.position === text.length - 1 || /[.,*_ \t\n]/.test(text.charAt(s.position + 1))) { + s.emitBlock(); + s.mono = false; + s.modStack.shift(); + } else { + s.add(ch); + } + } else { + s.add(ch); + s.beginable = false; + } + s.position++; + } + s.emitBlock(); + return blocks; + } - var _createClass2 = __webpack_require__(136); + /** + * Explodes a piece of text into single-font blocks using a given markup + * + * @param {string} text + * @param {boolean|'md'|'markdown'|'html'} markupSystem + * @returns {Array.<{text: string, mod: string}>} + * @private + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'splitBlocks', + value: function splitBlocks(text, markupSystem) { + var system = this.decodeMarkupSystem(markupSystem); + if (system === 'none') { + return [{ + text: text, + mod: 'normal' + }]; + } else if (system === 'markdown') { + return this.splitMarkdownBlocks(text); + } else if (system === 'html') { + return this.splitHtmlBlocks(text); + } + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * @param {string} text + * @returns {boolean} true if text length over the current max with + * @private + */ - var util = __webpack_require__(1); - var DataSet = __webpack_require__(89); - var DataView = __webpack_require__(93); + }, { + key: 'overMaxWidth', + value: function overMaxWidth(text) { + var width = this.ctx.measureText(text).width; + return this.lines.curWidth() + width > this.parent.fontOptions.maxWdt; + } - var Edge = __webpack_require__(202)['default']; - var Label = __webpack_require__(170)['default']; - var LayoutEngine = __webpack_require__(210)['default']; // For access to LayoutEngine.getStaticType() + /** + * Determine the longest part of the sentence which still fits in the + * current max width. + * + * @param {Array} words Array of strings signifying a text lines + * @return {number} index of first item in string making string go over max + * @private + */ - var EdgesHandler = function () { - function EdgesHandler(body, images, groups) { - var _this = this; + }, { + key: 'getLongestFit', + value: function getLongestFit(words) { + var text = ''; + var w = 0; - (0, _classCallCheck3['default'])(this, EdgesHandler); + while (w < words.length) { + var pre = text === '' ? '' : ' '; + var newText = text + pre + words[w]; - this.body = body; - this.images = images; - this.groups = groups; + if (this.overMaxWidth(newText)) break; + text = newText; + w++; + } - // create the edge API in the body container - this.body.functions.createEdge = this.create.bind(this); + return w; + } - this.edgesListeners = { - add: function add(event, params) { - _this.add(params.items); - }, - update: function update(event, params) { - _this.update(params.items); - }, - remove: function remove(event, params) { - _this.remove(params.items); - } - }; + /** + * Determine the longest part of the string which still fits in the + * current max width. + * + * @param {Array} words Array of strings signifying a text lines + * @return {number} index of first item in string making string go over max + */ - this.options = {}; - this.defaultOptions = { - arrows: { - to: { enabled: false, scaleFactor: 1, type: 'arrow' }, // boolean / {arrowScaleFactor:1} / {enabled: false, arrowScaleFactor:1} - middle: { enabled: false, scaleFactor: 1, type: 'arrow' }, - from: { enabled: false, scaleFactor: 1, type: 'arrow' } - }, - arrowStrikethrough: true, - color: { - color: '#848484', - highlight: '#848484', - hover: '#848484', - inherit: 'from', - opacity: 1.0 - }, - dashes: false, - font: { - color: '#343434', - size: 14, // px - face: 'arial', - background: 'none', - strokeWidth: 2, // px - strokeColor: '#ffffff', - align: 'horizontal', - multi: false, - vadjust: 0, - bold: { - mod: 'bold' - }, - boldital: { - mod: 'bold italic' - }, - ital: { - mod: 'italic' - }, - mono: { - mod: '', - size: 15, // px - face: 'courier new', - vadjust: 2 - } - }, - hidden: false, - hoverWidth: 1.5, - label: undefined, - labelHighlightBold: true, - length: undefined, - physics: true, - scaling: { - min: 1, - max: 15, - label: { - enabled: true, - min: 14, - max: 30, - maxVisible: 30, - drawThreshold: 5 - }, - customScalingFunction: function customScalingFunction(min, max, total, value) { - if (max === min) { - return 0.5; - } else { - var scale = 1 / (max - min); - return Math.max(0, (value - min) * scale); - } - } - }, - selectionWidth: 1.5, - selfReferenceSize: 20, - shadow: { - enabled: false, - color: 'rgba(0,0,0,0.5)', - size: 10, - x: 5, - y: 5 - }, - smooth: { - enabled: true, - type: "dynamic", - forceDirection: 'none', - roundness: 0.5 - }, - title: undefined, - width: 1, - value: undefined - }; + }, { + key: 'getLongestFitWord', + value: function getLongestFitWord(words) { + var w = 0; - util.extend(this.options, this.defaultOptions); + while (w < words.length) { + if (this.overMaxWidth(words.slice(0, w))) break; + w++; + } - this.bindEventListeners(); + return w; } - (0, _createClass3['default'])(EdgesHandler, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this2 = this; + /** + * Split the passed text into lines, according to width constraint (if any). + * + * The method assumes that the input string is a single line, i.e. without lines break. + * + * This method retains spaces, if still present (case `font.multi: false`). + * A space which falls on an internal line break, will be replaced by a newline. + * There is no special handling of tabs; these go along with the flow. + * + * @param {string} str + * @param {string} [mod='normal'] + * @param {boolean} [appendLast=false] + * @private + */ - // this allows external modules to force all dynamic curves to turn static. - this.body.emitter.on("_forceDisableDynamicCurves", function (type) { - var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + }, { + key: 'splitStringIntoLines', + value: function splitStringIntoLines(str) { + var mod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal'; + var appendLast = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - if (type === 'dynamic') { - type = 'continuous'; - } - var dataChanged = false; - for (var edgeId in _this2.body.edges) { - if (_this2.body.edges.hasOwnProperty(edgeId)) { - var edge = _this2.body.edges[edgeId]; - var edgeData = _this2.body.data.edges._data[edgeId]; + // Still-present spaces are relevant, retain them + str = str.replace(/^( +)/g, '$1\r'); + str = str.replace(/([^\r][^ ]*)( +)/g, '$1\r$2\r'); + var words = str.split('\r'); - // only forcibly remove the smooth curve if the data has been set of the edge has the smooth curves defined. - // this is because a change in the global would not affect these curves. - if (edgeData !== undefined) { - var edgeOptions = edgeData.smooth; - if (edgeOptions !== undefined) { - if (edgeOptions.enabled === true && edgeOptions.type === 'dynamic') { - if (type === undefined) { - edge.setOptions({ smooth: false }); - } else { - edge.setOptions({ smooth: { type: type } }); - } - dataChanged = true; - } - } - } - } - } - if (emit === true && dataChanged === true) { - _this2.body.emitter.emit("_dataChanged"); - } - }); + while (words.length > 0) { + var w = this.getLongestFit(words); - // this is called when options of EXISTING nodes or edges have changed. - // - // NOTE: Not true, called when options have NOT changed, for both existing as well as new nodes. - // See update() for logic. - // TODO: Verify and examine the consequences of this. It might still trigger when - // non-option fields have changed, but then reconnecting edges is still useless. - // Alternatively, it might also be called when edges are removed. - // - this.body.emitter.on("_dataUpdated", function () { - _this2.reconnectEdges(); - }); + if (w === 0) { + // Special case: the first word is already larger than the max width. + var word = words[0]; - // refresh the edges. Used when reverting from hierarchical layout - this.body.emitter.on("refreshEdges", this.refresh.bind(this)); - this.body.emitter.on("refresh", this.refresh.bind(this)); - this.body.emitter.on("destroy", function () { - util.forEach(_this2.edgesListeners, function (callback, event) { - if (_this2.body.data.edges) _this2.body.data.edges.off(event, callback); - }); - delete _this2.body.functions.createEdge; - delete _this2.edgesListeners.add; - delete _this2.edgesListeners.update; - delete _this2.edgesListeners.remove; - delete _this2.edgesListeners; - }); - } - }, { - key: 'setOptions', - value: function setOptions(options) { - this.edgeOptions = options; - if (options !== undefined) { - // use the parser from the Edge class to fill in all shorthand notations - Edge.parseOptions(this.options, options); - - // update smooth settings in all edges - var dataChanged = false; - if (options.smooth !== undefined) { - for (var edgeId in this.body.edges) { - if (this.body.edges.hasOwnProperty(edgeId)) { - dataChanged = this.body.edges[edgeId].updateEdgeType() || dataChanged; - } - } - } + // Break the word to the largest part that fits the line + var x = this.getLongestFitWord(word); + this.lines.newLine(word.slice(0, x), mod); - // update fonts in all edges - if (options.font !== undefined) { - // use the parser from the Label class to fill in all shorthand notations - Label.parseOptions(this.options.font, options); - for (var _edgeId in this.body.edges) { - if (this.body.edges.hasOwnProperty(_edgeId)) { - this.body.edges[_edgeId].updateLabelModule(); - } - } + // Adjust the word, so that the rest will be done next iteration + words[0] = word.slice(x); + } else { + // skip any space that is replaced by a newline + var newW = w; + if (words[w - 1] === ' ') { + w--; + } else if (words[newW] === ' ') { + newW++; } - // update the state of the variables if needed - if (options.hidden !== undefined || options.physics !== undefined || dataChanged === true) { - this.body.emitter.emit('_dataChanged'); + var text = words.slice(0, w).join(""); + + if (w == words.length && appendLast) { + this.lines.append(text, mod); + } else { + this.lines.newLine(text, mod); } + + // Adjust the word, so that the rest will be done next iteration + words = words.slice(newW); } } + } + }]); + return LabelSplitter; +}(); - /** - * Load edges by reading the data table - * @param {Array | DataSet | DataView} edges The data containing the edges. - * @private - * @private - */ +exports['default'] = LabelSplitter; - }, { - key: 'setData', - value: function setData(edges) { - var _this3 = this; +/***/ }), +/* 192 */ +/***/ (function(module, exports, __webpack_require__) { - var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; +"use strict"; - var oldEdgesData = this.body.data.edges; - if (edges instanceof DataSet || edges instanceof DataView) { - this.body.data.edges = edges; - } else if (Array.isArray(edges)) { - this.body.data.edges = new DataSet(); - this.body.data.edges.add(edges); - } else if (!edges) { - this.body.data.edges = new DataSet(); - } else { - throw new TypeError('Array or DataSet expected'); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - // TODO: is this null or undefined or false? - if (oldEdgesData) { - // unsubscribe from old dataset - util.forEach(this.edgesListeners, function (callback, event) { - oldEdgesData.off(event, callback); - }); - } +var _assign = __webpack_require__(90); - // remove drawn edges - this.body.edges = {}; +var _assign2 = _interopRequireDefault(_assign); - // TODO: is this null or undefined or false? - if (this.body.data.edges) { - // subscribe to new dataset - util.forEach(this.edgesListeners, function (callback, event) { - _this3.body.data.edges.on(event, callback); - }); +var _classCallCheck2 = __webpack_require__(0); - // draw all new nodes - var ids = this.body.data.edges.getIds(); - this.add(ids, true); - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - this.body.emitter.emit('_adjustEdgesForHierarchicalLayout'); - if (doNotEmit === false) { - this.body.emitter.emit("_dataChanged"); - } - } +var _createClass2 = __webpack_require__(1); - /** - * Add edges - * @param {Number[] | String[]} ids - * @private - */ +var _createClass3 = _interopRequireDefault(_createClass2); - }, { - key: 'add', - value: function add(ids) { - var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var edges = this.body.edges; - var edgesData = this.body.data.edges; +/** + * Callback to determine text dimensions, using the parent label settings. + * @callback MeasureText + * @param {text} text + * @param {text} mod + * @return {Object} { width, values} width in pixels and font attributes + */ - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; +/** + * Helper class for Label which collects results of splitting labels into lines and blocks. + * + * @private + */ +var LabelAccumulator = function () { - var oldEdge = edges[id]; - if (oldEdge) { - oldEdge.disconnect(); - } + /** + * @param {MeasureText} measureText + */ + function LabelAccumulator(measureText) { + (0, _classCallCheck3["default"])(this, LabelAccumulator); - var data = edgesData.get(id, { "showInternalIds": true }); - edges[id] = this.create(data); - } + this.measureText = measureText; + this.current = 0; + this.width = 0; + this.height = 0; + this.lines = []; + } - this.body.emitter.emit('_adjustEdgesForHierarchicalLayout'); + /** + * Append given text to the given line. + * + * @param {number} l index of line to add to + * @param {string} text string to append to line + * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod='normal'] + * @private + */ - if (doNotEmit === false) { - this.body.emitter.emit("_dataChanged"); - } - } - /** - * Update existing edges, or create them when not yet existing - * @param {Number[] | String[]} ids - * @private - */ + (0, _createClass3["default"])(LabelAccumulator, [{ + key: "_add", + value: function _add(l, text) { + var mod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'normal'; - }, { - key: 'update', - value: function update(ids) { - var edges = this.body.edges; - var edgesData = this.body.data.edges; - var dataChanged = false; - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - var data = edgesData.get(id); - var edge = edges[id]; - if (edge !== undefined) { - // update edge - edge.disconnect(); - dataChanged = edge.setOptions(data) || dataChanged; // if a support node is added, data can be changed. - edge.connect(); - } else { - // create edge - this.body.edges[id] = this.create(data); - dataChanged = true; - } - } - if (dataChanged === true) { - this.body.emitter.emit('_adjustEdgesForHierarchicalLayout'); - this.body.emitter.emit("_dataChanged"); - } else { - this.body.emitter.emit("_dataUpdated"); - } + if (this.lines[l] === undefined) { + this.lines[l] = { + width: 0, + height: 0, + blocks: [] + }; } - /** - * Remove existing edges. Non existing ids will be ignored - * @param {Number[] | String[]} ids - * @private - */ + // We still need to set a block for undefined and empty texts, hence return at this point + // This is necessary because we don't know at this point if we're at the + // start of an empty line or not. + // To compensate, empty blocks are removed in `finalize()`. + // + // Empty strings should still have a height + var tmpText = text; + if (text === undefined || text === "") tmpText = " "; - }, { - key: 'remove', - value: function remove(ids) { - var edges = this.body.edges; - for (var i = 0; i < ids.length; i++) { - var id = ids[i]; - var edge = edges[id]; - if (edge !== undefined) { - edge.cleanup(); - edge.disconnect(); - delete edges[id]; - } - } + // Determine width and get the font properties + var result = this.measureText(tmpText, mod); + var block = (0, _assign2["default"])({}, result.values); + block.text = text; + block.width = result.width; + block.mod = mod; - this.body.emitter.emit("_dataChanged"); + if (text === undefined || text === "") { + block.width = 0; } - }, { - key: 'refresh', - value: function refresh() { - var edges = this.body.edges; - for (var edgeId in edges) { - var edge = undefined; - if (edges.hasOwnProperty(edgeId)) { - edge = edges[edgeId]; - } - var data = this.body.data.edges._data[edgeId]; - if (edge !== undefined && data !== undefined) { - edge.setOptions(data); + + this.lines[l].blocks.push(block); + + // Update the line width. We need this for determining if a string goes over max width + this.lines[l].width += block.width; + } + + /** + * Returns the width in pixels of the current line. + * + * @returns {number} + */ + + }, { + key: "curWidth", + value: function curWidth() { + var line = this.lines[this.current]; + if (line === undefined) return 0; + + return line.width; + } + + /** + * Add text in block to current line + * + * @param {string} text + * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod='normal'] + */ + + }, { + key: "append", + value: function append(text) { + var mod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal'; + + this._add(this.current, text, mod); + } + + /** + * Add text in block to current line and start a new line + * + * @param {string} text + * @param {'bold'|'ital'|'boldital'|'mono'|'normal'} [mod='normal'] + */ + + }, { + key: "newLine", + value: function newLine(text) { + var mod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'normal'; + + this._add(this.current, text, mod); + this.current++; + } + + /** + * Determine and set the heights of all the lines currently contained in this instance + * + * Note that width has already been set. + * + * @private + */ + + }, { + key: "determineLineHeights", + value: function determineLineHeights() { + for (var k = 0; k < this.lines.length; k++) { + var line = this.lines[k]; + + // Looking for max height of blocks in line + var height = 0; + + if (line.blocks !== undefined) { + // Can happen if text contains e.g. '\n ' + for (var l = 0; l < line.blocks.length; l++) { + var block = line.blocks[l]; + + if (height < block.height) { + height = block.height; + } } } + + line.height = height; } - }, { - key: 'create', - value: function create(properties) { - return new Edge(properties, this.body, this.options, this.defaultOptions, this.edgeOptions); + } + + /** + * Determine the full size of the label text, as determined by current lines and blocks + * + * @private + */ + + }, { + key: "determineLabelSize", + value: function determineLabelSize() { + var width = 0; + var height = 0; + for (var k = 0; k < this.lines.length; k++) { + var line = this.lines[k]; + + if (line.width > width) { + width = line.width; + } + height += line.height; } - /** - * Reconnect all edges - * @private - */ + this.width = width; + this.height = height; + } - }, { - key: 'reconnectEdges', - value: function reconnectEdges() { - var id; - var nodes = this.body.nodes; - var edges = this.body.edges; + /** + * Remove all empty blocks and empty lines we don't need + * + * This must be done after the width/height determination, + * so that these are set properly for processing here. + * + * @returns {Array} Lines with empty blocks (and some empty lines) removed + * @private + */ - for (id in nodes) { - if (nodes.hasOwnProperty(id)) { - nodes[id].edges = []; - } + }, { + key: "removeEmptyBlocks", + value: function removeEmptyBlocks() { + var tmpLines = []; + for (var k = 0; k < this.lines.length; k++) { + var line = this.lines[k]; + + // Note: an empty line in between text has width zero but is still relevant to layout. + // So we can't use width for testing empty line here + if (line.blocks.length === 0) continue; + + // Discard final empty line always + if (k === this.lines.length - 1) { + if (line.width === 0) continue; } - for (id in edges) { - if (edges.hasOwnProperty(id)) { - var edge = edges[id]; - edge.from = null; - edge.to = null; - edge.connect(); + var tmpLine = {}; + (0, _assign2["default"])(tmpLine, line); + tmpLine.blocks = []; + + var firstEmptyBlock = void 0; + var tmpBlocks = []; + for (var l = 0; l < line.blocks.length; l++) { + var block = line.blocks[l]; + if (block.width !== 0) { + tmpBlocks.push(block); + } else { + if (firstEmptyBlock === undefined) { + firstEmptyBlock = block; + } } } - } - }, { - key: 'getConnectedNodes', - value: function getConnectedNodes(edgeId) { - var nodeList = []; - if (this.body.edges[edgeId] !== undefined) { - var edge = this.body.edges[edgeId]; - if (edge.fromId !== undefined) { - nodeList.push(edge.fromId); - } - if (edge.toId !== undefined) { - nodeList.push(edge.toId); - } + + // Ensure that there is *some* text present + if (tmpBlocks.length === 0 && firstEmptyBlock !== undefined) { + tmpBlocks.push(firstEmptyBlock); } - return nodeList; + + tmpLine.blocks = tmpBlocks; + + tmpLines.push(tmpLine); } - }]); - return EdgesHandler; - }(); - exports['default'] = EdgesHandler; + return tmpLines; + } + + /** + * Set the sizes for all lines and the whole thing. + * + * @returns {{width: (number|*), height: (number|*), lines: Array}} + */ + + }, { + key: "finalize", + value: function finalize() { + //console.log(JSON.stringify(this.lines, null, 2)); + + this.determineLineHeights(); + this.determineLabelSize(); + var tmpLines = this.removeEmptyBlocks(); + + // Return a simple hash object for further processing. + return { + width: this.width, + height: this.height, + lines: tmpLines + }; + } + }]); + return LabelAccumulator; +}(); + +exports["default"] = LabelAccumulator; /***/ }), -/* 202 */ +/* 193 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _stringify = __webpack_require__(90); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getPrototypeOf = __webpack_require__(3); + +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + +var _classCallCheck2 = __webpack_require__(0); - var _stringify2 = _interopRequireDefault(_stringify); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _create = __webpack_require__(55); +var _createClass2 = __webpack_require__(1); - var _create2 = _interopRequireDefault(_create); +var _createClass3 = _interopRequireDefault(_createClass2); - var _typeof2 = __webpack_require__(62); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _typeof3 = _interopRequireDefault(_typeof2); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _classCallCheck2 = __webpack_require__(135); +var _inherits2 = __webpack_require__(5); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _inherits3 = _interopRequireDefault(_inherits2); - var _createClass2 = __webpack_require__(136); +var _NodeBase2 = __webpack_require__(23); - var _createClass3 = _interopRequireDefault(_createClass2); +var _NodeBase3 = _interopRequireDefault(_NodeBase2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/** + * A Box Node/Cluster shape. + * + * @extends NodeBase + */ +var Box = function (_NodeBase) { + (0, _inherits3['default'])(Box, _NodeBase); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Box(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Box); - var util = __webpack_require__(1); + var _this = (0, _possibleConstructorReturn3['default'])(this, (Box.__proto__ || (0, _getPrototypeOf2['default'])(Box)).call(this, options, body, labelModule)); - var Label = __webpack_require__(170)['default']; - var CubicBezierEdge = __webpack_require__(203)['default']; - var BezierEdgeDynamic = __webpack_require__(207)['default']; - var BezierEdgeStatic = __webpack_require__(208)['default']; - var StraightEdge = __webpack_require__(209)['default']; + _this._setMargins(labelModule); + return _this; + } /** - * @class Edge * - * A edge connects two nodes - * @param {Object} properties Object with options. Must contain - * At least options from and to. - * Available options: from (number), - * to (number), label (string, color (string), - * width (number), style (string), - * length (number), title (string) - * @param {Network} network A Network object, used to find and edge to - * nodes. - * @param {Object} constants An object with default values for - * example for the color + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [selected] + * @param {boolean} [hover] */ - var Edge = function () { - function Edge(options, body, globalOptions, defaultOptions, edgeOptions) { - (0, _classCallCheck3['default'])(this, Edge); - if (body === undefined) { - throw "No body provided"; - } - this.options = util.bridgeObject(globalOptions); - this.globalOptions = globalOptions; - this.defaultOptions = defaultOptions; - this.edgeOptions = edgeOptions; - this.body = body; + (0, _createClass3['default'])(Box, [{ + key: 'resize', + value: function resize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; - // initialize variables - this.id = undefined; - this.fromId = undefined; - this.toId = undefined; - this.selected = false; - this.hover = false; - this.labelDirty = true; + if (this.needsRefresh(selected, hover)) { + var dimensions = this.getDimensionsFromLabel(ctx, selected, hover); - this.baseWidth = this.options.width; - this.baseFontSize = this.options.font.size; + this.width = dimensions.width + this.margin.right + this.margin.left; + this.height = dimensions.height + this.margin.top + this.margin.bottom; + this.radius = this.width / 2; + } + } - this.from = undefined; // a node - this.to = undefined; // a node + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - this.edgeType = undefined; + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.resize(ctx, selected, hover); + this.left = x - this.width / 2; + this.top = y - this.height / 2; - this.connected = false; + this.initContextForDraw(ctx, values); + ctx.roundRect(this.left, this.top, this.width, this.height, values.borderRadius); + this.performFill(ctx, values); - this.labelModule = new Label(this.body, this.options, true /* It's an edge label */); - this.setOptions(options); + this.updateBoundingBox(x, y, ctx, selected, hover); + this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); } /** - * Set or overwrite options for the edge - * @param {Object} options an object with options - * @param doNotEmit + * + * @param {number} x width + * @param {number} y height + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover */ + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y, ctx, selected, hover) { + this._updateBoundingBox(x, y, ctx, selected, hover); - (0, _createClass3['default'])(Edge, [{ - key: 'setOptions', - value: function setOptions(options) { - if (!options) { - return; - } + var borderRadius = this.options.shapeProperties.borderRadius; // only effective for box + this._addBoundingBoxMargin(borderRadius); + } - Edge.parseOptions(this.options, options, true, this.globalOptions); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - if (options.id !== undefined) { - this.id = options.id; - } - if (options.from !== undefined) { - this.fromId = options.from; - } - if (options.to !== undefined) { - this.toId = options.to; - } - if (options.title !== undefined) { - this.title = options.title; - } - if (options.value !== undefined) { - options.value = parseFloat(options.value); - } + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + this.resize(ctx); + var borderWidth = this.options.borderWidth; - this.choosify(options); + return Math.min(Math.abs(this.width / 2 / Math.cos(angle)), Math.abs(this.height / 2 / Math.sin(angle))) + borderWidth; + } + }]); + return Box; +}(_NodeBase3['default']); - // update label Module - this.updateLabelModule(options); - this.labelModule.propagateFonts(this.edgeOptions, options, this.defaultOptions); +exports['default'] = Box; - var dataChanged = this.updateEdgeType(); +/***/ }), +/* 194 */ +/***/ (function(module, exports, __webpack_require__) { - // if anything has been updates, reset the selection width and the hover width - this._setInteractionWidths(); +__webpack_require__(195); +module.exports = __webpack_require__(7).Object.getPrototypeOf; - // A node is connected when it has a from and to node that both exist in the network.body.nodes. - this.connect(); - if (options.hidden !== undefined || options.physics !== undefined) { - dataChanged = true; - } +/***/ }), +/* 195 */ +/***/ (function(module, exports, __webpack_require__) { - return dataChanged; - } - }, { - key: 'choosify', - value: function choosify(options) { - this.chooser = true; +// 19.1.2.9 Object.getPrototypeOf(O) +var toObject = __webpack_require__(41); +var $getPrototypeOf = __webpack_require__(85); - var pile = [options, this.options, this.edgeOptions, this.defaultOptions]; +__webpack_require__(87)('getPrototypeOf', function () { + return function getPrototypeOf(it) { + return $getPrototypeOf(toObject(it)); + }; +}); - var chosen = util.topMost(pile, 'chosen'); - if (typeof chosen === 'boolean') { - this.chooser = chosen; - } else if ((typeof chosen === 'undefined' ? 'undefined' : (0, _typeof3['default'])(chosen)) === 'object') { - var chosenEdge = util.topMost(pile, ['chosen', 'edge']); - if (typeof chosenEdge === 'boolean' || typeof chosenEdge === 'function') { - this.chooser = chosenEdge; - } - } - } - }, { - key: 'getFormattingValues', - value: function getFormattingValues() { - var toArrow = this.options.arrows.to === true || this.options.arrows.to.enabled === true; - var fromArrow = this.options.arrows.from === true || this.options.arrows.from.enabled === true; - var middleArrow = this.options.arrows.middle === true || this.options.arrows.middle.enabled === true; - var inheritsColor = this.options.color.inherit; - var values = { - toArrow: toArrow, - toArrowScale: this.options.arrows.to.scaleFactor, - toArrowType: this.options.arrows.to.type, - middleArrow: middleArrow, - middleArrowScale: this.options.arrows.middle.scaleFactor, - middleArrowType: this.options.arrows.middle.type, - fromArrow: fromArrow, - fromArrowScale: this.options.arrows.from.scaleFactor, - fromArrowType: this.options.arrows.from.type, - arrowStrikethrough: this.options.arrowStrikethrough, - color: inheritsColor ? undefined : this.options.color.color, - inheritsColor: inheritsColor, - opacity: this.options.color.opacity, - hidden: this.options.hidden, - length: this.options.length, - shadow: this.options.shadow.enabled, - shadowColor: this.options.shadow.color, - shadowSize: this.options.shadow.size, - shadowX: this.options.shadow.x, - shadowY: this.options.shadow.y, - dashes: this.options.dashes, - width: this.options.width - }; - if (this.selected || this.hover) { - if (this.chooser === true) { - if (this.selected) { - var selectedWidth = this.options.selectionWidth; - if (typeof selectedWidth === 'function') { - values.width = selectedWidth(values.width); - } else if (typeof selectedWidth === 'number') { - values.width += selectedWidth; - } - values.width = Math.max(values.width, 0.3 / this.body.view.scale); - values.color = this.options.color.highlight; - values.shadow = this.options.shadow.enabled; - } else if (this.hover) { - var hoverWidth = this.options.hoverWidth; - if (typeof hoverWidth === 'function') { - values.width = hoverWidth(values.width); - } else if (typeof hoverWidth === 'number') { - values.width += hoverWidth; - } - values.width = Math.max(values.width, 0.3 / this.body.view.scale); - values.color = this.options.color.hover; - values.shadow = this.options.shadow.enabled; - } - } else if (typeof this.chooser === 'function') { - this.chooser(values, this.options.id, this.selected, this.hover); - if (values.color !== undefined) { - values.inheritsColor = false; - } - if (values.shadow === false) { - if (values.shadowColor !== this.options.shadow.color || values.shadowSize !== this.options.shadow.size || values.shadowX !== this.options.shadow.x || values.shadowY !== this.options.shadow.y) { - values.shadow = true; - } - } - } - } else { - values.shadow = this.options.shadow.enabled; - values.width = Math.max(values.width, 0.3 / this.body.view.scale); - } - return values; - } - /** - * update the options in the label module - */ +/***/ }), +/* 196 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: 'updateLabelModule', - value: function updateLabelModule(options) { - this.labelModule.setOptions(this.options, true); - if (this.labelModule.baseSize !== undefined) { - this.baseFontSize = this.labelModule.baseSize; - } - this.labelModule.constrain(this.edgeOptions, options, this.defaultOptions); - this.labelModule.choosify(this.edgeOptions, options, this.defaultOptions); - } +module.exports = { "default": __webpack_require__(197), __esModule: true }; - /** - * update the edge type, set the options - * @returns {boolean} - */ +/***/ }), +/* 197 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: 'updateEdgeType', - value: function updateEdgeType() { - var smooth = this.options.smooth; - var dataChanged = false; - var changeInType = true; - if (this.edgeType !== undefined) { - if (this.edgeType instanceof BezierEdgeDynamic && smooth.enabled === true && smooth.type === 'dynamic' || this.edgeType instanceof CubicBezierEdge && smooth.enabled === true && smooth.type === 'cubicBezier' || this.edgeType instanceof BezierEdgeStatic && smooth.enabled === true && smooth.type !== 'dynamic' && smooth.type !== 'cubicBezier' || this.edgeType instanceof StraightEdge && smooth.type.enabled === false) { - changeInType = false; - } - if (changeInType === true) { - dataChanged = this.cleanup(); - } - } - if (changeInType === true) { - if (smooth.enabled === true) { - if (smooth.type === 'dynamic') { - dataChanged = true; - this.edgeType = new BezierEdgeDynamic(this.options, this.body, this.labelModule); - } else if (smooth.type === 'cubicBezier') { - this.edgeType = new CubicBezierEdge(this.options, this.body, this.labelModule); - } else { - this.edgeType = new BezierEdgeStatic(this.options, this.body, this.labelModule); - } - } else { - this.edgeType = new StraightEdge(this.options, this.body, this.labelModule); - } - } else { - // if nothing changes, we just set the options. - this.edgeType.setOptions(this.options); - } - return dataChanged; - } +__webpack_require__(198); +module.exports = __webpack_require__(7).Object.setPrototypeOf; - /** - * Connect an edge to its nodes - */ - }, { - key: 'connect', - value: function connect() { - this.disconnect(); +/***/ }), +/* 198 */ +/***/ (function(module, exports, __webpack_require__) { - this.from = this.body.nodes[this.fromId] || undefined; - this.to = this.body.nodes[this.toId] || undefined; - this.connected = this.from !== undefined && this.to !== undefined; +// 19.1.3.19 Object.setPrototypeOf(O, proto) +var $export = __webpack_require__(17); +$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(199).set }); - if (this.connected === true) { - this.from.attachEdge(this); - this.to.attachEdge(this); - } else { - if (this.from) { - this.from.detachEdge(this); - } - if (this.to) { - this.to.detachEdge(this); - } - } - this.edgeType.connect(); - } +/***/ }), +/* 199 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Disconnect an edge from its nodes - */ +// Works with __proto__ only. Old v8 can't work with null proto objects. +/* eslint-disable no-proto */ +var isObject = __webpack_require__(32); +var anObject = __webpack_require__(27); +var check = function (O, proto) { + anObject(O); + if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); +}; +module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function (test, buggy, set) { + try { + set = __webpack_require__(80)(Function.call, __webpack_require__(89).f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch (e) { buggy = true; } + return function setPrototypeOf(O, proto) { + check(O, proto); + if (buggy) O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check +}; - }, { - key: 'disconnect', - value: function disconnect() { - if (this.from) { - this.from.detachEdge(this); - this.from = undefined; - } - if (this.to) { - this.to.detachEdge(this); - this.to = undefined; - } - this.connected = false; - } +/***/ }), +/* 200 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * get the title of this edge. - * @return {string} title The title of the edge, or undefined when no title - * has been set. - */ +"use strict"; - }, { - key: 'getTitle', - value: function getTitle() { - return this.title; - } - /** - * check if this node is selecte - * @return {boolean} selected True if node is selected, else false - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); - }, { - key: 'isSelected', - value: function isSelected() { - return this.selected; - } +var _getPrototypeOf = __webpack_require__(3); - /** - * Retrieve the value of the edge. Can be undefined - * @return {Number} value - */ +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - }, { - key: 'getValue', - value: function getValue() { - return this.options.value; - } +var _classCallCheck2 = __webpack_require__(0); - /** - * Adjust the value range of the edge. The edge will adjust it's width - * based on its value. - * @param {Number} min - * @param {Number} max - * @param total - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - }, { - key: 'setValueRange', - value: function setValueRange(min, max, total) { - if (this.options.value !== undefined) { - var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); - var widthDiff = this.options.scaling.max - this.options.scaling.min; - if (this.options.scaling.label.enabled === true) { - var fontDiff = this.options.scaling.label.max - this.options.scaling.label.min; - this.options.font.size = this.options.scaling.label.min + scale * fontDiff; - } - this.options.width = this.options.scaling.min + scale * widthDiff; - } else { - this.options.width = this.baseWidth; - this.options.font.size = this.baseFontSize; - } +var _createClass2 = __webpack_require__(1); - this._setInteractionWidths(); - this.updateLabelModule(); - } - }, { - key: '_setInteractionWidths', - value: function _setInteractionWidths() { - if (typeof this.options.hoverWidth === 'function') { - this.edgeType.hoverWidth = this.options.hoverWidth(this.options.width); - } else { - this.edgeType.hoverWidth = this.options.hoverWidth + this.options.width; - } - if (typeof this.options.selectionWidth === 'function') { - this.edgeType.selectionWidth = this.options.selectionWidth(this.options.width); - } else { - this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width; - } - } +var _createClass3 = _interopRequireDefault(_createClass2); - /** - * Redraw a edge - * Draw this edge in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - */ +var _possibleConstructorReturn2 = __webpack_require__(4); - }, { - key: 'draw', - value: function draw(ctx) { - var values = this.getFormattingValues(); - if (values.hidden) { - return; - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - // get the via node from the edge type - var viaNode = this.edgeType.getViaNode(); - var arrowData = {}; +var _inherits2 = __webpack_require__(5); - // restore edge targets to defaults - this.edgeType.fromPoint = this.edgeType.from; - this.edgeType.toPoint = this.edgeType.to; +var _inherits3 = _interopRequireDefault(_inherits2); - // from and to arrows give a different end point for edges. we set them here - if (values.fromArrow) { - arrowData.from = this.edgeType.getArrowData(ctx, 'from', viaNode, this.selected, this.hover, values); - if (values.arrowStrikethrough === false) this.edgeType.fromPoint = arrowData.from.core; - } - if (values.toArrow) { - arrowData.to = this.edgeType.getArrowData(ctx, 'to', viaNode, this.selected, this.hover, values); - if (values.arrowStrikethrough === false) this.edgeType.toPoint = arrowData.to.core; - } +var _CircleImageBase2 = __webpack_require__(73); - // the middle arrow depends on the line, which can depend on the to and from arrows so we do this one lastly. - if (values.middleArrow) { - arrowData.middle = this.edgeType.getArrowData(ctx, 'middle', viaNode, this.selected, this.hover, values); - } +var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2); - // draw everything - this.edgeType.drawLine(ctx, values, this.selected, this.hover, viaNode); - this.drawArrows(ctx, arrowData, values); - this.drawLabel(ctx, viaNode); - } - }, { - key: 'drawArrows', - value: function drawArrows(ctx, arrowData, values) { - if (values.fromArrow) { - this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.from); - } - if (values.middleArrow) { - this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.middle); - } - if (values.toArrow) { - this.edgeType.drawArrowHead(ctx, values, this.selected, this.hover, arrowData.to); - } - } - }, { - key: 'drawLabel', - value: function drawLabel(ctx, viaNode) { - if (this.options.label !== undefined) { - // set style - var node1 = this.from; - var node2 = this.to; - - if (this.labelModule.differentState(this.selected, this.hover)) { - this.labelModule.getTextSize(ctx, this.selected, this.hover); - } - - if (node1.id != node2.id) { - this.labelModule.pointToSelf = false; - var point = this.edgeType.getPoint(0.5, viaNode); - ctx.save(); - - // if the label has to be rotated: - if (this.options.font.align !== "horizontal") { - this.labelModule.calculateLabelSize(ctx, this.selected, this.hover, point.x, point.y); - ctx.translate(point.x, this.labelModule.size.yLine); - this._rotateForLabelAlignment(ctx); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // draw the label - this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover); - ctx.restore(); - } else { - // Ignore the orientations. - this.labelModule.pointToSelf = true; - var x, y; - var radius = this.options.selfReferenceSize; - if (node1.shape.width > node1.shape.height) { - x = node1.x + node1.shape.width * 0.5; - y = node1.y - radius; - } else { - x = node1.x + radius; - y = node1.y - node1.shape.height * 0.5; - } - point = this._pointOnCircle(x, y, radius, 0.125); - this.labelModule.draw(ctx, point.x, point.y, this.selected, this.hover); - } - } - } +/** + * A Circle Node/Cluster shape. + * + * @extends CircleImageBase + */ +var Circle = function (_CircleImageBase) { + (0, _inherits3['default'])(Circle, _CircleImageBase); - /** - * Check if this object is overlapping with the provided object - * @param {Object} obj an object with parameters left, top - * @return {boolean} True if location is located on the edge - */ + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Circle(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Circle); - }, { - key: 'isOverlappingWith', - value: function isOverlappingWith(obj) { - if (this.connected) { - var distMax = 10; - var xFrom = this.from.x; - var yFrom = this.from.y; - var xTo = this.to.x; - var yTo = this.to.y; - var xObj = obj.left; - var yObj = obj.top; - - var dist = this.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, xObj, yObj); - - return dist < distMax; - } else { - return false; - } - } + var _this = (0, _possibleConstructorReturn3['default'])(this, (Circle.__proto__ || (0, _getPrototypeOf2['default'])(Circle)).call(this, options, body, labelModule)); - /** - * Rotates the canvas so the text is most readable - * @param {CanvasRenderingContext2D} ctx - * @private - */ + _this._setMargins(labelModule); + return _this; + } - }, { - key: '_rotateForLabelAlignment', - value: function _rotateForLabelAlignment(ctx) { - var dy = this.from.y - this.to.y; - var dx = this.from.x - this.to.x; - var angleInDegrees = Math.atan2(dy, dx); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [selected] + * @param {boolean} [hover] + */ - // rotate so label it is readable - if (angleInDegrees < -1 && dx < 0 || angleInDegrees > 0 && dx < 0) { - angleInDegrees = angleInDegrees + Math.PI; - } - ctx.rotate(angleInDegrees); - } + (0, _createClass3['default'])(Circle, [{ + key: 'resize', + value: function resize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; - /** - * Get a point on a circle - * @param {Number} x - * @param {Number} y - * @param {Number} radius - * @param {Number} percentage. Value between 0 (line start) and 1 (line end) - * @return {Object} point - * @private - */ + if (this.needsRefresh(selected, hover)) { + var dimensions = this.getDimensionsFromLabel(ctx, selected, hover); - }, { - key: '_pointOnCircle', - value: function _pointOnCircle(x, y, radius, percentage) { - var angle = percentage * 2 * Math.PI; - return { - x: x + radius * Math.cos(angle), - y: y - radius * Math.sin(angle) - }; - } - }, { - key: 'select', - value: function select() { - this.selected = true; - } - }, { - key: 'unselect', - value: function unselect() { - this.selected = false; + var diameter = Math.max(dimensions.width + this.margin.right + this.margin.left, dimensions.height + this.margin.top + this.margin.bottom); + + this.options.size = diameter / 2; // NOTE: this size field only set here, not in Ellipse, Database, Box + this.width = diameter; + this.height = diameter; + this.radius = this.width / 2; } + } - /** - * cleans all required things on delete - * @returns {*} - */ + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - }, { - key: 'cleanup', - value: function cleanup() { - return this.edgeType.cleanup(); - } - }], [{ - key: 'parseOptions', - value: function parseOptions(parentOptions, newOptions) { - var allowDeletion = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var globalOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - - var fields = ['arrowStrikethrough', 'id', 'from', 'hidden', 'hoverWidth', 'label', 'labelHighlightBold', 'length', 'line', 'opacity', 'physics', 'scaling', 'selectionWidth', 'selfReferenceSize', 'to', 'title', 'value', 'width']; - - // only deep extend the items in the field array. These do not have shorthand. - util.selectiveDeepExtend(fields, parentOptions, newOptions, allowDeletion); - - util.mergeOptions(parentOptions, newOptions, 'smooth', allowDeletion, globalOptions); - util.mergeOptions(parentOptions, newOptions, 'shadow', allowDeletion, globalOptions); - - if (newOptions.dashes !== undefined && newOptions.dashes !== null) { - parentOptions.dashes = newOptions.dashes; - } else if (allowDeletion === true && newOptions.dashes === null) { - parentOptions.dashes = (0, _create2['default'])(globalOptions.dashes); // this sets the pointer of the option back to the global option. - } - - // set the scaling newOptions - if (newOptions.scaling !== undefined && newOptions.scaling !== null) { - if (newOptions.scaling.min !== undefined) { - parentOptions.scaling.min = newOptions.scaling.min; - } - if (newOptions.scaling.max !== undefined) { - parentOptions.scaling.max = newOptions.scaling.max; - } - util.mergeOptions(parentOptions.scaling, newOptions.scaling, 'label', allowDeletion, globalOptions.scaling); - } else if (allowDeletion === true && newOptions.scaling === null) { - parentOptions.scaling = (0, _create2['default'])(globalOptions.scaling); // this sets the pointer of the option back to the global option. - } - - // handle multiple input cases for arrows - if (newOptions.arrows !== undefined && newOptions.arrows !== null) { - if (typeof newOptions.arrows === 'string') { - var arrows = newOptions.arrows.toLowerCase(); - parentOptions.arrows.to.enabled = arrows.indexOf("to") != -1; - parentOptions.arrows.middle.enabled = arrows.indexOf("middle") != -1; - parentOptions.arrows.from.enabled = arrows.indexOf("from") != -1; - } else if ((0, _typeof3['default'])(newOptions.arrows) === 'object') { - util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'to', allowDeletion, globalOptions.arrows); - util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'middle', allowDeletion, globalOptions.arrows); - util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'from', allowDeletion, globalOptions.arrows); - } else { - throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:" + (0, _stringify2['default'])(newOptions.arrows)); - } - } else if (allowDeletion === true && newOptions.arrows === null) { - parentOptions.arrows = (0, _create2['default'])(globalOptions.arrows); // this sets the pointer of the option back to the global option. - } + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.resize(ctx, selected, hover); + this.left = x - this.width / 2; + this.top = y - this.height / 2; - // handle multiple input cases for color - if (newOptions.color !== undefined && newOptions.color !== null) { - // make a copy of the parent object in case this is referring to the global one (due to object create once, then update) - parentOptions.color = util.deepExtend({}, parentOptions.color, true); - if (util.isString(newOptions.color)) { - parentOptions.color.color = newOptions.color; - parentOptions.color.highlight = newOptions.color; - parentOptions.color.hover = newOptions.color; - parentOptions.color.inherit = false; - } else { - var colorsDefined = false; - if (newOptions.color.color !== undefined) { - parentOptions.color.color = newOptions.color.color;colorsDefined = true; - } - if (newOptions.color.highlight !== undefined) { - parentOptions.color.highlight = newOptions.color.highlight;colorsDefined = true; - } - if (newOptions.color.hover !== undefined) { - parentOptions.color.hover = newOptions.color.hover;colorsDefined = true; - } - if (newOptions.color.inherit !== undefined) { - parentOptions.color.inherit = newOptions.color.inherit; - } - if (newOptions.color.opacity !== undefined) { - parentOptions.color.opacity = Math.min(1, Math.max(0, newOptions.color.opacity)); - } + this._drawRawCircle(ctx, x, y, values); - if (newOptions.color.inherit === undefined && colorsDefined === true) { - parentOptions.color.inherit = false; - } - } - } else if (allowDeletion === true && newOptions.color === null) { - parentOptions.color = util.bridgeObject(globalOptions.color); // set the object back to the global options - } + this.updateBoundingBox(x, y); + this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, y, selected, hover); + } - // handle the font settings - if (newOptions.font !== undefined && newOptions.font !== null) { - Label.parseOptions(parentOptions.font, newOptions); - } else if (allowDeletion === true && newOptions.font === null) { - parentOptions.font = util.bridgeObject(globalOptions.font); // set the object back to the global options - } - } - }]); - return Edge; - }(); + /** + * + * @param {number} x width + * @param {number} y height + */ + + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y) { + this.boundingBox.top = y - this.options.size; + this.boundingBox.left = x - this.options.size; + this.boundingBox.right = x + this.options.size; + this.boundingBox.bottom = y + this.options.size; + } + + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle - Unused + * @returns {number} + */ + + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + // eslint-disable-line no-unused-vars + this.resize(ctx); + return this.width * 0.5; + } + }]); + return Circle; +}(_CircleImageBase3['default']); - exports['default'] = Edge; +exports['default'] = Circle; /***/ }), -/* 203 */ +/* 201 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _slicedToArray2 = __webpack_require__(171); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getPrototypeOf = __webpack_require__(3); + +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); - var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); +var _createClass3 = _interopRequireDefault(_createClass2); - var _getPrototypeOf = __webpack_require__(176); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _classCallCheck2 = __webpack_require__(135); +var _inherits2 = __webpack_require__(5); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _inherits3 = _interopRequireDefault(_inherits2); - var _createClass2 = __webpack_require__(136); +var _CircleImageBase2 = __webpack_require__(73); - var _createClass3 = _interopRequireDefault(_createClass2); +var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2); - var _possibleConstructorReturn2 = __webpack_require__(179); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +/** + * A CircularImage Node/Cluster shape. + * + * @extends CircleImageBase + */ +var CircularImage = function (_CircleImageBase) { + (0, _inherits3['default'])(CircularImage, _CircleImageBase); + + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + * @param {Image} imageObj + * @param {Image} imageObjAlt + */ + function CircularImage(options, body, labelModule, imageObj, imageObjAlt) { + (0, _classCallCheck3['default'])(this, CircularImage); + + var _this = (0, _possibleConstructorReturn3['default'])(this, (CircularImage.__proto__ || (0, _getPrototypeOf2['default'])(CircularImage)).call(this, options, body, labelModule)); - var _inherits2 = __webpack_require__(180); + _this.setImages(imageObj, imageObjAlt); + return _this; + } - var _inherits3 = _interopRequireDefault(_inherits2); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [selected] + * @param {boolean} [hover] + */ - var _CubicBezierEdgeBase2 = __webpack_require__(204); - var _CubicBezierEdgeBase3 = _interopRequireDefault(_CubicBezierEdgeBase2); + (0, _createClass3['default'])(CircularImage, [{ + key: 'resize', + value: function resize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var imageAbsent = this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined; - var CubicBezierEdge = function (_CubicBezierEdgeBase) { - (0, _inherits3['default'])(CubicBezierEdge, _CubicBezierEdgeBase); + if (imageAbsent) { + var diameter = this.options.size * 2; + this.width = diameter; + this.height = diameter; + this.radius = 0.5 * this.width; + return; + } - function CubicBezierEdge(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, CubicBezierEdge); - return (0, _possibleConstructorReturn3['default'])(this, (CubicBezierEdge.__proto__ || (0, _getPrototypeOf2['default'])(CubicBezierEdge)).call(this, options, body, labelModule)); + // At this point, an image is present, i.e. this.imageObj is valid. + if (this.needsRefresh(selected, hover)) { + this._resizeImage(); + } } /** - * Draw a line between two nodes + * * @param {CanvasRenderingContext2D} ctx - * @private + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values */ + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.switchImages(selected); + this.resize(); + this.left = x - this.width / 2; + this.top = y - this.height / 2; - (0, _createClass3['default'])(CubicBezierEdge, [{ - key: '_line', - value: function _line(ctx, values, viaNodes) { - // get the coordinates of the support points. - var via1 = viaNodes[0]; - var via2 = viaNodes[1]; - this._bezierCurve(ctx, values, via1, via2); - } - }, { - key: '_getViaCoordinates', - value: function _getViaCoordinates() { - var dx = this.from.x - this.to.x; - var dy = this.from.y - this.to.y; - - var x1 = void 0, - y1 = void 0, - x2 = void 0, - y2 = void 0; - var roundness = this.options.smooth.roundness; - - // horizontal if x > y or if direction is forced or if direction is horizontal - if ((Math.abs(dx) > Math.abs(dy) || this.options.smooth.forceDirection === true || this.options.smooth.forceDirection === 'horizontal') && this.options.smooth.forceDirection !== 'vertical') { - y1 = this.from.y; - y2 = this.to.y; - x1 = this.from.x - roundness * dx; - x2 = this.to.x + roundness * dx; - } else { - y1 = this.from.y - roundness * dy; - y2 = this.to.y + roundness * dy; - x1 = this.from.x; - x2 = this.to.x; - } + // draw the background circle. IMPORTANT: the stroke in this method is used by the clip method below. + this._drawRawCircle(ctx, x, y, values); - return [{ x: x1, y: y1 }, { x: x2, y: y2 }]; - } - }, { - key: 'getViaNode', - value: function getViaNode() { - return this._getViaCoordinates(); - } - }, { - key: '_findBorderPosition', - value: function _findBorderPosition(nearNode, ctx) { - return this._findBorderPositionBezier(nearNode, ctx); - } - }, { - key: '_getDistanceToEdge', - value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { - var _ref = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates(), - _ref2 = (0, _slicedToArray3['default'])(_ref, 2), - via1 = _ref2[0], - via2 = _ref2[1]; + // now we draw in the circle, we save so we can revert the clip operation after drawing. + ctx.save(); + // clip is used to use the stroke in drawRawCircle as an area that we can draw in. + ctx.clip(); + // draw the image + this._drawImageAtPosition(ctx, values); + // restore so we can again draw on the full canvas + ctx.restore(); - // x3,y3 is the point - return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2); - } + this._drawImageLabel(ctx, x, y, selected, hover); - /** - * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way - * @param percentage - * @param via - * @returns {{x: number, y: number}} - * @private - */ + this.updateBoundingBox(x, y); + } - }, { - key: 'getPoint', - value: function getPoint(percentage) { - var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates(), - _ref4 = (0, _slicedToArray3['default'])(_ref3, 2), - via1 = _ref4[0], - via2 = _ref4[1]; - - var t = percentage; - var vec = []; - vec[0] = Math.pow(1 - t, 3); - vec[1] = 3 * t * Math.pow(1 - t, 2); - vec[2] = 3 * Math.pow(t, 2) * (1 - t); - vec[3] = Math.pow(t, 3); - var x = vec[0] * this.fromPoint.x + vec[1] * via1.x + vec[2] * via2.x + vec[3] * this.toPoint.x; - var y = vec[0] * this.fromPoint.y + vec[1] * via1.y + vec[2] * via2.y + vec[3] * this.toPoint.y; + // TODO: compare with Circle.updateBoundingBox(), consolidate? More stuff is happening here + /** + * + * @param {number} x width + * @param {number} y height + */ - return { x: x, y: y }; - } - }]); - return CubicBezierEdge; - }(_CubicBezierEdgeBase3['default']); + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y) { + this.boundingBox.top = y - this.options.size; + this.boundingBox.left = x - this.options.size; + this.boundingBox.right = x + this.options.size; + this.boundingBox.bottom = y + this.options.size; + + // TODO: compare with Image.updateBoundingBox(), consolidate? + this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); + this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); + this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset); + } + + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle - Unused + * @returns {number} + */ + + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + // eslint-disable-line no-unused-vars + this.resize(ctx); + return this.width * 0.5; + } + }]); + return CircularImage; +}(_CircleImageBase3['default']); - exports['default'] = CubicBezierEdge; +exports['default'] = CircularImage; /***/ }), -/* 204 */ +/* 202 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); +"use strict"; - var _getPrototypeOf = __webpack_require__(176); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _classCallCheck2 = __webpack_require__(135); +var _getPrototypeOf = __webpack_require__(3); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var _createClass2 = __webpack_require__(136); +var _classCallCheck2 = __webpack_require__(0); - var _createClass3 = _interopRequireDefault(_createClass2); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _possibleConstructorReturn2 = __webpack_require__(179); +var _createClass2 = __webpack_require__(1); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +var _createClass3 = _interopRequireDefault(_createClass2); - var _inherits2 = __webpack_require__(180); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _inherits3 = _interopRequireDefault(_inherits2); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _BezierEdgeBase2 = __webpack_require__(205); +var _inherits2 = __webpack_require__(5); - var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2); +var _inherits3 = _interopRequireDefault(_inherits2); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _NodeBase2 = __webpack_require__(23); - var CubicBezierEdgeBase = function (_BezierEdgeBase) { - (0, _inherits3['default'])(CubicBezierEdgeBase, _BezierEdgeBase); +var _NodeBase3 = _interopRequireDefault(_NodeBase2); - function CubicBezierEdgeBase(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, CubicBezierEdgeBase); - return (0, _possibleConstructorReturn3['default'])(this, (CubicBezierEdgeBase.__proto__ || (0, _getPrototypeOf2['default'])(CubicBezierEdgeBase)).call(this, options, body, labelModule)); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Calculate the distance between a point (x3,y3) and a line segment from - * (x1,y1) to (x2,y2). - * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment - * https://en.wikipedia.org/wiki/B%C3%A9zier_curve - * @param {number} x1 from x - * @param {number} y1 from y - * @param {number} x2 to x - * @param {number} y2 to y - * @param {number} x3 point to check x - * @param {number} y3 point to check y - * @private - */ +/** + * A Database Node/Cluster shape. + * + * @extends NodeBase + */ +var Database = function (_NodeBase) { + (0, _inherits3['default'])(Database, _NodeBase); + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Database(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Database); - (0, _createClass3['default'])(CubicBezierEdgeBase, [{ - key: '_getDistanceToBezierEdge', - value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2) { - // x3,y3 is the point - var minDistance = 1e9; - var distance = void 0; - var i = void 0, - t = void 0, - x = void 0, - y = void 0; - var lastX = x1; - var lastY = y1; - var vec = [0, 0, 0, 0]; - for (i = 1; i < 10; i++) { - t = 0.1 * i; - vec[0] = Math.pow(1 - t, 3); - vec[1] = 3 * t * Math.pow(1 - t, 2); - vec[2] = 3 * Math.pow(t, 2) * (1 - t); - vec[3] = Math.pow(t, 3); - x = vec[0] * x1 + vec[1] * via1.x + vec[2] * via2.x + vec[3] * x2; - y = vec[0] * y1 + vec[1] * via1.y + vec[2] * via2.y + vec[3] * y2; - if (i > 0) { - distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3); - minDistance = distance < minDistance ? distance : minDistance; - } - lastX = x; - lastY = y; - } - - return minDistance; - } - }]); - return CubicBezierEdgeBase; - }(_BezierEdgeBase3['default']); + var _this = (0, _possibleConstructorReturn3['default'])(this, (Database.__proto__ || (0, _getPrototypeOf2['default'])(Database)).call(this, options, body, labelModule)); - exports['default'] = CubicBezierEdgeBase; + _this._setMargins(labelModule); + return _this; + } -/***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + */ - 'use strict'; - Object.defineProperty(exports, "__esModule", { - value: true - }); + (0, _createClass3['default'])(Database, [{ + key: 'resize', + value: function resize(ctx, selected, hover) { + if (this.needsRefresh(selected, hover)) { + var dimensions = this.getDimensionsFromLabel(ctx, selected, hover); + var size = dimensions.width + this.margin.right + this.margin.left; - var _getPrototypeOf = __webpack_require__(176); + this.width = size; + this.height = size; + this.radius = this.width / 2; + } + } - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - var _classCallCheck2 = __webpack_require__(135); + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.resize(ctx, selected, hover); + this.left = x - this.width / 2; + this.top = y - this.height / 2; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + this.initContextForDraw(ctx, values); + ctx.database(x - this.width / 2, y - this.height / 2, this.width, this.height); + this.performFill(ctx, values); - var _createClass2 = __webpack_require__(136); + this.updateBoundingBox(x, y, ctx, selected, hover); + this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); + } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Database; +}(_NodeBase3['default']); - var _possibleConstructorReturn2 = __webpack_require__(179); +exports['default'] = Database; - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +/***/ }), +/* 203 */ +/***/ (function(module, exports, __webpack_require__) { - var _inherits2 = __webpack_require__(180); +"use strict"; - var _inherits3 = _interopRequireDefault(_inherits2); - var _EdgeBase2 = __webpack_require__(206); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _EdgeBase3 = _interopRequireDefault(_EdgeBase2); +var _getPrototypeOf = __webpack_require__(3); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var BezierEdgeBase = function (_EdgeBase) { - (0, _inherits3['default'])(BezierEdgeBase, _EdgeBase); +var _classCallCheck2 = __webpack_require__(0); - function BezierEdgeBase(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, BezierEdgeBase); - return (0, _possibleConstructorReturn3['default'])(this, (BezierEdgeBase.__proto__ || (0, _getPrototypeOf2['default'])(BezierEdgeBase)).call(this, options, body, labelModule)); - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * This function uses binary search to look for the point where the bezier curve crosses the border of the node. - * - * @param nearNode - * @param ctx - * @param viaNode - * @param nearNode - * @param ctx - * @param viaNode - * @param nearNode - * @param ctx - * @param viaNode - */ +var _createClass2 = __webpack_require__(1); +var _createClass3 = _interopRequireDefault(_createClass2); - (0, _createClass3['default'])(BezierEdgeBase, [{ - key: '_findBorderPositionBezier', - value: function _findBorderPositionBezier(nearNode, ctx) { - var viaNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this._getViaCoordinates(); +var _possibleConstructorReturn2 = __webpack_require__(4); - var maxIterations = 10; - var iteration = 0; - var low = 0; - var high = 1; - var pos, angle, distanceToBorder, distanceToPoint, difference; - var threshold = 0.2; - var node = this.to; - var from = false; - if (nearNode.id === this.from.id) { - node = this.from; - from = true; - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - while (low <= high && iteration < maxIterations) { - var middle = (low + high) * 0.5; +var _inherits2 = __webpack_require__(5); - pos = this.getPoint(middle, viaNode); - angle = Math.atan2(node.y - pos.y, node.x - pos.x); - distanceToBorder = node.distanceToBorder(ctx, angle); - distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2)); - difference = distanceToBorder - distanceToPoint; - if (Math.abs(difference) < threshold) { - break; // found - } else if (difference < 0) { - // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. - if (from === false) { - low = middle; - } else { - high = middle; - } - } else { - if (from === false) { - high = middle; - } else { - low = middle; - } - } +var _inherits3 = _interopRequireDefault(_inherits2); - iteration++; - } - pos.t = middle; +var _ShapeBase2 = __webpack_require__(24); - return pos; - } +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - /** - * Calculate the distance between a point (x3,y3) and a line segment from - * (x1,y1) to (x2,y2). - * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment - * @param {number} x1 from x - * @param {number} y1 from y - * @param {number} x2 to x - * @param {number} y2 to y - * @param {number} x3 point to check x - * @param {number} y3 point to check y - * @private - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - }, { - key: '_getDistanceToBezierEdge', - value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via) { - // x3,y3 is the point - var minDistance = 1e9; - var distance = void 0; - var i = void 0, - t = void 0, - x = void 0, - y = void 0; - var lastX = x1; - var lastY = y1; - for (i = 1; i < 10; i++) { - t = 0.1 * i; - x = Math.pow(1 - t, 2) * x1 + 2 * t * (1 - t) * via.x + Math.pow(t, 2) * x2; - y = Math.pow(1 - t, 2) * y1 + 2 * t * (1 - t) * via.y + Math.pow(t, 2) * y2; - if (i > 0) { - distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3); - minDistance = distance < minDistance ? distance : minDistance; - } - lastX = x; - lastY = y; - } +/** + * A Diamond Node/Cluster shape. + * + * @extends ShapeBase + */ +var Diamond = function (_ShapeBase) { + (0, _inherits3['default'])(Diamond, _ShapeBase); - return minDistance; - } + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Diamond(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Diamond); + return (0, _possibleConstructorReturn3['default'])(this, (Diamond.__proto__ || (0, _getPrototypeOf2['default'])(Diamond)).call(this, options, body, labelModule)); + } - /** - * Draw a bezier curve between two nodes - * - * The method accepts zero, one or two control points. - * Passing zero control points just draws a straight line - * - * @param {CanvasRenderingContext2D} ctx - * @param {Object} values | options for shadow drawing - * @param {Object|undefined} viaNode1 | first control point for curve drawing - * @param {Object|undefined} viaNode2 | second control point for curve drawing - * - * @protected - */ + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - }, { - key: '_bezierCurve', - value: function _bezierCurve(ctx, values, viaNode1, viaNode2) { - var hasNode1 = viaNode1 !== undefined && viaNode1.x !== undefined; - var hasNode2 = viaNode2 !== undefined && viaNode2.x !== undefined; - ctx.beginPath(); - ctx.moveTo(this.fromPoint.x, this.fromPoint.y); + (0, _createClass3['default'])(Diamond, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'diamond', 4, x, y, selected, hover, values); + } - if (hasNode1 && hasNode2) { - ctx.bezierCurveTo(viaNode1.x, viaNode1.y, viaNode2.x, viaNode2.y, this.toPoint.x, this.toPoint.y); - } else if (hasNode1) { - ctx.quadraticCurveTo(viaNode1.x, viaNode1.y, this.toPoint.x, this.toPoint.y); - } else { - // fallback to normal straight edge - ctx.lineTo(this.toPoint.x, this.toPoint.y); - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - // draw shadow if enabled - this.enableShadow(ctx, values); - ctx.stroke(); - this.disableShadow(ctx, values); - } - }, { - key: 'getViaNode', - value: function getViaNode() { - return this._getViaCoordinates(); - } - }]); - return BezierEdgeBase; - }(_EdgeBase3['default']); + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Diamond; +}(_ShapeBase3['default']); - exports['default'] = BezierEdgeBase; +exports['default'] = Diamond; /***/ }), -/* 206 */ +/* 204 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _slicedToArray2 = __webpack_require__(171); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); +var _getPrototypeOf = __webpack_require__(3); - var _classCallCheck2 = __webpack_require__(135); +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _classCallCheck2 = __webpack_require__(0); - var _createClass2 = __webpack_require__(136); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _createClass3 = _interopRequireDefault(_createClass2); +var _createClass2 = __webpack_require__(1); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _createClass3 = _interopRequireDefault(_createClass2); - var util = __webpack_require__(1); +var _possibleConstructorReturn2 = __webpack_require__(4); - var EdgeBase = function () { - function EdgeBase(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, EdgeBase); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - this.body = body; - this.labelModule = labelModule; - this.options = {}; - this.setOptions(options); - this.colorDirty = true; - this.color = {}; - this.selectionWidth = 2; - this.hoverWidth = 1.5; - this.fromPoint = this.from; - this.toPoint = this.to; - } +var _inherits2 = __webpack_require__(5); - (0, _createClass3['default'])(EdgeBase, [{ - key: 'connect', - value: function connect() { - this.from = this.body.nodes[this.options.from]; - this.to = this.body.nodes[this.options.to]; - } - }, { - key: 'cleanup', - value: function cleanup() { - return false; - } - }, { - key: 'setOptions', - value: function setOptions(options) { - this.options = options; - this.from = this.body.nodes[this.options.from]; - this.to = this.body.nodes[this.options.to]; - this.id = this.options.id; - } - - /** - * Redraw a edge as a line - * Draw this edge in the given canvas - * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); - * @param {CanvasRenderingContext2D} ctx - * @private - */ +var _inherits3 = _interopRequireDefault(_inherits2); - }, { - key: 'drawLine', - value: function drawLine(ctx, values, selected, hover, viaNode) { - // set style - ctx.strokeStyle = this.getColor(ctx, values, selected, hover); - ctx.lineWidth = values.width; - - if (values.dashes !== false) { - this._drawDashedLine(ctx, values, viaNode); - } else { - this._drawLine(ctx, values, viaNode); - } - } - }, { - key: '_drawLine', - value: function _drawLine(ctx, values, viaNode, fromPoint, toPoint) { - if (this.from != this.to) { - // draw line - this._line(ctx, values, viaNode, fromPoint, toPoint); - } else { - var _getCircleData2 = this._getCircleData(ctx), - _getCircleData3 = (0, _slicedToArray3['default'])(_getCircleData2, 3), - x = _getCircleData3[0], - y = _getCircleData3[1], - radius = _getCircleData3[2]; +var _ShapeBase2 = __webpack_require__(24); - this._circle(ctx, values, x, y, radius); - } - } - }, { - key: '_drawDashedLine', - value: function _drawDashedLine(ctx, values, viaNode, fromPoint, toPoint) { - ctx.lineCap = 'round'; - var pattern = [5, 5]; - if (Array.isArray(values.dashes) === true) { - pattern = values.dashes; - } +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - // only firefox and chrome support this method, else we use the legacy one. - if (ctx.setLineDash !== undefined) { - ctx.save(); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // set dash settings for chrome or firefox - ctx.setLineDash(pattern); - ctx.lineDashOffset = 0; +/** + * A Dot Node/Cluster shape. + * + * @extends ShapeBase + */ +var Dot = function (_ShapeBase) { + (0, _inherits3['default'])(Dot, _ShapeBase); - // draw the line - if (this.from != this.to) { - // draw line - this._line(ctx, values, viaNode); - } else { - var _getCircleData4 = this._getCircleData(ctx), - _getCircleData5 = (0, _slicedToArray3['default'])(_getCircleData4, 3), - x = _getCircleData5[0], - y = _getCircleData5[1], - radius = _getCircleData5[2]; + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Dot(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Dot); + return (0, _possibleConstructorReturn3['default'])(this, (Dot.__proto__ || (0, _getPrototypeOf2['default'])(Dot)).call(this, options, body, labelModule)); + } - this._circle(ctx, values, x, y, radius); - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - // restore the dash settings. - ctx.setLineDash([0]); - ctx.lineDashOffset = 0; - ctx.restore(); - } else { - // unsupporting smooth lines - if (this.from != this.to) { - // draw line - ctx.dashedLine(this.from.x, this.from.y, this.to.x, this.to.y, pattern); - } else { - var _getCircleData6 = this._getCircleData(ctx), - _getCircleData7 = (0, _slicedToArray3['default'])(_getCircleData6, 3), - _x = _getCircleData7[0], - _y = _getCircleData7[1], - _radius = _getCircleData7[2]; - this._circle(ctx, values, _x, _y, _radius); - } - // draw shadow if enabled - this.enableShadow(ctx, values); + (0, _createClass3['default'])(Dot, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'circle', 2, x, y, selected, hover, values); + } - ctx.stroke(); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - // disable shadows for other elements. - this.disableShadow(ctx, values); - } - } - }, { - key: 'findBorderPosition', - value: function findBorderPosition(nearNode, ctx, options) { - if (this.from != this.to) { - return this._findBorderPosition(nearNode, ctx, options); - } else { - return this._findBorderPositionCircle(nearNode, ctx, options); - } - } - }, { - key: 'findBorderPositions', - value: function findBorderPositions(ctx) { - var from = {}; - var to = {}; - if (this.from != this.to) { - from = this._findBorderPosition(this.from, ctx); - to = this._findBorderPosition(this.to, ctx); - } else { - var _getCircleData8 = this._getCircleData(ctx), - _getCircleData9 = (0, _slicedToArray3['default'])(_getCircleData8, 3), - x = _getCircleData9[0], - y = _getCircleData9[1], - radius = _getCircleData9[2]; + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + // eslint-disable-line no-unused-vars + this.resize(ctx); + return this.options.size; + } + }]); + return Dot; +}(_ShapeBase3['default']); - from = this._findBorderPositionCircle(this.from, ctx, { x: x, y: y, low: 0.25, high: 0.6, direction: -1 }); - to = this._findBorderPositionCircle(this.from, ctx, { x: x, y: y, low: 0.6, high: 0.8, direction: 1 }); - } - return { from: from, to: to }; - } - }, { - key: '_getCircleData', - value: function _getCircleData(ctx) { - var x = void 0, - y = void 0; - var node = this.from; - var radius = this.options.selfReferenceSize; +exports['default'] = Dot; - if (ctx !== undefined) { - if (node.shape.width === undefined) { - node.shape.resize(ctx); - } - } +/***/ }), +/* 205 */ +/***/ (function(module, exports, __webpack_require__) { - // get circle coordinates - if (node.shape.width > node.shape.height) { - x = node.x + node.shape.width * 0.5; - y = node.y - radius; - } else { - x = node.x + radius; - y = node.y - node.shape.height * 0.5; - } - return [x, y, radius]; - } +"use strict"; - /** - * Get a point on a circle - * @param {Number} x - * @param {Number} y - * @param {Number} radius - * @param {Number} percentage. Value between 0 (line start) and 1 (line end) - * @return {Object} point - * @private - */ - }, { - key: '_pointOnCircle', - value: function _pointOnCircle(x, y, radius, percentage) { - var angle = percentage * 2 * Math.PI; - return { - x: x + radius * Math.cos(angle), - y: y - radius * Math.sin(angle) - }; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * This function uses binary search to look for the point where the circle crosses the border of the node. - * @param node - * @param ctx - * @param options - * @returns {*} - * @private - */ +var _getPrototypeOf = __webpack_require__(3); - }, { - key: '_findBorderPositionCircle', - value: function _findBorderPositionCircle(node, ctx, options) { - var x = options.x; - var y = options.y; - var low = options.low; - var high = options.high; - var direction = options.direction; - - var maxIterations = 10; - var iteration = 0; - var radius = this.options.selfReferenceSize; - var pos = void 0, - angle = void 0, - distanceToBorder = void 0, - distanceToPoint = void 0, - difference = void 0; - var threshold = 0.05; - var middle = (low + high) * 0.5; +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - while (low <= high && iteration < maxIterations) { - middle = (low + high) * 0.5; - - pos = this._pointOnCircle(x, y, radius, middle); - angle = Math.atan2(node.y - pos.y, node.x - pos.x); - distanceToBorder = node.distanceToBorder(ctx, angle); - distanceToPoint = Math.sqrt(Math.pow(pos.x - node.x, 2) + Math.pow(pos.y - node.y, 2)); - difference = distanceToBorder - distanceToPoint; - if (Math.abs(difference) < threshold) { - break; // found - } else if (difference > 0) { - // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. - if (direction > 0) { - low = middle; - } else { - high = middle; - } - } else { - if (direction > 0) { - high = middle; - } else { - low = middle; - } - } - iteration++; - } - pos.t = middle; +var _classCallCheck2 = __webpack_require__(0); - return pos; - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * Get the line width of the edge. Depends on width and whether one of the - * connected nodes is selected. - * @return {Number} width - * @private - */ +var _createClass2 = __webpack_require__(1); - }, { - key: 'getLineWidth', - value: function getLineWidth(selected, hover) { - if (selected === true) { - return Math.max(this.selectionWidth, 0.3 / this.body.view.scale); - } else { - if (hover === true) { - return Math.max(this.hoverWidth, 0.3 / this.body.view.scale); - } else { - return Math.max(this.options.width, 0.3 / this.body.view.scale); - } - } - } - }, { - key: 'getColor', - value: function getColor(ctx, values, selected, hover) { - if (values.inheritsColor !== false) { - // when this is a loop edge, just use the 'from' method - if (values.inheritsColor === 'both' && this.from.id !== this.to.id) { - var grd = ctx.createLinearGradient(this.from.x, this.from.y, this.to.x, this.to.y); - var fromColor = void 0, - toColor = void 0; - fromColor = this.from.options.color.highlight.border; - toColor = this.to.options.color.highlight.border; - - if (this.from.selected === false && this.to.selected === false) { - fromColor = util.overrideOpacity(this.from.options.color.border, values.opacity); - toColor = util.overrideOpacity(this.to.options.color.border, values.opacity); - } else if (this.from.selected === true && this.to.selected === false) { - toColor = this.to.options.color.border; - } else if (this.from.selected === false && this.to.selected === true) { - fromColor = this.from.options.color.border; - } - grd.addColorStop(0, fromColor); - grd.addColorStop(1, toColor); +var _createClass3 = _interopRequireDefault(_createClass2); - // -------------------- this returns -------------------- // - return grd; - } +var _possibleConstructorReturn2 = __webpack_require__(4); - if (values.inheritsColor === "to") { - return util.overrideOpacity(this.to.options.color.border, values.opacity); - } else { - // "from" - return util.overrideOpacity(this.from.options.color.border, values.opacity); - } - } else { - return util.overrideOpacity(values.color, values.opacity); - } - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - /** - * Draw a line from a node to itself, a circle - * @param {CanvasRenderingContext2D} ctx - * @param {Number} x - * @param {Number} y - * @param {Number} radius - * @private - */ +var _inherits2 = __webpack_require__(5); - }, { - key: '_circle', - value: function _circle(ctx, values, x, y, radius) { - // draw shadow if enabled - this.enableShadow(ctx, values); +var _inherits3 = _interopRequireDefault(_inherits2); - // draw a circle - ctx.beginPath(); - ctx.arc(x, y, radius, 0, 2 * Math.PI, false); - ctx.stroke(); +var _NodeBase2 = __webpack_require__(23); - // disable shadows for other elements. - this.disableShadow(ctx, values); - } +var _NodeBase3 = _interopRequireDefault(_NodeBase2); - /** - * Calculate the distance between a point (x3,y3) and a line segment from - * (x1,y1) to (x2,y2). - * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment - * @param {number} x1 - * @param {number} y1 - * @param {number} x2 - * @param {number} y2 - * @param {number} x3 - * @param {number} y3 - * @private - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - }, { - key: 'getDistanceToEdge', - value: function getDistanceToEdge(x1, y1, x2, y2, x3, y3, via, values) { - // x3,y3 is the point - var returnValue = 0; - if (this.from != this.to) { - returnValue = this._getDistanceToEdge(x1, y1, x2, y2, x3, y3, via); - } else { - var _getCircleData10 = this._getCircleData(undefined), - _getCircleData11 = (0, _slicedToArray3['default'])(_getCircleData10, 3), - x = _getCircleData11[0], - y = _getCircleData11[1], - radius = _getCircleData11[2]; +/** + * Am Ellipse Node/Cluster shape. + * + * @extends NodeBase + */ +var Ellipse = function (_NodeBase) { + (0, _inherits3['default'])(Ellipse, _NodeBase); - var dx = x - x3; - var dy = y - y3; - returnValue = Math.abs(Math.sqrt(dx * dx + dy * dy) - radius); - } + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Ellipse(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Ellipse); + return (0, _possibleConstructorReturn3['default'])(this, (Ellipse.__proto__ || (0, _getPrototypeOf2['default'])(Ellipse)).call(this, options, body, labelModule)); + } - if (this.labelModule.size.left < x3 && this.labelModule.size.left + this.labelModule.size.width > x3 && this.labelModule.size.top < y3 && this.labelModule.size.top + this.labelModule.size.height > y3) { - return 0; - } else { - return returnValue; - } - } - }, { - key: '_getDistanceToLine', - value: function _getDistanceToLine(x1, y1, x2, y2, x3, y3) { - var px = x2 - x1; - var py = y2 - y1; - var something = px * px + py * py; - var u = ((x3 - x1) * px + (y3 - y1) * py) / something; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [selected] + * @param {boolean} [hover] + */ - if (u > 1) { - u = 1; - } else if (u < 0) { - u = 0; - } - var x = x1 + u * px; - var y = y1 + u * py; - var dx = x - x3; - var dy = y - y3; + (0, _createClass3['default'])(Ellipse, [{ + key: 'resize', + value: function resize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; - //# Note: If the actual distance does not matter, - //# if you only want to compare what this function - //# returns to other results of this function, you - //# can just return the squared distance instead - //# (i.e. remove the sqrt) to gain a little performance + if (this.needsRefresh(selected, hover)) { + var dimensions = this.getDimensionsFromLabel(ctx, selected, hover); - return Math.sqrt(dx * dx + dy * dy); + this.height = dimensions.height * 2; + this.width = dimensions.width + dimensions.height; + this.radius = 0.5 * this.width; } + } - /** - * - * @param ctx - * @param position - * @param viaNode - */ - - }, { - key: 'getArrowData', - value: function getArrowData(ctx, position, viaNode, selected, hover, values) { - // set lets - var angle = void 0; - var arrowPoint = void 0; - var node1 = void 0; - var node2 = void 0; - var guideOffset = void 0; - var scaleFactor = void 0; - var type = void 0; - var lineWidth = values.width; - - if (position === 'from') { - node1 = this.from; - node2 = this.to; - guideOffset = 0.1; - scaleFactor = values.fromArrowScale; - type = values.fromArrowType; - } else if (position === 'to') { - node1 = this.to; - node2 = this.from; - guideOffset = -0.1; - scaleFactor = values.toArrowScale; - type = values.toArrowType; - } else { - node1 = this.to; - node2 = this.from; - scaleFactor = values.middleArrowScale; - type = values.middleArrowType; - } - - // if not connected to itself - if (node1 != node2) { - if (position !== 'middle') { - // draw arrow head - if (this.options.smooth.enabled === true) { - arrowPoint = this.findBorderPosition(node1, ctx, { via: viaNode }); - var guidePos = this.getPoint(Math.max(0.0, Math.min(1.0, arrowPoint.t + guideOffset)), viaNode); - angle = Math.atan2(arrowPoint.y - guidePos.y, arrowPoint.x - guidePos.x); - } else { - angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); - arrowPoint = this.findBorderPosition(node1, ctx); - } - } else { - angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); - arrowPoint = this.getPoint(0.5, viaNode); // this is 0.6 to account for the size of the arrow. - } - } else { - // draw circle - var _getCircleData12 = this._getCircleData(ctx), - _getCircleData13 = (0, _slicedToArray3['default'])(_getCircleData12, 3), - x = _getCircleData13[0], - y = _getCircleData13[1], - radius = _getCircleData13[2]; - - if (position === 'from') { - arrowPoint = this.findBorderPosition(this.from, ctx, { x: x, y: y, low: 0.25, high: 0.6, direction: -1 }); - angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; - } else if (position === 'to') { - arrowPoint = this.findBorderPosition(this.from, ctx, { x: x, y: y, low: 0.6, high: 1.0, direction: 1 }); - angle = arrowPoint.t * -2 * Math.PI + 1.5 * Math.PI - 1.1 * Math.PI; - } else { - arrowPoint = this._pointOnCircle(x, y, radius, 0.175); - angle = 3.9269908169872414; // === 0.175 * -2 * Math.PI + 1.5 * Math.PI + 0.1 * Math.PI; - } - } - - var length = 15 * scaleFactor + 3 * lineWidth; // 3* lineWidth is the width of the edge. - - var xi = arrowPoint.x - length * 0.9 * Math.cos(angle); - var yi = arrowPoint.y - length * 0.9 * Math.sin(angle); - var arrowCore = { x: xi, y: yi }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - return { point: arrowPoint, core: arrowCore, angle: angle, length: length, type: type }; - } + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.resize(ctx, selected, hover); + this.left = x - this.width * 0.5; + this.top = y - this.height * 0.5; - /** - * - * @param ctx - * @param selected - * @param hover - * @param arrowData - */ + this.initContextForDraw(ctx, values); + ctx.ellipse_vis(this.left, this.top, this.width, this.height); + this.performFill(ctx, values); - }, { - key: 'drawArrowHead', - value: function drawArrowHead(ctx, values, selected, hover, arrowData) { - // set style - ctx.strokeStyle = this.getColor(ctx, values, selected, hover); - ctx.fillStyle = ctx.strokeStyle; - ctx.lineWidth = values.width; + this.updateBoundingBox(x, y, ctx, selected, hover); + this.labelModule.draw(ctx, x, y, selected, hover); + } - if (arrowData.type && arrowData.type.toLowerCase() === 'circle') { - // draw circle at the end of the line - ctx.circleEndpoint(arrowData.point.x, arrowData.point.y, arrowData.angle, arrowData.length); - } else { - // draw arrow at the end of the line - ctx.arrowEndpoint(arrowData.point.x, arrowData.point.y, arrowData.angle, arrowData.length); - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - // draw shadow if enabled - this.enableShadow(ctx, values); - ctx.fill(); - // disable shadows for other elements. - this.disableShadow(ctx, values); - } - }, { - key: 'enableShadow', - value: function enableShadow(ctx, values) { - if (values.shadow === true) { - ctx.shadowColor = values.shadowColor; - ctx.shadowBlur = values.shadowSize; - ctx.shadowOffsetX = values.shadowX; - ctx.shadowOffsetY = values.shadowY; - } - } - }, { - key: 'disableShadow', - value: function disableShadow(ctx, values) { - if (values.shadow === true) { - ctx.shadowColor = 'rgba(0,0,0,0)'; - ctx.shadowBlur = 0; - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - } - } - }]); - return EdgeBase; - }(); + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + this.resize(ctx); + var a = this.width * 0.5; + var b = this.height * 0.5; + var w = Math.sin(angle) * a; + var h = Math.cos(angle) * b; + return a * b / Math.sqrt(w * w + h * h); + } + }]); + return Ellipse; +}(_NodeBase3['default']); - exports['default'] = EdgeBase; +exports['default'] = Ellipse; /***/ }), -/* 207 */ +/* 206 */ /***/ (function(module, exports, __webpack_require__) { - "use strict"; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _slicedToArray2 = __webpack_require__(171); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getPrototypeOf = __webpack_require__(3); - var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var _getPrototypeOf = __webpack_require__(176); +var _classCallCheck2 = __webpack_require__(0); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _classCallCheck2 = __webpack_require__(135); +var _createClass2 = __webpack_require__(1); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _createClass3 = _interopRequireDefault(_createClass2); - var _createClass2 = __webpack_require__(136); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _createClass3 = _interopRequireDefault(_createClass2); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _possibleConstructorReturn2 = __webpack_require__(179); +var _inherits2 = __webpack_require__(5); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +var _inherits3 = _interopRequireDefault(_inherits2); - var _inherits2 = __webpack_require__(180); +var _NodeBase2 = __webpack_require__(23); - var _inherits3 = _interopRequireDefault(_inherits2); +var _NodeBase3 = _interopRequireDefault(_NodeBase2); - var _BezierEdgeBase2 = __webpack_require__(205); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2); +/** + * An icon replacement for the default Node shape. + * + * @extends NodeBase + */ +var Icon = function (_NodeBase) { + (0, _inherits3['default'])(Icon, _NodeBase); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Icon(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Icon); - var BezierEdgeDynamic = function (_BezierEdgeBase) { - (0, _inherits3["default"])(BezierEdgeDynamic, _BezierEdgeBase); + var _this = (0, _possibleConstructorReturn3['default'])(this, (Icon.__proto__ || (0, _getPrototypeOf2['default'])(Icon)).call(this, options, body, labelModule)); - function BezierEdgeDynamic(options, body, labelModule) { - (0, _classCallCheck3["default"])(this, BezierEdgeDynamic); + _this._setMargins(labelModule); + return _this; + } - // --> this calls the setOptions below - var _this = (0, _possibleConstructorReturn3["default"])(this, (BezierEdgeDynamic.__proto__ || (0, _getPrototypeOf2["default"])(BezierEdgeDynamic)).call(this, options, body, labelModule)); - //this.via = undefined; // Here for completeness but not allowed to defined before super() is invoked. + /** + * + * @param {CanvasRenderingContext2D} ctx - Unused. + * @param {boolean} [selected] + * @param {boolean} [hover] + */ - _this._boundFunction = function () { - _this.positionBezierNode(); - }; - _this.body.emitter.on("_repositionBezierNodes", _this._boundFunction); - return _this; + (0, _createClass3['default'])(Icon, [{ + key: 'resize', + value: function resize(ctx, selected, hover) { + if (this.needsRefresh(selected, hover)) { + this.iconSize = { + width: Number(this.options.icon.size), + height: Number(this.options.icon.size) + }; + this.width = this.iconSize.width + this.margin.right + this.margin.left; + this.height = this.iconSize.height + this.margin.top + this.margin.bottom; + this.radius = 0.5 * this.width; + } } - (0, _createClass3["default"])(BezierEdgeDynamic, [{ - key: "setOptions", - value: function setOptions(options) { - // check if the physics has changed. - var physicsChange = false; - if (this.options.physics !== options.physics) { - physicsChange = true; - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - // set the options and the to and from nodes - this.options = options; - this.id = this.options.id; - this.from = this.body.nodes[this.options.from]; - this.to = this.body.nodes[this.options.to]; + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.resize(ctx, selected, hover); + this.options.icon.size = this.options.icon.size || 50; - // setup the support node and connect - this.setupSupportNode(); - this.connect(); + this.left = x - this.width / 2; + this.top = y - this.height / 2; + this._icon(ctx, x, y, selected, hover, values); - // when we change the physics state of the edge, we reposition the support node. - if (physicsChange === true) { - this.via.setOptions({ physics: this.options.physics }); - this.positionBezierNode(); - } - } - }, { - key: "connect", - value: function connect() { - this.from = this.body.nodes[this.options.from]; - this.to = this.body.nodes[this.options.to]; - if (this.from === undefined || this.to === undefined || this.options.physics === false) { - this.via.setOptions({ physics: false }); - } else { - // fix weird behaviour where a self referencing node has physics enabled - if (this.from.id === this.to.id) { - this.via.setOptions({ physics: false }); - } else { - this.via.setOptions({ physics: true }); - } - } + if (this.options.label !== undefined) { + var iconTextSpacing = 5; + this.labelModule.draw(ctx, this.left + this.iconSize.width / 2 + this.margin.left, y + this.height / 2 + iconTextSpacing, selected); } - /** - * remove the support nodes - * @returns {boolean} - */ + this.updateBoundingBox(x, y); + } - }, { - key: "cleanup", - value: function cleanup() { - this.body.emitter.off("_repositionBezierNodes", this._boundFunction); - if (this.via !== undefined) { - delete this.body.nodes[this.via.id]; - this.via = undefined; - return true; - } - return false; - } + /** + * + * @param {number} x + * @param {number} y + */ - /** - * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but - * are used for the force calculation. - * - * The changed data is not called, if needed, it is returned by the main edge constructor. - * @private - */ + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y) { + this.boundingBox.top = y - this.options.icon.size * 0.5; + this.boundingBox.left = x - this.options.icon.size * 0.5; + this.boundingBox.right = x + this.options.icon.size * 0.5; + this.boundingBox.bottom = y + this.options.icon.size * 0.5; - }, { - key: "setupSupportNode", - value: function setupSupportNode() { - if (this.via === undefined) { - var nodeId = "edgeId:" + this.id; - var node = this.body.functions.createNode({ - id: nodeId, - shape: 'circle', - physics: true, - hidden: true - }); - this.body.nodes[nodeId] = node; - this.via = node; - this.via.parentEdgeId = this.id; - this.positionBezierNode(); - } - } - }, { - key: "positionBezierNode", - value: function positionBezierNode() { - if (this.via !== undefined && this.from !== undefined && this.to !== undefined) { - this.via.x = 0.5 * (this.from.x + this.to.x); - this.via.y = 0.5 * (this.from.y + this.to.y); - } else if (this.via !== undefined) { - this.via.x = 0; - this.via.y = 0; - } + if (this.options.label !== undefined && this.labelModule.size.width > 0) { + var iconTextSpacing = 5; + this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); + this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); + this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelModule.size.height + iconTextSpacing); } + } - /** - * Draw a line between two nodes - * @param {CanvasRenderingContext2D} ctx - * @private - */ + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover - Unused + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - }, { - key: "_line", - value: function _line(ctx, values, viaNode) { - this._bezierCurve(ctx, values, viaNode); - } - }, { - key: "getViaNode", - value: function getViaNode() { - return this.via; - } + }, { + key: '_icon', + value: function _icon(ctx, x, y, selected, hover, values) { + var iconSize = Number(this.options.icon.size); - /** - * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way - * @param percentage - * @param viaNode - * @returns {{x: number, y: number}} - * @private - */ + if (this.options.icon.code !== undefined) { + ctx.font = (selected ? "bold " : "") + iconSize + "px " + this.options.icon.face; - }, { - key: "getPoint", - value: function getPoint(percentage) { - var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.via; + // draw icon + ctx.fillStyle = this.options.icon.color || "black"; + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; - var t = percentage; - var x = void 0, - y = void 0; - if (this.from === this.to) { - var _getCircleData = this._getCircleData(this.from), - _getCircleData2 = (0, _slicedToArray3["default"])(_getCircleData, 3), - cx = _getCircleData2[0], - cy = _getCircleData2[1], - cr = _getCircleData2[2]; - - var a = 2 * Math.PI * (1 - t); - x = cx + cr * Math.sin(a); - y = cy + cr - cr * (1 - Math.cos(a)); - } else { - x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; - y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; - } + // draw shadow if enabled + this.enableShadow(ctx, values); + ctx.fillText(this.options.icon.code, x, y); - return { x: x, y: y }; - } - }, { - key: "_findBorderPosition", - value: function _findBorderPosition(nearNode, ctx) { - return this._findBorderPositionBezier(nearNode, ctx, this.via); - } - }, { - key: "_getDistanceToEdge", - value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { - // x3,y3 is the point - return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, this.via); + // disable shadows for other elements. + this.disableShadow(ctx, values); + } else { + console.error('When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.'); } - }]); - return BezierEdgeDynamic; - }(_BezierEdgeBase3["default"]); + } - exports["default"] = BezierEdgeDynamic; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ + + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Icon; +}(_NodeBase3['default']); + +exports['default'] = Icon; /***/ }), -/* 208 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _getPrototypeOf = __webpack_require__(176); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _getPrototypeOf = __webpack_require__(3); + +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +var _classCallCheck2 = __webpack_require__(0); - var _classCallCheck2 = __webpack_require__(135); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _createClass2 = __webpack_require__(1); - var _createClass2 = __webpack_require__(136); +var _createClass3 = _interopRequireDefault(_createClass2); - var _createClass3 = _interopRequireDefault(_createClass2); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _possibleConstructorReturn2 = __webpack_require__(179); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +var _inherits2 = __webpack_require__(5); - var _inherits2 = __webpack_require__(180); +var _inherits3 = _interopRequireDefault(_inherits2); - var _inherits3 = _interopRequireDefault(_inherits2); +var _CircleImageBase2 = __webpack_require__(73); - var _BezierEdgeBase2 = __webpack_require__(205); +var _CircleImageBase3 = _interopRequireDefault(_CircleImageBase2); - var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +/** + * An image-based replacement for the default Node shape. + * + * @extends CircleImageBase + */ +var Image = function (_CircleImageBase) { + (0, _inherits3['default'])(Image, _CircleImageBase); + + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + * @param {Image} imageObj + * @param {Image} imageObjAlt + */ + function Image(options, body, labelModule, imageObj, imageObjAlt) { + (0, _classCallCheck3['default'])(this, Image); + + var _this = (0, _possibleConstructorReturn3['default'])(this, (Image.__proto__ || (0, _getPrototypeOf2['default'])(Image)).call(this, options, body, labelModule)); + + _this.setImages(imageObj, imageObjAlt); + return _this; + } + + /** + * + * @param {CanvasRenderingContext2D} ctx - Unused. + * @param {boolean} [selected] + * @param {boolean} [hover] + */ + + + (0, _createClass3['default'])(Image, [{ + key: 'resize', + value: function resize(ctx) { + var selected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.selected; + var hover = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.hover; - var BezierEdgeStatic = function (_BezierEdgeBase) { - (0, _inherits3['default'])(BezierEdgeStatic, _BezierEdgeBase); + var imageAbsent = this.imageObj.src === undefined || this.imageObj.width === undefined || this.imageObj.height === undefined; - function BezierEdgeStatic(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, BezierEdgeStatic); - return (0, _possibleConstructorReturn3['default'])(this, (BezierEdgeStatic.__proto__ || (0, _getPrototypeOf2['default'])(BezierEdgeStatic)).call(this, options, body, labelModule)); + if (imageAbsent) { + var side = this.options.size * 2; + this.width = side; + this.height = side; + return; + } + + if (this.needsRefresh(selected, hover)) { + this._resizeImage(); + } } /** - * Draw a line between two nodes + * * @param {CanvasRenderingContext2D} ctx - * @private + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values */ + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.switchImages(selected); + this.resize(); + this.left = x - this.width / 2; + this.top = y - this.height / 2; + + if (this.options.shapeProperties.useBorderWithImage === true) { + var neutralborderWidth = this.options.borderWidth; + var selectionLineWidth = this.options.borderWidthSelected || 2 * this.options.borderWidth; + var borderWidth = (selected ? selectionLineWidth : neutralborderWidth) / this.body.view.scale; + ctx.lineWidth = Math.min(this.width, borderWidth); - (0, _createClass3['default'])(BezierEdgeStatic, [{ - key: '_line', - value: function _line(ctx, values, viaNode) { - this._bezierCurve(ctx, values, viaNode); - } - }, { - key: 'getViaNode', - value: function getViaNode() { - return this._getViaCoordinates(); - } + ctx.beginPath(); - /** - * We do not use the to and fromPoints here to make the via nodes the same as edges without arrows. - * @returns {{x: undefined, y: undefined}} - * @private - */ + // setup the line properties. + ctx.strokeStyle = selected ? this.options.color.highlight.border : hover ? this.options.color.hover.border : this.options.color.border; - }, { - key: '_getViaCoordinates', - value: function _getViaCoordinates() { - // Assumption: x/y coordinates in from/to always defined - var xVia = undefined; - var yVia = undefined; - var factor = this.options.smooth.roundness; - var type = this.options.smooth.type; - var dx = Math.abs(this.from.x - this.to.x); - var dy = Math.abs(this.from.y - this.to.y); - if (type === 'discrete' || type === 'diagonalCross') { - var stepX = void 0; - var stepY = void 0; + // set a fillstyle + ctx.fillStyle = selected ? this.options.color.highlight.background : hover ? this.options.color.hover.background : this.options.color.background; - if (dx <= dy) { - stepX = stepY = factor * dy; - } else { - stepX = stepY = factor * dx; - } + // draw a rectangle to form the border around. This rectangle is filled so the opacity of a picture (in future vis releases?) can be used to tint the image + ctx.rect(this.left - 0.5 * ctx.lineWidth, this.top - 0.5 * ctx.lineWidth, this.width + ctx.lineWidth, this.height + ctx.lineWidth); + ctx.fill(); - if (this.from.x > this.to.x) stepX = -stepX; - if (this.from.y >= this.to.y) stepY = -stepY; + this.performStroke(ctx, values); - xVia = this.from.x + stepX; - yVia = this.from.y + stepY; + ctx.closePath(); + } - if (type === "discrete") { - if (dx <= dy) { - xVia = dx < factor * dy ? this.from.x : xVia; - } else { - yVia = dy < factor * dx ? this.from.y : yVia; - } - } - } else if (type === "straightCross") { - var _stepX = (1 - factor) * dx; - var _stepY = (1 - factor) * dy; + this._drawImageAtPosition(ctx, values); - if (dx <= dy) { - // up - down - _stepX = 0; - if (this.from.y < this.to.y) _stepY = -_stepY; - } else { - // left - right - if (this.from.x < this.to.x) _stepX = -_stepX; - _stepY = 0; - } - xVia = this.to.x + _stepX; - yVia = this.to.y + _stepY; - } else if (type === 'horizontal') { - var _stepX2 = (1 - factor) * dx; - if (this.from.x < this.to.x) _stepX2 = -_stepX2; - xVia = this.to.x + _stepX2; - yVia = this.from.y; - } else if (type === 'vertical') { - var _stepY2 = (1 - factor) * dy; - if (this.from.y < this.to.y) _stepY2 = -_stepY2; - xVia = this.from.x; - yVia = this.to.y + _stepY2; - } else if (type === 'curvedCW') { - dx = this.to.x - this.from.x; - dy = this.from.y - this.to.y; - var radius = Math.sqrt(dx * dx + dy * dy); - var pi = Math.PI; - - var originalAngle = Math.atan2(dy, dx); - var myAngle = (originalAngle + (factor * 0.5 + 0.5) * pi) % (2 * pi); - - xVia = this.from.x + (factor * 0.5 + 0.5) * radius * Math.sin(myAngle); - yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle); - } else if (type === 'curvedCCW') { - dx = this.to.x - this.from.x; - dy = this.from.y - this.to.y; - var _radius = Math.sqrt(dx * dx + dy * dy); - var _pi = Math.PI; - - var _originalAngle = Math.atan2(dy, dx); - var _myAngle = (_originalAngle + (-factor * 0.5 + 0.5) * _pi) % (2 * _pi); - - xVia = this.from.x + (factor * 0.5 + 0.5) * _radius * Math.sin(_myAngle); - yVia = this.from.y + (factor * 0.5 + 0.5) * _radius * Math.cos(_myAngle); - } else { - // continuous - var _stepX3 = void 0; - var _stepY3 = void 0; + this._drawImageLabel(ctx, x, y, selected, hover); - if (dx <= dy) { - _stepX3 = _stepY3 = factor * dy; - } else { - _stepX3 = _stepY3 = factor * dx; - } + this.updateBoundingBox(x, y); + } - if (this.from.x > this.to.x) _stepX3 = -_stepX3; - if (this.from.y >= this.to.y) _stepY3 = -_stepY3; + /** + * + * @param {number} x + * @param {number} y + */ - xVia = this.from.x + _stepX3; - yVia = this.from.y + _stepY3; + }, { + key: 'updateBoundingBox', + value: function updateBoundingBox(x, y) { + this.resize(); + this._updateBoundingBox(x, y); - if (dx <= dy) { - if (this.from.x <= this.to.x) { - xVia = this.to.x < xVia ? this.to.x : xVia; - } else { - xVia = this.to.x > xVia ? this.to.x : xVia; - } - } else { - if (this.from.y >= this.to.y) { - yVia = this.to.y > yVia ? this.to.y : yVia; - } else { - yVia = this.to.y < yVia ? this.to.y : yVia; - } - } - } - return { x: xVia, y: yVia }; + if (this.options.label !== undefined && this.labelModule.size.width > 0) { + this.boundingBox.left = Math.min(this.boundingBox.left, this.labelModule.size.left); + this.boundingBox.right = Math.max(this.boundingBox.right, this.labelModule.size.left + this.labelModule.size.width); + this.boundingBox.bottom = Math.max(this.boundingBox.bottom, this.boundingBox.bottom + this.labelOffset); } - }, { - key: '_findBorderPosition', - value: function _findBorderPosition(nearNode, ctx) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + } - return this._findBorderPositionBezier(nearNode, ctx, options.via); - } - }, { - key: '_getDistanceToEdge', - value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { - var viaNode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates(); - // x3,y3 is the point - return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, viaNode); - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - /** - * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way - * @param percentage - * @param viaNode - * @returns {{x: number, y: number}} - * @private - */ + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Image; +}(_CircleImageBase3['default']); - }, { - key: 'getPoint', - value: function getPoint(percentage) { - var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates(); +exports['default'] = Image; - var t = percentage; - var x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; - var y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; +/***/ }), +/* 208 */ +/***/ (function(module, exports, __webpack_require__) { - return { x: x, y: y }; - } - }]); - return BezierEdgeStatic; - }(_BezierEdgeBase3['default']); +"use strict"; - exports['default'] = BezierEdgeStatic; -/***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, "__esModule", { + value: true +}); - 'use strict'; +var _getPrototypeOf = __webpack_require__(3); - Object.defineProperty(exports, "__esModule", { - value: true - }); +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + +var _classCallCheck2 = __webpack_require__(0); - var _getPrototypeOf = __webpack_require__(176); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +var _createClass2 = __webpack_require__(1); - var _classCallCheck2 = __webpack_require__(135); +var _createClass3 = _interopRequireDefault(_createClass2); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _createClass2 = __webpack_require__(136); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _createClass3 = _interopRequireDefault(_createClass2); +var _inherits2 = __webpack_require__(5); - var _possibleConstructorReturn2 = __webpack_require__(179); +var _inherits3 = _interopRequireDefault(_inherits2); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +var _ShapeBase2 = __webpack_require__(24); - var _inherits2 = __webpack_require__(180); +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - var _inherits3 = _interopRequireDefault(_inherits2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _EdgeBase2 = __webpack_require__(206); +/** + * A Square Node/Cluster shape. + * + * @extends ShapeBase + */ +var Square = function (_ShapeBase) { + (0, _inherits3['default'])(Square, _ShapeBase); - var _EdgeBase3 = _interopRequireDefault(_EdgeBase2); + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Square(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Square); + return (0, _possibleConstructorReturn3['default'])(this, (Square.__proto__ || (0, _getPrototypeOf2['default'])(Square)).call(this, options, body, labelModule)); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - var StraightEdge = function (_EdgeBase) { - (0, _inherits3['default'])(StraightEdge, _EdgeBase); - function StraightEdge(options, body, labelModule) { - (0, _classCallCheck3['default'])(this, StraightEdge); - return (0, _possibleConstructorReturn3['default'])(this, (StraightEdge.__proto__ || (0, _getPrototypeOf2['default'])(StraightEdge)).call(this, options, body, labelModule)); + (0, _createClass3['default'])(Square, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'square', 2, x, y, selected, hover, values); } /** - * Draw a line between two nodes + * * @param {CanvasRenderingContext2D} ctx - * @private + * @param {number} angle + * @returns {number} */ + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Square; +}(_ShapeBase3['default']); - (0, _createClass3['default'])(StraightEdge, [{ - key: '_line', - value: function _line(ctx, values) { - // draw a straight line - ctx.beginPath(); - ctx.moveTo(this.fromPoint.x, this.fromPoint.y); - ctx.lineTo(this.toPoint.x, this.toPoint.y); - // draw shadow if enabled - this.enableShadow(ctx, values); - ctx.stroke(); - this.disableShadow(ctx, values); - } - }, { - key: 'getViaNode', - value: function getViaNode() { - return undefined; - } - - /** - * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way - * @param percentage - * @param via - * @returns {{x: number, y: number}} - * @private - */ - - }, { - key: 'getPoint', - value: function getPoint(percentage) { - return { - x: (1 - percentage) * this.fromPoint.x + percentage * this.toPoint.x, - y: (1 - percentage) * this.fromPoint.y + percentage * this.toPoint.y - }; - } - }, { - key: '_findBorderPosition', - value: function _findBorderPosition(nearNode, ctx) { - var node1 = this.to; - var node2 = this.from; - if (nearNode.id === this.from.id) { - node1 = this.from; - node2 = this.to; - } +exports['default'] = Square; - var angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); - var dx = node1.x - node2.x; - var dy = node1.y - node2.y; - var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); - var toBorderDist = nearNode.distanceToBorder(ctx, angle); - var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; +/***/ }), +/* 209 */ +/***/ (function(module, exports, __webpack_require__) { - var borderPos = {}; - borderPos.x = (1 - toBorderPoint) * node2.x + toBorderPoint * node1.x; - borderPos.y = (1 - toBorderPoint) * node2.y + toBorderPoint * node1.y; +"use strict"; - return borderPos; - } - }, { - key: '_getDistanceToEdge', - value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { - // x3,y3 is the point - return this._getDistanceToLine(x1, y1, x2, y2, x3, y3); - } - }]); - return StraightEdge; - }(_EdgeBase3['default']); - exports['default'] = StraightEdge; +Object.defineProperty(exports, "__esModule", { + value: true +}); -/***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +var _getPrototypeOf = __webpack_require__(3); - 'use strict'; +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - Object.defineProperty(exports, "__esModule", { - value: true - }); +var _classCallCheck2 = __webpack_require__(0); - var _keys = __webpack_require__(58); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _keys2 = _interopRequireDefault(_keys); +var _createClass2 = __webpack_require__(1); - var _slicedToArray2 = __webpack_require__(171); +var _createClass3 = _interopRequireDefault(_createClass2); - var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _typeof2 = __webpack_require__(62); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _typeof3 = _interopRequireDefault(_typeof2); +var _inherits2 = __webpack_require__(5); - var _classCallCheck2 = __webpack_require__(135); +var _inherits3 = _interopRequireDefault(_inherits2); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _ShapeBase2 = __webpack_require__(24); - var _createClass2 = __webpack_require__(136); +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - var _createClass3 = _interopRequireDefault(_createClass2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +/** + * A Hexagon Node/Cluster shape. + * + * @extends ShapeBase + */ +var Hexagon = function (_ShapeBase) { + (0, _inherits3['default'])(Hexagon, _ShapeBase); - var util = __webpack_require__(1); - var NetworkUtil = __webpack_require__(211)['default']; + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Hexagon(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Hexagon); + return (0, _possibleConstructorReturn3['default'])(this, (Hexagon.__proto__ || (0, _getPrototypeOf2['default'])(Hexagon)).call(this, options, body, labelModule)); + } /** - * Container for derived data on current network, relating to hierarchy. * - * Local, private class. - * - * TODO: Perhaps move more code for hierarchy state handling to this class. - * Till now, only the required and most obvious has been done. + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values */ - var HierarchicalStatus = function () { - function HierarchicalStatus() { - (0, _classCallCheck3['default'])(this, HierarchicalStatus); - - this.childrenReference = {}; - this.parentReference = {}; - this.levels = {}; - this.trees = {}; - this.isTree = false; + (0, _createClass3['default'])(Hexagon, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'hexagon', 4, x, y, selected, hover, values); } /** - * Add the relation between given nodes to the current state. + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} */ + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Hexagon; +}(_ShapeBase3['default']); - (0, _createClass3['default'])(HierarchicalStatus, [{ - key: 'addRelation', - value: function addRelation(parentNodeId, childNodeId) { - if (this.childrenReference[parentNodeId] === undefined) { - this.childrenReference[parentNodeId] = []; - } - this.childrenReference[parentNodeId].push(childNodeId); +exports['default'] = Hexagon; - if (this.parentReference[childNodeId] === undefined) { - this.parentReference[childNodeId] = []; - } - this.parentReference[childNodeId].push(parentNodeId); - } +/***/ }), +/* 210 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Check if the current state is for a tree or forest network. - * - * This is the case if every node has at most one parent. - * - * Pre: parentReference init'ed properly for current network - */ +"use strict"; - }, { - key: 'checkIfTree', - value: function checkIfTree() { - for (var i in this.parentReference) { - if (this.parentReference[i].length > 1) { - this.isTree = false; - return; - } - } - this.isTree = true; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * Ensure level for given id is defined. - * - * Sets level to zero for given node id if not already present - */ +var _getPrototypeOf = __webpack_require__(3); - }, { - key: 'ensureLevel', - value: function ensureLevel(nodeId) { - if (this.levels[nodeId] === undefined) { - this.levels[nodeId] = 0; - } - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - /** - * get the maximum level of a branch. - * - * TODO: Never entered; find a test case to test this! - */ +var _classCallCheck2 = __webpack_require__(0); - }, { - key: 'getMaxLevel', - value: function getMaxLevel(nodeId) { - var _this = this; - - var accumulator = {}; - - var _getMaxLevel = function _getMaxLevel(nodeId) { - if (accumulator[nodeId] !== undefined) { - return accumulator[nodeId]; - } - var level = _this.levels[nodeId]; - if (_this.childrenReference[nodeId]) { - var children = _this.childrenReference[nodeId]; - if (children.length > 0) { - for (var i = 0; i < children.length; i++) { - level = Math.max(level, _getMaxLevel(children[i])); - } - } - } - accumulator[nodeId] = level; - return level; - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - return _getMaxLevel(nodeId); - } - }, { - key: 'levelDownstream', - value: function levelDownstream(nodeA, nodeB) { - if (this.levels[nodeB.id] === undefined) { - // set initial level - if (this.levels[nodeA.id] === undefined) { - this.levels[nodeA.id] = 0; - } - // set level - this.levels[nodeB.id] = this.levels[nodeA.id] + 1; - } - } +var _createClass2 = __webpack_require__(1); - /** - * Small util method to set the minimum levels of the nodes to zero. - */ +var _createClass3 = _interopRequireDefault(_createClass2); - }, { - key: 'setMinLevelToZero', - value: function setMinLevelToZero(nodes) { - var minLevel = 1e9; - // get the minimum level - for (var nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - if (this.levels[nodeId] !== undefined) { - minLevel = Math.min(this.levels[nodeId], minLevel); - } - } - } +var _possibleConstructorReturn2 = __webpack_require__(4); - // subtract the minimum from the set so we have a range starting from 0 - for (var _nodeId in nodes) { - if (nodes.hasOwnProperty(_nodeId)) { - if (this.levels[_nodeId] !== undefined) { - this.levels[_nodeId] -= minLevel; - } - } - } - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - /** - * Get the min and max xy-coordinates of a given tree - */ +var _inherits2 = __webpack_require__(5); - }, { - key: 'getTreeSize', - value: function getTreeSize(nodes, index) { - var min_x = 1e9; - var max_x = -1e9; - var min_y = 1e9; - var max_y = -1e9; - - for (var nodeId in this.trees) { - if (this.trees.hasOwnProperty(nodeId)) { - if (this.trees[nodeId] === index) { - var node = nodes[nodeId]; - min_x = Math.min(node.x, min_x); - max_x = Math.max(node.x, max_x); - min_y = Math.min(node.y, min_y); - max_y = Math.max(node.y, max_y); - } - } - } +var _inherits3 = _interopRequireDefault(_inherits2); - return { - min_x: min_x, - max_x: max_x, - min_y: min_y, - max_y: max_y - }; - } - }]); - return HierarchicalStatus; - }(); +var _ShapeBase2 = __webpack_require__(24); - var LayoutEngine = function () { - function LayoutEngine(body) { - (0, _classCallCheck3['default'])(this, LayoutEngine); +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - this.body = body; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - this.initialRandomSeed = Math.round(Math.random() * 1000000); - this.randomSeed = this.initialRandomSeed; - this.setPhysics = false; - this.options = {}; - this.optionsBackup = { physics: {} }; +/** + * A Star Node/Cluster shape. + * + * @extends ShapeBase + */ +var Star = function (_ShapeBase) { + (0, _inherits3['default'])(Star, _ShapeBase); - this.defaultOptions = { - randomSeed: undefined, - improvedLayout: true, - hierarchical: { - enabled: false, - levelSeparation: 150, - nodeSpacing: 100, - treeSpacing: 200, - blockShifting: true, - edgeMinimization: true, - parentCentralization: true, - direction: 'UD', // UD, DU, LR, RL - sortMethod: 'hubsize' // hubsize, directed - } - }; - util.extend(this.options, this.defaultOptions); - this.bindEventListeners(); - } + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Star(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Star); + return (0, _possibleConstructorReturn3['default'])(this, (Star.__proto__ || (0, _getPrototypeOf2['default'])(Star)).call(this, options, body, labelModule)); + } - (0, _createClass3['default'])(LayoutEngine, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this2 = this; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - this.body.emitter.on('_dataChanged', function () { - _this2.setupHierarchicalLayout(); - }); - this.body.emitter.on('_dataLoaded', function () { - _this2.layoutNetwork(); - }); - this.body.emitter.on('_resetHierarchicalLayout', function () { - _this2.setupHierarchicalLayout(); - }); - this.body.emitter.on('_adjustEdgesForHierarchicalLayout', function () { - if (_this2.options.hierarchical.enabled !== true) { - return; - } - // get the type of static smooth curve in case it is required - var type = _this2.getStaticType(); - // force all edges into static smooth curves. - _this2.body.emitter.emit('_forceDisableDynamicCurves', type, false); - }); - } - }, { - key: 'setOptions', - value: function setOptions(options, allOptions) { - if (options !== undefined) { - var hierarchical = this.options.hierarchical; - var prevHierarchicalState = hierarchical.enabled; - util.selectiveDeepExtend(["randomSeed", "improvedLayout"], this.options, options); - util.mergeOptions(this.options, options, 'hierarchical'); - if (options.randomSeed !== undefined) { - this.initialRandomSeed = options.randomSeed; - } - - if (hierarchical.enabled === true) { - if (prevHierarchicalState === true) { - // refresh the overridden options for nodes and edges. - this.body.emitter.emit('refresh', true); - } + (0, _createClass3['default'])(Star, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'star', 4, x, y, selected, hover, values); + } - // make sure the level separation is the right way up - if (hierarchical.direction === 'RL' || hierarchical.direction === 'DU') { - if (hierarchical.levelSeparation > 0) { - hierarchical.levelSeparation *= -1; - } - } else { - if (hierarchical.levelSeparation < 0) { - hierarchical.levelSeparation *= -1; - } - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - this.body.emitter.emit('_resetHierarchicalLayout'); - // because the hierarchical system needs it's own physics and smooth curve settings, - // we adapt the other options if needed. - return this.adaptAllOptionsForHierarchicalLayout(allOptions); - } else { - if (prevHierarchicalState === true) { - // refresh the overridden options for nodes and edges. - this.body.emitter.emit('refresh'); - return util.deepExtend(allOptions, this.optionsBackup); - } - } - } - return allOptions; - } - }, { - key: 'adaptAllOptionsForHierarchicalLayout', - value: function adaptAllOptionsForHierarchicalLayout(allOptions) { - if (this.options.hierarchical.enabled === true) { - var backupPhysics = this.optionsBackup.physics; - - // set the physics - if (allOptions.physics === undefined || allOptions.physics === true) { - allOptions.physics = { - enabled: backupPhysics.enabled === undefined ? true : backupPhysics.enabled, - solver: 'hierarchicalRepulsion' - }; - backupPhysics.enabled = backupPhysics.enabled === undefined ? true : backupPhysics.enabled; - backupPhysics.solver = backupPhysics.solver || 'barnesHut'; - } else if ((0, _typeof3['default'])(allOptions.physics) === 'object') { - backupPhysics.enabled = allOptions.physics.enabled === undefined ? true : allOptions.physics.enabled; - backupPhysics.solver = allOptions.physics.solver || 'barnesHut'; - allOptions.physics.solver = 'hierarchicalRepulsion'; - } else if (allOptions.physics !== false) { - backupPhysics.solver = 'barnesHut'; - allOptions.physics = { solver: 'hierarchicalRepulsion' }; - } - - // get the type of static smooth curve in case it is required - var type = this.getStaticType(); - - // disable smooth curves if nothing is defined. If smooth curves have been turned on, - // turn them into static smooth curves. - if (allOptions.edges === undefined) { - this.optionsBackup.edges = { smooth: { enabled: true, type: 'dynamic' } }; - allOptions.edges = { smooth: false }; - } else if (allOptions.edges.smooth === undefined) { - this.optionsBackup.edges = { smooth: { enabled: true, type: 'dynamic' } }; - allOptions.edges.smooth = false; - } else { - if (typeof allOptions.edges.smooth === 'boolean') { - this.optionsBackup.edges = { smooth: allOptions.edges.smooth }; - allOptions.edges.smooth = { enabled: allOptions.edges.smooth, type: type }; - } else { - var smooth = allOptions.edges.smooth; + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Star; +}(_ShapeBase3['default']); - // allow custom types except for dynamic - if (smooth.type !== undefined && smooth.type !== 'dynamic') { - type = smooth.type; - } +exports['default'] = Star; - // TODO: this is options merging; see if the standard routines can be used here. - this.optionsBackup.edges = { - smooth: smooth.enabled === undefined ? true : smooth.enabled, - type: smooth.type === undefined ? 'dynamic' : smooth.type, - roundness: smooth.roundness === undefined ? 0.5 : smooth.roundness, - forceDirection: smooth.forceDirection === undefined ? false : smooth.forceDirection - }; +/***/ }), +/* 211 */ +/***/ (function(module, exports, __webpack_require__) { - // NOTE: Copying an object to self; this is basically setting defaults for undefined variables - allOptions.edges.smooth = { - enabled: smooth.enabled === undefined ? true : smooth.enabled, - type: type, - roundness: smooth.roundness === undefined ? 0.5 : smooth.roundness, - forceDirection: smooth.forceDirection === undefined ? false : smooth.forceDirection - }; - } - } +"use strict"; - // Force all edges into static smooth curves. - // Only applies to edges that do not use the global options for smooth. - this.body.emitter.emit('_forceDisableDynamicCurves', type); - } - return allOptions; - } - }, { - key: 'seededRandom', - value: function seededRandom() { - var x = Math.sin(this.randomSeed++) * 10000; - return x - Math.floor(x); - } - }, { - key: 'positionInitially', - value: function positionInitially(nodesArray) { - if (this.options.hierarchical.enabled !== true) { - this.randomSeed = this.initialRandomSeed; - var radius = nodesArray.length + 50; - for (var i = 0; i < nodesArray.length; i++) { - var node = nodesArray[i]; - var angle = 2 * Math.PI * this.seededRandom(); - if (node.x === undefined) { - node.x = radius * Math.cos(angle); - } - if (node.y === undefined) { - node.y = radius * Math.sin(angle); - } - } - } - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * Use Kamada Kawai to position nodes. This is quite a heavy algorithm so if there are a lot of nodes we - * cluster them first to reduce the amount. - */ +var _getPrototypeOf = __webpack_require__(3); - }, { - key: 'layoutNetwork', - value: function layoutNetwork() { - if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) { - var indices = this.body.nodeIndices; - - // first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible - // nodes have predefined positions we use this. - var positionDefined = 0; - for (var i = 0; i < indices.length; i++) { - var node = this.body.nodes[indices[i]]; - if (node.predefinedPosition === true) { - positionDefined += 1; - } - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - // if less than half of the nodes have a predefined position we continue - if (positionDefined < 0.5 * indices.length) { - var MAX_LEVELS = 10; - var level = 0; - var clusterThreshold = 150; - // Performance enhancement, during clustering edges need only be simple straight lines. - // These options don't propagate outside the clustering phase. - var clusterOptions = { - clusterEdgeProperties: { - smooth: { - enabled: false - } - } - }; +var _classCallCheck2 = __webpack_require__(0); - // if there are a lot of nodes, we cluster before we run the algorithm. - // NOTE: this part fails to find clusters for large scale-free networks, which should - // be easily clusterable. - // TODO: examine why this is so - if (indices.length > clusterThreshold) { - var startLength = indices.length; - while (indices.length > clusterThreshold && level <= MAX_LEVELS) { - //console.time("clustering") - level += 1; - var before = indices.length; - // if there are many nodes we do a hubsize cluster - if (level % 3 === 0) { - this.body.modules.clustering.clusterBridges(clusterOptions); - } else { - this.body.modules.clustering.clusterOutliers(clusterOptions); - } - var after = indices.length; - if (before == after && level % 3 !== 0) { - this._declusterAll(); - this.body.emitter.emit("_layoutFailed"); - console.info("This network could not be positioned by this version of the improved layout algorithm." + " Please disable improvedLayout for better performance."); - return; - } - //console.timeEnd("clustering") - //console.log(before,level,after); - } - // increase the size of the edges - this.body.modules.kamadaKawai.setOptions({ springLength: Math.max(150, 2 * startLength) }); - } - if (level > MAX_LEVELS) { - console.info("The clustering didn't succeed within the amount of interations allowed," + " progressing with partial result."); - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // position the system for these nodes and edges - this.body.modules.kamadaKawai.solve(indices, this.body.edgeIndices, true); +var _createClass2 = __webpack_require__(1); - // shift to center point - this._shiftToCenter(); +var _createClass3 = _interopRequireDefault(_createClass2); - // perturb the nodes a little bit to force the physics to kick in - var offset = 70; - for (var _i = 0; _i < indices.length; _i++) { - // Only perturb the nodes that aren't fixed - var _node = this.body.nodes[indices[_i]]; - if (_node.predefinedPosition === false) { - _node.x += (0.5 - this.seededRandom()) * offset; - _node.y += (0.5 - this.seededRandom()) * offset; - } - } +var _possibleConstructorReturn2 = __webpack_require__(4); - // uncluster all clusters - this._declusterAll(); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - // reposition all bezier nodes. - this.body.emitter.emit("_repositionBezierNodes"); - } - } - } +var _inherits2 = __webpack_require__(5); - /** - * Move all the nodes towards to the center so gravitational pull wil not move the nodes away from view - * @private - */ +var _inherits3 = _interopRequireDefault(_inherits2); - }, { - key: '_shiftToCenter', - value: function _shiftToCenter() { - var range = NetworkUtil.getRangeCore(this.body.nodes, this.body.nodeIndices); - var center = NetworkUtil.findCenter(range); - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var node = this.body.nodes[this.body.nodeIndices[i]]; - node.x -= center.x; - node.y -= center.y; - } - } - }, { - key: '_declusterAll', - value: function _declusterAll() { - var clustersPresent = true; - while (clustersPresent === true) { - clustersPresent = false; - for (var i = 0; i < this.body.nodeIndices.length; i++) { - if (this.body.nodes[this.body.nodeIndices[i]].isCluster === true) { - clustersPresent = true; - this.body.modules.clustering.openCluster(this.body.nodeIndices[i], {}, false); - } - } - if (clustersPresent === true) { - this.body.emitter.emit('_dataChanged'); - } - } - } - }, { - key: 'getSeed', - value: function getSeed() { - return this.initialRandomSeed; - } +var _NodeBase2 = __webpack_require__(23); - /** - * This is the main function to layout the nodes in a hierarchical way. - * It checks if the node details are supplied correctly - * - * @private - */ +var _NodeBase3 = _interopRequireDefault(_NodeBase2); - }, { - key: 'setupHierarchicalLayout', - value: function setupHierarchicalLayout() { - if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) { - // get the size of the largest hubs and check if the user has defined a level for a node. - var node = void 0, - nodeId = void 0; - var definedLevel = false; - var definedPositions = true; - var undefinedLevel = false; - this.lastNodeOnLevel = {}; - this.hierarchical = new HierarchicalStatus(); - this.treeIndex = -1; - - this.distributionOrdering = {}; - this.distributionIndex = {}; - this.distributionOrderingPresence = {}; - - for (nodeId in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(nodeId)) { - node = this.body.nodes[nodeId]; - if (node.options.x === undefined && node.options.y === undefined) { - definedPositions = false; - } - if (node.options.level !== undefined) { - definedLevel = true; - this.hierarchical.levels[nodeId] = node.options.level; - } else { - undefinedLevel = true; - } - } - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // if the user defined some levels but not all, alert and run without hierarchical layout - if (undefinedLevel === true && definedLevel === true) { - throw new Error('To use the hierarchical layout, nodes require either no predefined levels' + ' or levels have to be defined for all nodes.'); - } else { - // define levels if undefined by the users. Based on hubsize. - if (undefinedLevel === true) { - var sortMethod = this.options.hierarchical.sortMethod; - if (sortMethod === 'hubsize') { - this._determineLevelsByHubsize(); - } else if (sortMethod === 'directed') { - this._determineLevelsDirected(); - } else if (sortMethod === 'custom') { - this._determineLevelsCustomCallback(); - } - } +/** + * A text-based replacement for the default Node shape. + * + * @extends NodeBase + */ +var Text = function (_NodeBase) { + (0, _inherits3['default'])(Text, _NodeBase); - // fallback for cases where there are nodes but no edges - for (var _nodeId2 in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(_nodeId2)) { - this.hierarchical.ensureLevel(_nodeId2); - } - } - // check the distribution of the nodes per level. - var distribution = this._getDistribution(); + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Text(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Text); - // get the parent children relations. - this._generateMap(); + var _this = (0, _possibleConstructorReturn3['default'])(this, (Text.__proto__ || (0, _getPrototypeOf2['default'])(Text)).call(this, options, body, labelModule)); - // place the nodes on the canvas. - this._placeNodesByHierarchy(distribution); + _this._setMargins(labelModule); + return _this; + } - // condense the whitespace. - this._condenseHierarchy(); + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} selected + * @param {boolean} hover + */ - // shift to center so gravity does not have to do much - this._shiftToCenter(); - } - } + + (0, _createClass3['default'])(Text, [{ + key: 'resize', + value: function resize(ctx, selected, hover) { + if (this.needsRefresh(selected, hover)) { + this.textSize = this.labelModule.getTextSize(ctx, selected, hover); + this.width = this.textSize.width + this.margin.right + this.margin.left; + this.height = this.textSize.height + this.margin.top + this.margin.bottom; + this.radius = 0.5 * this.width; } + } - /** - * @private - */ + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x width + * @param {number} y height + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - }, { - key: '_condenseHierarchy', - value: function _condenseHierarchy() { - var _this3 = this; - - // Global var in this scope to define when the movement has stopped. - var stillShifting = false; - var branches = {}; - // first we have some methods to help shifting trees around. - // the main method to shift the trees - var shiftTrees = function shiftTrees() { - var treeSizes = getTreeSizes(); - var shiftBy = 0; - for (var i = 0; i < treeSizes.length - 1; i++) { - var diff = treeSizes[i].max - treeSizes[i + 1].min; - shiftBy += diff + _this3.options.hierarchical.treeSpacing; - shiftTree(i + 1, shiftBy); - } - }; + }, { + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this.resize(ctx, selected, hover); + this.left = x - this.width / 2; + this.top = y - this.height / 2; - // shift a single tree by an offset - var shiftTree = function shiftTree(index, offset) { - for (var nodeId in _this3.hierarchical.trees) { - if (_this3.hierarchical.trees.hasOwnProperty(nodeId)) { - if (_this3.hierarchical.trees[nodeId] === index) { - var node = _this3.body.nodes[nodeId]; - var pos = _this3._getPositionForHierarchy(node); - _this3._setPositionForHierarchy(node, pos + offset, undefined, true); - } - } - } - }; + // draw shadow if enabled + this.enableShadow(ctx, values); + this.labelModule.draw(ctx, this.left + this.textSize.width / 2 + this.margin.left, this.top + this.textSize.height / 2 + this.margin.top, selected, hover); - // get the width of a tree - var getTreeSize = function getTreeSize(index) { - var res = _this3.hierarchical.getTreeSize(_this3.body.nodes, index); - if (_this3._isVertical()) { - return { min: res.min_x, max: res.max_x }; - } else { - return { min: res.min_y, max: res.max_y }; - } - }; + // disable shadows for other elements. + this.disableShadow(ctx, values); - // get the width of all trees - var getTreeSizes = function getTreeSizes() { - var treeWidths = []; - for (var i = 0; i <= _this3.treeIndex; i++) { - treeWidths.push(getTreeSize(i)); - } - return treeWidths; - }; + this.updateBoundingBox(x, y, ctx, selected, hover); + } - // get a map of all nodes in this branch - var getBranchNodes = function getBranchNodes(source, map) { - if (map[source.id]) { - return; - } - map[source.id] = true; - if (_this3.hierarchical.childrenReference[source.id]) { - var children = _this3.hierarchical.childrenReference[source.id]; - if (children.length > 0) { - for (var i = 0; i < children.length; i++) { - getBranchNodes(_this3.body.nodes[children[i]], map); - } - } - } - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - // get a min max width as well as the maximum movement space it has on either sides - // we use min max terminology because width and height can interchange depending on the direction of the layout - var getBranchBoundary = function getBranchBoundary(branchMap) { - var maxLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1e9; - - var minSpace = 1e9; - var maxSpace = 1e9; - var min = 1e9; - var max = -1e9; - for (var branchNode in branchMap) { - if (branchMap.hasOwnProperty(branchNode)) { - var node = _this3.body.nodes[branchNode]; - var level = _this3.hierarchical.levels[node.id]; - var position = _this3._getPositionForHierarchy(node); - - // get the space around the node. - - var _getSpaceAroundNode2 = _this3._getSpaceAroundNode(node, branchMap), - _getSpaceAroundNode3 = (0, _slicedToArray3['default'])(_getSpaceAroundNode2, 2), - minSpaceNode = _getSpaceAroundNode3[0], - maxSpaceNode = _getSpaceAroundNode3[1]; - - minSpace = Math.min(minSpaceNode, minSpace); - maxSpace = Math.min(maxSpaceNode, maxSpace); - - // the width is only relevant for the levels two nodes have in common. This is why we filter on this. - if (level <= maxLevel) { - min = Math.min(position, min); - max = Math.max(position, max); - } - } - } + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Text; +}(_NodeBase3['default']); - return [min, max, minSpace, maxSpace]; - }; +exports['default'] = Text; - // check what the maximum level is these nodes have in common. - var getCollisionLevel = function getCollisionLevel(node1, node2) { - var maxLevel1 = _this3.hierarchical.getMaxLevel(node1.id); - var maxLevel2 = _this3.hierarchical.getMaxLevel(node2.id); - return Math.min(maxLevel1, maxLevel2); - }; +/***/ }), +/* 212 */ +/***/ (function(module, exports, __webpack_require__) { - // check if two nodes have the same parent(s) - var hasSameParent = function hasSameParent(node1, node2) { - var parents1 = _this3.hierarchical.parentReference[node1.id]; - var parents2 = _this3.hierarchical.parentReference[node2.id]; - if (parents1 === undefined || parents2 === undefined) { - return false; - } +"use strict"; - for (var i = 0; i < parents1.length; i++) { - for (var j = 0; j < parents2.length; j++) { - if (parents1[i] == parents2[j]) { - return true; - } - } - } - return false; - }; - // condense elements. These can be nodes or branches depending on the callback. - var shiftElementsCloser = function shiftElementsCloser(callback, levels, centerParents) { - for (var i = 0; i < levels.length; i++) { - var level = levels[i]; - var levelNodes = _this3.distributionOrdering[level]; - if (levelNodes.length > 1) { - for (var j = 0; j < levelNodes.length - 1; j++) { - if (hasSameParent(levelNodes[j], levelNodes[j + 1]) === true) { - if (_this3.hierarchical.trees[levelNodes[j].id] === _this3.hierarchical.trees[levelNodes[j + 1].id]) { - callback(levelNodes[j], levelNodes[j + 1], centerParents); - } - } - } - } - } - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - // callback for shifting branches - var branchShiftCallback = function branchShiftCallback(node1, node2) { - var centerParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - //window.CALLBACKS.push(() => { - var pos1 = _this3._getPositionForHierarchy(node1); - var pos2 = _this3._getPositionForHierarchy(node2); - var diffAbs = Math.abs(pos2 - pos1); - var nodeSpacing = _this3.options.hierarchical.nodeSpacing; - //console.log("NOW CHECKING:", node1.id, node2.id, diffAbs); - if (diffAbs > nodeSpacing) { - var branchNodes1 = {}; - var branchNodes2 = {}; - - getBranchNodes(node1, branchNodes1); - getBranchNodes(node2, branchNodes2); - - // check the largest distance between the branches - var maxLevel = getCollisionLevel(node1, node2); - - var _getBranchBoundary = getBranchBoundary(branchNodes1, maxLevel), - _getBranchBoundary2 = (0, _slicedToArray3['default'])(_getBranchBoundary, 4), - min1 = _getBranchBoundary2[0], - max1 = _getBranchBoundary2[1], - minSpace1 = _getBranchBoundary2[2], - maxSpace1 = _getBranchBoundary2[3]; - - var _getBranchBoundary3 = getBranchBoundary(branchNodes2, maxLevel), - _getBranchBoundary4 = (0, _slicedToArray3['default'])(_getBranchBoundary3, 4), - min2 = _getBranchBoundary4[0], - max2 = _getBranchBoundary4[1], - minSpace2 = _getBranchBoundary4[2], - maxSpace2 = _getBranchBoundary4[3]; - - //console.log(node1.id, getBranchBoundary(branchNodes1, maxLevel), node2.id, - // getBranchBoundary(branchNodes2, maxLevel), maxLevel); - - - var diffBranch = Math.abs(max1 - min2); - if (diffBranch > nodeSpacing) { - var offset = max1 - min2 + nodeSpacing; - if (offset < -minSpace2 + nodeSpacing) { - offset = -minSpace2 + nodeSpacing; - //console.log("RESETTING OFFSET", max1 - min2 + this.options.hierarchical.nodeSpacing, -minSpace2, offset); - } - if (offset < 0) { - //console.log("SHIFTING", node2.id, offset); - _this3._shiftBlock(node2.id, offset); - stillShifting = true; +var _getPrototypeOf = __webpack_require__(3); - if (centerParent === true) _this3._centerParent(node2); - } - } - } - //this.body.emitter.emit("_redraw");}) - }; +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var minimizeEdgeLength = function minimizeEdgeLength(iterations, node) { - //window.CALLBACKS.push(() => { - // console.log("ts",node.id); - var nodeId = node.id; - var allEdges = node.edges; - var nodeLevel = _this3.hierarchical.levels[node.id]; - - // gather constants - var C2 = _this3.options.hierarchical.levelSeparation * _this3.options.hierarchical.levelSeparation; - var referenceNodes = {}; - var aboveEdges = []; - for (var i = 0; i < allEdges.length; i++) { - var edge = allEdges[i]; - if (edge.toId != edge.fromId) { - var otherNode = edge.toId == nodeId ? edge.from : edge.to; - referenceNodes[allEdges[i].id] = otherNode; - if (_this3.hierarchical.levels[otherNode.id] < nodeLevel) { - aboveEdges.push(edge); - } - } - } +var _classCallCheck2 = __webpack_require__(0); - // differentiated sum of lengths based on only moving one node over one axis - var getFx = function getFx(point, edges) { - var sum = 0; - for (var _i2 = 0; _i2 < edges.length; _i2++) { - if (referenceNodes[edges[_i2].id] !== undefined) { - var a = _this3._getPositionForHierarchy(referenceNodes[edges[_i2].id]) - point; - sum += a / Math.sqrt(a * a + C2); - } - } - return sum; - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // doubly differentiated sum of lengths based on only moving one node over one axis - var getDFx = function getDFx(point, edges) { - var sum = 0; - for (var _i3 = 0; _i3 < edges.length; _i3++) { - if (referenceNodes[edges[_i3].id] !== undefined) { - var a = _this3._getPositionForHierarchy(referenceNodes[edges[_i3].id]) - point; - sum -= C2 * Math.pow(a * a + C2, -1.5); - } - } - return sum; - }; +var _createClass2 = __webpack_require__(1); - var getGuess = function getGuess(iterations, edges) { - var guess = _this3._getPositionForHierarchy(node); - // Newton's method for optimization - var guessMap = {}; - for (var _i4 = 0; _i4 < iterations; _i4++) { - var fx = getFx(guess, edges); - var dfx = getDFx(guess, edges); - - // we limit the movement to avoid instability. - var limit = 40; - var ratio = Math.max(-limit, Math.min(limit, Math.round(fx / dfx))); - guess = guess - ratio; - // reduce duplicates - if (guessMap[guess] !== undefined) { - break; - } - guessMap[guess] = _i4; - } - return guess; - }; +var _createClass3 = _interopRequireDefault(_createClass2); - var moveBranch = function moveBranch(guess) { - // position node if there is space - var nodePosition = _this3._getPositionForHierarchy(node); +var _possibleConstructorReturn2 = __webpack_require__(4); - // check movable area of the branch - if (branches[node.id] === undefined) { - var branchNodes = {}; - getBranchNodes(node, branchNodes); - branches[node.id] = branchNodes; - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _getBranchBoundary5 = getBranchBoundary(branches[node.id]), - _getBranchBoundary6 = (0, _slicedToArray3['default'])(_getBranchBoundary5, 4), - minBranch = _getBranchBoundary6[0], - maxBranch = _getBranchBoundary6[1], - minSpaceBranch = _getBranchBoundary6[2], - maxSpaceBranch = _getBranchBoundary6[3]; - - var diff = guess - nodePosition; - - // check if we are allowed to move the node: - var branchOffset = 0; - if (diff > 0) { - branchOffset = Math.min(diff, maxSpaceBranch - _this3.options.hierarchical.nodeSpacing); - } else if (diff < 0) { - branchOffset = -Math.min(-diff, minSpaceBranch - _this3.options.hierarchical.nodeSpacing); - } +var _inherits2 = __webpack_require__(5); - if (branchOffset != 0) { - //console.log("moving branch:",branchOffset, maxSpaceBranch, minSpaceBranch) - _this3._shiftBlock(node.id, branchOffset); - //this.body.emitter.emit("_redraw"); - stillShifting = true; - } - }; +var _inherits3 = _interopRequireDefault(_inherits2); - var moveNode = function moveNode(guess) { - var nodePosition = _this3._getPositionForHierarchy(node); +var _ShapeBase2 = __webpack_require__(24); - // position node if there is space +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - var _getSpaceAroundNode4 = _this3._getSpaceAroundNode(node), - _getSpaceAroundNode5 = (0, _slicedToArray3['default'])(_getSpaceAroundNode4, 2), - minSpace = _getSpaceAroundNode5[0], - maxSpace = _getSpaceAroundNode5[1]; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var diff = guess - nodePosition; - // check if we are allowed to move the node: - var newPosition = nodePosition; - if (diff > 0) { - newPosition = Math.min(nodePosition + (maxSpace - _this3.options.hierarchical.nodeSpacing), guess); - } else if (diff < 0) { - newPosition = Math.max(nodePosition - (minSpace - _this3.options.hierarchical.nodeSpacing), guess); - } +/** + * A Triangle Node/Cluster shape. + * + * @extends ShapeBase + */ +var Triangle = function (_ShapeBase) { + (0, _inherits3['default'])(Triangle, _ShapeBase); - if (newPosition !== nodePosition) { - //console.log("moving Node:",diff, minSpace, maxSpace); - _this3._setPositionForHierarchy(node, newPosition, undefined, true); - //this.body.emitter.emit("_redraw"); - stillShifting = true; - } - }; + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function Triangle(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, Triangle); + return (0, _possibleConstructorReturn3['default'])(this, (Triangle.__proto__ || (0, _getPrototypeOf2['default'])(Triangle)).call(this, options, body, labelModule)); + } - var guess = getGuess(iterations, aboveEdges); - moveBranch(guess); - guess = getGuess(iterations, allEdges); - moveNode(guess); - //}) - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x + * @param {number} y + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - // method to remove whitespace between branches. Because we do bottom up, we can center the parents. - var minimizeEdgeLengthBottomUp = function minimizeEdgeLengthBottomUp(iterations) { - var levels = (0, _keys2['default'])(_this3.distributionOrdering); - levels = levels.reverse(); - for (var i = 0; i < iterations; i++) { - stillShifting = false; - for (var j = 0; j < levels.length; j++) { - var level = levels[j]; - var levelNodes = _this3.distributionOrdering[level]; - for (var k = 0; k < levelNodes.length; k++) { - minimizeEdgeLength(1000, levelNodes[k]); - } - } - if (stillShifting !== true) { - //console.log("FINISHED minimizeEdgeLengthBottomUp IN " + i); - break; - } - } - }; - // method to remove whitespace between branches. Because we do bottom up, we can center the parents. - var shiftBranchesCloserBottomUp = function shiftBranchesCloserBottomUp(iterations) { - var levels = (0, _keys2['default'])(_this3.distributionOrdering); - levels = levels.reverse(); - for (var i = 0; i < iterations; i++) { - stillShifting = false; - shiftElementsCloser(branchShiftCallback, levels, true); - if (stillShifting !== true) { - //console.log("FINISHED shiftBranchesCloserBottomUp IN " + (i+1)); - break; - } - } - }; + (0, _createClass3['default'])(Triangle, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'triangle', 3, x, y, selected, hover, values); + } - // center all parents - var centerAllParents = function centerAllParents() { - for (var nodeId in _this3.body.nodes) { - if (_this3.body.nodes.hasOwnProperty(nodeId)) _this3._centerParent(_this3.body.nodes[nodeId]); - } - }; + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - // center all parents - var centerAllParentsBottomUp = function centerAllParentsBottomUp() { - var levels = (0, _keys2['default'])(_this3.distributionOrdering); - levels = levels.reverse(); - for (var i = 0; i < levels.length; i++) { - var level = levels[i]; - var levelNodes = _this3.distributionOrdering[level]; - for (var j = 0; j < levelNodes.length; j++) { - _this3._centerParent(levelNodes[j]); - } - } - }; + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return Triangle; +}(_ShapeBase3['default']); - // the actual work is done here. - if (this.options.hierarchical.blockShifting === true) { - shiftBranchesCloserBottomUp(5); - centerAllParents(); - } +exports['default'] = Triangle; - // minimize edge length - if (this.options.hierarchical.edgeMinimization === true) { - minimizeEdgeLengthBottomUp(20); - } +/***/ }), +/* 213 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.options.hierarchical.parentCentralization === true) { - centerAllParentsBottomUp(); - } +"use strict"; - shiftTrees(); - } - /** - * This gives the space around the node. IF a map is supplied, it will only check against nodes NOT in the map. - * This is used to only get the distances to nodes outside of a branch. - * @param node - * @param map - * @returns {*[]} - * @private - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); - }, { - key: '_getSpaceAroundNode', - value: function _getSpaceAroundNode(node, map) { - var useMap = true; - if (map === undefined) { - useMap = false; - } - var level = this.hierarchical.levels[node.id]; - if (level !== undefined) { - var index = this.distributionIndex[node.id]; - var position = this._getPositionForHierarchy(node); - var ordering = this.distributionOrdering[level]; - var minSpace = 1e9; - var maxSpace = 1e9; - if (index !== 0) { - var prevNode = ordering[index - 1]; - if (useMap === true && map[prevNode.id] === undefined || useMap === false) { - var prevPos = this._getPositionForHierarchy(prevNode); - minSpace = position - prevPos; - } - } +var _getPrototypeOf = __webpack_require__(3); - if (index != ordering.length - 1) { - var nextNode = ordering[index + 1]; - if (useMap === true && map[nextNode.id] === undefined || useMap === false) { - var nextPos = this._getPositionForHierarchy(nextNode); - maxSpace = Math.min(maxSpace, nextPos - position); - } - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - return [minSpace, maxSpace]; - } else { - return [0, 0]; - } - } +var _classCallCheck2 = __webpack_require__(0); - /** - * We use this method to center a parent node and check if it does not cross other nodes when it does. - * @param node - * @private - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - }, { - key: '_centerParent', - value: function _centerParent(node) { - if (this.hierarchical.parentReference[node.id]) { - var parents = this.hierarchical.parentReference[node.id]; - for (var i = 0; i < parents.length; i++) { - var parentId = parents[i]; - var parentNode = this.body.nodes[parentId]; - var children = this.hierarchical.childrenReference[parentId]; - - if (children !== undefined) { - // get the range of the children - var newPosition = this._getCenterPosition(children); - - var position = this._getPositionForHierarchy(parentNode); - - var _getSpaceAroundNode6 = this._getSpaceAroundNode(parentNode), - _getSpaceAroundNode7 = (0, _slicedToArray3['default'])(_getSpaceAroundNode6, 2), - minSpace = _getSpaceAroundNode7[0], - maxSpace = _getSpaceAroundNode7[1]; - - var diff = position - newPosition; - if (diff < 0 && Math.abs(diff) < maxSpace - this.options.hierarchical.nodeSpacing || diff > 0 && Math.abs(diff) < minSpace - this.options.hierarchical.nodeSpacing) { - this._setPositionForHierarchy(parentNode, newPosition, undefined, true); - } - } - } - } - } +var _createClass2 = __webpack_require__(1); - /** - * This function places the nodes on the canvas based on the hierarchial distribution. - * - * @param {Object} distribution | obtained by the function this._getDistribution() - * @private - */ +var _createClass3 = _interopRequireDefault(_createClass2); - }, { - key: '_placeNodesByHierarchy', - value: function _placeNodesByHierarchy(distribution) { - this.positionedNodes = {}; - // start placing all the level 0 nodes first. Then recursively position their branches. - for (var level in distribution) { - if (distribution.hasOwnProperty(level)) { - // sort nodes in level by position: - var nodeArray = (0, _keys2['default'])(distribution[level]); - nodeArray = this._indexArrayToNodes(nodeArray); - this._sortNodeArray(nodeArray); - var handledNodeCount = 0; - - for (var i = 0; i < nodeArray.length; i++) { - var node = nodeArray[i]; - if (this.positionedNodes[node.id] === undefined) { - var spacing = this.options.hierarchical.nodeSpacing; - var pos = spacing * handledNodeCount; - // We get the X or Y values we need and store them in pos and previousPos. - // The get and set make sure we get X or Y - if (handledNodeCount > 0) { - pos = this._getPositionForHierarchy(nodeArray[i - 1]) + spacing; - } - this._setPositionForHierarchy(node, pos, level); - this._validatePositionAndContinue(node, level, pos); +var _possibleConstructorReturn2 = __webpack_require__(4); - handledNodeCount++; - } - } - } - } - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - /** - * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes - * on a X position that ensures there will be no overlap. - * - * @param parentId - * @param parentLevel - * @private - */ +var _inherits2 = __webpack_require__(5); - }, { - key: '_placeBranchNodes', - value: function _placeBranchNodes(parentId, parentLevel) { - var childRef = this.hierarchical.childrenReference[parentId]; +var _inherits3 = _interopRequireDefault(_inherits2); - // if this is not a parent, cancel the placing. This can happen with multiple parents to one child. - if (childRef === undefined) { - return; - } +var _ShapeBase2 = __webpack_require__(24); - // get a list of childNodes - var childNodes = []; - for (var i = 0; i < childRef.length; i++) { - childNodes.push(this.body.nodes[childRef[i]]); - } +var _ShapeBase3 = _interopRequireDefault(_ShapeBase2); - // use the positions to order the nodes. - this._sortNodeArray(childNodes); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - // position the childNodes - for (var _i5 = 0; _i5 < childNodes.length; _i5++) { - var childNode = childNodes[_i5]; - var childNodeLevel = this.hierarchical.levels[childNode.id]; - // check if the child node is below the parent node and if it has already been positioned. - if (childNodeLevel > parentLevel && this.positionedNodes[childNode.id] === undefined) { - // get the amount of space required for this node. If parent the width is based on the amount of children. - var spacing = this.options.hierarchical.nodeSpacing; - var pos = void 0; +/** + * A downward facing Triangle Node/Cluster shape. + * + * @extends ShapeBase + */ +var TriangleDown = function (_ShapeBase) { + (0, _inherits3['default'])(TriangleDown, _ShapeBase); - // we get the X or Y values we need and store them in pos and previousPos. - // The get and set make sure we get X or Y - if (_i5 === 0) { - pos = this._getPositionForHierarchy(this.body.nodes[parentId]); - } else { - pos = this._getPositionForHierarchy(childNodes[_i5 - 1]) + spacing; - } - this._setPositionForHierarchy(childNode, pos, childNodeLevel); - this._validatePositionAndContinue(childNode, childNodeLevel, pos); - } else { - return; - } - } + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function TriangleDown(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, TriangleDown); + return (0, _possibleConstructorReturn3['default'])(this, (TriangleDown.__proto__ || (0, _getPrototypeOf2['default'])(TriangleDown)).call(this, options, body, labelModule)); + } - // center the parent nodes. - var center = this._getCenterPosition(childNodes); - this._setPositionForHierarchy(this.body.nodes[parentId], center, parentLevel); - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} x + * @param {number} y + * @param {boolean} selected + * @param {boolean} hover + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + */ - /** - * This method checks for overlap and if required shifts the branch. It also keeps records of positioned nodes. - * Finally it will call _placeBranchNodes to place the branch nodes. - * @param node - * @param level - * @param pos - * @private - */ - }, { - key: '_validatePositionAndContinue', - value: function _validatePositionAndContinue(node, level, pos) { - // This only works for strict hierarchical networks, i.e. trees and forests - // Early exit if this is not the case - if (!this.hierarchical.isTree) return; + (0, _createClass3['default'])(TriangleDown, [{ + key: 'draw', + value: function draw(ctx, x, y, selected, hover, values) { + this._drawShape(ctx, 'triangleDown', 3, x, y, selected, hover, values); + } - // if overlap has been detected, we shift the branch - if (this.lastNodeOnLevel[level] !== undefined) { - var previousPos = this._getPositionForHierarchy(this.body.nodes[this.lastNodeOnLevel[level]]); - if (pos - previousPos < this.options.hierarchical.nodeSpacing) { - var diff = previousPos + this.options.hierarchical.nodeSpacing - pos; - var sharedParent = this._findCommonParent(this.lastNodeOnLevel[level], node.id); - this._shiftBlock(sharedParent.withChild, diff); - } - } + /** + * + * @param {CanvasRenderingContext2D} ctx + * @param {number} angle + * @returns {number} + */ - // store change in position. - this.lastNodeOnLevel[level] = node.id; + }, { + key: 'distanceToBorder', + value: function distanceToBorder(ctx, angle) { + return this._distanceToBorder(ctx, angle); + } + }]); + return TriangleDown; +}(_ShapeBase3['default']); - this.positionedNodes[node.id] = true; +exports['default'] = TriangleDown; - this._placeBranchNodes(node.id, level); - } +/***/ }), +/* 214 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Receives an array with node indices and returns an array with the actual node references. - * Used for sorting based on node properties. - * @param idArray - */ +"use strict"; - }, { - key: '_indexArrayToNodes', - value: function _indexArrayToNodes(idArray) { - var array = []; - for (var i = 0; i < idArray.length; i++) { - array.push(this.body.nodes[idArray[i]]); - } - return array; - } - /** - * This function get the distribution of levels based on hubsize - * - * @returns {Object} - * @private - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); - }, { - key: '_getDistribution', - value: function _getDistribution() { - var distribution = {}; - var nodeId = void 0, - node = void 0; - - // we fix Y because the hierarchy is vertical, - // we fix X so we do not give a node an x position for a second time. - // the fix of X is removed after the x value has been set. - for (nodeId in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(nodeId)) { - node = this.body.nodes[nodeId]; - var level = this.hierarchical.levels[nodeId] === undefined ? 0 : this.hierarchical.levels[nodeId]; - if (this._isVertical()) { - node.y = this.options.hierarchical.levelSeparation * level; - node.options.fixed.y = true; - } else { - node.x = this.options.hierarchical.levelSeparation * level; - node.options.fixed.x = true; - } - if (distribution[level] === undefined) { - distribution[level] = {}; - } - distribution[level][nodeId] = node; - } - } - return distribution; - } +var _classCallCheck2 = __webpack_require__(0); - /** - * Return the active (i.e. visible) edges for this node - * - * @returns {array} Array of edge instances - * @private - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - }, { - key: '_getActiveEdges', - value: function _getActiveEdges(node) { - var result = []; +var _createClass2 = __webpack_require__(1); - for (var j in node.edges) { - var edge = node.edges[j]; - if (this.body.edgeIndices.indexOf(edge.id) !== -1) { - result.push(edge); - } - } +var _createClass3 = _interopRequireDefault(_createClass2); - return result; - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * Get the hubsizes for all active nodes. - * - * @returns {number} - * @private - */ +var util = __webpack_require__(2); +var DataSet = __webpack_require__(11); +var DataView = __webpack_require__(12); +var Edge = __webpack_require__(74)['default']; - }, { - key: '_getHubSizes', - value: function _getHubSizes() { - var hubSizes = {}; - var nodeIds = this.body.nodeIndices; +/** + * Handler for Edges + */ - for (var i in nodeIds) { - var nodeId = nodeIds[i]; - var node = this.body.nodes[nodeId]; - var hubSize = this._getActiveEdges(node).length; - hubSizes[hubSize] = true; - } +var EdgesHandler = function () { + /** + * @param {Object} body + * @param {Array.} images + * @param {Array.} groups + */ + function EdgesHandler(body, images, groups) { + var _this = this; - // Make an array of the size sorted descending - var result = []; - for (var size in hubSizes) { - result.push(Number(size)); - } - result.sort(function (a, b) { - return b - a; - }); + (0, _classCallCheck3['default'])(this, EdgesHandler); - return result; + this.body = body; + this.images = images; + this.groups = groups; + + // create the edge API in the body container + this.body.functions.createEdge = this.create.bind(this); + + this.edgesListeners = { + add: function add(event, params) { + _this.add(params.items); + }, + update: function update(event, params) { + _this.update(params.items); + }, + remove: function remove(event, params) { + _this.remove(params.items); } + }; - /** - * this function allocates nodes in levels based on the recursive branching from the largest hubs. - * - * @private - */ + this.options = {}; + this.defaultOptions = { + arrows: { + to: { enabled: false, scaleFactor: 1, type: 'arrow' }, // boolean / {arrowScaleFactor:1} / {enabled: false, arrowScaleFactor:1} + middle: { enabled: false, scaleFactor: 1, type: 'arrow' }, + from: { enabled: false, scaleFactor: 1, type: 'arrow' } + }, + arrowStrikethrough: true, + color: { + color: '#848484', + highlight: '#848484', + hover: '#848484', + inherit: 'from', + opacity: 1.0 + }, + dashes: false, + font: { + color: '#343434', + size: 14, // px + face: 'arial', + background: 'none', + strokeWidth: 2, // px + strokeColor: '#ffffff', + align: 'horizontal', + multi: false, + vadjust: 0, + bold: { + mod: 'bold' + }, + boldital: { + mod: 'bold italic' + }, + ital: { + mod: 'italic' + }, + mono: { + mod: '', + size: 15, // px + face: 'courier new', + vadjust: 2 + } + }, + hidden: false, + hoverWidth: 1.5, + label: undefined, + labelHighlightBold: true, + length: undefined, + physics: true, + scaling: { + min: 1, + max: 15, + label: { + enabled: true, + min: 14, + max: 30, + maxVisible: 30, + drawThreshold: 5 + }, + customScalingFunction: function customScalingFunction(min, max, total, value) { + if (max === min) { + return 0.5; + } else { + var scale = 1 / (max - min); + return Math.max(0, (value - min) * scale); + } + } + }, + selectionWidth: 1.5, + selfReferenceSize: 20, + shadow: { + enabled: false, + color: 'rgba(0,0,0,0.5)', + size: 10, + x: 5, + y: 5 + }, + smooth: { + enabled: true, + type: "dynamic", + forceDirection: 'none', + roundness: 0.5 + }, + title: undefined, + width: 1, + value: undefined + }; - }, { - key: '_determineLevelsByHubsize', - value: function _determineLevelsByHubsize() { - var _this4 = this; + util.deepExtend(this.options, this.defaultOptions); - var levelDownstream = function levelDownstream(nodeA, nodeB) { - _this4.hierarchical.levelDownstream(nodeA, nodeB); - }; + this.bindEventListeners(); + } - var hubSizes = this._getHubSizes(); + /** + * Binds event listeners + */ - for (var i = 0; i < hubSizes.length; ++i) { - var hubSize = hubSizes[i]; - if (hubSize === 0) break; - var nodeIds = this.body.nodeIndices; - for (var j in nodeIds) { - var nodeId = nodeIds[j]; - var node = this.body.nodes[nodeId]; + (0, _createClass3['default'])(EdgesHandler, [{ + key: 'bindEventListeners', + value: function bindEventListeners() { + var _this2 = this; + + // this allows external modules to force all dynamic curves to turn static. + this.body.emitter.on("_forceDisableDynamicCurves", function (type) { + var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - if (hubSize === this._getActiveEdges(node).length) { - this._crawlNetwork(levelDownstream, nodeId); + if (type === 'dynamic') { + type = 'continuous'; + } + var dataChanged = false; + for (var edgeId in _this2.body.edges) { + if (_this2.body.edges.hasOwnProperty(edgeId)) { + var edge = _this2.body.edges[edgeId]; + var edgeData = _this2.body.data.edges._data[edgeId]; + + // only forcibly remove the smooth curve if the data has been set of the edge has the smooth curves defined. + // this is because a change in the global would not affect these curves. + if (edgeData !== undefined) { + var smoothOptions = edgeData.smooth; + if (smoothOptions !== undefined) { + if (smoothOptions.enabled === true && smoothOptions.type === 'dynamic') { + if (type === undefined) { + edge.setOptions({ smooth: false }); + } else { + edge.setOptions({ smooth: { type: type } }); + } + dataChanged = true; + } + } } } } - } + if (emit === true && dataChanged === true) { + _this2.body.emitter.emit("_dataChanged"); + } + }); - /** - * TODO: release feature - * TODO: Determine if this feature is needed at all - * - * @private - */ + // this is called when options of EXISTING nodes or edges have changed. + // + // NOTE: Not true, called when options have NOT changed, for both existing as well as new nodes. + // See update() for logic. + // TODO: Verify and examine the consequences of this. It might still trigger when + // non-option fields have changed, but then reconnecting edges is still useless. + // Alternatively, it might also be called when edges are removed. + // + this.body.emitter.on("_dataUpdated", function () { + _this2.reconnectEdges(); + }); - }, { - key: '_determineLevelsCustomCallback', - value: function _determineLevelsCustomCallback() { - var _this5 = this; + // refresh the edges. Used when reverting from hierarchical layout + this.body.emitter.on("refreshEdges", this.refresh.bind(this)); + this.body.emitter.on("refresh", this.refresh.bind(this)); + this.body.emitter.on("destroy", function () { + util.forEach(_this2.edgesListeners, function (callback, event) { + if (_this2.body.data.edges) _this2.body.data.edges.off(event, callback); + }); + delete _this2.body.functions.createEdge; + delete _this2.edgesListeners.add; + delete _this2.edgesListeners.update; + delete _this2.edgesListeners.remove; + delete _this2.edgesListeners; + }); + } - var minLevel = 100000; + /** + * + * @param {Object} options + */ - // TODO: this should come from options. - var customCallback = function customCallback(nodeA, nodeB, edge) {}; + }, { + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + // use the parser from the Edge class to fill in all shorthand notations + Edge.parseOptions(this.options, options, true, this.defaultOptions, true); - // TODO: perhaps move to HierarchicalStatus. - // But I currently don't see the point, this method is not used. - var levelByDirection = function levelByDirection(nodeA, nodeB, edge) { - var levelA = _this5.hierarchical.levels[nodeA.id]; - // set initial level - if (levelA === undefined) { - levelA = _this5.hierarchical.levels[nodeA.id] = minLevel; + // update smooth settings in all edges + var dataChanged = false; + if (options.smooth !== undefined) { + for (var edgeId in this.body.edges) { + if (this.body.edges.hasOwnProperty(edgeId)) { + dataChanged = this.body.edges[edgeId].updateEdgeType() || dataChanged; + } } + } - var diff = customCallback(NetworkUtil.cloneOptions(nodeA, 'node'), NetworkUtil.cloneOptions(nodeB, 'node'), NetworkUtil.cloneOptions(edge, 'edge')); - - _this5.hierarchical.levels[nodeB.id] = levelA + diff; - }; + // update fonts in all edges + if (options.font !== undefined) { + for (var _edgeId in this.body.edges) { + if (this.body.edges.hasOwnProperty(_edgeId)) { + this.body.edges[_edgeId].updateLabelModule(); + } + } + } - this._crawlNetwork(levelByDirection); - this.hierarchical.setMinLevelToZero(this.body.nodes); + // update the state of the variables if needed + if (options.hidden !== undefined || options.physics !== undefined || dataChanged === true) { + this.body.emitter.emit('_dataChanged'); + } } + } - /** - * this function allocates nodes in levels based on the direction of the edges - * - * @param hubsize - * @private - */ + /** + * Load edges by reading the data table + * @param {Array | DataSet | DataView} edges The data containing the edges. + * @param {boolean} [doNotEmit=false] + * @private + */ - }, { - key: '_determineLevelsDirected', - value: function _determineLevelsDirected() { - var _this6 = this; + }, { + key: 'setData', + value: function setData(edges) { + var _this3 = this; - var minLevel = 10000; + var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var levelByDirection = function levelByDirection(nodeA, nodeB, edge) { - var levelA = _this6.hierarchical.levels[nodeA.id]; - // set initial level - if (levelA === undefined) { - levelA = _this6.hierarchical.levels[nodeA.id] = minLevel; - } - if (edge.toId == nodeB.id) { - _this6.hierarchical.levels[nodeB.id] = levelA + 1; - } else { - _this6.hierarchical.levels[nodeB.id] = levelA - 1; - } - }; + var oldEdgesData = this.body.data.edges; - this._crawlNetwork(levelByDirection); - this.hierarchical.setMinLevelToZero(this.body.nodes); + if (edges instanceof DataSet || edges instanceof DataView) { + this.body.data.edges = edges; + } else if (Array.isArray(edges)) { + this.body.data.edges = new DataSet(); + this.body.data.edges.add(edges); + } else if (!edges) { + this.body.data.edges = new DataSet(); + } else { + throw new TypeError('Array or DataSet expected'); } - /** - * Update the bookkeeping of parent and child. - * @private - */ + // TODO: is this null or undefined or false? + if (oldEdgesData) { + // unsubscribe from old dataset + util.forEach(this.edgesListeners, function (callback, event) { + oldEdgesData.off(event, callback); + }); + } - }, { - key: '_generateMap', - value: function _generateMap() { - var _this7 = this; + // remove drawn edges + this.body.edges = {}; - var fillInRelations = function fillInRelations(parentNode, childNode) { - if (_this7.hierarchical.levels[childNode.id] > _this7.hierarchical.levels[parentNode.id]) { - _this7.hierarchical.addRelation(parentNode.id, childNode.id); - } - }; + // TODO: is this null or undefined or false? + if (this.body.data.edges) { + // subscribe to new dataset + util.forEach(this.edgesListeners, function (callback, event) { + _this3.body.data.edges.on(event, callback); + }); - this._crawlNetwork(fillInRelations); - this.hierarchical.checkIfTree(); + // draw all new nodes + var ids = this.body.data.edges.getIds(); + this.add(ids, true); } - /** - * Crawl over the entire network and use a callback on each node couple that is connected to each other. - * @param callback | will receive nodeA, nodeB and the connecting edge. A and B are distinct. - * @param startingNodeId - * @private - */ + this.body.emitter.emit('_adjustEdgesForHierarchicalLayout'); + if (doNotEmit === false) { + this.body.emitter.emit("_dataChanged"); + } + } - }, { - key: '_crawlNetwork', - value: function _crawlNetwork() { - var _this8 = this; + /** + * Add edges + * @param {number[] | string[]} ids + * @param {boolean} [doNotEmit=false] + * @private + */ - var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {}; - var startingNodeId = arguments[1]; + }, { + key: 'add', + value: function add(ids) { + var doNotEmit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var progress = {}; - var treeIndex = 0; + var edges = this.body.edges; + var edgesData = this.body.data.edges; - var crawler = function crawler(node, tree) { - if (progress[node.id] === undefined) { + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; - if (_this8.hierarchical.trees[node.id] === undefined) { - _this8.hierarchical.trees[node.id] = tree; - _this8.treeIndex = Math.max(tree, _this8.treeIndex); - } + var oldEdge = edges[id]; + if (oldEdge) { + oldEdge.disconnect(); + } - progress[node.id] = true; - var childNode = void 0; - var edges = _this8._getActiveEdges(node); - for (var i = 0; i < edges.length; i++) { - var edge = edges[i]; - if (edge.connected === true) { - if (edge.toId == node.id) { - // '==' because id's can be string and numeric - childNode = edge.from; - } else { - childNode = edge.to; - } + var data = edgesData.get(id, { "showInternalIds": true }); + edges[id] = this.create(data); + } - if (node.id != childNode.id) { - // '!=' because id's can be string and numeric - callback(node, childNode, edge); - crawler(childNode, tree); - } - } - } - } - }; + this.body.emitter.emit('_adjustEdgesForHierarchicalLayout'); - // we can crawl from a specific node or over all nodes. - if (startingNodeId === undefined) { - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var node = this.body.nodes[this.body.nodeIndices[i]]; - if (progress[node.id] === undefined) { - crawler(node, treeIndex); - treeIndex += 1; - } - } + if (doNotEmit === false) { + this.body.emitter.emit("_dataChanged"); + } + } + + /** + * Update existing edges, or create them when not yet existing + * @param {number[] | string[]} ids + * @private + */ + + }, { + key: 'update', + value: function update(ids) { + var edges = this.body.edges; + var edgesData = this.body.data.edges; + var dataChanged = false; + for (var i = 0; i < ids.length; i++) { + var id = ids[i]; + var data = edgesData.get(id); + var edge = edges[id]; + if (edge !== undefined) { + // update edge + edge.disconnect(); + dataChanged = edge.setOptions(data) || dataChanged; // if a support node is added, data can be changed. + edge.connect(); } else { - var _node2 = this.body.nodes[startingNodeId]; - if (_node2 === undefined) { - console.error("Node not found:", startingNodeId); - return; - } - crawler(_node2); + // create edge + this.body.edges[id] = this.create(data); + dataChanged = true; } } - /** - * Shift a branch a certain distance - * @param parentId - * @param diff - * @private - */ + if (dataChanged === true) { + this.body.emitter.emit('_adjustEdgesForHierarchicalLayout'); + this.body.emitter.emit("_dataChanged"); + } else { + this.body.emitter.emit("_dataUpdated"); + } + } - }, { - key: '_shiftBlock', - value: function _shiftBlock(parentId, diff) { - var _this9 = this; + /** + * Remove existing edges. Non existing ids will be ignored + * @param {number[] | string[]} ids + * @param {boolean} [emit=true] + * @private + */ - var progress = {}; - var shifter = function shifter(parentId) { - if (progress[parentId]) { - return; - } - progress[parentId] = true; - if (_this9._isVertical()) { - _this9.body.nodes[parentId].x += diff; - } else { - _this9.body.nodes[parentId].y += diff; - } + }, { + key: 'remove', + value: function remove(ids) { + var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var childRef = _this9.hierarchical.childrenReference[parentId]; - if (childRef !== undefined) { - for (var i = 0; i < childRef.length; i++) { - shifter(childRef[i]); - } - } - }; - shifter(parentId); + if (ids.length === 0) return; // early out + + var edges = this.body.edges; + util.forEach(ids, function (id) { + var edge = edges[id]; + if (edge !== undefined) { + edge.remove(); + } + }); + + if (emit) { + this.body.emitter.emit("_dataChanged"); } + } - /** - * Find a common parent between branches. - * @param childA - * @param childB - * @returns {{foundParent, withChild}} - * @private - */ + /** + * Refreshes Edge Handler + */ - }, { - key: '_findCommonParent', - value: function _findCommonParent(childA, childB) { - var _this10 = this; - - var parents = {}; - var iterateParents = function iterateParents(parents, child) { - var parentRef = _this10.hierarchical.parentReference[child]; - if (parentRef !== undefined) { - for (var i = 0; i < parentRef.length; i++) { - var parent = parentRef[i]; - parents[parent] = true; - iterateParents(parents, parent); - } - } - }; - var findParent = function findParent(parents, child) { - var parentRef = _this10.hierarchical.parentReference[child]; - if (parentRef !== undefined) { - for (var i = 0; i < parentRef.length; i++) { - var parent = parentRef[i]; - if (parents[parent] !== undefined) { - return { foundParent: parent, withChild: child }; - } - var branch = findParent(parents, parent); - if (branch.foundParent !== null) { - return branch; - } - } - } - return { foundParent: null, withChild: child }; - }; + }, { + key: 'refresh', + value: function refresh() { + var _this4 = this; - iterateParents(parents, childA); - return findParent(parents, childB); - } + util.forEach(this.body.edges, function (edge, edgeId) { + var data = _this4.body.data.edges._data[edgeId]; + if (data !== undefined) { + edge.setOptions(data); + } + }); + } - /** - * Abstract the getting of the position so we won't have to repeat the check for direction all the time - * @param node - * @param position - * @param level - * @private - */ + /** + * + * @param {Object} properties + * @returns {Edge} + */ - }, { - key: '_setPositionForHierarchy', - value: function _setPositionForHierarchy(node, position, level) { - var doNotUpdate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + }, { + key: 'create', + value: function create(properties) { + return new Edge(properties, this.body, this.options, this.defaultOptions); + } - //console.log('_setPositionForHierarchy',node.id, position) - if (doNotUpdate !== true) { - if (this.distributionOrdering[level] === undefined) { - this.distributionOrdering[level] = []; - this.distributionOrderingPresence[level] = {}; - } + /** + * Reconnect all edges + * @private + */ - if (this.distributionOrderingPresence[level][node.id] === undefined) { - this.distributionOrdering[level].push(node); - this.distributionIndex[node.id] = this.distributionOrdering[level].length - 1; - } - this.distributionOrderingPresence[level][node.id] = true; - } + }, { + key: 'reconnectEdges', + value: function reconnectEdges() { + var id; + var nodes = this.body.nodes; + var edges = this.body.edges; - if (this._isVertical()) { - node.x = position; - } else { - node.y = position; + for (id in nodes) { + if (nodes.hasOwnProperty(id)) { + nodes[id].edges = []; } } - /** - * Utility function to cut down on typing this all the time. - * - * TODO: use this in all applicable situations in this class. - * - * @private - */ - - }, { - key: '_isVertical', - value: function _isVertical() { - return this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU'; + for (id in edges) { + if (edges.hasOwnProperty(id)) { + var edge = edges[id]; + edge.from = null; + edge.to = null; + edge.connect(); + } } + } - /** - * Abstract the getting of the position of a node so we do not have to repeat the direction check all the time. - * @param node - * @returns {number|*} - * @private - */ + /** + * + * @param {Edge.id} edgeId + * @returns {Array} + */ - }, { - key: '_getPositionForHierarchy', - value: function _getPositionForHierarchy(node) { - if (this._isVertical()) { - return node.x; - } else { - return node.y; + }, { + key: 'getConnectedNodes', + value: function getConnectedNodes(edgeId) { + var nodeList = []; + if (this.body.edges[edgeId] !== undefined) { + var edge = this.body.edges[edgeId]; + if (edge.fromId !== undefined) { + nodeList.push(edge.fromId); + } + if (edge.toId !== undefined) { + nodeList.push(edge.toId); } } + return nodeList; + } - /** - * Use the x or y value to sort the array, allowing users to specify order. - * @param nodeArray - * @private - */ + /** + * There is no direct relation between the nodes and the edges DataSet, + * so the right place to do call this is in the handler for event `_dataUpdated`. + */ - }, { - key: '_sortNodeArray', - value: function _sortNodeArray(nodeArray) { - if (nodeArray.length > 1) { - if (this._isVertical()) { - nodeArray.sort(function (a, b) { - return a.x - b.x; - }); - } else { - nodeArray.sort(function (a, b) { - return a.y - b.y; - }); - } - } - } + }, { + key: '_updateState', + value: function _updateState() { + this._addMissingEdges(); + this._removeInvalidEdges(); + } - /** - * Get the type of static smooth curve in case it is required. - * - * The return value is the type to use to translate dynamic curves to - * another type, in the case of hierarchical layout. Dynamic curves do - * not work for that layout type. - */ + /** + * Scan for missing nodes and remove corresponding edges, if any. + * @private + */ - }, { - key: 'getStaticType', - value: function getStaticType() { - // Node that 'type' is the edge type, and therefore 'orthogonal' to the layout type. - var type = 'horizontal'; - if (!this._isVertical()) { - type = 'vertical'; + }, { + key: '_removeInvalidEdges', + value: function _removeInvalidEdges() { + var _this5 = this; + + var edgesToDelete = []; + + util.forEach(this.body.edges, function (edge, id) { + var toNode = _this5.body.nodes[edge.toId]; + var fromNode = _this5.body.nodes[edge.fromId]; + + // Skip clustering edges here, let the Clustering module handle those + if (toNode !== undefined && toNode.isCluster === true || fromNode !== undefined && fromNode.isCluster === true) { + return; } - return type; - } + if (toNode === undefined || fromNode === undefined) { + edgesToDelete.push(id); + } + }); - /** - * Determine the center position of a branch from the passed list of child nodes - * - * This takes into account the positions of all the child nodes. - * @param childNodes {array} Array of either child nodes or node id's - * @return {number} - * @private - */ + this.remove(edgesToDelete, false); + } - }, { - key: '_getCenterPosition', - value: function _getCenterPosition(childNodes) { - var minPos = 1e9; - var maxPos = -1e9; + /** + * add all edges from dataset that are not in the cached state + * @private + */ - for (var i = 0; i < childNodes.length; i++) { - var childNode = void 0; - if (childNodes[i].id !== undefined) { - childNode = childNodes[i]; - } else { - var childNodeId = childNodes[i]; - childNode = this.body.nodes[childNodeId]; - } + }, { + key: '_addMissingEdges', + value: function _addMissingEdges() { + var edges = this.body.edges; + var edgesData = this.body.data.edges; + var addIds = []; - var position = this._getPositionForHierarchy(childNode); - minPos = Math.min(minPos, position); - maxPos = Math.max(maxPos, position); + edgesData.forEach(function (edgeData, edgeId) { + var edge = edges[edgeId]; + if (edge === undefined) { + addIds.push(edgeId); } + }); - return 0.5 * (minPos + maxPos); - } - }]); - return LayoutEngine; - }(); + this.add(addIds, true); + } + }]); + return EdgesHandler; +}(); - exports['default'] = LayoutEngine; +exports['default'] = EdgesHandler; /***/ }), -/* 211 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { - "use strict"; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _classCallCheck2 = __webpack_require__(135); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _slicedToArray2 = __webpack_require__(30); - var _createClass2 = __webpack_require__(136); +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - var _createClass3 = _interopRequireDefault(_createClass2); +var _getPrototypeOf = __webpack_require__(3); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - var util = __webpack_require__(1); +var _classCallCheck2 = __webpack_require__(0); - var NetworkUtil = function () { - function NetworkUtil() { - (0, _classCallCheck3["default"])(this, NetworkUtil); - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * Find the center position of the network considering the bounding boxes - */ +var _createClass2 = __webpack_require__(1); +var _createClass3 = _interopRequireDefault(_createClass2); - (0, _createClass3["default"])(NetworkUtil, null, [{ - key: "getRange", - value: function getRange(allNodes) { - var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; +var _possibleConstructorReturn2 = __webpack_require__(4); - var minY = 1e9, - maxY = -1e9, - minX = 1e9, - maxX = -1e9, - node; - if (specificNodes.length > 0) { - for (var i = 0; i < specificNodes.length; i++) { - node = allNodes[specificNodes[i]]; - if (minX > node.shape.boundingBox.left) { - minX = node.shape.boundingBox.left; - } - if (maxX < node.shape.boundingBox.right) { - maxX = node.shape.boundingBox.right; - } - if (minY > node.shape.boundingBox.top) { - minY = node.shape.boundingBox.top; - } // top is negative, bottom is positive - if (maxY < node.shape.boundingBox.bottom) { - maxY = node.shape.boundingBox.bottom; - } // top is negative, bottom is positive - } - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) { - minY = 0, maxY = 0, minX = 0, maxX = 0; - } - return { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; - } +var _inherits2 = __webpack_require__(5); - /** - * Find the center position of the network - */ +var _inherits3 = _interopRequireDefault(_inherits2); - }, { - key: "getRangeCore", - value: function getRangeCore(allNodes) { - var specificNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - - var minY = 1e9, - maxY = -1e9, - minX = 1e9, - maxX = -1e9, - node; - if (specificNodes.length > 0) { - for (var i = 0; i < specificNodes.length; i++) { - node = allNodes[specificNodes[i]]; - if (minX > node.x) { - minX = node.x; - } - if (maxX < node.x) { - maxX = node.x; - } - if (minY > node.y) { - minY = node.y; - } // top is negative, bottom is positive - if (maxY < node.y) { - maxY = node.y; - } // top is negative, bottom is positive - } - } +var _CubicBezierEdgeBase2 = __webpack_require__(216); - if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) { - minY = 0, maxY = 0, minX = 0, maxX = 0; - } - return { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; - } +var _CubicBezierEdgeBase3 = _interopRequireDefault(_CubicBezierEdgeBase2); - /** - * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; - * @returns {{x: number, y: number}} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - }, { - key: "findCenter", - value: function findCenter(range) { - return { x: 0.5 * (range.maxX + range.minX), - y: 0.5 * (range.maxY + range.minY) }; - } +/** + * A Cubic Bezier Edge. Bezier curves are used to model smooth gradual + * curves in paths between nodes. + * + * @extends CubicBezierEdgeBase + */ +var CubicBezierEdge = function (_CubicBezierEdgeBase) { + (0, _inherits3['default'])(CubicBezierEdge, _CubicBezierEdgeBase); - /** - * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes. - * @param item - * @param type - * @returns {{}} - */ + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function CubicBezierEdge(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, CubicBezierEdge); + return (0, _possibleConstructorReturn3['default'])(this, (CubicBezierEdge.__proto__ || (0, _getPrototypeOf2['default'])(CubicBezierEdge)).call(this, options, body, labelModule)); + } - }, { - key: "cloneOptions", - value: function cloneOptions(item, type) { - var clonedOptions = {}; - if (type === undefined || type === 'node') { - util.deepExtend(clonedOptions, item.options, true); - clonedOptions.x = item.x; - clonedOptions.y = item.y; - clonedOptions.amountOfConnections = item.edges.length; - } else { - util.deepExtend(clonedOptions, item.options, true); - } - return clonedOptions; - } - }]); - return NetworkUtil; - }(); + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @param {Array.} viaNodes + * @private + */ - exports["default"] = NetworkUtil; -/***/ }), -/* 212 */ -/***/ (function(module, exports, __webpack_require__) { + (0, _createClass3['default'])(CubicBezierEdge, [{ + key: '_line', + value: function _line(ctx, values, viaNodes) { + // get the coordinates of the support points. + var via1 = viaNodes[0]; + var via2 = viaNodes[1]; + this._bezierCurve(ctx, values, via1, via2); + } - 'use strict'; + /** + * + * @returns {Array.<{x: number, y: number}>} + * @private + */ - Object.defineProperty(exports, "__esModule", { - value: true - }); + }, { + key: '_getViaCoordinates', + value: function _getViaCoordinates() { + var dx = this.from.x - this.to.x; + var dy = this.from.y - this.to.y; + + var x1 = void 0, + y1 = void 0, + x2 = void 0, + y2 = void 0; + var roundness = this.options.smooth.roundness; + + // horizontal if x > y or if direction is forced or if direction is horizontal + if ((Math.abs(dx) > Math.abs(dy) || this.options.smooth.forceDirection === true || this.options.smooth.forceDirection === 'horizontal') && this.options.smooth.forceDirection !== 'vertical') { + y1 = this.from.y; + y2 = this.to.y; + x1 = this.from.x - roundness * dx; + x2 = this.to.x + roundness * dx; + } else { + y1 = this.from.y - roundness * dy; + y2 = this.to.y + roundness * dy; + x1 = this.from.x; + x2 = this.to.x; + } - var _keys = __webpack_require__(58); + return [{ x: x1, y: y1 }, { x: x2, y: y2 }]; + } - var _keys2 = _interopRequireDefault(_keys); + /** + * + * @returns {Array.<{x: number, y: number}>} + */ - var _classCallCheck2 = __webpack_require__(135); + }, { + key: 'getViaNode', + value: function getViaNode() { + return this._getViaCoordinates(); + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + /** + * + * @param {Node} nearNode + * @param {CanvasRenderingContext2D} ctx + * @returns {{x: number, y: number, t: number}} + * @private + */ - var _createClass2 = __webpack_require__(136); + }, { + key: '_findBorderPosition', + value: function _findBorderPosition(nearNode, ctx) { + return this._findBorderPositionBezier(nearNode, ctx); + } - var _createClass3 = _interopRequireDefault(_createClass2); + /** + * + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @param {Node} via1 + * @param {Node} via2 + * @returns {number} + * @private + */ - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + }, { + key: '_getDistanceToEdge', + value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { + var _ref = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates(), + _ref2 = (0, _slicedToArray3['default'])(_ref, 2), + via1 = _ref2[0], + via2 = _ref2[1]; - var BarnesHutSolver = __webpack_require__(213)['default']; - var Repulsion = __webpack_require__(214)['default']; - var HierarchicalRepulsion = __webpack_require__(215)['default']; - var SpringSolver = __webpack_require__(216)['default']; - var HierarchicalSpringSolver = __webpack_require__(217)['default']; - var CentralGravitySolver = __webpack_require__(218)['default']; - var ForceAtlas2BasedRepulsionSolver = __webpack_require__(219)['default']; - var ForceAtlas2BasedCentralGravitySolver = __webpack_require__(220)['default']; + // x3,y3 is the point + return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2); + } - var util = __webpack_require__(1); + /** + * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way + * @param {number} percentage + * @param {{x: number, y: number}} [via1=this._getViaCoordinates()[0]] + * @param {{x: number, y: number}} [via2=this._getViaCoordinates()[1]] + * @returns {{x: number, y: number}} + * @private + */ - var PhysicsEngine = function () { - function PhysicsEngine(body) { - (0, _classCallCheck3['default'])(this, PhysicsEngine); + }, { + key: 'getPoint', + value: function getPoint(percentage) { + var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates(), + _ref4 = (0, _slicedToArray3['default'])(_ref3, 2), + via1 = _ref4[0], + via2 = _ref4[1]; - this.body = body; - this.physicsBody = { physicsNodeIndices: [], physicsEdgeIndices: [], forces: {}, velocities: {} }; + var t = percentage; + var vec = []; + vec[0] = Math.pow(1 - t, 3); + vec[1] = 3 * t * Math.pow(1 - t, 2); + vec[2] = 3 * Math.pow(t, 2) * (1 - t); + vec[3] = Math.pow(t, 3); + var x = vec[0] * this.fromPoint.x + vec[1] * via1.x + vec[2] * via2.x + vec[3] * this.toPoint.x; + var y = vec[0] * this.fromPoint.y + vec[1] * via1.y + vec[2] * via2.y + vec[3] * this.toPoint.y; - this.physicsEnabled = true; - this.simulationInterval = 1000 / 60; - this.requiresTimeout = true; - this.previousStates = {}; - this.referenceState = {}; - this.freezeCache = {}; - this.renderTimer = undefined; + return { x: x, y: y }; + } + }]); + return CubicBezierEdge; +}(_CubicBezierEdgeBase3['default']); - // parameters for the adaptive timestep - this.adaptiveTimestep = false; - this.adaptiveTimestepEnabled = false; - this.adaptiveCounter = 0; - this.adaptiveInterval = 3; +exports['default'] = CubicBezierEdge; - this.stabilized = false; - this.startedStabilization = false; - this.stabilizationIterations = 0; - this.ready = false; // will be set to true if the stabilize +/***/ }), +/* 216 */ +/***/ (function(module, exports, __webpack_require__) { - // default options - this.options = {}; - this.defaultOptions = { - enabled: true, - barnesHut: { - theta: 0.5, - gravitationalConstant: -2000, - centralGravity: 0.3, - springLength: 95, - springConstant: 0.04, - damping: 0.09, - avoidOverlap: 0 - }, - forceAtlas2Based: { - theta: 0.5, - gravitationalConstant: -50, - centralGravity: 0.01, - springConstant: 0.08, - springLength: 100, - damping: 0.4, - avoidOverlap: 0 - }, - repulsion: { - centralGravity: 0.2, - springLength: 200, - springConstant: 0.05, - nodeDistance: 100, - damping: 0.09, - avoidOverlap: 0 - }, - hierarchicalRepulsion: { - centralGravity: 0.0, - springLength: 100, - springConstant: 0.01, - nodeDistance: 120, - damping: 0.09 - }, - maxVelocity: 50, - minVelocity: 0.75, // px/s - solver: 'barnesHut', - stabilization: { - enabled: true, - iterations: 1000, // maximum number of iteration to stabilize - updateInterval: 50, - onlyDynamicEdges: false, - fit: true - }, - timestep: 0.5, - adaptiveTimestep: true - }; - util.extend(this.options, this.defaultOptions); - this.timestep = 0.5; - this.layoutFailed = false; +"use strict"; - this.bindEventListeners(); - } - (0, _createClass3['default'])(PhysicsEngine, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this = this; +Object.defineProperty(exports, "__esModule", { + value: true +}); - this.body.emitter.on('initPhysics', function () { - _this.initPhysics(); - }); - this.body.emitter.on('_layoutFailed', function () { - _this.layoutFailed = true; - }); - this.body.emitter.on('resetPhysics', function () { - _this.stopSimulation();_this.ready = false; - }); - this.body.emitter.on('disablePhysics', function () { - _this.physicsEnabled = false;_this.stopSimulation(); - }); - this.body.emitter.on('restorePhysics', function () { - _this.setOptions(_this.options); - if (_this.ready === true) { - _this.startSimulation(); - } - }); - this.body.emitter.on('startSimulation', function () { - if (_this.ready === true) { - _this.startSimulation(); - } - }); - this.body.emitter.on('stopSimulation', function () { - _this.stopSimulation(); - }); - this.body.emitter.on('destroy', function () { - _this.stopSimulation(false); - _this.body.emitter.off(); - }); - // this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed. - this.body.emitter.on("_dataChanged", function () { - // update shortcut lists - _this.updatePhysicsData(); - }); +var _getPrototypeOf = __webpack_require__(3); - // debug: show forces - // this.body.emitter.on("afterDrawing", (ctx) => {this._drawForces(ctx);}); - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - /** - * set the physics options - * @param options - */ +var _classCallCheck2 = __webpack_require__(0); - }, { - key: 'setOptions', - value: function setOptions(options) { - if (options !== undefined) { - if (options === false) { - this.options.enabled = false; - this.physicsEnabled = false; - this.stopSimulation(); - } else { - this.physicsEnabled = true; - util.selectiveNotDeepExtend(['stabilization'], this.options, options); - util.mergeOptions(this.options, options, 'stabilization'); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - if (options.enabled === undefined) { - this.options.enabled = true; - } +var _createClass2 = __webpack_require__(1); - if (this.options.enabled === false) { - this.physicsEnabled = false; - this.stopSimulation(); - } +var _createClass3 = _interopRequireDefault(_createClass2); - // set the timestep - this.timestep = this.options.timestep; - } - } - this.init(); - } +var _possibleConstructorReturn2 = __webpack_require__(4); - /** - * configure the engine. - */ +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - }, { - key: 'init', - value: function init() { - var options; - if (this.options.solver === 'forceAtlas2Based') { - options = this.options.forceAtlas2Based; - this.nodesSolver = new ForceAtlas2BasedRepulsionSolver(this.body, this.physicsBody, options); - this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); - this.gravitySolver = new ForceAtlas2BasedCentralGravitySolver(this.body, this.physicsBody, options); - } else if (this.options.solver === 'repulsion') { - options = this.options.repulsion; - this.nodesSolver = new Repulsion(this.body, this.physicsBody, options); - this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); - this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); - } else if (this.options.solver === 'hierarchicalRepulsion') { - options = this.options.hierarchicalRepulsion; - this.nodesSolver = new HierarchicalRepulsion(this.body, this.physicsBody, options); - this.edgesSolver = new HierarchicalSpringSolver(this.body, this.physicsBody, options); - this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); - } else { - // barnesHut - options = this.options.barnesHut; - this.nodesSolver = new BarnesHutSolver(this.body, this.physicsBody, options); - this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); - this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); - } +var _inherits2 = __webpack_require__(5); - this.modelOptions = options; - } +var _inherits3 = _interopRequireDefault(_inherits2); - /** - * initialize the engine - */ +var _BezierEdgeBase2 = __webpack_require__(75); - }, { - key: 'initPhysics', - value: function initPhysics() { - if (this.physicsEnabled === true && this.options.enabled === true) { - if (this.options.stabilization.enabled === true) { - this.stabilize(); - } else { - this.stabilized = false; - this.ready = true; - this.body.emitter.emit('fit', {}, this.layoutFailed); // if the layout failed, we use the approximation for the zoom - this.startSimulation(); - } - } else { - this.ready = true; - this.body.emitter.emit('fit'); - } - } +var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2); - /** - * Start the simulation - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - }, { - key: 'startSimulation', - value: function startSimulation() { - if (this.physicsEnabled === true && this.options.enabled === true) { - this.stabilized = false; +/** + * A Base Class for all Cubic Bezier Edges. Bezier curves are used to model + * smooth gradual curves in paths between nodes. + * + * @extends BezierEdgeBase + */ +var CubicBezierEdgeBase = function (_BezierEdgeBase) { + (0, _inherits3['default'])(CubicBezierEdgeBase, _BezierEdgeBase); - // when visible, adaptivity is disabled. - this.adaptiveTimestep = false; + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function CubicBezierEdgeBase(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, CubicBezierEdgeBase); + return (0, _possibleConstructorReturn3['default'])(this, (CubicBezierEdgeBase.__proto__ || (0, _getPrototypeOf2['default'])(CubicBezierEdgeBase)).call(this, options, body, labelModule)); + } + + /** + * Calculate the distance between a point (x3,y3) and a line segment from + * (x1,y1) to (x2,y2). + * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment + * https://en.wikipedia.org/wiki/B%C3%A9zier_curve + * @param {number} x1 from x + * @param {number} y1 from y + * @param {number} x2 to x + * @param {number} y2 to y + * @param {number} x3 point to check x + * @param {number} y3 point to check y + * @param {Node} via1 + * @param {Node} via2 + * @returns {number} + * @private + */ - // this sets the width of all nodes initially which could be required for the avoidOverlap - this.body.emitter.emit("_resizeNodes"); - if (this.viewFunction === undefined) { - this.viewFunction = this.simulationStep.bind(this); - this.body.emitter.on('initRedraw', this.viewFunction); - this.body.emitter.emit('_startRendering'); - } - } else { - this.body.emitter.emit('_redraw'); + + (0, _createClass3['default'])(CubicBezierEdgeBase, [{ + key: '_getDistanceToBezierEdge', + value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2) { + // x3,y3 is the point + var minDistance = 1e9; + var distance = void 0; + var i = void 0, + t = void 0, + x = void 0, + y = void 0; + var lastX = x1; + var lastY = y1; + var vec = [0, 0, 0, 0]; + for (i = 1; i < 10; i++) { + t = 0.1 * i; + vec[0] = Math.pow(1 - t, 3); + vec[1] = 3 * t * Math.pow(1 - t, 2); + vec[2] = 3 * Math.pow(t, 2) * (1 - t); + vec[3] = Math.pow(t, 3); + x = vec[0] * x1 + vec[1] * via1.x + vec[2] * via2.x + vec[3] * x2; + y = vec[0] * y1 + vec[1] * via1.y + vec[2] * via2.y + vec[3] * y2; + if (i > 0) { + distance = this._getDistanceToLine(lastX, lastY, x, y, x3, y3); + minDistance = distance < minDistance ? distance : minDistance; } + lastX = x; + lastY = y; } - /** - * Stop the simulation, force stabilization. - */ + return minDistance; + } + }]); + return CubicBezierEdgeBase; +}(_BezierEdgeBase3['default']); - }, { - key: 'stopSimulation', - value: function stopSimulation() { - var emit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; +exports['default'] = CubicBezierEdgeBase; - this.stabilized = true; - if (emit === true) { - this._emitStabilized(); - } - if (this.viewFunction !== undefined) { - this.body.emitter.off('initRedraw', this.viewFunction); - this.viewFunction = undefined; - if (emit === true) { - this.body.emitter.emit('_stopRendering'); - } - } - } +/***/ }), +/* 217 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * The viewFunction inserts this step into each render loop. It calls the physics tick and handles the cleanup at stabilized. - * - */ +"use strict"; - }, { - key: 'simulationStep', - value: function simulationStep() { - // check if the physics have settled - var startTime = Date.now(); - this.physicsTick(); - var physicsTime = Date.now() - startTime; - // run double speed if it is a little graph - if ((physicsTime < 0.4 * this.simulationInterval || this.runDoubleSpeed === true) && this.stabilized === false) { - this.physicsTick(); +Object.defineProperty(exports, "__esModule", { + value: true +}); - // this makes sure there is no jitter. The decision is taken once to run it at double speed. - this.runDoubleSpeed = true; - } - - if (this.stabilized === true) { - this.stopSimulation(); - } - } - - /** - * trigger the stabilized event. - * @private - */ +var _slicedToArray2 = __webpack_require__(30); - }, { - key: '_emitStabilized', - value: function _emitStabilized() { - var _this2 = this; +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - var amountOfIterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.stabilizationIterations; +var _getPrototypeOf = __webpack_require__(3); - if (this.stabilizationIterations > 1 || this.startedStabilization === true) { - setTimeout(function () { - _this2.body.emitter.emit('stabilized', { iterations: amountOfIterations }); - _this2.startedStabilization = false; - _this2.stabilizationIterations = 0; - }, 0); - } - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - /** - * A single simulation step (or 'tick') in the physics simulation - * - * @private - */ +var _classCallCheck2 = __webpack_require__(0); - }, { - key: 'physicsTick', - value: function physicsTick() { - // this is here to ensure that there is no start event when the network is already stable. - if (this.startedStabilization === false) { - this.body.emitter.emit('startStabilizing'); - this.startedStabilization = true; - } - - if (this.stabilized === false) { - // adaptivity means the timestep adapts to the situation, only applicable for stabilization - if (this.adaptiveTimestep === true && this.adaptiveTimestepEnabled === true) { - // this is the factor for increasing the timestep on success. - var factor = 1.2; - - // we assume the adaptive interval is - if (this.adaptiveCounter % this.adaptiveInterval === 0) { - // we leave the timestep stable for "interval" iterations. - // first the big step and revert. Revert saves the reference state. - this.timestep = 2 * this.timestep; - this.calculateForces(); - this.moveNodes(); - this.revert(); - - // now the normal step. Since this is the last step, it is the more stable one and we will take this. - this.timestep = 0.5 * this.timestep; - - // since it's half the step, we do it twice. - this.calculateForces(); - this.moveNodes(); - this.calculateForces(); - this.moveNodes(); - - // we compare the two steps. if it is acceptable we double the step. - if (this._evaluateStepQuality() === true) { - this.timestep = factor * this.timestep; - } else { - // if not, we decrease the step to a minimum of the options timestep. - // if the decreased timestep is smaller than the options step, we do not reset the counter - // we assume that the options timestep is stable enough. - if (this.timestep / factor < this.options.timestep) { - this.timestep = this.options.timestep; - } else { - // if the timestep was larger than 2 times the option one we check the adaptivity again to ensure - // that large instabilities do not form. - this.adaptiveCounter = -1; // check again next iteration - this.timestep = Math.max(this.options.timestep, this.timestep / factor); - } - } - } else { - // normal step, keeping timestep constant - this.calculateForces(); - this.moveNodes(); - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // increment the counter - this.adaptiveCounter += 1; - } else { - // case for the static timestep, we reset it to the one in options and take a normal step. - this.timestep = this.options.timestep; - this.calculateForces(); - this.moveNodes(); - } +var _createClass2 = __webpack_require__(1); - // determine if the network has stabilzied - if (this.stabilized === true) { - this.revert(); - } +var _createClass3 = _interopRequireDefault(_createClass2); - this.stabilizationIterations++; - } - } +var _possibleConstructorReturn2 = __webpack_require__(4); - /** - * Nodes and edges can have the physics toggles on or off. A collection of indices is created here so we can skip the check all the time. - * - * @private - */ +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - }, { - key: 'updatePhysicsData', - value: function updatePhysicsData() { - this.physicsBody.forces = {}; - this.physicsBody.physicsNodeIndices = []; - this.physicsBody.physicsEdgeIndices = []; - var nodes = this.body.nodes; - var edges = this.body.edges; +var _inherits2 = __webpack_require__(5); - // get node indices for physics - for (var nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - if (nodes[nodeId].options.physics === true) { - this.physicsBody.physicsNodeIndices.push(nodes[nodeId].id); - } - } - } +var _inherits3 = _interopRequireDefault(_inherits2); - // get edge indices for physics - for (var edgeId in edges) { - if (edges.hasOwnProperty(edgeId)) { - if (edges[edgeId].options.physics === true) { - this.physicsBody.physicsEdgeIndices.push(edges[edgeId].id); - } - } - } +var _BezierEdgeBase2 = __webpack_require__(75); - // get the velocity and the forces vector - for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) { - var _nodeId = this.physicsBody.physicsNodeIndices[i]; - this.physicsBody.forces[_nodeId] = { x: 0, y: 0 }; +var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2); - // forces can be reset because they are recalculated. Velocities have to persist. - if (this.physicsBody.velocities[_nodeId] === undefined) { - this.physicsBody.velocities[_nodeId] = { x: 0, y: 0 }; - } - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - // clean deleted nodes from the velocity vector - for (var _nodeId2 in this.physicsBody.velocities) { - if (nodes[_nodeId2] === undefined) { - delete this.physicsBody.velocities[_nodeId2]; - } - } - } +/** + * A Dynamic Bezier Edge. Bezier curves are used to model smooth gradual + * curves in paths between nodes. The Dynamic piece refers to how the curve + * reacts to physics changes. + * + * @extends BezierEdgeBase + */ +var BezierEdgeDynamic = function (_BezierEdgeBase) { + (0, _inherits3["default"])(BezierEdgeDynamic, _BezierEdgeBase); - /** - * Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized. - */ + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function BezierEdgeDynamic(options, body, labelModule) { + (0, _classCallCheck3["default"])(this, BezierEdgeDynamic); - }, { - key: 'revert', - value: function revert() { - var nodeIds = (0, _keys2['default'])(this.previousStates); - var nodes = this.body.nodes; - var velocities = this.physicsBody.velocities; - this.referenceState = {}; - - for (var i = 0; i < nodeIds.length; i++) { - var nodeId = nodeIds[i]; - if (nodes[nodeId] !== undefined) { - if (nodes[nodeId].options.physics === true) { - this.referenceState[nodeId] = { - positions: { x: nodes[nodeId].x, y: nodes[nodeId].y } - }; - velocities[nodeId].x = this.previousStates[nodeId].vx; - velocities[nodeId].y = this.previousStates[nodeId].vy; - nodes[nodeId].x = this.previousStates[nodeId].x; - nodes[nodeId].y = this.previousStates[nodeId].y; - } - } else { - delete this.previousStates[nodeId]; - } - } - } + // --> this calls the setOptions below + var _this = (0, _possibleConstructorReturn3["default"])(this, (BezierEdgeDynamic.__proto__ || (0, _getPrototypeOf2["default"])(BezierEdgeDynamic)).call(this, options, body, labelModule)); + //this.via = undefined; // Here for completeness but not allowed to defined before super() is invoked. - /** - * This compares the reference state to the current state - */ - }, { - key: '_evaluateStepQuality', - value: function _evaluateStepQuality() { - var dx = void 0, - dy = void 0, - dpos = void 0; - var nodes = this.body.nodes; - var reference = this.referenceState; - var posThreshold = 0.3; + _this._boundFunction = function () { + _this.positionBezierNode(); + }; + _this.body.emitter.on("_repositionBezierNodes", _this._boundFunction); + return _this; + } - for (var nodeId in this.referenceState) { - if (this.referenceState.hasOwnProperty(nodeId) && nodes[nodeId] !== undefined) { - dx = nodes[nodeId].x - reference[nodeId].positions.x; - dy = nodes[nodeId].y - reference[nodeId].positions.y; + /** + * + * @param {Object} options + */ - dpos = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); - if (dpos > posThreshold) { - return false; - } - } - } - return true; + (0, _createClass3["default"])(BezierEdgeDynamic, [{ + key: "setOptions", + value: function setOptions(options) { + // check if the physics has changed. + var physicsChange = false; + if (this.options.physics !== options.physics) { + physicsChange = true; } - /** - * move the nodes one timestep and check if they are stabilized - * @returns {boolean} - */ - - }, { - key: 'moveNodes', - value: function moveNodes() { - var nodeIndices = this.physicsBody.physicsNodeIndices; - var maxVelocity = this.options.maxVelocity ? this.options.maxVelocity : 1e9; - var maxNodeVelocity = 0; - var averageNodeVelocity = 0; - - // the velocity threshold (energy in the system) for the adaptivity toggle - var velocityAdaptiveThreshold = 5; + // set the options and the to and from nodes + this.options = options; + this.id = this.options.id; + this.from = this.body.nodes[this.options.from]; + this.to = this.body.nodes[this.options.to]; - for (var i = 0; i < nodeIndices.length; i++) { - var nodeId = nodeIndices[i]; - var nodeVelocity = this._performStep(nodeId, maxVelocity); - // stabilized is true if stabilized is true and velocity is smaller than vmin --> all nodes must be stabilized - maxNodeVelocity = Math.max(maxNodeVelocity, nodeVelocity); - averageNodeVelocity += nodeVelocity; - } + // setup the support node and connect + this.setupSupportNode(); + this.connect(); - // evaluating the stabilized and adaptiveTimestepEnabled conditions - this.adaptiveTimestepEnabled = averageNodeVelocity / nodeIndices.length < velocityAdaptiveThreshold; - this.stabilized = maxNodeVelocity < this.options.minVelocity; + // when we change the physics state of the edge, we reposition the support node. + if (physicsChange === true) { + this.via.setOptions({ physics: this.options.physics }); + this.positionBezierNode(); } + } - /** - * Perform the actual step - * - * @param nodeId - * @param maxVelocity - * @returns {number} - * @private - */ - - }, { - key: '_performStep', - value: function _performStep(nodeId, maxVelocity) { - var node = this.body.nodes[nodeId]; - var timestep = this.timestep; - var forces = this.physicsBody.forces; - var velocities = this.physicsBody.velocities; - - // store the state so we can revert - this.previousStates[nodeId] = { x: node.x, y: node.y, vx: velocities[nodeId].x, vy: velocities[nodeId].y }; - - if (node.options.fixed.x === false) { - var dx = this.modelOptions.damping * velocities[nodeId].x; // damping force - var ax = (forces[nodeId].x - dx) / node.options.mass; // acceleration - velocities[nodeId].x += ax * timestep; // velocity - velocities[nodeId].x = Math.abs(velocities[nodeId].x) > maxVelocity ? velocities[nodeId].x > 0 ? maxVelocity : -maxVelocity : velocities[nodeId].x; - node.x += velocities[nodeId].x * timestep; // position - } else { - forces[nodeId].x = 0; - velocities[nodeId].x = 0; - } + /** + * Connects an edge to node(s) + */ - if (node.options.fixed.y === false) { - var dy = this.modelOptions.damping * velocities[nodeId].y; // damping force - var ay = (forces[nodeId].y - dy) / node.options.mass; // acceleration - velocities[nodeId].y += ay * timestep; // velocity - velocities[nodeId].y = Math.abs(velocities[nodeId].y) > maxVelocity ? velocities[nodeId].y > 0 ? maxVelocity : -maxVelocity : velocities[nodeId].y; - node.y += velocities[nodeId].y * timestep; // position + }, { + key: "connect", + value: function connect() { + this.from = this.body.nodes[this.options.from]; + this.to = this.body.nodes[this.options.to]; + if (this.from === undefined || this.to === undefined || this.options.physics === false) { + this.via.setOptions({ physics: false }); + } else { + // fix weird behaviour where a self referencing node has physics enabled + if (this.from.id === this.to.id) { + this.via.setOptions({ physics: false }); } else { - forces[nodeId].y = 0; - velocities[nodeId].y = 0; + this.via.setOptions({ physics: true }); } - - var totalVelocity = Math.sqrt(Math.pow(velocities[nodeId].x, 2) + Math.pow(velocities[nodeId].y, 2)); - return totalVelocity; } + } - /** - * calculate the forces for one physics iteration. - */ + /** + * remove the support nodes + * @returns {boolean} + */ - }, { - key: 'calculateForces', - value: function calculateForces() { - this.gravitySolver.solve(); - this.nodesSolver.solve(); - this.edgesSolver.solve(); + }, { + key: "cleanup", + value: function cleanup() { + this.body.emitter.off("_repositionBezierNodes", this._boundFunction); + if (this.via !== undefined) { + delete this.body.nodes[this.via.id]; + this.via = undefined; + return true; } + return false; + } - /** - * When initializing and stabilizing, we can freeze nodes with a predefined position. This greatly speeds up stabilization - * because only the supportnodes for the smoothCurves have to settle. - * - * @private - */ + /** + * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but + * are used for the force calculation. + * + * The changed data is not called, if needed, it is returned by the main edge constructor. + * @private + */ - }, { - key: '_freezeNodes', - value: function _freezeNodes() { - var nodes = this.body.nodes; - for (var id in nodes) { - if (nodes.hasOwnProperty(id)) { - if (nodes[id].x && nodes[id].y) { - this.freezeCache[id] = { x: nodes[id].options.fixed.x, y: nodes[id].options.fixed.y }; - nodes[id].options.fixed.x = true; - nodes[id].options.fixed.y = true; - } - } - } + }, { + key: "setupSupportNode", + value: function setupSupportNode() { + if (this.via === undefined) { + var nodeId = "edgeId:" + this.id; + var node = this.body.functions.createNode({ + id: nodeId, + shape: 'circle', + physics: true, + hidden: true + }); + this.body.nodes[nodeId] = node; + this.via = node; + this.via.parentEdgeId = this.id; + this.positionBezierNode(); } + } - /** - * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. - * - * @private - */ + /** + * Positions bezier node + */ - }, { - key: '_restoreFrozenNodes', - value: function _restoreFrozenNodes() { - var nodes = this.body.nodes; - for (var id in nodes) { - if (nodes.hasOwnProperty(id)) { - if (this.freezeCache[id] !== undefined) { - nodes[id].options.fixed.x = this.freezeCache[id].x; - nodes[id].options.fixed.y = this.freezeCache[id].y; - } - } - } - this.freezeCache = {}; + }, { + key: "positionBezierNode", + value: function positionBezierNode() { + if (this.via !== undefined && this.from !== undefined && this.to !== undefined) { + this.via.x = 0.5 * (this.from.x + this.to.x); + this.via.y = 0.5 * (this.from.y + this.to.y); + } else if (this.via !== undefined) { + this.via.x = 0; + this.via.y = 0; } + } - /** - * Find a stable position for all nodes - */ + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @param {Node} viaNode + * @private + */ - }, { - key: 'stabilize', - value: function stabilize() { - var _this3 = this; + }, { + key: "_line", + value: function _line(ctx, values, viaNode) { + this._bezierCurve(ctx, values, viaNode); + } - var iterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.stabilization.iterations; + /** + * + * @returns {Node|undefined|*|{index, line, column}} + */ - if (typeof iterations !== 'number') { - console.log('The stabilize method needs a numeric amount of iterations. Switching to default: ', this.options.stabilization.iterations); - iterations = this.options.stabilization.iterations; - } + }, { + key: "getViaNode", + value: function getViaNode() { + return this.via; + } - if (this.physicsBody.physicsNodeIndices.length === 0) { - this.ready = true; - return; - } + /** + * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way + * + * @param {number} percentage + * @param {Node} viaNode + * @returns {{x: number, y: number}} + * @private + */ - // enable adaptive timesteps - this.adaptiveTimestep = true && this.options.adaptiveTimestep; + }, { + key: "getPoint", + value: function getPoint(percentage) { + var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.via; + + var t = percentage; + var x = void 0, + y = void 0; + if (this.from === this.to) { + var _getCircleData = this._getCircleData(this.from), + _getCircleData2 = (0, _slicedToArray3["default"])(_getCircleData, 3), + cx = _getCircleData2[0], + cy = _getCircleData2[1], + cr = _getCircleData2[2]; + + var a = 2 * Math.PI * (1 - t); + x = cx + cr * Math.sin(a); + y = cy + cr - cr * (1 - Math.cos(a)); + } else { + x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; + y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; + } - // this sets the width of all nodes initially which could be required for the avoidOverlap - this.body.emitter.emit("_resizeNodes"); + return { x: x, y: y }; + } - // stop the render loop - this.stopSimulation(); + /** + * + * @param {Node} nearNode + * @param {CanvasRenderingContext2D} ctx + * @returns {*} + * @private + */ - // set stabilze to false - this.stabilized = false; + }, { + key: "_findBorderPosition", + value: function _findBorderPosition(nearNode, ctx) { + return this._findBorderPositionBezier(nearNode, ctx, this.via); + } - // block redraw requests - this.body.emitter.emit('_blockRedraw'); - this.targetIterations = iterations; + /** + * + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @returns {number} + * @private + */ - // start the stabilization - if (this.options.stabilization.onlyDynamicEdges === true) { - this._freezeNodes(); - } - this.stabilizationIterations = 0; + }, { + key: "_getDistanceToEdge", + value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { + // x3,y3 is the point + return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, this.via); + } + }]); + return BezierEdgeDynamic; +}(_BezierEdgeBase3["default"]); - setTimeout(function () { - return _this3._stabilizationBatch(); - }, 0); - } +exports["default"] = BezierEdgeDynamic; - /** - * One batch of stabilization - * @private - */ +/***/ }), +/* 218 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: '_stabilizationBatch', - value: function _stabilizationBatch() { - var self = this; - var running = function running() { - return self.stabilized === false && self.stabilizationIterations < self.targetIterations; - }; - var sendProgress = function sendProgress() { - self.body.emitter.emit('stabilizationProgress', { - iterations: self.stabilizationIterations, - total: self.targetIterations - }); - }; +"use strict"; - // this is here to ensure that there is at least one start event. - if (this.startedStabilization === false) { - this.body.emitter.emit('startStabilizing'); - this.startedStabilization = true; - sendProgress(); - } - var count = 0; - while (running() && count < this.options.stabilization.updateInterval) { - this.physicsTick(); - count++; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - sendProgress(); +var _getPrototypeOf = __webpack_require__(3); - if (running()) { - setTimeout(this._stabilizationBatch.bind(this), 0); - } else { - this._finalizeStabilization(); - } - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - /** - * Wrap up the stabilization, fit and emit the events. - * @private - */ +var _classCallCheck2 = __webpack_require__(0); - }, { - key: '_finalizeStabilization', - value: function _finalizeStabilization() { - this.body.emitter.emit('_allowRedraw'); - if (this.options.stabilization.fit === true) { - this.body.emitter.emit('fit'); - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - if (this.options.stabilization.onlyDynamicEdges === true) { - this._restoreFrozenNodes(); - } +var _createClass2 = __webpack_require__(1); - this.body.emitter.emit('stabilizationIterationsDone'); - this.body.emitter.emit('_requestRedraw'); +var _createClass3 = _interopRequireDefault(_createClass2); - if (this.stabilized === true) { - this._emitStabilized(); - } else { - this.startSimulation(); - } +var _possibleConstructorReturn2 = __webpack_require__(4); - this.ready = true; - } - }, { - key: '_drawForces', - value: function _drawForces(ctx) { - for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) { - var node = this.body.nodes[this.physicsBody.physicsNodeIndices[i]]; - var force = this.physicsBody.forces[this.physicsBody.physicsNodeIndices[i]]; - var factor = 20; - var colorFactor = 0.03; - var forceSize = Math.sqrt(Math.pow(force.x, 2) + Math.pow(force.x, 2)); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var size = Math.min(Math.max(5, forceSize), 15); - var arrowSize = 3 * size; +var _inherits2 = __webpack_require__(5); - var color = util.HSVToHex((180 - Math.min(1, Math.max(0, colorFactor * forceSize)) * 180) / 360, 1, 1); +var _inherits3 = _interopRequireDefault(_inherits2); - ctx.lineWidth = size; - ctx.strokeStyle = color; - ctx.beginPath(); - ctx.moveTo(node.x, node.y); - ctx.lineTo(node.x + factor * force.x, node.y + factor * force.y); - ctx.stroke(); +var _BezierEdgeBase2 = __webpack_require__(75); - var angle = Math.atan2(force.y, force.x); - ctx.fillStyle = color; - ctx.arrowEndpoint(node.x + factor * force.x + Math.cos(angle) * arrowSize, node.y + factor * force.y + Math.sin(angle) * arrowSize, angle, arrowSize); - ctx.fill(); - } - } - }]); - return PhysicsEngine; - }(); +var _BezierEdgeBase3 = _interopRequireDefault(_BezierEdgeBase2); - exports['default'] = PhysicsEngine; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * A Static Bezier Edge. Bezier curves are used to model smooth gradual + * curves in paths between nodes. + * + * @extends BezierEdgeBase + */ +var BezierEdgeStatic = function (_BezierEdgeBase) { + (0, _inherits3['default'])(BezierEdgeStatic, _BezierEdgeBase); - "use strict"; + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function BezierEdgeStatic(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, BezierEdgeStatic); + return (0, _possibleConstructorReturn3['default'])(this, (BezierEdgeStatic.__proto__ || (0, _getPrototypeOf2['default'])(BezierEdgeStatic)).call(this, options, body, labelModule)); + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @param {Node} viaNode + * @private + */ - var _classCallCheck2 = __webpack_require__(135); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + (0, _createClass3['default'])(BezierEdgeStatic, [{ + key: '_line', + value: function _line(ctx, values, viaNode) { + this._bezierCurve(ctx, values, viaNode); + } - var _createClass2 = __webpack_require__(136); + /** + * + * @returns {Array.<{x: number, y: number}>} + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'getViaNode', + value: function getViaNode() { + return this._getViaCoordinates(); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + /** + * We do not use the to and fromPoints here to make the via nodes the same as edges without arrows. + * @returns {{x: undefined, y: undefined}} + * @private + */ - var BarnesHutSolver = function () { - function BarnesHutSolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, BarnesHutSolver); + }, { + key: '_getViaCoordinates', + value: function _getViaCoordinates() { + // Assumption: x/y coordinates in from/to always defined + var xVia = undefined; + var yVia = undefined; + var factor = this.options.smooth.roundness; + var type = this.options.smooth.type; + var dx = Math.abs(this.from.x - this.to.x); + var dy = Math.abs(this.from.y - this.to.y); + if (type === 'discrete' || type === 'diagonalCross') { + var stepX = void 0; + var stepY = void 0; + + if (dx <= dy) { + stepX = stepY = factor * dy; + } else { + stepX = stepY = factor * dx; + } - this.body = body; - this.physicsBody = physicsBody; - this.barnesHutTree; - this.setOptions(options); - this.randomSeed = 5; + if (this.from.x > this.to.x) stepX = -stepX; + if (this.from.y >= this.to.y) stepY = -stepY; - // debug: show grid - //this.body.emitter.on("afterDrawing", (ctx) => {this._debug(ctx,'#ff0000')}) - } + xVia = this.from.x + stepX; + yVia = this.from.y + stepY; - (0, _createClass3["default"])(BarnesHutSolver, [{ - key: "setOptions", - value: function setOptions(options) { - this.options = options; - this.thetaInversed = 1 / this.options.theta; - this.overlapAvoidanceFactor = 1 - Math.max(0, Math.min(1, this.options.avoidOverlap)); // if 1 then min distance = 0.5, if 0.5 then min distance = 0.5 + 0.5*node.shape.radius - } - }, { - key: "seededRandom", - value: function seededRandom() { - var x = Math.sin(this.randomSeed++) * 10000; - return x - Math.floor(x); - } + if (type === "discrete") { + if (dx <= dy) { + xVia = dx < factor * dy ? this.from.x : xVia; + } else { + yVia = dy < factor * dx ? this.from.y : yVia; + } + } + } else if (type === "straightCross") { + var _stepX = (1 - factor) * dx; + var _stepY = (1 - factor) * dy; - /** - * This function calculates the forces the nodes apply on each other based on a gravitational model. - * The Barnes Hut method is used to speed up this N-body simulation. - * - * @private - */ + if (dx <= dy) { + // up - down + _stepX = 0; + if (this.from.y < this.to.y) _stepY = -_stepY; + } else { + // left - right + if (this.from.x < this.to.x) _stepX = -_stepX; + _stepY = 0; + } + xVia = this.to.x + _stepX; + yVia = this.to.y + _stepY; + } else if (type === 'horizontal') { + var _stepX2 = (1 - factor) * dx; + if (this.from.x < this.to.x) _stepX2 = -_stepX2; + xVia = this.to.x + _stepX2; + yVia = this.from.y; + } else if (type === 'vertical') { + var _stepY2 = (1 - factor) * dy; + if (this.from.y < this.to.y) _stepY2 = -_stepY2; + xVia = this.from.x; + yVia = this.to.y + _stepY2; + } else if (type === 'curvedCW') { + dx = this.to.x - this.from.x; + dy = this.from.y - this.to.y; + var radius = Math.sqrt(dx * dx + dy * dy); + var pi = Math.PI; + + var originalAngle = Math.atan2(dy, dx); + var myAngle = (originalAngle + (factor * 0.5 + 0.5) * pi) % (2 * pi); + + xVia = this.from.x + (factor * 0.5 + 0.5) * radius * Math.sin(myAngle); + yVia = this.from.y + (factor * 0.5 + 0.5) * radius * Math.cos(myAngle); + } else if (type === 'curvedCCW') { + dx = this.to.x - this.from.x; + dy = this.from.y - this.to.y; + var _radius = Math.sqrt(dx * dx + dy * dy); + var _pi = Math.PI; + + var _originalAngle = Math.atan2(dy, dx); + var _myAngle = (_originalAngle + (-factor * 0.5 + 0.5) * _pi) % (2 * _pi); + + xVia = this.from.x + (factor * 0.5 + 0.5) * _radius * Math.sin(_myAngle); + yVia = this.from.y + (factor * 0.5 + 0.5) * _radius * Math.cos(_myAngle); + } else { + // continuous + var _stepX3 = void 0; + var _stepY3 = void 0; - }, { - key: "solve", - value: function solve() { - if (this.options.gravitationalConstant !== 0 && this.physicsBody.physicsNodeIndices.length > 0) { - var node = void 0; - var nodes = this.body.nodes; - var nodeIndices = this.physicsBody.physicsNodeIndices; - var nodeCount = nodeIndices.length; - - // create the tree - var barnesHutTree = this._formBarnesHutTree(nodes, nodeIndices); - - // for debugging - this.barnesHutTree = barnesHutTree; - - // place the nodes one by one recursively - for (var i = 0; i < nodeCount; i++) { - node = nodes[nodeIndices[i]]; - if (node.options.mass > 0) { - // starting with root is irrelevant, it never passes the BarnesHutSolver condition - this._getForceContribution(barnesHutTree.root.children.NW, node); - this._getForceContribution(barnesHutTree.root.children.NE, node); - this._getForceContribution(barnesHutTree.root.children.SW, node); - this._getForceContribution(barnesHutTree.root.children.SE, node); - } - } + if (dx <= dy) { + _stepX3 = _stepY3 = factor * dy; + } else { + _stepX3 = _stepY3 = factor * dx; } - } - /** - * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. - * If a region contains a single node, we check if it is not itself, then we apply the force. - * - * @param parentBranch - * @param node - * @private - */ + if (this.from.x > this.to.x) _stepX3 = -_stepX3; + if (this.from.y >= this.to.y) _stepY3 = -_stepY3; - }, { - key: "_getForceContribution", - value: function _getForceContribution(parentBranch, node) { - // we get no force contribution from an empty region - if (parentBranch.childrenCount > 0) { - var dx = void 0, - dy = void 0, - distance = void 0; - - // get the distance from the center of mass to the node. - dx = parentBranch.centerOfMass.x - node.x; - dy = parentBranch.centerOfMass.y - node.y; - distance = Math.sqrt(dx * dx + dy * dy); + xVia = this.from.x + _stepX3; + yVia = this.from.y + _stepY3; - // BarnesHutSolver condition - // original condition : s/d < theta = passed === d/s > 1/theta = passed - // calcSize = 1/s --> d * 1/s > 1/theta = passed - if (distance * parentBranch.calcSize > this.thetaInversed) { - this._calculateForces(distance, dx, dy, node, parentBranch); + if (dx <= dy) { + if (this.from.x <= this.to.x) { + xVia = this.to.x < xVia ? this.to.x : xVia; } else { - // Did not pass the condition, go into children if available - if (parentBranch.childrenCount === 4) { - this._getForceContribution(parentBranch.children.NW, node); - this._getForceContribution(parentBranch.children.NE, node); - this._getForceContribution(parentBranch.children.SW, node); - this._getForceContribution(parentBranch.children.SE, node); - } else { - // parentBranch must have only one node, if it was empty we wouldnt be here - if (parentBranch.children.data.id != node.id) { - // if it is not self - this._calculateForces(distance, dx, dy, node, parentBranch); - } - } + xVia = this.to.x > xVia ? this.to.x : xVia; + } + } else { + if (this.from.y >= this.to.y) { + yVia = this.to.y > yVia ? this.to.y : yVia; + } else { + yVia = this.to.y < yVia ? this.to.y : yVia; } } } + return { x: xVia, y: yVia }; + } - /** - * Calculate the forces based on the distance. - * - * @param distance - * @param dx - * @param dy - * @param node - * @param parentBranch - * @private - */ + /** + * + * @param {Node} nearNode + * @param {CanvasRenderingContext2D} ctx + * @param {Object} options + * @returns {*} + * @private + */ - }, { - key: "_calculateForces", - value: function _calculateForces(distance, dx, dy, node, parentBranch) { - if (distance === 0) { - distance = 0.1; - dx = distance; - } + }, { + key: '_findBorderPosition', + value: function _findBorderPosition(nearNode, ctx) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (this.overlapAvoidanceFactor < 1 && node.shape.radius) { - distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius); - } + return this._findBorderPositionBezier(nearNode, ctx, options.via); + } - // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines - // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce - var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass / Math.pow(distance, 3); - var fx = dx * gravityForce; - var fy = dy * gravityForce; + /** + * + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @param {Node} viaNode + * @returns {number} + * @private + */ - this.physicsBody.forces[node.id].x += fx; - this.physicsBody.forces[node.id].y += fy; - } + }, { + key: '_getDistanceToEdge', + value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { + var viaNode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : this._getViaCoordinates(); + // x3,y3 is the point + return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, viaNode); + } - /** - * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. - * - * @param nodes - * @param nodeIndices - * @private - */ + /** + * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way + * @param {number} percentage + * @param {Node} viaNode + * @returns {{x: number, y: number}} + * @private + */ - }, { - key: "_formBarnesHutTree", - value: function _formBarnesHutTree(nodes, nodeIndices) { - var node = void 0; - var nodeCount = nodeIndices.length; + }, { + key: 'getPoint', + value: function getPoint(percentage) { + var viaNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._getViaCoordinates(); - var minX = nodes[nodeIndices[0]].x; - var minY = nodes[nodeIndices[0]].y; - var maxX = nodes[nodeIndices[0]].x; - var maxY = nodes[nodeIndices[0]].y; - - // get the range of the nodes - for (var i = 1; i < nodeCount; i++) { - var x = nodes[nodeIndices[i]].x; - var y = nodes[nodeIndices[i]].y; - if (nodes[nodeIndices[i]].options.mass > 0) { - if (x < minX) { - minX = x; - } - if (x > maxX) { - maxX = x; - } - if (y < minY) { - minY = y; - } - if (y > maxY) { - maxY = y; - } - } - } - // make the range a square - var sizeDiff = Math.abs(maxX - minX) - Math.abs(maxY - minY); // difference between X and Y - if (sizeDiff > 0) { - minY -= 0.5 * sizeDiff; - maxY += 0.5 * sizeDiff; - } // xSize > ySize - else { - minX += 0.5 * sizeDiff; - maxX -= 0.5 * sizeDiff; - } // xSize < ySize - - - var minimumTreeSize = 1e-5; - var rootSize = Math.max(minimumTreeSize, Math.abs(maxX - minX)); - var halfRootSize = 0.5 * rootSize; - var centerX = 0.5 * (minX + maxX), - centerY = 0.5 * (minY + maxY); - - // construct the barnesHutTree - var barnesHutTree = { - root: { - centerOfMass: { x: 0, y: 0 }, - mass: 0, - range: { - minX: centerX - halfRootSize, maxX: centerX + halfRootSize, - minY: centerY - halfRootSize, maxY: centerY + halfRootSize - }, - size: rootSize, - calcSize: 1 / rootSize, - children: { data: null }, - maxWidth: 0, - level: 0, - childrenCount: 4 - } - }; - this._splitBranch(barnesHutTree.root); + var t = percentage; + var x = Math.pow(1 - t, 2) * this.fromPoint.x + 2 * t * (1 - t) * viaNode.x + Math.pow(t, 2) * this.toPoint.x; + var y = Math.pow(1 - t, 2) * this.fromPoint.y + 2 * t * (1 - t) * viaNode.y + Math.pow(t, 2) * this.toPoint.y; - // place the nodes one by one recursively - for (var _i = 0; _i < nodeCount; _i++) { - node = nodes[nodeIndices[_i]]; - if (node.options.mass > 0) { - this._placeInTree(barnesHutTree.root, node); - } - } + return { x: x, y: y }; + } + }]); + return BezierEdgeStatic; +}(_BezierEdgeBase3['default']); - // make global - return barnesHutTree; - } +exports['default'] = BezierEdgeStatic; - /** - * this updates the mass of a branch. this is increased by adding a node. - * - * @param parentBranch - * @param node - * @private - */ +/***/ }), +/* 219 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: "_updateBranchMass", - value: function _updateBranchMass(parentBranch, node) { - var totalMass = parentBranch.mass + node.options.mass; - var totalMassInv = 1 / totalMass; +"use strict"; - parentBranch.centerOfMass.x = parentBranch.centerOfMass.x * parentBranch.mass + node.x * node.options.mass; - parentBranch.centerOfMass.x *= totalMassInv; - parentBranch.centerOfMass.y = parentBranch.centerOfMass.y * parentBranch.mass + node.y * node.options.mass; - parentBranch.centerOfMass.y *= totalMassInv; +Object.defineProperty(exports, "__esModule", { + value: true +}); - parentBranch.mass = totalMass; - var biggestSize = Math.max(Math.max(node.height, node.radius), node.width); - parentBranch.maxWidth = parentBranch.maxWidth < biggestSize ? biggestSize : parentBranch.maxWidth; - } +var _getPrototypeOf = __webpack_require__(3); - /** - * determine in which branch the node will be placed. - * - * @param parentBranch - * @param node - * @param skipMassUpdate - * @private - */ +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - }, { - key: "_placeInTree", - value: function _placeInTree(parentBranch, node, skipMassUpdate) { - if (skipMassUpdate != true || skipMassUpdate === undefined) { - // update the mass of the branch. - this._updateBranchMass(parentBranch, node); - } - - if (parentBranch.children.NW.range.maxX > node.x) { - // in NW or SW - if (parentBranch.children.NW.range.maxY > node.y) { - // in NW - this._placeInRegion(parentBranch, node, "NW"); - } else { - // in SW - this._placeInRegion(parentBranch, node, "SW"); - } - } else { - // in NE or SE - if (parentBranch.children.NW.range.maxY > node.y) { - // in NE - this._placeInRegion(parentBranch, node, "NE"); - } else { - // in SE - this._placeInRegion(parentBranch, node, "SE"); - } - } - } +var _classCallCheck2 = __webpack_require__(0); - /** - * actually place the node in a region (or branch) - * - * @param parentBranch - * @param node - * @param region - * @private - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - }, { - key: "_placeInRegion", - value: function _placeInRegion(parentBranch, node, region) { - switch (parentBranch.children[region].childrenCount) { - case 0: - // place node here - parentBranch.children[region].children.data = node; - parentBranch.children[region].childrenCount = 1; - this._updateBranchMass(parentBranch.children[region], node); - break; - case 1: - // convert into children - // if there are two nodes exactly overlapping (on init, on opening of cluster etc.) - // we move one node a little bit and we do not put it in the tree. - if (parentBranch.children[region].children.data.x === node.x && parentBranch.children[region].children.data.y === node.y) { - node.x += this.seededRandom(); - node.y += this.seededRandom(); - } else { - this._splitBranch(parentBranch.children[region]); - this._placeInTree(parentBranch.children[region], node); - } - break; - case 4: - // place in branch - this._placeInTree(parentBranch.children[region], node); - break; - } - } +var _createClass2 = __webpack_require__(1); - /** - * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch - * after the split is complete. - * - * @param parentBranch - * @private - */ +var _createClass3 = _interopRequireDefault(_createClass2); - }, { - key: "_splitBranch", - value: function _splitBranch(parentBranch) { - // if the branch is shaded with a node, replace the node in the new subset. - var containedNode = null; - if (parentBranch.childrenCount === 1) { - containedNode = parentBranch.children.data; - parentBranch.mass = 0; - parentBranch.centerOfMass.x = 0; - parentBranch.centerOfMass.y = 0; - } - parentBranch.childrenCount = 4; - parentBranch.children.data = null; - this._insertRegion(parentBranch, "NW"); - this._insertRegion(parentBranch, "NE"); - this._insertRegion(parentBranch, "SW"); - this._insertRegion(parentBranch, "SE"); +var _possibleConstructorReturn2 = __webpack_require__(4); - if (containedNode != null) { - this._placeInTree(parentBranch, containedNode); - } - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - /** - * This function subdivides the region into four new segments. - * Specifically, this inserts a single new segment. - * It fills the children section of the parentBranch - * - * @param parentBranch - * @param region - * @param parentRange - * @private - */ +var _inherits2 = __webpack_require__(5); - }, { - key: "_insertRegion", - value: function _insertRegion(parentBranch, region) { - var minX = void 0, - maxX = void 0, - minY = void 0, - maxY = void 0; - var childSize = 0.5 * parentBranch.size; - switch (region) { - case "NW": - minX = parentBranch.range.minX; - maxX = parentBranch.range.minX + childSize; - minY = parentBranch.range.minY; - maxY = parentBranch.range.minY + childSize; - break; - case "NE": - minX = parentBranch.range.minX + childSize; - maxX = parentBranch.range.maxX; - minY = parentBranch.range.minY; - maxY = parentBranch.range.minY + childSize; - break; - case "SW": - minX = parentBranch.range.minX; - maxX = parentBranch.range.minX + childSize; - minY = parentBranch.range.minY + childSize; - maxY = parentBranch.range.maxY; - break; - case "SE": - minX = parentBranch.range.minX + childSize; - maxX = parentBranch.range.maxX; - minY = parentBranch.range.minY + childSize; - maxY = parentBranch.range.maxY; - break; - } +var _inherits3 = _interopRequireDefault(_inherits2); - parentBranch.children[region] = { - centerOfMass: { x: 0, y: 0 }, - mass: 0, - range: { minX: minX, maxX: maxX, minY: minY, maxY: maxY }, - size: 0.5 * parentBranch.size, - calcSize: 2 * parentBranch.calcSize, - children: { data: null }, - maxWidth: 0, - level: parentBranch.level + 1, - childrenCount: 0 - }; - } +var _EdgeBase2 = __webpack_require__(118); - //--------------------------- DEBUGGING BELOW ---------------------------// +var _EdgeBase3 = _interopRequireDefault(_EdgeBase2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * This function is for debugging purposed, it draws the tree. - * - * @param ctx - * @param color - * @private - */ +/** + * A Straight Edge. + * + * @extends EdgeBase + */ +var StraightEdge = function (_EdgeBase) { + (0, _inherits3['default'])(StraightEdge, _EdgeBase); - }, { - key: "_debug", - value: function _debug(ctx, color) { - if (this.barnesHutTree !== undefined) { + /** + * @param {Object} options + * @param {Object} body + * @param {Label} labelModule + */ + function StraightEdge(options, body, labelModule) { + (0, _classCallCheck3['default'])(this, StraightEdge); + return (0, _possibleConstructorReturn3['default'])(this, (StraightEdge.__proto__ || (0, _getPrototypeOf2['default'])(StraightEdge)).call(this, options, body, labelModule)); + } - ctx.lineWidth = 1; + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values + * @private + */ - this._drawBranch(this.barnesHutTree.root, ctx, color); - } - } - /** - * This function is for debugging purposes. It draws the branches recursively. - * - * @param branch - * @param ctx - * @param color - * @private - */ + (0, _createClass3['default'])(StraightEdge, [{ + key: '_line', + value: function _line(ctx, values) { + // draw a straight line + ctx.beginPath(); + ctx.moveTo(this.fromPoint.x, this.fromPoint.y); + ctx.lineTo(this.toPoint.x, this.toPoint.y); + // draw shadow if enabled + this.enableShadow(ctx, values); + ctx.stroke(); + this.disableShadow(ctx, values); + } - }, { - key: "_drawBranch", - value: function _drawBranch(branch, ctx, color) { - if (color === undefined) { - color = "#FF0000"; - } + /** + * + * @returns {undefined} + */ - if (branch.childrenCount === 4) { - this._drawBranch(branch.children.NW, ctx); - this._drawBranch(branch.children.NE, ctx); - this._drawBranch(branch.children.SE, ctx); - this._drawBranch(branch.children.SW, ctx); - } - ctx.strokeStyle = color; - ctx.beginPath(); - ctx.moveTo(branch.range.minX, branch.range.minY); - ctx.lineTo(branch.range.maxX, branch.range.minY); - ctx.stroke(); + }, { + key: 'getViaNode', + value: function getViaNode() { + return undefined; + } - ctx.beginPath(); - ctx.moveTo(branch.range.maxX, branch.range.minY); - ctx.lineTo(branch.range.maxX, branch.range.maxY); - ctx.stroke(); + /** + * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way + * + * @param {number} percentage + * @returns {{x: number, y: number}} + * @private + */ - ctx.beginPath(); - ctx.moveTo(branch.range.maxX, branch.range.maxY); - ctx.lineTo(branch.range.minX, branch.range.maxY); - ctx.stroke(); + }, { + key: 'getPoint', + value: function getPoint(percentage) { + return { + x: (1 - percentage) * this.fromPoint.x + percentage * this.toPoint.x, + y: (1 - percentage) * this.fromPoint.y + percentage * this.toPoint.y + }; + } - ctx.beginPath(); - ctx.moveTo(branch.range.minX, branch.range.maxY); - ctx.lineTo(branch.range.minX, branch.range.minY); - ctx.stroke(); + /** + * + * @param {Node} nearNode + * @param {CanvasRenderingContext2D} ctx + * @returns {{x: number, y: number}} + * @private + */ - /* - if (branch.mass > 0) { - ctx.circle(branch.centerOfMass.x, branch.centerOfMass.y, 3*branch.mass); - ctx.stroke(); - } - */ + }, { + key: '_findBorderPosition', + value: function _findBorderPosition(nearNode, ctx) { + var node1 = this.to; + var node2 = this.from; + if (nearNode.id === this.from.id) { + node1 = this.from; + node2 = this.to; } - }]); - return BarnesHutSolver; - }(); - exports["default"] = BarnesHutSolver; + var angle = Math.atan2(node1.y - node2.y, node1.x - node2.x); + var dx = node1.x - node2.x; + var dy = node1.y - node2.y; + var edgeSegmentLength = Math.sqrt(dx * dx + dy * dy); + var toBorderDist = nearNode.distanceToBorder(ctx, angle); + var toBorderPoint = (edgeSegmentLength - toBorderDist) / edgeSegmentLength; -/***/ }), -/* 214 */ -/***/ (function(module, exports, __webpack_require__) { + var borderPos = {}; + borderPos.x = (1 - toBorderPoint) * node2.x + toBorderPoint * node1.x; + borderPos.y = (1 - toBorderPoint) * node2.y + toBorderPoint * node1.y; - "use strict"; + return borderPos; + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @param {number} x3 + * @param {number} y3 + * @returns {number} + * @private + */ - var _classCallCheck2 = __webpack_require__(135); + }, { + key: '_getDistanceToEdge', + value: function _getDistanceToEdge(x1, y1, x2, y2, x3, y3) { + // x3,y3 is the point + return this._getDistanceToLine(x1, y1, x2, y2, x3, y3); + } + }]); + return StraightEdge; +}(_EdgeBase3['default']); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +exports['default'] = StraightEdge; - var _createClass2 = __webpack_require__(136); +/***/ }), +/* 220 */ +/***/ (function(module, exports, __webpack_require__) { - var _createClass3 = _interopRequireDefault(_createClass2); +"use strict"; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var RepulsionSolver = function () { - function RepulsionSolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, RepulsionSolver); +Object.defineProperty(exports, "__esModule", { + value: true +}); - this.body = body; - this.physicsBody = physicsBody; - this.setOptions(options); - } +var _keys = __webpack_require__(8); - (0, _createClass3["default"])(RepulsionSolver, [{ - key: "setOptions", - value: function setOptions(options) { - this.options = options; - } - /** - * Calculate the forces the nodes apply on each other based on a repulsion field. - * This field is linearly approximated. - * - * @private - */ +var _keys2 = _interopRequireDefault(_keys); - }, { - key: "solve", - value: function solve() { - var dx, dy, distance, fx, fy, repulsingForce, node1, node2; +var _classCallCheck2 = __webpack_require__(0); - var nodes = this.body.nodes; - var nodeIndices = this.physicsBody.physicsNodeIndices; - var forces = this.physicsBody.forces; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // repulsing forces between nodes - var nodeDistance = this.options.nodeDistance; +var _createClass2 = __webpack_require__(1); - // approximation constants - var a = -2 / 3 / nodeDistance; - var b = 4 / 3; +var _createClass3 = _interopRequireDefault(_createClass2); - // we loop from i over all but the last entree in the array - // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j - for (var i = 0; i < nodeIndices.length - 1; i++) { - node1 = nodes[nodeIndices[i]]; - for (var j = i + 1; j < nodeIndices.length; j++) { - node2 = nodes[nodeIndices[j]]; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - dx = node2.x - node1.x; - dy = node2.y - node1.y; - distance = Math.sqrt(dx * dx + dy * dy); +var BarnesHutSolver = __webpack_require__(120)['default']; +var Repulsion = __webpack_require__(221)['default']; +var HierarchicalRepulsion = __webpack_require__(222)['default']; +var SpringSolver = __webpack_require__(223)['default']; +var HierarchicalSpringSolver = __webpack_require__(224)['default']; +var CentralGravitySolver = __webpack_require__(121)['default']; +var ForceAtlas2BasedRepulsionSolver = __webpack_require__(225)['default']; +var ForceAtlas2BasedCentralGravitySolver = __webpack_require__(226)['default']; +var util = __webpack_require__(2); +var EndPoints = __webpack_require__(119)['default']; // for debugging with _drawForces() - // same condition as BarnesHutSolver, making sure nodes are never 100% overlapping. - if (distance === 0) { - distance = 0.1 * Math.random(); - dx = distance; - } - if (distance < 2 * nodeDistance) { - if (distance < 0.5 * nodeDistance) { - repulsingForce = 1.0; - } else { - repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / nodeDistance - 1) * steepness)) - } - repulsingForce = repulsingForce / distance; +/** + * The physics engine + */ - fx = dx * repulsingForce; - fy = dy * repulsingForce; +var PhysicsEngine = function () { + /** + * @param {Object} body + */ + function PhysicsEngine(body) { + (0, _classCallCheck3['default'])(this, PhysicsEngine); - forces[node1.id].x -= fx; - forces[node1.id].y -= fy; - forces[node2.id].x += fx; - forces[node2.id].y += fy; - } - } - } - } - }]); - return RepulsionSolver; - }(); + this.body = body; + this.physicsBody = { physicsNodeIndices: [], physicsEdgeIndices: [], forces: {}, velocities: {} }; + + this.physicsEnabled = true; + this.simulationInterval = 1000 / 60; + this.requiresTimeout = true; + this.previousStates = {}; + this.referenceState = {}; + this.freezeCache = {}; + this.renderTimer = undefined; + + // parameters for the adaptive timestep + this.adaptiveTimestep = false; + this.adaptiveTimestepEnabled = false; + this.adaptiveCounter = 0; + this.adaptiveInterval = 3; + + this.stabilized = false; + this.startedStabilization = false; + this.stabilizationIterations = 0; + this.ready = false; // will be set to true if the stabilize - exports["default"] = RepulsionSolver; + // default options + this.options = {}; + this.defaultOptions = { + enabled: true, + barnesHut: { + theta: 0.5, + gravitationalConstant: -2000, + centralGravity: 0.3, + springLength: 95, + springConstant: 0.04, + damping: 0.09, + avoidOverlap: 0 + }, + forceAtlas2Based: { + theta: 0.5, + gravitationalConstant: -50, + centralGravity: 0.01, + springConstant: 0.08, + springLength: 100, + damping: 0.4, + avoidOverlap: 0 + }, + repulsion: { + centralGravity: 0.2, + springLength: 200, + springConstant: 0.05, + nodeDistance: 100, + damping: 0.09, + avoidOverlap: 0 + }, + hierarchicalRepulsion: { + centralGravity: 0.0, + springLength: 100, + springConstant: 0.01, + nodeDistance: 120, + damping: 0.09 + }, + maxVelocity: 50, + minVelocity: 0.75, // px/s + solver: 'barnesHut', + stabilization: { + enabled: true, + iterations: 1000, // maximum number of iteration to stabilize + updateInterval: 50, + onlyDynamicEdges: false, + fit: true + }, + timestep: 0.5, + adaptiveTimestep: true + }; + util.extend(this.options, this.defaultOptions); + this.timestep = 0.5; + this.layoutFailed = false; -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { + this.bindEventListeners(); + } - "use strict"; + /** + * Binds event listeners + */ - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _classCallCheck2 = __webpack_require__(135); + (0, _createClass3['default'])(PhysicsEngine, [{ + key: 'bindEventListeners', + value: function bindEventListeners() { + var _this = this; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + this.body.emitter.on('initPhysics', function () { + _this.initPhysics(); + }); + this.body.emitter.on('_layoutFailed', function () { + _this.layoutFailed = true; + }); + this.body.emitter.on('resetPhysics', function () { + _this.stopSimulation();_this.ready = false; + }); + this.body.emitter.on('disablePhysics', function () { + _this.physicsEnabled = false;_this.stopSimulation(); + }); + this.body.emitter.on('restorePhysics', function () { + _this.setOptions(_this.options); + if (_this.ready === true) { + _this.startSimulation(); + } + }); + this.body.emitter.on('startSimulation', function () { + if (_this.ready === true) { + _this.startSimulation(); + } + }); + this.body.emitter.on('stopSimulation', function () { + _this.stopSimulation(); + }); + this.body.emitter.on('destroy', function () { + _this.stopSimulation(false); + _this.body.emitter.off(); + }); + this.body.emitter.on("_dataChanged", function () { + // Nodes and/or edges have been added or removed, update shortcut lists. + _this.updatePhysicsData(); + }); - var _createClass2 = __webpack_require__(136); + // debug: show forces + // this.body.emitter.on("afterDrawing", (ctx) => {this._drawForces(ctx);}); + } - var _createClass3 = _interopRequireDefault(_createClass2); + /** + * set the physics options + * @param {Object} options + */ - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + }, { + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + if (options === false) { + this.options.enabled = false; + this.physicsEnabled = false; + this.stopSimulation(); + } else if (options === true) { + this.options.enabled = true; + this.physicsEnabled = true; + this.startSimulation(); + } else { + this.physicsEnabled = true; + util.selectiveNotDeepExtend(['stabilization'], this.options, options); + util.mergeOptions(this.options, options, 'stabilization'); - var HierarchicalRepulsionSolver = function () { - function HierarchicalRepulsionSolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, HierarchicalRepulsionSolver); + if (options.enabled === undefined) { + this.options.enabled = true; + } - this.body = body; - this.physicsBody = physicsBody; - this.setOptions(options); - } + if (this.options.enabled === false) { + this.physicsEnabled = false; + this.stopSimulation(); + } - (0, _createClass3["default"])(HierarchicalRepulsionSolver, [{ - key: "setOptions", - value: function setOptions(options) { - this.options = options; + // set the timestep + this.timestep = this.options.timestep; + } } + this.init(); + } - /** - * Calculate the forces the nodes apply on each other based on a repulsion field. - * This field is linearly approximated. - * - * @private - */ + /** + * configure the engine. + */ - }, { - key: "solve", - value: function solve() { - var dx, dy, distance, fx, fy, repulsingForce, node1, node2, i, j; + }, { + key: 'init', + value: function init() { + var options; + if (this.options.solver === 'forceAtlas2Based') { + options = this.options.forceAtlas2Based; + this.nodesSolver = new ForceAtlas2BasedRepulsionSolver(this.body, this.physicsBody, options); + this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); + this.gravitySolver = new ForceAtlas2BasedCentralGravitySolver(this.body, this.physicsBody, options); + } else if (this.options.solver === 'repulsion') { + options = this.options.repulsion; + this.nodesSolver = new Repulsion(this.body, this.physicsBody, options); + this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); + this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); + } else if (this.options.solver === 'hierarchicalRepulsion') { + options = this.options.hierarchicalRepulsion; + this.nodesSolver = new HierarchicalRepulsion(this.body, this.physicsBody, options); + this.edgesSolver = new HierarchicalSpringSolver(this.body, this.physicsBody, options); + this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); + } else { + // barnesHut + options = this.options.barnesHut; + this.nodesSolver = new BarnesHutSolver(this.body, this.physicsBody, options); + this.edgesSolver = new SpringSolver(this.body, this.physicsBody, options); + this.gravitySolver = new CentralGravitySolver(this.body, this.physicsBody, options); + } - var nodes = this.body.nodes; - var nodeIndices = this.physicsBody.physicsNodeIndices; - var forces = this.physicsBody.forces; - - // repulsing forces between nodes - var nodeDistance = this.options.nodeDistance; - - // we loop from i over all but the last entree in the array - // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j - for (i = 0; i < nodeIndices.length - 1; i++) { - node1 = nodes[nodeIndices[i]]; - for (j = i + 1; j < nodeIndices.length; j++) { - node2 = nodes[nodeIndices[j]]; - - // nodes only affect nodes on their level - if (node1.level === node2.level) { - dx = node2.x - node1.x; - dy = node2.y - node1.y; - distance = Math.sqrt(dx * dx + dy * dy); - - var steepness = 0.05; - if (distance < nodeDistance) { - repulsingForce = -Math.pow(steepness * distance, 2) + Math.pow(steepness * nodeDistance, 2); - } else { - repulsingForce = 0; - } - // normalize force with - if (distance === 0) { - distance = 0.01; - } else { - repulsingForce = repulsingForce / distance; - } - fx = dx * repulsingForce; - fy = dy * repulsingForce; + this.modelOptions = options; + } - forces[node1.id].x -= fx; - forces[node1.id].y -= fy; - forces[node2.id].x += fx; - forces[node2.id].y += fy; - } - } + /** + * initialize the engine + */ + + }, { + key: 'initPhysics', + value: function initPhysics() { + if (this.physicsEnabled === true && this.options.enabled === true) { + if (this.options.stabilization.enabled === true) { + this.stabilize(); + } else { + this.stabilized = false; + this.ready = true; + this.body.emitter.emit('fit', {}, this.layoutFailed); // if the layout failed, we use the approximation for the zoom + this.startSimulation(); } + } else { + this.ready = true; + this.body.emitter.emit('fit'); } - }]); - return HierarchicalRepulsionSolver; - }(); + } - exports["default"] = HierarchicalRepulsionSolver; + /** + * Start the simulation + */ -/***/ }), -/* 216 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'startSimulation', + value: function startSimulation() { + if (this.physicsEnabled === true && this.options.enabled === true) { + this.stabilized = false; - "use strict"; + // when visible, adaptivity is disabled. + this.adaptiveTimestep = false; - Object.defineProperty(exports, "__esModule", { - value: true - }); + // this sets the width of all nodes initially which could be required for the avoidOverlap + this.body.emitter.emit("_resizeNodes"); + if (this.viewFunction === undefined) { + this.viewFunction = this.simulationStep.bind(this); + this.body.emitter.on('initRedraw', this.viewFunction); + this.body.emitter.emit('_startRendering'); + } + } else { + this.body.emitter.emit('_redraw'); + } + } - var _classCallCheck2 = __webpack_require__(135); + /** + * Stop the simulation, force stabilization. + * @param {boolean} [emit=true] + */ - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + }, { + key: 'stopSimulation', + value: function stopSimulation() { + var emit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - var _createClass2 = __webpack_require__(136); + this.stabilized = true; + if (emit === true) { + this._emitStabilized(); + } + if (this.viewFunction !== undefined) { + this.body.emitter.off('initRedraw', this.viewFunction); + this.viewFunction = undefined; + if (emit === true) { + this.body.emitter.emit('_stopRendering'); + } + } + } - var _createClass3 = _interopRequireDefault(_createClass2); + /** + * The viewFunction inserts this step into each render loop. It calls the physics tick and handles the cleanup at stabilized. + * + */ - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + }, { + key: 'simulationStep', + value: function simulationStep() { + // check if the physics have settled + var startTime = Date.now(); + this.physicsTick(); + var physicsTime = Date.now() - startTime; - var SpringSolver = function () { - function SpringSolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, SpringSolver); + // run double speed if it is a little graph + if ((physicsTime < 0.4 * this.simulationInterval || this.runDoubleSpeed === true) && this.stabilized === false) { + this.physicsTick(); - this.body = body; - this.physicsBody = physicsBody; - this.setOptions(options); - } + // this makes sure there is no jitter. The decision is taken once to run it at double speed. + this.runDoubleSpeed = true; + } - (0, _createClass3["default"])(SpringSolver, [{ - key: "setOptions", - value: function setOptions(options) { - this.options = options; + if (this.stabilized === true) { + this.stopSimulation(); } + } - /** - * This function calculates the springforces on the nodes, accounting for the support nodes. - * - * @private - */ + /** + * trigger the stabilized event. + * + * @param {number} [amountOfIterations=this.stabilizationIterations] + * @private + */ - }, { - key: "solve", - value: function solve() { - var edgeLength = void 0, - edge = void 0; - var edgeIndices = this.physicsBody.physicsEdgeIndices; - var edges = this.body.edges; - var node1 = void 0, - node2 = void 0, - node3 = void 0; - - // forces caused by the edges, modelled as springs - for (var i = 0; i < edgeIndices.length; i++) { - edge = edges[edgeIndices[i]]; - if (edge.connected === true && edge.toId !== edge.fromId) { - // only calculate forces if nodes are in the same sector - if (this.body.nodes[edge.toId] !== undefined && this.body.nodes[edge.fromId] !== undefined) { - if (edge.edgeType.via !== undefined) { - edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length; - node1 = edge.to; - node2 = edge.edgeType.via; - node3 = edge.from; - - this._calculateSpringForce(node1, node2, 0.5 * edgeLength); - this._calculateSpringForce(node2, node3, 0.5 * edgeLength); - } else { - // the * 1.5 is here so the edge looks as large as a smooth edge. It does not initially because the smooth edges use - // the support nodes which exert a repulsive force on the to and from nodes, making the edge appear larger. - edgeLength = edge.options.length === undefined ? this.options.springLength * 1.5 : edge.options.length; - this._calculateSpringForce(edge.from, edge.to, edgeLength); - } - } - } - } - } + }, { + key: '_emitStabilized', + value: function _emitStabilized() { + var _this2 = this; - /** - * This is the code actually performing the calculation for the function above. - * - * @param node1 - * @param node2 - * @param edgeLength - * @private - */ + var amountOfIterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.stabilizationIterations; - }, { - key: "_calculateSpringForce", - value: function _calculateSpringForce(node1, node2, edgeLength) { - var dx = node1.x - node2.x; - var dy = node1.y - node2.y; - var distance = Math.max(Math.sqrt(dx * dx + dy * dy), 0.01); + if (this.stabilizationIterations > 1 || this.startedStabilization === true) { + setTimeout(function () { + _this2.body.emitter.emit('stabilized', { iterations: amountOfIterations }); + _this2.startedStabilization = false; + _this2.stabilizationIterations = 0; + }, 0); + } + } - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - var springForce = this.options.springConstant * (edgeLength - distance) / distance; + /** + * Calculate the forces for one physics iteration and move the nodes. + * @private + */ - var fx = dx * springForce; - var fy = dy * springForce; + }, { + key: 'physicsStep', + value: function physicsStep() { + this.gravitySolver.solve(); + this.nodesSolver.solve(); + this.edgesSolver.solve(); + this.moveNodes(); + } - // handle the case where one node is not part of the physcis - if (this.physicsBody.forces[node1.id] !== undefined) { - this.physicsBody.forces[node1.id].x += fx; - this.physicsBody.forces[node1.id].y += fy; - } + /** + * Make dynamic adjustments to the timestep, based on current state. + * + * Helper function for physicsTick(). + * @private + */ + + }, { + key: 'adjustTimeStep', + value: function adjustTimeStep() { + var factor = 1.2; // Factor for increasing the timestep on success. - if (this.physicsBody.forces[node2.id] !== undefined) { - this.physicsBody.forces[node2.id].x -= fx; - this.physicsBody.forces[node2.id].y -= fy; + // we compare the two steps. if it is acceptable we double the step. + if (this._evaluateStepQuality() === true) { + this.timestep = factor * this.timestep; + } else { + // if not, we decrease the step to a minimum of the options timestep. + // if the decreased timestep is smaller than the options step, we do not reset the counter + // we assume that the options timestep is stable enough. + if (this.timestep / factor < this.options.timestep) { + this.timestep = this.options.timestep; + } else { + // if the timestep was larger than 2 times the option one we check the adaptivity again to ensure + // that large instabilities do not form. + this.adaptiveCounter = -1; // check again next iteration + this.timestep = Math.max(this.options.timestep, this.timestep / factor); } } - }]); - return SpringSolver; - }(); + } - exports["default"] = SpringSolver; + /** + * A single simulation step (or 'tick') in the physics simulation + * + * @private + */ -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: 'physicsTick', + value: function physicsTick() { + this._startStabilizing(); // this ensures that there is no start event when the network is already stable. + if (this.stabilized === true) return; - "use strict"; + // adaptivity means the timestep adapts to the situation, only applicable for stabilization + if (this.adaptiveTimestep === true && this.adaptiveTimestepEnabled === true) { + // timestep remains stable for "interval" iterations. + var doAdaptive = this.adaptiveCounter % this.adaptiveInterval === 0; - Object.defineProperty(exports, "__esModule", { - value: true - }); + if (doAdaptive) { + // first the big step and revert. + this.timestep = 2 * this.timestep; + this.physicsStep(); + this.revert(); // saves the reference state - var _classCallCheck2 = __webpack_require__(135); + // now the normal step. Since this is the last step, it is the more stable one and we will take this. + this.timestep = 0.5 * this.timestep; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // since it's half the step, we do it twice. + this.physicsStep(); + this.physicsStep(); - var _createClass2 = __webpack_require__(136); + this.adjustTimeStep(); + } else { + this.physicsStep(); // normal step, keeping timestep constant + } - var _createClass3 = _interopRequireDefault(_createClass2); + this.adaptiveCounter += 1; + } else { + // case for the static timestep, we reset it to the one in options and take a normal step. + this.timestep = this.options.timestep; + this.physicsStep(); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + if (this.stabilized === true) this.revert(); + this.stabilizationIterations++; + } - var HierarchicalSpringSolver = function () { - function HierarchicalSpringSolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, HierarchicalSpringSolver); + /** + * Nodes and edges can have the physics toggles on or off. A collection of indices is created here so we can skip the check all the time. + * + * @private + */ - this.body = body; - this.physicsBody = physicsBody; - this.setOptions(options); - } + }, { + key: 'updatePhysicsData', + value: function updatePhysicsData() { + this.physicsBody.forces = {}; + this.physicsBody.physicsNodeIndices = []; + this.physicsBody.physicsEdgeIndices = []; + var nodes = this.body.nodes; + var edges = this.body.edges; - (0, _createClass3["default"])(HierarchicalSpringSolver, [{ - key: "setOptions", - value: function setOptions(options) { - this.options = options; + // get node indices for physics + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + if (nodes[nodeId].options.physics === true) { + this.physicsBody.physicsNodeIndices.push(nodes[nodeId].id); + } + } } - /** - * This function calculates the springforces on the nodes, accounting for the support nodes. - * - * @private - */ - - }, { - key: "solve", - value: function solve() { - var edgeLength, edge; - var dx, dy, fx, fy, springForce, distance; - var edges = this.body.edges; - var factor = 0.5; + // get edge indices for physics + for (var edgeId in edges) { + if (edges.hasOwnProperty(edgeId)) { + if (edges[edgeId].options.physics === true) { + this.physicsBody.physicsEdgeIndices.push(edges[edgeId].id); + } + } + } - var edgeIndices = this.physicsBody.physicsEdgeIndices; - var nodeIndices = this.physicsBody.physicsNodeIndices; - var forces = this.physicsBody.forces; + // get the velocity and the forces vector + for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) { + var _nodeId = this.physicsBody.physicsNodeIndices[i]; + this.physicsBody.forces[_nodeId] = { x: 0, y: 0 }; - // initialize the spring force counters - for (var i = 0; i < nodeIndices.length; i++) { - var nodeId = nodeIndices[i]; - forces[nodeId].springFx = 0; - forces[nodeId].springFy = 0; + // forces can be reset because they are recalculated. Velocities have to persist. + if (this.physicsBody.velocities[_nodeId] === undefined) { + this.physicsBody.velocities[_nodeId] = { x: 0, y: 0 }; } + } - // forces caused by the edges, modelled as springs - for (var _i = 0; _i < edgeIndices.length; _i++) { - edge = edges[edgeIndices[_i]]; - if (edge.connected === true) { - edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length; - - dx = edge.from.x - edge.to.x; - dy = edge.from.y - edge.to.y; - distance = Math.sqrt(dx * dx + dy * dy); - distance = distance === 0 ? 0.01 : distance; + // clean deleted nodes from the velocity vector + for (var _nodeId2 in this.physicsBody.velocities) { + if (nodes[_nodeId2] === undefined) { + delete this.physicsBody.velocities[_nodeId2]; + } + } + } - // the 1/distance is so the fx and fy can be calculated without sine or cosine. - springForce = this.options.springConstant * (edgeLength - distance) / distance; + /** + * Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized. + */ - fx = dx * springForce; - fy = dy * springForce; + }, { + key: 'revert', + value: function revert() { + var nodeIds = (0, _keys2['default'])(this.previousStates); + var nodes = this.body.nodes; + var velocities = this.physicsBody.velocities; + this.referenceState = {}; - if (edge.to.level != edge.from.level) { - if (forces[edge.toId] !== undefined) { - forces[edge.toId].springFx -= fx; - forces[edge.toId].springFy -= fy; - } - if (forces[edge.fromId] !== undefined) { - forces[edge.fromId].springFx += fx; - forces[edge.fromId].springFy += fy; - } - } else { - if (forces[edge.toId] !== undefined) { - forces[edge.toId].x -= factor * fx; - forces[edge.toId].y -= factor * fy; - } - if (forces[edge.fromId] !== undefined) { - forces[edge.fromId].x += factor * fx; - forces[edge.fromId].y += factor * fy; - } - } + for (var i = 0; i < nodeIds.length; i++) { + var nodeId = nodeIds[i]; + if (nodes[nodeId] !== undefined) { + if (nodes[nodeId].options.physics === true) { + this.referenceState[nodeId] = { + positions: { x: nodes[nodeId].x, y: nodes[nodeId].y } + }; + velocities[nodeId].x = this.previousStates[nodeId].vx; + velocities[nodeId].y = this.previousStates[nodeId].vy; + nodes[nodeId].x = this.previousStates[nodeId].x; + nodes[nodeId].y = this.previousStates[nodeId].y; } + } else { + delete this.previousStates[nodeId]; } + } + } + + /** + * This compares the reference state to the current state + * + * @returns {boolean} + * @private + */ - // normalize spring forces - var springForce = 1; - var springFx, springFy; - for (var _i2 = 0; _i2 < nodeIndices.length; _i2++) { - var _nodeId = nodeIndices[_i2]; - springFx = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFx)); - springFy = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFy)); + }, { + key: '_evaluateStepQuality', + value: function _evaluateStepQuality() { + var dx = void 0, + dy = void 0, + dpos = void 0; + var nodes = this.body.nodes; + var reference = this.referenceState; + var posThreshold = 0.3; - forces[_nodeId].x += springFx; - forces[_nodeId].y += springFy; - } + for (var nodeId in this.referenceState) { + if (this.referenceState.hasOwnProperty(nodeId) && nodes[nodeId] !== undefined) { + dx = nodes[nodeId].x - reference[nodeId].positions.x; + dy = nodes[nodeId].y - reference[nodeId].positions.y; - // retain energy balance - var totalFx = 0; - var totalFy = 0; - for (var _i3 = 0; _i3 < nodeIndices.length; _i3++) { - var _nodeId2 = nodeIndices[_i3]; - totalFx += forces[_nodeId2].x; - totalFy += forces[_nodeId2].y; - } - var correctionFx = totalFx / nodeIndices.length; - var correctionFy = totalFy / nodeIndices.length; + dpos = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); - for (var _i4 = 0; _i4 < nodeIndices.length; _i4++) { - var _nodeId3 = nodeIndices[_i4]; - forces[_nodeId3].x -= correctionFx; - forces[_nodeId3].y -= correctionFy; + if (dpos > posThreshold) { + return false; + } } } - }]); - return HierarchicalSpringSolver; - }(); - - exports["default"] = HierarchicalSpringSolver; + return true; + } -/***/ }), -/* 218 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * move the nodes one timestep and check if they are stabilized + */ - "use strict"; + }, { + key: 'moveNodes', + value: function moveNodes() { + var nodeIndices = this.physicsBody.physicsNodeIndices; + var maxNodeVelocity = 0; + var averageNodeVelocity = 0; - Object.defineProperty(exports, "__esModule", { - value: true - }); + // the velocity threshold (energy in the system) for the adaptivity toggle + var velocityAdaptiveThreshold = 5; - var _classCallCheck2 = __webpack_require__(135); + for (var i = 0; i < nodeIndices.length; i++) { + var nodeId = nodeIndices[i]; + var nodeVelocity = this._performStep(nodeId); + // stabilized is true if stabilized is true and velocity is smaller than vmin --> all nodes must be stabilized + maxNodeVelocity = Math.max(maxNodeVelocity, nodeVelocity); + averageNodeVelocity += nodeVelocity; + } - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // evaluating the stabilized and adaptiveTimestepEnabled conditions + this.adaptiveTimestepEnabled = averageNodeVelocity / nodeIndices.length < velocityAdaptiveThreshold; + this.stabilized = maxNodeVelocity < this.options.minVelocity; + } - var _createClass2 = __webpack_require__(136); + /** + * Calculate new velocity for a coordinate direction + * + * @param {number} v velocity for current coordinate + * @param {number} f regular force for current coordinate + * @param {number} m mass of current node + * @returns {number} new velocity for current coordinate + * @private + */ - var _createClass3 = _interopRequireDefault(_createClass2); + }, { + key: 'calculateComponentVelocity', + value: function calculateComponentVelocity(v, f, m) { + var df = this.modelOptions.damping * v; // damping force + var a = (f - df) / m; // acceleration - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + v += a * this.timestep; - var CentralGravitySolver = function () { - function CentralGravitySolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, CentralGravitySolver); + // Put a limit on the velocities if it is really high + var maxV = this.options.maxVelocity || 1e9; + if (Math.abs(v) > maxV) { + v = v > 0 ? maxV : -maxV; + } - this.body = body; - this.physicsBody = physicsBody; - this.setOptions(options); + return v; } - (0, _createClass3["default"])(CentralGravitySolver, [{ - key: "setOptions", - value: function setOptions(options) { - this.options = options; - } - }, { - key: "solve", - value: function solve() { - var dx = void 0, - dy = void 0, - distance = void 0, - node = void 0; - var nodes = this.body.nodes; - var nodeIndices = this.physicsBody.physicsNodeIndices; - var forces = this.physicsBody.forces; + /** + * Perform the actual step + * + * @param {Node.id} nodeId + * @returns {number} the new velocity of given node + * @private + */ - for (var i = 0; i < nodeIndices.length; i++) { - var nodeId = nodeIndices[i]; - node = nodes[nodeId]; - dx = -node.x; - dy = -node.y; - distance = Math.sqrt(dx * dx + dy * dy); + }, { + key: '_performStep', + value: function _performStep(nodeId) { + var node = this.body.nodes[nodeId]; + var force = this.physicsBody.forces[nodeId]; + var velocity = this.physicsBody.velocities[nodeId]; - this._calculateForces(distance, dx, dy, forces, node); - } - } + // store the state so we can revert + this.previousStates[nodeId] = { x: node.x, y: node.y, vx: velocity.x, vy: velocity.y }; - /** - * Calculate the forces based on the distance. - * @private - */ + if (node.options.fixed.x === false) { + velocity.x = this.calculateComponentVelocity(velocity.x, force.x, node.options.mass); + node.x += velocity.x * this.timestep; + } else { + force.x = 0; + velocity.x = 0; + } - }, { - key: "_calculateForces", - value: function _calculateForces(distance, dx, dy, forces, node) { - var gravityForce = distance === 0 ? 0 : this.options.centralGravity / distance; - forces[node.id].x = dx * gravityForce; - forces[node.id].y = dy * gravityForce; + if (node.options.fixed.y === false) { + velocity.y = this.calculateComponentVelocity(velocity.y, force.y, node.options.mass); + node.y += velocity.y * this.timestep; + } else { + force.y = 0; + velocity.y = 0; } - }]); - return CentralGravitySolver; - }(); - exports["default"] = CentralGravitySolver; + var totalVelocity = Math.sqrt(Math.pow(velocity.x, 2) + Math.pow(velocity.y, 2)); + return totalVelocity; + } -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * When initializing and stabilizing, we can freeze nodes with a predefined position. + * This greatly speeds up stabilization because only the supportnodes for the smoothCurves have to settle. + * + * @private + */ - "use strict"; + }, { + key: '_freezeNodes', + value: function _freezeNodes() { + var nodes = this.body.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + if (nodes[id].x && nodes[id].y) { + var fixed = nodes[id].options.fixed; + this.freezeCache[id] = { x: fixed.x, y: fixed.y }; + fixed.x = true; + fixed.y = true; + } + } + } + } - Object.defineProperty(exports, "__esModule", { - value: true - }); + /** + * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. + * + * @private + */ - var _getPrototypeOf = __webpack_require__(176); + }, { + key: '_restoreFrozenNodes', + value: function _restoreFrozenNodes() { + var nodes = this.body.nodes; + for (var id in nodes) { + if (nodes.hasOwnProperty(id)) { + if (this.freezeCache[id] !== undefined) { + nodes[id].options.fixed.x = this.freezeCache[id].x; + nodes[id].options.fixed.y = this.freezeCache[id].y; + } + } + } + this.freezeCache = {}; + } - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + /** + * Find a stable position for all nodes + * + * @param {number} [iterations=this.options.stabilization.iterations] + */ - var _classCallCheck2 = __webpack_require__(135); + }, { + key: 'stabilize', + value: function stabilize() { + var _this3 = this; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + var iterations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.stabilization.iterations; - var _createClass2 = __webpack_require__(136); + if (typeof iterations !== 'number') { + iterations = this.options.stabilization.iterations; + console.log('The stabilize method needs a numeric amount of iterations. Switching to default: ', iterations); + } - var _createClass3 = _interopRequireDefault(_createClass2); + if (this.physicsBody.physicsNodeIndices.length === 0) { + this.ready = true; + return; + } - var _possibleConstructorReturn2 = __webpack_require__(179); + // enable adaptive timesteps + this.adaptiveTimestep = true && this.options.adaptiveTimestep; - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + // this sets the width of all nodes initially which could be required for the avoidOverlap + this.body.emitter.emit("_resizeNodes"); - var _inherits2 = __webpack_require__(180); + this.stopSimulation(); // stop the render loop + this.stabilized = false; - var _inherits3 = _interopRequireDefault(_inherits2); + // block redraw requests + this.body.emitter.emit('_blockRedraw'); + this.targetIterations = iterations; - var _BarnesHutSolver2 = __webpack_require__(213); + // start the stabilization + if (this.options.stabilization.onlyDynamicEdges === true) { + this._freezeNodes(); + } + this.stabilizationIterations = 0; - var _BarnesHutSolver3 = _interopRequireDefault(_BarnesHutSolver2); + setTimeout(function () { + return _this3._stabilizationBatch(); + }, 0); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + /** + * If not already stabilizing, start it and emit a start event. + * + * @returns {boolean} true if stabilization started with this call + * @private + */ - var ForceAtlas2BasedRepulsionSolver = function (_BarnesHutSolver) { - (0, _inherits3["default"])(ForceAtlas2BasedRepulsionSolver, _BarnesHutSolver); + }, { + key: '_startStabilizing', + value: function _startStabilizing() { + if (this.startedStabilization === true) return false; - function ForceAtlas2BasedRepulsionSolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, ForceAtlas2BasedRepulsionSolver); - return (0, _possibleConstructorReturn3["default"])(this, (ForceAtlas2BasedRepulsionSolver.__proto__ || (0, _getPrototypeOf2["default"])(ForceAtlas2BasedRepulsionSolver)).call(this, body, physicsBody, options)); + this.body.emitter.emit('startStabilizing'); + this.startedStabilization = true; + return true; } /** - * Calculate the forces based on the distance. - * - * @param distance - * @param dx - * @param dy - * @param node - * @param parentBranch + * One batch of stabilization * @private */ + }, { + key: '_stabilizationBatch', + value: function _stabilizationBatch() { + var _this4 = this; - (0, _createClass3["default"])(ForceAtlas2BasedRepulsionSolver, [{ - key: "_calculateForces", - value: function _calculateForces(distance, dx, dy, node, parentBranch) { - if (distance === 0) { - distance = 0.1 * Math.random(); - dx = distance; - } + var running = function running() { + return _this4.stabilized === false && _this4.stabilizationIterations < _this4.targetIterations; + }; - if (this.overlapAvoidanceFactor < 1 && node.shape.radius) { - distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius); - } + var sendProgress = function sendProgress() { + _this4.body.emitter.emit('stabilizationProgress', { + iterations: _this4.stabilizationIterations, + total: _this4.targetIterations + }); + }; - var degree = node.edges.length + 1; - // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines - // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce - var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass * degree / Math.pow(distance, 2); - var fx = dx * gravityForce; - var fy = dy * gravityForce; + if (this._startStabilizing()) { + sendProgress(); // Ensure that there is at least one start event. + } - this.physicsBody.forces[node.id].x += fx; - this.physicsBody.forces[node.id].y += fy; + var count = 0; + while (running() && count < this.options.stabilization.updateInterval) { + this.physicsTick(); + count++; } - }]); - return ForceAtlas2BasedRepulsionSolver; - }(_BarnesHutSolver3["default"]); - exports["default"] = ForceAtlas2BasedRepulsionSolver; + sendProgress(); -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _getPrototypeOf = __webpack_require__(176); - - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - - var _classCallCheck2 = __webpack_require__(135); - - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - - var _createClass2 = __webpack_require__(136); - - var _createClass3 = _interopRequireDefault(_createClass2); - - var _possibleConstructorReturn2 = __webpack_require__(179); + if (running()) { + setTimeout(this._stabilizationBatch.bind(this), 0); + } else { + this._finalizeStabilization(); + } + } - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + /** + * Wrap up the stabilization, fit and emit the events. + * @private + */ - var _inherits2 = __webpack_require__(180); + }, { + key: '_finalizeStabilization', + value: function _finalizeStabilization() { + this.body.emitter.emit('_allowRedraw'); + if (this.options.stabilization.fit === true) { + this.body.emitter.emit('fit'); + } - var _inherits3 = _interopRequireDefault(_inherits2); + if (this.options.stabilization.onlyDynamicEdges === true) { + this._restoreFrozenNodes(); + } - var _CentralGravitySolver2 = __webpack_require__(218); + this.body.emitter.emit('stabilizationIterationsDone'); + this.body.emitter.emit('_requestRedraw'); - var _CentralGravitySolver3 = _interopRequireDefault(_CentralGravitySolver2); + if (this.stabilized === true) { + this._emitStabilized(); + } else { + this.startSimulation(); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + this.ready = true; + } - var ForceAtlas2BasedCentralGravitySolver = function (_CentralGravitySolver) { - (0, _inherits3["default"])(ForceAtlas2BasedCentralGravitySolver, _CentralGravitySolver); + //--------------------------- DEBUGGING BELOW ---------------------------// - function ForceAtlas2BasedCentralGravitySolver(body, physicsBody, options) { - (0, _classCallCheck3["default"])(this, ForceAtlas2BasedCentralGravitySolver); - return (0, _possibleConstructorReturn3["default"])(this, (ForceAtlas2BasedCentralGravitySolver.__proto__ || (0, _getPrototypeOf2["default"])(ForceAtlas2BasedCentralGravitySolver)).call(this, body, physicsBody, options)); - } /** - * Calculate the forces based on the distance. + * Debug function that display arrows for the forces currently active in the network. + * + * Use this when debugging only. + * + * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: '_drawForces', + value: function _drawForces(ctx) { + for (var i = 0; i < this.physicsBody.physicsNodeIndices.length; i++) { + var index = this.physicsBody.physicsNodeIndices[i]; + var node = this.body.nodes[index]; + var force = this.physicsBody.forces[index]; + var factor = 20; + var colorFactor = 0.03; + var forceSize = Math.sqrt(Math.pow(force.x, 2) + Math.pow(force.x, 2)); + + var size = Math.min(Math.max(5, forceSize), 15); + var arrowSize = 3 * size; + + var color = util.HSVToHex((180 - Math.min(1, Math.max(0, colorFactor * forceSize)) * 180) / 360, 1, 1); + + var point = { + x: node.x + factor * force.x, + y: node.y + factor * force.y + }; - (0, _createClass3["default"])(ForceAtlas2BasedCentralGravitySolver, [{ - key: "_calculateForces", - value: function _calculateForces(distance, dx, dy, forces, node) { - if (distance > 0) { - var degree = node.edges.length + 1; - var gravityForce = this.options.centralGravity * degree * node.options.mass; - forces[node.id].x = dx * gravityForce; - forces[node.id].y = dy * gravityForce; - } + ctx.lineWidth = size; + ctx.strokeStyle = color; + ctx.beginPath(); + ctx.moveTo(node.x, node.y); + ctx.lineTo(point.x, point.y); + ctx.stroke(); + + var angle = Math.atan2(force.y, force.x); + ctx.fillStyle = color; + EndPoints.draw(ctx, { type: 'arrow', point: point, angle: angle, length: arrowSize }); + ctx.fill(); } - }]); - return ForceAtlas2BasedCentralGravitySolver; - }(_CentralGravitySolver3["default"]); + } + }]); + return PhysicsEngine; +}(); - exports["default"] = ForceAtlas2BasedCentralGravitySolver; +exports['default'] = PhysicsEngine; /***/ }), /* 221 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _keys = __webpack_require__(58); +"use strict"; - var _keys2 = _interopRequireDefault(_keys); - var _typeof2 = __webpack_require__(62); - - var _typeof3 = _interopRequireDefault(_typeof2); - - var _classCallCheck2 = __webpack_require__(135); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _classCallCheck2 = __webpack_require__(0); - var _createClass2 = __webpack_require__(136); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _createClass3 = _interopRequireDefault(_createClass2); +var _createClass2 = __webpack_require__(1); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _createClass3 = _interopRequireDefault(_createClass2); - var util = __webpack_require__(1); - var NetworkUtil = __webpack_require__(211)['default']; - var Cluster = __webpack_require__(222)['default']; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var ClusterEngine = function () { - function ClusterEngine(body) { - var _this = this; +/** + * Repulsion Solver + */ +var RepulsionSolver = function () { + /** + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options + */ + function RepulsionSolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, RepulsionSolver); - (0, _classCallCheck3['default'])(this, ClusterEngine); + this.body = body; + this.physicsBody = physicsBody; + this.setOptions(options); + } - this.body = body; - this.clusteredNodes = {}; - this.clusteredEdges = {}; + /** + * + * @param {Object} options + */ - this.options = {}; - this.defaultOptions = {}; - util.extend(this.options, this.defaultOptions); - this.body.emitter.on('_resetData', function () { - _this.clusteredNodes = {};_this.clusteredEdges = {}; - }); + (0, _createClass3["default"])(RepulsionSolver, [{ + key: "setOptions", + value: function setOptions(options) { + this.options = options; } /** - * - * @param hubsize - * @param options - */ - + * Calculate the forces the nodes apply on each other based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ - (0, _createClass3['default'])(ClusterEngine, [{ - key: 'clusterByHubsize', - value: function clusterByHubsize(hubsize, options) { - if (hubsize === undefined) { - hubsize = this._getHubSize(); - } else if ((typeof hubsize === 'undefined' ? 'undefined' : (0, _typeof3['default'])(hubsize)) === "object") { - options = this._checkOptions(hubsize); - hubsize = this._getHubSize(); - } + }, { + key: "solve", + value: function solve() { + var dx, dy, distance, fx, fy, repulsingForce, node1, node2; - var nodesToCluster = []; - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var node = this.body.nodes[this.body.nodeIndices[i]]; - if (node.edges.length >= hubsize) { - nodesToCluster.push(node.id); - } - } + var nodes = this.body.nodes; + var nodeIndices = this.physicsBody.physicsNodeIndices; + var forces = this.physicsBody.forces; - for (var _i = 0; _i < nodesToCluster.length; _i++) { - this.clusterByConnection(nodesToCluster[_i], options, true); - } + // repulsing forces between nodes + var nodeDistance = this.options.nodeDistance; - this.body.emitter.emit('_dataChanged'); - } + // approximation constants + var a = -2 / 3 / nodeDistance; + var b = 4 / 3; - /** - * loop over all nodes, check if they adhere to the condition and cluster if needed. - * @param options - * @param refreshData - */ + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j + for (var i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (var j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; - }, { - key: 'cluster', - value: function cluster() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); - if (options.joinCondition === undefined) { - throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options."); - } + // same condition as BarnesHutSolver, making sure nodes are never 100% overlapping. + if (distance === 0) { + distance = 0.1 * Math.random(); + dx = distance; + } - // check if the options object is fine, append if needed - options = this._checkOptions(options); + if (distance < 2 * nodeDistance) { + if (distance < 0.5 * nodeDistance) { + repulsingForce = 1.0; + } else { + repulsingForce = a * distance + b; // linear approx of 1 / (1 + Math.exp((distance / nodeDistance - 1) * steepness)) + } + repulsingForce = repulsingForce / distance; - var childNodesObj = {}; - var childEdgesObj = {}; + fx = dx * repulsingForce; + fy = dy * repulsingForce; - // collect the nodes that will be in the cluster - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var nodeId = this.body.nodeIndices[i]; - var node = this.body.nodes[nodeId]; - var clonedOptions = NetworkUtil.cloneOptions(node); - if (options.joinCondition(clonedOptions) === true) { - childNodesObj[nodeId] = this.body.nodes[nodeId]; - - // collect the nodes that will be in the cluster - for (var _i2 = 0; _i2 < node.edges.length; _i2++) { - var edge = node.edges[_i2]; - if (this.clusteredEdges[edge.id] === undefined) { - childEdgesObj[edge.id] = edge; - } - } + forces[node1.id].x -= fx; + forces[node1.id].y -= fy; + forces[node2.id].x += fx; + forces[node2.id].y += fy; } } - - this._cluster(childNodesObj, childEdgesObj, options, refreshData); } + } + }]); + return RepulsionSolver; +}(); - /** - * Cluster all nodes in the network that have only X edges - * @param edgeCount - * @param options - * @param refreshData - */ +exports["default"] = RepulsionSolver; - }, { - key: 'clusterByEdgeCount', - value: function clusterByEdgeCount(edgeCount, options) { - var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - - options = this._checkOptions(options); - var clusters = []; - var usedNodes = {}; - var edge = void 0, - edges = void 0, - node = void 0, - nodeId = void 0, - relevantEdgeCount = void 0; - // collect the nodes that will be in the cluster - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var childNodesObj = {}; - var childEdgesObj = {}; - nodeId = this.body.nodeIndices[i]; +/***/ }), +/* 222 */ +/***/ (function(module, exports, __webpack_require__) { - // if this node is already used in another cluster this session, we do not have to re-evaluate it. - if (usedNodes[nodeId] === undefined) { - relevantEdgeCount = 0; - node = this.body.nodes[nodeId]; - edges = []; - for (var j = 0; j < node.edges.length; j++) { - edge = node.edges[j]; - if (this.clusteredEdges[edge.id] === undefined) { - if (edge.toId !== edge.fromId) { - relevantEdgeCount++; - } - edges.push(edge); - } - } +"use strict"; - // this node qualifies, we collect its neighbours to start the clustering process. - if (relevantEdgeCount === edgeCount) { - var gatheringSuccessful = true; - for (var _j = 0; _j < edges.length; _j++) { - edge = edges[_j]; - var childNodeId = this._getConnectedId(edge, nodeId); - // add the nodes to the list by the join condition. - if (options.joinCondition === undefined) { - childEdgesObj[edge.id] = edge; - childNodesObj[nodeId] = this.body.nodes[nodeId]; - childNodesObj[childNodeId] = this.body.nodes[childNodeId]; - usedNodes[nodeId] = true; - } else { - var clonedOptions = NetworkUtil.cloneOptions(this.body.nodes[nodeId]); - if (options.joinCondition(clonedOptions) === true) { - childEdgesObj[edge.id] = edge; - childNodesObj[nodeId] = this.body.nodes[nodeId]; - usedNodes[nodeId] = true; - } else { - // this node does not qualify after all. - gatheringSuccessful = false; - break; - } - } - } - // add to the cluster queue - if ((0, _keys2['default'])(childNodesObj).length > 0 && (0, _keys2['default'])(childEdgesObj).length > 0 && gatheringSuccessful === true) { - clusters.push({ nodes: childNodesObj, edges: childEdgesObj }); - } - } - } - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - for (var _i3 = 0; _i3 < clusters.length; _i3++) { - this._cluster(clusters[_i3].nodes, clusters[_i3].edges, options, false); - } +var _classCallCheck2 = __webpack_require__(0); - if (refreshData === true) { - this.body.emitter.emit('_dataChanged'); - } - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * Cluster all nodes in the network that have only 1 edge - * @param options - * @param refreshData - */ +var _createClass2 = __webpack_require__(1); - }, { - key: 'clusterOutliers', - value: function clusterOutliers(options) { - var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; +var _createClass3 = _interopRequireDefault(_createClass2); - this.clusterByEdgeCount(1, options, refreshData); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /** - * Cluster all nodes in the network that have only 2 edge - * @param options - * @param refreshData - */ +/** + * Hierarchical Repulsion Solver + */ +var HierarchicalRepulsionSolver = function () { + /** + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options + */ + function HierarchicalRepulsionSolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, HierarchicalRepulsionSolver); - }, { - key: 'clusterBridges', - value: function clusterBridges(options) { - var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + this.body = body; + this.physicsBody = physicsBody; + this.setOptions(options); + } - this.clusterByEdgeCount(2, options, refreshData); - } + /** + * + * @param {Object} options + */ - /** - * suck all connected nodes of a node into the node. - * @param nodeId - * @param options - * @param refreshData - */ - }, { - key: 'clusterByConnection', - value: function clusterByConnection(nodeId, options) { - var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + (0, _createClass3["default"])(HierarchicalRepulsionSolver, [{ + key: "setOptions", + value: function setOptions(options) { + this.options = options; + } - // kill conditions - if (nodeId === undefined) { - throw new Error("No nodeId supplied to clusterByConnection!"); - } - if (this.body.nodes[nodeId] === undefined) { - throw new Error("The nodeId given to clusterByConnection does not exist!"); - } + /** + * Calculate the forces the nodes apply on each other based on a repulsion field. + * This field is linearly approximated. + * + * @private + */ - var node = this.body.nodes[nodeId]; - options = this._checkOptions(options, node); - if (options.clusterNodeProperties.x === undefined) { - options.clusterNodeProperties.x = node.x; - } - if (options.clusterNodeProperties.y === undefined) { - options.clusterNodeProperties.y = node.y; - } - if (options.clusterNodeProperties.fixed === undefined) { - options.clusterNodeProperties.fixed = {}; - options.clusterNodeProperties.fixed.x = node.options.fixed.x; - options.clusterNodeProperties.fixed.y = node.options.fixed.y; - } + }, { + key: "solve", + value: function solve() { + var dx, dy, distance, fx, fy, repulsingForce, node1, node2, i, j; - var childNodesObj = {}; - var childEdgesObj = {}; - var parentNodeId = node.id; - var parentClonedOptions = NetworkUtil.cloneOptions(node); - childNodesObj[parentNodeId] = node; + var nodes = this.body.nodes; + var nodeIndices = this.physicsBody.physicsNodeIndices; + var forces = this.physicsBody.forces; - // collect the nodes that will be in the cluster - for (var i = 0; i < node.edges.length; i++) { - var edge = node.edges[i]; - if (this.clusteredEdges[edge.id] === undefined) { - var childNodeId = this._getConnectedId(edge, parentNodeId); + // repulsing forces between nodes + var nodeDistance = this.options.nodeDistance; - // if the child node is not in a cluster - if (this.clusteredNodes[childNodeId] === undefined) { - if (childNodeId !== parentNodeId) { - if (options.joinCondition === undefined) { - childEdgesObj[edge.id] = edge; - childNodesObj[childNodeId] = this.body.nodes[childNodeId]; - } else { - // clone the options and insert some additional parameters that could be interesting. - var childClonedOptions = NetworkUtil.cloneOptions(this.body.nodes[childNodeId]); - if (options.joinCondition(parentClonedOptions, childClonedOptions) === true) { - childEdgesObj[edge.id] = edge; - childNodesObj[childNodeId] = this.body.nodes[childNodeId]; - } - } - } else { - // swallow the edge if it is self-referencing. - childEdgesObj[edge.id] = edge; - } - } - } - } - var childNodeIDs = (0, _keys2['default'])(childNodesObj).map(function (childNode) { - return childNodesObj[childNode].id; - }); + // we loop from i over all but the last entree in the array + // j loops from i+1 to the last. This way we do not double count any of the indices, nor i === j + for (i = 0; i < nodeIndices.length - 1; i++) { + node1 = nodes[nodeIndices[i]]; + for (j = i + 1; j < nodeIndices.length; j++) { + node2 = nodes[nodeIndices[j]]; + + // nodes only affect nodes on their level + if (node1.level === node2.level) { + dx = node2.x - node1.x; + dy = node2.y - node1.y; + distance = Math.sqrt(dx * dx + dy * dy); - for (childNode in childNodesObj) { - var childNode = childNodesObj[childNode]; - for (var y = 0; y < childNode.edges.length; y++) { - var childEdge = childNode.edges[y]; - if (childNodeIDs.indexOf(this._getConnectedId(childEdge, childNode.id)) > -1) { - childEdgesObj[childEdge.id] = childEdge; + var steepness = 0.05; + if (distance < nodeDistance) { + repulsingForce = -Math.pow(steepness * distance, 2) + Math.pow(steepness * nodeDistance, 2); + } else { + repulsingForce = 0; + } + // normalize force with + if (distance === 0) { + distance = 0.01; + } else { + repulsingForce = repulsingForce / distance; } + fx = dx * repulsingForce; + fy = dy * repulsingForce; + + forces[node1.id].x -= fx; + forces[node1.id].y -= fy; + forces[node2.id].x += fx; + forces[node2.id].y += fy; } } - this._cluster(childNodesObj, childEdgesObj, options, refreshData); } + } + }]); + return HierarchicalRepulsionSolver; +}(); - /** - * This function creates the edges that will be attached to the cluster - * It looks for edges that are connected to the nodes from the "outside' of the cluster. - * - * @param childNodesObj - * @param childEdgesObj - * @param clusterNodeProperties - * @param clusterEdgeProperties - * @private - */ - - }, { - key: '_createClusterEdges', - value: function _createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) { - var edge = void 0, - childNodeId = void 0, - childNode = void 0, - toId = void 0, - fromId = void 0, - otherNodeId = void 0; - - // loop over all child nodes and their edges to find edges going out of the cluster - // these edges will be replaced by clusterEdges. - var childKeys = (0, _keys2['default'])(childNodesObj); - var createEdges = []; - for (var i = 0; i < childKeys.length; i++) { - childNodeId = childKeys[i]; - childNode = childNodesObj[childNodeId]; - - // construct new edges from the cluster to others - for (var j = 0; j < childNode.edges.length; j++) { - edge = childNode.edges[j]; - // we only handle edges that are visible to the system, not the disabled ones from the clustering process. - if (this.clusteredEdges[edge.id] === undefined) { - // self-referencing edges will be added to the "hidden" list - if (edge.toId == edge.fromId) { - childEdgesObj[edge.id] = edge; - } else { - // set up the from and to. - if (edge.toId == childNodeId) { - // this is a double equals because ints and strings can be interchanged here. - toId = clusterNodeProperties.id; - fromId = edge.fromId; - otherNodeId = fromId; - } else { - toId = edge.toId; - fromId = clusterNodeProperties.id; - otherNodeId = toId; - } - } +exports["default"] = HierarchicalRepulsionSolver; - // Only edges from the cluster outwards are being replaced. - if (childNodesObj[otherNodeId] === undefined) { - createEdges.push({ edge: edge, fromId: fromId, toId: toId }); - } - } - } - } +/***/ }), +/* 223 */ +/***/ (function(module, exports, __webpack_require__) { - // here we actually create the replacement edges. We could not do this in the loop above as the creation process - // would add an edge to the edges array we are iterating over. - for (var _j2 = 0; _j2 < createEdges.length; _j2++) { - var _edge = createEdges[_j2].edge; - // copy the options of the edge we will replace - var clonedOptions = NetworkUtil.cloneOptions(_edge, 'edge'); - // make sure the properties of clusterEdges are superimposed on it - util.deepExtend(clonedOptions, clusterEdgeProperties); +"use strict"; - // set up the edge - clonedOptions.from = createEdges[_j2].fromId; - clonedOptions.to = createEdges[_j2].toId; - clonedOptions.id = 'clusterEdge:' + util.randomUUID(); - //clonedOptions.id = '(cf: ' + createEdges[j].fromId + " to: " + createEdges[j].toId + ")" + Math.random(); - // create the edge and give a reference to the one it replaced. - var newEdge = this.body.functions.createEdge(clonedOptions); - newEdge.clusteringEdgeReplacingId = _edge.id; +Object.defineProperty(exports, "__esModule", { + value: true +}); - // also reference the new edge in the old edge - this.body.edges[_edge.id].edgeReplacedById = newEdge.id; +var _classCallCheck2 = __webpack_require__(0); - // connect the edge. - this.body.edges[newEdge.id] = newEdge; - newEdge.connect(); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // hide the replaced edge - this._backupEdgeOptions(_edge); - _edge.setOptions({ physics: false, hidden: true }); - } - } +var _createClass2 = __webpack_require__(1); - /** - * This function checks the options that can be supplied to the different cluster functions - * for certain fields and inserts defaults if needed - * @param options - * @returns {*} - * @private - */ +var _createClass3 = _interopRequireDefault(_createClass2); - }, { - key: '_checkOptions', - value: function _checkOptions() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - if (options.clusterEdgeProperties === undefined) { - options.clusterEdgeProperties = {}; - } - if (options.clusterNodeProperties === undefined) { - options.clusterNodeProperties = {}; - } +/** + * Spring Solver + */ +var SpringSolver = function () { + /** + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options + */ + function SpringSolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, SpringSolver); - return options; - } + this.body = body; + this.physicsBody = physicsBody; + this.setOptions(options); + } - /** - * - * @param {Object} childNodesObj | object with node objects, id as keys, same as childNodes except it also contains a source node - * @param {Object} childEdgesObj | object with edge objects, id as keys - * @param {Array} options | object with {clusterNodeProperties, clusterEdgeProperties, processProperties} - * @param {Boolean} refreshData | when true, do not wrap up - * @private - */ + /** + * + * @param {Object} options + */ - }, { - key: '_cluster', - value: function _cluster(childNodesObj, childEdgesObj, options) { - var refreshData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - // kill condition: no nodes don't bother - if ((0, _keys2['default'])(childNodesObj).length == 0) { - return; - } + (0, _createClass3["default"])(SpringSolver, [{ + key: "setOptions", + value: function setOptions(options) { + this.options = options; + } - // allow clusters of 1 if options allow - if ((0, _keys2['default'])(childNodesObj).length == 1 && options.clusterNodeProperties.allowSingleNodeCluster != true) { - return; - } + /** + * This function calculates the springforces on the nodes, accounting for the support nodes. + * + * @private + */ - // check if this cluster call is not trying to cluster anything that is in another cluster. - for (var nodeId in childNodesObj) { - if (childNodesObj.hasOwnProperty(nodeId)) { - if (this.clusteredNodes[nodeId] !== undefined) { - return; + }, { + key: "solve", + value: function solve() { + var edgeLength = void 0, + edge = void 0; + var edgeIndices = this.physicsBody.physicsEdgeIndices; + var edges = this.body.edges; + var node1 = void 0, + node2 = void 0, + node3 = void 0; + + // forces caused by the edges, modelled as springs + for (var i = 0; i < edgeIndices.length; i++) { + edge = edges[edgeIndices[i]]; + if (edge.connected === true && edge.toId !== edge.fromId) { + // only calculate forces if nodes are in the same sector + if (this.body.nodes[edge.toId] !== undefined && this.body.nodes[edge.fromId] !== undefined) { + if (edge.edgeType.via !== undefined) { + edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length; + node1 = edge.to; + node2 = edge.edgeType.via; + node3 = edge.from; + + this._calculateSpringForce(node1, node2, 0.5 * edgeLength); + this._calculateSpringForce(node2, node3, 0.5 * edgeLength); + } else { + // the * 1.5 is here so the edge looks as large as a smooth edge. It does not initially because the smooth edges use + // the support nodes which exert a repulsive force on the to and from nodes, making the edge appear larger. + edgeLength = edge.options.length === undefined ? this.options.springLength * 1.5 : edge.options.length; + this._calculateSpringForce(edge.from, edge.to, edgeLength); } } } + } + } - var clusterNodeProperties = util.deepExtend({}, options.clusterNodeProperties); + /** + * This is the code actually performing the calculation for the function above. + * + * @param {Node} node1 + * @param {Node} node2 + * @param {number} edgeLength + * @private + */ - // construct the clusterNodeProperties - if (options.processProperties !== undefined) { - // get the childNode options - var childNodesOptions = []; - for (var _nodeId in childNodesObj) { - if (childNodesObj.hasOwnProperty(_nodeId)) { - var clonedOptions = NetworkUtil.cloneOptions(childNodesObj[_nodeId]); - childNodesOptions.push(clonedOptions); - } - } + }, { + key: "_calculateSpringForce", + value: function _calculateSpringForce(node1, node2, edgeLength) { + var dx = node1.x - node2.x; + var dy = node1.y - node2.y; + var distance = Math.max(Math.sqrt(dx * dx + dy * dy), 0.01); - // get cluster properties based on childNodes - var childEdgesOptions = []; - for (var edgeId in childEdgesObj) { - if (childEdgesObj.hasOwnProperty(edgeId)) { - // these cluster edges will be removed on creation of the cluster. - if (edgeId.substr(0, 12) !== "clusterEdge:") { - var _clonedOptions = NetworkUtil.cloneOptions(childEdgesObj[edgeId], 'edge'); - childEdgesOptions.push(_clonedOptions); - } - } - } + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + var springForce = this.options.springConstant * (edgeLength - distance) / distance; - clusterNodeProperties = options.processProperties(clusterNodeProperties, childNodesOptions, childEdgesOptions); - if (!clusterNodeProperties) { - throw new Error("The processProperties function does not return properties!"); - } - } + var fx = dx * springForce; + var fy = dy * springForce; - // check if we have an unique id; - if (clusterNodeProperties.id === undefined) { - clusterNodeProperties.id = 'cluster:' + util.randomUUID(); - } - var clusterId = clusterNodeProperties.id; + // handle the case where one node is not part of the physcis + if (this.physicsBody.forces[node1.id] !== undefined) { + this.physicsBody.forces[node1.id].x += fx; + this.physicsBody.forces[node1.id].y += fy; + } - if (clusterNodeProperties.label === undefined) { - clusterNodeProperties.label = 'cluster'; - } + if (this.physicsBody.forces[node2.id] !== undefined) { + this.physicsBody.forces[node2.id].x -= fx; + this.physicsBody.forces[node2.id].y -= fy; + } + } + }]); + return SpringSolver; +}(); - // give the clusterNode a position if it does not have one. - var pos = undefined; - if (clusterNodeProperties.x === undefined) { - pos = this._getClusterPosition(childNodesObj); - clusterNodeProperties.x = pos.x; - } - if (clusterNodeProperties.y === undefined) { - if (pos === undefined) { - pos = this._getClusterPosition(childNodesObj); - } - clusterNodeProperties.y = pos.y; - } +exports["default"] = SpringSolver; - // force the ID to remain the same - clusterNodeProperties.id = clusterId; +/***/ }), +/* 224 */ +/***/ (function(module, exports, __webpack_require__) { - // create the clusterNode - var clusterNode = this.body.functions.createNode(clusterNodeProperties, Cluster); - clusterNode.isCluster = true; - clusterNode.containedNodes = childNodesObj; - clusterNode.containedEdges = childEdgesObj; - // cache a copy from the cluster edge properties if we have to reconnect others later on - clusterNode.clusterEdgeProperties = options.clusterEdgeProperties; +"use strict"; - // finally put the cluster node into global - this.body.nodes[clusterNodeProperties.id] = clusterNode; - // create the new edges that will connect to the cluster, all self-referencing edges will be added to childEdgesObject here. - this._createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, options.clusterEdgeProperties); +Object.defineProperty(exports, "__esModule", { + value: true +}); - // disable the childEdges - for (var _edgeId in childEdgesObj) { - if (childEdgesObj.hasOwnProperty(_edgeId)) { - if (this.body.edges[_edgeId] !== undefined) { - var edge = this.body.edges[_edgeId]; - // cache the options before changing - this._backupEdgeOptions(edge); - // disable physics and hide the edge - edge.setOptions({ physics: false, hidden: true }); - } - } - } +var _classCallCheck2 = __webpack_require__(0); - // disable the childNodes - for (var _nodeId2 in childNodesObj) { - if (childNodesObj.hasOwnProperty(_nodeId2)) { - this.clusteredNodes[_nodeId2] = { clusterId: clusterNodeProperties.id, node: this.body.nodes[_nodeId2] }; - this.body.nodes[_nodeId2].setOptions({ hidden: true, physics: false }); - } - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // set ID to undefined so no duplicates arise - clusterNodeProperties.id = undefined; +var _createClass2 = __webpack_require__(1); - // wrap up - if (refreshData === true) { - this.body.emitter.emit('_dataChanged'); - } - } - }, { - key: '_backupEdgeOptions', - value: function _backupEdgeOptions(edge) { - if (this.clusteredEdges[edge.id] === undefined) { - this.clusteredEdges[edge.id] = { physics: edge.options.physics, hidden: edge.options.hidden }; - } - } - }, { - key: '_restoreEdge', - value: function _restoreEdge(edge) { - var originalOptions = this.clusteredEdges[edge.id]; - if (originalOptions !== undefined) { - edge.setOptions({ physics: originalOptions.physics, hidden: originalOptions.hidden }); - delete this.clusteredEdges[edge.id]; - } - } +var _createClass3 = _interopRequireDefault(_createClass2); - /** - * Check if a node is a cluster. - * @param nodeId - * @returns {*} - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - }, { - key: 'isCluster', - value: function isCluster(nodeId) { - if (this.body.nodes[nodeId] !== undefined) { - return this.body.nodes[nodeId].isCluster === true; - } else { - console.log("Node does not exist."); - return false; - } - } +/** + * Hierarchical Spring Solver + */ +var HierarchicalSpringSolver = function () { + /** + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options + */ + function HierarchicalSpringSolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, HierarchicalSpringSolver); - /** - * get the position of the cluster node based on what's inside - * @param {object} childNodesObj | object with node objects, id as keys - * @returns {{x: number, y: number}} - * @private - */ + this.body = body; + this.physicsBody = physicsBody; + this.setOptions(options); + } - }, { - key: '_getClusterPosition', - value: function _getClusterPosition(childNodesObj) { - var childKeys = (0, _keys2['default'])(childNodesObj); - var minX = childNodesObj[childKeys[0]].x; - var maxX = childNodesObj[childKeys[0]].x; - var minY = childNodesObj[childKeys[0]].y; - var maxY = childNodesObj[childKeys[0]].y; - var node = void 0; - for (var i = 1; i < childKeys.length; i++) { - node = childNodesObj[childKeys[i]]; - minX = node.x < minX ? node.x : minX; - maxX = node.x > maxX ? node.x : maxX; - minY = node.y < minY ? node.y : minY; - maxY = node.y > maxY ? node.y : maxY; - } + /** + * + * @param {Object} options + */ - return { x: 0.5 * (minX + maxX), y: 0.5 * (minY + maxY) }; - } - /** - * Open a cluster by calling this function. - * @param {String} clusterNodeId | the ID of the cluster node - * @param {Boolean} refreshData | wrap up afterwards if not true - */ + (0, _createClass3["default"])(HierarchicalSpringSolver, [{ + key: "setOptions", + value: function setOptions(options) { + this.options = options; + } - }, { - key: 'openCluster', - value: function openCluster(clusterNodeId, options) { - var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + /** + * This function calculates the springforces on the nodes, accounting for the support nodes. + * + * @private + */ - // kill conditions - if (clusterNodeId === undefined) { - throw new Error("No clusterNodeId supplied to openCluster."); - } - if (this.body.nodes[clusterNodeId] === undefined) { - throw new Error("The clusterNodeId supplied to openCluster does not exist."); - } - if (this.body.nodes[clusterNodeId].containedNodes === undefined) { - console.log("The node:" + clusterNodeId + " is not a cluster."); - return; - } - var clusterNode = this.body.nodes[clusterNodeId]; - var containedNodes = clusterNode.containedNodes; - var containedEdges = clusterNode.containedEdges; - - // allow the user to position the nodes after release. - if (options !== undefined && options.releaseFunction !== undefined && typeof options.releaseFunction === 'function') { - var positions = {}; - var clusterPosition = { x: clusterNode.x, y: clusterNode.y }; - for (var nodeId in containedNodes) { - if (containedNodes.hasOwnProperty(nodeId)) { - var containedNode = this.body.nodes[nodeId]; - positions[nodeId] = { x: containedNode.x, y: containedNode.y }; - } - } - var newPositions = options.releaseFunction(clusterPosition, positions); + }, { + key: "solve", + value: function solve() { + var edgeLength, edge; + var dx, dy, fx, fy, springForce, distance; + var edges = this.body.edges; + var factor = 0.5; + + var edgeIndices = this.physicsBody.physicsEdgeIndices; + var nodeIndices = this.physicsBody.physicsNodeIndices; + var forces = this.physicsBody.forces; + + // initialize the spring force counters + for (var i = 0; i < nodeIndices.length; i++) { + var nodeId = nodeIndices[i]; + forces[nodeId].springFx = 0; + forces[nodeId].springFy = 0; + } + + // forces caused by the edges, modelled as springs + for (var _i = 0; _i < edgeIndices.length; _i++) { + edge = edges[edgeIndices[_i]]; + if (edge.connected === true) { + edgeLength = edge.options.length === undefined ? this.options.springLength : edge.options.length; + + dx = edge.from.x - edge.to.x; + dy = edge.from.y - edge.to.y; + distance = Math.sqrt(dx * dx + dy * dy); + distance = distance === 0 ? 0.01 : distance; - for (var _nodeId3 in containedNodes) { - if (containedNodes.hasOwnProperty(_nodeId3)) { - var _containedNode = this.body.nodes[_nodeId3]; - if (newPositions[_nodeId3] !== undefined) { - _containedNode.x = newPositions[_nodeId3].x === undefined ? clusterNode.x : newPositions[_nodeId3].x; - _containedNode.y = newPositions[_nodeId3].y === undefined ? clusterNode.y : newPositions[_nodeId3].y; - } + // the 1/distance is so the fx and fy can be calculated without sine or cosine. + springForce = this.options.springConstant * (edgeLength - distance) / distance; + + fx = dx * springForce; + fy = dy * springForce; + + if (edge.to.level != edge.from.level) { + if (forces[edge.toId] !== undefined) { + forces[edge.toId].springFx -= fx; + forces[edge.toId].springFy -= fy; } - } - } else { - // copy the position from the cluster - for (var _nodeId4 in containedNodes) { - if (containedNodes.hasOwnProperty(_nodeId4)) { - var _containedNode2 = this.body.nodes[_nodeId4]; - _containedNode2 = containedNodes[_nodeId4]; - // inherit position - if (_containedNode2.options.fixed.x === false) { - _containedNode2.x = clusterNode.x; - } - if (_containedNode2.options.fixed.y === false) { - _containedNode2.y = clusterNode.y; - } + if (forces[edge.fromId] !== undefined) { + forces[edge.fromId].springFx += fx; + forces[edge.fromId].springFy += fy; + } + } else { + if (forces[edge.toId] !== undefined) { + forces[edge.toId].x -= factor * fx; + forces[edge.toId].y -= factor * fy; + } + if (forces[edge.fromId] !== undefined) { + forces[edge.fromId].x += factor * fx; + forces[edge.fromId].y += factor * fy; } } } + } - // release nodes - for (var _nodeId5 in containedNodes) { - if (containedNodes.hasOwnProperty(_nodeId5)) { - var _containedNode3 = this.body.nodes[_nodeId5]; - - // inherit speed - _containedNode3.vx = clusterNode.vx; - _containedNode3.vy = clusterNode.vy; - - // we use these methods to avoid re-instantiating the shape, which happens with setOptions. - _containedNode3.setOptions({ hidden: false, physics: true }); - - delete this.clusteredNodes[_nodeId5]; - } - } + // normalize spring forces + springForce = 1; + var springFx, springFy; + for (var _i2 = 0; _i2 < nodeIndices.length; _i2++) { + var _nodeId = nodeIndices[_i2]; + springFx = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFx)); + springFy = Math.min(springForce, Math.max(-springForce, forces[_nodeId].springFy)); - // copy the clusterNode edges because we cannot iterate over an object that we add or remove from. - var edgesToBeDeleted = []; - for (var i = 0; i < clusterNode.edges.length; i++) { - edgesToBeDeleted.push(clusterNode.edges[i]); - } + forces[_nodeId].x += springFx; + forces[_nodeId].y += springFy; + } - // actually handling the deleting. - for (var _i4 = 0; _i4 < edgesToBeDeleted.length; _i4++) { - var edge = edgesToBeDeleted[_i4]; + // retain energy balance + var totalFx = 0; + var totalFy = 0; + for (var _i3 = 0; _i3 < nodeIndices.length; _i3++) { + var _nodeId2 = nodeIndices[_i3]; + totalFx += forces[_nodeId2].x; + totalFy += forces[_nodeId2].y; + } + var correctionFx = totalFx / nodeIndices.length; + var correctionFy = totalFy / nodeIndices.length; - var otherNodeId = this._getConnectedId(edge, clusterNodeId); - // if the other node is in another cluster, we transfer ownership of this edge to the other cluster - if (this.clusteredNodes[otherNodeId] !== undefined) { - // transfer ownership: - var otherCluster = this.body.nodes[this.clusteredNodes[otherNodeId].clusterId]; - var transferEdge = this.body.edges[edge.clusteringEdgeReplacingId]; - if (transferEdge !== undefined) { - otherCluster.containedEdges[transferEdge.id] = transferEdge; - - // delete local reference - delete containedEdges[transferEdge.id]; - - // create new cluster edge from the otherCluster: - // get to and from - var fromId = transferEdge.fromId; - var toId = transferEdge.toId; - if (transferEdge.toId == otherNodeId) { - toId = this.clusteredNodes[otherNodeId].clusterId; - } else { - fromId = this.clusteredNodes[otherNodeId].clusterId; - } + for (var _i4 = 0; _i4 < nodeIndices.length; _i4++) { + var _nodeId3 = nodeIndices[_i4]; + forces[_nodeId3].x -= correctionFx; + forces[_nodeId3].y -= correctionFy; + } + } + }]); + return HierarchicalSpringSolver; +}(); - // clone the options and apply the cluster options to them - var clonedOptions = NetworkUtil.cloneOptions(transferEdge, 'edge'); - util.deepExtend(clonedOptions, otherCluster.clusterEdgeProperties); +exports["default"] = HierarchicalSpringSolver; - // apply the edge specific options to it. - var id = 'clusterEdge:' + util.randomUUID(); - util.deepExtend(clonedOptions, { from: fromId, to: toId, hidden: false, physics: true, id: id }); +/***/ }), +/* 225 */ +/***/ (function(module, exports, __webpack_require__) { - // create it - var newEdge = this.body.functions.createEdge(clonedOptions); - newEdge.clusteringEdgeReplacingId = transferEdge.id; - this.body.edges[id] = newEdge; - this.body.edges[id].connect(); - } - } else { - var replacedEdge = this.body.edges[edge.clusteringEdgeReplacingId]; - if (replacedEdge !== undefined) { - this._restoreEdge(replacedEdge); - } - } - edge.cleanup(); - // this removes the edge from node.edges, which is why edgeIds is formed - edge.disconnect(); - delete this.body.edges[edge.id]; - } +"use strict"; - // handle the releasing of the edges - for (var edgeId in containedEdges) { - if (containedEdges.hasOwnProperty(edgeId)) { - this._restoreEdge(containedEdges[edgeId]); - } - } - // remove clusterNode - delete this.body.nodes[clusterNodeId]; +Object.defineProperty(exports, "__esModule", { + value: true +}); - if (refreshData === true) { - this.body.emitter.emit('_dataChanged'); - } - } - }, { - key: 'getNodesInCluster', - value: function getNodesInCluster(clusterId) { - var nodesArray = []; - if (this.isCluster(clusterId) === true) { - var containedNodes = this.body.nodes[clusterId].containedNodes; - for (var nodeId in containedNodes) { - if (containedNodes.hasOwnProperty(nodeId)) { - nodesArray.push(this.body.nodes[nodeId].id); - } - } - } +var _getPrototypeOf = __webpack_require__(3); - return nodesArray; - } +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - /** - * Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node - * - * If a node can't be found in the chain, return an empty array. - * - * @param {string|number} nodeId - * @returns {Array} - */ +var _classCallCheck2 = __webpack_require__(0); - }, { - key: 'findNode', - value: function findNode(nodeId) { - var stack = []; - var max = 100; - var counter = 0; - var node = void 0; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - while (this.clusteredNodes[nodeId] !== undefined && counter < max) { - node = this.body.nodes[nodeId]; - if (node === undefined) return []; - stack.push(node.id); +var _createClass2 = __webpack_require__(1); - nodeId = this.clusteredNodes[nodeId].clusterId; - counter++; - } +var _createClass3 = _interopRequireDefault(_createClass2); - node = this.body.nodes[nodeId]; - if (node === undefined) return []; - stack.push(node.id); +var _possibleConstructorReturn2 = __webpack_require__(4); - stack.reverse(); - return stack; - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - /** - * Using a clustered nodeId, update with the new options - * @param clusteredNodeId - * @param {object} newOptions - */ +var _inherits2 = __webpack_require__(5); - }, { - key: 'updateClusteredNode', - value: function updateClusteredNode(clusteredNodeId, newOptions) { - if (clusteredNodeId === undefined) { - throw new Error("No clusteredNodeId supplied to updateClusteredNode."); - } - if (newOptions === undefined) { - throw new Error("No newOptions supplied to updateClusteredNode."); - } - if (this.body.nodes[clusteredNodeId] === undefined) { - throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist."); - } +var _inherits3 = _interopRequireDefault(_inherits2); - this.body.nodes[clusteredNodeId].setOptions(newOptions); - this.body.emitter.emit('_dataChanged'); - } +var _BarnesHutSolver2 = __webpack_require__(120); - /** - * Using a base edgeId, update all related clustered edges with the new options - * @param startEdgeId - * @param {object} newOptions - */ +var _BarnesHutSolver3 = _interopRequireDefault(_BarnesHutSolver2); - }, { - key: 'updateEdge', - value: function updateEdge(startEdgeId, newOptions) { - if (startEdgeId === undefined) { - throw new Error("No startEdgeId supplied to updateEdge."); - } - if (newOptions === undefined) { - throw new Error("No newOptions supplied to updateEdge."); - } - if (this.body.edges[startEdgeId] === undefined) { - throw new Error("The startEdgeId supplied to updateEdge does not exist."); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var allEdgeIds = this.getClusteredEdges(startEdgeId); - for (var i = 0; i < allEdgeIds.length; i++) { - var edge = this.body.edges[allEdgeIds[i]]; - edge.setOptions(newOptions); - } - this.body.emitter.emit('_dataChanged'); - } +/** + * @extends BarnesHutSolver + */ +var ForceAtlas2BasedRepulsionSolver = function (_BarnesHutSolver) { + (0, _inherits3["default"])(ForceAtlas2BasedRepulsionSolver, _BarnesHutSolver); - /** - * Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId) - * @param edgeId - * @returns {Array} - */ + /** + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options + */ + function ForceAtlas2BasedRepulsionSolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, ForceAtlas2BasedRepulsionSolver); + return (0, _possibleConstructorReturn3["default"])(this, (ForceAtlas2BasedRepulsionSolver.__proto__ || (0, _getPrototypeOf2["default"])(ForceAtlas2BasedRepulsionSolver)).call(this, body, physicsBody, options)); + } - }, { - key: 'getClusteredEdges', - value: function getClusteredEdges(edgeId) { - var stack = []; - var max = 100; - var counter = 0; - - while (edgeId !== undefined && this.body.edges[edgeId] !== undefined && counter < max) { - stack.push(this.body.edges[edgeId].id); - edgeId = this.body.edges[edgeId].edgeReplacedById; - counter++; - } - stack.reverse(); - return stack; - } + /** + * Calculate the forces based on the distance. + * + * @param {number} distance + * @param {number} dx + * @param {number} dy + * @param {Node} node + * @param {Object} parentBranch + * @private + */ - /** - * Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge - * @param clusteredEdgeId - * @returns baseEdgeId - */ - }, { - key: 'getBaseEdge', - value: function getBaseEdge(clusteredEdgeId) { - var baseEdgeId = clusteredEdgeId; - var max = 100; - var counter = 0; - - while (clusteredEdgeId !== undefined && this.body.edges[clusteredEdgeId] !== undefined && counter < max) { - clusteredEdgeId = this.body.edges[clusteredEdgeId].clusteringEdgeReplacingId; - counter++; - if (clusteredEdgeId !== undefined) { - baseEdgeId = clusteredEdgeId; - } - } - return baseEdgeId; + (0, _createClass3["default"])(ForceAtlas2BasedRepulsionSolver, [{ + key: "_calculateForces", + value: function _calculateForces(distance, dx, dy, node, parentBranch) { + if (distance === 0) { + distance = 0.1 * Math.random(); + dx = distance; } - /** - * Get the Id the node is connected to - * @param edge - * @param nodeId - * @returns {*} - * @private - */ - - }, { - key: '_getConnectedId', - value: function _getConnectedId(edge, nodeId) { - if (edge.toId != nodeId) { - return edge.toId; - } else if (edge.fromId != nodeId) { - return edge.fromId; - } else { - return edge.fromId; - } + if (this.overlapAvoidanceFactor < 1 && node.shape.radius) { + distance = Math.max(0.1 + this.overlapAvoidanceFactor * node.shape.radius, distance - node.shape.radius); } - /** - * We determine how many connections denote an important hub. - * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) - * - * @private - */ + var degree = node.edges.length + 1; + // the dividing by the distance cubed instead of squared allows us to get the fx and fy components without sines and cosines + // it is shorthand for gravityforce with distance squared and fx = dx/distance * gravityForce + var gravityForce = this.options.gravitationalConstant * parentBranch.mass * node.options.mass * degree / Math.pow(distance, 2); + var fx = dx * gravityForce; + var fy = dy * gravityForce; - }, { - key: '_getHubSize', - value: function _getHubSize() { - var average = 0; - var averageSquared = 0; - var hubCounter = 0; - var largestHub = 0; + this.physicsBody.forces[node.id].x += fx; + this.physicsBody.forces[node.id].y += fy; + } + }]); + return ForceAtlas2BasedRepulsionSolver; +}(_BarnesHutSolver3["default"]); - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var node = this.body.nodes[this.body.nodeIndices[i]]; - if (node.edges.length > largestHub) { - largestHub = node.edges.length; - } - average += node.edges.length; - averageSquared += Math.pow(node.edges.length, 2); - hubCounter += 1; - } - average = average / hubCounter; - averageSquared = averageSquared / hubCounter; +exports["default"] = ForceAtlas2BasedRepulsionSolver; - var variance = averageSquared - Math.pow(average, 2); - var standardDeviation = Math.sqrt(variance); +/***/ }), +/* 226 */ +/***/ (function(module, exports, __webpack_require__) { - var hubThreshold = Math.floor(average + 2 * standardDeviation); +"use strict"; - // always have at least one to cluster - if (hubThreshold > largestHub) { - hubThreshold = largestHub; - } - return hubThreshold; - } - }]); - return ClusterEngine; - }(); +Object.defineProperty(exports, "__esModule", { + value: true +}); - exports['default'] = ClusterEngine; +var _getPrototypeOf = __webpack_require__(3); -/***/ }), -/* 222 */ -/***/ (function(module, exports, __webpack_require__) { +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - 'use strict'; +var _classCallCheck2 = __webpack_require__(0); - Object.defineProperty(exports, "__esModule", { - value: true - }); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _getPrototypeOf = __webpack_require__(176); +var _createClass2 = __webpack_require__(1); - var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); +var _createClass3 = _interopRequireDefault(_createClass2); - var _classCallCheck2 = __webpack_require__(135); +var _possibleConstructorReturn2 = __webpack_require__(4); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var _possibleConstructorReturn2 = __webpack_require__(179); +var _inherits2 = __webpack_require__(5); - var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +var _inherits3 = _interopRequireDefault(_inherits2); - var _inherits2 = __webpack_require__(180); +var _CentralGravitySolver2 = __webpack_require__(121); - var _inherits3 = _interopRequireDefault(_inherits2); +var _CentralGravitySolver3 = _interopRequireDefault(_CentralGravitySolver2); - var _Node2 = __webpack_require__(169); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var _Node3 = _interopRequireDefault(_Node2); +/** + * @extends CentralGravitySolver + */ +var ForceAtlas2BasedCentralGravitySolver = function (_CentralGravitySolver) { + (0, _inherits3["default"])(ForceAtlas2BasedCentralGravitySolver, _CentralGravitySolver); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * @param {Object} body + * @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody + * @param {Object} options + */ + function ForceAtlas2BasedCentralGravitySolver(body, physicsBody, options) { + (0, _classCallCheck3["default"])(this, ForceAtlas2BasedCentralGravitySolver); + return (0, _possibleConstructorReturn3["default"])(this, (ForceAtlas2BasedCentralGravitySolver.__proto__ || (0, _getPrototypeOf2["default"])(ForceAtlas2BasedCentralGravitySolver)).call(this, body, physicsBody, options)); + } /** + * Calculate the forces based on the distance. * + * @param {number} distance + * @param {number} dx + * @param {number} dy + * @param {Object} forces + * @param {Node} node + * @private */ - var Cluster = function (_Node) { - (0, _inherits3['default'])(Cluster, _Node); - - function Cluster(options, body, imagelist, grouplist, globalOptions) { - (0, _classCallCheck3['default'])(this, Cluster); - var _this = (0, _possibleConstructorReturn3['default'])(this, (Cluster.__proto__ || (0, _getPrototypeOf2['default'])(Cluster)).call(this, options, body, imagelist, grouplist, globalOptions)); - _this.isCluster = true; - _this.containedNodes = {}; - _this.containedEdges = {}; - return _this; + (0, _createClass3["default"])(ForceAtlas2BasedCentralGravitySolver, [{ + key: "_calculateForces", + value: function _calculateForces(distance, dx, dy, forces, node) { + if (distance > 0) { + var degree = node.edges.length + 1; + var gravityForce = this.options.centralGravity * degree * node.options.mass; + forces[node.id].x = dx * gravityForce; + forces[node.id].y = dy * gravityForce; + } } + }]); + return ForceAtlas2BasedCentralGravitySolver; +}(_CentralGravitySolver3["default"]); - return Cluster; - }(_Node3['default']); - - exports['default'] = Cluster; +exports["default"] = ForceAtlas2BasedCentralGravitySolver; /***/ }), -/* 223 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _classCallCheck2 = __webpack_require__(135); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _keys = __webpack_require__(8); - var _createClass2 = __webpack_require__(136); +var _keys2 = _interopRequireDefault(_keys); - var _createClass3 = _interopRequireDefault(_createClass2); +var _typeof2 = __webpack_require__(6); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _typeof3 = _interopRequireDefault(_typeof2); - if (typeof window !== 'undefined') { - window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; - } +var _classCallCheck2 = __webpack_require__(0); - var util = __webpack_require__(1); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var CanvasRenderer = function () { - function CanvasRenderer(body, canvas) { - (0, _classCallCheck3['default'])(this, CanvasRenderer); +var _createClass2 = __webpack_require__(1); - this.body = body; - this.canvas = canvas; +var _createClass3 = _interopRequireDefault(_createClass2); - this.redrawRequested = false; - this.renderTimer = undefined; - this.requiresTimeout = true; - this.renderingActive = false; - this.renderRequests = 0; - this.allowRedraw = true; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - this.dragging = false; - this.options = {}; - this.defaultOptions = { - hideEdgesOnDrag: false, - hideNodesOnDrag: false - }; - util.extend(this.options, this.defaultOptions); +/* =========================================================================== + +# TODO + +- `edgeReplacedById` not cleaned up yet on cluster edge removal +- allowSingleNodeCluster could be a global option as well; currently needs to always + be passed to clustering methods + +---------------------------------------------- + +# State Model for Clustering + +The total state for clustering is non-trivial. It is useful to have a model +available as to how it works. The following documents the relevant state items. + + +## Network State + +The following `network`-members are relevant to clustering: + +- `body.nodes` - all nodes actively participating in the network +- `body.edges` - same for edges +- `body.nodeIndices` - id's of nodes that are visible at a given moment +- `body.edgeIndices` - same for edges + +This includes: + +- helper nodes for dragging in `manipulation` +- helper nodes for edge type `dynamic` +- cluster nodes and edges +- there may be more than this. + +A node/edge may be missing in the `Indices` member if: + +- it is a helper node +- the node or edge state has option `hidden` set +- It is not visible due to clustering + + +## Clustering State + +For the hashes, the id's of the nodes/edges are used as key. + +Member `network.clustering` contains the following items: + +- `clusteredNodes` - hash with values: { clusterId: , node: } +- `clusteredEdges` - hash with values: restore information for given edge + + +Due to nesting of clusters, these members can contain cluster nodes and edges as well. + +The important thing to note here, is that the clustered nodes and edges also +appear in the members of the cluster nodes. For data update, it is therefore +important to scan these lists as well as the cluster nodes. + + +### Cluster Node + +A cluster node has the following extra fields: + +- `isCluster : true` - indication that this is a cluster node +- `containedNodes` - hash of nodes contained in this cluster +- `containedEdges` - same for edges +- `edges` - array of cluster edges for this node + + +**NOTE:** + +- `containedEdges` can also contain edges which are not clustered; e.g. an edge + connecting two nodes in the same cluster. + + +### Cluster Edge + +These are the items in the `edges` member of a clustered node. They have the +following relevant members: + +- 'clusteringEdgeReplacingIds` - array of id's of edges replaced by this edge + +Note that it's possible to nest clusters, so that `clusteringEdgeReplacingIds` +can contain edge id's of other clusters. + + +### Clustered Edge + +This is any edge contained by a cluster edge. It gets the following additional +member: + +- `edgeReplacedById` - id of the cluster edge in which current edge is clustered + + + =========================================================================== */ +var util = __webpack_require__(2); +var NetworkUtil = __webpack_require__(76)['default']; +var Cluster = __webpack_require__(228)['default']; +var Edge = __webpack_require__(74)['default']; // Only needed for check on type! +var Node = __webpack_require__(47)['default']; // Only needed for check on type! - this._determineBrowserMethod(); - this.bindEventListeners(); - } +/** + * The clustering engine + */ - (0, _createClass3['default'])(CanvasRenderer, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this = this; +var ClusterEngine = function () { + /** + * @param {Object} body + */ + function ClusterEngine(body) { + var _this = this; - this.body.emitter.on("dragStart", function () { - _this.dragging = true; - }); - this.body.emitter.on("dragEnd", function () { - _this.dragging = false; - }); - this.body.emitter.on("_resizeNodes", function () { - _this._resizeNodes(); - }); - this.body.emitter.on("_redraw", function () { - if (_this.renderingActive === false) { - _this._redraw(); - } - }); - this.body.emitter.on("_blockRedraw", function () { - _this.allowRedraw = false; - }); - this.body.emitter.on("_allowRedraw", function () { - _this.allowRedraw = true;_this.redrawRequested = false; - }); - this.body.emitter.on("_requestRedraw", this._requestRedraw.bind(this)); - this.body.emitter.on("_startRendering", function () { - _this.renderRequests += 1; - _this.renderingActive = true; - _this._startRendering(); - }); - this.body.emitter.on("_stopRendering", function () { - _this.renderRequests -= 1; - _this.renderingActive = _this.renderRequests > 0; - _this.renderTimer = undefined; - }); - this.body.emitter.on('destroy', function () { - _this.renderRequests = 0; - _this.allowRedraw = false; - _this.renderingActive = false; - if (_this.requiresTimeout === true) { - clearTimeout(_this.renderTimer); - } else { - window.cancelAnimationFrame(_this.renderTimer); - } - _this.body.emitter.off(); - }); + (0, _classCallCheck3['default'])(this, ClusterEngine); + + this.body = body; + this.clusteredNodes = {}; // key: node id, value: { clusterId: , node: } + this.clusteredEdges = {}; // key: edge id, value: restore information for given edge + + this.options = {}; + this.defaultOptions = {}; + util.extend(this.options, this.defaultOptions); + + this.body.emitter.on('_resetData', function () { + _this.clusteredNodes = {};_this.clusteredEdges = {}; + }); + } + + /** + * + * @param {number} hubsize + * @param {Object} options + */ + + + (0, _createClass3['default'])(ClusterEngine, [{ + key: 'clusterByHubsize', + value: function clusterByHubsize(hubsize, options) { + if (hubsize === undefined) { + hubsize = this._getHubSize(); + } else if ((typeof hubsize === 'undefined' ? 'undefined' : (0, _typeof3['default'])(hubsize)) === "object") { + options = this._checkOptions(hubsize); + hubsize = this._getHubSize(); } - }, { - key: 'setOptions', - value: function setOptions(options) { - if (options !== undefined) { - var fields = ['hideEdgesOnDrag', 'hideNodesOnDrag']; - util.selectiveDeepExtend(fields, this.options, options); + + var nodesToCluster = []; + for (var i = 0; i < this.body.nodeIndices.length; i++) { + var node = this.body.nodes[this.body.nodeIndices[i]]; + if (node.edges.length >= hubsize) { + nodesToCluster.push(node.id); } } - }, { - key: '_startRendering', - value: function _startRendering() { - if (this.renderingActive === true) { - if (this.renderTimer === undefined) { - if (this.requiresTimeout === true) { - this.renderTimer = window.setTimeout(this._renderStep.bind(this), this.simulationInterval); // wait this.renderTimeStep milliseconds and perform the animation step function - } else { - this.renderTimer = window.requestAnimationFrame(this._renderStep.bind(this)); // wait this.renderTimeStep milliseconds and perform the animation step function - } - } - } + + for (var _i = 0; _i < nodesToCluster.length; _i++) { + this.clusterByConnection(nodesToCluster[_i], options, true); } - }, { - key: '_renderStep', - value: function _renderStep() { - if (this.renderingActive === true) { - // reset the renderTimer so a new scheduled animation step can be set - this.renderTimer = undefined; - if (this.requiresTimeout === true) { - // this schedules a new simulation step - this._startRendering(); - } + this.body.emitter.emit('_dataChanged'); + } + + /** + * loop over all nodes, check if they adhere to the condition and cluster if needed. + * @param {Object} options + * @param {boolean} [refreshData=true] + */ - this._redraw(); + }, { + key: 'cluster', + value: function cluster() { + var _this2 = this; - if (this.requiresTimeout === false) { - // this schedules a new simulation step - this._startRendering(); - } - } + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + if (options.joinCondition === undefined) { + throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options."); } - /** - * Redraw the network with the current data - * chart will be resized too. - */ + // check if the options object is fine, append if needed + options = this._checkOptions(options); - }, { - key: 'redraw', - value: function redraw() { - this.body.emitter.emit('setSize'); - this._redraw(); - } + var childNodesObj = {}; + var childEdgesObj = {}; - /** - * Redraw the network with the current data - * @param hidden | used to get the first estimate of the node sizes. only the nodes are drawn after which they are quickly drawn over. - * @private - */ + // collect the nodes that will be in the cluster + util.forEach(this.body.nodes, function (node, nodeId) { + var clonedOptions = NetworkUtil.cloneOptions(node); + if (options.joinCondition(clonedOptions) === true) { + childNodesObj[nodeId] = node; - }, { - key: '_requestRedraw', - value: function _requestRedraw() { - var _this2 = this; - - if (this.redrawRequested !== true && this.renderingActive === false && this.allowRedraw === true) { - this.redrawRequested = true; - if (this.requiresTimeout === true) { - window.setTimeout(function () { - _this2._redraw(false); - }, 0); - } else { - window.requestAnimationFrame(function () { - _this2._redraw(false); - }); - } + // collect the edges that will be in the cluster + util.forEach(node.edges, function (edge) { + if (_this2.clusteredEdges[edge.id] === undefined) { + childEdgesObj[edge.id] = edge; + } + }); } - } - }, { - key: '_redraw', - value: function _redraw() { - var hidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - if (this.allowRedraw === true) { - this.body.emitter.emit("initRedraw"); + }); - this.redrawRequested = false; + this._cluster(childNodesObj, childEdgesObj, options, refreshData); + } - // when the container div was hidden, this fixes it back up! - if (this.canvas.frame.canvas.width === 0 || this.canvas.frame.canvas.height === 0) { - this.canvas.setSize(); - } + /** + * Cluster all nodes in the network that have only X edges + * @param {number} edgeCount + * @param {Object} options + * @param {boolean} [refreshData=true] + */ - this.canvas.setTransform(); + }, { + key: 'clusterByEdgeCount', + value: function clusterByEdgeCount(edgeCount, options) { + var _this3 = this; - var ctx = this.canvas.getContext(); + var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - // clear the canvas - var w = this.canvas.frame.canvas.clientWidth; - var h = this.canvas.frame.canvas.clientHeight; - ctx.clearRect(0, 0, w, h); + options = this._checkOptions(options); + var clusters = []; + var usedNodes = {}; + var edge = void 0, + edges = void 0, + relevantEdgeCount = void 0; + // collect the nodes that will be in the cluster - // if the div is hidden, we stop the redraw here for performance. - if (this.canvas.frame.clientWidth === 0) { - return; + var _loop = function _loop(i) { + var childNodesObj = {}; + var childEdgesObj = {}; + var nodeId = _this3.body.nodeIndices[i]; + var node = _this3.body.nodes[nodeId]; + + // if this node is already used in another cluster this session, we do not have to re-evaluate it. + if (usedNodes[nodeId] === undefined) { + relevantEdgeCount = 0; + edges = []; + for (var j = 0; j < node.edges.length; j++) { + edge = node.edges[j]; + if (_this3.clusteredEdges[edge.id] === undefined) { + if (edge.toId !== edge.fromId) { + relevantEdgeCount++; + } + edges.push(edge); + } } - // set scaling and translation - ctx.save(); - ctx.translate(this.body.view.translation.x, this.body.view.translation.y); - ctx.scale(this.body.view.scale, this.body.view.scale); + // this node qualifies, we collect its neighbours to start the clustering process. + if (relevantEdgeCount === edgeCount) { + checkJoinCondition = function checkJoinCondition(node) { + if (options.joinCondition === undefined || options.joinCondition === null) { + return true; + } - ctx.beginPath(); - this.body.emitter.emit("beforeDrawing", ctx); - ctx.closePath(); + var clonedOptions = NetworkUtil.cloneOptions(node); + return options.joinCondition(clonedOptions); + }; - if (hidden === false) { - if (this.dragging === false || this.dragging === true && this.options.hideEdgesOnDrag === false) { - this._drawEdges(ctx); + var gatheringSuccessful = true; + for (var _j = 0; _j < edges.length; _j++) { + edge = edges[_j]; + var childNodeId = _this3._getConnectedId(edge, nodeId); + // add the nodes to the list by the join condition. + if (checkJoinCondition(node)) { + childEdgesObj[edge.id] = edge; + childNodesObj[nodeId] = node; + childNodesObj[childNodeId] = _this3.body.nodes[childNodeId]; + usedNodes[nodeId] = true; + } else { + // this node does not qualify after all. + gatheringSuccessful = false; + break; + } } - } - if (this.dragging === false || this.dragging === true && this.options.hideNodesOnDrag === false) { - this._drawNodes(ctx, hidden); - } + // add to the cluster queue + if ((0, _keys2['default'])(childNodesObj).length > 0 && (0, _keys2['default'])(childEdgesObj).length > 0 && gatheringSuccessful === true) { + /** + * Search for cluster data that contains any of the node id's + * @returns {Boolean} true if no joinCondition, otherwise return value of joinCondition + */ + findClusterData = function findClusterData() { + for (var n = 0; n < clusters.length; ++n) { + // Search for a cluster containing any of the node id's + for (var m in childNodesObj) { + if (clusters[n].nodes[m] !== undefined) { + return clusters[n]; + } + } + } + + return undefined; + }; - ctx.beginPath(); - this.body.emitter.emit("afterDrawing", ctx); - ctx.closePath(); + // If any of the found nodes is part of a cluster found in this method, + // add the current values to that cluster - // restore original scaling and translation - ctx.restore(); - if (hidden === true) { - ctx.clearRect(0, 0, w, h); + + foundCluster = findClusterData(); + + if (foundCluster !== undefined) { + // Add nodes to found cluster if not present + for (var m in childNodesObj) { + if (foundCluster.nodes[m] === undefined) { + foundCluster.nodes[m] = childNodesObj[m]; + } + } + + // Add edges to found cluster, if not present + for (var _m in childEdgesObj) { + if (foundCluster.edges[_m] === undefined) { + foundCluster.edges[_m] = childEdgesObj[_m]; + } + } + } else { + // Create a new cluster group + clusters.push({ nodes: childNodesObj, edges: childEdgesObj }); + } + } } } + }; + + for (var i = 0; i < this.body.nodeIndices.length; i++) { + var checkJoinCondition; + var findClusterData; + var foundCluster; + + _loop(i); } - /** - * Redraw all nodes - * - * @param {CanvasRenderingContext2D} ctx - * @param {Boolean} [alwaysShow] - * @private - */ + for (var i = 0; i < clusters.length; i++) { + this._cluster(clusters[i].nodes, clusters[i].edges, options, false); + } - }, { - key: '_resizeNodes', - value: function _resizeNodes() { - this.canvas.setTransform(); - var ctx = this.canvas.getContext(); - ctx.save(); - ctx.translate(this.body.view.translation.x, this.body.view.translation.y); - ctx.scale(this.body.view.scale, this.body.view.scale); + if (refreshData === true) { + this.body.emitter.emit('_dataChanged'); + } + } - var nodes = this.body.nodes; - var node = void 0; + /** + * Cluster all nodes in the network that have only 1 edge + * @param {Object} options + * @param {boolean} [refreshData=true] + */ - // resize all nodes - for (var nodeId in nodes) { - if (nodes.hasOwnProperty(nodeId)) { - node = nodes[nodeId]; - node.resize(ctx); - node.updateBoundingBox(ctx, node.selected); - } - } + }, { + key: 'clusterOutliers', + value: function clusterOutliers(options) { + var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - // restore original scaling and translation - ctx.restore(); + this.clusterByEdgeCount(1, options, refreshData); + } + + /** + * Cluster all nodes in the network that have only 2 edge + * @param {Object} options + * @param {boolean} [refreshData=true] + */ + + }, { + key: 'clusterBridges', + value: function clusterBridges(options) { + var refreshData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + this.clusterByEdgeCount(2, options, refreshData); + } + + /** + * suck all connected nodes of a node into the node. + * @param {Node.id} nodeId + * @param {Object} options + * @param {boolean} [refreshData=true] + */ + + }, { + key: 'clusterByConnection', + value: function clusterByConnection(nodeId, options) { + var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + + // kill conditions + if (nodeId === undefined) { + throw new Error("No nodeId supplied to clusterByConnection!"); + } + if (this.body.nodes[nodeId] === undefined) { + throw new Error("The nodeId given to clusterByConnection does not exist!"); } - /** - * Redraw all nodes - * - * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas - * @param {Boolean} [alwaysShow] - * @private - */ + var node = this.body.nodes[nodeId]; + options = this._checkOptions(options, node); + if (options.clusterNodeProperties.x === undefined) { + options.clusterNodeProperties.x = node.x; + } + if (options.clusterNodeProperties.y === undefined) { + options.clusterNodeProperties.y = node.y; + } + if (options.clusterNodeProperties.fixed === undefined) { + options.clusterNodeProperties.fixed = {}; + options.clusterNodeProperties.fixed.x = node.options.fixed.x; + options.clusterNodeProperties.fixed.y = node.options.fixed.y; + } - }, { - key: '_drawNodes', - value: function _drawNodes(ctx) { - var alwaysShow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var childNodesObj = {}; + var childEdgesObj = {}; + var parentNodeId = node.id; + var parentClonedOptions = NetworkUtil.cloneOptions(node); + childNodesObj[parentNodeId] = node; - var nodes = this.body.nodes; - var nodeIndices = this.body.nodeIndices; - var node = void 0; - var selected = []; - var margin = 20; - var topLeft = this.canvas.DOMtoCanvas({ x: -margin, y: -margin }); - var bottomRight = this.canvas.DOMtoCanvas({ - x: this.canvas.frame.canvas.clientWidth + margin, - y: this.canvas.frame.canvas.clientHeight + margin - }); - var viewableArea = { top: topLeft.y, left: topLeft.x, bottom: bottomRight.y, right: bottomRight.x }; + // collect the nodes that will be in the cluster + for (var i = 0; i < node.edges.length; i++) { + var edge = node.edges[i]; + if (this.clusteredEdges[edge.id] === undefined) { + var childNodeId = this._getConnectedId(edge, parentNodeId); - // draw unselected nodes; - for (var i = 0; i < nodeIndices.length; i++) { - node = nodes[nodeIndices[i]]; - // set selected nodes aside - if (node.isSelected()) { - selected.push(nodeIndices[i]); - } else { - if (alwaysShow === true) { - node.draw(ctx); - } else if (node.isBoundingBoxOverlappingWith(viewableArea) === true) { - node.draw(ctx); + // if the child node is not in a cluster + if (this.clusteredNodes[childNodeId] === undefined) { + if (childNodeId !== parentNodeId) { + if (options.joinCondition === undefined) { + childEdgesObj[edge.id] = edge; + childNodesObj[childNodeId] = this.body.nodes[childNodeId]; + } else { + // clone the options and insert some additional parameters that could be interesting. + var childClonedOptions = NetworkUtil.cloneOptions(this.body.nodes[childNodeId]); + if (options.joinCondition(parentClonedOptions, childClonedOptions) === true) { + childEdgesObj[edge.id] = edge; + childNodesObj[childNodeId] = this.body.nodes[childNodeId]; + } + } } else { - node.updateBoundingBox(ctx, node.selected); + // swallow the edge if it is self-referencing. + childEdgesObj[edge.id] = edge; } } } - - // draw the selected nodes on top - for (var _i = 0; _i < selected.length; _i++) { - node = nodes[selected[_i]]; - node.draw(ctx); - } } + var childNodeIDs = (0, _keys2['default'])(childNodesObj).map(function (childNode) { + return childNodesObj[childNode].id; + }); - /** - * Redraw all edges - * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas - * @private - */ - - }, { - key: '_drawEdges', - value: function _drawEdges(ctx) { - var edges = this.body.edges; - var edgeIndices = this.body.edgeIndices; - var edge = void 0; + for (childNode in childNodesObj) { + if (!childNodesObj.hasOwnProperty(childNode)) continue; - for (var i = 0; i < edgeIndices.length; i++) { - edge = edges[edgeIndices[i]]; - if (edge.connected === true) { - edge.draw(ctx); + var childNode = childNodesObj[childNode]; + for (var y = 0; y < childNode.edges.length; y++) { + var childEdge = childNode.edges[y]; + if (childNodeIDs.indexOf(this._getConnectedId(childEdge, childNode.id)) > -1) { + childEdgesObj[childEdge.id] = childEdge; } } } + this._cluster(childNodesObj, childEdgesObj, options, refreshData); + } - /** - * Determine if the browser requires a setTimeout or a requestAnimationFrame. This was required because - * some implementations (safari and IE9) did not support requestAnimationFrame - * @private - */ + /** + * This function creates the edges that will be attached to the cluster + * It looks for edges that are connected to the nodes from the "outside' of the cluster. + * + * @param {{Node.id: vis.Node}} childNodesObj + * @param {{vis.Edge.id: vis.Edge}} childEdgesObj + * @param {Object} clusterNodeProperties + * @param {Object} clusterEdgeProperties + * @private + */ - }, { - key: '_determineBrowserMethod', - value: function _determineBrowserMethod() { - if (typeof window !== 'undefined') { - var browserType = navigator.userAgent.toLowerCase(); - this.requiresTimeout = false; - if (browserType.indexOf('msie 9.0') != -1) { - // IE 9 - this.requiresTimeout = true; - } else if (browserType.indexOf('safari') != -1) { - // safari - if (browserType.indexOf('chrome') <= -1) { - this.requiresTimeout = true; + }, { + key: '_createClusterEdges', + value: function _createClusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, clusterEdgeProperties) { + var edge = void 0, + childNodeId = void 0, + childNode = void 0, + toId = void 0, + fromId = void 0, + otherNodeId = void 0; + + // loop over all child nodes and their edges to find edges going out of the cluster + // these edges will be replaced by clusterEdges. + var childKeys = (0, _keys2['default'])(childNodesObj); + var createEdges = []; + for (var i = 0; i < childKeys.length; i++) { + childNodeId = childKeys[i]; + childNode = childNodesObj[childNodeId]; + + // construct new edges from the cluster to others + for (var j = 0; j < childNode.edges.length; j++) { + edge = childNode.edges[j]; + // we only handle edges that are visible to the system, not the disabled ones from the clustering process. + if (this.clusteredEdges[edge.id] === undefined) { + // self-referencing edges will be added to the "hidden" list + if (edge.toId == edge.fromId) { + childEdgesObj[edge.id] = edge; + } else { + // set up the from and to. + if (edge.toId == childNodeId) { + // this is a double equals because ints and strings can be interchanged here. + toId = clusterNodeProperties.id; + fromId = edge.fromId; + otherNodeId = fromId; + } else { + toId = edge.toId; + fromId = clusterNodeProperties.id; + otherNodeId = toId; + } + } + + // Only edges from the cluster outwards are being replaced. + if (childNodesObj[otherNodeId] === undefined) { + createEdges.push({ edge: edge, fromId: fromId, toId: toId }); } } - } else { - this.requiresTimeout = true; } } - }]); - return CanvasRenderer; - }(); - exports['default'] = CanvasRenderer; + // + // Here we actually create the replacement edges. + // + // We could not do this in the loop above as the creation process + // would add an edge to the edges array we are iterating over. + // + // NOTE: a clustered edge can have multiple base edges! + // + var newEdges = []; -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Find a cluster edge which matches the given created edge. + * @param {vis.Edge} createdEdge + * @returns {vis.Edge} + */ + var getNewEdge = function getNewEdge(createdEdge) { + for (var _j2 = 0; _j2 < newEdges.length; _j2++) { + var newEdge = newEdges[_j2]; - 'use strict'; + // We replace both to and from edges with a single cluster edge + var matchToDirection = createdEdge.fromId === newEdge.fromId && createdEdge.toId === newEdge.toId; + var matchFromDirection = createdEdge.fromId === newEdge.toId && createdEdge.toId === newEdge.fromId; - Object.defineProperty(exports, "__esModule", { - value: true - }); + if (matchToDirection || matchFromDirection) { + return newEdge; + } + } - var _classCallCheck2 = __webpack_require__(135); + return null; + }; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + for (var _j3 = 0; _j3 < createEdges.length; _j3++) { + var createdEdge = createEdges[_j3]; + var _edge = createdEdge.edge; + var newEdge = getNewEdge(createdEdge); - var _createClass2 = __webpack_require__(136); + if (newEdge === null) { + // Create a clustered edge for this connection + newEdge = this._createClusteredEdge(createdEdge.fromId, createdEdge.toId, _edge, clusterEdgeProperties); - var _createClass3 = _interopRequireDefault(_createClass2); + newEdges.push(newEdge); + } else { + newEdge.clusteringEdgeReplacingIds.push(_edge.id); + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + // also reference the new edge in the old edge + this.body.edges[_edge.id].edgeReplacedById = newEdge.id; - var Hammer = __webpack_require__(113); - var hammerUtil = __webpack_require__(120); + // hide the replaced edge + this._backupEdgeOptions(_edge); + _edge.setOptions({ physics: false }); + } + } - var util = __webpack_require__(1); + /** + * This function checks the options that can be supplied to the different cluster functions + * for certain fields and inserts defaults if needed + * @param {Object} options + * @returns {*} + * @private + */ - /** - * Create the main frame for the Network. - * This function is executed once when a Network object is created. The frame - * contains a canvas, and this canvas contains all objects like the axis and - * nodes. - * @private - */ + }, { + key: '_checkOptions', + value: function _checkOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var Canvas = function () { - function Canvas(body) { - (0, _classCallCheck3['default'])(this, Canvas); - - this.body = body; - this.pixelRatio = 1; - this.resizeTimer = undefined; - this.resizeFunction = this._onResize.bind(this); - this.cameraState = {}; - this.initialized = false; - this.canvasViewCenter = {}; - - this.options = {}; - this.defaultOptions = { - autoResize: true, - height: '100%', - width: '100%' - }; - util.extend(this.options, this.defaultOptions); + if (options.clusterEdgeProperties === undefined) { + options.clusterEdgeProperties = {}; + } + if (options.clusterNodeProperties === undefined) { + options.clusterNodeProperties = {}; + } - this.bindEventListeners(); + return options; } - (0, _createClass3['default'])(Canvas, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this = this; + /** + * + * @param {Object} childNodesObj | object with node objects, id as keys, same as childNodes except it also contains a source node + * @param {Object} childEdgesObj | object with edge objects, id as keys + * @param {Array} options | object with {clusterNodeProperties, clusterEdgeProperties, processProperties} + * @param {boolean} refreshData | when true, do not wrap up + * @private + */ - // bind the events - this.body.emitter.once("resize", function (obj) { - if (obj.width !== 0) { - _this.body.view.translation.x = obj.width * 0.5; - } - if (obj.height !== 0) { - _this.body.view.translation.y = obj.height * 0.5; + }, { + key: '_cluster', + value: function _cluster(childNodesObj, childEdgesObj, options) { + var refreshData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + + // Remove nodes which are already clustered + var tmpNodesToRemove = []; + for (var _nodeId in childNodesObj) { + if (childNodesObj.hasOwnProperty(_nodeId)) { + if (this.clusteredNodes[_nodeId] !== undefined) { + tmpNodesToRemove.push(_nodeId); } - }); - this.body.emitter.on("setSize", this.setSize.bind(this)); - this.body.emitter.on("destroy", function () { - _this.hammerFrame.destroy(); - _this.hammer.destroy(); - _this._cleanUp(); - }); - } - }, { - key: 'setOptions', - value: function setOptions(options) { - var _this2 = this; - - if (options !== undefined) { - var fields = ['width', 'height', 'autoResize']; - util.selectiveDeepExtend(fields, this.options, options); - } - - if (this.options.autoResize === true) { - // automatically adapt to a changing size of the browser. - this._cleanUp(); - this.resizeTimer = setInterval(function () { - var changed = _this2.setSize(); - if (changed === true) { - _this2.body.emitter.emit("_requestRedraw"); - } - }, 1000); - this.resizeFunction = this._onResize.bind(this); - util.addEventListener(window, 'resize', this.resizeFunction); - } - } - }, { - key: '_cleanUp', - value: function _cleanUp() { - // automatically adapt to a changing size of the browser. - if (this.resizeTimer !== undefined) { - clearInterval(this.resizeTimer); } - util.removeEventListener(window, 'resize', this.resizeFunction); - this.resizeFunction = undefined; - } - }, { - key: '_onResize', - value: function _onResize() { - this.setSize(); - this.body.emitter.emit("_redraw"); } - /** - * Get and store the cameraState - * @private - */ + for (var n = 0; n < tmpNodesToRemove.length; ++n) { + delete childNodesObj[tmpNodesToRemove[n]]; + } - }, { - key: '_getCameraState', - value: function _getCameraState() { - var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pixelRatio; - - if (this.initialized === true) { - this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio; - this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio; - this.cameraState.scale = this.body.view.scale; - this.cameraState.position = this.DOMtoCanvas({ - x: 0.5 * this.frame.canvas.width / pixelRatio, - y: 0.5 * this.frame.canvas.height / pixelRatio - }); - } + // kill condition: no nodes don't bother + if ((0, _keys2['default'])(childNodesObj).length == 0) { + return; } - /** - * Set the cameraState - * @private - */ + // allow clusters of 1 if options allow + if ((0, _keys2['default'])(childNodesObj).length == 1 && options.clusterNodeProperties.allowSingleNodeCluster != true) { + return; + } - }, { - key: '_setCameraState', - value: function _setCameraState() { - if (this.cameraState.scale !== undefined && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0) { - - var widthRatio = this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth; - var heightRatio = this.frame.canvas.height / this.pixelRatio / this.cameraState.previousHeight; - var newScale = this.cameraState.scale; - - if (widthRatio != 1 && heightRatio != 1) { - newScale = this.cameraState.scale * 0.5 * (widthRatio + heightRatio); - } else if (widthRatio != 1) { - newScale = this.cameraState.scale * widthRatio; - } else if (heightRatio != 1) { - newScale = this.cameraState.scale * heightRatio; - } - - this.body.view.scale = newScale; - // this comes from the view module. - var currentViewCenter = this.DOMtoCanvas({ - x: 0.5 * this.frame.canvas.clientWidth, - y: 0.5 * this.frame.canvas.clientHeight - }); + var clusterNodeProperties = util.deepExtend({}, options.clusterNodeProperties); - var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node - x: currentViewCenter.x - this.cameraState.position.x, - y: currentViewCenter.y - this.cameraState.position.y - }; - this.body.view.translation.x += distanceFromCenter.x * this.body.view.scale; - this.body.view.translation.y += distanceFromCenter.y * this.body.view.scale; - } - } - }, { - key: '_prepareValue', - value: function _prepareValue(value) { - if (typeof value === 'number') { - return value + 'px'; - } else if (typeof value === 'string') { - if (value.indexOf('%') !== -1 || value.indexOf('px') !== -1) { - return value; - } else if (value.indexOf('%') === -1) { - return value + 'px'; + // construct the clusterNodeProperties + if (options.processProperties !== undefined) { + // get the childNode options + var childNodesOptions = []; + for (var _nodeId2 in childNodesObj) { + if (childNodesObj.hasOwnProperty(_nodeId2)) { + var clonedOptions = NetworkUtil.cloneOptions(childNodesObj[_nodeId2]); + childNodesOptions.push(clonedOptions); } } - throw new Error('Could not use the value supplied for width or height:' + value); - } - /** - * Create the HTML - */ + // get cluster properties based on childNodes + var childEdgesOptions = []; + for (var edgeId in childEdgesObj) { + if (childEdgesObj.hasOwnProperty(edgeId)) { + // these cluster edges will be removed on creation of the cluster. + if (edgeId.substr(0, 12) !== "clusterEdge:") { + var _clonedOptions = NetworkUtil.cloneOptions(childEdgesObj[edgeId], 'edge'); + childEdgesOptions.push(_clonedOptions); + } + } + } - }, { - key: '_create', - value: function _create() { - // remove all elements from the container element. - while (this.body.container.hasChildNodes()) { - this.body.container.removeChild(this.body.container.firstChild); - } - - this.frame = document.createElement('div'); - this.frame.className = 'vis-network'; - this.frame.style.position = 'relative'; - this.frame.style.overflow = 'hidden'; - this.frame.tabIndex = 900; // tab index is required for keycharm to bind keystrokes to the div instead of the window - - ////////////////////////////////////////////////////////////////// - - this.frame.canvas = document.createElement("canvas"); - this.frame.canvas.style.position = 'relative'; - this.frame.appendChild(this.frame.canvas); - - if (!this.frame.canvas.getContext) { - var noCanvas = document.createElement('DIV'); - noCanvas.style.color = 'red'; - noCanvas.style.fontWeight = 'bold'; - noCanvas.style.padding = '10px'; - noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; - this.frame.canvas.appendChild(noCanvas); - } else { - this._setPixelRatio(); - this.setTransform(); + clusterNodeProperties = options.processProperties(clusterNodeProperties, childNodesOptions, childEdgesOptions); + if (!clusterNodeProperties) { + throw new Error("The processProperties function does not return properties!"); } + } - // add the frame to the container element - this.body.container.appendChild(this.frame); + // check if we have an unique id; + if (clusterNodeProperties.id === undefined) { + clusterNodeProperties.id = 'cluster:' + util.randomUUID(); + } + var clusterId = clusterNodeProperties.id; - this.body.view.scale = 1; - this.body.view.translation = { x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight }; + if (clusterNodeProperties.label === undefined) { + clusterNodeProperties.label = 'cluster'; + } - this._bindHammer(); + // give the clusterNode a position if it does not have one. + var pos = undefined; + if (clusterNodeProperties.x === undefined) { + pos = this._getClusterPosition(childNodesObj); + clusterNodeProperties.x = pos.x; + } + if (clusterNodeProperties.y === undefined) { + if (pos === undefined) { + pos = this._getClusterPosition(childNodesObj); + } + clusterNodeProperties.y = pos.y; } - /** - * This function binds hammer, it can be repeated over and over due to the uniqueness check. - * @private - */ + // force the ID to remain the same + clusterNodeProperties.id = clusterId; - }, { - key: '_bindHammer', - value: function _bindHammer() { - var _this3 = this; + // create the cluster Node + // Note that allowSingleNodeCluster, if present, is stored in the options as well + var clusterNode = this.body.functions.createNode(clusterNodeProperties, Cluster); + clusterNode.containedNodes = childNodesObj; + clusterNode.containedEdges = childEdgesObj; + // cache a copy from the cluster edge properties if we have to reconnect others later on + clusterNode.clusterEdgeProperties = options.clusterEdgeProperties; - if (this.hammer !== undefined) { - this.hammer.destroy(); - } - this.drag = {}; - this.pinch = {}; + // finally put the cluster node into global + this.body.nodes[clusterNodeProperties.id] = clusterNode; - // init hammer - this.hammer = new Hammer(this.frame.canvas); - this.hammer.get('pinch').set({ enable: true }); - // enable to get better response, todo: test on mobile. - this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_ALL }); + this._clusterEdges(childNodesObj, childEdgesObj, clusterNodeProperties, options.clusterEdgeProperties); - hammerUtil.onTouch(this.hammer, function (event) { - _this3.body.eventListeners.onTouch(event); - }); - this.hammer.on('tap', function (event) { - _this3.body.eventListeners.onTap(event); - }); - this.hammer.on('doubletap', function (event) { - _this3.body.eventListeners.onDoubleTap(event); - }); - this.hammer.on('press', function (event) { - _this3.body.eventListeners.onHold(event); - }); - this.hammer.on('panstart', function (event) { - _this3.body.eventListeners.onDragStart(event); - }); - this.hammer.on('panmove', function (event) { - _this3.body.eventListeners.onDrag(event); - }); - this.hammer.on('panend', function (event) { - _this3.body.eventListeners.onDragEnd(event); - }); - this.hammer.on('pinch', function (event) { - _this3.body.eventListeners.onPinch(event); - }); + // set ID to undefined so no duplicates arise + clusterNodeProperties.id = undefined; - // TODO: neatly cleanup these handlers when re-creating the Canvas, IF these are done with hammer, event.stopPropagation will not work? - this.frame.canvas.addEventListener('mousewheel', function (event) { - _this3.body.eventListeners.onMouseWheel(event); - }); - this.frame.canvas.addEventListener('DOMMouseScroll', function (event) { - _this3.body.eventListeners.onMouseWheel(event); - }); + // wrap up + if (refreshData === true) { + this.body.emitter.emit('_dataChanged'); + } + } - this.frame.canvas.addEventListener('mousemove', function (event) { - _this3.body.eventListeners.onMouseMove(event); - }); - this.frame.canvas.addEventListener('contextmenu', function (event) { - _this3.body.eventListeners.onContext(event); - }); + /** + * + * @param {Edge} edge + * @private + */ - this.hammerFrame = new Hammer(this.frame); - hammerUtil.onRelease(this.hammerFrame, function (event) { - _this3.body.eventListeners.onRelease(event); - }); + }, { + key: '_backupEdgeOptions', + value: function _backupEdgeOptions(edge) { + if (this.clusteredEdges[edge.id] === undefined) { + this.clusteredEdges[edge.id] = { physics: edge.options.physics }; } + } - /** - * Set a new size for the network - * @param {string} width Width in pixels or percentage (for example '800px' - * or '50%') - * @param {string} height Height in pixels or percentage (for example '400px' - * or '30%') - */ + /** + * + * @param {Edge} edge + * @private + */ - }, { - key: 'setSize', - value: function setSize() { - var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.width; - var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.height; - - width = this._prepareValue(width); - height = this._prepareValue(height); - - var emitEvent = false; - var oldWidth = this.frame.canvas.width; - var oldHeight = this.frame.canvas.height; - - // update the pixel ratio - // - // NOTE: Comment in following is rather inconsistent; this is the ONLY place in the code - // where it is assumed that the pixel ratio could change at runtime. - // The only way I can think of this happening is a rotating screen or tablet; but then - // there should be a mechanism for reloading the data (TODO: check if this is present). - // - // If the assumption is true (i.e. pixel ratio can change at runtime), then *all* usage - // of pixel ratio must be overhauled for this. - // - // For the time being, I will humor the assumption here, and in the rest of the code assume it is - // constant. - var previousRatio = this.pixelRatio; // we cache this because the camera state storage needs the old value - this._setPixelRatio(); + }, { + key: '_restoreEdge', + value: function _restoreEdge(edge) { + var originalOptions = this.clusteredEdges[edge.id]; + if (originalOptions !== undefined) { + edge.setOptions({ physics: originalOptions.physics }); + delete this.clusteredEdges[edge.id]; + } + } - if (width != this.options.width || height != this.options.height || this.frame.style.width != width || this.frame.style.height != height) { - this._getCameraState(previousRatio); + /** + * Check if a node is a cluster. + * @param {Node.id} nodeId + * @returns {*} + */ + + }, { + key: 'isCluster', + value: function isCluster(nodeId) { + if (this.body.nodes[nodeId] !== undefined) { + return this.body.nodes[nodeId].isCluster === true; + } else { + console.log("Node does not exist."); + return false; + } + } - this.frame.style.width = width; - this.frame.style.height = height; + /** + * get the position of the cluster node based on what's inside + * @param {object} childNodesObj | object with node objects, id as keys + * @returns {{x: number, y: number}} + * @private + */ - this.frame.canvas.style.width = '100%'; - this.frame.canvas.style.height = '100%'; + }, { + key: '_getClusterPosition', + value: function _getClusterPosition(childNodesObj) { + var childKeys = (0, _keys2['default'])(childNodesObj); + var minX = childNodesObj[childKeys[0]].x; + var maxX = childNodesObj[childKeys[0]].x; + var minY = childNodesObj[childKeys[0]].y; + var maxY = childNodesObj[childKeys[0]].y; + var node = void 0; + for (var i = 1; i < childKeys.length; i++) { + node = childNodesObj[childKeys[i]]; + minX = node.x < minX ? node.x : minX; + maxX = node.x > maxX ? node.x : maxX; + minY = node.y < minY ? node.y : minY; + maxY = node.y > maxY ? node.y : maxY; + } - this.frame.canvas.width = Math.round(this.frame.canvas.clientWidth * this.pixelRatio); - this.frame.canvas.height = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); + return { x: 0.5 * (minX + maxX), y: 0.5 * (minY + maxY) }; + } - this.options.width = width; - this.options.height = height; + /** + * Open a cluster by calling this function. + * @param {vis.Edge.id} clusterNodeId | the ID of the cluster node + * @param {Object} options + * @param {boolean} refreshData | wrap up afterwards if not true + */ - this.canvasViewCenter = { - x: 0.5 * this.frame.clientWidth, - y: 0.5 * this.frame.clientHeight - }; + }, { + key: 'openCluster', + value: function openCluster(clusterNodeId, options) { + var refreshData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - emitEvent = true; - } else { - // this would adapt the width of the canvas to the width from 100% if and only if - // there is a change. + // kill conditions + if (clusterNodeId === undefined) { + throw new Error("No clusterNodeId supplied to openCluster."); + } - var newWidth = Math.round(this.frame.canvas.clientWidth * this.pixelRatio); - var newHeight = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); + var clusterNode = this.body.nodes[clusterNodeId]; - // store the camera if there is a change in size. - if (this.frame.canvas.width !== newWidth || this.frame.canvas.height !== newHeight) { - this._getCameraState(previousRatio); - } + if (clusterNode === undefined) { + throw new Error("The clusterNodeId supplied to openCluster does not exist."); + } + if (clusterNode.isCluster !== true || clusterNode.containedNodes === undefined || clusterNode.containedEdges === undefined) { + throw new Error("The node:" + clusterNodeId + " is not a valid cluster."); + } - if (this.frame.canvas.width !== newWidth) { - this.frame.canvas.width = newWidth; - emitEvent = true; - } - if (this.frame.canvas.height !== newHeight) { - this.frame.canvas.height = newHeight; - emitEvent = true; - } - } + // Check if current cluster is clustered itself + var stack = this.findNode(clusterNodeId); + var parentIndex = stack.indexOf(clusterNodeId) - 1; + if (parentIndex >= 0) { + // Current cluster is clustered; transfer contained nodes and edges to parent + var parentClusterNodeId = stack[parentIndex]; + var parentClusterNode = this.body.nodes[parentClusterNodeId]; - if (emitEvent === true) { - this.body.emitter.emit('resize', { - width: Math.round(this.frame.canvas.width / this.pixelRatio), - height: Math.round(this.frame.canvas.height / this.pixelRatio), - oldWidth: Math.round(oldWidth / this.pixelRatio), - oldHeight: Math.round(oldHeight / this.pixelRatio) - }); + // clustering.clusteredNodes and clustering.clusteredEdges remain unchanged + parentClusterNode._openChildCluster(clusterNodeId); - // restore the camera on change. - this._setCameraState(); + // All components of child cluster node have been transferred. It can die now. + delete this.body.nodes[clusterNodeId]; + if (refreshData === true) { + this.body.emitter.emit('_dataChanged'); } - // set initialized so the get and set camera will work from now on. - this.initialized = true; - return emitEvent; - } - }, { - key: 'getContext', - value: function getContext() { - return this.frame.canvas.getContext("2d"); + return; } - /** - * Determine the pixel ratio for various browsers. - * - * @private - */ + // main body + var containedNodes = clusterNode.containedNodes; + var containedEdges = clusterNode.containedEdges; - }, { - key: '_determinePixelRatio', - value: function _determinePixelRatio() { - var ctx = this.getContext(); - if (ctx === undefined) { - throw "Could not get canvax context"; + // allow the user to position the nodes after release. + if (options !== undefined && options.releaseFunction !== undefined && typeof options.releaseFunction === 'function') { + var positions = {}; + var clusterPosition = { x: clusterNode.x, y: clusterNode.y }; + for (var _nodeId3 in containedNodes) { + if (containedNodes.hasOwnProperty(_nodeId3)) { + var containedNode = this.body.nodes[_nodeId3]; + positions[_nodeId3] = { x: containedNode.x, y: containedNode.y }; + } } + var newPositions = options.releaseFunction(clusterPosition, positions); - return (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); + for (var _nodeId4 in containedNodes) { + if (containedNodes.hasOwnProperty(_nodeId4)) { + var _containedNode = this.body.nodes[_nodeId4]; + if (newPositions[_nodeId4] !== undefined) { + _containedNode.x = newPositions[_nodeId4].x === undefined ? clusterNode.x : newPositions[_nodeId4].x; + _containedNode.y = newPositions[_nodeId4].y === undefined ? clusterNode.y : newPositions[_nodeId4].y; + } + } + } + } else { + // copy the position from the cluster + util.forEach(containedNodes, function (containedNode) { + // inherit position + if (containedNode.options.fixed.x === false) { + containedNode.x = clusterNode.x; + } + if (containedNode.options.fixed.y === false) { + containedNode.y = clusterNode.y; + } + }); } - /** - * Lazy determination of pixel ratio. - * - * @private - */ + // release nodes + for (var _nodeId5 in containedNodes) { + if (containedNodes.hasOwnProperty(_nodeId5)) { + var _containedNode2 = this.body.nodes[_nodeId5]; - }, { - key: '_setPixelRatio', - value: function _setPixelRatio() { - this.pixelRatio = this._determinePixelRatio(); - } + // inherit speed + _containedNode2.vx = clusterNode.vx; + _containedNode2.vy = clusterNode.vy; - /** - * Set the transform in the contained context, based on its pixelRatio - */ + _containedNode2.setOptions({ physics: true }); - }, { - key: 'setTransform', - value: function setTransform() { - var ctx = this.getContext(); - if (ctx === undefined) { - throw "Could not get canvax context"; + delete this.clusteredNodes[_nodeId5]; } + } - ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + // copy the clusterNode edges because we cannot iterate over an object that we add or remove from. + var edgesToBeDeleted = []; + for (var i = 0; i < clusterNode.edges.length; i++) { + edgesToBeDeleted.push(clusterNode.edges[i]); } - /** - * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to - * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) - * @param {number} x - * @returns {number} - * @private - */ + // actually handling the deleting. + for (var _i2 = 0; _i2 < edgesToBeDeleted.length; _i2++) { + var edge = edgesToBeDeleted[_i2]; + var otherNodeId = this._getConnectedId(edge, clusterNodeId); + var otherNode = this.clusteredNodes[otherNodeId]; - }, { - key: '_XconvertDOMtoCanvas', - value: function _XconvertDOMtoCanvas(x) { - return (x - this.body.view.translation.x) / this.body.view.scale; - } + for (var j = 0; j < edge.clusteringEdgeReplacingIds.length; j++) { + var transferId = edge.clusteringEdgeReplacingIds[j]; + var transferEdge = this.body.edges[transferId]; + if (transferEdge === undefined) continue; - /** - * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to - * the X coordinate in DOM-space (coordinate point in browser relative to the container div) - * @param {number} x - * @returns {number} - * @private - */ + // if the other node is in another cluster, we transfer ownership of this edge to the other cluster + if (otherNode !== undefined) { + // transfer ownership: + var otherCluster = this.body.nodes[otherNode.clusterId]; + otherCluster.containedEdges[transferEdge.id] = transferEdge; - }, { - key: '_XconvertCanvasToDOM', - value: function _XconvertCanvasToDOM(x) { - return x * this.body.view.scale + this.body.view.translation.x; - } + // delete local reference + delete containedEdges[transferEdge.id]; - /** - * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to - * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) - * @param {number} y - * @returns {number} - * @private - */ + // get to and from + var fromId = transferEdge.fromId; + var toId = transferEdge.toId; + if (transferEdge.toId == otherNodeId) { + toId = otherNode.clusterId; + } else { + fromId = otherNode.clusterId; + } - }, { - key: '_YconvertDOMtoCanvas', - value: function _YconvertDOMtoCanvas(y) { - return (y - this.body.view.translation.y) / this.body.view.scale; - } + // create new cluster edge from the otherCluster + this._createClusteredEdge(fromId, toId, transferEdge, otherCluster.clusterEdgeProperties, { hidden: false, physics: true }); + } else { + this._restoreEdge(transferEdge); + } + } - /** - * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to - * the Y coordinate in DOM-space (coordinate point in browser relative to the container div) - * @param {number} y - * @returns {number} - * @private - */ + edge.remove(); + } - }, { - key: '_YconvertCanvasToDOM', - value: function _YconvertCanvasToDOM(y) { - return y * this.body.view.scale + this.body.view.translation.y; + // handle the releasing of the edges + for (var edgeId in containedEdges) { + if (containedEdges.hasOwnProperty(edgeId)) { + this._restoreEdge(containedEdges[edgeId]); + } } - /** - * - * @param {object} pos = {x: number, y: number} - * @returns {{x: number, y: number}} - * @constructor - */ + // remove clusterNode + delete this.body.nodes[clusterNodeId]; - }, { - key: 'canvasToDOM', - value: function canvasToDOM(pos) { - return { x: this._XconvertCanvasToDOM(pos.x), y: this._YconvertCanvasToDOM(pos.y) }; + if (refreshData === true) { + this.body.emitter.emit('_dataChanged'); } + } - /** - * - * @param {object} pos = {x: number, y: number} - * @returns {{x: number, y: number}} - * @constructor - */ + /** + * + * @param {Cluster.id} clusterId + * @returns {Array.} + */ - }, { - key: 'DOMtoCanvas', - value: function DOMtoCanvas(pos) { - return { x: this._XconvertDOMtoCanvas(pos.x), y: this._YconvertDOMtoCanvas(pos.y) }; + }, { + key: 'getNodesInCluster', + value: function getNodesInCluster(clusterId) { + var nodesArray = []; + if (this.isCluster(clusterId) === true) { + var containedNodes = this.body.nodes[clusterId].containedNodes; + for (var _nodeId6 in containedNodes) { + if (containedNodes.hasOwnProperty(_nodeId6)) { + nodesArray.push(this.body.nodes[_nodeId6].id); + } + } } - }]); - return Canvas; - }(); - exports['default'] = Canvas; - -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + return nodesArray; + } - 'use strict'; + /** + * Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node + * + * If a node can't be found in the chain, return an empty array. + * + * @param {string|number} nodeId + * @returns {Array} + */ - Object.defineProperty(exports, "__esModule", { - value: true - }); + }, { + key: 'findNode', + value: function findNode(nodeId) { + var stack = []; + var max = 100; + var counter = 0; + var node = void 0; - var _classCallCheck2 = __webpack_require__(135); + while (this.clusteredNodes[nodeId] !== undefined && counter < max) { + node = this.body.nodes[nodeId]; + if (node === undefined) return []; + stack.push(node.id); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + nodeId = this.clusteredNodes[nodeId].clusterId; + counter++; + } - var _createClass2 = __webpack_require__(136); + node = this.body.nodes[nodeId]; + if (node === undefined) return []; + stack.push(node.id); - var _createClass3 = _interopRequireDefault(_createClass2); + stack.reverse(); + return stack; + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** + * Using a clustered nodeId, update with the new options + * @param {vis.Edge.id} clusteredNodeId + * @param {object} newOptions + */ - var util = __webpack_require__(1); + }, { + key: 'updateClusteredNode', + value: function updateClusteredNode(clusteredNodeId, newOptions) { + if (clusteredNodeId === undefined) { + throw new Error("No clusteredNodeId supplied to updateClusteredNode."); + } + if (newOptions === undefined) { + throw new Error("No newOptions supplied to updateClusteredNode."); + } + if (this.body.nodes[clusteredNodeId] === undefined) { + throw new Error("The clusteredNodeId supplied to updateClusteredNode does not exist."); + } - var NetworkUtil = __webpack_require__(211)['default']; + this.body.nodes[clusteredNodeId].setOptions(newOptions); + this.body.emitter.emit('_dataChanged'); + } - var View = function () { - function View(body, canvas) { - var _this = this; + /** + * Using a base edgeId, update all related clustered edges with the new options + * @param {vis.Edge.id} startEdgeId + * @param {object} newOptions + */ - (0, _classCallCheck3['default'])(this, View); + }, { + key: 'updateEdge', + value: function updateEdge(startEdgeId, newOptions) { + if (startEdgeId === undefined) { + throw new Error("No startEdgeId supplied to updateEdge."); + } + if (newOptions === undefined) { + throw new Error("No newOptions supplied to updateEdge."); + } + if (this.body.edges[startEdgeId] === undefined) { + throw new Error("The startEdgeId supplied to updateEdge does not exist."); + } - this.body = body; - this.canvas = canvas; + var allEdgeIds = this.getClusteredEdges(startEdgeId); + for (var i = 0; i < allEdgeIds.length; i++) { + var edge = this.body.edges[allEdgeIds[i]]; + edge.setOptions(newOptions); + } + this.body.emitter.emit('_dataChanged'); + } - this.animationSpeed = 1 / this.renderRefreshRate; - this.animationEasingFunction = "easeInOutQuint"; - this.easingTime = 0; - this.sourceScale = 0; - this.targetScale = 0; - this.sourceTranslation = 0; - this.targetTranslation = 0; - this.lockedOnNodeId = undefined; - this.lockedOnNodeOffset = undefined; - this.touchTime = 0; + /** + * Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId) + * @param {vis.Edge.id} edgeId + * @returns {Array.} + */ - this.viewFunction = undefined; + }, { + key: 'getClusteredEdges', + value: function getClusteredEdges(edgeId) { + var stack = []; + var max = 100; + var counter = 0; - this.body.emitter.on("fit", this.fit.bind(this)); - this.body.emitter.on("animationFinished", function () { - _this.body.emitter.emit("_stopRendering"); - }); - this.body.emitter.on("unlockNode", this.releaseNode.bind(this)); + while (edgeId !== undefined && this.body.edges[edgeId] !== undefined && counter < max) { + stack.push(this.body.edges[edgeId].id); + edgeId = this.body.edges[edgeId].edgeReplacedById; + counter++; + } + stack.reverse(); + return stack; } - (0, _createClass3['default'])(View, [{ - key: 'setOptions', - value: function setOptions() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - this.options = options; - } + /** + * Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge + * @param {vis.Edge.id} clusteredEdgeId + * @returns {vis.Edge.id} baseEdgeId + * + * TODO: deprecate in 5.0.0. Method getBaseEdges() is the correct one to use. + */ - /** - * This function zooms out to fit all data on screen based on amount of nodes - * @param {Object} Options - * @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false; - */ + }, { + key: 'getBaseEdge', + value: function getBaseEdge(clusteredEdgeId) { + // Just kludge this by returning the first base edge id found + return this.getBaseEdges(clusteredEdgeId)[0]; + } - }, { - key: 'fit', - value: function fit() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { nodes: [] }; - var initialZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + /** + * Get all regular edges for this clustered edge id. + * + * @param {vis.Edge.id} clusteredEdgeId + * @returns {Array.} all baseEdgeId's under this clustered edge + */ - var range = void 0; - var zoomLevel = void 0; - if (options.nodes === undefined || options.nodes.length === 0) { - options.nodes = this.body.nodeIndices; - } + }, { + key: 'getBaseEdges', + value: function getBaseEdges(clusteredEdgeId) { + var IdsToHandle = [clusteredEdgeId]; + var doneIds = []; + var foundIds = []; + var max = 100; + var counter = 0; + + while (IdsToHandle.length > 0 && counter < max) { + var nextId = IdsToHandle.pop(); + if (nextId === undefined) continue; // Paranoia here and onwards + var nextEdge = this.body.edges[nextId]; + if (nextEdge === undefined) continue; + counter++; + + var replacingIds = nextEdge.clusteringEdgeReplacingIds; + if (replacingIds === undefined) { + // nextId is a base id + foundIds.push(nextId); + } else { + // Another cluster edge, unravel this one as well + for (var i = 0; i < replacingIds.length; ++i) { + var replacingId = replacingIds[i]; - if (initialZoom === true) { - // check if more than half of the nodes have a predefined position. If so, we use the range, not the approximation. - var positionDefined = 0; - for (var nodeId in this.body.nodes) { - if (this.body.nodes.hasOwnProperty(nodeId)) { - var node = this.body.nodes[nodeId]; - if (node.predefinedPosition === true) { - positionDefined += 1; - } + // Don't add if already handled + // TODO: never triggers; find a test-case which does + if (IdsToHandle.indexOf(replacingIds) !== -1 || doneIds.indexOf(replacingIds) !== -1) { + continue; } + + IdsToHandle.push(replacingId); } - if (positionDefined > 0.5 * this.body.nodeIndices.length) { - this.fit(options, false); - return; - } + } + + doneIds.push(nextId); + } - range = NetworkUtil.getRange(this.body.nodes, options.nodes); + return foundIds; + } - var numberOfNodes = this.body.nodeIndices.length; - zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + /** + * Get the Id the node is connected to + * @param {vis.Edge} edge + * @param {Node.id} nodeId + * @returns {*} + * @private + */ - // correct for larger canvasses. - var factor = Math.min(this.canvas.frame.canvas.clientWidth / 600, this.canvas.frame.canvas.clientHeight / 600); - zoomLevel *= factor; - } else { - this.body.emitter.emit("_resizeNodes"); - range = NetworkUtil.getRange(this.body.nodes, options.nodes); + }, { + key: '_getConnectedId', + value: function _getConnectedId(edge, nodeId) { + if (edge.toId != nodeId) { + return edge.toId; + } else if (edge.fromId != nodeId) { + return edge.fromId; + } else { + return edge.fromId; + } + } - var xDistance = Math.abs(range.maxX - range.minX) * 1.1; - var yDistance = Math.abs(range.maxY - range.minY) * 1.1; + /** + * We determine how many connections denote an important hub. + * We take the mean + 2*std as the important hub size. (Assuming a normal distribution of data, ~2.2%) + * + * @returns {number} + * @private + */ - var xZoomLevel = this.canvas.frame.canvas.clientWidth / xDistance; - var yZoomLevel = this.canvas.frame.canvas.clientHeight / yDistance; + }, { + key: '_getHubSize', + value: function _getHubSize() { + var average = 0; + var averageSquared = 0; + var hubCounter = 0; + var largestHub = 0; - zoomLevel = xZoomLevel <= yZoomLevel ? xZoomLevel : yZoomLevel; + for (var i = 0; i < this.body.nodeIndices.length; i++) { + var _node = this.body.nodes[this.body.nodeIndices[i]]; + if (_node.edges.length > largestHub) { + largestHub = _node.edges.length; } + average += _node.edges.length; + averageSquared += Math.pow(_node.edges.length, 2); + hubCounter += 1; + } + average = average / hubCounter; + averageSquared = averageSquared / hubCounter; - if (zoomLevel > 1.0) { - zoomLevel = 1.0; - } else if (zoomLevel === 0) { - zoomLevel = 1.0; - } + var variance = averageSquared - Math.pow(average, 2); + var standardDeviation = Math.sqrt(variance); - var center = NetworkUtil.findCenter(range); - var animationOptions = { position: center, scale: zoomLevel, animation: options.animation }; - this.moveTo(animationOptions); + var hubThreshold = Math.floor(average + 2 * standardDeviation); + + // always have at least one to cluster + if (hubThreshold > largestHub) { + hubThreshold = largestHub; } - // animation + return hubThreshold; + } - /** - * Center a node in view. - * - * @param {Number} nodeId - * @param {Number} [options] - */ + /** + * Create an edge for the cluster representation. + * + * @param {Node.id} fromId + * @param {Node.id} toId + * @param {vis.Edge} baseEdge + * @param {Object} clusterEdgeProperties + * @param {Object} extraOptions + * @returns {Edge} newly created clustered edge + * @private + */ - }, { - key: 'focus', - value: function focus(nodeId) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + }, { + key: '_createClusteredEdge', + value: function _createClusteredEdge(fromId, toId, baseEdge, clusterEdgeProperties, extraOptions) { + // copy the options of the edge we will replace + var clonedOptions = NetworkUtil.cloneOptions(baseEdge, 'edge'); + // make sure the properties of clusterEdges are superimposed on it + util.deepExtend(clonedOptions, clusterEdgeProperties); - if (this.body.nodes[nodeId] !== undefined) { - var nodePosition = { x: this.body.nodes[nodeId].x, y: this.body.nodes[nodeId].y }; - options.position = nodePosition; - options.lockedOnNode = nodeId; + // set up the edge + clonedOptions.from = fromId; + clonedOptions.to = toId; + clonedOptions.id = 'clusterEdge:' + util.randomUUID(); - this.moveTo(options); - } else { - console.log("Node: " + nodeId + " cannot be found."); - } + // apply the edge specific options to it if specified + if (extraOptions !== undefined) { + util.deepExtend(clonedOptions, extraOptions); } - /** - * - * @param {Object} options | options.offset = {x:Number, y:Number} // offset from the center in DOM pixels - * | options.scale = Number // scale to move to - * | options.position = {x:Number, y:Number} // position to move to - * | options.animation = {duration:Number, easingFunction:String} || Boolean // position to move to - */ + var newEdge = this.body.functions.createEdge(clonedOptions); + newEdge.clusteringEdgeReplacingIds = [baseEdge.id]; + newEdge.connect(); - }, { - key: 'moveTo', - value: function moveTo(options) { - if (options === undefined) { - options = {}; - return; - } - if (options.offset === undefined) { - options.offset = { x: 0, y: 0 }; - } - if (options.offset.x === undefined) { - options.offset.x = 0; - } - if (options.offset.y === undefined) { - options.offset.y = 0; - } - if (options.scale === undefined) { - options.scale = this.body.view.scale; - } - if (options.position === undefined) { - options.position = this.getViewPosition(); - } - if (options.animation === undefined) { - options.animation = { duration: 0 }; - } - if (options.animation === false) { - options.animation = { duration: 0 }; - } - if (options.animation === true) { - options.animation = {}; - } - if (options.animation.duration === undefined) { - options.animation.duration = 1000; - } // default duration - if (options.animation.easingFunction === undefined) { - options.animation.easingFunction = "easeInOutQuad"; - } // default easing function + // Register the new edge + this.body.edges[newEdge.id] = newEdge; - this.animateView(options); - } + return newEdge; + } - /** - * - * @param {Object} options | options.offset = {x:Number, y:Number} // offset from the center in DOM pixels - * | options.time = Number // animation time in milliseconds - * | options.scale = Number // scale to animate to - * | options.position = {x:Number, y:Number} // position to animate to - * | options.easingFunction = String // linear, easeInQuad, easeOutQuad, easeInOutQuad, - * // easeInCubic, easeOutCubic, easeInOutCubic, - * // easeInQuart, easeOutQuart, easeInOutQuart, - * // easeInQuint, easeOutQuint, easeInOutQuint - */ + /** + * Add the passed child nodes and edges to the given cluster node. + * + * @param {Object|Node} childNodes hash of nodes or single node to add in cluster + * @param {Object|Edge} childEdges hash of edges or single edge to take into account when clustering + * @param {Node} clusterNode cluster node to add nodes and edges to + * @param {Object} [clusterEdgeProperties] + * @private + */ - }, { - key: 'animateView', - value: function animateView(options) { - if (options === undefined) { - return; - } - this.animationEasingFunction = options.animation.easingFunction; - // release if something focussed on the node - this.releaseNode(); - if (options.locked === true) { - this.lockedOnNodeId = options.lockedOnNode; - this.lockedOnNodeOffset = options.offset; - } + }, { + key: '_clusterEdges', + value: function _clusterEdges(childNodes, childEdges, clusterNode, clusterEdgeProperties) { + if (childEdges instanceof Edge) { + var edge = childEdges; + var obj = {}; + obj[edge.id] = edge; + childEdges = obj; + } - // forcefully complete the old animation if it was still running - if (this.easingTime != 0) { - this._transitionRedraw(true); // by setting easingtime to 1, we finish the animation. - } + if (childNodes instanceof Node) { + var _node2 = childNodes; + var _obj = {}; + _obj[_node2.id] = _node2; + childNodes = _obj; + } - this.sourceScale = this.body.view.scale; - this.sourceTranslation = this.body.view.translation; - this.targetScale = options.scale; + if (clusterNode === undefined || clusterNode === null) { + throw new Error("_clusterEdges: parameter clusterNode required"); + } - // set the scale so the viewCenter is based on the correct zoom level. This is overridden in the transitionRedraw - // but at least then we'll have the target transition - this.body.view.scale = this.targetScale; - var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); + if (clusterEdgeProperties === undefined) { + // Take the required properties from the cluster node + clusterEdgeProperties = clusterNode.clusterEdgeProperties; + } - var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node - x: viewCenter.x - options.position.x, - y: viewCenter.y - options.position.y - }; - this.targetTranslation = { - x: this.sourceTranslation.x + distanceFromCenter.x * this.targetScale + options.offset.x, - y: this.sourceTranslation.y + distanceFromCenter.y * this.targetScale + options.offset.y - }; + // create the new edges that will connect to the cluster. + // All self-referencing edges will be added to childEdges here. + this._createClusterEdges(childNodes, childEdges, clusterNode, clusterEdgeProperties); - // if the time is set to 0, don't do an animation - if (options.animation.duration === 0) { - if (this.lockedOnNodeId != undefined) { - this.viewFunction = this._lockedRedraw.bind(this); - this.body.emitter.on("initRedraw", this.viewFunction); - } else { - this.body.view.scale = this.targetScale; - this.body.view.translation = this.targetTranslation; - this.body.emitter.emit("_requestRedraw"); + // disable the childEdges + for (var edgeId in childEdges) { + if (childEdges.hasOwnProperty(edgeId)) { + if (this.body.edges[edgeId] !== undefined) { + var _edge2 = this.body.edges[edgeId]; + // cache the options before changing + this._backupEdgeOptions(_edge2); + // disable physics and hide the edge + _edge2.setOptions({ physics: false }); } - } else { - this.animationSpeed = 1 / (60 * options.animation.duration * 0.001) || 1 / 60; // 60 for 60 seconds, 0.001 for milli's - this.animationEasingFunction = options.animation.easingFunction; - - this.viewFunction = this._transitionRedraw.bind(this); - this.body.emitter.on("initRedraw", this.viewFunction); - this.body.emitter.emit("_startRendering"); } } - /** - * used to animate smoothly by hijacking the redraw function. - * @private - */ + // disable the childNodes + for (var _nodeId7 in childNodes) { + if (childNodes.hasOwnProperty(_nodeId7)) { + this.clusteredNodes[_nodeId7] = { clusterId: clusterNode.id, node: this.body.nodes[_nodeId7] }; + this.body.nodes[_nodeId7].setOptions({ physics: false }); + } + } + } - }, { - key: '_lockedRedraw', - value: function _lockedRedraw() { - var nodePosition = { x: this.body.nodes[this.lockedOnNodeId].x, y: this.body.nodes[this.lockedOnNodeId].y }; - var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); - var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node - x: viewCenter.x - nodePosition.x, - y: viewCenter.y - nodePosition.y - }; - var sourceTranslation = this.body.view.translation; - var targetTranslation = { - x: sourceTranslation.x + distanceFromCenter.x * this.body.view.scale + this.lockedOnNodeOffset.x, - y: sourceTranslation.y + distanceFromCenter.y * this.body.view.scale + this.lockedOnNodeOffset.y - }; - - this.body.view.translation = targetTranslation; - } - }, { - key: 'releaseNode', - value: function releaseNode() { - if (this.lockedOnNodeId !== undefined && this.viewFunction !== undefined) { - this.body.emitter.off("initRedraw", this.viewFunction); - this.lockedOnNodeId = undefined; - this.lockedOnNodeOffset = undefined; - } - } + /** + * Determine in which cluster given nodeId resides. + * + * If not in cluster, return undefined. + * + * NOTE: If you know a cleaner way to do this, please enlighten me (wimrijnders). + * + * @param {Node.id} nodeId + * @returns {Node|undefined} Node instance for cluster, if present + * @private + */ - /** - * - * @param easingTime - * @private - */ + }, { + key: '_getClusterNodeForNode', + value: function _getClusterNodeForNode(nodeId) { + if (nodeId === undefined) return undefined; + var clusteredNode = this.clusteredNodes[nodeId]; - }, { - key: '_transitionRedraw', - value: function _transitionRedraw() { - var finished = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + // NOTE: If no cluster info found, it should actually be an error + if (clusteredNode === undefined) return undefined; + var clusterId = clusteredNode.clusterId; + if (clusterId === undefined) return undefined; - this.easingTime += this.animationSpeed; - this.easingTime = finished === true ? 1.0 : this.easingTime; + return this.body.nodes[clusterId]; + } - var progress = util.easingFunctions[this.animationEasingFunction](this.easingTime); + /** + * Internal helper function for conditionally removing items in array + * + * Done like this because Array.filter() is not fully supported by all IE's. + * + * @param {Array} arr + * @param {function} callback + * @returns {Array} + * @private + */ - this.body.view.scale = this.sourceScale + (this.targetScale - this.sourceScale) * progress; - this.body.view.translation = { - x: this.sourceTranslation.x + (this.targetTranslation.x - this.sourceTranslation.x) * progress, - y: this.sourceTranslation.y + (this.targetTranslation.y - this.sourceTranslation.y) * progress - }; + }, { + key: '_filter', + value: function _filter(arr, callback) { + var ret = []; - // cleanup - if (this.easingTime >= 1.0) { - this.body.emitter.off("initRedraw", this.viewFunction); - this.easingTime = 0; - if (this.lockedOnNodeId != undefined) { - this.viewFunction = this._lockedRedraw.bind(this); - this.body.emitter.on("initRedraw", this.viewFunction); - } - this.body.emitter.emit("animationFinished"); + util.forEach(arr, function (item) { + if (callback(item)) { + ret.push(item); } - } - }, { - key: 'getScale', - value: function getScale() { - return this.body.view.scale; - } - }, { - key: 'getViewPosition', - value: function getViewPosition() { - return this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); - } - }]); - return View; - }(); + }); - exports['default'] = View; + return ret; + } -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Scan all edges for changes in clustering and adjust this if necessary. + * + * Call this (internally) after there has been a change in node or edge data. + * + * Pre: States of this.body.nodes and this.body.edges consistent + * Pre: this.clusteredNodes and this.clusteredEdge consistent with containedNodes and containedEdges + * of cluster nodes. + */ - 'use strict'; + }, { + key: '_updateState', + value: function _updateState() { + var _this4 = this; - Object.defineProperty(exports, "__esModule", { - value: true - }); + var nodeId = void 0; + var deletedNodeIds = []; + var deletedEdgeIds = []; - var _classCallCheck2 = __webpack_require__(135); + /** + * Utility function to iterate over clustering nodes only + * + * @param {Function} callback function to call for each cluster node + */ + var eachClusterNode = function eachClusterNode(callback) { + util.forEach(_this4.body.nodes, function (node) { + if (node.isCluster === true) { + callback(node); + } + }); + }; - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + // + // Remove deleted regular nodes from clustering + // - var _createClass2 = __webpack_require__(136); + // Determine the deleted nodes + for (nodeId in this.clusteredNodes) { + if (!this.clusteredNodes.hasOwnProperty(nodeId)) continue; + var _node3 = this.body.nodes[nodeId]; - var _createClass3 = _interopRequireDefault(_createClass2); + if (_node3 === undefined) { + deletedNodeIds.push(nodeId); + } + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + // Remove nodes from cluster nodes + eachClusterNode(function (clusterNode) { + for (var n = 0; n < deletedNodeIds.length; n++) { + delete clusterNode.containedNodes[deletedNodeIds[n]]; + } + }); - var util = __webpack_require__(1); + // Remove nodes from cluster list + for (var n = 0; n < deletedNodeIds.length; n++) { + delete this.clusteredNodes[deletedNodeIds[n]]; + } - var NavigationHandler = __webpack_require__(227)['default']; - var Popup = __webpack_require__(134)['default']; + // + // Remove deleted edges from clustering + // - var InteractionHandler = function () { - function InteractionHandler(body, canvas, selectionHandler) { - (0, _classCallCheck3['default'])(this, InteractionHandler); + // Add the deleted clustered edges to the list + util.forEach(this.clusteredEdges, function (edgeId) { + var edge = _this4.body.edges[edgeId]; + if (edge === undefined || !edge.endPointsValid()) { + deletedEdgeIds.push(edgeId); + } + }); - this.body = body; - this.canvas = canvas; - this.selectionHandler = selectionHandler; - this.navigationHandler = new NavigationHandler(body, canvas); + // Cluster nodes can also contain edges which are not clustered, + // i.e. nodes 1-2 within cluster with an edge in between. + // So the cluster nodes also need to be scanned for invalid edges + eachClusterNode(function (clusterNode) { + util.forEach(clusterNode.containedEdges, function (edge, edgeId) { + if (!edge.endPointsValid() && deletedEdgeIds.indexOf(edgeId) === -1) { + deletedEdgeIds.push(edgeId); + } + }); + }); - // bind the events from hammer to functions in this object - this.body.eventListeners.onTap = this.onTap.bind(this); - this.body.eventListeners.onTouch = this.onTouch.bind(this); - this.body.eventListeners.onDoubleTap = this.onDoubleTap.bind(this); - this.body.eventListeners.onHold = this.onHold.bind(this); - this.body.eventListeners.onDragStart = this.onDragStart.bind(this); - this.body.eventListeners.onDrag = this.onDrag.bind(this); - this.body.eventListeners.onDragEnd = this.onDragEnd.bind(this); - this.body.eventListeners.onMouseWheel = this.onMouseWheel.bind(this); - this.body.eventListeners.onPinch = this.onPinch.bind(this); - this.body.eventListeners.onMouseMove = this.onMouseMove.bind(this); - this.body.eventListeners.onRelease = this.onRelease.bind(this); - this.body.eventListeners.onContext = this.onContext.bind(this); + // Also scan for cluster edges which need to be removed in the active list. + // Regular edges have been removed beforehand, so this only picks up the cluster edges. + util.forEach(this.body.edges, function (edge, edgeId) { + // Explicitly scan the contained edges for validity + var isValid = true; + var replacedIds = edge.clusteringEdgeReplacingIds; + if (replacedIds !== undefined) { + var numValid = 0; - this.touchTime = 0; - this.drag = {}; - this.pinch = {}; - this.popup = undefined; - this.popupObj = undefined; - this.popupTimer = undefined; - - this.body.functions.getPointer = this.getPointer.bind(this); - - this.options = {}; - this.defaultOptions = { - dragNodes: true, - dragView: true, - hover: false, - keyboard: { - enabled: false, - speed: { x: 10, y: 10, zoom: 0.02 }, - bindToWindow: true - }, - navigationButtons: false, - tooltipDelay: 300, - zoomView: true - }; - util.extend(this.options, this.defaultOptions); + util.forEach(replacedIds, function (containedEdgeId) { + var containedEdge = _this4.body.edges[containedEdgeId]; - this.bindEventListeners(); - } + if (containedEdge !== undefined && containedEdge.endPointsValid()) { + numValid += 1; + } + }); - (0, _createClass3['default'])(InteractionHandler, [{ - key: 'bindEventListeners', - value: function bindEventListeners() { - var _this = this; + isValid = numValid > 0; + } - this.body.emitter.on('destroy', function () { - clearTimeout(_this.popupTimer); - delete _this.body.functions.getPointer; - }); - } - }, { - key: 'setOptions', - value: function setOptions(options) { - if (options !== undefined) { - // extend all but the values in fields - var fields = ['hideEdgesOnDrag', 'hideNodesOnDrag', 'keyboard', 'multiselect', 'selectable', 'selectConnectedEdges']; - util.selectiveNotDeepExtend(fields, this.options, options); - - // merge the keyboard options in. - util.mergeOptions(this.options, options, 'keyboard'); - - if (options.tooltip) { - util.extend(this.options.tooltip, options.tooltip); - if (options.tooltip.color) { - this.options.tooltip.color = util.parseColor(options.tooltip.color); - } - } + if (!edge.endPointsValid() || !isValid) { + deletedEdgeIds.push(edgeId); } + }); - this.navigationHandler.setOptions(this.options); - } + // Remove edges from cluster nodes + eachClusterNode(function (clusterNode) { + util.forEach(deletedEdgeIds, function (deletedEdgeId) { + delete clusterNode.containedEdges[deletedEdgeId]; - /** - * Get the pointer location from a touch location - * @param {{x: Number, y: Number}} touch - * @return {{x: Number, y: Number}} pointer - * @private - */ + util.forEach(clusterNode.edges, function (edge, m) { + if (edge.id === deletedEdgeId) { + clusterNode.edges[m] = null; // Don't want to directly delete here, because in the loop + return; + } - }, { - key: 'getPointer', - value: function getPointer(touch) { - return { - x: touch.x - util.getAbsoluteLeft(this.canvas.frame.canvas), - y: touch.y - util.getAbsoluteTop(this.canvas.frame.canvas) - }; - } + edge.clusteringEdgeReplacingIds = _this4._filter(edge.clusteringEdgeReplacingIds, function (id) { + return deletedEdgeIds.indexOf(id) === -1; + }); + }); - /** - * On start of a touch gesture, store the pointer - * @param event - * @private - */ + // Clean up the nulls + clusterNode.edges = _this4._filter(clusterNode.edges, function (item) { + return item !== null; + }); + }); + }); - }, { - key: 'onTouch', - value: function onTouch(event) { - if (new Date().valueOf() - this.touchTime > 50) { - this.drag.pointer = this.getPointer(event.center); - this.drag.pinched = false; - this.pinch.scale = this.body.view.scale; - // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame) - this.touchTime = new Date().valueOf(); - } - } + // Remove from cluster list + util.forEach(deletedEdgeIds, function (edgeId) { + delete _this4.clusteredEdges[edgeId]; + }); - /** - * handle tap/click event: select/unselect a node - * @private - */ + // Remove cluster edges from active list (this.body.edges). + // deletedEdgeIds still contains id of regular edges, but these should all + // be gone when you reach here. + util.forEach(deletedEdgeIds, function (edgeId) { + delete _this4.body.edges[edgeId]; + }); - }, { - key: 'onTap', - value: function onTap(event) { - var pointer = this.getPointer(event.center); - var multiselect = this.selectionHandler.options.multiselect && (event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey); + // + // Check changed cluster state of edges + // - this.checkSelectionChanges(pointer, event, multiselect); - this.selectionHandler._generateClickEvent('click', event, pointer); - } + // Iterating over keys here, because edges may be removed in the loop + var ids = (0, _keys2['default'])(this.body.edges); + util.forEach(ids, function (edgeId) { + var edge = _this4.body.edges[edgeId]; - /** - * handle doubletap event - * @private - */ + var shouldBeClustered = _this4._isClusteredNode(edge.fromId) || _this4._isClusteredNode(edge.toId); + if (shouldBeClustered === _this4._isClusteredEdge(edge.id)) { + return; // all is well + } - }, { - key: 'onDoubleTap', - value: function onDoubleTap(event) { - var pointer = this.getPointer(event.center); - this.selectionHandler._generateClickEvent('doubleClick', event, pointer); - } + if (shouldBeClustered) { + // add edge to clustering + var clusterFrom = _this4._getClusterNodeForNode(edge.fromId); + if (clusterFrom !== undefined) { + _this4._clusterEdges(_this4.body.nodes[edge.fromId], edge, clusterFrom); + } - /** - * handle long tap event: multi select nodes - * @private - */ + var clusterTo = _this4._getClusterNodeForNode(edge.toId); + if (clusterTo !== undefined) { + _this4._clusterEdges(_this4.body.nodes[edge.toId], edge, clusterTo); + } - }, { - key: 'onHold', - value: function onHold(event) { - var pointer = this.getPointer(event.center); - var multiselect = this.selectionHandler.options.multiselect; + // TODO: check that it works for both edges clustered + // (This might be paranoia) + } else { + // This should not be happening, the state should + // be properly updated at this point. + // + // If it *is* reached during normal operation, then we have to implement + // undo clustering for this edge here. + throw new Error('remove edge from clustering not implemented!'); + } + }); - this.checkSelectionChanges(pointer, event, multiselect); + // Clusters may be nested to any level. Keep on opening until nothing to open + var changed = false; + var continueLoop = true; - this.selectionHandler._generateClickEvent('click', event, pointer); - this.selectionHandler._generateClickEvent('hold', event, pointer); - } + var _loop2 = function _loop2() { + var clustersToOpen = []; - /** - * handle the release of the screen - * - * @private - */ + // Determine the id's of clusters that need opening + eachClusterNode(function (clusterNode) { + var numNodes = (0, _keys2['default'])(clusterNode.containedNodes).length; + var allowSingle = clusterNode.options.allowSingleNodeCluster === true; + if (allowSingle && numNodes < 1 || !allowSingle && numNodes < 2) { + clustersToOpen.push(clusterNode.id); + } + }); - }, { - key: 'onRelease', - value: function onRelease(event) { - if (new Date().valueOf() - this.touchTime > 10) { - var pointer = this.getPointer(event.center); - this.selectionHandler._generateClickEvent('release', event, pointer); - // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame) - this.touchTime = new Date().valueOf(); + // Open them + for (var _n = 0; _n < clustersToOpen.length; ++_n) { + _this4.openCluster(clustersToOpen[_n], {}, false /* Don't refresh, we're in an refresh/update already */); } - } - }, { - key: 'onContext', - value: function onContext(event) { - var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); - this.selectionHandler._generateClickEvent('oncontext', event, pointer); - } - /** - * Select and deselect nodes depending current selection change. - * - * For changing nodes, select/deselect events are fired. - * - * NOTE: For a given edge, if one connecting node is deselected and with the same - * click the other node is selected, no events for the edge will fire. - * It was selected and it will remain selected. - * - * TODO: This is all SelectionHandler calls; the method should be moved to there. - * - * @param pointer - * @param add - */ + continueLoop = clustersToOpen.length > 0; + changed = changed || continueLoop; + }; - }, { - key: 'checkSelectionChanges', - value: function checkSelectionChanges(pointer, event) { - var add = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - var previousSelection = this.selectionHandler.getSelection(); - var selected = false; - if (add === true) { - selected = this.selectionHandler.selectAdditionalOnPoint(pointer); - } else { - selected = this.selectionHandler.selectOnPoint(pointer); - } - var currentSelection = this.selectionHandler.getSelection(); + while (continueLoop) { + _loop2(); + } - // See NOTE in method comment for the reason to do it like this - var deselectedItems = this._determineDifference(previousSelection, currentSelection); - var selectedItems = this._determineDifference(currentSelection, previousSelection); + if (changed) { + this._updateState(); // Redo this method (recursion possible! should be safe) + } + } - if (deselectedItems.edges.length > 0) { - this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection); - selected = true; - } + /** + * Determine if node with given id is part of a cluster. + * + * @param {Node.id} nodeId + * @return {boolean} true if part of a cluster. + */ - if (deselectedItems.nodes.length > 0) { - this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection); - selected = true; - } + }, { + key: '_isClusteredNode', + value: function _isClusteredNode(nodeId) { + return this.clusteredNodes[nodeId] !== undefined; + } - if (selectedItems.nodes.length > 0) { - this.selectionHandler._generateClickEvent('selectNode', event, pointer); - selected = true; - } + /** + * Determine if edge with given id is not visible due to clustering. + * + * An edge is considered clustered if: + * - it is directly replaced by a clustering edge + * - any of its connecting nodes is in a cluster + * + * @param {vis.Edge.id} edgeId + * @return {boolean} true if part of a cluster. + */ - if (selectedItems.edges.length > 0) { - this.selectionHandler._generateClickEvent('selectEdge', event, pointer); - selected = true; - } + }, { + key: '_isClusteredEdge', + value: function _isClusteredEdge(edgeId) { + return this.clusteredEdges[edgeId] !== undefined; + } + }]); + return ClusterEngine; +}(); - // fire the select event if anything has been selected or deselected - if (selected === true) { - // select or unselect - this.selectionHandler._generateClickEvent('select', event, pointer); - } - } +exports['default'] = ClusterEngine; - /** - * Remove all node and edge id's from the first set that are present in the second one. - * - * @param firstSet - * @param secondSet - * @returns {{nodes: array, edges: array}} - * @private - */ +/***/ }), +/* 228 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: '_determineDifference', - value: function _determineDifference(firstSet, secondSet) { - var arrayDiff = function arrayDiff(firstArr, secondArr) { - var result = []; - - for (var i = 0; i < firstArr.length; i++) { - var value = firstArr[i]; - if (secondArr.indexOf(value) === -1) { - result.push(value); - } - } +"use strict"; - return result; - }; - return { - nodes: arrayDiff(firstSet.nodes, secondSet.nodes), - edges: arrayDiff(firstSet.edges, secondSet.edges) - }; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * This function is called by onDragStart. - * It is separated out because we can then overload it for the datamanipulation system. - * - * @private - */ +var _getPrototypeOf = __webpack_require__(3); - }, { - key: 'onDragStart', - value: function onDragStart(event) { - //in case the touch event was triggered on an external div, do the initial touch now. - if (this.drag.pointer === undefined) { - this.onTouch(event); - } - - // note: drag.pointer is set in onTouch to get the initial touch location - var node = this.selectionHandler.getNodeAt(this.drag.pointer); - - this.drag.dragging = true; - this.drag.selection = []; - this.drag.translation = util.extend({}, this.body.view.translation); // copy the object - this.drag.nodeId = undefined; - - if (node !== undefined && this.options.dragNodes === true) { - this.drag.nodeId = node.id; - // select the clicked node if not yet selected - if (node.isSelected() === false) { - this.selectionHandler.unselectAll(); - this.selectionHandler.selectObject(node); - } - - // after select to contain the node - this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer); - - var selection = this.selectionHandler.selectionObj.nodes; - // create an array with the selected nodes and their original location and status - for (var nodeId in selection) { - if (selection.hasOwnProperty(nodeId)) { - var object = selection[nodeId]; - var s = { - id: object.id, - node: object, - - // store original x, y, xFixed and yFixed, make the node temporarily Fixed - x: object.x, - y: object.y, - xFixed: object.options.fixed.x, - yFixed: object.options.fixed.y - }; +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); - object.options.fixed.x = true; - object.options.fixed.y = true; +var _classCallCheck2 = __webpack_require__(0); - this.drag.selection.push(s); - } - } - } else { - // fallback if no node is selected and thus the view is dragged. - this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer, undefined, true); - } - } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - /** - * handle drag event - * @private - */ +var _createClass2 = __webpack_require__(1); - }, { - key: 'onDrag', - value: function onDrag(event) { - var _this2 = this; +var _createClass3 = _interopRequireDefault(_createClass2); - if (this.drag.pinched === true) { - return; - } +var _possibleConstructorReturn2 = __webpack_require__(4); - // remove the focus on node if it is focussed on by the focusOnNode - this.body.emitter.emit('unlockNode'); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - var pointer = this.getPointer(event.center); +var _inherits2 = __webpack_require__(5); - var selection = this.drag.selection; - if (selection && selection.length && this.options.dragNodes === true) { - this.selectionHandler._generateClickEvent('dragging', event, pointer); +var _inherits3 = _interopRequireDefault(_inherits2); - // calculate delta's and new location - var deltaX = pointer.x - this.drag.pointer.x; - var deltaY = pointer.y - this.drag.pointer.y; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - // update position of all selected nodes - selection.forEach(function (selection) { - var node = selection.node; - // only move the node if it was not fixed initially - if (selection.xFixed === false) { - node.x = _this2.canvas._XconvertDOMtoCanvas(_this2.canvas._XconvertCanvasToDOM(selection.x) + deltaX); - } - // only move the node if it was not fixed initially - if (selection.yFixed === false) { - node.y = _this2.canvas._YconvertDOMtoCanvas(_this2.canvas._YconvertCanvasToDOM(selection.y) + deltaY); - } - }); +var util = __webpack_require__(2); +var Node = __webpack_require__(47)["default"]; - // start the simulation of the physics - this.body.emitter.emit('startSimulation'); - } else { - // move the network - if (this.options.dragView === true) { - this.selectionHandler._generateClickEvent('dragging', event, pointer, undefined, true); +/** + * A Cluster is a special Node that allows a group of Nodes positioned closely together + * to be represented by a single Cluster Node. + * + * @extends Node + */ - // if the drag was not started properly because the click started outside the network div, start it now. - if (this.drag.pointer === undefined) { - this.onDragStart(event); - return; - } - var diffX = pointer.x - this.drag.pointer.x; - var diffY = pointer.y - this.drag.pointer.y; +var Cluster = function (_Node) { + (0, _inherits3["default"])(Cluster, _Node); - this.body.view.translation = { x: this.drag.translation.x + diffX, y: this.drag.translation.y + diffY }; - this.body.emitter.emit('_redraw'); - } - } - } + /** + * @param {Object} options + * @param {Object} body + * @param {Array.}imagelist + * @param {Array} grouplist + * @param {Object} globalOptions + * @param {Object} defaultOptions Global default options for nodes + */ + function Cluster(options, body, imagelist, grouplist, globalOptions, defaultOptions) { + (0, _classCallCheck3["default"])(this, Cluster); - /** - * handle drag start event - * @private - */ + var _this = (0, _possibleConstructorReturn3["default"])(this, (Cluster.__proto__ || (0, _getPrototypeOf2["default"])(Cluster)).call(this, options, body, imagelist, grouplist, globalOptions, defaultOptions)); - }, { - key: 'onDragEnd', - value: function onDragEnd(event) { - this.drag.dragging = false; - var selection = this.drag.selection; - if (selection && selection.length) { - selection.forEach(function (s) { - // restore original xFixed and yFixed - s.node.options.fixed.x = s.xFixed; - s.node.options.fixed.y = s.yFixed; - }); - this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center)); - this.body.emitter.emit('startSimulation'); - } else { - this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center), undefined, true); - this.body.emitter.emit('_requestRedraw'); - } - } + _this.isCluster = true; + _this.containedNodes = {}; + _this.containedEdges = {}; + return _this; + } - /** - * Handle pinch event - * @param event - * @private - */ + /** + * Transfer child cluster data to current and disconnect the child cluster. + * + * Please consult the header comment in 'Clustering.js' for the fields set here. + * + * @param {string|number} childClusterId id of child cluster to open + */ - }, { - key: 'onPinch', - value: function onPinch(event) { - var pointer = this.getPointer(event.center); - this.drag.pinched = true; - if (this.pinch['scale'] === undefined) { - this.pinch.scale = 1; - } + (0, _createClass3["default"])(Cluster, [{ + key: "_openChildCluster", + value: function _openChildCluster(childClusterId) { + var _this2 = this; - // TODO: enabled moving while pinching? - var scale = this.pinch.scale * event.scale; - this.zoom(scale, pointer); + var childCluster = this.body.nodes[childClusterId]; + if (this.containedNodes[childClusterId] === undefined) { + throw new Error('node with id: ' + childClusterId + ' not in current cluster'); + } + if (!childCluster.isCluster) { + throw new Error('node with id: ' + childClusterId + ' is not a cluster'); } - /** - * Zoom the network in or out - * @param {Number} scale a number around 1, and between 0.01 and 10 - * @param {{x: Number, y: Number}} pointer Position on screen - * @return {Number} appliedScale scale is limited within the boundaries - * @private - */ + // Disconnect child cluster from current cluster + delete this.containedNodes[childClusterId]; + util.forEach(childCluster.edges, function (edge) { + delete _this2.containedEdges[edge.id]; + }); - }, { - key: 'zoom', - value: function zoom(scale, pointer) { - if (this.options.zoomView === true) { - var scaleOld = this.body.view.scale; - if (scale < 0.00001) { - scale = 0.00001; - } - if (scale > 10) { - scale = 10; - } + // Transfer nodes and edges + util.forEach(childCluster.containedNodes, function (node, nodeId) { + _this2.containedNodes[nodeId] = node; + }); + childCluster.containedNodes = {}; - var preScaleDragPointer = undefined; - if (this.drag !== undefined) { - if (this.drag.dragging === true) { - preScaleDragPointer = this.canvas.DOMtoCanvas(this.drag.pointer); - } - } - // + this.canvas.frame.canvas.clientHeight / 2 - var translation = this.body.view.translation; + util.forEach(childCluster.containedEdges, function (edge, edgeId) { + _this2.containedEdges[edgeId] = edge; + }); + childCluster.containedEdges = {}; - var scaleFrac = scale / scaleOld; - var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac; - var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac; + // Transfer edges within cluster edges which are clustered + util.forEach(childCluster.edges, function (clusterEdge) { + util.forEach(_this2.edges, function (parentClusterEdge) { + // Assumption: a clustered edge can only be present in a single clustering edge + // Not tested here + var index = parentClusterEdge.clusteringEdgeReplacingIds.indexOf(clusterEdge.id); + if (index === -1) return; - this.body.view.scale = scale; - this.body.view.translation = { x: tx, y: ty }; + util.forEach(clusterEdge.clusteringEdgeReplacingIds, function (srcId) { + parentClusterEdge.clusteringEdgeReplacingIds.push(srcId); - if (preScaleDragPointer != undefined) { - var postScaleDragPointer = this.canvas.canvasToDOM(preScaleDragPointer); - this.drag.pointer.x = postScaleDragPointer.x; - this.drag.pointer.y = postScaleDragPointer.y; - } + // Maintain correct bookkeeping for transferred edge + _this2.body.edges[srcId].edgeReplacedById = parentClusterEdge.id; + }); - this.body.emitter.emit('_requestRedraw'); + // Remove cluster edge from parent cluster edge + parentClusterEdge.clusteringEdgeReplacingIds.splice(index, 1); + }); + }); + childCluster.edges = []; + } + }]); + return Cluster; +}(Node); - if (scaleOld < scale) { - this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: pointer }); - } else { - this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: pointer }); - } - } - } +exports["default"] = Cluster; - /** - * Event handler for mouse wheel event, used to zoom the timeline - * See http://adomas.org/javascript-mouse-wheel/ - * https://github.com/EightMedia/hammer.js/issues/256 - * @param {MouseEvent} event - * @private - */ +/***/ }), +/* 229 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: 'onMouseWheel', - value: function onMouseWheel(event) { - if (this.options.zoomView === true) { - // retrieve delta - var delta = 0; - if (event.wheelDelta) { - /* IE/Opera. */ - delta = event.wheelDelta / 120; - } else if (event.detail) { - /* Mozilla case. */ - // In Mozilla, sign of delta is different than in IE. - // Also, delta is multiple of 3. - delta = -event.detail / 3; - } - - // If delta is nonzero, handle it. - // Basically, delta is now positive if wheel was scrolled up, - // and negative, if wheel was scrolled down. - if (delta !== 0) { - - // calculate the new scale - var scale = this.body.view.scale; - var zoom = delta / 10; - if (delta < 0) { - zoom = zoom / (1 - zoom); - } - scale *= 1 + zoom; +"use strict"; - // calculate the pointer location - var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); - // apply the new scale - this.zoom(scale, pointer); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - // Prevent default actions caused by mouse wheel. - event.preventDefault(); - } - } +var _classCallCheck2 = __webpack_require__(0); - /** - * Mouse move handler for checking whether the title moves over a node with a title. - * @param {Event} event - * @private - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - }, { - key: 'onMouseMove', - value: function onMouseMove(event) { - var _this3 = this; +var _createClass2 = __webpack_require__(1); - var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); - var popupVisible = false; +var _createClass3 = _interopRequireDefault(_createClass2); - // check if the previously selected node is still selected - if (this.popup !== undefined) { - if (this.popup.hidden === false) { - this._checkHidePopup(pointer); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - // if the popup was not hidden above - if (this.popup.hidden === false) { - popupVisible = true; - this.popup.setPosition(pointer.x + 3, pointer.y - 5); - this.popup.show(); - } - } +/** + * Initializes window.requestAnimationFrame() to a usable form. + * + * Specifically, set up this method for the case of running on node.js with jsdom enabled. + * + * NOTES: + * + * * On node.js, when calling this directly outside of this class, `window` is not defined. + * This happens even if jsdom is used. + * * For node.js + jsdom, `window` is available at the moment the constructor is called. + * For this reason, the called is placed within the constructor. + * * Even then, `window.requestAnimationFrame()` is not defined, so it still needs to be added. + * * During unit testing, it happens that the window object is reset during execution, causing + * a runtime error due to missing `requestAnimationFrame()`. This needs to be compensated for, + * see `_requestNextFrame()`. + * * Since this is a global object, it may affect other modules besides `Network`. With normal + * usage, this does not cause any problems. During unit testing, errors may occur. These have + * been compensated for, see comment block in _requestNextFrame(). + * + * @private + */ +function _initRequestAnimationFrame() { + var func; - // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over. - if (this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true) { - this.canvas.frame.focus(); - } + if (window !== undefined) { + func = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame; + } - // start a timeout that will check if the mouse is positioned above an element - if (popupVisible === false) { - if (this.popupTimer !== undefined) { - clearInterval(this.popupTimer); // stop any running calculationTimer - this.popupTimer = undefined; - } - if (!this.drag.dragging) { - this.popupTimer = setTimeout(function () { - return _this3._checkShowPopup(pointer); - }, this.options.tooltipDelay); - } - } + if (func === undefined) { + // window or method not present, setting mock requestAnimationFrame + window.requestAnimationFrame = function (callback) { + //console.log("Called mock requestAnimationFrame"); + callback(); + }; + } else { + window.requestAnimationFrame = func; + } +} - /** - * Adding hover highlights - */ - if (this.options.hover === true) { - // adding hover highlights - var obj = this.selectionHandler.getNodeAt(pointer); - if (obj === undefined) { - obj = this.selectionHandler.getEdgeAt(pointer); - } - this.selectionHandler.hoverObject(obj); - } - } +var util = __webpack_require__(2); - /** - * Check if there is an element on the given position in the network - * (a node or edge). If so, and if this element has a title, - * show a popup window with its title. - * - * @param {{x:Number, y:Number}} pointer - * @private - */ +/** + * The canvas renderer + */ - }, { - key: '_checkShowPopup', - value: function _checkShowPopup(pointer) { - var x = this.canvas._XconvertDOMtoCanvas(pointer.x); - var y = this.canvas._YconvertDOMtoCanvas(pointer.y); - var pointerObj = { - left: x, - top: y, - right: x, - bottom: y - }; +var CanvasRenderer = function () { + /** + * @param {Object} body + * @param {Canvas} canvas + */ + function CanvasRenderer(body, canvas) { + (0, _classCallCheck3["default"])(this, CanvasRenderer); - var previousPopupObjId = this.popupObj === undefined ? undefined : this.popupObj.id; - var nodeUnderCursor = false; - var popupType = 'node'; - - // check if a node is under the cursor. - if (this.popupObj === undefined) { - // search the nodes for overlap, select the top one in case of multiple nodes - var nodeIndices = this.body.nodeIndices; - var nodes = this.body.nodes; - var node = void 0; - var overlappingNodes = []; - for (var i = 0; i < nodeIndices.length; i++) { - node = nodes[nodeIndices[i]]; - if (node.isOverlappingWith(pointerObj) === true) { - if (node.getTitle() !== undefined) { - overlappingNodes.push(nodeIndices[i]); - } - } - } + _initRequestAnimationFrame(); + this.body = body; + this.canvas = canvas; - if (overlappingNodes.length > 0) { - // if there are overlapping nodes, select the last one, this is the one which is drawn on top of the others - this.popupObj = nodes[overlappingNodes[overlappingNodes.length - 1]]; - // if you hover over a node, the title of the edge is not supposed to be shown. - nodeUnderCursor = true; - } - } + this.redrawRequested = false; + this.renderTimer = undefined; + this.requiresTimeout = true; + this.renderingActive = false; + this.renderRequests = 0; + this.allowRedraw = true; - if (this.popupObj === undefined && nodeUnderCursor === false) { - // search the edges for overlap - var edgeIndices = this.body.edgeIndices; - var edges = this.body.edges; - var edge = void 0; - var overlappingEdges = []; - for (var _i = 0; _i < edgeIndices.length; _i++) { - edge = edges[edgeIndices[_i]]; - if (edge.isOverlappingWith(pointerObj) === true) { - if (edge.connected === true && edge.getTitle() !== undefined) { - overlappingEdges.push(edgeIndices[_i]); - } - } - } + this.dragging = false; + this.options = {}; + this.defaultOptions = { + hideEdgesOnDrag: false, + hideNodesOnDrag: false + }; + util.extend(this.options, this.defaultOptions); - if (overlappingEdges.length > 0) { - this.popupObj = edges[overlappingEdges[overlappingEdges.length - 1]]; - popupType = 'edge'; - } - } + this._determineBrowserMethod(); + this.bindEventListeners(); + } - if (this.popupObj !== undefined) { - // show popup message window - if (this.popupObj.id !== previousPopupObjId) { - if (this.popup === undefined) { - this.popup = new Popup(this.canvas.frame); - } + /** + * Binds event listeners + */ - this.popup.popupTargetType = popupType; - this.popup.popupTargetId = this.popupObj.id; - // adjust a small offset such that the mouse cursor is located in the - // bottom left location of the popup, and you can easily move over the - // popup area - this.popup.setPosition(pointer.x + 3, pointer.y - 5); - this.popup.setText(this.popupObj.getTitle()); - this.popup.show(); - this.body.emitter.emit('showPopup', this.popupObj.id); - } + (0, _createClass3["default"])(CanvasRenderer, [{ + key: "bindEventListeners", + value: function bindEventListeners() { + var _this = this; + + this.body.emitter.on("dragStart", function () { + _this.dragging = true; + }); + this.body.emitter.on("dragEnd", function () { + _this.dragging = false; + }); + this.body.emitter.on("_resizeNodes", function () { + _this._resizeNodes(); + }); + this.body.emitter.on("_redraw", function () { + if (_this.renderingActive === false) { + _this._redraw(); + } + }); + this.body.emitter.on("_blockRedraw", function () { + _this.allowRedraw = false; + }); + this.body.emitter.on("_allowRedraw", function () { + _this.allowRedraw = true;_this.redrawRequested = false; + }); + this.body.emitter.on("_requestRedraw", this._requestRedraw.bind(this)); + this.body.emitter.on("_startRendering", function () { + _this.renderRequests += 1; + _this.renderingActive = true; + _this._startRendering(); + }); + this.body.emitter.on("_stopRendering", function () { + _this.renderRequests -= 1; + _this.renderingActive = _this.renderRequests > 0; + _this.renderTimer = undefined; + }); + this.body.emitter.on('destroy', function () { + _this.renderRequests = 0; + _this.allowRedraw = false; + _this.renderingActive = false; + if (_this.requiresTimeout === true) { + clearTimeout(_this.renderTimer); } else { - if (this.popup !== undefined) { - this.popup.hide(); - this.body.emitter.emit('hidePopup'); - } + window.cancelAnimationFrame(_this.renderTimer); } - } + _this.body.emitter.off(); + }); + } - /** - * Check if the popup must be hidden, which is the case when the mouse is no - * longer hovering on the object - * @param {{x:Number, y:Number}} pointer - * @private - */ + /** + * + * @param {Object} options + */ - }, { - key: '_checkHidePopup', - value: function _checkHidePopup(pointer) { - var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); - - var stillOnObj = false; - if (this.popup.popupTargetType === 'node') { - if (this.body.nodes[this.popup.popupTargetId] !== undefined) { - stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj); - - // if the mouse is still one the node, we have to check if it is not also on one that is drawn on top of it. - // we initially only check stillOnObj because this is much faster. - if (stillOnObj === true) { - var overNode = this.selectionHandler.getNodeAt(pointer); - stillOnObj = overNode === undefined ? false : overNode.id === this.popup.popupTargetId; - } - } - } else { - if (this.selectionHandler.getNodeAt(pointer) === undefined) { - if (this.body.edges[this.popup.popupTargetId] !== undefined) { - stillOnObj = this.body.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj); - } - } - } + }, { + key: "setOptions", + value: function setOptions(options) { + if (options !== undefined) { + var fields = ['hideEdgesOnDrag', 'hideNodesOnDrag']; + util.selectiveDeepExtend(fields, this.options, options); + } + } - if (stillOnObj === false) { - this.popupObj = undefined; - this.popup.hide(); - this.body.emitter.emit('hidePopup'); + /** + * Prepare the drawing of the next frame. + * + * Calls the callback when the next frame can or will be drawn. + * + * @param {function} callback + * @param {number} delay - timeout case only, wait this number of milliseconds + * @returns {function|undefined} + * @private + */ + + }, { + key: "_requestNextFrame", + value: function _requestNextFrame(callback, delay) { + // During unit testing, it happens that the mock window object is reset while + // the next frame is still pending. Then, either 'window' is not present, or + // 'requestAnimationFrame()' is not present because it is not defined on the + // mock window object. + // + // As a consequence, unrelated unit tests may appear to fail, even if the problem + // described happens in the current unit test. + // + // This is not something that will happen in normal operation, but we still need + // to take it into account. + // + if (typeof window === 'undefined') return; // Doing `if (window === undefined)` does not work here! + + var timer = void 0; + + var myWindow = window; // Grab a reference to reduce the possibility that 'window' is reset + // while running this method. + + if (this.requiresTimeout === true) { + // wait given number of milliseconds and perform the animation step function + timer = myWindow.setTimeout(callback, delay); + } else { + if (myWindow.requestAnimationFrame) { + timer = myWindow.requestAnimationFrame(callback); } } - }]); - return InteractionHandler; - }(); - - exports['default'] = InteractionHandler; -/***/ }), -/* 227 */ -/***/ (function(module, exports, __webpack_require__) { + return timer; + } - 'use strict'; + /** + * + * @private + */ - Object.defineProperty(exports, "__esModule", { - value: true - }); + }, { + key: "_startRendering", + value: function _startRendering() { + if (this.renderingActive === true) { + if (this.renderTimer === undefined) { + this.renderTimer = this._requestNextFrame(this._renderStep.bind(this), this.simulationInterval); + } + } + } - var _classCallCheck2 = __webpack_require__(135); + /** + * + * @private + */ - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + }, { + key: "_renderStep", + value: function _renderStep() { + if (this.renderingActive === true) { + // reset the renderTimer so a new scheduled animation step can be set + this.renderTimer = undefined; - var _createClass2 = __webpack_require__(136); + if (this.requiresTimeout === true) { + // this schedules a new simulation step + this._startRendering(); + } - var _createClass3 = _interopRequireDefault(_createClass2); + this._redraw(); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + if (this.requiresTimeout === false) { + // this schedules a new simulation step + this._startRendering(); + } + } + } - var util = __webpack_require__(1); - var Hammer = __webpack_require__(113); - var hammerUtil = __webpack_require__(120); - var keycharm = __webpack_require__(116); + /** + * Redraw the network with the current data + * chart will be resized too. + */ - var NavigationHandler = function () { - function NavigationHandler(body, canvas) { - var _this = this; + }, { + key: "redraw", + value: function redraw() { + this.body.emitter.emit('setSize'); + this._redraw(); + } - (0, _classCallCheck3['default'])(this, NavigationHandler); + /** + * Redraw the network with the current data + * @private + */ - this.body = body; - this.canvas = canvas; + }, { + key: "_requestRedraw", + value: function _requestRedraw() { + var _this2 = this; - this.iconsCreated = false; - this.navigationHammers = []; - this.boundFunctions = {}; - this.touchTime = 0; - this.activated = false; + if (this.redrawRequested !== true && this.renderingActive === false && this.allowRedraw === true) { + this.redrawRequested = true; + this._requestNextFrame(function () { + _this2._redraw(false); + }, 0); + } + } - this.body.emitter.on("activate", function () { - _this.activated = true;_this.configureKeyboardBindings(); - }); - this.body.emitter.on("deactivate", function () { - _this.activated = false;_this.configureKeyboardBindings(); - }); - this.body.emitter.on("destroy", function () { - if (_this.keycharm !== undefined) { - _this.keycharm.destroy(); - } - }); + /** + * Redraw the network with the current data + * @param {boolean} [hidden=false] | Used to get the first estimate of the node sizes. + * Only the nodes are drawn after which they are quickly drawn over. + * @private + */ - this.options = {}; - } + }, { + key: "_redraw", + value: function _redraw() { + var hidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - (0, _createClass3['default'])(NavigationHandler, [{ - key: 'setOptions', - value: function setOptions(options) { - if (options !== undefined) { - this.options = options; - this.create(); - } - } - }, { - key: 'create', - value: function create() { - if (this.options.navigationButtons === true) { - if (this.iconsCreated === false) { - this.loadNavigationElements(); - } - } else if (this.iconsCreated === true) { - this.cleanNavigation(); - } + if (this.allowRedraw === true) { + this.body.emitter.emit("initRedraw"); - this.configureKeyboardBindings(); - } - }, { - key: 'cleanNavigation', - value: function cleanNavigation() { - // clean hammer bindings - if (this.navigationHammers.length != 0) { - for (var i = 0; i < this.navigationHammers.length; i++) { - this.navigationHammers[i].destroy(); - } - this.navigationHammers = []; - } + this.redrawRequested = false; - // clean up previous navigation items - if (this.navigationDOM && this.navigationDOM['wrapper'] && this.navigationDOM['wrapper'].parentNode) { - this.navigationDOM['wrapper'].parentNode.removeChild(this.navigationDOM['wrapper']); + // when the container div was hidden, this fixes it back up! + if (this.canvas.frame.canvas.width === 0 || this.canvas.frame.canvas.height === 0) { + this.canvas.setSize(); } - this.iconsCreated = false; - } - - /** - * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation - * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent - * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. - * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. - * - * @private - */ + this.canvas.setTransform(); - }, { - key: 'loadNavigationElements', - value: function loadNavigationElements() { - var _this2 = this; + var ctx = this.canvas.getContext(); - this.cleanNavigation(); + // clear the canvas + var w = this.canvas.frame.canvas.clientWidth; + var h = this.canvas.frame.canvas.clientHeight; + ctx.clearRect(0, 0, w, h); - this.navigationDOM = {}; - var navigationDivs = ['up', 'down', 'left', 'right', 'zoomIn', 'zoomOut', 'zoomExtends']; - var navigationDivActions = ['_moveUp', '_moveDown', '_moveLeft', '_moveRight', '_zoomIn', '_zoomOut', '_fit']; + // if the div is hidden, we stop the redraw here for performance. + if (this.canvas.frame.clientWidth === 0) { + return; + } - this.navigationDOM['wrapper'] = document.createElement('div'); - this.navigationDOM['wrapper'].className = 'vis-navigation'; - this.canvas.frame.appendChild(this.navigationDOM['wrapper']); + // set scaling and translation + ctx.save(); + ctx.translate(this.body.view.translation.x, this.body.view.translation.y); + ctx.scale(this.body.view.scale, this.body.view.scale); - for (var i = 0; i < navigationDivs.length; i++) { - this.navigationDOM[navigationDivs[i]] = document.createElement('div'); - this.navigationDOM[navigationDivs[i]].className = 'vis-button vis-' + navigationDivs[i]; - this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]); + ctx.beginPath(); + this.body.emitter.emit("beforeDrawing", ctx); + ctx.closePath(); - var hammer = new Hammer(this.navigationDOM[navigationDivs[i]]); - if (navigationDivActions[i] === "_fit") { - hammerUtil.onTouch(hammer, this._fit.bind(this)); - } else { - hammerUtil.onTouch(hammer, this.bindToRedraw.bind(this, navigationDivActions[i])); + if (hidden === false) { + if (this.dragging === false || this.dragging === true && this.options.hideEdgesOnDrag === false) { + this._drawEdges(ctx); } + } - this.navigationHammers.push(hammer); + if (this.dragging === false || this.dragging === true && this.options.hideNodesOnDrag === false) { + this._drawNodes(ctx, hidden); } - // use a hammer for the release so we do not require the one used in the rest of the network - // the one the rest uses can be overloaded by the manipulation system. - var hammerFrame = new Hammer(this.canvas.frame); - hammerUtil.onRelease(hammerFrame, function () { - _this2._stopMovement(); - }); - this.navigationHammers.push(hammerFrame); + ctx.beginPath(); + this.body.emitter.emit("afterDrawing", ctx); + ctx.closePath(); - this.iconsCreated = true; - } - }, { - key: 'bindToRedraw', - value: function bindToRedraw(action) { - if (this.boundFunctions[action] === undefined) { - this.boundFunctions[action] = this[action].bind(this); - this.body.emitter.on("initRedraw", this.boundFunctions[action]); - this.body.emitter.emit("_startRendering"); - } - } - }, { - key: 'unbindFromRedraw', - value: function unbindFromRedraw(action) { - if (this.boundFunctions[action] !== undefined) { - this.body.emitter.off("initRedraw", this.boundFunctions[action]); - this.body.emitter.emit("_stopRendering"); - delete this.boundFunctions[action]; + // restore original scaling and translation + ctx.restore(); + if (hidden === true) { + ctx.clearRect(0, 0, w, h); } } + } - /** - * this stops all movement induced by the navigation buttons - * - * @private - */ + /** + * Redraw all nodes + * + * @param {CanvasRenderingContext2D} ctx + * @param {boolean} [alwaysShow] + * @private + */ - }, { - key: '_fit', - value: function _fit() { - if (new Date().valueOf() - this.touchTime > 700) { - // TODO: fix ugly hack to avoid hammer's double fireing of event (because we use release?) - this.body.emitter.emit("fit", { duration: 700 }); - this.touchTime = new Date().valueOf(); + }, { + key: "_resizeNodes", + value: function _resizeNodes() { + this.canvas.setTransform(); + var ctx = this.canvas.getContext(); + ctx.save(); + ctx.translate(this.body.view.translation.x, this.body.view.translation.y); + ctx.scale(this.body.view.scale, this.body.view.scale); + + var nodes = this.body.nodes; + var node = void 0; + + // resize all nodes + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + node = nodes[nodeId]; + node.resize(ctx); + node.updateBoundingBox(ctx, node.selected); } } - /** - * this stops all movement induced by the navigation buttons - * - * @private - */ + // restore original scaling and translation + ctx.restore(); + } - }, { - key: '_stopMovement', - value: function _stopMovement() { - for (var boundAction in this.boundFunctions) { - if (this.boundFunctions.hasOwnProperty(boundAction)) { - this.body.emitter.off("initRedraw", this.boundFunctions[boundAction]); - this.body.emitter.emit("_stopRendering"); + /** + * Redraw all nodes + * + * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas + * @param {boolean} [alwaysShow] + * @private + */ + + }, { + key: "_drawNodes", + value: function _drawNodes(ctx) { + var alwaysShow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var nodes = this.body.nodes; + var nodeIndices = this.body.nodeIndices; + var node = void 0; + var selected = []; + var margin = 20; + var topLeft = this.canvas.DOMtoCanvas({ x: -margin, y: -margin }); + var bottomRight = this.canvas.DOMtoCanvas({ + x: this.canvas.frame.canvas.clientWidth + margin, + y: this.canvas.frame.canvas.clientHeight + margin + }); + var viewableArea = { top: topLeft.y, left: topLeft.x, bottom: bottomRight.y, right: bottomRight.x }; + + // draw unselected nodes; + for (var i = 0; i < nodeIndices.length; i++) { + node = nodes[nodeIndices[i]]; + // set selected nodes aside + if (node.isSelected()) { + selected.push(nodeIndices[i]); + } else { + if (alwaysShow === true) { + node.draw(ctx); + } else if (node.isBoundingBoxOverlappingWith(viewableArea) === true) { + node.draw(ctx); + } else { + node.updateBoundingBox(ctx, node.selected); } } - this.boundFunctions = {}; - } - }, { - key: '_moveUp', - value: function _moveUp() { - this.body.view.translation.y += this.options.keyboard.speed.y; - } - }, { - key: '_moveDown', - value: function _moveDown() { - this.body.view.translation.y -= this.options.keyboard.speed.y; - } - }, { - key: '_moveLeft', - value: function _moveLeft() { - this.body.view.translation.x += this.options.keyboard.speed.x; - } - }, { - key: '_moveRight', - value: function _moveRight() { - this.body.view.translation.x -= this.options.keyboard.speed.x; - } - }, { - key: '_zoomIn', - value: function _zoomIn() { - var scaleOld = this.body.view.scale; - var scale = this.body.view.scale * (1 + this.options.keyboard.speed.zoom); - var translation = this.body.view.translation; - var scaleFrac = scale / scaleOld; - var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac; - var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac; - - this.body.view.scale = scale; - this.body.view.translation = { x: tx, y: ty }; - this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: null }); } - }, { - key: '_zoomOut', - value: function _zoomOut() { - var scaleOld = this.body.view.scale; - var scale = this.body.view.scale / (1 + this.options.keyboard.speed.zoom); - var translation = this.body.view.translation; - var scaleFrac = scale / scaleOld; - var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac; - var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac; - this.body.view.scale = scale; - this.body.view.translation = { x: tx, y: ty }; - this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: null }); + // draw the selected nodes on top + for (var _i = 0; _i < selected.length; _i++) { + node = nodes[selected[_i]]; + node.draw(ctx); } + } - /** - * bind all keys using keycharm. - */ + /** + * Redraw all edges + * @param {CanvasRenderingContext2D} ctx 2D context of a HTML canvas + * @private + */ - }, { - key: 'configureKeyboardBindings', - value: function configureKeyboardBindings() { - var _this3 = this; + }, { + key: "_drawEdges", + value: function _drawEdges(ctx) { + var edges = this.body.edges; + var edgeIndices = this.body.edgeIndices; + var edge = void 0; - if (this.keycharm !== undefined) { - this.keycharm.destroy(); + for (var i = 0; i < edgeIndices.length; i++) { + edge = edges[edgeIndices[i]]; + if (edge.connected === true) { + edge.draw(ctx); } + } + } - if (this.options.keyboard.enabled === true) { - if (this.options.keyboard.bindToWindow === true) { - this.keycharm = keycharm({ container: window, preventDefault: true }); - } else { - this.keycharm = keycharm({ container: this.canvas.frame, preventDefault: true }); - } - - this.keycharm.reset(); - - if (this.activated === true) { - this.keycharm.bind("up", function () { - _this3.bindToRedraw("_moveUp"); - }, "keydown"); - this.keycharm.bind("down", function () { - _this3.bindToRedraw("_moveDown"); - }, "keydown"); - this.keycharm.bind("left", function () { - _this3.bindToRedraw("_moveLeft"); - }, "keydown"); - this.keycharm.bind("right", function () { - _this3.bindToRedraw("_moveRight"); - }, "keydown"); - this.keycharm.bind("=", function () { - _this3.bindToRedraw("_zoomIn"); - }, "keydown"); - this.keycharm.bind("num+", function () { - _this3.bindToRedraw("_zoomIn"); - }, "keydown"); - this.keycharm.bind("num-", function () { - _this3.bindToRedraw("_zoomOut"); - }, "keydown"); - this.keycharm.bind("-", function () { - _this3.bindToRedraw("_zoomOut"); - }, "keydown"); - this.keycharm.bind("[", function () { - _this3.bindToRedraw("_zoomOut"); - }, "keydown"); - this.keycharm.bind("]", function () { - _this3.bindToRedraw("_zoomIn"); - }, "keydown"); - this.keycharm.bind("pageup", function () { - _this3.bindToRedraw("_zoomIn"); - }, "keydown"); - this.keycharm.bind("pagedown", function () { - _this3.bindToRedraw("_zoomOut"); - }, "keydown"); - - this.keycharm.bind("up", function () { - _this3.unbindFromRedraw("_moveUp"); - }, "keyup"); - this.keycharm.bind("down", function () { - _this3.unbindFromRedraw("_moveDown"); - }, "keyup"); - this.keycharm.bind("left", function () { - _this3.unbindFromRedraw("_moveLeft"); - }, "keyup"); - this.keycharm.bind("right", function () { - _this3.unbindFromRedraw("_moveRight"); - }, "keyup"); - this.keycharm.bind("=", function () { - _this3.unbindFromRedraw("_zoomIn"); - }, "keyup"); - this.keycharm.bind("num+", function () { - _this3.unbindFromRedraw("_zoomIn"); - }, "keyup"); - this.keycharm.bind("num-", function () { - _this3.unbindFromRedraw("_zoomOut"); - }, "keyup"); - this.keycharm.bind("-", function () { - _this3.unbindFromRedraw("_zoomOut"); - }, "keyup"); - this.keycharm.bind("[", function () { - _this3.unbindFromRedraw("_zoomOut"); - }, "keyup"); - this.keycharm.bind("]", function () { - _this3.unbindFromRedraw("_zoomIn"); - }, "keyup"); - this.keycharm.bind("pageup", function () { - _this3.unbindFromRedraw("_zoomIn"); - }, "keyup"); - this.keycharm.bind("pagedown", function () { - _this3.unbindFromRedraw("_zoomOut"); - }, "keyup"); + /** + * Determine if the browser requires a setTimeout or a requestAnimationFrame. This was required because + * some implementations (safari and IE9) did not support requestAnimationFrame + * @private + */ + + }, { + key: "_determineBrowserMethod", + value: function _determineBrowserMethod() { + if (typeof window !== 'undefined') { + var browserType = navigator.userAgent.toLowerCase(); + this.requiresTimeout = false; + if (browserType.indexOf('msie 9.0') != -1) { + // IE 9 + this.requiresTimeout = true; + } else if (browserType.indexOf('safari') != -1) { + // safari + if (browserType.indexOf('chrome') <= -1) { + this.requiresTimeout = true; } } + } else { + this.requiresTimeout = true; } - }]); - return NavigationHandler; - }(); + } + }]); + return CanvasRenderer; +}(); - exports['default'] = NavigationHandler; +exports["default"] = CanvasRenderer; /***/ }), -/* 228 */ +/* 230 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); +"use strict"; - var _classCallCheck2 = __webpack_require__(135); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _createClass2 = __webpack_require__(136); +var _classCallCheck2 = __webpack_require__(0); - var _createClass3 = _interopRequireDefault(_createClass2); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } +var _createClass2 = __webpack_require__(1); - var Node = __webpack_require__(169)['default']; - var Edge = __webpack_require__(202)['default']; +var _createClass3 = _interopRequireDefault(_createClass2); - var util = __webpack_require__(1); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var SelectionHandler = function () { - function SelectionHandler(body, canvas) { - var _this = this; +var Hammer = __webpack_require__(10); +var hammerUtil = __webpack_require__(37); - (0, _classCallCheck3['default'])(this, SelectionHandler); +var util = __webpack_require__(2); - this.body = body; - this.canvas = canvas; - this.selectionObj = { nodes: [], edges: [] }; - this.hoverObj = { nodes: {}, edges: {} }; +/** + * Create the main frame for the Network. + * This function is executed once when a Network object is created. The frame + * contains a canvas, and this canvas contains all objects like the axis and + * nodes. + */ - this.options = {}; - this.defaultOptions = { - multiselect: false, - selectable: true, - selectConnectedEdges: true, - hoverConnectedEdges: true - }; - util.extend(this.options, this.defaultOptions); +var Canvas = function () { + /** + * @param {Object} body + */ + function Canvas(body) { + (0, _classCallCheck3['default'])(this, Canvas); - this.body.emitter.on("_dataChanged", function () { - _this.updateSelection(); - }); - } + this.body = body; + this.pixelRatio = 1; + this.resizeTimer = undefined; + this.resizeFunction = this._onResize.bind(this); + this.cameraState = {}; + this.initialized = false; + this.canvasViewCenter = {}; - (0, _createClass3['default'])(SelectionHandler, [{ - key: 'setOptions', - value: function setOptions(options) { - if (options !== undefined) { - var fields = ['multiselect', 'hoverConnectedEdges', 'selectable', 'selectConnectedEdges']; - util.selectiveDeepExtend(fields, this.options, options); - } - } + this.options = {}; + this.defaultOptions = { + autoResize: true, + height: '100%', + width: '100%' + }; + util.extend(this.options, this.defaultOptions); - /** - * handles the selection part of the tap; - * - * @param {Object} pointer - * @private - */ + this.bindEventListeners(); + } - }, { - key: 'selectOnPoint', - value: function selectOnPoint(pointer) { - var selected = false; - if (this.options.selectable === true) { - var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); + /** + * Binds event listeners + */ - // unselect after getting the objects in order to restore width and height. - this.unselectAll(); - if (obj !== undefined) { - selected = this.selectObject(obj); - } - this.body.emitter.emit("_requestRedraw"); - } - return selected; - } - }, { - key: 'selectAdditionalOnPoint', - value: function selectAdditionalOnPoint(pointer) { - var selectionChanged = false; - if (this.options.selectable === true) { - var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); - - if (obj !== undefined) { - selectionChanged = true; - if (obj.isSelected() === true) { - this.deselectObject(obj); - } else { - this.selectObject(obj); - } + (0, _createClass3['default'])(Canvas, [{ + key: 'bindEventListeners', + value: function bindEventListeners() { + var _this = this; - this.body.emitter.emit("_requestRedraw"); - } + // bind the events + this.body.emitter.once("resize", function (obj) { + if (obj.width !== 0) { + _this.body.view.translation.x = obj.width * 0.5; } - return selectionChanged; - } - }, { - key: '_generateClickEvent', - value: function _generateClickEvent(eventType, event, pointer, oldSelection) { - var emptySelection = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - - var properties = void 0; - if (emptySelection === true) { - properties = { nodes: [], edges: [] }; - } else { - properties = this.getSelection(); + if (obj.height !== 0) { + _this.body.view.translation.y = obj.height * 0.5; } - properties['pointer'] = { - DOM: { x: pointer.x, y: pointer.y }, - canvas: this.canvas.DOMtoCanvas(pointer) - }; - properties['event'] = event; + }); + this.body.emitter.on("setSize", this.setSize.bind(this)); + this.body.emitter.on("destroy", function () { + _this.hammerFrame.destroy(); + _this.hammer.destroy(); + _this._cleanUp(); + }); + } - if (oldSelection !== undefined) { - properties['previousSelection'] = oldSelection; - } - this.body.emitter.emit(eventType, properties); + /** + * @param {Object} options + */ + + }, { + key: 'setOptions', + value: function setOptions(options) { + var _this2 = this; + + if (options !== undefined) { + var fields = ['width', 'height', 'autoResize']; + util.selectiveDeepExtend(fields, this.options, options); } - }, { - key: 'selectObject', - value: function selectObject(obj) { - var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.selectConnectedEdges; - if (obj !== undefined) { - if (obj instanceof Node) { - if (highlightEdges === true) { - this._selectConnectedEdges(obj); - } + if (this.options.autoResize === true) { + // automatically adapt to a changing size of the browser. + this._cleanUp(); + this.resizeTimer = setInterval(function () { + var changed = _this2.setSize(); + if (changed === true) { + _this2.body.emitter.emit("_requestRedraw"); } - obj.select(); - this._addToSelection(obj); - return true; - } - return false; - } - }, { - key: 'deselectObject', - value: function deselectObject(obj) { - if (obj.isSelected() === true) { - obj.selected = false; - this._removeFromSelection(obj); - } + }, 1000); + this.resizeFunction = this._onResize.bind(this); + util.addEventListener(window, 'resize', this.resizeFunction); } + } - /** - * retrieve all nodes overlapping with given object - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private - */ + /** + * @private + */ - }, { - key: '_getAllNodesOverlappingWith', - value: function _getAllNodesOverlappingWith(object) { - var overlappingNodes = []; - var nodes = this.body.nodes; - for (var i = 0; i < this.body.nodeIndices.length; i++) { - var nodeId = this.body.nodeIndices[i]; - if (nodes[nodeId].isOverlappingWith(object)) { - overlappingNodes.push(nodeId); - } - } - return overlappingNodes; + }, { + key: '_cleanUp', + value: function _cleanUp() { + // automatically adapt to a changing size of the browser. + if (this.resizeTimer !== undefined) { + clearInterval(this.resizeTimer); } + util.removeEventListener(window, 'resize', this.resizeFunction); + this.resizeFunction = undefined; + } - /** - * Return a position object in canvasspace from a single point in screenspace - * - * @param pointer - * @returns {{left: number, top: number, right: number, bottom: number}} - * @private - */ + /** + * @private + */ - }, { - key: '_pointerToPositionObject', - value: function _pointerToPositionObject(pointer) { - var canvasPos = this.canvas.DOMtoCanvas(pointer); - return { - left: canvasPos.x - 1, - top: canvasPos.y + 1, - right: canvasPos.x + 1, - bottom: canvasPos.y - 1 - }; - } + }, { + key: '_onResize', + value: function _onResize() { + this.setSize(); + this.body.emitter.emit("_redraw"); + } - /** - * Get the top node at the passed point (like a click) - * - * @param {{x: Number, y: Number}} pointer - * @return {Node | undefined} node - */ + /** + * Get and store the cameraState + * + * @param {number} [pixelRatio=this.pixelRatio] + * @private + */ - }, { - key: 'getNodeAt', - value: function getNodeAt(pointer) { - var returnNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - // we first check if this is an navigation controls element - var positionObject = this._pointerToPositionObject(pointer); - var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); - // if there are overlapping nodes, select the last one, this is the - // one which is drawn on top of the others - if (overlappingNodes.length > 0) { - if (returnNode === true) { - return this.body.nodes[overlappingNodes[overlappingNodes.length - 1]]; - } else { - return overlappingNodes[overlappingNodes.length - 1]; - } - } else { - return undefined; - } + }, { + key: '_getCameraState', + value: function _getCameraState() { + var pixelRatio = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pixelRatio; + + if (this.initialized === true) { + this.cameraState.previousWidth = this.frame.canvas.width / pixelRatio; + this.cameraState.previousHeight = this.frame.canvas.height / pixelRatio; + this.cameraState.scale = this.body.view.scale; + this.cameraState.position = this.DOMtoCanvas({ + x: 0.5 * this.frame.canvas.width / pixelRatio, + y: 0.5 * this.frame.canvas.height / pixelRatio + }); } + } - /** - * retrieve all edges overlapping with given object, selector is around center - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private - */ + /** + * Set the cameraState + * @private + */ - }, { - key: '_getEdgesOverlappingWith', - value: function _getEdgesOverlappingWith(object, overlappingEdges) { - var edges = this.body.edges; - for (var i = 0; i < this.body.edgeIndices.length; i++) { - var edgeId = this.body.edgeIndices[i]; - if (edges[edgeId].isOverlappingWith(object)) { - overlappingEdges.push(edgeId); - } + }, { + key: '_setCameraState', + value: function _setCameraState() { + if (this.cameraState.scale !== undefined && this.frame.canvas.clientWidth !== 0 && this.frame.canvas.clientHeight !== 0 && this.pixelRatio !== 0 && this.cameraState.previousWidth > 0) { + + var widthRatio = this.frame.canvas.width / this.pixelRatio / this.cameraState.previousWidth; + var heightRatio = this.frame.canvas.height / this.pixelRatio / this.cameraState.previousHeight; + var newScale = this.cameraState.scale; + + if (widthRatio != 1 && heightRatio != 1) { + newScale = this.cameraState.scale * 0.5 * (widthRatio + heightRatio); + } else if (widthRatio != 1) { + newScale = this.cameraState.scale * widthRatio; + } else if (heightRatio != 1) { + newScale = this.cameraState.scale * heightRatio; } - } - /** - * retrieve all nodes overlapping with given object - * @param {Object} object An object with parameters left, top, right, bottom - * @return {Number[]} An array with id's of the overlapping nodes - * @private - */ + this.body.view.scale = newScale; + // this comes from the view module. + var currentViewCenter = this.DOMtoCanvas({ + x: 0.5 * this.frame.canvas.clientWidth, + y: 0.5 * this.frame.canvas.clientHeight + }); - }, { - key: '_getAllEdgesOverlappingWith', - value: function _getAllEdgesOverlappingWith(object) { - var overlappingEdges = []; - this._getEdgesOverlappingWith(object, overlappingEdges); - return overlappingEdges; + var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node + x: currentViewCenter.x - this.cameraState.position.x, + y: currentViewCenter.y - this.cameraState.position.y + }; + this.body.view.translation.x += distanceFromCenter.x * this.body.view.scale; + this.body.view.translation.y += distanceFromCenter.y * this.body.view.scale; } + } - /** - * Get the edges nearest to the passed point (like a click) - * - * @param {{x: Number, y: Number}} pointer - * @return {Edge | undefined} node - */ + /** + * + * @param {number|string} value + * @returns {string} + * @private + */ - }, { - key: 'getEdgeAt', - value: function getEdgeAt(pointer) { - var returnEdge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - // Iterate over edges, pick closest within 10 - var canvasPos = this.canvas.DOMtoCanvas(pointer); - var mindist = 10; - var overlappingEdge = null; - var edges = this.body.edges; - for (var i = 0; i < this.body.edgeIndices.length; i++) { - var edgeId = this.body.edgeIndices[i]; - var edge = edges[edgeId]; - if (edge.connected) { - var xFrom = edge.from.x; - var yFrom = edge.from.y; - var xTo = edge.to.x; - var yTo = edge.to.y; - var dist = edge.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, canvasPos.x, canvasPos.y); - if (dist < mindist) { - overlappingEdge = edgeId; - mindist = dist; - } - } - } - if (overlappingEdge !== null) { - if (returnEdge === true) { - return this.body.edges[overlappingEdge]; - } else { - return overlappingEdge; - } - } else { - return undefined; + }, { + key: '_prepareValue', + value: function _prepareValue(value) { + if (typeof value === 'number') { + return value + 'px'; + } else if (typeof value === 'string') { + if (value.indexOf('%') !== -1 || value.indexOf('px') !== -1) { + return value; + } else if (value.indexOf('%') === -1) { + return value + 'px'; } } + throw new Error('Could not use the value supplied for width or height:' + value); + } - /** - * Add object to the selection array. - * - * @param obj - * @private - */ + /** + * Create the HTML + */ - }, { - key: '_addToSelection', - value: function _addToSelection(obj) { - if (obj instanceof Node) { - this.selectionObj.nodes[obj.id] = obj; - } else { - this.selectionObj.edges[obj.id] = obj; - } + }, { + key: '_create', + value: function _create() { + // remove all elements from the container element. + while (this.body.container.hasChildNodes()) { + this.body.container.removeChild(this.body.container.firstChild); } - /** - * Add object to the selection array. - * - * @param obj - * @private - */ - - }, { - key: '_addToHover', - value: function _addToHover(obj) { - if (obj instanceof Node) { - this.hoverObj.nodes[obj.id] = obj; - } else { - this.hoverObj.edges[obj.id] = obj; - } + this.frame = document.createElement('div'); + this.frame.className = 'vis-network'; + this.frame.style.position = 'relative'; + this.frame.style.overflow = 'hidden'; + this.frame.tabIndex = 900; // tab index is required for keycharm to bind keystrokes to the div instead of the window + + ////////////////////////////////////////////////////////////////// + + this.frame.canvas = document.createElement("canvas"); + this.frame.canvas.style.position = 'relative'; + this.frame.appendChild(this.frame.canvas); + + if (!this.frame.canvas.getContext) { + var noCanvas = document.createElement('DIV'); + noCanvas.style.color = 'red'; + noCanvas.style.fontWeight = 'bold'; + noCanvas.style.padding = '10px'; + noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; + this.frame.canvas.appendChild(noCanvas); + } else { + this._setPixelRatio(); + this.setTransform(); } - /** - * Remove a single option from selection. - * - * @param {Object} obj - * @private - */ + // add the frame to the container element + this.body.container.appendChild(this.frame); - }, { - key: '_removeFromSelection', - value: function _removeFromSelection(obj) { - if (obj instanceof Node) { - delete this.selectionObj.nodes[obj.id]; - this._unselectConnectedEdges(obj); - } else { - delete this.selectionObj.edges[obj.id]; - } - } + this.body.view.scale = 1; + this.body.view.translation = { x: 0.5 * this.frame.canvas.clientWidth, y: 0.5 * this.frame.canvas.clientHeight }; - /** - * Unselect all. The selectionObj is useful for this. - */ + this._bindHammer(); + } - }, { - key: 'unselectAll', - value: function unselectAll() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - this.selectionObj.nodes[nodeId].unselect(); - } - } - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - this.selectionObj.edges[edgeId].unselect(); - } - } + /** + * This function binds hammer, it can be repeated over and over due to the uniqueness check. + * @private + */ - this.selectionObj = { nodes: {}, edges: {} }; + }, { + key: '_bindHammer', + value: function _bindHammer() { + var _this3 = this; + + if (this.hammer !== undefined) { + this.hammer.destroy(); } + this.drag = {}; + this.pinch = {}; - /** - * return the number of selected nodes - * - * @returns {number} - * @private - */ + // init hammer + this.hammer = new Hammer(this.frame.canvas); + this.hammer.get('pinch').set({ enable: true }); + // enable to get better response, todo: test on mobile. + this.hammer.get('pan').set({ threshold: 5, direction: Hammer.DIRECTION_ALL }); - }, { - key: '_getSelectedNodeCount', - value: function _getSelectedNodeCount() { - var count = 0; - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - count += 1; - } - } - return count; - } + hammerUtil.onTouch(this.hammer, function (event) { + _this3.body.eventListeners.onTouch(event); + }); + this.hammer.on('tap', function (event) { + _this3.body.eventListeners.onTap(event); + }); + this.hammer.on('doubletap', function (event) { + _this3.body.eventListeners.onDoubleTap(event); + }); + this.hammer.on('press', function (event) { + _this3.body.eventListeners.onHold(event); + }); + this.hammer.on('panstart', function (event) { + _this3.body.eventListeners.onDragStart(event); + }); + this.hammer.on('panmove', function (event) { + _this3.body.eventListeners.onDrag(event); + }); + this.hammer.on('panend', function (event) { + _this3.body.eventListeners.onDragEnd(event); + }); + this.hammer.on('pinch', function (event) { + _this3.body.eventListeners.onPinch(event); + }); - /** - * return the selected node - * - * @returns {number} - * @private - */ + // TODO: neatly cleanup these handlers when re-creating the Canvas, IF these are done with hammer, event.stopPropagation will not work? + this.frame.canvas.addEventListener('mousewheel', function (event) { + _this3.body.eventListeners.onMouseWheel(event); + }); + this.frame.canvas.addEventListener('DOMMouseScroll', function (event) { + _this3.body.eventListeners.onMouseWheel(event); + }); - }, { - key: '_getSelectedNode', - value: function _getSelectedNode() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - return this.selectionObj.nodes[nodeId]; - } - } - return undefined; - } + this.frame.canvas.addEventListener('mousemove', function (event) { + _this3.body.eventListeners.onMouseMove(event); + }); + this.frame.canvas.addEventListener('contextmenu', function (event) { + _this3.body.eventListeners.onContext(event); + }); - /** - * return the selected edge - * - * @returns {number} - * @private - */ + this.hammerFrame = new Hammer(this.frame); + hammerUtil.onRelease(this.hammerFrame, function (event) { + _this3.body.eventListeners.onRelease(event); + }); + } - }, { - key: '_getSelectedEdge', - value: function _getSelectedEdge() { - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - return this.selectionObj.edges[edgeId]; - } - } - return undefined; - } + /** + * Set a new size for the network + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') + * @returns {boolean} + */ - /** - * return the number of selected edges - * - * @returns {number} - * @private - */ + }, { + key: 'setSize', + value: function setSize() { + var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.width; + var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.height; + + width = this._prepareValue(width); + height = this._prepareValue(height); + + var emitEvent = false; + var oldWidth = this.frame.canvas.width; + var oldHeight = this.frame.canvas.height; + + // update the pixel ratio + // + // NOTE: Comment in following is rather inconsistent; this is the ONLY place in the code + // where it is assumed that the pixel ratio could change at runtime. + // The only way I can think of this happening is a rotating screen or tablet; but then + // there should be a mechanism for reloading the data (TODO: check if this is present). + // + // If the assumption is true (i.e. pixel ratio can change at runtime), then *all* usage + // of pixel ratio must be overhauled for this. + // + // For the time being, I will humor the assumption here, and in the rest of the code assume it is + // constant. + var previousRatio = this.pixelRatio; // we cache this because the camera state storage needs the old value + this._setPixelRatio(); + + if (width != this.options.width || height != this.options.height || this.frame.style.width != width || this.frame.style.height != height) { + this._getCameraState(previousRatio); + + this.frame.style.width = width; + this.frame.style.height = height; + + this.frame.canvas.style.width = '100%'; + this.frame.canvas.style.height = '100%'; + + this.frame.canvas.width = Math.round(this.frame.canvas.clientWidth * this.pixelRatio); + this.frame.canvas.height = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); + + this.options.width = width; + this.options.height = height; + + this.canvasViewCenter = { + x: 0.5 * this.frame.clientWidth, + y: 0.5 * this.frame.clientHeight + }; - }, { - key: '_getSelectedEdgeCount', - value: function _getSelectedEdgeCount() { - var count = 0; - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - count += 1; - } - } - return count; - } + emitEvent = true; + } else { + // this would adapt the width of the canvas to the width from 100% if and only if + // there is a change. - /** - * return the number of selected objects. - * - * @returns {number} - * @private - */ + var newWidth = Math.round(this.frame.canvas.clientWidth * this.pixelRatio); + var newHeight = Math.round(this.frame.canvas.clientHeight * this.pixelRatio); - }, { - key: '_getSelectedObjectCount', - value: function _getSelectedObjectCount() { - var count = 0; - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - count += 1; - } - } - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - count += 1; - } + // store the camera if there is a change in size. + if (this.frame.canvas.width !== newWidth || this.frame.canvas.height !== newHeight) { + this._getCameraState(previousRatio); } - return count; - } - - /** - * Check if anything is selected - * - * @returns {boolean} - * @private - */ - }, { - key: '_selectionIsEmpty', - value: function _selectionIsEmpty() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - return false; - } + if (this.frame.canvas.width !== newWidth) { + this.frame.canvas.width = newWidth; + emitEvent = true; } - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - return false; - } + if (this.frame.canvas.height !== newHeight) { + this.frame.canvas.height = newHeight; + emitEvent = true; } - return true; } - /** - * check if one of the selected nodes is a cluster. - * - * @returns {boolean} - * @private - */ - - }, { - key: '_clusterInSelection', - value: function _clusterInSelection() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (this.selectionObj.nodes[nodeId].clusterSize > 1) { - return true; - } - } - } - return false; - } - - /** - * select the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ + if (emitEvent === true) { + this.body.emitter.emit('resize', { + width: Math.round(this.frame.canvas.width / this.pixelRatio), + height: Math.round(this.frame.canvas.height / this.pixelRatio), + oldWidth: Math.round(oldWidth / this.pixelRatio), + oldHeight: Math.round(oldHeight / this.pixelRatio) + }); - }, { - key: '_selectConnectedEdges', - value: function _selectConnectedEdges(node) { - for (var i = 0; i < node.edges.length; i++) { - var edge = node.edges[i]; - edge.select(); - this._addToSelection(edge); - } + // restore the camera on change. + this._setCameraState(); } - /** - * select the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ - - }, { - key: '_hoverConnectedEdges', - value: function _hoverConnectedEdges(node) { - for (var i = 0; i < node.edges.length; i++) { - var edge = node.edges[i]; - edge.hover = true; - this._addToHover(edge); - } - } + // set initialized so the get and set camera will work from now on. + this.initialized = true; + return emitEvent; + } - /** - * unselect the edges connected to the node that is being selected - * - * @param {Node} node - * @private - */ + /** + * + * @returns {CanvasRenderingContext2D} + */ - }, { - key: '_unselectConnectedEdges', - value: function _unselectConnectedEdges(node) { - for (var i = 0; i < node.edges.length; i++) { - var edge = node.edges[i]; - edge.unselect(); - this._removeFromSelection(edge); - } - } + }, { + key: 'getContext', + value: function getContext() { + return this.frame.canvas.getContext("2d"); + } - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @private - */ + /** + * Determine the pixel ratio for various browsers. + * + * @returns {number} + * @private + */ - }, { - key: 'blurObject', - value: function blurObject(object) { - if (object.hover === true) { - object.hover = false; - if (object instanceof Node) { - this.body.emitter.emit("blurNode", { node: object.id }); - } else { - this.body.emitter.emit("blurEdge", { edge: object.id }); - } - } + }, { + key: '_determinePixelRatio', + value: function _determinePixelRatio() { + var ctx = this.getContext(); + if (ctx === undefined) { + throw new Error("Could not get canvax context"); } - /** - * This is called when someone clicks on a node. either select or deselect it. - * If there is an existing selection and we don't want to append to it, clear the existing selection - * - * @param {Node || Edge} object - * @private - */ - - }, { - key: 'hoverObject', - value: function hoverObject(object) { - var hoverChanged = false; - // remove all node hover highlights - for (var nodeId in this.hoverObj.nodes) { - if (this.hoverObj.nodes.hasOwnProperty(nodeId)) { - if (object === undefined || object instanceof Node && object.id != nodeId || object instanceof Edge) { - this.blurObject(this.hoverObj.nodes[nodeId]); - delete this.hoverObj.nodes[nodeId]; - hoverChanged = true; - } - } - } - - // removing all edge hover highlights - for (var edgeId in this.hoverObj.edges) { - if (this.hoverObj.edges.hasOwnProperty(edgeId)) { - // if the hover has been changed here it means that the node has been hovered over or off - // we then do not use the blurObject method here. - if (hoverChanged === true) { - this.hoverObj.edges[edgeId].hover = false; - delete this.hoverObj.edges[edgeId]; - } - // if the blur remains the same and the object is undefined (mouse off) or another - // edge has been hovered, or another node has been hovered we blur the edge. - else if (object === undefined || object instanceof Edge && object.id != edgeId || object instanceof Node && !object.hover) { - this.blurObject(this.hoverObj.edges[edgeId]); - delete this.hoverObj.edges[edgeId]; - hoverChanged = true; - } - } - } - - if (object !== undefined) { - if (object.hover === false) { - object.hover = true; - this._addToHover(object); - hoverChanged = true; - if (object instanceof Node) { - this.body.emitter.emit("hoverNode", { node: object.id }); - } else { - this.body.emitter.emit("hoverEdge", { edge: object.id }); - } - } - if (object instanceof Node && this.options.hoverConnectedEdges === true) { - this._hoverConnectedEdges(object); - } - } - - if (hoverChanged === true) { - this.body.emitter.emit('_requestRedraw'); - } + var numerator = 1; + if (typeof window !== 'undefined') { + // (window !== undefined) doesn't work here! + // Protection during unit tests, where 'window' can be missing + numerator = window.devicePixelRatio || 1; } - /** - * - * retrieve the currently selected objects - * @return {{nodes: Array., edges: Array.}} selection - */ + var denominator = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; - }, { - key: 'getSelection', - value: function getSelection() { - var nodeIds = this.getSelectedNodes(); - var edgeIds = this.getSelectedEdges(); - return { nodes: nodeIds, edges: edgeIds }; - } + return numerator / denominator; + } - /** - * - * retrieve the currently selected nodes - * @return {String[]} selection An array with the ids of the - * selected nodes. - */ + /** + * Lazy determination of pixel ratio. + * + * @private + */ - }, { - key: 'getSelectedNodes', - value: function getSelectedNodes() { - var idArray = []; - if (this.options.selectable === true) { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - idArray.push(this.selectionObj.nodes[nodeId].id); - } - } - } - return idArray; - } + }, { + key: '_setPixelRatio', + value: function _setPixelRatio() { + this.pixelRatio = this._determinePixelRatio(); + } - /** - * - * retrieve the currently selected edges - * @return {Array} selection An array with the ids of the - * selected nodes. - */ + /** + * Set the transform in the contained context, based on its pixelRatio + */ - }, { - key: 'getSelectedEdges', - value: function getSelectedEdges() { - var idArray = []; - if (this.options.selectable === true) { - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - idArray.push(this.selectionObj.edges[edgeId].id); - } - } - } - return idArray; + }, { + key: 'setTransform', + value: function setTransform() { + var ctx = this.getContext(); + if (ctx === undefined) { + throw new Error("Could not get canvax context"); } - /** - * Updates the current selection - * @param {{nodes: Array., edges: Array.}} Selection - * @param {Object} options Options - */ - - }, { - key: 'setSelection', - value: function setSelection(selection) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var i = void 0, - id = void 0; - - if (!selection || !selection.nodes && !selection.edges) throw 'Selection must be an object with nodes and/or edges properties'; - // first unselect any selected node, if option is true or undefined - if (options.unselectAll || options.unselectAll === undefined) { - this.unselectAll(); - } - if (selection.nodes) { - for (i = 0; i < selection.nodes.length; i++) { - id = selection.nodes[i]; + ctx.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + } - var node = this.body.nodes[id]; - if (!node) { - throw new RangeError('Node with id "' + id + '" not found'); - } - // don't select edges with it - this.selectObject(node, options.highlightEdges); - } - } + /** + * Convert the X coordinate in DOM-space (coordinate point in browser relative to the container div) to + * the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) + * @param {number} x + * @returns {number} + * @private + */ - if (selection.edges) { - for (i = 0; i < selection.edges.length; i++) { - id = selection.edges[i]; + }, { + key: '_XconvertDOMtoCanvas', + value: function _XconvertDOMtoCanvas(x) { + return (x - this.body.view.translation.x) / this.body.view.scale; + } - var edge = this.body.edges[id]; - if (!edge) { - throw new RangeError('Edge with id "' + id + '" not found'); - } - this.selectObject(edge); - } - } - this.body.emitter.emit('_requestRedraw'); - } + /** + * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to + * the X coordinate in DOM-space (coordinate point in browser relative to the container div) + * @param {number} x + * @returns {number} + * @private + */ - /** - * select zero or more nodes with the option to highlight edges - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - * @param {boolean} [highlightEdges] - */ + }, { + key: '_XconvertCanvasToDOM', + value: function _XconvertCanvasToDOM(x) { + return x * this.body.view.scale + this.body.view.translation.x; + } - }, { - key: 'selectNodes', - value: function selectNodes(selection) { - var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + /** + * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to + * the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) + * @param {number} y + * @returns {number} + * @private + */ - if (!selection || selection.length === undefined) throw 'Selection must be an array with ids'; + }, { + key: '_YconvertDOMtoCanvas', + value: function _YconvertDOMtoCanvas(y) { + return (y - this.body.view.translation.y) / this.body.view.scale; + } - this.setSelection({ nodes: selection }, { highlightEdges: highlightEdges }); - } + /** + * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to + * the Y coordinate in DOM-space (coordinate point in browser relative to the container div) + * @param {number} y + * @returns {number} + * @private + */ - /** - * select zero or more edges - * @param {Number[] | String[]} selection An array with the ids of the - * selected nodes. - */ + }, { + key: '_YconvertCanvasToDOM', + value: function _YconvertCanvasToDOM(y) { + return y * this.body.view.scale + this.body.view.translation.y; + } - }, { - key: 'selectEdges', - value: function selectEdges(selection) { - if (!selection || selection.length === undefined) throw 'Selection must be an array with ids'; + /** + * @param {point} pos + * @returns {point} + */ - this.setSelection({ edges: selection }); - } + }, { + key: 'canvasToDOM', + value: function canvasToDOM(pos) { + return { x: this._XconvertCanvasToDOM(pos.x), y: this._YconvertCanvasToDOM(pos.y) }; + } - /** - * Validate the selection: remove ids of nodes which no longer exist - * @private - */ + /** + * + * @param {point} pos + * @returns {point} + */ - }, { - key: 'updateSelection', - value: function updateSelection() { - for (var nodeId in this.selectionObj.nodes) { - if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { - if (!this.body.nodes.hasOwnProperty(nodeId)) { - delete this.selectionObj.nodes[nodeId]; - } - } - } - for (var edgeId in this.selectionObj.edges) { - if (this.selectionObj.edges.hasOwnProperty(edgeId)) { - if (!this.body.edges.hasOwnProperty(edgeId)) { - delete this.selectionObj.edges[edgeId]; - } - } - } - } - }]); - return SelectionHandler; - }(); + }, { + key: 'DOMtoCanvas', + value: function DOMtoCanvas(pos) { + return { x: this._XconvertDOMtoCanvas(pos.x), y: this._YconvertDOMtoCanvas(pos.y) }; + } + }]); + return Canvas; +}(); - exports['default'] = SelectionHandler; +exports['default'] = Canvas; /***/ }), -/* 229 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _keys = __webpack_require__(58); +Object.defineProperty(exports, "__esModule", { + value: true +}); - var _keys2 = _interopRequireDefault(_keys); +var _classCallCheck2 = __webpack_require__(0); - var _stringify = __webpack_require__(90); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _stringify2 = _interopRequireDefault(_stringify); +var _createClass2 = __webpack_require__(1); - var _typeof2 = __webpack_require__(62); +var _createClass3 = _interopRequireDefault(_createClass2); - var _typeof3 = _interopRequireDefault(_typeof2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _classCallCheck2 = __webpack_require__(135); +var util = __webpack_require__(2); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var NetworkUtil = __webpack_require__(76)['default']; - var _createClass2 = __webpack_require__(136); +/** + * The view + */ - var _createClass3 = _interopRequireDefault(_createClass2); +var View = function () { + /** + * @param {Object} body + * @param {Canvas} canvas + */ + function View(body, canvas) { + var _this = this; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + (0, _classCallCheck3['default'])(this, View); - var util = __webpack_require__(1); - var Hammer = __webpack_require__(113); - var hammerUtil = __webpack_require__(120); + this.body = body; + this.canvas = canvas; + + this.animationSpeed = 1 / this.renderRefreshRate; + this.animationEasingFunction = "easeInOutQuint"; + this.easingTime = 0; + this.sourceScale = 0; + this.targetScale = 0; + this.sourceTranslation = 0; + this.targetTranslation = 0; + this.lockedOnNodeId = undefined; + this.lockedOnNodeOffset = undefined; + this.touchTime = 0; + + this.viewFunction = undefined; + + this.body.emitter.on("fit", this.fit.bind(this)); + this.body.emitter.on("animationFinished", function () { + _this.body.emitter.emit("_stopRendering"); + }); + this.body.emitter.on("unlockNode", this.releaseNode.bind(this)); + } /** - * clears the toolbar div element of children * - * @private + * @param {Object} [options={}] */ - var ManipulationSystem = function () { - function ManipulationSystem(body, canvas, selectionHandler) { - var _this = this; - - (0, _classCallCheck3['default'])(this, ManipulationSystem); - - this.body = body; - this.canvas = canvas; - this.selectionHandler = selectionHandler; - - this.editMode = false; - this.manipulationDiv = undefined; - this.editModeDiv = undefined; - this.closeDiv = undefined; - - this.manipulationHammers = []; - this.temporaryUIFunctions = {}; - this.temporaryEventFunctions = []; - - this.touchTime = 0; - this.temporaryIds = { nodes: [], edges: [] }; - this.guiEnabled = false; - this.inMode = false; - this.selectedControlNode = undefined; - this.options = {}; - this.defaultOptions = { - enabled: false, - initiallyActive: false, - addNode: true, - addEdge: true, - editNode: undefined, - editEdge: true, - deleteNode: true, - deleteEdge: true, - controlNodeStyle: { - shape: 'dot', - size: 6, - color: { background: '#ff0000', border: '#3c3c3c', highlight: { background: '#07f968', border: '#3c3c3c' } }, - borderWidth: 2, - borderWidthSelected: 2 - } - }; - util.extend(this.options, this.defaultOptions); + (0, _createClass3['default'])(View, [{ + key: 'setOptions', + value: function setOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - this.body.emitter.on('destroy', function () { - _this._clean(); - }); - this.body.emitter.on('_dataChanged', this._restore.bind(this)); - this.body.emitter.on('_resetData', this._restore.bind(this)); + this.options = options; } /** - * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes. - * @private + * This function zooms out to fit all data on screen based on amount of nodes + * @param {Object} [options={{nodes=Array}}] + * @param {boolean} [initialZoom=false] | zoom based on fitted formula or range, true = fitted, default = false; */ + }, { + key: 'fit', + value: function fit() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { nodes: [] }; + var initialZoom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - (0, _createClass3['default'])(ManipulationSystem, [{ - key: '_restore', - value: function _restore() { - if (this.inMode !== false) { - if (this.options.initiallyActive === true) { - this.enableEditMode(); - } else { - this.disableEditMode(); - } - } + var range = void 0; + var zoomLevel = void 0; + if (options.nodes === undefined || options.nodes.length === 0) { + options.nodes = this.body.nodeIndices; } - /** - * Set the Options - * @param options - */ - - }, { - key: 'setOptions', - value: function setOptions(options, allOptions, globalOptions) { - if (allOptions !== undefined) { - if (allOptions.locale !== undefined) { - this.options.locale = allOptions.locale; - } else { - this.options.locale = globalOptions.locale; - } - if (allOptions.locales !== undefined) { - this.options.locales = allOptions.locales; - } else { - this.options.locales = globalOptions.locales; + if (initialZoom === true) { + // check if more than half of the nodes have a predefined position. If so, we use the range, not the approximation. + var positionDefined = 0; + for (var nodeId in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(nodeId)) { + var node = this.body.nodes[nodeId]; + if (node.predefinedPosition === true) { + positionDefined += 1; + } } } - - if (options !== undefined) { - if (typeof options === 'boolean') { - this.options.enabled = options; - } else { - this.options.enabled = true; - util.deepExtend(this.options, options); - } - if (this.options.initiallyActive === true) { - this.editMode = true; - } - this._setup(); + if (positionDefined > 0.5 * this.body.nodeIndices.length) { + this.fit(options, false); + return; } - } - /** - * Enable or disable edit-mode. Draws the DOM required and cleans up after itself. - * - * @private - */ + range = NetworkUtil.getRange(this.body.nodes, options.nodes); - }, { - key: 'toggleEditMode', - value: function toggleEditMode() { - if (this.editMode === true) { - this.disableEditMode(); - } else { - this.enableEditMode(); - } + var numberOfNodes = this.body.nodeIndices.length; + zoomLevel = 12.662 / (numberOfNodes + 7.4147) + 0.0964822; // this is obtained from fitting a dataset from 5 points with scale levels that looked good. + + // correct for larger canvasses. + var factor = Math.min(this.canvas.frame.canvas.clientWidth / 600, this.canvas.frame.canvas.clientHeight / 600); + zoomLevel *= factor; + } else { + this.body.emitter.emit("_resizeNodes"); + range = NetworkUtil.getRange(this.body.nodes, options.nodes); + + var xDistance = Math.abs(range.maxX - range.minX) * 1.1; + var yDistance = Math.abs(range.maxY - range.minY) * 1.1; + + var xZoomLevel = this.canvas.frame.canvas.clientWidth / xDistance; + var yZoomLevel = this.canvas.frame.canvas.clientHeight / yDistance; + + zoomLevel = xZoomLevel <= yZoomLevel ? xZoomLevel : yZoomLevel; } - }, { - key: 'enableEditMode', - value: function enableEditMode() { - this.editMode = true; - this._clean(); - if (this.guiEnabled === true) { - this.manipulationDiv.style.display = 'block'; - this.closeDiv.style.display = 'block'; - this.editModeDiv.style.display = 'none'; - this.showManipulatorToolbar(); - } + if (zoomLevel > 1.0) { + zoomLevel = 1.0; + } else if (zoomLevel === 0) { + zoomLevel = 1.0; } - }, { - key: 'disableEditMode', - value: function disableEditMode() { - this.editMode = false; - this._clean(); - if (this.guiEnabled === true) { - this.manipulationDiv.style.display = 'none'; - this.closeDiv.style.display = 'none'; - this.editModeDiv.style.display = 'block'; - this._createEditButton(); - } - } + var center = NetworkUtil.findCenter(range); + var animationOptions = { position: center, scale: zoomLevel, animation: options.animation }; + this.moveTo(animationOptions); + } - /** - * Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. - * - * @private - */ + // animation - }, { - key: 'showManipulatorToolbar', - value: function showManipulatorToolbar() { - // restore the state of any bound functions or events, remove control nodes, restore physics - this._clean(); + /** + * Center a node in view. + * + * @param {number} nodeId + * @param {number} [options] + */ - // reset global variables - this.manipulationDOM = {}; + }, { + key: 'focus', + value: function focus(nodeId) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - // if the gui is enabled, draw all elements. - if (this.guiEnabled === true) { - // a _restore will hide these menus - this.editMode = true; - this.manipulationDiv.style.display = 'block'; - this.closeDiv.style.display = 'block'; + if (this.body.nodes[nodeId] !== undefined) { + var nodePosition = { x: this.body.nodes[nodeId].x, y: this.body.nodes[nodeId].y }; + options.position = nodePosition; + options.lockedOnNode = nodeId; - var selectedNodeCount = this.selectionHandler._getSelectedNodeCount(); - var selectedEdgeCount = this.selectionHandler._getSelectedEdgeCount(); - var selectedTotalCount = selectedNodeCount + selectedEdgeCount; - var locale = this.options.locales[this.options.locale]; - var needSeperator = false; + this.moveTo(options); + } else { + console.log("Node: " + nodeId + " cannot be found."); + } + } - if (this.options.addNode !== false) { - this._createAddNodeButton(locale); - needSeperator = true; - } - if (this.options.addEdge !== false) { - if (needSeperator === true) { - this._createSeperator(1); - } else { - needSeperator = true; - } - this._createAddEdgeButton(locale); - } + /** + * + * @param {Object} options | options.offset = {x:number, y:number} // offset from the center in DOM pixels + * | options.scale = number // scale to move to + * | options.position = {x:number, y:number} // position to move to + * | options.animation = {duration:number, easingFunction:String} || Boolean // position to move to + */ - if (selectedNodeCount === 1 && typeof this.options.editNode === 'function') { - if (needSeperator === true) { - this._createSeperator(2); - } else { - needSeperator = true; - } - this._createEditNodeButton(locale); - } else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.editEdge !== false) { - if (needSeperator === true) { - this._createSeperator(3); - } else { - needSeperator = true; - } - this._createEditEdgeButton(locale); - } + }, { + key: 'moveTo', + value: function moveTo(options) { + if (options === undefined) { + options = {}; + return; + } + if (options.offset === undefined) { + options.offset = { x: 0, y: 0 }; + } + if (options.offset.x === undefined) { + options.offset.x = 0; + } + if (options.offset.y === undefined) { + options.offset.y = 0; + } + if (options.scale === undefined) { + options.scale = this.body.view.scale; + } + if (options.position === undefined) { + options.position = this.getViewPosition(); + } + if (options.animation === undefined) { + options.animation = { duration: 0 }; + } + if (options.animation === false) { + options.animation = { duration: 0 }; + } + if (options.animation === true) { + options.animation = {}; + } + if (options.animation.duration === undefined) { + options.animation.duration = 1000; + } // default duration + if (options.animation.easingFunction === undefined) { + options.animation.easingFunction = "easeInOutQuad"; + } // default easing function - // remove buttons - if (selectedTotalCount !== 0) { - if (selectedNodeCount > 0 && this.options.deleteNode !== false) { - if (needSeperator === true) { - this._createSeperator(4); - } - this._createDeleteButton(locale); - } else if (selectedNodeCount === 0 && this.options.deleteEdge !== false) { - if (needSeperator === true) { - this._createSeperator(4); - } - this._createDeleteButton(locale); - } - } + this.animateView(options); + } - // bind the close button - this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); + /** + * + * @param {Object} options | options.offset = {x:number, y:number} // offset from the center in DOM pixels + * | options.time = number // animation time in milliseconds + * | options.scale = number // scale to animate to + * | options.position = {x:number, y:number} // position to animate to + * | options.easingFunction = String // linear, easeInQuad, easeOutQuad, easeInOutQuad, + * // easeInCubic, easeOutCubic, easeInOutCubic, + * // easeInQuart, easeOutQuart, easeInOutQuart, + * // easeInQuint, easeOutQuint, easeInOutQuint + */ - // refresh this bar based on what has been selected - this._temporaryBindEvent('select', this.showManipulatorToolbar.bind(this)); - } + }, { + key: 'animateView', + value: function animateView(options) { + if (options === undefined) { + return; + } + this.animationEasingFunction = options.animation.easingFunction; + // release if something focussed on the node + this.releaseNode(); + if (options.locked === true) { + this.lockedOnNodeId = options.lockedOnNode; + this.lockedOnNodeOffset = options.offset; + } - // redraw to show any possible changes - this.body.emitter.emit('_redraw'); + // forcefully complete the old animation if it was still running + if (this.easingTime != 0) { + this._transitionRedraw(true); // by setting easingtime to 1, we finish the animation. } - /** - * Create the toolbar for adding Nodes - */ + this.sourceScale = this.body.view.scale; + this.sourceTranslation = this.body.view.translation; + this.targetScale = options.scale; - }, { - key: 'addNodeMode', - value: function addNodeMode() { - // when using the gui, enable edit mode if it wasnt already. - if (this.editMode !== true) { - this.enableEditMode(); + // set the scale so the viewCenter is based on the correct zoom level. This is overridden in the transitionRedraw + // but at least then we'll have the target transition + this.body.view.scale = this.targetScale; + var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); + + var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node + x: viewCenter.x - options.position.x, + y: viewCenter.y - options.position.y + }; + this.targetTranslation = { + x: this.sourceTranslation.x + distanceFromCenter.x * this.targetScale + options.offset.x, + y: this.sourceTranslation.y + distanceFromCenter.y * this.targetScale + options.offset.y + }; + + // if the time is set to 0, don't do an animation + if (options.animation.duration === 0) { + if (this.lockedOnNodeId != undefined) { + this.viewFunction = this._lockedRedraw.bind(this); + this.body.emitter.on("initRedraw", this.viewFunction); + } else { + this.body.view.scale = this.targetScale; + this.body.view.translation = this.targetTranslation; + this.body.emitter.emit("_requestRedraw"); } + } else { + this.animationSpeed = 1 / (60 * options.animation.duration * 0.001) || 1 / 60; // 60 for 60 seconds, 0.001 for milli's + this.animationEasingFunction = options.animation.easingFunction; - // restore the state of any bound functions or events, remove control nodes, restore physics - this._clean(); + this.viewFunction = this._transitionRedraw.bind(this); + this.body.emitter.on("initRedraw", this.viewFunction); + this.body.emitter.emit("_startRendering"); + } + } - this.inMode = 'addNode'; - if (this.guiEnabled === true) { - var locale = this.options.locales[this.options.locale]; - this.manipulationDOM = {}; - this._createBackButton(locale); - this._createSeperator(); - this._createDescription(locale['addDescription'] || this.options.locales['en']['addDescription']); + /** + * used to animate smoothly by hijacking the redraw function. + * @private + */ - // bind the close button - this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); - } + }, { + key: '_lockedRedraw', + value: function _lockedRedraw() { + var nodePosition = { x: this.body.nodes[this.lockedOnNodeId].x, y: this.body.nodes[this.lockedOnNodeId].y }; + var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); + var distanceFromCenter = { // offset from view, distance view has to change by these x and y to center the node + x: viewCenter.x - nodePosition.x, + y: viewCenter.y - nodePosition.y + }; + var sourceTranslation = this.body.view.translation; + var targetTranslation = { + x: sourceTranslation.x + distanceFromCenter.x * this.body.view.scale + this.lockedOnNodeOffset.x, + y: sourceTranslation.y + distanceFromCenter.y * this.body.view.scale + this.lockedOnNodeOffset.y + }; - this._temporaryBindEvent('click', this._performAddNode.bind(this)); + this.body.view.translation = targetTranslation; + } + + /** + * Resets state of a locked on Node + */ + + }, { + key: 'releaseNode', + value: function releaseNode() { + if (this.lockedOnNodeId !== undefined && this.viewFunction !== undefined) { + this.body.emitter.off("initRedraw", this.viewFunction); + this.lockedOnNodeId = undefined; + this.lockedOnNodeOffset = undefined; } + } - /** - * call the bound function to handle the editing of the node. The node has to be selected. - */ + /** + * @param {boolean} [finished=false] + * @private + */ - }, { - key: 'editNode', - value: function editNode() { - var _this2 = this; + }, { + key: '_transitionRedraw', + value: function _transitionRedraw() { + var finished = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - // when using the gui, enable edit mode if it wasnt already. - if (this.editMode !== true) { - this.enableEditMode(); - } + this.easingTime += this.animationSpeed; + this.easingTime = finished === true ? 1.0 : this.easingTime; - // restore the state of any bound functions or events, remove control nodes, restore physics - this._clean(); - var node = this.selectionHandler._getSelectedNode(); - if (node !== undefined) { - this.inMode = 'editNode'; - if (typeof this.options.editNode === 'function') { - if (node.isCluster !== true) { - var data = util.deepExtend({}, node.options, false); - data.x = node.x; - data.y = node.y; - - if (this.options.editNode.length === 2) { - this.options.editNode(data, function (finalizedData) { - if (finalizedData !== null && finalizedData !== undefined && _this2.inMode === 'editNode') { - // if for whatever reason the mode has changes (due to dataset change) disregard the callback) { - _this2.body.data.nodes.getDataSet().update(finalizedData); - } - _this2.showManipulatorToolbar(); - }); - } else { - throw new Error('The function for edit does not support two arguments (data, callback)'); - } - } else { - alert(this.options.locales[this.options.locale]['editClusterError'] || this.options.locales['en']['editClusterError']); - } - } else { - throw new Error('No function has been configured to handle the editing of nodes.'); - } - } else { - this.showManipulatorToolbar(); + var progress = util.easingFunctions[this.animationEasingFunction](this.easingTime); + + this.body.view.scale = this.sourceScale + (this.targetScale - this.sourceScale) * progress; + this.body.view.translation = { + x: this.sourceTranslation.x + (this.targetTranslation.x - this.sourceTranslation.x) * progress, + y: this.sourceTranslation.y + (this.targetTranslation.y - this.sourceTranslation.y) * progress + }; + + // cleanup + if (this.easingTime >= 1.0) { + this.body.emitter.off("initRedraw", this.viewFunction); + this.easingTime = 0; + if (this.lockedOnNodeId != undefined) { + this.viewFunction = this._lockedRedraw.bind(this); + this.body.emitter.on("initRedraw", this.viewFunction); } + this.body.emitter.emit("animationFinished"); } + } - /** - * create the toolbar to connect nodes - */ + /** + * + * @returns {number} + */ - }, { - key: 'addEdgeMode', - value: function addEdgeMode() { - // when using the gui, enable edit mode if it wasnt already. - if (this.editMode !== true) { - this.enableEditMode(); - } + }, { + key: 'getScale', + value: function getScale() { + return this.body.view.scale; + } - // restore the state of any bound functions or events, remove control nodes, restore physics - this._clean(); + /** + * + * @returns {{x: number, y: number}} + */ - this.inMode = 'addEdge'; - if (this.guiEnabled === true) { - var locale = this.options.locales[this.options.locale]; - this.manipulationDOM = {}; - this._createBackButton(locale); - this._createSeperator(); - this._createDescription(locale['edgeDescription'] || this.options.locales['en']['edgeDescription']); + }, { + key: 'getViewPosition', + value: function getViewPosition() { + return this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); + } + }]); + return View; +}(); - // bind the close button - this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); - } +exports['default'] = View; - // temporarily overload functions - this._temporaryBindUI('onTouch', this._handleConnect.bind(this)); - this._temporaryBindUI('onDragEnd', this._finishConnect.bind(this)); - this._temporaryBindUI('onDrag', this._dragControlNode.bind(this)); - this._temporaryBindUI('onRelease', this._finishConnect.bind(this)); +/***/ }), +/* 232 */ +/***/ (function(module, exports, __webpack_require__) { - this._temporaryBindUI('onDragStart', function () {}); - this._temporaryBindUI('onHold', function () {}); - } +"use strict"; - /** - * create the toolbar to edit edges - */ - }, { - key: 'editEdgeMode', - value: function editEdgeMode() { - // when using the gui, enable edit mode if it wasn't already. - if (this.editMode !== true) { - this.enableEditMode(); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - // restore the state of any bound functions or events, remove control nodes, restore physics - this._clean(); +var _classCallCheck2 = __webpack_require__(0); - this.inMode = 'editEdge'; - if ((0, _typeof3['default'])(this.options.editEdge) === 'object' && typeof this.options.editEdge.editWithoutDrag === "function") { - this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0]; - if (this.edgeBeingEditedId !== undefined) { - var edge = this.body.edges[this.edgeBeingEditedId]; - this._performEditEdge(edge.from, edge.to); - return; - } - } - if (this.guiEnabled === true) { - var locale = this.options.locales[this.options.locale]; - this.manipulationDOM = {}; - this._createBackButton(locale); - this._createSeperator(); - this._createDescription(locale['editEdgeDescription'] || this.options.locales['en']['editEdgeDescription']); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - // bind the close button - this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); - } +var _createClass2 = __webpack_require__(1); - this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0]; - if (this.edgeBeingEditedId !== undefined) { - var _edge = this.body.edges[this.edgeBeingEditedId]; - - // create control nodes - var controlNodeFrom = this._getNewTargetNode(_edge.from.x, _edge.from.y); - var controlNodeTo = this._getNewTargetNode(_edge.to.x, _edge.to.y); - - this.temporaryIds.nodes.push(controlNodeFrom.id); - this.temporaryIds.nodes.push(controlNodeTo.id); - - this.body.nodes[controlNodeFrom.id] = controlNodeFrom; - this.body.nodeIndices.push(controlNodeFrom.id); - this.body.nodes[controlNodeTo.id] = controlNodeTo; - this.body.nodeIndices.push(controlNodeTo.id); - - // temporarily overload UI functions, cleaned up automatically because of _temporaryBindUI - this._temporaryBindUI('onTouch', this._controlNodeTouch.bind(this)); // used to get the position - this._temporaryBindUI('onTap', function () {}); // disabled - this._temporaryBindUI('onHold', function () {}); // disabled - this._temporaryBindUI('onDragStart', this._controlNodeDragStart.bind(this)); // used to select control node - this._temporaryBindUI('onDrag', this._controlNodeDrag.bind(this)); // used to drag control node - this._temporaryBindUI('onDragEnd', this._controlNodeDragEnd.bind(this)); // used to connect or revert control nodes - this._temporaryBindUI('onMouseMove', function () {}); // disabled - - // create function to position control nodes correctly on movement - // automatically cleaned up because we use the temporary bind - this._temporaryBindEvent('beforeDrawing', function (ctx) { - var positions = _edge.edgeType.findBorderPositions(ctx); - if (controlNodeFrom.selected === false) { - controlNodeFrom.x = positions.from.x; - controlNodeFrom.y = positions.from.y; - } - if (controlNodeTo.selected === false) { - controlNodeTo.x = positions.to.x; - controlNodeTo.y = positions.to.y; - } - }); +var _createClass3 = _interopRequireDefault(_createClass2); - this.body.emitter.emit('_redraw'); - } else { - this.showManipulatorToolbar(); - } - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - /** - * delete everything in the selection - */ +var util = __webpack_require__(2); +var NavigationHandler = __webpack_require__(233)['default']; +var Popup = __webpack_require__(104)['default']; - }, { - key: 'deleteSelected', - value: function deleteSelected() { - var _this3 = this; +/** + * Handler for interactions + */ - // when using the gui, enable edit mode if it wasnt already. - if (this.editMode !== true) { - this.enableEditMode(); - } +var InteractionHandler = function () { + /** + * @param {Object} body + * @param {Canvas} canvas + * @param {SelectionHandler} selectionHandler + */ + function InteractionHandler(body, canvas, selectionHandler) { + (0, _classCallCheck3['default'])(this, InteractionHandler); - // restore the state of any bound functions or events, remove control nodes, restore physics - this._clean(); + this.body = body; + this.canvas = canvas; + this.selectionHandler = selectionHandler; + this.navigationHandler = new NavigationHandler(body, canvas); + + // bind the events from hammer to functions in this object + this.body.eventListeners.onTap = this.onTap.bind(this); + this.body.eventListeners.onTouch = this.onTouch.bind(this); + this.body.eventListeners.onDoubleTap = this.onDoubleTap.bind(this); + this.body.eventListeners.onHold = this.onHold.bind(this); + this.body.eventListeners.onDragStart = this.onDragStart.bind(this); + this.body.eventListeners.onDrag = this.onDrag.bind(this); + this.body.eventListeners.onDragEnd = this.onDragEnd.bind(this); + this.body.eventListeners.onMouseWheel = this.onMouseWheel.bind(this); + this.body.eventListeners.onPinch = this.onPinch.bind(this); + this.body.eventListeners.onMouseMove = this.onMouseMove.bind(this); + this.body.eventListeners.onRelease = this.onRelease.bind(this); + this.body.eventListeners.onContext = this.onContext.bind(this); + + this.touchTime = 0; + this.drag = {}; + this.pinch = {}; + this.popup = undefined; + this.popupObj = undefined; + this.popupTimer = undefined; + + this.body.functions.getPointer = this.getPointer.bind(this); - this.inMode = 'delete'; - var selectedNodes = this.selectionHandler.getSelectedNodes(); - var selectedEdges = this.selectionHandler.getSelectedEdges(); - var deleteFunction = undefined; - if (selectedNodes.length > 0) { - for (var i = 0; i < selectedNodes.length; i++) { - if (this.body.nodes[selectedNodes[i]].isCluster === true) { - alert(this.options.locales[this.options.locale]['deleteClusterError'] || this.options.locales['en']['deleteClusterError']); - return; - } - } + this.options = {}; + this.defaultOptions = { + dragNodes: true, + dragView: true, + hover: false, + keyboard: { + enabled: false, + speed: { x: 10, y: 10, zoom: 0.02 }, + bindToWindow: true + }, + navigationButtons: false, + tooltipDelay: 300, + zoomView: true + }; + util.extend(this.options, this.defaultOptions); - if (typeof this.options.deleteNode === 'function') { - deleteFunction = this.options.deleteNode; - } - } else if (selectedEdges.length > 0) { - if (typeof this.options.deleteEdge === 'function') { - deleteFunction = this.options.deleteEdge; - } - } + this.bindEventListeners(); + } - if (typeof deleteFunction === 'function') { - var data = { nodes: selectedNodes, edges: selectedEdges }; - if (deleteFunction.length === 2) { - deleteFunction(data, function (finalizedData) { - if (finalizedData !== null && finalizedData !== undefined && _this3.inMode === 'delete') { - // if for whatever reason the mode has changes (due to dataset change) disregard the callback) { - _this3.body.data.edges.getDataSet().remove(finalizedData.edges); - _this3.body.data.nodes.getDataSet().remove(finalizedData.nodes); - _this3.body.emitter.emit('startSimulation'); - _this3.showManipulatorToolbar(); - } else { - _this3.body.emitter.emit('startSimulation'); - _this3.showManipulatorToolbar(); - } - }); - } else { - throw new Error('The function for delete does not support two arguments (data, callback)'); - } - } else { - this.body.data.edges.getDataSet().remove(selectedEdges); - this.body.data.nodes.getDataSet().remove(selectedNodes); - this.body.emitter.emit('startSimulation'); - this.showManipulatorToolbar(); - } - } + /** + * Binds event listeners + */ - //********************************************** PRIVATE ***************************************// - /** - * draw or remove the DOM - * @private - */ + (0, _createClass3['default'])(InteractionHandler, [{ + key: 'bindEventListeners', + value: function bindEventListeners() { + var _this = this; - }, { - key: '_setup', - value: function _setup() { - if (this.options.enabled === true) { - // Enable the GUI - this.guiEnabled = true; - - this._createWrappers(); - if (this.editMode === false) { - this._createEditButton(); - } else { - this.showManipulatorToolbar(); - } - } else { - this._removeManipulationDOM(); + this.body.emitter.on('destroy', function () { + clearTimeout(_this.popupTimer); + delete _this.body.functions.getPointer; + }); + } - // disable the gui - this.guiEnabled = false; - } - } + /** + * + * @param {Object} options + */ - /** - * create the div overlays that contain the DOM - * @private - */ + }, { + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + // extend all but the values in fields + var fields = ['hideEdgesOnDrag', 'hideNodesOnDrag', 'keyboard', 'multiselect', 'selectable', 'selectConnectedEdges']; + util.selectiveNotDeepExtend(fields, this.options, options); - }, { - key: '_createWrappers', - value: function _createWrappers() { - // load the manipulator HTML elements. All styling done in css. - if (this.manipulationDiv === undefined) { - this.manipulationDiv = document.createElement('div'); - this.manipulationDiv.className = 'vis-manipulation'; - if (this.editMode === true) { - this.manipulationDiv.style.display = 'block'; - } else { - this.manipulationDiv.style.display = 'none'; - } - this.canvas.frame.appendChild(this.manipulationDiv); - } + // merge the keyboard options in. + util.mergeOptions(this.options, options, 'keyboard'); - // container for the edit button. - if (this.editModeDiv === undefined) { - this.editModeDiv = document.createElement('div'); - this.editModeDiv.className = 'vis-edit-mode'; - if (this.editMode === true) { - this.editModeDiv.style.display = 'none'; - } else { - this.editModeDiv.style.display = 'block'; + if (options.tooltip) { + util.extend(this.options.tooltip, options.tooltip); + if (options.tooltip.color) { + this.options.tooltip.color = util.parseColor(options.tooltip.color); } - this.canvas.frame.appendChild(this.editModeDiv); - } - - // container for the close div button - if (this.closeDiv === undefined) { - this.closeDiv = document.createElement('div'); - this.closeDiv.className = 'vis-close'; - this.closeDiv.style.display = this.manipulationDiv.style.display; - this.canvas.frame.appendChild(this.closeDiv); } } - /** - * generate a new target node. Used for creating new edges and editing edges - * @param x - * @param y - * @returns {*} - * @private - */ + this.navigationHandler.setOptions(this.options); + } - }, { - key: '_getNewTargetNode', - value: function _getNewTargetNode(x, y) { - var controlNodeStyle = util.deepExtend({}, this.options.controlNodeStyle); + /** + * Get the pointer location from a touch location + * @param {{x: number, y: number}} touch + * @return {{x: number, y: number}} pointer + * @private + */ - controlNodeStyle.id = 'targetNode' + util.randomUUID(); - controlNodeStyle.hidden = false; - controlNodeStyle.physics = false; - controlNodeStyle.x = x; - controlNodeStyle.y = y; + }, { + key: 'getPointer', + value: function getPointer(touch) { + return { + x: touch.x - util.getAbsoluteLeft(this.canvas.frame.canvas), + y: touch.y - util.getAbsoluteTop(this.canvas.frame.canvas) + }; + } - // we have to define the bounding box in order for the nodes to be drawn immediately - var node = this.body.functions.createNode(controlNodeStyle); - node.shape.boundingBox = { left: x, right: x, top: y, bottom: y }; + /** + * On start of a touch gesture, store the pointer + * @param {Event} event The event + * @private + */ - return node; + }, { + key: 'onTouch', + value: function onTouch(event) { + if (new Date().valueOf() - this.touchTime > 50) { + this.drag.pointer = this.getPointer(event.center); + this.drag.pinched = false; + this.pinch.scale = this.body.view.scale; + // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame) + this.touchTime = new Date().valueOf(); } + } - /** - * Create the edit button - */ + /** + * handle tap/click event: select/unselect a node + * @param {Event} event + * @private + */ - }, { - key: '_createEditButton', - value: function _createEditButton() { - // restore everything to it's original state (if applicable) - this._clean(); + }, { + key: 'onTap', + value: function onTap(event) { + var pointer = this.getPointer(event.center); + var multiselect = this.selectionHandler.options.multiselect && (event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey); - // reset the manipulationDOM - this.manipulationDOM = {}; + this.checkSelectionChanges(pointer, event, multiselect); + this.selectionHandler._generateClickEvent('click', event, pointer); + } - // empty the editModeDiv - util.recursiveDOMDelete(this.editModeDiv); + /** + * handle doubletap event + * @param {Event} event + * @private + */ - // create the contents for the editMode button - var locale = this.options.locales[this.options.locale]; - var button = this._createButton('editMode', 'vis-button vis-edit vis-edit-mode', locale['edit'] || this.options.locales['en']['edit']); - this.editModeDiv.appendChild(button); + }, { + key: 'onDoubleTap', + value: function onDoubleTap(event) { + var pointer = this.getPointer(event.center); + this.selectionHandler._generateClickEvent('doubleClick', event, pointer); + } - // bind a hammer listener to the button, calling the function toggleEditMode. - this._bindHammerToDiv(button, this.toggleEditMode.bind(this)); - } + /** + * handle long tap event: multi select nodes + * @param {Event} event + * @private + */ - /** - * this function cleans up after everything this module does. Temporary elements, functions and events are removed, physics restored, hammers removed. - * @private - */ + }, { + key: 'onHold', + value: function onHold(event) { + var pointer = this.getPointer(event.center); + var multiselect = this.selectionHandler.options.multiselect; - }, { - key: '_clean', - value: function _clean() { - // not in mode - this.inMode = false; + this.checkSelectionChanges(pointer, event, multiselect); - // _clean the divs - if (this.guiEnabled === true) { - util.recursiveDOMDelete(this.editModeDiv); - util.recursiveDOMDelete(this.manipulationDiv); + this.selectionHandler._generateClickEvent('click', event, pointer); + this.selectionHandler._generateClickEvent('hold', event, pointer); + } - // removes all the bindings and overloads - this._cleanManipulatorHammers(); - } + /** + * handle the release of the screen + * + * @param {Event} event + * @private + */ - // remove temporary nodes and edges - this._cleanupTemporaryNodesAndEdges(); + }, { + key: 'onRelease', + value: function onRelease(event) { + if (new Date().valueOf() - this.touchTime > 10) { + var pointer = this.getPointer(event.center); + this.selectionHandler._generateClickEvent('release', event, pointer); + // to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame) + this.touchTime = new Date().valueOf(); + } + } - // restore overloaded UI functions - this._unbindTemporaryUIs(); + /** + * + * @param {Event} event + */ - // remove the temporaryEventFunctions - this._unbindTemporaryEvents(); + }, { + key: 'onContext', + value: function onContext(event) { + var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); + this.selectionHandler._generateClickEvent('oncontext', event, pointer); + } - // restore the physics if required - this.body.emitter.emit('restorePhysics'); - } + /** + * Select and deselect nodes depending current selection change. + * + * For changing nodes, select/deselect events are fired. + * + * NOTE: For a given edge, if one connecting node is deselected and with the same + * click the other node is selected, no events for the edge will fire. + * It was selected and it will remain selected. + * + * TODO: This is all SelectionHandler calls; the method should be moved to there. + * + * @param {{x: number, y: number}} pointer + * @param {Event} event + * @param {boolean} [add=false] + */ - /** - * Each dom element has it's own hammer. They are stored in this.manipulationHammers. This cleans them up. - * @private - */ + }, { + key: 'checkSelectionChanges', + value: function checkSelectionChanges(pointer, event) { + var add = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - }, { - key: '_cleanManipulatorHammers', - value: function _cleanManipulatorHammers() { - // _clean hammer bindings - if (this.manipulationHammers.length != 0) { - for (var i = 0; i < this.manipulationHammers.length; i++) { - this.manipulationHammers[i].destroy(); - } - this.manipulationHammers = []; - } + var previousSelection = this.selectionHandler.getSelection(); + var selected = false; + if (add === true) { + selected = this.selectionHandler.selectAdditionalOnPoint(pointer); + } else { + selected = this.selectionHandler.selectOnPoint(pointer); } + var currentSelection = this.selectionHandler.getSelection(); - /** - * Remove all DOM elements created by this module. - * @private - */ - - }, { - key: '_removeManipulationDOM', - value: function _removeManipulationDOM() { - // removes all the bindings and overloads - this._clean(); - - // empty the manipulation divs - util.recursiveDOMDelete(this.manipulationDiv); - util.recursiveDOMDelete(this.editModeDiv); - util.recursiveDOMDelete(this.closeDiv); + // See NOTE in method comment for the reason to do it like this + var deselectedItems = this._determineDifference(previousSelection, currentSelection); + var selectedItems = this._determineDifference(currentSelection, previousSelection); - // remove the manipulation divs - if (this.manipulationDiv) { - this.canvas.frame.removeChild(this.manipulationDiv); - } - if (this.editModeDiv) { - this.canvas.frame.removeChild(this.editModeDiv); - } - if (this.closeDiv) { - this.canvas.frame.removeChild(this.closeDiv); - } + if (deselectedItems.edges.length > 0) { + this.selectionHandler._generateClickEvent('deselectEdge', event, pointer, previousSelection); + selected = true; + } - // set the references to undefined - this.manipulationDiv = undefined; - this.editModeDiv = undefined; - this.closeDiv = undefined; + if (deselectedItems.nodes.length > 0) { + this.selectionHandler._generateClickEvent('deselectNode', event, pointer, previousSelection); + selected = true; } - /** - * create a seperator line. the index is to differentiate in the manipulation dom - * @param index - * @private - */ + if (selectedItems.nodes.length > 0) { + this.selectionHandler._generateClickEvent('selectNode', event, pointer); + selected = true; + } - }, { - key: '_createSeperator', - value: function _createSeperator() { - var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + if (selectedItems.edges.length > 0) { + this.selectionHandler._generateClickEvent('selectEdge', event, pointer); + selected = true; + } - this.manipulationDOM['seperatorLineDiv' + index] = document.createElement('div'); - this.manipulationDOM['seperatorLineDiv' + index].className = 'vis-separator-line'; - this.manipulationDiv.appendChild(this.manipulationDOM['seperatorLineDiv' + index]); + // fire the select event if anything has been selected or deselected + if (selected === true) { + // select or unselect + this.selectionHandler._generateClickEvent('select', event, pointer); } + } - // ---------------------- DOM functions for buttons --------------------------// + /** + * Remove all node and edge id's from the first set that are present in the second one. + * + * @param {{nodes: Array., edges: Array.}} firstSet + * @param {{nodes: Array., edges: Array.}} secondSet + * @returns {{nodes: Array., edges: Array.}} + * @private + */ - }, { - key: '_createAddNodeButton', - value: function _createAddNodeButton(locale) { - var button = this._createButton('addNode', 'vis-button vis-add', locale['addNode'] || this.options.locales['en']['addNode']); - this.manipulationDiv.appendChild(button); - this._bindHammerToDiv(button, this.addNodeMode.bind(this)); - } - }, { - key: '_createAddEdgeButton', - value: function _createAddEdgeButton(locale) { - var button = this._createButton('addEdge', 'vis-button vis-connect', locale['addEdge'] || this.options.locales['en']['addEdge']); - this.manipulationDiv.appendChild(button); - this._bindHammerToDiv(button, this.addEdgeMode.bind(this)); - } - }, { - key: '_createEditNodeButton', - value: function _createEditNodeButton(locale) { - var button = this._createButton('editNode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']); - this.manipulationDiv.appendChild(button); - this._bindHammerToDiv(button, this.editNode.bind(this)); - } - }, { - key: '_createEditEdgeButton', - value: function _createEditEdgeButton(locale) { - var button = this._createButton('editEdge', 'vis-button vis-edit', locale['editEdge'] || this.options.locales['en']['editEdge']); - this.manipulationDiv.appendChild(button); - this._bindHammerToDiv(button, this.editEdgeMode.bind(this)); - } - }, { - key: '_createDeleteButton', - value: function _createDeleteButton(locale) { - if (this.options.rtl) { - var deleteBtnClass = 'vis-button vis-delete-rtl'; - } else { - var deleteBtnClass = 'vis-button vis-delete'; - } - var button = this._createButton('delete', deleteBtnClass, locale['del'] || this.options.locales['en']['del']); - this.manipulationDiv.appendChild(button); - this._bindHammerToDiv(button, this.deleteSelected.bind(this)); - } - }, { - key: '_createBackButton', - value: function _createBackButton(locale) { - var button = this._createButton('back', 'vis-button vis-back', locale['back'] || this.options.locales['en']['back']); - this.manipulationDiv.appendChild(button); - this._bindHammerToDiv(button, this.showManipulatorToolbar.bind(this)); - } - }, { - key: '_createButton', - value: function _createButton(id, className, label) { - var labelClassName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vis-label'; + }, { + key: '_determineDifference', + value: function _determineDifference(firstSet, secondSet) { + var arrayDiff = function arrayDiff(firstArr, secondArr) { + var result = []; + for (var i = 0; i < firstArr.length; i++) { + var value = firstArr[i]; + if (secondArr.indexOf(value) === -1) { + result.push(value); + } + } - this.manipulationDOM[id + 'Div'] = document.createElement('div'); - this.manipulationDOM[id + 'Div'].className = className; - this.manipulationDOM[id + 'Label'] = document.createElement('div'); - this.manipulationDOM[id + 'Label'].className = labelClassName; - this.manipulationDOM[id + 'Label'].innerHTML = label; - this.manipulationDOM[id + 'Div'].appendChild(this.manipulationDOM[id + 'Label']); - return this.manipulationDOM[id + 'Div']; - } - }, { - key: '_createDescription', - value: function _createDescription(label) { - this.manipulationDiv.appendChild(this._createButton('description', 'vis-button vis-none', label)); - } + return result; + }; - // -------------------------- End of DOM functions for buttons ------------------------------// + return { + nodes: arrayDiff(firstSet.nodes, secondSet.nodes), + edges: arrayDiff(firstSet.edges, secondSet.edges) + }; + } - /** - * this binds an event until cleanup by the clean functions. - * @param event - * @param newFunction - * @private - */ + /** + * This function is called by onDragStart. + * It is separated out because we can then overload it for the datamanipulation system. + * + * @param {Event} event + * @private + */ - }, { - key: '_temporaryBindEvent', - value: function _temporaryBindEvent(event, newFunction) { - this.temporaryEventFunctions.push({ event: event, boundFunction: newFunction }); - this.body.emitter.on(event, newFunction); + }, { + key: 'onDragStart', + value: function onDragStart(event) { + //in case the touch event was triggered on an external div, do the initial touch now. + if (this.drag.pointer === undefined) { + this.onTouch(event); } - /** - * this overrides an UI function until cleanup by the clean function - * @param UIfunctionName - * @param newFunction - * @private - */ + // note: drag.pointer is set in onTouch to get the initial touch location + var node = this.selectionHandler.getNodeAt(this.drag.pointer); - }, { - key: '_temporaryBindUI', - value: function _temporaryBindUI(UIfunctionName, newFunction) { - if (this.body.eventListeners[UIfunctionName] !== undefined) { - this.temporaryUIFunctions[UIfunctionName] = this.body.eventListeners[UIfunctionName]; - this.body.eventListeners[UIfunctionName] = newFunction; - } else { - throw new Error('This UI function does not exist. Typo? You tried: ' + UIfunctionName + ' possible are: ' + (0, _stringify2['default'])((0, _keys2['default'])(this.body.eventListeners))); - } - } + this.drag.dragging = true; + this.drag.selection = []; + this.drag.translation = util.extend({}, this.body.view.translation); // copy the object + this.drag.nodeId = undefined; - /** - * Restore the overridden UI functions to their original state. - * - * @private - */ + if (node !== undefined && this.options.dragNodes === true) { + this.drag.nodeId = node.id; + // select the clicked node if not yet selected + if (node.isSelected() === false) { + this.selectionHandler.unselectAll(); + this.selectionHandler.selectObject(node); + } + + // after select to contain the node + this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer); + + var selection = this.selectionHandler.selectionObj.nodes; + // create an array with the selected nodes and their original location and status + for (var nodeId in selection) { + if (selection.hasOwnProperty(nodeId)) { + var object = selection[nodeId]; + var s = { + id: object.id, + node: object, + + // store original x, y, xFixed and yFixed, make the node temporarily Fixed + x: object.x, + y: object.y, + xFixed: object.options.fixed.x, + yFixed: object.options.fixed.y + }; - }, { - key: '_unbindTemporaryUIs', - value: function _unbindTemporaryUIs() { - for (var functionName in this.temporaryUIFunctions) { - if (this.temporaryUIFunctions.hasOwnProperty(functionName)) { - this.body.eventListeners[functionName] = this.temporaryUIFunctions[functionName]; - delete this.temporaryUIFunctions[functionName]; + object.options.fixed.x = true; + object.options.fixed.y = true; + + this.drag.selection.push(s); } } - this.temporaryUIFunctions = {}; + } else { + // fallback if no node is selected and thus the view is dragged. + this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer, undefined, true); } + } - /** - * Unbind the events created by _temporaryBindEvent - * @private - */ + /** + * handle drag event + * @param {Event} event + * @private + */ - }, { - key: '_unbindTemporaryEvents', - value: function _unbindTemporaryEvents() { - for (var i = 0; i < this.temporaryEventFunctions.length; i++) { - var eventName = this.temporaryEventFunctions[i].event; - var boundFunction = this.temporaryEventFunctions[i].boundFunction; - this.body.emitter.off(eventName, boundFunction); - } - this.temporaryEventFunctions = []; + }, { + key: 'onDrag', + value: function onDrag(event) { + var _this2 = this; + + if (this.drag.pinched === true) { + return; } - /** - * Bind an hammer instance to a DOM element. - * @param domElement - * @param funct - */ + // remove the focus on node if it is focussed on by the focusOnNode + this.body.emitter.emit('unlockNode'); - }, { - key: '_bindHammerToDiv', - value: function _bindHammerToDiv(domElement, boundFunction) { - var hammer = new Hammer(domElement, {}); - hammerUtil.onTouch(hammer, boundFunction); - this.manipulationHammers.push(hammer); - } + var pointer = this.getPointer(event.center); - /** - * Neatly clean up temporary edges and nodes - * @private - */ + var selection = this.drag.selection; + if (selection && selection.length && this.options.dragNodes === true) { + this.selectionHandler._generateClickEvent('dragging', event, pointer); - }, { - key: '_cleanupTemporaryNodesAndEdges', - value: function _cleanupTemporaryNodesAndEdges() { - // _clean temporary edges - for (var i = 0; i < this.temporaryIds.edges.length; i++) { - this.body.edges[this.temporaryIds.edges[i]].disconnect(); - delete this.body.edges[this.temporaryIds.edges[i]]; - var indexTempEdge = this.body.edgeIndices.indexOf(this.temporaryIds.edges[i]); - if (indexTempEdge !== -1) { - this.body.edgeIndices.splice(indexTempEdge, 1); + // calculate delta's and new location + var deltaX = pointer.x - this.drag.pointer.x; + var deltaY = pointer.y - this.drag.pointer.y; + + // update position of all selected nodes + selection.forEach(function (selection) { + var node = selection.node; + // only move the node if it was not fixed initially + if (selection.xFixed === false) { + node.x = _this2.canvas._XconvertDOMtoCanvas(_this2.canvas._XconvertCanvasToDOM(selection.x) + deltaX); } - } + // only move the node if it was not fixed initially + if (selection.yFixed === false) { + node.y = _this2.canvas._YconvertDOMtoCanvas(_this2.canvas._YconvertCanvasToDOM(selection.y) + deltaY); + } + }); + + // start the simulation of the physics + this.body.emitter.emit('startSimulation'); + } else { + // move the network + if (this.options.dragView === true) { + this.selectionHandler._generateClickEvent('dragging', event, pointer, undefined, true); - // _clean temporary nodes - for (var _i = 0; _i < this.temporaryIds.nodes.length; _i++) { - delete this.body.nodes[this.temporaryIds.nodes[_i]]; - var indexTempNode = this.body.nodeIndices.indexOf(this.temporaryIds.nodes[_i]); - if (indexTempNode !== -1) { - this.body.nodeIndices.splice(indexTempNode, 1); + // if the drag was not started properly because the click started outside the network div, start it now. + if (this.drag.pointer === undefined) { + this.onDragStart(event); + return; } + var diffX = pointer.x - this.drag.pointer.x; + var diffY = pointer.y - this.drag.pointer.y; + + this.body.view.translation = { x: this.drag.translation.x + diffX, y: this.drag.translation.y + diffY }; + this.body.emitter.emit('_requestRedraw'); } + } + } + + /** + * handle drag start event + * @param {Event} event + * @private + */ - this.temporaryIds = { nodes: [], edges: [] }; + }, { + key: 'onDragEnd', + value: function onDragEnd(event) { + this.drag.dragging = false; + var selection = this.drag.selection; + if (selection && selection.length) { + selection.forEach(function (s) { + // restore original xFixed and yFixed + s.node.options.fixed.x = s.xFixed; + s.node.options.fixed.y = s.yFixed; + }); + this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center)); + this.body.emitter.emit('startSimulation'); + } else { + this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center), undefined, true); + this.body.emitter.emit('_requestRedraw'); } + } - // ------------------------------------------ EDIT EDGE FUNCTIONS -----------------------------------------// + /** + * Handle pinch event + * @param {Event} event The event + * @private + */ - /** - * the touch is used to get the position of the initial click - * @param event - * @private - */ + }, { + key: 'onPinch', + value: function onPinch(event) { + var pointer = this.getPointer(event.center); - }, { - key: '_controlNodeTouch', - value: function _controlNodeTouch(event) { - this.selectionHandler.unselectAll(); - this.lastTouch = this.body.functions.getPointer(event.center); - this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object + this.drag.pinched = true; + if (this.pinch['scale'] === undefined) { + this.pinch.scale = 1; } - /** - * the drag start is used to mark one of the control nodes as selected. - * @param event - * @private - */ - - }, { - key: '_controlNodeDragStart', - value: function _controlNodeDragStart(event) { - var pointer = this.lastTouch; - var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); - var from = this.body.nodes[this.temporaryIds.nodes[0]]; - var to = this.body.nodes[this.temporaryIds.nodes[1]]; - var edge = this.body.edges[this.edgeBeingEditedId]; - this.selectedControlNode = undefined; + // TODO: enabled moving while pinching? + var scale = this.pinch.scale * event.scale; + this.zoom(scale, pointer); + } - var fromSelect = from.isOverlappingWith(pointerObj); - var toSelect = to.isOverlappingWith(pointerObj); + /** + * Zoom the network in or out + * @param {number} scale a number around 1, and between 0.01 and 10 + * @param {{x: number, y: number}} pointer Position on screen + * @private + */ - if (fromSelect === true) { - this.selectedControlNode = from; - edge.edgeType.from = from; - } else if (toSelect === true) { - this.selectedControlNode = to; - edge.edgeType.to = to; + }, { + key: 'zoom', + value: function zoom(scale, pointer) { + if (this.options.zoomView === true) { + var scaleOld = this.body.view.scale; + if (scale < 0.00001) { + scale = 0.00001; + } + if (scale > 10) { + scale = 10; } - // we use the selection to find the node that is being dragged. We explicitly select it here. - if (this.selectedControlNode !== undefined) { - this.selectionHandler.selectObject(this.selectedControlNode); + var preScaleDragPointer = undefined; + if (this.drag !== undefined) { + if (this.drag.dragging === true) { + preScaleDragPointer = this.canvas.DOMtoCanvas(this.drag.pointer); + } } + // + this.canvas.frame.canvas.clientHeight / 2 + var translation = this.body.view.translation; - this.body.emitter.emit('_redraw'); - } + var scaleFrac = scale / scaleOld; + var tx = (1 - scaleFrac) * pointer.x + translation.x * scaleFrac; + var ty = (1 - scaleFrac) * pointer.y + translation.y * scaleFrac; - /** - * dragging the control nodes or the canvas - * @param event - * @private - */ + this.body.view.scale = scale; + this.body.view.translation = { x: tx, y: ty }; - }, { - key: '_controlNodeDrag', - value: function _controlNodeDrag(event) { - this.body.emitter.emit('disablePhysics'); - var pointer = this.body.functions.getPointer(event.center); - var pos = this.canvas.DOMtoCanvas(pointer); - if (this.selectedControlNode !== undefined) { - this.selectedControlNode.x = pos.x; - this.selectedControlNode.y = pos.y; + if (preScaleDragPointer != undefined) { + var postScaleDragPointer = this.canvas.canvasToDOM(preScaleDragPointer); + this.drag.pointer.x = postScaleDragPointer.x; + this.drag.pointer.y = postScaleDragPointer.y; + } + + this.body.emitter.emit('_requestRedraw'); + + if (scaleOld < scale) { + this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: pointer }); } else { - // if the drag was not started properly because the click started outside the network div, start it now. - var diffX = pointer.x - this.lastTouch.x; - var diffY = pointer.y - this.lastTouch.y; - this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY }; + this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: pointer }); } - this.body.emitter.emit('_redraw'); } + } - /** - * connecting or restoring the control nodes. - * @param event - * @private - */ + /** + * Event handler for mouse wheel event, used to zoom the timeline + * See http://adomas.org/javascript-mouse-wheel/ + * https://github.com/EightMedia/hammer.js/issues/256 + * @param {MouseEvent} event + * @private + */ - }, { - key: '_controlNodeDragEnd', - value: function _controlNodeDragEnd(event) { - var pointer = this.body.functions.getPointer(event.center); - var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); - var edge = this.body.edges[this.edgeBeingEditedId]; - // if the node that was dragged is not a control node, return - if (this.selectedControlNode === undefined) { - return; + }, { + key: 'onMouseWheel', + value: function onMouseWheel(event) { + if (this.options.zoomView === true) { + // retrieve delta + var delta = 0; + if (event.wheelDelta) { + /* IE/Opera. */ + delta = event.wheelDelta / 120; + } else if (event.detail) { + /* Mozilla case. */ + // In Mozilla, sign of delta is different than in IE. + // Also, delta is multiple of 3. + delta = -event.detail / 3; } - // we use the selection to find the node that is being dragged. We explicitly DEselect the control node here. - this.selectionHandler.unselectAll(); - var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); - var node = undefined; - for (var i = overlappingNodeIds.length - 1; i >= 0; i--) { - if (overlappingNodeIds[i] !== this.selectedControlNode.id) { - node = this.body.nodes[overlappingNodeIds[i]]; - break; - } - } - // perform the connection - if (node !== undefined && this.selectedControlNode !== undefined) { - if (node.isCluster === true) { - alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']); - } else { - var from = this.body.nodes[this.temporaryIds.nodes[0]]; - if (this.selectedControlNode.id === from.id) { - this._performEditEdge(node.id, edge.to.id); - } else { - this._performEditEdge(edge.from.id, node.id); - } + // If delta is nonzero, handle it. + // Basically, delta is now positive if wheel was scrolled up, + // and negative, if wheel was scrolled down. + if (delta !== 0) { + + // calculate the new scale + var scale = this.body.view.scale; + var zoom = delta / 10; + if (delta < 0) { + zoom = zoom / (1 - zoom); } - } else { - edge.updateEdgeType(); - this.body.emitter.emit('restorePhysics'); + scale *= 1 + zoom; + + // calculate the pointer location + var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); + + // apply the new scale + this.zoom(scale, pointer); } - this.body.emitter.emit('_redraw'); + + // Prevent default actions caused by mouse wheel. + event.preventDefault(); } + } - // ------------------------------------ END OF EDIT EDGE FUNCTIONS -----------------------------------------// + /** + * Mouse move handler for checking whether the title moves over a node with a title. + * @param {Event} event + * @private + */ + }, { + key: 'onMouseMove', + value: function onMouseMove(event) { + var _this3 = this; - // ------------------------------------------- ADD EDGE FUNCTIONS -----------------------------------------// - /** - * the function bound to the selection event. It checks if you want to connect a cluster and changes the description - * to walk the user through the process. - * - * @private - */ + var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); + var popupVisible = false; - }, { - key: '_handleConnect', - value: function _handleConnect(event) { - // check to avoid double fireing of this function. - if (new Date().valueOf() - this.touchTime > 100) { - this.lastTouch = this.body.functions.getPointer(event.center); - this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object - - var pointer = this.lastTouch; - var node = this.selectionHandler.getNodeAt(pointer); - - if (node !== undefined) { - if (node.isCluster === true) { - alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']); - } else { - // create a node the temporary line can look at - var targetNode = this._getNewTargetNode(node.x, node.y); - this.body.nodes[targetNode.id] = targetNode; - this.body.nodeIndices.push(targetNode.id); - - // create a temporary edge - var connectionEdge = this.body.functions.createEdge({ - id: 'connectionEdge' + util.randomUUID(), - from: node.id, - to: targetNode.id, - physics: false, - smooth: { - enabled: true, - type: 'continuous', - roundness: 0.5 - } - }); - this.body.edges[connectionEdge.id] = connectionEdge; - this.body.edgeIndices.push(connectionEdge.id); + // check if the previously selected node is still selected + if (this.popup !== undefined) { + if (this.popup.hidden === false) { + this._checkHidePopup(pointer); + } - this.temporaryIds.nodes.push(targetNode.id); - this.temporaryIds.edges.push(connectionEdge.id); - } - } - this.touchTime = new Date().valueOf(); + // if the popup was not hidden above + if (this.popup.hidden === false) { + popupVisible = true; + this.popup.setPosition(pointer.x + 3, pointer.y - 5); + this.popup.show(); } } - }, { - key: '_dragControlNode', - value: function _dragControlNode(event) { - var pointer = this.body.functions.getPointer(event.center); - if (this.temporaryIds.nodes[0] !== undefined) { - var targetNode = this.body.nodes[this.temporaryIds.nodes[0]]; // there is only one temp node in the add edge mode. - targetNode.x = this.canvas._XconvertDOMtoCanvas(pointer.x); - targetNode.y = this.canvas._YconvertDOMtoCanvas(pointer.y); - this.body.emitter.emit('_redraw'); - } else { - var diffX = pointer.x - this.lastTouch.x; - var diffY = pointer.y - this.lastTouch.y; - this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY }; + + // if we bind the keyboard to the div, we have to highlight it to use it. This highlights it on mouse over. + if (this.options.keyboard.bindToWindow === false && this.options.keyboard.enabled === true) { + this.canvas.frame.focus(); + } + + // start a timeout that will check if the mouse is positioned above an element + if (popupVisible === false) { + if (this.popupTimer !== undefined) { + clearInterval(this.popupTimer); // stop any running calculationTimer + this.popupTimer = undefined; + } + if (!this.drag.dragging) { + this.popupTimer = setTimeout(function () { + return _this3._checkShowPopup(pointer); + }, this.options.tooltipDelay); } } - /** - * Connect the new edge to the target if one exists, otherwise remove temp line - * @param event - * @private - */ + // adding hover highlights + if (this.options.hover === true) { + this.selectionHandler.hoverObject(event, pointer); + } + } - }, { - key: '_finishConnect', - value: function _finishConnect(event) { - var pointer = this.body.functions.getPointer(event.center); - var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); - - // remember the edge id - var connectFromId = undefined; - if (this.temporaryIds.edges[0] !== undefined) { - connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId; - } - - // get the overlapping node but NOT the temporary node; - var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); - var node = undefined; - for (var i = overlappingNodeIds.length - 1; i >= 0; i--) { - // if the node id is NOT a temporary node, accept the node. - if (this.temporaryIds.nodes.indexOf(overlappingNodeIds[i]) === -1) { - node = this.body.nodes[overlappingNodeIds[i]]; - break; - } - } + /** + * Check if there is an element on the given position in the network + * (a node or edge). If so, and if this element has a title, + * show a popup window with its title. + * + * @param {{x:number, y:number}} pointer + * @private + */ - // clean temporary nodes and edges. - this._cleanupTemporaryNodesAndEdges(); + }, { + key: '_checkShowPopup', + value: function _checkShowPopup(pointer) { + var x = this.canvas._XconvertDOMtoCanvas(pointer.x); + var y = this.canvas._YconvertDOMtoCanvas(pointer.y); + var pointerObj = { + left: x, + top: y, + right: x, + bottom: y + }; - // perform the connection - if (node !== undefined) { - if (node.isCluster === true) { - alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']); - } else { - if (this.body.nodes[connectFromId] !== undefined && this.body.nodes[node.id] !== undefined) { - this._performAddEdge(connectFromId, node.id); + var previousPopupObjId = this.popupObj === undefined ? undefined : this.popupObj.id; + var nodeUnderCursor = false; + var popupType = 'node'; + + // check if a node is under the cursor. + if (this.popupObj === undefined) { + // search the nodes for overlap, select the top one in case of multiple nodes + var nodeIndices = this.body.nodeIndices; + var nodes = this.body.nodes; + var node = void 0; + var overlappingNodes = []; + for (var i = 0; i < nodeIndices.length; i++) { + node = nodes[nodeIndices[i]]; + if (node.isOverlappingWith(pointerObj) === true) { + if (node.getTitle() !== undefined) { + overlappingNodes.push(nodeIndices[i]); } } } - this.body.emitter.emit('_redraw'); + + if (overlappingNodes.length > 0) { + // if there are overlapping nodes, select the last one, this is the one which is drawn on top of the others + this.popupObj = nodes[overlappingNodes[overlappingNodes.length - 1]]; + // if you hover over a node, the title of the edge is not supposed to be shown. + nodeUnderCursor = true; + } } - // --------------------------------------- END OF ADD EDGE FUNCTIONS -------------------------------------// + if (this.popupObj === undefined && nodeUnderCursor === false) { + // search the edges for overlap + var edgeIndices = this.body.edgeIndices; + var edges = this.body.edges; + var edge = void 0; + var overlappingEdges = []; + for (var _i = 0; _i < edgeIndices.length; _i++) { + edge = edges[edgeIndices[_i]]; + if (edge.isOverlappingWith(pointerObj) === true) { + if (edge.connected === true && edge.getTitle() !== undefined) { + overlappingEdges.push(edgeIndices[_i]); + } + } + } + if (overlappingEdges.length > 0) { + this.popupObj = edges[overlappingEdges[overlappingEdges.length - 1]]; + popupType = 'edge'; + } + } - // ------------------------------ Performing all the actual data manipulation ------------------------// + if (this.popupObj !== undefined) { + // show popup message window + if (this.popupObj.id !== previousPopupObjId) { + if (this.popup === undefined) { + this.popup = new Popup(this.canvas.frame); + } - /** - * Adds a node on the specified location - */ + this.popup.popupTargetType = popupType; + this.popup.popupTargetId = this.popupObj.id; - }, { - key: '_performAddNode', - value: function _performAddNode(clickData) { - var _this4 = this; - - var defaultData = { - id: util.randomUUID(), - x: clickData.pointer.canvas.x, - y: clickData.pointer.canvas.y, - label: 'new' - }; - - if (typeof this.options.addNode === 'function') { - if (this.options.addNode.length === 2) { - this.options.addNode(defaultData, function (finalizedData) { - if (finalizedData !== null && finalizedData !== undefined && _this4.inMode === 'addNode') { - // if for whatever reason the mode has changes (due to dataset change) disregard the callback - _this4.body.data.nodes.getDataSet().add(finalizedData); - _this4.showManipulatorToolbar(); - } - }); - } else { - throw new Error('The function for add does not support two arguments (data,callback)'); - this.showManipulatorToolbar(); - } - } else { - this.body.data.nodes.getDataSet().add(defaultData); - this.showManipulatorToolbar(); + // adjust a small offset such that the mouse cursor is located in the + // bottom left location of the popup, and you can easily move over the + // popup area + this.popup.setPosition(pointer.x + 3, pointer.y - 5); + this.popup.setText(this.popupObj.getTitle()); + this.popup.show(); + this.body.emitter.emit('showPopup', this.popupObj.id); + } + } else { + if (this.popup !== undefined) { + this.popup.hide(); + this.body.emitter.emit('hidePopup'); } } + } - /** - * connect two nodes with a new edge. - * - * @private - */ + /** + * Check if the popup must be hidden, which is the case when the mouse is no + * longer hovering on the object + * @param {{x:number, y:number}} pointer + * @private + */ - }, { - key: '_performAddEdge', - value: function _performAddEdge(sourceNodeId, targetNodeId) { - var _this5 = this; - - var defaultData = { from: sourceNodeId, to: targetNodeId }; - if (typeof this.options.addEdge === 'function') { - if (this.options.addEdge.length === 2) { - this.options.addEdge(defaultData, function (finalizedData) { - if (finalizedData !== null && finalizedData !== undefined && _this5.inMode === 'addEdge') { - // if for whatever reason the mode has changes (due to dataset change) disregard the callback - _this5.body.data.edges.getDataSet().add(finalizedData); - _this5.selectionHandler.unselectAll(); - _this5.showManipulatorToolbar(); - } - }); - } else { - throw new Error('The function for connect does not support two arguments (data,callback)'); - } - } else { - this.body.data.edges.getDataSet().add(defaultData); - this.selectionHandler.unselectAll(); - this.showManipulatorToolbar(); - } - } + }, { + key: '_checkHidePopup', + value: function _checkHidePopup(pointer) { + var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); - /** - * connect two nodes with a new edge. - * - * @private - */ + var stillOnObj = false; + if (this.popup.popupTargetType === 'node') { + if (this.body.nodes[this.popup.popupTargetId] !== undefined) { + stillOnObj = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(pointerObj); - }, { - key: '_performEditEdge', - value: function _performEditEdge(sourceNodeId, targetNodeId) { - var _this6 = this; - - var defaultData = { id: this.edgeBeingEditedId, from: sourceNodeId, to: targetNodeId, label: this.body.data.edges._data[this.edgeBeingEditedId].label }; - var eeFunct = this.options.editEdge; - if ((typeof eeFunct === 'undefined' ? 'undefined' : (0, _typeof3['default'])(eeFunct)) === 'object') { - eeFunct = eeFunct.editWithoutDrag; - } - if (typeof eeFunct === 'function') { - if (eeFunct.length === 2) { - eeFunct(defaultData, function (finalizedData) { - if (finalizedData === null || finalizedData === undefined || _this6.inMode !== 'editEdge') { - // if for whatever reason the mode has changes (due to dataset change) disregard the callback) { - _this6.body.edges[defaultData.id].updateEdgeType(); - _this6.body.emitter.emit('_redraw'); - _this6.showManipulatorToolbar(); - } else { - _this6.body.data.edges.getDataSet().update(finalizedData); - _this6.selectionHandler.unselectAll(); - _this6.showManipulatorToolbar(); - } - }); - } else { - throw new Error('The function for edit does not support two arguments (data, callback)'); + // if the mouse is still one the node, we have to check if it is not also on one that is drawn on top of it. + // we initially only check stillOnObj because this is much faster. + if (stillOnObj === true) { + var overNode = this.selectionHandler.getNodeAt(pointer); + stillOnObj = overNode === undefined ? false : overNode.id === this.popup.popupTargetId; + } + } + } else { + if (this.selectionHandler.getNodeAt(pointer) === undefined) { + if (this.body.edges[this.popup.popupTargetId] !== undefined) { + stillOnObj = this.body.edges[this.popup.popupTargetId].isOverlappingWith(pointerObj); } - } else { - this.body.data.edges.getDataSet().update(defaultData); - this.selectionHandler.unselectAll(); - this.showManipulatorToolbar(); } } - }]); - return ManipulationSystem; - }(); - exports['default'] = ManipulationSystem; + if (stillOnObj === false) { + this.popupObj = undefined; + this.popup.hide(); + this.body.emitter.emit('hidePopup'); + } + } + }]); + return InteractionHandler; +}(); + +exports['default'] = InteractionHandler; /***/ }), -/* 230 */ -/***/ (function(module, exports) { +/* 233 */ +/***/ (function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var Hammer = __webpack_require__(10); +var hammerUtil = __webpack_require__(37); +var keycharm = __webpack_require__(35); + +/** + * Navigation Handler + */ + +var NavigationHandler = function () { + /** + * @param {Object} body + * @param {Canvas} canvas + */ + function NavigationHandler(body, canvas) { + var _this = this; + + (0, _classCallCheck3['default'])(this, NavigationHandler); + + this.body = body; + this.canvas = canvas; + + this.iconsCreated = false; + this.navigationHammers = []; + this.boundFunctions = {}; + this.touchTime = 0; + this.activated = false; + + this.body.emitter.on("activate", function () { + _this.activated = true;_this.configureKeyboardBindings(); + }); + this.body.emitter.on("deactivate", function () { + _this.activated = false;_this.configureKeyboardBindings(); + }); + this.body.emitter.on("destroy", function () { + if (_this.keycharm !== undefined) { + _this.keycharm.destroy(); + } + }); + + this.options = {}; + } - Object.defineProperty(exports, "__esModule", { - value: true - }); /** - * This object contains all possible options. It will check if the types are correct, if required if the option is one - * of the allowed values. * - * __any__ means that the name of the property does not matter. - * __type__ is a required field for all objects and contains the allowed types of all objects + * @param {Object} options */ - var string = 'string'; - var bool = 'boolean'; - var number = 'number'; - var array = 'array'; - var object = 'object'; // should only be in a __type__ property - var dom = 'dom'; - var any = 'any'; - - var allOptions = { - configure: { - enabled: { boolean: bool }, - filter: { boolean: bool, string: string, array: array, 'function': 'function' }, - container: { dom: dom }, - showButton: { boolean: bool }, - __type__: { object: object, boolean: bool, string: string, array: array, 'function': 'function' } - }, - edges: { - arrows: { - to: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: ['arrow', 'circle'] }, __type__: { object: object, boolean: bool } }, - middle: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: ['arrow', 'circle'] }, __type__: { object: object, boolean: bool } }, - from: { enabled: { boolean: bool }, scaleFactor: { number: number }, type: { string: ['arrow', 'circle'] }, __type__: { object: object, boolean: bool } }, - __type__: { string: ['from', 'to', 'middle'], object: object } - }, - arrowStrikethrough: { boolean: bool }, - chosen: { - label: { boolean: bool, 'function': 'function' }, - edge: { boolean: bool, 'function': 'function' }, - __type__: { object: object, boolean: bool } - }, - color: { - color: { string: string }, - highlight: { string: string }, - hover: { string: string }, - inherit: { string: ['from', 'to', 'both'], boolean: bool }, - opacity: { number: number }, - __type__: { object: object, string: string } - }, - dashes: { boolean: bool, array: array }, - font: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - background: { string: string }, - strokeWidth: { number: number }, // px - strokeColor: { string: string }, - align: { string: ['horizontal', 'top', 'middle', 'bottom'] }, - vadjust: { number: number }, - multi: { boolean: bool, string: string }, - bold: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - boldital: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - ital: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - mono: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - __type__: { object: object, string: string } - }, - hidden: { boolean: bool }, - hoverWidth: { 'function': 'function', number: number }, - label: { string: string, 'undefined': 'undefined' }, - labelHighlightBold: { boolean: bool }, - length: { number: number, 'undefined': 'undefined' }, - physics: { boolean: bool }, - scaling: { - min: { number: number }, - max: { number: number }, - label: { - enabled: { boolean: bool }, - min: { number: number }, - max: { number: number }, - maxVisible: { number: number }, - drawThreshold: { number: number }, - __type__: { object: object, boolean: bool } - }, - customScalingFunction: { 'function': 'function' }, - __type__: { object: object } - }, - selectionWidth: { 'function': 'function', number: number }, - selfReferenceSize: { number: number }, - shadow: { - enabled: { boolean: bool }, - color: { string: string }, - size: { number: number }, - x: { number: number }, - y: { number: number }, - __type__: { object: object, boolean: bool } - }, - smooth: { - enabled: { boolean: bool }, - type: { string: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'] }, - roundness: { number: number }, - forceDirection: { string: ['horizontal', 'vertical', 'none'], boolean: bool }, - __type__: { object: object, boolean: bool } - }, - title: { string: string, 'undefined': 'undefined' }, - width: { number: number }, - widthConstraint: { - maximum: { number: number }, - __type__: { object: object, boolean: bool, number: number } - }, - value: { number: number, 'undefined': 'undefined' }, - __type__: { object: object } - }, - groups: { - useDefaultGroups: { boolean: bool }, - __any__: 'get from nodes, will be overwritten below', - __type__: { object: object } - }, - interaction: { - dragNodes: { boolean: bool }, - dragView: { boolean: bool }, - hideEdgesOnDrag: { boolean: bool }, - hideNodesOnDrag: { boolean: bool }, - hover: { boolean: bool }, - keyboard: { - enabled: { boolean: bool }, - speed: { x: { number: number }, y: { number: number }, zoom: { number: number }, __type__: { object: object } }, - bindToWindow: { boolean: bool }, - __type__: { object: object, boolean: bool } - }, - multiselect: { boolean: bool }, - navigationButtons: { boolean: bool }, - selectable: { boolean: bool }, - selectConnectedEdges: { boolean: bool }, - hoverConnectedEdges: { boolean: bool }, - tooltipDelay: { number: number }, - zoomView: { boolean: bool }, - __type__: { object: object } - }, - layout: { - randomSeed: { 'undefined': 'undefined', number: number }, - improvedLayout: { boolean: bool }, - hierarchical: { - enabled: { boolean: bool }, - levelSeparation: { number: number }, - nodeSpacing: { number: number }, - treeSpacing: { number: number }, - blockShifting: { boolean: bool }, - edgeMinimization: { boolean: bool }, - parentCentralization: { boolean: bool }, - direction: { string: ['UD', 'DU', 'LR', 'RL'] }, // UD, DU, LR, RL - sortMethod: { string: ['hubsize', 'directed'] }, // hubsize, directed - __type__: { object: object, boolean: bool } - }, - __type__: { object: object } - }, - manipulation: { - enabled: { boolean: bool }, - initiallyActive: { boolean: bool }, - addNode: { boolean: bool, 'function': 'function' }, - addEdge: { boolean: bool, 'function': 'function' }, - editNode: { 'function': 'function' }, - editEdge: { - editWithoutDrag: { 'function': 'function' }, - __type__: { object: object, boolean: bool, 'function': 'function' } - }, - deleteNode: { boolean: bool, 'function': 'function' }, - deleteEdge: { boolean: bool, 'function': 'function' }, - controlNodeStyle: 'get from nodes, will be overwritten below', - __type__: { object: object, boolean: bool } - }, - nodes: { - borderWidth: { number: number }, - borderWidthSelected: { number: number, 'undefined': 'undefined' }, - brokenImage: { string: string, 'undefined': 'undefined' }, - chosen: { - label: { boolean: bool, 'function': 'function' }, - node: { boolean: bool, 'function': 'function' }, - __type__: { object: object, boolean: bool } - }, - color: { - border: { string: string }, - background: { string: string }, - highlight: { - border: { string: string }, - background: { string: string }, - __type__: { object: object, string: string } - }, - hover: { - border: { string: string }, - background: { string: string }, - __type__: { object: object, string: string } - }, - __type__: { object: object, string: string } - }, - fixed: { - x: { boolean: bool }, - y: { boolean: bool }, - __type__: { object: object, boolean: bool } - }, - font: { - align: { string: string }, - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - background: { string: string }, - strokeWidth: { number: number }, // px - strokeColor: { string: string }, - vadjust: { number: number }, - multi: { boolean: bool, string: string }, - bold: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - boldital: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - ital: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - mono: { - color: { string: string }, - size: { number: number }, // px - face: { string: string }, - mod: { string: string }, - vadjust: { number: number }, - __type__: { object: object, string: string } - }, - __type__: { object: object, string: string } - }, - group: { string: string, number: number, 'undefined': 'undefined' }, - heightConstraint: { - minimum: { number: number }, - valign: { string: string }, - __type__: { object: object, boolean: bool, number: number } - }, - hidden: { boolean: bool }, - icon: { - face: { string: string }, - code: { string: string }, //'\uf007', - size: { number: number }, //50, - color: { string: string }, - __type__: { object: object } - }, - id: { string: string, number: number }, - image: { - selected: { string: string, 'undefined': 'undefined' }, // --> URL - unselected: { string: string, 'undefined': 'undefined' }, // --> URL - __type__: { object: object, string: string } - }, - label: { string: string, 'undefined': 'undefined' }, - labelHighlightBold: { boolean: bool }, - level: { number: number, 'undefined': 'undefined' }, - margin: { - top: { number: number }, - right: { number: number }, - bottom: { number: number }, - left: { number: number }, - __type__: { object: object, number: number } - }, - mass: { number: number }, - physics: { boolean: bool }, - scaling: { - min: { number: number }, - max: { number: number }, - label: { - enabled: { boolean: bool }, - min: { number: number }, - max: { number: number }, - maxVisible: { number: number }, - drawThreshold: { number: number }, - __type__: { object: object, boolean: bool } - }, - customScalingFunction: { 'function': 'function' }, - __type__: { object: object } - }, - shadow: { - enabled: { boolean: bool }, - color: { string: string }, - size: { number: number }, - x: { number: number }, - y: { number: number }, - __type__: { object: object, boolean: bool } - }, - shape: { string: ['ellipse', 'circle', 'database', 'box', 'text', 'image', 'circularImage', 'diamond', 'dot', 'star', 'triangle', 'triangleDown', 'square', 'icon'] }, - shapeProperties: { - borderDashes: { boolean: bool, array: array }, - borderRadius: { number: number }, - interpolation: { boolean: bool }, - useImageSize: { boolean: bool }, - useBorderWithImage: { boolean: bool }, - __type__: { object: object } - }, - size: { number: number }, - title: { string: string, 'undefined': 'undefined' }, - value: { number: number, 'undefined': 'undefined' }, - widthConstraint: { - minimum: { number: number }, - maximum: { number: number }, - __type__: { object: object, boolean: bool, number: number } - }, - x: { number: number }, - y: { number: number }, - __type__: { object: object } - }, - physics: { - enabled: { boolean: bool }, - barnesHut: { - gravitationalConstant: { number: number }, - centralGravity: { number: number }, - springLength: { number: number }, - springConstant: { number: number }, - damping: { number: number }, - avoidOverlap: { number: number }, - __type__: { object: object } - }, - forceAtlas2Based: { - gravitationalConstant: { number: number }, - centralGravity: { number: number }, - springLength: { number: number }, - springConstant: { number: number }, - damping: { number: number }, - avoidOverlap: { number: number }, - __type__: { object: object } - }, - repulsion: { - centralGravity: { number: number }, - springLength: { number: number }, - springConstant: { number: number }, - nodeDistance: { number: number }, - damping: { number: number }, - __type__: { object: object } - }, - hierarchicalRepulsion: { - centralGravity: { number: number }, - springLength: { number: number }, - springConstant: { number: number }, - nodeDistance: { number: number }, - damping: { number: number }, - __type__: { object: object } - }, - maxVelocity: { number: number }, - minVelocity: { number: number }, // px/s - solver: { string: ['barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based'] }, - stabilization: { - enabled: { boolean: bool }, - iterations: { number: number }, // maximum number of iteration to stabilize - updateInterval: { number: number }, - onlyDynamicEdges: { boolean: bool }, - fit: { boolean: bool }, - __type__: { object: object, boolean: bool } - }, - timestep: { number: number }, - adaptiveTimestep: { boolean: bool }, - __type__: { object: object, boolean: bool } - }, - //globals : - autoResize: { boolean: bool }, - clickToUse: { boolean: bool }, - locale: { string: string }, - locales: { - __any__: { any: any }, - __type__: { object: object } - }, - height: { string: string }, - width: { string: string }, - __type__: { object: object } - }; - allOptions.groups.__any__ = allOptions.nodes; - allOptions.manipulation.controlNodeStyle = allOptions.nodes; + (0, _createClass3['default'])(NavigationHandler, [{ + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + this.options = options; + this.create(); + } + } - var configureOptions = { - nodes: { - borderWidth: [1, 0, 10, 1], - borderWidthSelected: [2, 0, 10, 1], - color: { - border: ['color', '#2B7CE9'], - background: ['color', '#97C2FC'], - highlight: { - border: ['color', '#2B7CE9'], - background: ['color', '#D2E5FF'] - }, - hover: { - border: ['color', '#2B7CE9'], - background: ['color', '#D2E5FF'] - } - }, - fixed: { - x: false, - y: false - }, - font: { - color: ['color', '#343434'], - size: [14, 0, 100, 1], // px - face: ['arial', 'verdana', 'tahoma'], - background: ['color', 'none'], - strokeWidth: [0, 0, 50, 1], // px - strokeColor: ['color', '#ffffff'] - }, - //group: 'string', - hidden: false, - labelHighlightBold: true, - //icon: { - // face: 'string', //'FontAwesome', - // code: 'string', //'\uf007', - // size: [50, 0, 200, 1], //50, - // color: ['color','#2B7CE9'] //'#aa00ff' - //}, - //image: 'string', // --> URL - physics: true, - scaling: { - min: [10, 0, 200, 1], - max: [30, 0, 200, 1], - label: { - enabled: false, - min: [14, 0, 200, 1], - max: [30, 0, 200, 1], - maxVisible: [30, 0, 200, 1], - drawThreshold: [5, 0, 20, 1] + /** + * Creates or refreshes navigation and sets key bindings + */ + + }, { + key: 'create', + value: function create() { + if (this.options.navigationButtons === true) { + if (this.iconsCreated === false) { + this.loadNavigationElements(); } - }, - shadow: { - enabled: false, - color: 'rgba(0,0,0,0.5)', - size: [10, 0, 20, 1], - x: [5, -30, 30, 1], - y: [5, -30, 30, 1] - }, - shape: ['ellipse', 'box', 'circle', 'database', 'diamond', 'dot', 'square', 'star', 'text', 'triangle', 'triangleDown'], - shapeProperties: { - borderDashes: false, - borderRadius: [6, 0, 20, 1], - interpolation: true, - useImageSize: false - }, - size: [25, 0, 200, 1] - }, - edges: { - arrows: { - to: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' }, - middle: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' }, - from: { enabled: false, scaleFactor: [1, 0, 3, 0.05], type: 'arrow' } - }, - arrowStrikethrough: true, - color: { - color: ['color', '#848484'], - highlight: ['color', '#848484'], - hover: ['color', '#848484'], - inherit: ['from', 'to', 'both', true, false], - opacity: [1, 0, 1, 0.05] - }, - dashes: false, - font: { - color: ['color', '#343434'], - size: [14, 0, 100, 1], // px - face: ['arial', 'verdana', 'tahoma'], - background: ['color', 'none'], - strokeWidth: [2, 0, 50, 1], // px - strokeColor: ['color', '#ffffff'], - align: ['horizontal', 'top', 'middle', 'bottom'] - }, - hidden: false, - hoverWidth: [1.5, 0, 5, 0.1], - labelHighlightBold: true, - physics: true, - scaling: { - min: [1, 0, 100, 1], - max: [15, 0, 100, 1], - label: { - enabled: true, - min: [14, 0, 200, 1], - max: [30, 0, 200, 1], - maxVisible: [30, 0, 200, 1], - drawThreshold: [5, 0, 20, 1] + } else if (this.iconsCreated === true) { + this.cleanNavigation(); + } + + this.configureKeyboardBindings(); + } + + /** + * Cleans up previous navigation items + */ + + }, { + key: 'cleanNavigation', + value: function cleanNavigation() { + // clean hammer bindings + if (this.navigationHammers.length != 0) { + for (var i = 0; i < this.navigationHammers.length; i++) { + this.navigationHammers[i].destroy(); + } + this.navigationHammers = []; + } + + // clean up previous navigation items + if (this.navigationDOM && this.navigationDOM['wrapper'] && this.navigationDOM['wrapper'].parentNode) { + this.navigationDOM['wrapper'].parentNode.removeChild(this.navigationDOM['wrapper']); + } + + this.iconsCreated = false; + } + + /** + * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation + * they have a triggerFunction which is called on click. If the position of the navigation controls is dependent + * on this.frame.canvas.clientWidth or this.frame.canvas.clientHeight, we flag horizontalAlignLeft and verticalAlignTop false. + * This means that the location will be corrected by the _relocateNavigation function on a size change of the canvas. + * + * @private + */ + + }, { + key: 'loadNavigationElements', + value: function loadNavigationElements() { + var _this2 = this; + + this.cleanNavigation(); + + this.navigationDOM = {}; + var navigationDivs = ['up', 'down', 'left', 'right', 'zoomIn', 'zoomOut', 'zoomExtends']; + var navigationDivActions = ['_moveUp', '_moveDown', '_moveLeft', '_moveRight', '_zoomIn', '_zoomOut', '_fit']; + + this.navigationDOM['wrapper'] = document.createElement('div'); + this.navigationDOM['wrapper'].className = 'vis-navigation'; + this.canvas.frame.appendChild(this.navigationDOM['wrapper']); + + for (var i = 0; i < navigationDivs.length; i++) { + this.navigationDOM[navigationDivs[i]] = document.createElement('div'); + this.navigationDOM[navigationDivs[i]].className = 'vis-button vis-' + navigationDivs[i]; + this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]); + + var hammer = new Hammer(this.navigationDOM[navigationDivs[i]]); + if (navigationDivActions[i] === "_fit") { + hammerUtil.onTouch(hammer, this._fit.bind(this)); + } else { + hammerUtil.onTouch(hammer, this.bindToRedraw.bind(this, navigationDivActions[i])); + } + + this.navigationHammers.push(hammer); + } + + // use a hammer for the release so we do not require the one used in the rest of the network + // the one the rest uses can be overloaded by the manipulation system. + var hammerFrame = new Hammer(this.canvas.frame); + hammerUtil.onRelease(hammerFrame, function () { + _this2._stopMovement(); + }); + this.navigationHammers.push(hammerFrame); + + this.iconsCreated = true; + } + + /** + * + * @param {string} action + */ + + }, { + key: 'bindToRedraw', + value: function bindToRedraw(action) { + if (this.boundFunctions[action] === undefined) { + this.boundFunctions[action] = this[action].bind(this); + this.body.emitter.on("initRedraw", this.boundFunctions[action]); + this.body.emitter.emit("_startRendering"); + } + } + + /** + * + * @param {string} action + */ + + }, { + key: 'unbindFromRedraw', + value: function unbindFromRedraw(action) { + if (this.boundFunctions[action] !== undefined) { + this.body.emitter.off("initRedraw", this.boundFunctions[action]); + this.body.emitter.emit("_stopRendering"); + delete this.boundFunctions[action]; + } + } + + /** + * this stops all movement induced by the navigation buttons + * + * @private + */ + + }, { + key: '_fit', + value: function _fit() { + if (new Date().valueOf() - this.touchTime > 700) { + // TODO: fix ugly hack to avoid hammer's double fireing of event (because we use release?) + this.body.emitter.emit("fit", { duration: 700 }); + this.touchTime = new Date().valueOf(); + } + } + + /** + * this stops all movement induced by the navigation buttons + * + * @private + */ + + }, { + key: '_stopMovement', + value: function _stopMovement() { + for (var boundAction in this.boundFunctions) { + if (this.boundFunctions.hasOwnProperty(boundAction)) { + this.body.emitter.off("initRedraw", this.boundFunctions[boundAction]); + this.body.emitter.emit("_stopRendering"); + } + } + this.boundFunctions = {}; + } + /** + * + * @private + */ + + }, { + key: '_moveUp', + value: function _moveUp() { + this.body.view.translation.y += this.options.keyboard.speed.y; + } + /** + * + * @private + */ + + }, { + key: '_moveDown', + value: function _moveDown() { + this.body.view.translation.y -= this.options.keyboard.speed.y; + } + /** + * + * @private + */ + + }, { + key: '_moveLeft', + value: function _moveLeft() { + this.body.view.translation.x += this.options.keyboard.speed.x; + } + /** + * + * @private + */ + + }, { + key: '_moveRight', + value: function _moveRight() { + this.body.view.translation.x -= this.options.keyboard.speed.x; + } + /** + * + * @private + */ + + }, { + key: '_zoomIn', + value: function _zoomIn() { + var scaleOld = this.body.view.scale; + var scale = this.body.view.scale * (1 + this.options.keyboard.speed.zoom); + var translation = this.body.view.translation; + var scaleFrac = scale / scaleOld; + var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac; + var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac; + + this.body.view.scale = scale; + this.body.view.translation = { x: tx, y: ty }; + this.body.emitter.emit('zoom', { direction: '+', scale: this.body.view.scale, pointer: null }); + } + + /** + * + * @private + */ + + }, { + key: '_zoomOut', + value: function _zoomOut() { + var scaleOld = this.body.view.scale; + var scale = this.body.view.scale / (1 + this.options.keyboard.speed.zoom); + var translation = this.body.view.translation; + var scaleFrac = scale / scaleOld; + var tx = (1 - scaleFrac) * this.canvas.canvasViewCenter.x + translation.x * scaleFrac; + var ty = (1 - scaleFrac) * this.canvas.canvasViewCenter.y + translation.y * scaleFrac; + + this.body.view.scale = scale; + this.body.view.translation = { x: tx, y: ty }; + this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale, pointer: null }); + } + + /** + * bind all keys using keycharm. + */ + + }, { + key: 'configureKeyboardBindings', + value: function configureKeyboardBindings() { + var _this3 = this; + + if (this.keycharm !== undefined) { + this.keycharm.destroy(); + } + + if (this.options.keyboard.enabled === true) { + if (this.options.keyboard.bindToWindow === true) { + this.keycharm = keycharm({ container: window, preventDefault: true }); + } else { + this.keycharm = keycharm({ container: this.canvas.frame, preventDefault: true }); + } + + this.keycharm.reset(); + + if (this.activated === true) { + this.keycharm.bind("up", function () { + _this3.bindToRedraw("_moveUp"); + }, "keydown"); + this.keycharm.bind("down", function () { + _this3.bindToRedraw("_moveDown"); + }, "keydown"); + this.keycharm.bind("left", function () { + _this3.bindToRedraw("_moveLeft"); + }, "keydown"); + this.keycharm.bind("right", function () { + _this3.bindToRedraw("_moveRight"); + }, "keydown"); + this.keycharm.bind("=", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("num+", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("num-", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + this.keycharm.bind("-", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + this.keycharm.bind("[", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + this.keycharm.bind("]", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("pageup", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("pagedown", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + + this.keycharm.bind("up", function () { + _this3.unbindFromRedraw("_moveUp"); + }, "keyup"); + this.keycharm.bind("down", function () { + _this3.unbindFromRedraw("_moveDown"); + }, "keyup"); + this.keycharm.bind("left", function () { + _this3.unbindFromRedraw("_moveLeft"); + }, "keyup"); + this.keycharm.bind("right", function () { + _this3.unbindFromRedraw("_moveRight"); + }, "keyup"); + this.keycharm.bind("=", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("num+", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("num-", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + this.keycharm.bind("-", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + this.keycharm.bind("[", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + this.keycharm.bind("]", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("pageup", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("pagedown", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + } + } + } + }]); + return NavigationHandler; +}(); + +exports['default'] = NavigationHandler; + +/***/ }), +/* 234 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var Node = __webpack_require__(47)['default']; +var Edge = __webpack_require__(74)['default']; + +var util = __webpack_require__(2); + +/** + * The handler for selections + */ + +var SelectionHandler = function () { + /** + * @param {Object} body + * @param {Canvas} canvas + */ + function SelectionHandler(body, canvas) { + var _this = this; + + (0, _classCallCheck3['default'])(this, SelectionHandler); + + this.body = body; + this.canvas = canvas; + this.selectionObj = { nodes: [], edges: [] }; + this.hoverObj = { nodes: {}, edges: {} }; + + this.options = {}; + this.defaultOptions = { + multiselect: false, + selectable: true, + selectConnectedEdges: true, + hoverConnectedEdges: true + }; + util.extend(this.options, this.defaultOptions); + + this.body.emitter.on("_dataChanged", function () { + _this.updateSelection(); + }); + } + + /** + * + * @param {Object} [options] + */ + + + (0, _createClass3['default'])(SelectionHandler, [{ + key: 'setOptions', + value: function setOptions(options) { + if (options !== undefined) { + var fields = ['multiselect', 'hoverConnectedEdges', 'selectable', 'selectConnectedEdges']; + util.selectiveDeepExtend(fields, this.options, options); + } + } + + /** + * handles the selection part of the tap; + * + * @param {{x: number, y: number}} pointer + * @returns {boolean} + */ + + }, { + key: 'selectOnPoint', + value: function selectOnPoint(pointer) { + var selected = false; + if (this.options.selectable === true) { + var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); + + // unselect after getting the objects in order to restore width and height. + this.unselectAll(); + + if (obj !== undefined) { + selected = this.selectObject(obj); + } + this.body.emitter.emit("_requestRedraw"); + } + return selected; + } + + /** + * + * @param {{x: number, y: number}} pointer + * @returns {boolean} + */ + + }, { + key: 'selectAdditionalOnPoint', + value: function selectAdditionalOnPoint(pointer) { + var selectionChanged = false; + if (this.options.selectable === true) { + var obj = this.getNodeAt(pointer) || this.getEdgeAt(pointer); + + if (obj !== undefined) { + selectionChanged = true; + if (obj.isSelected() === true) { + this.deselectObject(obj); + } else { + this.selectObject(obj); + } + + this.body.emitter.emit("_requestRedraw"); + } + } + return selectionChanged; + } + + /** + * Create an object containing the standard fields for an event. + * + * @param {Event} event + * @param {{x: number, y: number}} pointer Object with the x and y screen coordinates of the mouse + * @returns {{}} + * @private + */ + + }, { + key: '_initBaseEvent', + value: function _initBaseEvent(event, pointer) { + var properties = {}; + + properties['pointer'] = { + DOM: { x: pointer.x, y: pointer.y }, + canvas: this.canvas.DOMtoCanvas(pointer) + }; + properties['event'] = event; + + return properties; + } + + /** + * Generate an event which the user can catch. + * + * This adds some extra data to the event with respect to cursor position and + * selected nodes and edges. + * + * @param {string} eventType Name of event to send + * @param {Event} event + * @param {{x: number, y: number}} pointer Object with the x and y screen coordinates of the mouse + * @param {Object|undefined} oldSelection If present, selection state before event occured + * @param {boolean|undefined} [emptySelection=false] Indicate if selection data should be passed + */ + + }, { + key: '_generateClickEvent', + value: function _generateClickEvent(eventType, event, pointer, oldSelection) { + var emptySelection = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + + var properties = this._initBaseEvent(event, pointer); + + if (emptySelection === true) { + properties.nodes = []; + properties.edges = []; + } else { + var tmp = this.getSelection(); + properties.nodes = tmp.nodes; + properties.edges = tmp.edges; + } + + if (oldSelection !== undefined) { + properties['previousSelection'] = oldSelection; + } + + if (eventType == 'click') { + // For the time being, restrict this functionality to + // just the click event. + properties.items = this.getClickedItems(pointer); + } + + this.body.emitter.emit(eventType, properties); + } + + /** + * + * @param {Object} obj + * @param {boolean} [highlightEdges=this.options.selectConnectedEdges] + * @returns {boolean} + */ + + }, { + key: 'selectObject', + value: function selectObject(obj) { + var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.selectConnectedEdges; + + if (obj !== undefined) { + if (obj instanceof Node) { + if (highlightEdges === true) { + this._selectConnectedEdges(obj); + } + } + obj.select(); + this._addToSelection(obj); + return true; + } + return false; + } + + /** + * + * @param {Object} obj + */ + + }, { + key: 'deselectObject', + value: function deselectObject(obj) { + if (obj.isSelected() === true) { + obj.selected = false; + this._removeFromSelection(obj); + } + } + + /** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {number[]} An array with id's of the overlapping nodes + * @private + */ + + }, { + key: '_getAllNodesOverlappingWith', + value: function _getAllNodesOverlappingWith(object) { + var overlappingNodes = []; + var nodes = this.body.nodes; + for (var i = 0; i < this.body.nodeIndices.length; i++) { + var nodeId = this.body.nodeIndices[i]; + if (nodes[nodeId].isOverlappingWith(object)) { + overlappingNodes.push(nodeId); + } + } + return overlappingNodes; + } + + /** + * Return a position object in canvasspace from a single point in screenspace + * + * @param {{x: number, y: number}} pointer + * @returns {{left: number, top: number, right: number, bottom: number}} + * @private + */ + + }, { + key: '_pointerToPositionObject', + value: function _pointerToPositionObject(pointer) { + var canvasPos = this.canvas.DOMtoCanvas(pointer); + return { + left: canvasPos.x - 1, + top: canvasPos.y + 1, + right: canvasPos.x + 1, + bottom: canvasPos.y - 1 + }; + } + + /** + * Get the top node at the passed point (like a click) + * + * @param {{x: number, y: number}} pointer + * @param {boolean} [returnNode=true] + * @return {Node | undefined} node + */ + + }, { + key: 'getNodeAt', + value: function getNodeAt(pointer) { + var returnNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + // we first check if this is an navigation controls element + var positionObject = this._pointerToPositionObject(pointer); + var overlappingNodes = this._getAllNodesOverlappingWith(positionObject); + // if there are overlapping nodes, select the last one, this is the + // one which is drawn on top of the others + if (overlappingNodes.length > 0) { + if (returnNode === true) { + return this.body.nodes[overlappingNodes[overlappingNodes.length - 1]]; + } else { + return overlappingNodes[overlappingNodes.length - 1]; + } + } else { + return undefined; + } + } + + /** + * retrieve all edges overlapping with given object, selector is around center + * @param {Object} object An object with parameters left, top, right, bottom + * @param {number[]} overlappingEdges An array with id's of the overlapping nodes + * @private + */ + + }, { + key: '_getEdgesOverlappingWith', + value: function _getEdgesOverlappingWith(object, overlappingEdges) { + var edges = this.body.edges; + for (var i = 0; i < this.body.edgeIndices.length; i++) { + var edgeId = this.body.edgeIndices[i]; + if (edges[edgeId].isOverlappingWith(object)) { + overlappingEdges.push(edgeId); + } + } + } + + /** + * retrieve all nodes overlapping with given object + * @param {Object} object An object with parameters left, top, right, bottom + * @return {number[]} An array with id's of the overlapping nodes + * @private + */ + + }, { + key: '_getAllEdgesOverlappingWith', + value: function _getAllEdgesOverlappingWith(object) { + var overlappingEdges = []; + this._getEdgesOverlappingWith(object, overlappingEdges); + return overlappingEdges; + } + + /** + * Get the edges nearest to the passed point (like a click) + * + * @param {{x: number, y: number}} pointer + * @param {boolean} [returnEdge=true] + * @return {Edge | undefined} node + */ + + }, { + key: 'getEdgeAt', + value: function getEdgeAt(pointer) { + var returnEdge = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + // Iterate over edges, pick closest within 10 + var canvasPos = this.canvas.DOMtoCanvas(pointer); + var mindist = 10; + var overlappingEdge = null; + var edges = this.body.edges; + for (var i = 0; i < this.body.edgeIndices.length; i++) { + var edgeId = this.body.edgeIndices[i]; + var edge = edges[edgeId]; + if (edge.connected) { + var xFrom = edge.from.x; + var yFrom = edge.from.y; + var xTo = edge.to.x; + var yTo = edge.to.y; + var dist = edge.edgeType.getDistanceToEdge(xFrom, yFrom, xTo, yTo, canvasPos.x, canvasPos.y); + if (dist < mindist) { + overlappingEdge = edgeId; + mindist = dist; + } + } + } + if (overlappingEdge !== null) { + if (returnEdge === true) { + return this.body.edges[overlappingEdge]; + } else { + return overlappingEdge; + } + } else { + return undefined; + } + } + + /** + * Add object to the selection array. + * + * @param {Object} obj + * @private + */ + + }, { + key: '_addToSelection', + value: function _addToSelection(obj) { + if (obj instanceof Node) { + this.selectionObj.nodes[obj.id] = obj; + } else { + this.selectionObj.edges[obj.id] = obj; + } + } + + /** + * Add object to the selection array. + * + * @param {Object} obj + * @private + */ + + }, { + key: '_addToHover', + value: function _addToHover(obj) { + if (obj instanceof Node) { + this.hoverObj.nodes[obj.id] = obj; + } else { + this.hoverObj.edges[obj.id] = obj; + } + } + + /** + * Remove a single option from selection. + * + * @param {Object} obj + * @private + */ + + }, { + key: '_removeFromSelection', + value: function _removeFromSelection(obj) { + if (obj instanceof Node) { + delete this.selectionObj.nodes[obj.id]; + this._unselectConnectedEdges(obj); + } else { + delete this.selectionObj.edges[obj.id]; + } + } + + /** + * Unselect all. The selectionObj is useful for this. + */ + + }, { + key: 'unselectAll', + value: function unselectAll() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + this.selectionObj.nodes[nodeId].unselect(); + } + } + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + this.selectionObj.edges[edgeId].unselect(); + } + } + + this.selectionObj = { nodes: {}, edges: {} }; + } + + /** + * return the number of selected nodes + * + * @returns {number} + * @private + */ + + }, { + key: '_getSelectedNodeCount', + value: function _getSelectedNodeCount() { + var count = 0; + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + return count; + } + + /** + * return the selected node + * + * @returns {number} + * @private + */ + + }, { + key: '_getSelectedNode', + value: function _getSelectedNode() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return this.selectionObj.nodes[nodeId]; + } + } + return undefined; + } + + /** + * return the selected edge + * + * @returns {number} + * @private + */ + + }, { + key: '_getSelectedEdge', + value: function _getSelectedEdge() { + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + return this.selectionObj.edges[edgeId]; + } + } + return undefined; + } + + /** + * return the number of selected edges + * + * @returns {number} + * @private + */ + + }, { + key: '_getSelectedEdgeCount', + value: function _getSelectedEdgeCount() { + var count = 0; + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; + } + + /** + * return the number of selected objects. + * + * @returns {number} + * @private + */ + + }, { + key: '_getSelectedObjectCount', + value: function _getSelectedObjectCount() { + var count = 0; + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + count += 1; + } + } + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + count += 1; + } + } + return count; + } + + /** + * Check if anything is selected + * + * @returns {boolean} + * @private + */ + + }, { + key: '_selectionIsEmpty', + value: function _selectionIsEmpty() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + return false; + } + } + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + return false; + } + } + return true; + } + + /** + * check if one of the selected nodes is a cluster. + * + * @returns {boolean} + * @private + */ + + }, { + key: '_clusterInSelection', + value: function _clusterInSelection() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (this.selectionObj.nodes[nodeId].clusterSize > 1) { + return true; + } + } + } + return false; + } + + /** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + + }, { + key: '_selectConnectedEdges', + value: function _selectConnectedEdges(node) { + for (var i = 0; i < node.edges.length; i++) { + var edge = node.edges[i]; + edge.select(); + this._addToSelection(edge); + } + } + + /** + * select the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + + }, { + key: '_hoverConnectedEdges', + value: function _hoverConnectedEdges(node) { + for (var i = 0; i < node.edges.length; i++) { + var edge = node.edges[i]; + edge.hover = true; + this._addToHover(edge); + } + } + + /** + * unselect the edges connected to the node that is being selected + * + * @param {Node} node + * @private + */ + + }, { + key: '_unselectConnectedEdges', + value: function _unselectConnectedEdges(node) { + for (var i = 0; i < node.edges.length; i++) { + var edge = node.edges[i]; + edge.unselect(); + this._removeFromSelection(edge); + } + } + + /** + * Remove the highlight from a node or edge, in response to mouse movement + * + * @param {Event} event + * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse + * @param {Node|vis.Edge} object + * @private + */ + + }, { + key: 'emitBlurEvent', + value: function emitBlurEvent(event, pointer, object) { + var properties = this._initBaseEvent(event, pointer); + + if (object.hover === true) { + object.hover = false; + if (object instanceof Node) { + properties.node = object.id; + this.body.emitter.emit("blurNode", properties); + } else { + properties.edge = object.id; + this.body.emitter.emit("blurEdge", properties); + } + } + } + + /** + * Create the highlight for a node or edge, in response to mouse movement + * + * @param {Event} event + * @param {{x: number, y: number}} pointer object with the x and y screen coordinates of the mouse + * @param {Node|vis.Edge} object + * @returns {boolean} hoverChanged + * @private + */ + + }, { + key: 'emitHoverEvent', + value: function emitHoverEvent(event, pointer, object) { + var properties = this._initBaseEvent(event, pointer); + var hoverChanged = false; + + if (object.hover === false) { + object.hover = true; + this._addToHover(object); + hoverChanged = true; + if (object instanceof Node) { + properties.node = object.id; + this.body.emitter.emit("hoverNode", properties); + } else { + properties.edge = object.id; + this.body.emitter.emit("hoverEdge", properties); + } + } + + return hoverChanged; + } + + /** + * Perform actions in response to a mouse movement. + * + * @param {Event} event + * @param {{x: number, y: number}} pointer | object with the x and y screen coordinates of the mouse + */ + + }, { + key: 'hoverObject', + value: function hoverObject(event, pointer) { + var object = this.getNodeAt(pointer); + if (object === undefined) { + object = this.getEdgeAt(pointer); + } + + var hoverChanged = false; + // remove all node hover highlights + for (var nodeId in this.hoverObj.nodes) { + if (this.hoverObj.nodes.hasOwnProperty(nodeId)) { + if (object === undefined || object instanceof Node && object.id != nodeId || object instanceof Edge) { + this.emitBlurEvent(event, pointer, this.hoverObj.nodes[nodeId]); + delete this.hoverObj.nodes[nodeId]; + hoverChanged = true; + } + } + } + + // removing all edge hover highlights + for (var edgeId in this.hoverObj.edges) { + if (this.hoverObj.edges.hasOwnProperty(edgeId)) { + // if the hover has been changed here it means that the node has been hovered over or off + // we then do not use the emitBlurEvent method here. + if (hoverChanged === true) { + this.hoverObj.edges[edgeId].hover = false; + delete this.hoverObj.edges[edgeId]; + } + // if the blur remains the same and the object is undefined (mouse off) or another + // edge has been hovered, or another node has been hovered we blur the edge. + else if (object === undefined || object instanceof Edge && object.id != edgeId || object instanceof Node && !object.hover) { + this.emitBlurEvent(event, pointer, this.hoverObj.edges[edgeId]); + delete this.hoverObj.edges[edgeId]; + hoverChanged = true; + } + } + } + + if (object !== undefined) { + hoverChanged = hoverChanged || this.emitHoverEvent(event, pointer, object); + if (object instanceof Node && this.options.hoverConnectedEdges === true) { + this._hoverConnectedEdges(object); + } + } + + if (hoverChanged === true) { + this.body.emitter.emit('_requestRedraw'); + } + } + + /** + * + * retrieve the currently selected objects + * @return {{nodes: Array., edges: Array.}} selection + */ + + }, { + key: 'getSelection', + value: function getSelection() { + var nodeIds = this.getSelectedNodes(); + var edgeIds = this.getSelectedEdges(); + return { nodes: nodeIds, edges: edgeIds }; + } + + /** + * + * retrieve the currently selected nodes + * @return {string[]} selection An array with the ids of the + * selected nodes. + */ + + }, { + key: 'getSelectedNodes', + value: function getSelectedNodes() { + var idArray = []; + if (this.options.selectable === true) { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + idArray.push(this.selectionObj.nodes[nodeId].id); + } + } + } + return idArray; + } + + /** + * + * retrieve the currently selected edges + * @return {Array} selection An array with the ids of the + * selected nodes. + */ + + }, { + key: 'getSelectedEdges', + value: function getSelectedEdges() { + var idArray = []; + if (this.options.selectable === true) { + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + idArray.push(this.selectionObj.edges[edgeId].id); + } + } + } + return idArray; + } + + /** + * Updates the current selection + * @param {{nodes: Array., edges: Array.}} selection + * @param {Object} options Options + */ + + }, { + key: 'setSelection', + value: function setSelection(selection) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var i = void 0, + id = void 0; + + if (!selection || !selection.nodes && !selection.edges) throw 'Selection must be an object with nodes and/or edges properties'; + // first unselect any selected node, if option is true or undefined + if (options.unselectAll || options.unselectAll === undefined) { + this.unselectAll(); + } + if (selection.nodes) { + for (i = 0; i < selection.nodes.length; i++) { + id = selection.nodes[i]; + + var node = this.body.nodes[id]; + if (!node) { + throw new RangeError('Node with id "' + id + '" not found'); + } + // don't select edges with it + this.selectObject(node, options.highlightEdges); + } + } + + if (selection.edges) { + for (i = 0; i < selection.edges.length; i++) { + id = selection.edges[i]; + + var edge = this.body.edges[id]; + if (!edge) { + throw new RangeError('Edge with id "' + id + '" not found'); + } + this.selectObject(edge); + } + } + this.body.emitter.emit('_requestRedraw'); + } + + /** + * select zero or more nodes with the option to highlight edges + * @param {number[] | string[]} selection An array with the ids of the + * selected nodes. + * @param {boolean} [highlightEdges] + */ + + }, { + key: 'selectNodes', + value: function selectNodes(selection) { + var highlightEdges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + if (!selection || selection.length === undefined) throw 'Selection must be an array with ids'; + + this.setSelection({ nodes: selection }, { highlightEdges: highlightEdges }); + } + + /** + * select zero or more edges + * @param {number[] | string[]} selection An array with the ids of the + * selected nodes. + */ + + }, { + key: 'selectEdges', + value: function selectEdges(selection) { + if (!selection || selection.length === undefined) throw 'Selection must be an array with ids'; + + this.setSelection({ edges: selection }); + } + + /** + * Validate the selection: remove ids of nodes which no longer exist + * @private + */ + + }, { + key: 'updateSelection', + value: function updateSelection() { + for (var nodeId in this.selectionObj.nodes) { + if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { + if (!this.body.nodes.hasOwnProperty(nodeId)) { + delete this.selectionObj.nodes[nodeId]; + } + } + } + for (var edgeId in this.selectionObj.edges) { + if (this.selectionObj.edges.hasOwnProperty(edgeId)) { + if (!this.body.edges.hasOwnProperty(edgeId)) { + delete this.selectionObj.edges[edgeId]; + } + } + } + } + + /** + * Determine all the visual elements clicked which are on the given point. + * + * All elements are returned; this includes nodes, edges and their labels. + * The order returned is from highest to lowest, i.e. element 0 of the return + * value is the topmost item clicked on. + * + * The return value consists of an array of the following possible elements: + * + * - `{nodeId:number}` - node with given id clicked on + * - `{nodeId:number, labelId:0}` - label of node with given id clicked on + * - `{edgeId:number}` - edge with given id clicked on + * - `{edge:number, labelId:0}` - label of edge with given id clicked on + * + * ## NOTES + * + * - Currently, there is only one label associated with a node or an edge, + * but this is expected to change somewhere in the future. + * - Since there is no z-indexing yet, it is not really possible to set the nodes and + * edges in the correct order. For the time being, nodes come first. + * + * @param {point} pointer mouse position in screen coordinates + * @returns {Array.} + * @private + */ + + }, { + key: 'getClickedItems', + value: function getClickedItems(pointer) { + var point = this.canvas.DOMtoCanvas(pointer); + var items = []; + + // Note reverse order; we want the topmost clicked items to be first in the array + // Also note that selected nodes are disregarded here; these normally display on top + var nodeIndices = this.body.nodeIndices; + var nodes = this.body.nodes; + for (var i = nodeIndices.length - 1; i >= 0; i--) { + var node = nodes[nodeIndices[i]]; + var ret = node.getItemsOnPoint(point); + items.push.apply(items, ret); // Append the return value to the running list. + } + + var edgeIndices = this.body.edgeIndices; + var edges = this.body.edges; + for (var _i = edgeIndices.length - 1; _i >= 0; _i--) { + var edge = edges[edgeIndices[_i]]; + var _ret = edge.getItemsOnPoint(point); + items.push.apply(items, _ret); // Append the return value to the running list. + } + + return items; + } + }]); + return SelectionHandler; +}(); + +exports['default'] = SelectionHandler; + +/***/ }), +/* 235 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +/** + * There's a mix-up with terms in the code. Following are the formal definitions: + * + * tree - a strict hierarchical network, i.e. every node has at most one parent + * forest - a collection of trees. These distinct trees are thus not connected. + * + * So: + * - in a network that is not a tree, there exist nodes with multiple parents. + * - a network consisting of unconnected sub-networks, of which at least one + * is not a tree, is not a forest. + * + * In the code, the definitions are: + * + * tree - any disconnected sub-network, strict hierarchical or not. + * forest - a bunch of these sub-networks + * + * The difference between tree and not-tree is important in the code, notably within + * to the block-shifting algorithm. The algorithm assumes formal trees and fails + * for not-trees, often in a spectacular manner (search for 'exploding network' in the issues). + * + * In order to distinguish the definitions in the following code, the adjective 'formal' is + * used. If 'formal' is absent, you must assume the non-formal definition. + * + * ---------------------------------------------------------------------------------- + * NOTES + * ===== + * + * A hierarchical layout is a different thing from a hierarchical network. + * The layout is a way to arrange the nodes in the view; this can be done + * on non-hierarchical networks as well. The converse is also possible. + */ + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _slicedToArray2 = __webpack_require__(30); + +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); + +var _typeof2 = __webpack_require__(6); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _keys = __webpack_require__(8); + +var _keys2 = _interopRequireDefault(_keys); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var util = __webpack_require__(2); +var NetworkUtil = __webpack_require__(76)['default']; + +var _require = __webpack_require__(236), + HorizontalStrategy = _require.HorizontalStrategy, + VerticalStrategy = _require.VerticalStrategy; + +/** + * Container for derived data on current network, relating to hierarchy. + * + * @private + */ + + +var HierarchicalStatus = function () { + /** + * @ignore + */ + function HierarchicalStatus() { + (0, _classCallCheck3['default'])(this, HierarchicalStatus); + + this.childrenReference = {}; // child id's per node id + this.parentReference = {}; // parent id's per node id + this.trees = {}; // tree id per node id; i.e. to which tree does given node id belong + + this.distributionOrdering = {}; // The nodes per level, in the display order + this.levels = {}; // hierarchy level per node id + this.distributionIndex = {}; // The position of the node in the level sorting order, per node id. + + this.isTree = false; // True if current network is a formal tree + this.treeIndex = -1; // Highest tree id in current network. + } + + /** + * Add the relation between given nodes to the current state. + * + * @param {Node.id} parentNodeId + * @param {Node.id} childNodeId + */ + + + (0, _createClass3['default'])(HierarchicalStatus, [{ + key: 'addRelation', + value: function addRelation(parentNodeId, childNodeId) { + if (this.childrenReference[parentNodeId] === undefined) { + this.childrenReference[parentNodeId] = []; + } + this.childrenReference[parentNodeId].push(childNodeId); + + if (this.parentReference[childNodeId] === undefined) { + this.parentReference[childNodeId] = []; + } + this.parentReference[childNodeId].push(parentNodeId); + } + + /** + * Check if the current state is for a formal tree or formal forest. + * + * This is the case if every node has at most one parent. + * + * Pre: parentReference init'ed properly for current network + */ + + }, { + key: 'checkIfTree', + value: function checkIfTree() { + for (var i in this.parentReference) { + if (this.parentReference[i].length > 1) { + this.isTree = false; + return; + } + } + + this.isTree = true; + } + + /** + * Return the number of separate trees in the current network. + * @returns {number} + */ + + }, { + key: 'numTrees', + value: function numTrees() { + return this.treeIndex + 1; // This assumes the indexes are assigned consecitively + } + + /** + * Assign a tree id to a node + * @param {Node} node + * @param {string|number} treeId + */ + + }, { + key: 'setTreeIndex', + value: function setTreeIndex(node, treeId) { + if (treeId === undefined) return; // Don't bother + + if (this.trees[node.id] === undefined) { + this.trees[node.id] = treeId; + this.treeIndex = Math.max(treeId, this.treeIndex); + } + } + + /** + * Ensure level for given id is defined. + * + * Sets level to zero for given node id if not already present + * + * @param {Node.id} nodeId + */ + + }, { + key: 'ensureLevel', + value: function ensureLevel(nodeId) { + if (this.levels[nodeId] === undefined) { + this.levels[nodeId] = 0; + } + } + + /** + * get the maximum level of a branch. + * + * TODO: Never entered; find a test case to test this! + * @param {Node.id} nodeId + * @returns {number} + */ + + }, { + key: 'getMaxLevel', + value: function getMaxLevel(nodeId) { + var _this = this; + + var accumulator = {}; + + var _getMaxLevel = function _getMaxLevel(nodeId) { + if (accumulator[nodeId] !== undefined) { + return accumulator[nodeId]; + } + var level = _this.levels[nodeId]; + if (_this.childrenReference[nodeId]) { + var children = _this.childrenReference[nodeId]; + if (children.length > 0) { + for (var i = 0; i < children.length; i++) { + level = Math.max(level, _getMaxLevel(children[i])); + } + } + } + accumulator[nodeId] = level; + return level; + }; + + return _getMaxLevel(nodeId); + } + + /** + * + * @param {Node} nodeA + * @param {Node} nodeB + */ + + }, { + key: 'levelDownstream', + value: function levelDownstream(nodeA, nodeB) { + if (this.levels[nodeB.id] === undefined) { + // set initial level + if (this.levels[nodeA.id] === undefined) { + this.levels[nodeA.id] = 0; + } + // set level + this.levels[nodeB.id] = this.levels[nodeA.id] + 1; + } + } + + /** + * Small util method to set the minimum levels of the nodes to zero. + * + * @param {Array.} nodes + */ + + }, { + key: 'setMinLevelToZero', + value: function setMinLevelToZero(nodes) { + var minLevel = 1e9; + // get the minimum level + for (var nodeId in nodes) { + if (nodes.hasOwnProperty(nodeId)) { + if (this.levels[nodeId] !== undefined) { + minLevel = Math.min(this.levels[nodeId], minLevel); + } + } + } + + // subtract the minimum from the set so we have a range starting from 0 + for (var _nodeId in nodes) { + if (nodes.hasOwnProperty(_nodeId)) { + if (this.levels[_nodeId] !== undefined) { + this.levels[_nodeId] -= minLevel; + } + } + } + } + + /** + * Get the min and max xy-coordinates of a given tree + * + * @param {Array.} nodes + * @param {number} index + * @returns {{min_x: number, max_x: number, min_y: number, max_y: number}} + */ + + }, { + key: 'getTreeSize', + value: function getTreeSize(nodes, index) { + var min_x = 1e9; + var max_x = -1e9; + var min_y = 1e9; + var max_y = -1e9; + + for (var nodeId in this.trees) { + if (this.trees.hasOwnProperty(nodeId)) { + if (this.trees[nodeId] === index) { + var node = nodes[nodeId]; + min_x = Math.min(node.x, min_x); + max_x = Math.max(node.x, max_x); + min_y = Math.min(node.y, min_y); + max_y = Math.max(node.y, max_y); + } + } + } + + return { + min_x: min_x, + max_x: max_x, + min_y: min_y, + max_y: max_y + }; + } + + /** + * Check if two nodes have the same parent(s) + * + * @param {Node} node1 + * @param {Node} node2 + * @return {boolean} true if the two nodes have a same ancestor node, false otherwise + */ + + }, { + key: 'hasSameParent', + value: function hasSameParent(node1, node2) { + var parents1 = this.parentReference[node1.id]; + var parents2 = this.parentReference[node2.id]; + if (parents1 === undefined || parents2 === undefined) { + return false; + } + + for (var i = 0; i < parents1.length; i++) { + for (var j = 0; j < parents2.length; j++) { + if (parents1[i] == parents2[j]) { + return true; + } + } + } + return false; + } + + /** + * Check if two nodes are in the same tree. + * + * @param {Node} node1 + * @param {Node} node2 + * @return {Boolean} true if this is so, false otherwise + */ + + }, { + key: 'inSameSubNetwork', + value: function inSameSubNetwork(node1, node2) { + return this.trees[node1.id] === this.trees[node2.id]; + } + + /** + * Get a list of the distinct levels in the current network + * + * @returns {Array} + */ + + }, { + key: 'getLevels', + value: function getLevels() { + return (0, _keys2['default'])(this.distributionOrdering); + } + + /** + * Add a node to the ordering per level + * + * @param {Node} node + * @param {number} level + */ + + }, { + key: 'addToOrdering', + value: function addToOrdering(node, level) { + if (this.distributionOrdering[level] === undefined) { + this.distributionOrdering[level] = []; + } + + var isPresent = false; + var curLevel = this.distributionOrdering[level]; + for (var n in curLevel) { + //if (curLevel[n].id === node.id) { + if (curLevel[n] === node) { + isPresent = true; + break; + } + } + + if (!isPresent) { + this.distributionOrdering[level].push(node); + this.distributionIndex[node.id] = this.distributionOrdering[level].length - 1; + } + } + }]); + return HierarchicalStatus; +}(); + +/** + * The Layout Engine + */ + + +var LayoutEngine = function () { + /** + * @param {Object} body + */ + function LayoutEngine(body) { + (0, _classCallCheck3['default'])(this, LayoutEngine); + + this.body = body; + + this.initialRandomSeed = Math.round(Math.random() * 1000000); + this.randomSeed = this.initialRandomSeed; + this.setPhysics = false; + this.options = {}; + this.optionsBackup = { physics: {} }; + + this.defaultOptions = { + randomSeed: undefined, + improvedLayout: true, + hierarchical: { + enabled: false, + levelSeparation: 150, + nodeSpacing: 100, + treeSpacing: 200, + blockShifting: true, + edgeMinimization: true, + parentCentralization: true, + direction: 'UD', // UD, DU, LR, RL + sortMethod: 'hubsize' // hubsize, directed + } + }; + util.extend(this.options, this.defaultOptions); + this.bindEventListeners(); + } + + /** + * Binds event listeners + */ + + + (0, _createClass3['default'])(LayoutEngine, [{ + key: 'bindEventListeners', + value: function bindEventListeners() { + var _this2 = this; + + this.body.emitter.on('_dataChanged', function () { + _this2.setupHierarchicalLayout(); + }); + this.body.emitter.on('_dataLoaded', function () { + _this2.layoutNetwork(); + }); + this.body.emitter.on('_resetHierarchicalLayout', function () { + _this2.setupHierarchicalLayout(); + }); + this.body.emitter.on('_adjustEdgesForHierarchicalLayout', function () { + if (_this2.options.hierarchical.enabled !== true) { + return; + } + // get the type of static smooth curve in case it is required + var type = _this2.direction.curveType(); + + // force all edges into static smooth curves. + _this2.body.emitter.emit('_forceDisableDynamicCurves', type, false); + }); + } + + /** + * + * @param {Object} options + * @param {Object} allOptions + * @returns {Object} + */ + + }, { + key: 'setOptions', + value: function setOptions(options, allOptions) { + if (options !== undefined) { + var hierarchical = this.options.hierarchical; + var prevHierarchicalState = hierarchical.enabled; + util.selectiveDeepExtend(["randomSeed", "improvedLayout"], this.options, options); + util.mergeOptions(this.options, options, 'hierarchical'); + if (options.randomSeed !== undefined) { + this.initialRandomSeed = options.randomSeed; + } + + if (hierarchical.enabled === true) { + if (prevHierarchicalState === true) { + // refresh the overridden options for nodes and edges. + this.body.emitter.emit('refresh', true); + } + + // make sure the level separation is the right way up + if (hierarchical.direction === 'RL' || hierarchical.direction === 'DU') { + if (hierarchical.levelSeparation > 0) { + hierarchical.levelSeparation *= -1; + } + } else { + if (hierarchical.levelSeparation < 0) { + hierarchical.levelSeparation *= -1; + } + } + + this.setDirectionStrategy(); + + this.body.emitter.emit('_resetHierarchicalLayout'); + // because the hierarchical system needs it's own physics and smooth curve settings, + // we adapt the other options if needed. + return this.adaptAllOptionsForHierarchicalLayout(allOptions); + } else { + if (prevHierarchicalState === true) { + // refresh the overridden options for nodes and edges. + this.body.emitter.emit('refresh'); + return util.deepExtend(allOptions, this.optionsBackup); + } + } + } + return allOptions; + } + + /** + * + * @param {Object} allOptions + * @returns {Object} + */ + + }, { + key: 'adaptAllOptionsForHierarchicalLayout', + value: function adaptAllOptionsForHierarchicalLayout(allOptions) { + if (this.options.hierarchical.enabled === true) { + var backupPhysics = this.optionsBackup.physics; + + // set the physics + if (allOptions.physics === undefined || allOptions.physics === true) { + allOptions.physics = { + enabled: backupPhysics.enabled === undefined ? true : backupPhysics.enabled, + solver: 'hierarchicalRepulsion' + }; + backupPhysics.enabled = backupPhysics.enabled === undefined ? true : backupPhysics.enabled; + backupPhysics.solver = backupPhysics.solver || 'barnesHut'; + } else if ((0, _typeof3['default'])(allOptions.physics) === 'object') { + backupPhysics.enabled = allOptions.physics.enabled === undefined ? true : allOptions.physics.enabled; + backupPhysics.solver = allOptions.physics.solver || 'barnesHut'; + allOptions.physics.solver = 'hierarchicalRepulsion'; + } else if (allOptions.physics !== false) { + backupPhysics.solver = 'barnesHut'; + allOptions.physics = { solver: 'hierarchicalRepulsion' }; + } + + // get the type of static smooth curve in case it is required + var type = this.direction.curveType(); + + // disable smooth curves if nothing is defined. If smooth curves have been turned on, + // turn them into static smooth curves. + if (allOptions.edges === undefined) { + this.optionsBackup.edges = { smooth: { enabled: true, type: 'dynamic' } }; + allOptions.edges = { smooth: false }; + } else if (allOptions.edges.smooth === undefined) { + this.optionsBackup.edges = { smooth: { enabled: true, type: 'dynamic' } }; + allOptions.edges.smooth = false; + } else { + if (typeof allOptions.edges.smooth === 'boolean') { + this.optionsBackup.edges = { smooth: allOptions.edges.smooth }; + allOptions.edges.smooth = { enabled: allOptions.edges.smooth, type: type }; + } else { + var smooth = allOptions.edges.smooth; + + // allow custom types except for dynamic + if (smooth.type !== undefined && smooth.type !== 'dynamic') { + type = smooth.type; + } + + // TODO: this is options merging; see if the standard routines can be used here. + this.optionsBackup.edges = { + smooth: smooth.enabled === undefined ? true : smooth.enabled, + type: smooth.type === undefined ? 'dynamic' : smooth.type, + roundness: smooth.roundness === undefined ? 0.5 : smooth.roundness, + forceDirection: smooth.forceDirection === undefined ? false : smooth.forceDirection + }; + + // NOTE: Copying an object to self; this is basically setting defaults for undefined variables + allOptions.edges.smooth = { + enabled: smooth.enabled === undefined ? true : smooth.enabled, + type: type, + roundness: smooth.roundness === undefined ? 0.5 : smooth.roundness, + forceDirection: smooth.forceDirection === undefined ? false : smooth.forceDirection + }; + } + } + + // Force all edges into static smooth curves. + // Only applies to edges that do not use the global options for smooth. + this.body.emitter.emit('_forceDisableDynamicCurves', type); + } + + return allOptions; + } + + /** + * + * @returns {number} + */ + + }, { + key: 'seededRandom', + value: function seededRandom() { + var x = Math.sin(this.randomSeed++) * 10000; + return x - Math.floor(x); + } + + /** + * + * @param {Array.} nodesArray + */ + + }, { + key: 'positionInitially', + value: function positionInitially(nodesArray) { + if (this.options.hierarchical.enabled !== true) { + this.randomSeed = this.initialRandomSeed; + var radius = nodesArray.length + 50; + for (var i = 0; i < nodesArray.length; i++) { + var node = nodesArray[i]; + var angle = 2 * Math.PI * this.seededRandom(); + if (node.x === undefined) { + node.x = radius * Math.cos(angle); + } + if (node.y === undefined) { + node.y = radius * Math.sin(angle); + } + } + } + } + + /** + * Use Kamada Kawai to position nodes. This is quite a heavy algorithm so if there are a lot of nodes we + * cluster them first to reduce the amount. + */ + + }, { + key: 'layoutNetwork', + value: function layoutNetwork() { + if (this.options.hierarchical.enabled !== true && this.options.improvedLayout === true) { + var indices = this.body.nodeIndices; + + // first check if we should Kamada Kawai to layout. The threshold is if less than half of the visible + // nodes have predefined positions we use this. + var positionDefined = 0; + for (var i = 0; i < indices.length; i++) { + var node = this.body.nodes[indices[i]]; + if (node.predefinedPosition === true) { + positionDefined += 1; + } + } + + // if less than half of the nodes have a predefined position we continue + if (positionDefined < 0.5 * indices.length) { + var MAX_LEVELS = 10; + var level = 0; + var clusterThreshold = 150; // TODO add this to options + + // + // Define the options for the hidden cluster nodes + // These options don't propagate outside the clustering phase. + // + // Some options are explicitly disabled, because they may be set in group or default node options. + // The clusters are never displayed, so most explicit settings here serve as performance optimizations. + // + // The explicit setting of 'shape' is to avoid `shape: 'image'`; images are not passed to the hidden + // cluster nodes, leading to an exception on creation. + // + // All settings here are performance related, except when noted otherwise. + // + var clusterOptions = { + clusterNodeProperties: { + shape: 'ellipse', // Bugfix: avoid type 'image', no images supplied + label: '', // avoid label handling + group: '', // avoid group handling + font: { multi: false } // avoid font propagation + }, + clusterEdgeProperties: { + label: '', // avoid label handling + font: { multi: false }, // avoid font propagation + smooth: { + enabled: false // avoid drawing penalty for complex edges + } + } + }; + + // if there are a lot of nodes, we cluster before we run the algorithm. + // NOTE: this part fails to find clusters for large scale-free networks, which should + // be easily clusterable. + // TODO: examine why this is so + if (indices.length > clusterThreshold) { + var startLength = indices.length; + while (indices.length > clusterThreshold && level <= MAX_LEVELS) { + //console.time("clustering") + level += 1; + var before = indices.length; + // if there are many nodes we do a hubsize cluster + if (level % 3 === 0) { + this.body.modules.clustering.clusterBridges(clusterOptions); + } else { + this.body.modules.clustering.clusterOutliers(clusterOptions); + } + var after = indices.length; + if (before == after && level % 3 !== 0) { + this._declusterAll(); + this.body.emitter.emit("_layoutFailed"); + console.info("This network could not be positioned by this version of the improved layout algorithm." + " Please disable improvedLayout for better performance."); + return; + } + //console.timeEnd("clustering") + //console.log(before,level,after); + } + // increase the size of the edges + this.body.modules.kamadaKawai.setOptions({ springLength: Math.max(150, 2 * startLength) }); + } + if (level > MAX_LEVELS) { + console.info("The clustering didn't succeed within the amount of interations allowed," + " progressing with partial result."); + } + + // position the system for these nodes and edges + this.body.modules.kamadaKawai.solve(indices, this.body.edgeIndices, true); + + // shift to center point + this._shiftToCenter(); + + // perturb the nodes a little bit to force the physics to kick in + var offset = 70; + for (var _i = 0; _i < indices.length; _i++) { + // Only perturb the nodes that aren't fixed + var _node = this.body.nodes[indices[_i]]; + if (_node.predefinedPosition === false) { + _node.x += (0.5 - this.seededRandom()) * offset; + _node.y += (0.5 - this.seededRandom()) * offset; + } + } + + // uncluster all clusters + this._declusterAll(); + + // reposition all bezier nodes. + this.body.emitter.emit("_repositionBezierNodes"); + } + } + } + + /** + * Move all the nodes towards to the center so gravitational pull wil not move the nodes away from view + * @private + */ + + }, { + key: '_shiftToCenter', + value: function _shiftToCenter() { + var range = NetworkUtil.getRangeCore(this.body.nodes, this.body.nodeIndices); + var center = NetworkUtil.findCenter(range); + for (var i = 0; i < this.body.nodeIndices.length; i++) { + var node = this.body.nodes[this.body.nodeIndices[i]]; + node.x -= center.x; + node.y -= center.y; + } + } + + /** + * Expands all clusters + * @private + */ + + }, { + key: '_declusterAll', + value: function _declusterAll() { + var clustersPresent = true; + while (clustersPresent === true) { + clustersPresent = false; + for (var i = 0; i < this.body.nodeIndices.length; i++) { + if (this.body.nodes[this.body.nodeIndices[i]].isCluster === true) { + clustersPresent = true; + this.body.modules.clustering.openCluster(this.body.nodeIndices[i], {}, false); + } + } + if (clustersPresent === true) { + this.body.emitter.emit('_dataChanged'); + } + } + } + + /** + * + * @returns {number|*} + */ + + }, { + key: 'getSeed', + value: function getSeed() { + return this.initialRandomSeed; + } + + /** + * This is the main function to layout the nodes in a hierarchical way. + * It checks if the node details are supplied correctly + * + * @private + */ + + }, { + key: 'setupHierarchicalLayout', + value: function setupHierarchicalLayout() { + if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) { + // get the size of the largest hubs and check if the user has defined a level for a node. + var node = void 0, + nodeId = void 0; + var definedLevel = false; + var undefinedLevel = false; + this.lastNodeOnLevel = {}; + this.hierarchical = new HierarchicalStatus(); + + for (nodeId in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(nodeId)) { + node = this.body.nodes[nodeId]; + if (node.options.level !== undefined) { + definedLevel = true; + this.hierarchical.levels[nodeId] = node.options.level; + } else { + undefinedLevel = true; + } + } + } + + // if the user defined some levels but not all, alert and run without hierarchical layout + if (undefinedLevel === true && definedLevel === true) { + throw new Error('To use the hierarchical layout, nodes require either no predefined levels' + ' or levels have to be defined for all nodes.'); + } else { + // define levels if undefined by the users. Based on hubsize. + if (undefinedLevel === true) { + var sortMethod = this.options.hierarchical.sortMethod; + if (sortMethod === 'hubsize') { + this._determineLevelsByHubsize(); + } else if (sortMethod === 'directed') { + this._determineLevelsDirected(); + } else if (sortMethod === 'custom') { + this._determineLevelsCustomCallback(); + } + } + + // fallback for cases where there are nodes but no edges + for (var _nodeId2 in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(_nodeId2)) { + this.hierarchical.ensureLevel(_nodeId2); + } + } + // check the distribution of the nodes per level. + var distribution = this._getDistribution(); + + // get the parent children relations. + this._generateMap(); + + // place the nodes on the canvas. + this._placeNodesByHierarchy(distribution); + + // condense the whitespace. + this._condenseHierarchy(); + + // shift to center so gravity does not have to do much + this._shiftToCenter(); + } + } + } + + /** + * @private + */ + + }, { + key: '_condenseHierarchy', + value: function _condenseHierarchy() { + var _this3 = this; + + // Global var in this scope to define when the movement has stopped. + var stillShifting = false; + var branches = {}; + // first we have some methods to help shifting trees around. + // the main method to shift the trees + var shiftTrees = function shiftTrees() { + var treeSizes = getTreeSizes(); + var shiftBy = 0; + for (var i = 0; i < treeSizes.length - 1; i++) { + var diff = treeSizes[i].max - treeSizes[i + 1].min; + shiftBy += diff + _this3.options.hierarchical.treeSpacing; + shiftTree(i + 1, shiftBy); + } + }; + + // shift a single tree by an offset + var shiftTree = function shiftTree(index, offset) { + var trees = _this3.hierarchical.trees; + + for (var nodeId in trees) { + if (trees.hasOwnProperty(nodeId)) { + if (trees[nodeId] === index) { + _this3.direction.shift(nodeId, offset); + } + } + } + }; + + // get the width of all trees + var getTreeSizes = function getTreeSizes() { + var treeWidths = []; + for (var i = 0; i < _this3.hierarchical.numTrees(); i++) { + treeWidths.push(_this3.direction.getTreeSize(i)); + } + return treeWidths; + }; + + // get a map of all nodes in this branch + var getBranchNodes = function getBranchNodes(source, map) { + if (map[source.id]) { + return; + } + map[source.id] = true; + if (_this3.hierarchical.childrenReference[source.id]) { + var children = _this3.hierarchical.childrenReference[source.id]; + if (children.length > 0) { + for (var i = 0; i < children.length; i++) { + getBranchNodes(_this3.body.nodes[children[i]], map); + } + } + } + }; + + // get a min max width as well as the maximum movement space it has on either sides + // we use min max terminology because width and height can interchange depending on the direction of the layout + var getBranchBoundary = function getBranchBoundary(branchMap) { + var maxLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1e9; + + var minSpace = 1e9; + var maxSpace = 1e9; + var min = 1e9; + var max = -1e9; + for (var branchNode in branchMap) { + if (branchMap.hasOwnProperty(branchNode)) { + var node = _this3.body.nodes[branchNode]; + var level = _this3.hierarchical.levels[node.id]; + var position = _this3.direction.getPosition(node); + + // get the space around the node. + + var _getSpaceAroundNode2 = _this3._getSpaceAroundNode(node, branchMap), + _getSpaceAroundNode3 = (0, _slicedToArray3['default'])(_getSpaceAroundNode2, 2), + minSpaceNode = _getSpaceAroundNode3[0], + maxSpaceNode = _getSpaceAroundNode3[1]; + + minSpace = Math.min(minSpaceNode, minSpace); + maxSpace = Math.min(maxSpaceNode, maxSpace); + + // the width is only relevant for the levels two nodes have in common. This is why we filter on this. + if (level <= maxLevel) { + min = Math.min(position, min); + max = Math.max(position, max); + } + } + } + + return [min, max, minSpace, maxSpace]; + }; + + // check what the maximum level is these nodes have in common. + var getCollisionLevel = function getCollisionLevel(node1, node2) { + var maxLevel1 = _this3.hierarchical.getMaxLevel(node1.id); + var maxLevel2 = _this3.hierarchical.getMaxLevel(node2.id); + return Math.min(maxLevel1, maxLevel2); + }; + + /** + * Condense elements. These can be nodes or branches depending on the callback. + * + * @param {function} callback + * @param {Array.} levels + * @param {*} centerParents + */ + var shiftElementsCloser = function shiftElementsCloser(callback, levels, centerParents) { + var hier = _this3.hierarchical; + + for (var i = 0; i < levels.length; i++) { + var level = levels[i]; + var levelNodes = hier.distributionOrdering[level]; + if (levelNodes.length > 1) { + for (var j = 0; j < levelNodes.length - 1; j++) { + var node1 = levelNodes[j]; + var node2 = levelNodes[j + 1]; + + // NOTE: logic maintained as it was; if nodes have same ancestor, + // then of course they are in the same sub-network. + if (hier.hasSameParent(node1, node2) && hier.inSameSubNetwork(node1, node2)) { + callback(node1, node2, centerParents); + } + } + } + } + }; + + // callback for shifting branches + var branchShiftCallback = function branchShiftCallback(node1, node2) { + var centerParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + //window.CALLBACKS.push(() => { + var pos1 = _this3.direction.getPosition(node1); + var pos2 = _this3.direction.getPosition(node2); + var diffAbs = Math.abs(pos2 - pos1); + var nodeSpacing = _this3.options.hierarchical.nodeSpacing; + //console.log("NOW CHECKING:", node1.id, node2.id, diffAbs); + if (diffAbs > nodeSpacing) { + var branchNodes1 = {}; + var branchNodes2 = {}; + + getBranchNodes(node1, branchNodes1); + getBranchNodes(node2, branchNodes2); + + // check the largest distance between the branches + var maxLevel = getCollisionLevel(node1, node2); + var branchNodeBoundary1 = getBranchBoundary(branchNodes1, maxLevel); + var branchNodeBoundary2 = getBranchBoundary(branchNodes2, maxLevel); + var max1 = branchNodeBoundary1[1]; + var min2 = branchNodeBoundary2[0]; + var minSpace2 = branchNodeBoundary2[2]; + + //console.log(node1.id, getBranchBoundary(branchNodes1, maxLevel), node2.id, + // getBranchBoundary(branchNodes2, maxLevel), maxLevel); + var diffBranch = Math.abs(max1 - min2); + if (diffBranch > nodeSpacing) { + var offset = max1 - min2 + nodeSpacing; + if (offset < -minSpace2 + nodeSpacing) { + offset = -minSpace2 + nodeSpacing; + //console.log("RESETTING OFFSET", max1 - min2 + this.options.hierarchical.nodeSpacing, -minSpace2, offset); + } + if (offset < 0) { + //console.log("SHIFTING", node2.id, offset); + _this3._shiftBlock(node2.id, offset); + stillShifting = true; + + if (centerParent === true) _this3._centerParent(node2); + } + } + } + //this.body.emitter.emit("_redraw");}) + }; + + var minimizeEdgeLength = function minimizeEdgeLength(iterations, node) { + //window.CALLBACKS.push(() => { + // console.log("ts",node.id); + var nodeId = node.id; + var allEdges = node.edges; + var nodeLevel = _this3.hierarchical.levels[node.id]; + + // gather constants + var C2 = _this3.options.hierarchical.levelSeparation * _this3.options.hierarchical.levelSeparation; + var referenceNodes = {}; + var aboveEdges = []; + for (var i = 0; i < allEdges.length; i++) { + var edge = allEdges[i]; + if (edge.toId != edge.fromId) { + var otherNode = edge.toId == nodeId ? edge.from : edge.to; + referenceNodes[allEdges[i].id] = otherNode; + if (_this3.hierarchical.levels[otherNode.id] < nodeLevel) { + aboveEdges.push(edge); + } + } + } + + // differentiated sum of lengths based on only moving one node over one axis + var getFx = function getFx(point, edges) { + var sum = 0; + for (var _i2 = 0; _i2 < edges.length; _i2++) { + if (referenceNodes[edges[_i2].id] !== undefined) { + var a = _this3.direction.getPosition(referenceNodes[edges[_i2].id]) - point; + sum += a / Math.sqrt(a * a + C2); + } + } + return sum; + }; + + // doubly differentiated sum of lengths based on only moving one node over one axis + var getDFx = function getDFx(point, edges) { + var sum = 0; + for (var _i3 = 0; _i3 < edges.length; _i3++) { + if (referenceNodes[edges[_i3].id] !== undefined) { + var a = _this3.direction.getPosition(referenceNodes[edges[_i3].id]) - point; + sum -= C2 * Math.pow(a * a + C2, -1.5); + } + } + return sum; + }; + + var getGuess = function getGuess(iterations, edges) { + var guess = _this3.direction.getPosition(node); + // Newton's method for optimization + var guessMap = {}; + for (var _i4 = 0; _i4 < iterations; _i4++) { + var fx = getFx(guess, edges); + var dfx = getDFx(guess, edges); + + // we limit the movement to avoid instability. + var limit = 40; + var ratio = Math.max(-limit, Math.min(limit, Math.round(fx / dfx))); + guess = guess - ratio; + // reduce duplicates + if (guessMap[guess] !== undefined) { + break; + } + guessMap[guess] = _i4; + } + return guess; + }; + + var moveBranch = function moveBranch(guess) { + // position node if there is space + var nodePosition = _this3.direction.getPosition(node); + + // check movable area of the branch + if (branches[node.id] === undefined) { + var branchNodes = {}; + getBranchNodes(node, branchNodes); + branches[node.id] = branchNodes; + } + var branchBoundary = getBranchBoundary(branches[node.id]); + var minSpaceBranch = branchBoundary[2]; + var maxSpaceBranch = branchBoundary[3]; + + var diff = guess - nodePosition; + + // check if we are allowed to move the node: + var branchOffset = 0; + if (diff > 0) { + branchOffset = Math.min(diff, maxSpaceBranch - _this3.options.hierarchical.nodeSpacing); + } else if (diff < 0) { + branchOffset = -Math.min(-diff, minSpaceBranch - _this3.options.hierarchical.nodeSpacing); + } + + if (branchOffset != 0) { + //console.log("moving branch:",branchOffset, maxSpaceBranch, minSpaceBranch) + _this3._shiftBlock(node.id, branchOffset); + //this.body.emitter.emit("_redraw"); + stillShifting = true; + } + }; + + var moveNode = function moveNode(guess) { + var nodePosition = _this3.direction.getPosition(node); + + // position node if there is space + + var _getSpaceAroundNode4 = _this3._getSpaceAroundNode(node), + _getSpaceAroundNode5 = (0, _slicedToArray3['default'])(_getSpaceAroundNode4, 2), + minSpace = _getSpaceAroundNode5[0], + maxSpace = _getSpaceAroundNode5[1]; + + var diff = guess - nodePosition; + // check if we are allowed to move the node: + var newPosition = nodePosition; + if (diff > 0) { + newPosition = Math.min(nodePosition + (maxSpace - _this3.options.hierarchical.nodeSpacing), guess); + } else if (diff < 0) { + newPosition = Math.max(nodePosition - (minSpace - _this3.options.hierarchical.nodeSpacing), guess); + } + + if (newPosition !== nodePosition) { + //console.log("moving Node:",diff, minSpace, maxSpace); + _this3.direction.setPosition(node, newPosition); + //this.body.emitter.emit("_redraw"); + stillShifting = true; + } + }; + + var guess = getGuess(iterations, aboveEdges); + moveBranch(guess); + guess = getGuess(iterations, allEdges); + moveNode(guess); + //}) + }; + + // method to remove whitespace between branches. Because we do bottom up, we can center the parents. + var minimizeEdgeLengthBottomUp = function minimizeEdgeLengthBottomUp(iterations) { + var levels = _this3.hierarchical.getLevels(); + levels = levels.reverse(); + for (var i = 0; i < iterations; i++) { + stillShifting = false; + for (var j = 0; j < levels.length; j++) { + var level = levels[j]; + var levelNodes = _this3.hierarchical.distributionOrdering[level]; + for (var k = 0; k < levelNodes.length; k++) { + minimizeEdgeLength(1000, levelNodes[k]); + } + } + if (stillShifting !== true) { + //console.log("FINISHED minimizeEdgeLengthBottomUp IN " + i); + break; + } + } + }; + + // method to remove whitespace between branches. Because we do bottom up, we can center the parents. + var shiftBranchesCloserBottomUp = function shiftBranchesCloserBottomUp(iterations) { + var levels = _this3.hierarchical.getLevels(); + levels = levels.reverse(); + for (var i = 0; i < iterations; i++) { + stillShifting = false; + shiftElementsCloser(branchShiftCallback, levels, true); + if (stillShifting !== true) { + //console.log("FINISHED shiftBranchesCloserBottomUp IN " + (i+1)); + break; + } + } + }; + + // center all parents + var centerAllParents = function centerAllParents() { + for (var nodeId in _this3.body.nodes) { + if (_this3.body.nodes.hasOwnProperty(nodeId)) _this3._centerParent(_this3.body.nodes[nodeId]); + } + }; + + // center all parents + var centerAllParentsBottomUp = function centerAllParentsBottomUp() { + var levels = _this3.hierarchical.getLevels(); + levels = levels.reverse(); + for (var i = 0; i < levels.length; i++) { + var level = levels[i]; + var levelNodes = _this3.hierarchical.distributionOrdering[level]; + for (var j = 0; j < levelNodes.length; j++) { + _this3._centerParent(levelNodes[j]); + } + } + }; + + // the actual work is done here. + if (this.options.hierarchical.blockShifting === true) { + shiftBranchesCloserBottomUp(5); + centerAllParents(); + } + + // minimize edge length + if (this.options.hierarchical.edgeMinimization === true) { + minimizeEdgeLengthBottomUp(20); + } + + if (this.options.hierarchical.parentCentralization === true) { + centerAllParentsBottomUp(); + } + + shiftTrees(); + } + + /** + * This gives the space around the node. IF a map is supplied, it will only check against nodes NOT in the map. + * This is used to only get the distances to nodes outside of a branch. + * @param {Node} node + * @param {{Node.id: vis.Node}} map + * @returns {number[]} + * @private + */ + + }, { + key: '_getSpaceAroundNode', + value: function _getSpaceAroundNode(node, map) { + var useMap = true; + if (map === undefined) { + useMap = false; + } + var level = this.hierarchical.levels[node.id]; + if (level !== undefined) { + var index = this.hierarchical.distributionIndex[node.id]; + var position = this.direction.getPosition(node); + var ordering = this.hierarchical.distributionOrdering[level]; + var minSpace = 1e9; + var maxSpace = 1e9; + if (index !== 0) { + var prevNode = ordering[index - 1]; + if (useMap === true && map[prevNode.id] === undefined || useMap === false) { + var prevPos = this.direction.getPosition(prevNode); + minSpace = position - prevPos; + } + } + + if (index != ordering.length - 1) { + var nextNode = ordering[index + 1]; + if (useMap === true && map[nextNode.id] === undefined || useMap === false) { + var nextPos = this.direction.getPosition(nextNode); + maxSpace = Math.min(maxSpace, nextPos - position); + } + } + + return [minSpace, maxSpace]; + } else { + return [0, 0]; + } + } + + /** + * We use this method to center a parent node and check if it does not cross other nodes when it does. + * @param {Node} node + * @private + */ + + }, { + key: '_centerParent', + value: function _centerParent(node) { + if (this.hierarchical.parentReference[node.id]) { + var parents = this.hierarchical.parentReference[node.id]; + for (var i = 0; i < parents.length; i++) { + var parentId = parents[i]; + var parentNode = this.body.nodes[parentId]; + var children = this.hierarchical.childrenReference[parentId]; + + if (children !== undefined) { + // get the range of the children + var newPosition = this._getCenterPosition(children); + + var position = this.direction.getPosition(parentNode); + + var _getSpaceAroundNode6 = this._getSpaceAroundNode(parentNode), + _getSpaceAroundNode7 = (0, _slicedToArray3['default'])(_getSpaceAroundNode6, 2), + minSpace = _getSpaceAroundNode7[0], + maxSpace = _getSpaceAroundNode7[1]; + + var diff = position - newPosition; + if (diff < 0 && Math.abs(diff) < maxSpace - this.options.hierarchical.nodeSpacing || diff > 0 && Math.abs(diff) < minSpace - this.options.hierarchical.nodeSpacing) { + this.direction.setPosition(parentNode, newPosition); + } + } + } + } + } + + /** + * This function places the nodes on the canvas based on the hierarchial distribution. + * + * @param {Object} distribution | obtained by the function this._getDistribution() + * @private + */ + + }, { + key: '_placeNodesByHierarchy', + value: function _placeNodesByHierarchy(distribution) { + this.positionedNodes = {}; + // start placing all the level 0 nodes first. Then recursively position their branches. + for (var level in distribution) { + if (distribution.hasOwnProperty(level)) { + // sort nodes in level by position: + var nodeArray = (0, _keys2['default'])(distribution[level]); + nodeArray = this._indexArrayToNodes(nodeArray); + this.direction.sort(nodeArray); + var handledNodeCount = 0; + + for (var i = 0; i < nodeArray.length; i++) { + var node = nodeArray[i]; + if (this.positionedNodes[node.id] === undefined) { + var spacing = this.options.hierarchical.nodeSpacing; + var pos = spacing * handledNodeCount; + // We get the X or Y values we need and store them in pos and previousPos. + // The get and set make sure we get X or Y + if (handledNodeCount > 0) { + pos = this.direction.getPosition(nodeArray[i - 1]) + spacing; + } + this.direction.setPosition(node, pos, level); + this._validatePositionAndContinue(node, level, pos); + + handledNodeCount++; + } + } + } + } + } + + /** + * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes + * on a X position that ensures there will be no overlap. + * + * @param {Node.id} parentId + * @param {number} parentLevel + * @private + */ + + }, { + key: '_placeBranchNodes', + value: function _placeBranchNodes(parentId, parentLevel) { + var childRef = this.hierarchical.childrenReference[parentId]; + + // if this is not a parent, cancel the placing. This can happen with multiple parents to one child. + if (childRef === undefined) { + return; + } + + // get a list of childNodes + var childNodes = []; + for (var i = 0; i < childRef.length; i++) { + childNodes.push(this.body.nodes[childRef[i]]); + } + + // use the positions to order the nodes. + this.direction.sort(childNodes); + + // position the childNodes + for (var _i5 = 0; _i5 < childNodes.length; _i5++) { + var childNode = childNodes[_i5]; + var childNodeLevel = this.hierarchical.levels[childNode.id]; + // check if the child node is below the parent node and if it has already been positioned. + if (childNodeLevel > parentLevel && this.positionedNodes[childNode.id] === undefined) { + // get the amount of space required for this node. If parent the width is based on the amount of children. + var spacing = this.options.hierarchical.nodeSpacing; + var pos = void 0; + + // we get the X or Y values we need and store them in pos and previousPos. + // The get and set make sure we get X or Y + if (_i5 === 0) { + pos = this.direction.getPosition(this.body.nodes[parentId]); + } else { + pos = this.direction.getPosition(childNodes[_i5 - 1]) + spacing; + } + this.direction.setPosition(childNode, pos, childNodeLevel); + this._validatePositionAndContinue(childNode, childNodeLevel, pos); + } else { + return; + } + } + + // center the parent nodes. + var center = this._getCenterPosition(childNodes); + this.direction.setPosition(this.body.nodes[parentId], center, parentLevel); + } + + /** + * This method checks for overlap and if required shifts the branch. It also keeps records of positioned nodes. + * Finally it will call _placeBranchNodes to place the branch nodes. + * @param {Node} node + * @param {number} level + * @param {number} pos + * @private + */ + + }, { + key: '_validatePositionAndContinue', + value: function _validatePositionAndContinue(node, level, pos) { + // This method only works for formal trees and formal forests + // Early exit if this is not the case + if (!this.hierarchical.isTree) return; + + // if overlap has been detected, we shift the branch + if (this.lastNodeOnLevel[level] !== undefined) { + var previousPos = this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[level]]); + if (pos - previousPos < this.options.hierarchical.nodeSpacing) { + var diff = previousPos + this.options.hierarchical.nodeSpacing - pos; + var sharedParent = this._findCommonParent(this.lastNodeOnLevel[level], node.id); + this._shiftBlock(sharedParent.withChild, diff); + } + } + + this.lastNodeOnLevel[level] = node.id; // store change in position. + this.positionedNodes[node.id] = true; + this._placeBranchNodes(node.id, level); + } + + /** + * Receives an array with node indices and returns an array with the actual node references. + * Used for sorting based on node properties. + * @param {Array.} idArray + * @returns {Array.} + */ + + }, { + key: '_indexArrayToNodes', + value: function _indexArrayToNodes(idArray) { + var array = []; + for (var i = 0; i < idArray.length; i++) { + array.push(this.body.nodes[idArray[i]]); + } + return array; + } + + /** + * This function get the distribution of levels based on hubsize + * + * @returns {Object} + * @private + */ + + }, { + key: '_getDistribution', + value: function _getDistribution() { + var distribution = {}; + var nodeId = void 0, + node = void 0; + + // we fix Y because the hierarchy is vertical, + // we fix X so we do not give a node an x position for a second time. + // the fix of X is removed after the x value has been set. + for (nodeId in this.body.nodes) { + if (this.body.nodes.hasOwnProperty(nodeId)) { + node = this.body.nodes[nodeId]; + var level = this.hierarchical.levels[nodeId] === undefined ? 0 : this.hierarchical.levels[nodeId]; + this.direction.fix(node, level); + if (distribution[level] === undefined) { + distribution[level] = {}; + } + distribution[level][nodeId] = node; + } + } + return distribution; + } + + /** + * Return the active (i.e. visible) edges for this node + * + * @param {Node} node + * @returns {Array.} Array of edge instances + * @private + */ + + }, { + key: '_getActiveEdges', + value: function _getActiveEdges(node) { + var _this4 = this; + + var result = []; + + util.forEach(node.edges, function (edge) { + if (_this4.body.edgeIndices.indexOf(edge.id) !== -1) { + result.push(edge); + } + }); + + return result; + } + + /** + * Get the hubsizes for all active nodes. + * + * @returns {number} + * @private + */ + + }, { + key: '_getHubSizes', + value: function _getHubSizes() { + var _this5 = this; + + var hubSizes = {}; + var nodeIds = this.body.nodeIndices; + + util.forEach(nodeIds, function (nodeId) { + var node = _this5.body.nodes[nodeId]; + var hubSize = _this5._getActiveEdges(node).length; + hubSizes[hubSize] = true; + }); + + // Make an array of the size sorted descending + var result = []; + util.forEach(hubSizes, function (size) { + result.push(Number(size)); + }); + + result.sort(function (a, b) { + return b - a; + }); + + return result; + } + + /** + * this function allocates nodes in levels based on the recursive branching from the largest hubs. + * + * @private + */ + + }, { + key: '_determineLevelsByHubsize', + value: function _determineLevelsByHubsize() { + var _this6 = this; + + var levelDownstream = function levelDownstream(nodeA, nodeB) { + _this6.hierarchical.levelDownstream(nodeA, nodeB); + }; + + var hubSizes = this._getHubSizes(); + + var _loop = function _loop(i) { + var hubSize = hubSizes[i]; + if (hubSize === 0) return 'break'; + + util.forEach(_this6.body.nodeIndices, function (nodeId) { + var node = _this6.body.nodes[nodeId]; + + if (hubSize === _this6._getActiveEdges(node).length) { + _this6._crawlNetwork(levelDownstream, nodeId); + } + }); + }; + + for (var i = 0; i < hubSizes.length; ++i) { + var _ret = _loop(i); + + if (_ret === 'break') break; + } + } + + /** + * TODO: release feature + * TODO: Determine if this feature is needed at all + * + * @private + */ + + }, { + key: '_determineLevelsCustomCallback', + value: function _determineLevelsCustomCallback() { + var _this7 = this; + + var minLevel = 100000; + + // TODO: this should come from options. + var customCallback = function customCallback(nodeA, nodeB, edge) {// eslint-disable-line no-unused-vars + + }; + + // TODO: perhaps move to HierarchicalStatus. + // But I currently don't see the point, this method is not used. + var levelByDirection = function levelByDirection(nodeA, nodeB, edge) { + var levelA = _this7.hierarchical.levels[nodeA.id]; + // set initial level + if (levelA === undefined) { + levelA = _this7.hierarchical.levels[nodeA.id] = minLevel; + } + + var diff = customCallback(NetworkUtil.cloneOptions(nodeA, 'node'), NetworkUtil.cloneOptions(nodeB, 'node'), NetworkUtil.cloneOptions(edge, 'edge')); + + _this7.hierarchical.levels[nodeB.id] = levelA + diff; + }; + + this._crawlNetwork(levelByDirection); + this.hierarchical.setMinLevelToZero(this.body.nodes); + } + + /** + * Allocate nodes in levels based on the direction of the edges. + * + * @private + */ + + }, { + key: '_determineLevelsDirected', + value: function _determineLevelsDirected() { + var _this8 = this; + + var minLevel = 10000; + + /** + * Check if there is an edge going the opposite direction for given edge + * + * @param {Edge} edge edge to check + * @returns {boolean} true if there's another edge going into the opposite direction + */ + var isBidirectional = function isBidirectional(edge) { + util.forEach(_this8.body.edges, function (otherEdge) { + if (otherEdge.toId === edge.fromId && otherEdge.fromId === edge.toId) { + return true; + } + }); + + return false; + }; + + var levelByDirection = function levelByDirection(nodeA, nodeB, edge) { + var levelA = _this8.hierarchical.levels[nodeA.id]; + var levelB = _this8.hierarchical.levels[nodeB.id]; + + if (isBidirectional(edge) && levelA !== undefined && levelB !== undefined) { + // Don't redo the level determination if already done in this case. + return; + } + + // set initial level + if (levelA === undefined) { + levelA = _this8.hierarchical.levels[nodeA.id] = minLevel; + } + if (edge.toId == nodeB.id) { + _this8.hierarchical.levels[nodeB.id] = levelA + 1; + } else { + _this8.hierarchical.levels[nodeB.id] = levelA - 1; + } + }; + + this._crawlNetwork(levelByDirection); + this.hierarchical.setMinLevelToZero(this.body.nodes); + } + + /** + * Update the bookkeeping of parent and child. + * @private + */ + + }, { + key: '_generateMap', + value: function _generateMap() { + var _this9 = this; + + var fillInRelations = function fillInRelations(parentNode, childNode) { + if (_this9.hierarchical.levels[childNode.id] > _this9.hierarchical.levels[parentNode.id]) { + _this9.hierarchical.addRelation(parentNode.id, childNode.id); + } + }; + + this._crawlNetwork(fillInRelations); + this.hierarchical.checkIfTree(); + } + + /** + * Crawl over the entire network and use a callback on each node couple that is connected to each other. + * @param {function} [callback=function(){}] | will receive nodeA, nodeB and the connecting edge. A and B are distinct. + * @param {Node.id} startingNodeId + * @private + */ + + }, { + key: '_crawlNetwork', + value: function _crawlNetwork() { + var _this10 = this; + + var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {}; + var startingNodeId = arguments[1]; + + var progress = {}; + + var crawler = function crawler(node, tree) { + if (progress[node.id] === undefined) { + _this10.hierarchical.setTreeIndex(node, tree); + + progress[node.id] = true; + var childNode = void 0; + var edges = _this10._getActiveEdges(node); + for (var i = 0; i < edges.length; i++) { + var edge = edges[i]; + if (edge.connected === true) { + if (edge.toId == node.id) { + // Not '===' because id's can be string and numeric + childNode = edge.from; + } else { + childNode = edge.to; + } + + if (node.id != childNode.id) { + // Not '!==' because id's can be string and numeric + callback(node, childNode, edge); + crawler(childNode, tree); + } + } + } + } + }; + + if (startingNodeId === undefined) { + // Crawl over all nodes + var treeIndex = 0; // Serves to pass a unique id for the current distinct tree + + for (var i = 0; i < this.body.nodeIndices.length; i++) { + var nodeId = this.body.nodeIndices[i]; + + if (progress[nodeId] === undefined) { + var node = this.body.nodes[nodeId]; + crawler(node, treeIndex); + treeIndex += 1; + } + } + } else { + // Crawl from the given starting node + var _node2 = this.body.nodes[startingNodeId]; + if (_node2 === undefined) { + console.error("Node not found:", startingNodeId); + return; + } + crawler(_node2); + } + } + + /** + * Shift a branch a certain distance + * @param {Node.id} parentId + * @param {number} diff + * @private + */ + + }, { + key: '_shiftBlock', + value: function _shiftBlock(parentId, diff) { + var _this11 = this; + + var progress = {}; + var shifter = function shifter(parentId) { + if (progress[parentId]) { + return; + } + progress[parentId] = true; + _this11.direction.shift(parentId, diff); + + var childRef = _this11.hierarchical.childrenReference[parentId]; + if (childRef !== undefined) { + for (var i = 0; i < childRef.length; i++) { + shifter(childRef[i]); + } + } + }; + shifter(parentId); + } + + /** + * Find a common parent between branches. + * @param {Node.id} childA + * @param {Node.id} childB + * @returns {{foundParent, withChild}} + * @private + */ + + }, { + key: '_findCommonParent', + value: function _findCommonParent(childA, childB) { + var _this12 = this; + + var parents = {}; + var iterateParents = function iterateParents(parents, child) { + var parentRef = _this12.hierarchical.parentReference[child]; + if (parentRef !== undefined) { + for (var i = 0; i < parentRef.length; i++) { + var parent = parentRef[i]; + parents[parent] = true; + iterateParents(parents, parent); + } + } + }; + var findParent = function findParent(parents, child) { + var parentRef = _this12.hierarchical.parentReference[child]; + if (parentRef !== undefined) { + for (var i = 0; i < parentRef.length; i++) { + var parent = parentRef[i]; + if (parents[parent] !== undefined) { + return { foundParent: parent, withChild: child }; + } + var branch = findParent(parents, parent); + if (branch.foundParent !== null) { + return branch; + } + } + } + return { foundParent: null, withChild: child }; + }; + + iterateParents(parents, childA); + return findParent(parents, childB); + } + + /** + * Set the strategy pattern for handling the coordinates given the current direction. + * + * The individual instances contain all the operations and data specific to a layout direction. + * + * @param {Node} node + * @param {{x: number, y: number}} position + * @param {number} level + * @param {boolean} [doNotUpdate=false] + * @private + */ + + }, { + key: 'setDirectionStrategy', + value: function setDirectionStrategy() { + var isVertical = this.options.hierarchical.direction === 'UD' || this.options.hierarchical.direction === 'DU'; + + if (isVertical) { + this.direction = new VerticalStrategy(this); + } else { + this.direction = new HorizontalStrategy(this); + } + } + + /** + * Determine the center position of a branch from the passed list of child nodes + * + * This takes into account the positions of all the child nodes. + * @param {Array.} childNodes Array of either child nodes or node id's + * @return {number} + * @private + */ + + }, { + key: '_getCenterPosition', + value: function _getCenterPosition(childNodes) { + var minPos = 1e9; + var maxPos = -1e9; + + for (var i = 0; i < childNodes.length; i++) { + var childNode = void 0; + if (childNodes[i].id !== undefined) { + childNode = childNodes[i]; + } else { + var childNodeId = childNodes[i]; + childNode = this.body.nodes[childNodeId]; + } + + var position = this.direction.getPosition(childNode); + minPos = Math.min(minPos, position); + maxPos = Math.max(maxPos, position); + } + + return 0.5 * (minPos + maxPos); + } + }]); + return LayoutEngine; +}(); + +exports['default'] = LayoutEngine; + +/***/ }), +/* 236 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.VerticalStrategy = exports.HorizontalStrategy = undefined; + +var _getPrototypeOf = __webpack_require__(3); + +var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); + +var _possibleConstructorReturn2 = __webpack_require__(4); + +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + +var _inherits2 = __webpack_require__(5); + +var _inherits3 = _interopRequireDefault(_inherits2); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/** + * Helper classes for LayoutEngine. + * + * Strategy pattern for usage of direction methods for hierarchical layouts. + */ + +/** + * Interface definition for direction strategy classes. + * + * This class describes the interface for the Strategy + * pattern classes used to differentiate horizontal and vertical + * direction of hierarchical results. + * + * For a given direction, one coordinate will be 'fixed', meaning that it is + * determined by level. + * The other coordinate is 'unfixed', meaning that the nodes on a given level + * can still move along that coordinate. So: + * + * - `vertical` layout: `x` unfixed, `y` fixed per level + * - `horizontal` layout: `x` fixed per level, `y` unfixed + * + * The local methods are stubs and should be regarded as abstract. + * Derived classes **must** implement all the methods themselves. + * + * @private + */ +var DirectionInterface = function () { + function DirectionInterface() { + (0, _classCallCheck3['default'])(this, DirectionInterface); + } + + (0, _createClass3['default'])(DirectionInterface, [{ + key: 'abstract', + + /** @ignore **/ + value: function abstract() { + throw new Error("Can't instantiate abstract class!"); + } + + /** + * This is a dummy call which is used to suppress the jsdoc errors of type: + * + * "'param' is assigned a value but never used" + * + * @ignore + **/ + + }, { + key: 'fake_use', + value: function fake_use() {} + // Do nothing special + + + /** + * Type to use to translate dynamic curves to, in the case of hierarchical layout. + * Dynamic curves do not work for these. + * + * The value should be perpendicular to the actual direction of the layout. + * + * @return {string} Direction, either 'vertical' or 'horizontal' + */ + + }, { + key: 'curveType', + value: function curveType() { + return this.abstract(); + } + + /** + * Return the value of the coordinate that is not fixed for this direction. + * + * @param {Node} node The node to read + * @return {number} Value of the unfixed coordinate + */ + + }, { + key: 'getPosition', + value: function getPosition(node) { + this.fake_use(node);return this.abstract(); + } + + /** + * Set the value of the coordinate that is not fixed for this direction. + * + * @param {Node} node The node to adjust + * @param {number} position + * @param {number} [level] if specified, the hierarchy level that this node should be fixed to + */ + + }, { + key: 'setPosition', + value: function setPosition(node, position) { + var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + this.fake_use(node, position, level);this.abstract(); + } + + /** + * Get the width of a tree. + * + * A `tree` here is a subset of nodes within the network which are not connected to other nodes, + * only among themselves. In essence, it is a sub-network. + * + * @param {number} index The index number of a tree + * @return {number} the width of a tree in the view coordinates + */ + + }, { + key: 'getTreeSize', + value: function getTreeSize(index) { + this.fake_use(index);return this.abstract(); + } + + /** + * Sort array of nodes on the unfixed coordinates. + * + * @param {Array.} nodeArray array of nodes to sort + */ + + }, { + key: 'sort', + value: function sort(nodeArray) { + this.fake_use(nodeArray);this.abstract(); + } + + /** + * Assign the fixed coordinate of the node to the given level + * + * @param {Node} node The node to adjust + * @param {number} level The level to fix to + */ + + }, { + key: 'fix', + value: function fix(node, level) { + this.fake_use(node, level);this.abstract(); + } + + /** + * Add an offset to the unfixed coordinate of the given node. + * + * @param {NodeId} nodeId Id of the node to adjust + * @param {number} diff Offset to add to the unfixed coordinate + */ + + }, { + key: 'shift', + value: function shift(nodeId, diff) { + this.fake_use(nodeId, diff);this.abstract(); + } + }]); + return DirectionInterface; +}(); + +/** + * Vertical Strategy + * + * Coordinate `y` is fixed on levels, coordinate `x` is unfixed. + * + * @extends DirectionInterface + * @private + */ + + +var VerticalStrategy = function (_DirectionInterface) { + (0, _inherits3['default'])(VerticalStrategy, _DirectionInterface); + + /** + * Constructor + * + * @param {Object} layout reference to the parent LayoutEngine instance. + */ + function VerticalStrategy(layout) { + (0, _classCallCheck3['default'])(this, VerticalStrategy); + + var _this = (0, _possibleConstructorReturn3['default'])(this, (VerticalStrategy.__proto__ || (0, _getPrototypeOf2['default'])(VerticalStrategy)).call(this)); + + _this.layout = layout; + return _this; + } + + /** @inheritdoc */ + + + (0, _createClass3['default'])(VerticalStrategy, [{ + key: 'curveType', + value: function curveType() { + return 'horizontal'; + } + + /** @inheritdoc */ + + }, { + key: 'getPosition', + value: function getPosition(node) { + return node.x; + } + + /** @inheritdoc */ + + }, { + key: 'setPosition', + value: function setPosition(node, position) { + var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + + if (level !== undefined) { + this.layout.hierarchical.addToOrdering(node, level); + } + node.x = position; + } + + /** @inheritdoc */ + + }, { + key: 'getTreeSize', + value: function getTreeSize(index) { + var res = this.layout.hierarchical.getTreeSize(this.layout.body.nodes, index); + return { min: res.min_x, max: res.max_x }; + } + + /** @inheritdoc */ + + }, { + key: 'sort', + value: function sort(nodeArray) { + nodeArray.sort(function (a, b) { + // Test on 'undefined' takes care of divergent behaviour in chrome + if (a.x === undefined || b.x === undefined) return 0; // THIS HAPPENS + return a.x - b.x; + }); + } + + /** @inheritdoc */ + + }, { + key: 'fix', + value: function fix(node, level) { + node.y = this.layout.options.hierarchical.levelSeparation * level; + node.options.fixed.y = true; + } + + /** @inheritdoc */ + + }, { + key: 'shift', + value: function shift(nodeId, diff) { + this.layout.body.nodes[nodeId].x += diff; + } + }]); + return VerticalStrategy; +}(DirectionInterface); + +/** + * Horizontal Strategy + * + * Coordinate `x` is fixed on levels, coordinate `y` is unfixed. + * + * @extends DirectionInterface + * @private + */ + + +var HorizontalStrategy = function (_DirectionInterface2) { + (0, _inherits3['default'])(HorizontalStrategy, _DirectionInterface2); + + /** + * Constructor + * + * @param {Object} layout reference to the parent LayoutEngine instance. + */ + function HorizontalStrategy(layout) { + (0, _classCallCheck3['default'])(this, HorizontalStrategy); + + var _this2 = (0, _possibleConstructorReturn3['default'])(this, (HorizontalStrategy.__proto__ || (0, _getPrototypeOf2['default'])(HorizontalStrategy)).call(this)); + + _this2.layout = layout; + return _this2; + } + + /** @inheritdoc */ + + + (0, _createClass3['default'])(HorizontalStrategy, [{ + key: 'curveType', + value: function curveType() { + return 'vertical'; + } + + /** @inheritdoc */ + + }, { + key: 'getPosition', + value: function getPosition(node) { + return node.y; + } + + /** @inheritdoc */ + + }, { + key: 'setPosition', + value: function setPosition(node, position) { + var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + + if (level !== undefined) { + this.layout.hierarchical.addToOrdering(node, level); + } + node.y = position; + } + + /** @inheritdoc */ + + }, { + key: 'getTreeSize', + value: function getTreeSize(index) { + var res = this.layout.hierarchical.getTreeSize(this.layout.body.nodes, index); + return { min: res.min_y, max: res.max_y }; + } + + /** @inheritdoc */ + + }, { + key: 'sort', + value: function sort(nodeArray) { + nodeArray.sort(function (a, b) { + // Test on 'undefined' takes care of divergent behaviour in chrome + if (a.y === undefined || b.y === undefined) return 0; // THIS HAPPENS + return a.y - b.y; + }); + } + + /** @inheritdoc */ + + }, { + key: 'fix', + value: function fix(node, level) { + node.x = this.layout.options.hierarchical.levelSeparation * level; + node.options.fixed.x = true; + } + + /** @inheritdoc */ + + }, { + key: 'shift', + value: function shift(nodeId, diff) { + this.layout.body.nodes[nodeId].y += diff; + } + }]); + return HorizontalStrategy; +}(DirectionInterface); + +exports.HorizontalStrategy = HorizontalStrategy; +exports.VerticalStrategy = VerticalStrategy; + +/***/ }), +/* 237 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _keys = __webpack_require__(8); + +var _keys2 = _interopRequireDefault(_keys); + +var _stringify = __webpack_require__(19); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _typeof2 = __webpack_require__(6); + +var _typeof3 = _interopRequireDefault(_typeof2); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _createClass2 = __webpack_require__(1); + +var _createClass3 = _interopRequireDefault(_createClass2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var util = __webpack_require__(2); +var Hammer = __webpack_require__(10); +var hammerUtil = __webpack_require__(37); + +/** + * Clears the toolbar div element of children + * + * @private + */ + +var ManipulationSystem = function () { + /** + * @param {Object} body + * @param {Canvas} canvas + * @param {SelectionHandler} selectionHandler + */ + function ManipulationSystem(body, canvas, selectionHandler) { + var _this = this; + + (0, _classCallCheck3['default'])(this, ManipulationSystem); + + this.body = body; + this.canvas = canvas; + this.selectionHandler = selectionHandler; + + this.editMode = false; + this.manipulationDiv = undefined; + this.editModeDiv = undefined; + this.closeDiv = undefined; + + this.manipulationHammers = []; + this.temporaryUIFunctions = {}; + this.temporaryEventFunctions = []; + + this.touchTime = 0; + this.temporaryIds = { nodes: [], edges: [] }; + this.guiEnabled = false; + this.inMode = false; + this.selectedControlNode = undefined; + + this.options = {}; + this.defaultOptions = { + enabled: false, + initiallyActive: false, + addNode: true, + addEdge: true, + editNode: undefined, + editEdge: true, + deleteNode: true, + deleteEdge: true, + controlNodeStyle: { + shape: 'dot', + size: 6, + color: { background: '#ff0000', border: '#3c3c3c', highlight: { background: '#07f968', border: '#3c3c3c' } }, + borderWidth: 2, + borderWidthSelected: 2 + } + }; + util.extend(this.options, this.defaultOptions); + + this.body.emitter.on('destroy', function () { + _this._clean(); + }); + this.body.emitter.on('_dataChanged', this._restore.bind(this)); + this.body.emitter.on('_resetData', this._restore.bind(this)); + } + + /** + * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes. + * @private + */ + + + (0, _createClass3['default'])(ManipulationSystem, [{ + key: '_restore', + value: function _restore() { + if (this.inMode !== false) { + if (this.options.initiallyActive === true) { + this.enableEditMode(); + } else { + this.disableEditMode(); + } + } + } + + /** + * Set the Options + * + * @param {Object} options + * @param {Object} allOptions + * @param {Object} globalOptions + */ + + }, { + key: 'setOptions', + value: function setOptions(options, allOptions, globalOptions) { + if (allOptions !== undefined) { + if (allOptions.locale !== undefined) { + this.options.locale = allOptions.locale; + } else { + this.options.locale = globalOptions.locale; + } + if (allOptions.locales !== undefined) { + this.options.locales = allOptions.locales; + } else { + this.options.locales = globalOptions.locales; + } + } + + if (options !== undefined) { + if (typeof options === 'boolean') { + this.options.enabled = options; + } else { + this.options.enabled = true; + util.deepExtend(this.options, options); + } + if (this.options.initiallyActive === true) { + this.editMode = true; + } + this._setup(); + } + } + + /** + * Enable or disable edit-mode. Draws the DOM required and cleans up after itself. + * + * @private + */ + + }, { + key: 'toggleEditMode', + value: function toggleEditMode() { + if (this.editMode === true) { + this.disableEditMode(); + } else { + this.enableEditMode(); + } + } + + /** + * Enables Edit Mode + */ + + }, { + key: 'enableEditMode', + value: function enableEditMode() { + this.editMode = true; + + this._clean(); + if (this.guiEnabled === true) { + this.manipulationDiv.style.display = 'block'; + this.closeDiv.style.display = 'block'; + this.editModeDiv.style.display = 'none'; + this.showManipulatorToolbar(); + } + } + + /** + * Disables Edit Mode + */ + + }, { + key: 'disableEditMode', + value: function disableEditMode() { + this.editMode = false; + + this._clean(); + if (this.guiEnabled === true) { + this.manipulationDiv.style.display = 'none'; + this.closeDiv.style.display = 'none'; + this.editModeDiv.style.display = 'block'; + this._createEditButton(); + } + } + + /** + * Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. + * + * @private + */ + + }, { + key: 'showManipulatorToolbar', + value: function showManipulatorToolbar() { + // restore the state of any bound functions or events, remove control nodes, restore physics + this._clean(); + + // reset global variables + this.manipulationDOM = {}; + + // if the gui is enabled, draw all elements. + if (this.guiEnabled === true) { + // a _restore will hide these menus + this.editMode = true; + this.manipulationDiv.style.display = 'block'; + this.closeDiv.style.display = 'block'; + + var selectedNodeCount = this.selectionHandler._getSelectedNodeCount(); + var selectedEdgeCount = this.selectionHandler._getSelectedEdgeCount(); + var selectedTotalCount = selectedNodeCount + selectedEdgeCount; + var locale = this.options.locales[this.options.locale]; + var needSeperator = false; + + if (this.options.addNode !== false) { + this._createAddNodeButton(locale); + needSeperator = true; + } + if (this.options.addEdge !== false) { + if (needSeperator === true) { + this._createSeperator(1); + } else { + needSeperator = true; + } + this._createAddEdgeButton(locale); + } + + if (selectedNodeCount === 1 && typeof this.options.editNode === 'function') { + if (needSeperator === true) { + this._createSeperator(2); + } else { + needSeperator = true; + } + this._createEditNodeButton(locale); + } else if (selectedEdgeCount === 1 && selectedNodeCount === 0 && this.options.editEdge !== false) { + if (needSeperator === true) { + this._createSeperator(3); + } else { + needSeperator = true; + } + this._createEditEdgeButton(locale); + } + + // remove buttons + if (selectedTotalCount !== 0) { + if (selectedNodeCount > 0 && this.options.deleteNode !== false) { + if (needSeperator === true) { + this._createSeperator(4); + } + this._createDeleteButton(locale); + } else if (selectedNodeCount === 0 && this.options.deleteEdge !== false) { + if (needSeperator === true) { + this._createSeperator(4); + } + this._createDeleteButton(locale); + } + } + + // bind the close button + this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); + + // refresh this bar based on what has been selected + this._temporaryBindEvent('select', this.showManipulatorToolbar.bind(this)); + } + + // redraw to show any possible changes + this.body.emitter.emit('_redraw'); + } + + /** + * Create the toolbar for adding Nodes + */ + + }, { + key: 'addNodeMode', + value: function addNodeMode() { + // when using the gui, enable edit mode if it wasnt already. + if (this.editMode !== true) { + this.enableEditMode(); + } + + // restore the state of any bound functions or events, remove control nodes, restore physics + this._clean(); + + this.inMode = 'addNode'; + if (this.guiEnabled === true) { + var locale = this.options.locales[this.options.locale]; + this.manipulationDOM = {}; + this._createBackButton(locale); + this._createSeperator(); + this._createDescription(locale['addDescription'] || this.options.locales['en']['addDescription']); + + // bind the close button + this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); + } + + this._temporaryBindEvent('click', this._performAddNode.bind(this)); + } + + /** + * call the bound function to handle the editing of the node. The node has to be selected. + */ + + }, { + key: 'editNode', + value: function editNode() { + var _this2 = this; + + // when using the gui, enable edit mode if it wasnt already. + if (this.editMode !== true) { + this.enableEditMode(); + } + + // restore the state of any bound functions or events, remove control nodes, restore physics + this._clean(); + var node = this.selectionHandler._getSelectedNode(); + if (node !== undefined) { + this.inMode = 'editNode'; + if (typeof this.options.editNode === 'function') { + if (node.isCluster !== true) { + var data = util.deepExtend({}, node.options, false); + data.x = node.x; + data.y = node.y; + + if (this.options.editNode.length === 2) { + this.options.editNode(data, function (finalizedData) { + if (finalizedData !== null && finalizedData !== undefined && _this2.inMode === 'editNode') { + // if for whatever reason the mode has changes (due to dataset change) disregard the callback) { + _this2.body.data.nodes.getDataSet().update(finalizedData); + } + _this2.showManipulatorToolbar(); + }); + } else { + throw new Error('The function for edit does not support two arguments (data, callback)'); + } + } else { + alert(this.options.locales[this.options.locale]['editClusterError'] || this.options.locales['en']['editClusterError']); + } + } else { + throw new Error('No function has been configured to handle the editing of nodes.'); + } + } else { + this.showManipulatorToolbar(); + } + } + + /** + * create the toolbar to connect nodes + */ + + }, { + key: 'addEdgeMode', + value: function addEdgeMode() { + // when using the gui, enable edit mode if it wasnt already. + if (this.editMode !== true) { + this.enableEditMode(); + } + + // restore the state of any bound functions or events, remove control nodes, restore physics + this._clean(); + + this.inMode = 'addEdge'; + if (this.guiEnabled === true) { + var locale = this.options.locales[this.options.locale]; + this.manipulationDOM = {}; + this._createBackButton(locale); + this._createSeperator(); + this._createDescription(locale['edgeDescription'] || this.options.locales['en']['edgeDescription']); + + // bind the close button + this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); + } + + // temporarily overload functions + this._temporaryBindUI('onTouch', this._handleConnect.bind(this)); + this._temporaryBindUI('onDragEnd', this._finishConnect.bind(this)); + this._temporaryBindUI('onDrag', this._dragControlNode.bind(this)); + this._temporaryBindUI('onRelease', this._finishConnect.bind(this)); + this._temporaryBindUI('onDragStart', this._dragStartEdge.bind(this)); + this._temporaryBindUI('onHold', function () {}); + } + + /** + * create the toolbar to edit edges + */ + + }, { + key: 'editEdgeMode', + value: function editEdgeMode() { + // when using the gui, enable edit mode if it wasn't already. + if (this.editMode !== true) { + this.enableEditMode(); + } + + // restore the state of any bound functions or events, remove control nodes, restore physics + this._clean(); + + this.inMode = 'editEdge'; + if ((0, _typeof3['default'])(this.options.editEdge) === 'object' && typeof this.options.editEdge.editWithoutDrag === "function") { + this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0]; + if (this.edgeBeingEditedId !== undefined) { + var edge = this.body.edges[this.edgeBeingEditedId]; + this._performEditEdge(edge.from, edge.to); + return; + } + } + if (this.guiEnabled === true) { + var locale = this.options.locales[this.options.locale]; + this.manipulationDOM = {}; + this._createBackButton(locale); + this._createSeperator(); + this._createDescription(locale['editEdgeDescription'] || this.options.locales['en']['editEdgeDescription']); + + // bind the close button + this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)); + } + + this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0]; + if (this.edgeBeingEditedId !== undefined) { + var _edge = this.body.edges[this.edgeBeingEditedId]; + + // create control nodes + var controlNodeFrom = this._getNewTargetNode(_edge.from.x, _edge.from.y); + var controlNodeTo = this._getNewTargetNode(_edge.to.x, _edge.to.y); + + this.temporaryIds.nodes.push(controlNodeFrom.id); + this.temporaryIds.nodes.push(controlNodeTo.id); + + this.body.nodes[controlNodeFrom.id] = controlNodeFrom; + this.body.nodeIndices.push(controlNodeFrom.id); + this.body.nodes[controlNodeTo.id] = controlNodeTo; + this.body.nodeIndices.push(controlNodeTo.id); + + // temporarily overload UI functions, cleaned up automatically because of _temporaryBindUI + this._temporaryBindUI('onTouch', this._controlNodeTouch.bind(this)); // used to get the position + this._temporaryBindUI('onTap', function () {}); // disabled + this._temporaryBindUI('onHold', function () {}); // disabled + this._temporaryBindUI('onDragStart', this._controlNodeDragStart.bind(this)); // used to select control node + this._temporaryBindUI('onDrag', this._controlNodeDrag.bind(this)); // used to drag control node + this._temporaryBindUI('onDragEnd', this._controlNodeDragEnd.bind(this)); // used to connect or revert control nodes + this._temporaryBindUI('onMouseMove', function () {}); // disabled + + // create function to position control nodes correctly on movement + // automatically cleaned up because we use the temporary bind + this._temporaryBindEvent('beforeDrawing', function (ctx) { + var positions = _edge.edgeType.findBorderPositions(ctx); + if (controlNodeFrom.selected === false) { + controlNodeFrom.x = positions.from.x; + controlNodeFrom.y = positions.from.y; + } + if (controlNodeTo.selected === false) { + controlNodeTo.x = positions.to.x; + controlNodeTo.y = positions.to.y; + } + }); + + this.body.emitter.emit('_redraw'); + } else { + this.showManipulatorToolbar(); + } + } + + /** + * delete everything in the selection + */ + + }, { + key: 'deleteSelected', + value: function deleteSelected() { + var _this3 = this; + + // when using the gui, enable edit mode if it wasnt already. + if (this.editMode !== true) { + this.enableEditMode(); + } + + // restore the state of any bound functions or events, remove control nodes, restore physics + this._clean(); + + this.inMode = 'delete'; + var selectedNodes = this.selectionHandler.getSelectedNodes(); + var selectedEdges = this.selectionHandler.getSelectedEdges(); + var deleteFunction = undefined; + if (selectedNodes.length > 0) { + for (var i = 0; i < selectedNodes.length; i++) { + if (this.body.nodes[selectedNodes[i]].isCluster === true) { + alert(this.options.locales[this.options.locale]['deleteClusterError'] || this.options.locales['en']['deleteClusterError']); + return; + } + } + + if (typeof this.options.deleteNode === 'function') { + deleteFunction = this.options.deleteNode; + } + } else if (selectedEdges.length > 0) { + if (typeof this.options.deleteEdge === 'function') { + deleteFunction = this.options.deleteEdge; + } + } + + if (typeof deleteFunction === 'function') { + var data = { nodes: selectedNodes, edges: selectedEdges }; + if (deleteFunction.length === 2) { + deleteFunction(data, function (finalizedData) { + if (finalizedData !== null && finalizedData !== undefined && _this3.inMode === 'delete') { + // if for whatever reason the mode has changes (due to dataset change) disregard the callback) { + _this3.body.data.edges.getDataSet().remove(finalizedData.edges); + _this3.body.data.nodes.getDataSet().remove(finalizedData.nodes); + _this3.body.emitter.emit('startSimulation'); + _this3.showManipulatorToolbar(); + } else { + _this3.body.emitter.emit('startSimulation'); + _this3.showManipulatorToolbar(); + } + }); + } else { + throw new Error('The function for delete does not support two arguments (data, callback)'); + } + } else { + this.body.data.edges.getDataSet().remove(selectedEdges); + this.body.data.nodes.getDataSet().remove(selectedNodes); + this.body.emitter.emit('startSimulation'); + this.showManipulatorToolbar(); + } + } + + //********************************************** PRIVATE ***************************************// + + /** + * draw or remove the DOM + * @private + */ + + }, { + key: '_setup', + value: function _setup() { + if (this.options.enabled === true) { + // Enable the GUI + this.guiEnabled = true; + + this._createWrappers(); + if (this.editMode === false) { + this._createEditButton(); + } else { + this.showManipulatorToolbar(); + } + } else { + this._removeManipulationDOM(); + + // disable the gui + this.guiEnabled = false; + } + } + + /** + * create the div overlays that contain the DOM + * @private + */ + + }, { + key: '_createWrappers', + value: function _createWrappers() { + // load the manipulator HTML elements. All styling done in css. + if (this.manipulationDiv === undefined) { + this.manipulationDiv = document.createElement('div'); + this.manipulationDiv.className = 'vis-manipulation'; + if (this.editMode === true) { + this.manipulationDiv.style.display = 'block'; + } else { + this.manipulationDiv.style.display = 'none'; + } + this.canvas.frame.appendChild(this.manipulationDiv); + } + + // container for the edit button. + if (this.editModeDiv === undefined) { + this.editModeDiv = document.createElement('div'); + this.editModeDiv.className = 'vis-edit-mode'; + if (this.editMode === true) { + this.editModeDiv.style.display = 'none'; + } else { + this.editModeDiv.style.display = 'block'; + } + this.canvas.frame.appendChild(this.editModeDiv); + } + + // container for the close div button + if (this.closeDiv === undefined) { + this.closeDiv = document.createElement('div'); + this.closeDiv.className = 'vis-close'; + this.closeDiv.style.display = this.manipulationDiv.style.display; + this.canvas.frame.appendChild(this.closeDiv); + } + } + + /** + * generate a new target node. Used for creating new edges and editing edges + * + * @param {number} x + * @param {number} y + * @returns {Node} + * @private + */ + + }, { + key: '_getNewTargetNode', + value: function _getNewTargetNode(x, y) { + var controlNodeStyle = util.deepExtend({}, this.options.controlNodeStyle); + + controlNodeStyle.id = 'targetNode' + util.randomUUID(); + controlNodeStyle.hidden = false; + controlNodeStyle.physics = false; + controlNodeStyle.x = x; + controlNodeStyle.y = y; + + // we have to define the bounding box in order for the nodes to be drawn immediately + var node = this.body.functions.createNode(controlNodeStyle); + node.shape.boundingBox = { left: x, right: x, top: y, bottom: y }; + + return node; + } + + /** + * Create the edit button + */ + + }, { + key: '_createEditButton', + value: function _createEditButton() { + // restore everything to it's original state (if applicable) + this._clean(); + + // reset the manipulationDOM + this.manipulationDOM = {}; + + // empty the editModeDiv + util.recursiveDOMDelete(this.editModeDiv); + + // create the contents for the editMode button + var locale = this.options.locales[this.options.locale]; + var button = this._createButton('editMode', 'vis-button vis-edit vis-edit-mode', locale['edit'] || this.options.locales['en']['edit']); + this.editModeDiv.appendChild(button); + + // bind a hammer listener to the button, calling the function toggleEditMode. + this._bindHammerToDiv(button, this.toggleEditMode.bind(this)); + } + + /** + * this function cleans up after everything this module does. Temporary elements, functions and events are removed, physics restored, hammers removed. + * @private + */ + + }, { + key: '_clean', + value: function _clean() { + // not in mode + this.inMode = false; + + // _clean the divs + if (this.guiEnabled === true) { + util.recursiveDOMDelete(this.editModeDiv); + util.recursiveDOMDelete(this.manipulationDiv); + + // removes all the bindings and overloads + this._cleanManipulatorHammers(); + } + + // remove temporary nodes and edges + this._cleanupTemporaryNodesAndEdges(); + + // restore overloaded UI functions + this._unbindTemporaryUIs(); + + // remove the temporaryEventFunctions + this._unbindTemporaryEvents(); + + // restore the physics if required + this.body.emitter.emit('restorePhysics'); + } + + /** + * Each dom element has it's own hammer. They are stored in this.manipulationHammers. This cleans them up. + * @private + */ + + }, { + key: '_cleanManipulatorHammers', + value: function _cleanManipulatorHammers() { + // _clean hammer bindings + if (this.manipulationHammers.length != 0) { + for (var i = 0; i < this.manipulationHammers.length; i++) { + this.manipulationHammers[i].destroy(); + } + this.manipulationHammers = []; + } + } + + /** + * Remove all DOM elements created by this module. + * @private + */ + + }, { + key: '_removeManipulationDOM', + value: function _removeManipulationDOM() { + // removes all the bindings and overloads + this._clean(); + + // empty the manipulation divs + util.recursiveDOMDelete(this.manipulationDiv); + util.recursiveDOMDelete(this.editModeDiv); + util.recursiveDOMDelete(this.closeDiv); + + // remove the manipulation divs + if (this.manipulationDiv) { + this.canvas.frame.removeChild(this.manipulationDiv); + } + if (this.editModeDiv) { + this.canvas.frame.removeChild(this.editModeDiv); + } + if (this.closeDiv) { + this.canvas.frame.removeChild(this.closeDiv); + } + + // set the references to undefined + this.manipulationDiv = undefined; + this.editModeDiv = undefined; + this.closeDiv = undefined; + } + + /** + * create a seperator line. the index is to differentiate in the manipulation dom + * @param {number} [index=1] + * @private + */ + + }, { + key: '_createSeperator', + value: function _createSeperator() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; + + this.manipulationDOM['seperatorLineDiv' + index] = document.createElement('div'); + this.manipulationDOM['seperatorLineDiv' + index].className = 'vis-separator-line'; + this.manipulationDiv.appendChild(this.manipulationDOM['seperatorLineDiv' + index]); + } + + // ---------------------- DOM functions for buttons --------------------------// + + /** + * + * @param {Locale} locale + * @private + */ + + }, { + key: '_createAddNodeButton', + value: function _createAddNodeButton(locale) { + var button = this._createButton('addNode', 'vis-button vis-add', locale['addNode'] || this.options.locales['en']['addNode']); + this.manipulationDiv.appendChild(button); + this._bindHammerToDiv(button, this.addNodeMode.bind(this)); + } + + /** + * + * @param {Locale} locale + * @private + */ + + }, { + key: '_createAddEdgeButton', + value: function _createAddEdgeButton(locale) { + var button = this._createButton('addEdge', 'vis-button vis-connect', locale['addEdge'] || this.options.locales['en']['addEdge']); + this.manipulationDiv.appendChild(button); + this._bindHammerToDiv(button, this.addEdgeMode.bind(this)); + } + + /** + * + * @param {Locale} locale + * @private + */ + + }, { + key: '_createEditNodeButton', + value: function _createEditNodeButton(locale) { + var button = this._createButton('editNode', 'vis-button vis-edit', locale['editNode'] || this.options.locales['en']['editNode']); + this.manipulationDiv.appendChild(button); + this._bindHammerToDiv(button, this.editNode.bind(this)); + } + + /** + * + * @param {Locale} locale + * @private + */ + + }, { + key: '_createEditEdgeButton', + value: function _createEditEdgeButton(locale) { + var button = this._createButton('editEdge', 'vis-button vis-edit', locale['editEdge'] || this.options.locales['en']['editEdge']); + this.manipulationDiv.appendChild(button); + this._bindHammerToDiv(button, this.editEdgeMode.bind(this)); + } + + /** + * + * @param {Locale} locale + * @private + */ + + }, { + key: '_createDeleteButton', + value: function _createDeleteButton(locale) { + var deleteBtnClass; + if (this.options.rtl) { + deleteBtnClass = 'vis-button vis-delete-rtl'; + } else { + deleteBtnClass = 'vis-button vis-delete'; + } + var button = this._createButton('delete', deleteBtnClass, locale['del'] || this.options.locales['en']['del']); + this.manipulationDiv.appendChild(button); + this._bindHammerToDiv(button, this.deleteSelected.bind(this)); + } + + /** + * + * @param {Locale} locale + * @private + */ + + }, { + key: '_createBackButton', + value: function _createBackButton(locale) { + var button = this._createButton('back', 'vis-button vis-back', locale['back'] || this.options.locales['en']['back']); + this.manipulationDiv.appendChild(button); + this._bindHammerToDiv(button, this.showManipulatorToolbar.bind(this)); + } + + /** + * + * @param {number|string} id + * @param {string} className + * @param {label} label + * @param {string} labelClassName + * @returns {HTMLElement} + * @private + */ + + }, { + key: '_createButton', + value: function _createButton(id, className, label) { + var labelClassName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'vis-label'; + + + this.manipulationDOM[id + 'Div'] = document.createElement('div'); + this.manipulationDOM[id + 'Div'].className = className; + this.manipulationDOM[id + 'Label'] = document.createElement('div'); + this.manipulationDOM[id + 'Label'].className = labelClassName; + this.manipulationDOM[id + 'Label'].innerHTML = label; + this.manipulationDOM[id + 'Div'].appendChild(this.manipulationDOM[id + 'Label']); + return this.manipulationDOM[id + 'Div']; + } + + /** + * + * @param {Label} label + * @private + */ + + }, { + key: '_createDescription', + value: function _createDescription(label) { + this.manipulationDiv.appendChild(this._createButton('description', 'vis-button vis-none', label)); + } + + // -------------------------- End of DOM functions for buttons ------------------------------// + + /** + * this binds an event until cleanup by the clean functions. + * @param {Event} event The event + * @param {function} newFunction + * @private + */ + + }, { + key: '_temporaryBindEvent', + value: function _temporaryBindEvent(event, newFunction) { + this.temporaryEventFunctions.push({ event: event, boundFunction: newFunction }); + this.body.emitter.on(event, newFunction); + } + + /** + * this overrides an UI function until cleanup by the clean function + * @param {string} UIfunctionName + * @param {function} newFunction + * @private + */ + + }, { + key: '_temporaryBindUI', + value: function _temporaryBindUI(UIfunctionName, newFunction) { + if (this.body.eventListeners[UIfunctionName] !== undefined) { + this.temporaryUIFunctions[UIfunctionName] = this.body.eventListeners[UIfunctionName]; + this.body.eventListeners[UIfunctionName] = newFunction; + } else { + throw new Error('This UI function does not exist. Typo? You tried: ' + UIfunctionName + ' possible are: ' + (0, _stringify2['default'])((0, _keys2['default'])(this.body.eventListeners))); + } + } + + /** + * Restore the overridden UI functions to their original state. + * + * @private + */ + + }, { + key: '_unbindTemporaryUIs', + value: function _unbindTemporaryUIs() { + for (var functionName in this.temporaryUIFunctions) { + if (this.temporaryUIFunctions.hasOwnProperty(functionName)) { + this.body.eventListeners[functionName] = this.temporaryUIFunctions[functionName]; + delete this.temporaryUIFunctions[functionName]; + } + } + this.temporaryUIFunctions = {}; + } + + /** + * Unbind the events created by _temporaryBindEvent + * @private + */ + + }, { + key: '_unbindTemporaryEvents', + value: function _unbindTemporaryEvents() { + for (var i = 0; i < this.temporaryEventFunctions.length; i++) { + var eventName = this.temporaryEventFunctions[i].event; + var boundFunction = this.temporaryEventFunctions[i].boundFunction; + this.body.emitter.off(eventName, boundFunction); + } + this.temporaryEventFunctions = []; + } + + /** + * Bind an hammer instance to a DOM element. + * + * @param {Element} domElement + * @param {function} boundFunction + */ + + }, { + key: '_bindHammerToDiv', + value: function _bindHammerToDiv(domElement, boundFunction) { + var hammer = new Hammer(domElement, {}); + hammerUtil.onTouch(hammer, boundFunction); + this.manipulationHammers.push(hammer); + } + + /** + * Neatly clean up temporary edges and nodes + * @private + */ + + }, { + key: '_cleanupTemporaryNodesAndEdges', + value: function _cleanupTemporaryNodesAndEdges() { + // _clean temporary edges + for (var i = 0; i < this.temporaryIds.edges.length; i++) { + this.body.edges[this.temporaryIds.edges[i]].disconnect(); + delete this.body.edges[this.temporaryIds.edges[i]]; + var indexTempEdge = this.body.edgeIndices.indexOf(this.temporaryIds.edges[i]); + if (indexTempEdge !== -1) { + this.body.edgeIndices.splice(indexTempEdge, 1); + } + } + + // _clean temporary nodes + for (var _i = 0; _i < this.temporaryIds.nodes.length; _i++) { + delete this.body.nodes[this.temporaryIds.nodes[_i]]; + var indexTempNode = this.body.nodeIndices.indexOf(this.temporaryIds.nodes[_i]); + if (indexTempNode !== -1) { + this.body.nodeIndices.splice(indexTempNode, 1); + } + } + + this.temporaryIds = { nodes: [], edges: [] }; + } + + // ------------------------------------------ EDIT EDGE FUNCTIONS -----------------------------------------// + + /** + * the touch is used to get the position of the initial click + * @param {Event} event The event + * @private + */ + + }, { + key: '_controlNodeTouch', + value: function _controlNodeTouch(event) { + this.selectionHandler.unselectAll(); + this.lastTouch = this.body.functions.getPointer(event.center); + this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object + } + + /** + * the drag start is used to mark one of the control nodes as selected. + * @param {Event} event The event + * @private + */ + + }, { + key: '_controlNodeDragStart', + value: function _controlNodeDragStart(event) { + // eslint-disable-line no-unused-vars + var pointer = this.lastTouch; + var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); + var from = this.body.nodes[this.temporaryIds.nodes[0]]; + var to = this.body.nodes[this.temporaryIds.nodes[1]]; + var edge = this.body.edges[this.edgeBeingEditedId]; + this.selectedControlNode = undefined; + + var fromSelect = from.isOverlappingWith(pointerObj); + var toSelect = to.isOverlappingWith(pointerObj); + + if (fromSelect === true) { + this.selectedControlNode = from; + edge.edgeType.from = from; + } else if (toSelect === true) { + this.selectedControlNode = to; + edge.edgeType.to = to; + } + + // we use the selection to find the node that is being dragged. We explicitly select it here. + if (this.selectedControlNode !== undefined) { + this.selectionHandler.selectObject(this.selectedControlNode); + } + + this.body.emitter.emit('_redraw'); + } + + /** + * dragging the control nodes or the canvas + * @param {Event} event The event + * @private + */ + + }, { + key: '_controlNodeDrag', + value: function _controlNodeDrag(event) { + this.body.emitter.emit('disablePhysics'); + var pointer = this.body.functions.getPointer(event.center); + var pos = this.canvas.DOMtoCanvas(pointer); + if (this.selectedControlNode !== undefined) { + this.selectedControlNode.x = pos.x; + this.selectedControlNode.y = pos.y; + } else { + // if the drag was not started properly because the click started outside the network div, start it now. + var diffX = pointer.x - this.lastTouch.x; + var diffY = pointer.y - this.lastTouch.y; + this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY }; + } + this.body.emitter.emit('_redraw'); + } + + /** + * connecting or restoring the control nodes. + * @param {Event} event The event + * @private + */ + + }, { + key: '_controlNodeDragEnd', + value: function _controlNodeDragEnd(event) { + var pointer = this.body.functions.getPointer(event.center); + var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); + var edge = this.body.edges[this.edgeBeingEditedId]; + // if the node that was dragged is not a control node, return + if (this.selectedControlNode === undefined) { + return; + } + + // we use the selection to find the node that is being dragged. We explicitly DEselect the control node here. + this.selectionHandler.unselectAll(); + var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); + var node = undefined; + for (var i = overlappingNodeIds.length - 1; i >= 0; i--) { + if (overlappingNodeIds[i] !== this.selectedControlNode.id) { + node = this.body.nodes[overlappingNodeIds[i]]; + break; + } + } + // perform the connection + if (node !== undefined && this.selectedControlNode !== undefined) { + if (node.isCluster === true) { + alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']); + } else { + var from = this.body.nodes[this.temporaryIds.nodes[0]]; + if (this.selectedControlNode.id === from.id) { + this._performEditEdge(node.id, edge.to.id); + } else { + this._performEditEdge(edge.from.id, node.id); + } + } + } else { + edge.updateEdgeType(); + this.body.emitter.emit('restorePhysics'); + } + + this.body.emitter.emit('_redraw'); + } + + // ------------------------------------ END OF EDIT EDGE FUNCTIONS -----------------------------------------// + + + // ------------------------------------------- ADD EDGE FUNCTIONS -----------------------------------------// + /** + * the function bound to the selection event. It checks if you want to connect a cluster and changes the description + * to walk the user through the process. + * + * @param {Event} event + * @private + */ + + }, { + key: '_handleConnect', + value: function _handleConnect(event) { + // check to avoid double fireing of this function. + if (new Date().valueOf() - this.touchTime > 100) { + this.lastTouch = this.body.functions.getPointer(event.center); + this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object + + var pointer = this.lastTouch; + var node = this.selectionHandler.getNodeAt(pointer); + + if (node !== undefined) { + if (node.isCluster === true) { + alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']); + } else { + // create a node the temporary line can look at + var targetNode = this._getNewTargetNode(node.x, node.y); + this.body.nodes[targetNode.id] = targetNode; + this.body.nodeIndices.push(targetNode.id); + + // create a temporary edge + var connectionEdge = this.body.functions.createEdge({ + id: 'connectionEdge' + util.randomUUID(), + from: node.id, + to: targetNode.id, + physics: false, + smooth: { + enabled: true, + type: 'continuous', + roundness: 0.5 + } + }); + this.body.edges[connectionEdge.id] = connectionEdge; + this.body.edgeIndices.push(connectionEdge.id); + + this.temporaryIds.nodes.push(targetNode.id); + this.temporaryIds.edges.push(connectionEdge.id); + } } - }, - selectionWidth: [1.5, 0, 5, 0.1], - selfReferenceSize: [20, 0, 200, 1], - shadow: { - enabled: false, - color: 'rgba(0,0,0,0.5)', - size: [10, 0, 20, 1], - x: [5, -30, 30, 1], - y: [5, -30, 30, 1] - }, - smooth: { - enabled: true, - type: ['dynamic', 'continuous', 'discrete', 'diagonalCross', 'straightCross', 'horizontal', 'vertical', 'curvedCW', 'curvedCCW', 'cubicBezier'], - forceDirection: ['horizontal', 'vertical', 'none'], - roundness: [0.5, 0, 1, 0.05] - }, - width: [1, 0, 30, 1] - }, - layout: { - //randomSeed: [0, 0, 500, 1], - //improvedLayout: true, - hierarchical: { - enabled: false, - levelSeparation: [150, 20, 500, 5], - nodeSpacing: [100, 20, 500, 5], - treeSpacing: [200, 20, 500, 5], - blockShifting: true, - edgeMinimization: true, - parentCentralization: true, - direction: ['UD', 'DU', 'LR', 'RL'], // UD, DU, LR, RL - sortMethod: ['hubsize', 'directed'] // hubsize, directed + this.touchTime = new Date().valueOf(); } - }, - interaction: { - dragNodes: true, - dragView: true, - hideEdgesOnDrag: false, - hideNodesOnDrag: false, - hover: false, - keyboard: { - enabled: false, - speed: { x: [10, 0, 40, 1], y: [10, 0, 40, 1], zoom: [0.02, 0, 0.1, 0.005] }, - bindToWindow: true - }, - multiselect: false, - navigationButtons: false, - selectable: true, - selectConnectedEdges: true, - hoverConnectedEdges: true, - tooltipDelay: [300, 0, 1000, 25], - zoomView: true - }, - manipulation: { - enabled: false, - initiallyActive: false - }, - physics: { - enabled: true, - barnesHut: { - //theta: [0.5, 0.1, 1, 0.05], - gravitationalConstant: [-2000, -30000, 0, 50], - centralGravity: [0.3, 0, 10, 0.05], - springLength: [95, 0, 500, 5], - springConstant: [0.04, 0, 1.2, 0.005], - damping: [0.09, 0, 1, 0.01], - avoidOverlap: [0, 0, 1, 0.01] - }, - forceAtlas2Based: { - //theta: [0.5, 0.1, 1, 0.05], - gravitationalConstant: [-50, -500, 0, 1], - centralGravity: [0.01, 0, 1, 0.005], - springLength: [95, 0, 500, 5], - springConstant: [0.08, 0, 1.2, 0.005], - damping: [0.4, 0, 1, 0.01], - avoidOverlap: [0, 0, 1, 0.01] - }, - repulsion: { - centralGravity: [0.2, 0, 10, 0.05], - springLength: [200, 0, 500, 5], - springConstant: [0.05, 0, 1.2, 0.005], - nodeDistance: [100, 0, 500, 5], - damping: [0.09, 0, 1, 0.01] - }, - hierarchicalRepulsion: { - centralGravity: [0.2, 0, 10, 0.05], - springLength: [100, 0, 500, 5], - springConstant: [0.01, 0, 1.2, 0.005], - nodeDistance: [120, 0, 500, 5], - damping: [0.09, 0, 1, 0.01] - }, - maxVelocity: [50, 0, 150, 1], - minVelocity: [0.1, 0.01, 0.5, 0.01], - solver: ['barnesHut', 'forceAtlas2Based', 'repulsion', 'hierarchicalRepulsion'], - timestep: [0.5, 0.01, 1, 0.01] - //adaptiveTimestep: true } - }; - exports.allOptions = allOptions; - exports.configureOptions = configureOptions; + /** + * + * @param {Event} event + * @private + */ -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { + }, { + key: '_dragControlNode', + value: function _dragControlNode(event) { + var pointer = this.body.functions.getPointer(event.center); + if (this.temporaryIds.nodes[0] !== undefined) { + var targetNode = this.body.nodes[this.temporaryIds.nodes[0]]; // there is only one temp node in the add edge mode. + targetNode.x = this.canvas._XconvertDOMtoCanvas(pointer.x); + targetNode.y = this.canvas._YconvertDOMtoCanvas(pointer.y); + this.body.emitter.emit('_redraw'); + } else { + var diffX = pointer.x - this.lastTouch.x; + var diffY = pointer.y - this.lastTouch.y; + this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY }; + } + } - "use strict"; + /** + * Connect the new edge to the target if one exists, otherwise remove temp line + * @param {Event} event The event + * @private + */ - Object.defineProperty(exports, "__esModule", { - value: true - }); + }, { + key: '_finishConnect', + value: function _finishConnect(event) { + var pointer = this.body.functions.getPointer(event.center); + var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); + + // remember the edge id + var connectFromId = undefined; + if (this.temporaryIds.edges[0] !== undefined) { + connectFromId = this.body.edges[this.temporaryIds.edges[0]].fromId; + } + + // get the overlapping node but NOT the temporary node; + var overlappingNodeIds = this.selectionHandler._getAllNodesOverlappingWith(pointerObj); + var node = undefined; + for (var i = overlappingNodeIds.length - 1; i >= 0; i--) { + // if the node id is NOT a temporary node, accept the node. + if (this.temporaryIds.nodes.indexOf(overlappingNodeIds[i]) === -1) { + node = this.body.nodes[overlappingNodeIds[i]]; + break; + } + } + + // clean temporary nodes and edges. + this._cleanupTemporaryNodesAndEdges(); - var _slicedToArray2 = __webpack_require__(171); + // perform the connection + if (node !== undefined) { + if (node.isCluster === true) { + alert(this.options.locales[this.options.locale]['createEdgeError'] || this.options.locales['en']['createEdgeError']); + } else { + if (this.body.nodes[connectFromId] !== undefined && this.body.nodes[node.id] !== undefined) { + this._performAddEdge(connectFromId, node.id); + } + } + } - var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); + // No need to do _generateclickevent('dragEnd') here, the regular dragEnd event fires. + this.body.emitter.emit('_redraw'); + } - var _classCallCheck2 = __webpack_require__(135); + /** + * + * @param {Event} event + * @private + */ - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + }, { + key: '_dragStartEdge', + value: function _dragStartEdge(event) { + var pointer = this.lastTouch; + this.selectionHandler._generateClickEvent('dragStart', event, pointer, undefined, true); + } - var _createClass2 = __webpack_require__(136); + // --------------------------------------- END OF ADD EDGE FUNCTIONS -------------------------------------// - var _createClass3 = _interopRequireDefault(_createClass2); - var _FloydWarshall = __webpack_require__(232); + // ------------------------------ Performing all the actual data manipulation ------------------------// - var _FloydWarshall2 = _interopRequireDefault(_FloydWarshall); + /** + * Adds a node on the specified location + * + * @param {Object} clickData + * @private + */ - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + }, { + key: '_performAddNode', + value: function _performAddNode(clickData) { + var _this4 = this; - /** - * KamadaKawai positions the nodes initially based on - * - * "AN ALGORITHM FOR DRAWING GENERAL UNDIRECTED GRAPHS" - * -- Tomihisa KAMADA and Satoru KAWAI in 1989 - * - * Possible optimizations in the distance calculation can be implemented. - */ - var KamadaKawai = function () { - function KamadaKawai(body, edgeLength, edgeStrength) { - (0, _classCallCheck3["default"])(this, KamadaKawai); + var defaultData = { + id: util.randomUUID(), + x: clickData.pointer.canvas.x, + y: clickData.pointer.canvas.y, + label: 'new' + }; - this.body = body; - this.springLength = edgeLength; - this.springConstant = edgeStrength; - this.distanceSolver = new _FloydWarshall2["default"](); + if (typeof this.options.addNode === 'function') { + if (this.options.addNode.length === 2) { + this.options.addNode(defaultData, function (finalizedData) { + if (finalizedData !== null && finalizedData !== undefined && _this4.inMode === 'addNode') { + // if for whatever reason the mode has changes (due to dataset change) disregard the callback + _this4.body.data.nodes.getDataSet().add(finalizedData); + _this4.showManipulatorToolbar(); + } + }); + } else { + this.showManipulatorToolbar(); + throw new Error('The function for add does not support two arguments (data,callback)'); + } + } else { + this.body.data.nodes.getDataSet().add(defaultData); + this.showManipulatorToolbar(); + } } /** - * Not sure if needed but can be used to update the spring length and spring constant - * @param options + * connect two nodes with a new edge. + * + * @param {Node.id} sourceNodeId + * @param {Node.id} targetNodeId + * @private */ + }, { + key: '_performAddEdge', + value: function _performAddEdge(sourceNodeId, targetNodeId) { + var _this5 = this; + + var defaultData = { from: sourceNodeId, to: targetNodeId }; + if (typeof this.options.addEdge === 'function') { + if (this.options.addEdge.length === 2) { + this.options.addEdge(defaultData, function (finalizedData) { + if (finalizedData !== null && finalizedData !== undefined && _this5.inMode === 'addEdge') { + // if for whatever reason the mode has changes (due to dataset change) disregard the callback + _this5.body.data.edges.getDataSet().add(finalizedData); + _this5.selectionHandler.unselectAll(); + _this5.showManipulatorToolbar(); + } + }); + } else { + throw new Error('The function for connect does not support two arguments (data,callback)'); + } + } else { + this.body.data.edges.getDataSet().add(defaultData); + this.selectionHandler.unselectAll(); + this.showManipulatorToolbar(); + } + } - (0, _createClass3["default"])(KamadaKawai, [{ - key: "setOptions", - value: function setOptions(options) { - if (options) { - if (options.springLength) { - this.springLength = options.springLength; - } - if (options.springConstant) { - this.springConstant = options.springConstant; - } + /** + * connect two nodes with a new edge. + * + * @param {Node.id} sourceNodeId + * @param {Node.id} targetNodeId + * @private + */ + + }, { + key: '_performEditEdge', + value: function _performEditEdge(sourceNodeId, targetNodeId) { + var _this6 = this; + + var defaultData = { id: this.edgeBeingEditedId, from: sourceNodeId, to: targetNodeId, label: this.body.data.edges._data[this.edgeBeingEditedId].label }; + var eeFunct = this.options.editEdge; + if ((typeof eeFunct === 'undefined' ? 'undefined' : (0, _typeof3['default'])(eeFunct)) === 'object') { + eeFunct = eeFunct.editWithoutDrag; + } + if (typeof eeFunct === 'function') { + if (eeFunct.length === 2) { + eeFunct(defaultData, function (finalizedData) { + if (finalizedData === null || finalizedData === undefined || _this6.inMode !== 'editEdge') { + // if for whatever reason the mode has changes (due to dataset change) disregard the callback) { + _this6.body.edges[defaultData.id].updateEdgeType(); + _this6.body.emitter.emit('_redraw'); + _this6.showManipulatorToolbar(); + } else { + _this6.body.data.edges.getDataSet().update(finalizedData); + _this6.selectionHandler.unselectAll(); + _this6.showManipulatorToolbar(); + } + }); + } else { + throw new Error('The function for edit does not support two arguments (data, callback)'); } + } else { + this.body.data.edges.getDataSet().update(defaultData); + this.selectionHandler.unselectAll(); + this.showManipulatorToolbar(); } + } + }]); + return ManipulationSystem; +}(); - /** - * Position the system - * @param nodesArray - * @param edgesArray - */ +exports['default'] = ManipulationSystem; - }, { - key: "solve", - value: function solve(nodesArray, edgesArray) { - var ignoreClusters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; +/***/ }), +/* 238 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; - // get distance matrix - var D_matrix = this.distanceSolver.getDistances(this.body, nodesArray, edgesArray); // distance matrix - // get the L Matrix - this._createL_matrix(D_matrix); +Object.defineProperty(exports, "__esModule", { + value: true +}); - // get the K Matrix - this._createK_matrix(D_matrix); +var _slicedToArray2 = __webpack_require__(30); - // initial E Matrix - this._createE_matrix(); +var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); - // calculate positions - var threshold = 0.01; - var innerThreshold = 1; - var iterations = 0; - var maxIterations = Math.max(1000, Math.min(10 * this.body.nodeIndices.length, 6000)); - var maxInnerIterations = 5; +var _classCallCheck2 = __webpack_require__(0); - var maxEnergy = 1e9; - var highE_nodeId = 0, - dE_dx = 0, - dE_dy = 0, - delta_m = 0, - subIterations = 0; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - while (maxEnergy > threshold && iterations < maxIterations) { - iterations += 1; +var _createClass2 = __webpack_require__(1); - var _getHighestEnergyNode2 = this._getHighestEnergyNode(ignoreClusters); +var _createClass3 = _interopRequireDefault(_createClass2); - var _getHighestEnergyNode3 = (0, _slicedToArray3["default"])(_getHighestEnergyNode2, 4); +var _FloydWarshall = __webpack_require__(239); - highE_nodeId = _getHighestEnergyNode3[0]; - maxEnergy = _getHighestEnergyNode3[1]; - dE_dx = _getHighestEnergyNode3[2]; - dE_dy = _getHighestEnergyNode3[3]; +var _FloydWarshall2 = _interopRequireDefault(_FloydWarshall); - delta_m = maxEnergy; - subIterations = 0; - while (delta_m > innerThreshold && subIterations < maxInnerIterations) { - subIterations += 1; - this._moveNode(highE_nodeId, dE_dx, dE_dy); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var _getEnergy2 = this._getEnergy(highE_nodeId); +/** + * KamadaKawai positions the nodes initially based on + * + * "AN ALGORITHM FOR DRAWING GENERAL UNDIRECTED GRAPHS" + * -- Tomihisa KAMADA and Satoru KAWAI in 1989 + * + * Possible optimizations in the distance calculation can be implemented. + */ +var KamadaKawai = function () { + /** + * @param {Object} body + * @param {number} edgeLength + * @param {number} edgeStrength + */ + function KamadaKawai(body, edgeLength, edgeStrength) { + (0, _classCallCheck3["default"])(this, KamadaKawai); + + this.body = body; + this.springLength = edgeLength; + this.springConstant = edgeStrength; + this.distanceSolver = new _FloydWarshall2["default"](); + } + + /** + * Not sure if needed but can be used to update the spring length and spring constant + * @param {Object} options + */ - var _getEnergy3 = (0, _slicedToArray3["default"])(_getEnergy2, 3); - delta_m = _getEnergy3[0]; - dE_dx = _getEnergy3[1]; - dE_dy = _getEnergy3[2]; - } + (0, _createClass3["default"])(KamadaKawai, [{ + key: "setOptions", + value: function setOptions(options) { + if (options) { + if (options.springLength) { + this.springLength = options.springLength; + } + if (options.springConstant) { + this.springConstant = options.springConstant; } } + } - /** - * get the node with the highest energy - * @returns {*[]} - * @private - */ + /** + * Position the system + * @param {Array.} nodesArray + * @param {Array.} edgesArray + * @param {boolean} [ignoreClusters=false] + */ - }, { - key: "_getHighestEnergyNode", - value: function _getHighestEnergyNode(ignoreClusters) { - var nodesArray = this.body.nodeIndices; - var nodes = this.body.nodes; - var maxEnergy = 0; - var maxEnergyNodeId = nodesArray[0]; - var dE_dx_max = 0, - dE_dy_max = 0; - - for (var nodeIdx = 0; nodeIdx < nodesArray.length; nodeIdx++) { - var m = nodesArray[nodeIdx]; - // by not evaluating nodes with predefined positions we should only move nodes that have no positions. - if (nodes[m].predefinedPosition === false || nodes[m].isCluster === true && ignoreClusters === true || nodes[m].options.fixed.x === true || nodes[m].options.fixed.y === true) { - var _getEnergy4 = this._getEnergy(m), - _getEnergy5 = (0, _slicedToArray3["default"])(_getEnergy4, 3), - delta_m = _getEnergy5[0], - dE_dx = _getEnergy5[1], - dE_dy = _getEnergy5[2]; - - if (maxEnergy < delta_m) { - maxEnergy = delta_m; - maxEnergyNodeId = m; - dE_dx_max = dE_dx; - dE_dy_max = dE_dy; - } - } - } + }, { + key: "solve", + value: function solve(nodesArray, edgesArray) { + var ignoreClusters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - return [maxEnergyNodeId, maxEnergy, dE_dx_max, dE_dy_max]; - } + // get distance matrix + var D_matrix = this.distanceSolver.getDistances(this.body, nodesArray, edgesArray); // distance matrix - /** - * calculate the energy of a single node - * @param m - * @returns {*[]} - * @private - */ + // get the L Matrix + this._createL_matrix(D_matrix); - }, { - key: "_getEnergy", - value: function _getEnergy(m) { - var _E_sums$m = (0, _slicedToArray3["default"])(this.E_sums[m], 2), - dE_dx = _E_sums$m[0], - dE_dy = _E_sums$m[1]; + // get the K Matrix + this._createK_matrix(D_matrix); - var delta_m = Math.sqrt(Math.pow(dE_dx, 2) + Math.pow(dE_dy, 2)); - return [delta_m, dE_dx, dE_dy]; - } + // initial E Matrix + this._createE_matrix(); - /** - * move the node based on it's energy - * the dx and dy are calculated from the linear system proposed by Kamada and Kawai - * @param m - * @param dE_dx - * @param dE_dy - * @private - */ + // calculate positions + var threshold = 0.01; + var innerThreshold = 1; + var iterations = 0; + var maxIterations = Math.max(1000, Math.min(10 * this.body.nodeIndices.length, 6000)); + var maxInnerIterations = 5; - }, { - key: "_moveNode", - value: function _moveNode(m, dE_dx, dE_dy) { - var nodesArray = this.body.nodeIndices; - var nodes = this.body.nodes; - var d2E_dx2 = 0; - var d2E_dxdy = 0; - var d2E_dy2 = 0; + var maxEnergy = 1e9; + var highE_nodeId = 0, + dE_dx = 0, + dE_dy = 0, + delta_m = 0, + subIterations = 0; - var x_m = nodes[m].x; - var y_m = nodes[m].y; - var km = this.K_matrix[m]; - var lm = this.L_matrix[m]; + while (maxEnergy > threshold && iterations < maxIterations) { + iterations += 1; - for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) { - var i = nodesArray[iIdx]; - if (i !== m) { - var x_i = nodes[i].x; - var y_i = nodes[i].y; - var kmat = km[i]; - var lmat = lm[i]; - var denominator = 1.0 / Math.pow(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2), 1.5); - d2E_dx2 += kmat * (1 - lmat * Math.pow(y_m - y_i, 2) * denominator); - d2E_dxdy += kmat * (lmat * (x_m - x_i) * (y_m - y_i) * denominator); - d2E_dy2 += kmat * (1 - lmat * Math.pow(x_m - x_i, 2) * denominator); - } - } - // make the variable names easier to make the solving of the linear system easier to read - var A = d2E_dx2, - B = d2E_dxdy, - C = dE_dx, - D = d2E_dy2, - E = dE_dy; + var _getHighestEnergyNode2 = this._getHighestEnergyNode(ignoreClusters); + + var _getHighestEnergyNode3 = (0, _slicedToArray3["default"])(_getHighestEnergyNode2, 4); - // solve the linear system for dx and dy - var dy = (C / A + E / B) / (B / A - D / B); - var dx = -(B * dy + C) / A; + highE_nodeId = _getHighestEnergyNode3[0]; + maxEnergy = _getHighestEnergyNode3[1]; + dE_dx = _getHighestEnergyNode3[2]; + dE_dy = _getHighestEnergyNode3[3]; - // move the node - nodes[m].x += dx; - nodes[m].y += dy; + delta_m = maxEnergy; + subIterations = 0; + while (delta_m > innerThreshold && subIterations < maxInnerIterations) { + subIterations += 1; + this._moveNode(highE_nodeId, dE_dx, dE_dy); - // Recalculate E_matrix (should be incremental) - this._updateE_matrix(m); + var _getEnergy2 = this._getEnergy(highE_nodeId); + + var _getEnergy3 = (0, _slicedToArray3["default"])(_getEnergy2, 3); + + delta_m = _getEnergy3[0]; + dE_dx = _getEnergy3[1]; + dE_dy = _getEnergy3[2]; + } } + } - /** - * Create the L matrix: edge length times shortest path - * @param D_matrix - * @private - */ + /** + * get the node with the highest energy + * @param {boolean} ignoreClusters + * @returns {number[]} + * @private + */ - }, { - key: "_createL_matrix", - value: function _createL_matrix(D_matrix) { - var nodesArray = this.body.nodeIndices; - var edgeLength = this.springLength; + }, { + key: "_getHighestEnergyNode", + value: function _getHighestEnergyNode(ignoreClusters) { + var nodesArray = this.body.nodeIndices; + var nodes = this.body.nodes; + var maxEnergy = 0; + var maxEnergyNodeId = nodesArray[0]; + var dE_dx_max = 0, + dE_dy_max = 0; - this.L_matrix = []; - for (var i = 0; i < nodesArray.length; i++) { - this.L_matrix[nodesArray[i]] = {}; - for (var j = 0; j < nodesArray.length; j++) { - this.L_matrix[nodesArray[i]][nodesArray[j]] = edgeLength * D_matrix[nodesArray[i]][nodesArray[j]]; + for (var nodeIdx = 0; nodeIdx < nodesArray.length; nodeIdx++) { + var m = nodesArray[nodeIdx]; + // by not evaluating nodes with predefined positions we should only move nodes that have no positions. + if (nodes[m].predefinedPosition === false || nodes[m].isCluster === true && ignoreClusters === true || nodes[m].options.fixed.x === true || nodes[m].options.fixed.y === true) { + var _getEnergy4 = this._getEnergy(m), + _getEnergy5 = (0, _slicedToArray3["default"])(_getEnergy4, 3), + delta_m = _getEnergy5[0], + dE_dx = _getEnergy5[1], + dE_dy = _getEnergy5[2]; + + if (maxEnergy < delta_m) { + maxEnergy = delta_m; + maxEnergyNodeId = m; + dE_dx_max = dE_dx; + dE_dy_max = dE_dy; } } } - /** - * Create the K matrix: spring constants times shortest path - * @param D_matrix - * @private - */ + return [maxEnergyNodeId, maxEnergy, dE_dx_max, dE_dy_max]; + } - }, { - key: "_createK_matrix", - value: function _createK_matrix(D_matrix) { - var nodesArray = this.body.nodeIndices; - var edgeStrength = this.springConstant; + /** + * calculate the energy of a single node + * @param {Node.id} m + * @returns {number[]} + * @private + */ - this.K_matrix = []; - for (var i = 0; i < nodesArray.length; i++) { - this.K_matrix[nodesArray[i]] = {}; - for (var j = 0; j < nodesArray.length; j++) { - this.K_matrix[nodesArray[i]][nodesArray[j]] = edgeStrength * Math.pow(D_matrix[nodesArray[i]][nodesArray[j]], -2); - } + }, { + key: "_getEnergy", + value: function _getEnergy(m) { + var _E_sums$m = (0, _slicedToArray3["default"])(this.E_sums[m], 2), + dE_dx = _E_sums$m[0], + dE_dy = _E_sums$m[1]; + + var delta_m = Math.sqrt(Math.pow(dE_dx, 2) + Math.pow(dE_dy, 2)); + return [delta_m, dE_dx, dE_dy]; + } + + /** + * move the node based on it's energy + * the dx and dy are calculated from the linear system proposed by Kamada and Kawai + * @param {number} m + * @param {number} dE_dx + * @param {number} dE_dy + * @private + */ + + }, { + key: "_moveNode", + value: function _moveNode(m, dE_dx, dE_dy) { + var nodesArray = this.body.nodeIndices; + var nodes = this.body.nodes; + var d2E_dx2 = 0; + var d2E_dxdy = 0; + var d2E_dy2 = 0; + + var x_m = nodes[m].x; + var y_m = nodes[m].y; + var km = this.K_matrix[m]; + var lm = this.L_matrix[m]; + + for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) { + var i = nodesArray[iIdx]; + if (i !== m) { + var x_i = nodes[i].x; + var y_i = nodes[i].y; + var kmat = km[i]; + var lmat = lm[i]; + var denominator = 1.0 / Math.pow(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2), 1.5); + d2E_dx2 += kmat * (1 - lmat * Math.pow(y_m - y_i, 2) * denominator); + d2E_dxdy += kmat * (lmat * (x_m - x_i) * (y_m - y_i) * denominator); + d2E_dy2 += kmat * (1 - lmat * Math.pow(x_m - x_i, 2) * denominator); + } + } + // make the variable names easier to make the solving of the linear system easier to read + var A = d2E_dx2, + B = d2E_dxdy, + C = dE_dx, + D = d2E_dy2, + E = dE_dy; + + // solve the linear system for dx and dy + var dy = (C / A + E / B) / (B / A - D / B); + var dx = -(B * dy + C) / A; + + // move the node + nodes[m].x += dx; + nodes[m].y += dy; + + // Recalculate E_matrix (should be incremental) + this._updateE_matrix(m); + } + + /** + * Create the L matrix: edge length times shortest path + * @param {Object} D_matrix + * @private + */ + + }, { + key: "_createL_matrix", + value: function _createL_matrix(D_matrix) { + var nodesArray = this.body.nodeIndices; + var edgeLength = this.springLength; + + this.L_matrix = []; + for (var i = 0; i < nodesArray.length; i++) { + this.L_matrix[nodesArray[i]] = {}; + for (var j = 0; j < nodesArray.length; j++) { + this.L_matrix[nodesArray[i]][nodesArray[j]] = edgeLength * D_matrix[nodesArray[i]][nodesArray[j]]; } } + } - /** - * Create matrix with all energies between nodes - * @private - */ + /** + * Create the K matrix: spring constants times shortest path + * @param {Object} D_matrix + * @private + */ - }, { - key: "_createE_matrix", - value: function _createE_matrix() { - var nodesArray = this.body.nodeIndices; - var nodes = this.body.nodes; - this.E_matrix = {}; - this.E_sums = {}; - for (var mIdx = 0; mIdx < nodesArray.length; mIdx++) { - this.E_matrix[nodesArray[mIdx]] = []; - } - for (var _mIdx = 0; _mIdx < nodesArray.length; _mIdx++) { - var m = nodesArray[_mIdx]; - var x_m = nodes[m].x; - var y_m = nodes[m].y; - var dE_dx = 0; - var dE_dy = 0; - for (var iIdx = _mIdx; iIdx < nodesArray.length; iIdx++) { - var i = nodesArray[iIdx]; - if (i !== m) { - var x_i = nodes[i].x; - var y_i = nodes[i].y; - var denominator = 1.0 / Math.sqrt(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2)); - this.E_matrix[m][iIdx] = [this.K_matrix[m][i] * (x_m - x_i - this.L_matrix[m][i] * (x_m - x_i) * denominator), this.K_matrix[m][i] * (y_m - y_i - this.L_matrix[m][i] * (y_m - y_i) * denominator)]; - this.E_matrix[i][_mIdx] = this.E_matrix[m][iIdx]; - dE_dx += this.E_matrix[m][iIdx][0]; - dE_dy += this.E_matrix[m][iIdx][1]; - } - } - //Store sum - this.E_sums[m] = [dE_dx, dE_dy]; + }, { + key: "_createK_matrix", + value: function _createK_matrix(D_matrix) { + var nodesArray = this.body.nodeIndices; + var edgeStrength = this.springConstant; + + this.K_matrix = []; + for (var i = 0; i < nodesArray.length; i++) { + this.K_matrix[nodesArray[i]] = {}; + for (var j = 0; j < nodesArray.length; j++) { + this.K_matrix[nodesArray[i]][nodesArray[j]] = edgeStrength * Math.pow(D_matrix[nodesArray[i]][nodesArray[j]], -2); } } + } - //Update method, just doing single column (rows are auto-updated) (update all sums) + /** + * Create matrix with all energies between nodes + * @private + */ - }, { - key: "_updateE_matrix", - value: function _updateE_matrix(m) { - var nodesArray = this.body.nodeIndices; - var nodes = this.body.nodes; - var colm = this.E_matrix[m]; - var kcolm = this.K_matrix[m]; - var lcolm = this.L_matrix[m]; + }, { + key: "_createE_matrix", + value: function _createE_matrix() { + var nodesArray = this.body.nodeIndices; + var nodes = this.body.nodes; + this.E_matrix = {}; + this.E_sums = {}; + for (var mIdx = 0; mIdx < nodesArray.length; mIdx++) { + this.E_matrix[nodesArray[mIdx]] = []; + } + for (var _mIdx = 0; _mIdx < nodesArray.length; _mIdx++) { + var m = nodesArray[_mIdx]; var x_m = nodes[m].x; var y_m = nodes[m].y; var dE_dx = 0; var dE_dy = 0; - for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) { + for (var iIdx = _mIdx; iIdx < nodesArray.length; iIdx++) { var i = nodesArray[iIdx]; if (i !== m) { - //Keep old energy value for sum modification below - var cell = colm[iIdx]; - var oldDx = cell[0]; - var oldDy = cell[1]; - - //Calc new energy: var x_i = nodes[i].x; var y_i = nodes[i].y; var denominator = 1.0 / Math.sqrt(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2)); - var dx = kcolm[i] * (x_m - x_i - lcolm[i] * (x_m - x_i) * denominator); - var dy = kcolm[i] * (y_m - y_i - lcolm[i] * (y_m - y_i) * denominator); - colm[iIdx] = [dx, dy]; - dE_dx += dx; - dE_dy += dy; - - //add new energy to sum of each column - var sum = this.E_sums[i]; - sum[0] += dx - oldDx; - sum[1] += dy - oldDy; + this.E_matrix[m][iIdx] = [this.K_matrix[m][i] * (x_m - x_i - this.L_matrix[m][i] * (x_m - x_i) * denominator), this.K_matrix[m][i] * (y_m - y_i - this.L_matrix[m][i] * (y_m - y_i) * denominator)]; + this.E_matrix[i][_mIdx] = this.E_matrix[m][iIdx]; + dE_dx += this.E_matrix[m][iIdx][0]; + dE_dy += this.E_matrix[m][iIdx][1]; } } - //Store sum at -1 index + //Store sum this.E_sums[m] = [dE_dx, dE_dy]; } - }]); - return KamadaKawai; - }(); // distance finding algorithm + } + /** + * Update method, just doing single column (rows are auto-updated) (update all sums) + * + * @param {number} m + * @private + */ - exports["default"] = KamadaKawai; + }, { + key: "_updateE_matrix", + value: function _updateE_matrix(m) { + var nodesArray = this.body.nodeIndices; + var nodes = this.body.nodes; + var colm = this.E_matrix[m]; + var kcolm = this.K_matrix[m]; + var lcolm = this.L_matrix[m]; + var x_m = nodes[m].x; + var y_m = nodes[m].y; + var dE_dx = 0; + var dE_dy = 0; + for (var iIdx = 0; iIdx < nodesArray.length; iIdx++) { + var i = nodesArray[iIdx]; + if (i !== m) { + //Keep old energy value for sum modification below + var cell = colm[iIdx]; + var oldDx = cell[0]; + var oldDy = cell[1]; + + //Calc new energy: + var x_i = nodes[i].x; + var y_i = nodes[i].y; + var denominator = 1.0 / Math.sqrt(Math.pow(x_m - x_i, 2) + Math.pow(y_m - y_i, 2)); + var dx = kcolm[i] * (x_m - x_i - lcolm[i] * (x_m - x_i) * denominator); + var dy = kcolm[i] * (y_m - y_i - lcolm[i] * (y_m - y_i) * denominator); + colm[iIdx] = [dx, dy]; + dE_dx += dx; + dE_dy += dy; + + //add new energy to sum of each column + var sum = this.E_sums[i]; + sum[0] += dx - oldDx; + sum[1] += dy - oldDy; + } + } + //Store sum at -1 index + this.E_sums[m] = [dE_dx, dE_dy]; + } + }]); + return KamadaKawai; +}(); // distance finding algorithm + + +exports["default"] = KamadaKawai; /***/ }), -/* 232 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { - "use strict"; +"use strict"; - Object.defineProperty(exports, "__esModule", { - value: true - }); - var _classCallCheck2 = __webpack_require__(135); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _classCallCheck2 = __webpack_require__(0); - var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - var _createClass2 = __webpack_require__(136); +var _createClass2 = __webpack_require__(1); - var _createClass3 = _interopRequireDefault(_createClass2); +var _createClass3 = _interopRequireDefault(_createClass2); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +/** + * The Floyd–Warshall algorithm is an algorithm for finding shortest paths in + * a weighted graph with positive or negative edge weights (but with no negative + * cycles). - https://en.wikipedia.org/wiki/Floyd–Warshall_algorithm + */ +var FloydWarshall = function () { /** - * Created by Alex on 10-Aug-15. + * @ignore */ + function FloydWarshall() { + (0, _classCallCheck3["default"])(this, FloydWarshall); + } - var FloydWarshall = function () { - function FloydWarshall() { - (0, _classCallCheck3["default"])(this, FloydWarshall); - } + /** + * + * @param {Object} body + * @param {Array.} nodesArray + * @param {Array.} edgesArray + * @returns {{}} + */ - (0, _createClass3["default"])(FloydWarshall, [{ - key: "getDistances", - value: function getDistances(body, nodesArray, edgesArray) { - var D_matrix = {}; - var edges = body.edges; - // prepare matrix with large numbers - for (var i = 0; i < nodesArray.length; i++) { - var node = nodesArray[i]; - var cell = {}; - D_matrix[node] = cell; - for (var j = 0; j < nodesArray.length; j++) { - cell[nodesArray[j]] = i == j ? 0 : 1e9; - } + (0, _createClass3["default"])(FloydWarshall, [{ + key: "getDistances", + value: function getDistances(body, nodesArray, edgesArray) { + var D_matrix = {}; + var edges = body.edges; + + // prepare matrix with large numbers + for (var i = 0; i < nodesArray.length; i++) { + var node = nodesArray[i]; + var cell = {}; + D_matrix[node] = cell; + for (var j = 0; j < nodesArray.length; j++) { + cell[nodesArray[j]] = i == j ? 0 : 1e9; } + } - // put the weights for the edges in. This assumes unidirectionality. - for (var _i = 0; _i < edgesArray.length; _i++) { - var edge = edges[edgesArray[_i]]; - // edge has to be connected if it counts to the distances. If it is connected to inner clusters it will crash so we also check if it is in the D_matrix - if (edge.connected === true && D_matrix[edge.fromId] !== undefined && D_matrix[edge.toId] !== undefined) { - D_matrix[edge.fromId][edge.toId] = 1; - D_matrix[edge.toId][edge.fromId] = 1; - } + // put the weights for the edges in. This assumes unidirectionality. + for (var _i = 0; _i < edgesArray.length; _i++) { + var edge = edges[edgesArray[_i]]; + // edge has to be connected if it counts to the distances. If it is connected to inner clusters it will crash so we also check if it is in the D_matrix + if (edge.connected === true && D_matrix[edge.fromId] !== undefined && D_matrix[edge.toId] !== undefined) { + D_matrix[edge.fromId][edge.toId] = 1; + D_matrix[edge.toId][edge.fromId] = 1; } + } - var nodeCount = nodesArray.length; + var nodeCount = nodesArray.length; - // Adapted FloydWarshall based on unidirectionality to greatly reduce complexity. - for (var k = 0; k < nodeCount; k++) { - var knode = nodesArray[k]; - var kcolm = D_matrix[knode]; - for (var _i2 = 0; _i2 < nodeCount - 1; _i2++) { - var inode = nodesArray[_i2]; - var icolm = D_matrix[inode]; - for (var _j = _i2 + 1; _j < nodeCount; _j++) { - var jnode = nodesArray[_j]; - var jcolm = D_matrix[jnode]; + // Adapted FloydWarshall based on unidirectionality to greatly reduce complexity. + for (var k = 0; k < nodeCount; k++) { + var knode = nodesArray[k]; + var kcolm = D_matrix[knode]; + for (var _i2 = 0; _i2 < nodeCount - 1; _i2++) { + var inode = nodesArray[_i2]; + var icolm = D_matrix[inode]; + for (var _j = _i2 + 1; _j < nodeCount; _j++) { + var jnode = nodesArray[_j]; + var jcolm = D_matrix[jnode]; - var val = Math.min(icolm[jnode], icolm[knode] + kcolm[jnode]); - icolm[jnode] = val; - jcolm[inode] = val; - } + var val = Math.min(icolm[jnode], icolm[knode] + kcolm[jnode]); + icolm[jnode] = val; + jcolm[inode] = val; } } - - return D_matrix; } - }]); - return FloydWarshall; - }(); - exports["default"] = FloydWarshall; + return D_matrix; + } + }]); + return FloydWarshall; +}(); + +exports["default"] = FloydWarshall; /***/ }) -/******/ ]) -}); -; \ No newline at end of file +/******/ ]); +}); \ No newline at end of file diff --git a/dist/vis.map b/dist/vis.map index 81d5ca0a..98823da7 100644 --- a/dist/vis.map +++ b/dist/vis.map @@ -1 +1 @@ -{"version":3,"sources":["vis.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","util","extend","_interopRequireDefault","obj","__esModule","default","_getIterator2","_getIterator3","_create","_create2","_keys","_keys2","_typeof2","_typeof3","moment","uuid","isNumber","object","Number","recursiveDOMDelete","DOMobject","hasChildNodes","firstChild","removeChild","giveRange","min","max","total","value","scale","Math","isString","String","isDate","Date","ASPDateRegex","exec","isNaN","parse","randomUUID","v4","assignAllKeys","prop","hasOwnProperty","fillIfDefined","a","b","allowDeletion","arguments","length","undefined","protoExtend","i","other","selectiveExtend","props","Array","isArray","Error","selectiveDeepExtend","TypeError","constructor","Object","deepExtend","selectiveNotDeepExtend","indexOf","push","equalArray","len","convert","type","match","Boolean","valueOf","isMoment","toDate","getType","toISOString","format","copyAndExtendArray","arr","newValue","newArr","copyArray","getAbsoluteLeft","elem","getBoundingClientRect","left","getAbsoluteRight","right","getAbsoluteTop","top","addClassName","classNames","classes","className","split","newClasses","concat","filter","join","removeClassName","oldClasses","forEach","callback","toArray","array","updateProperty","key","throttle","fn","scheduled","requestAnimationFrame","addEventListener","element","action","listener","useCapture","navigator","userAgent","attachEvent","removeEventListener","detachEvent","preventDefault","event","window","returnValue","getTarget","target","srcElement","nodeType","parentNode","hasParent","parent","e","option","asBoolean","defaultValue","asNumber","asString","asSize","asElement","hexToRGB","hex","shorthandRegex","replace","r","g","result","parseInt","overrideOpacity","color","opacity","rgb","substr","RGBToHex","red","green","blue","toString","slice","parseColor","isValidRGB","map","isValidHex","hsv","hexToHSV","lighterColorHSV","h","s","v","darkerColorHSV","darkerColorHex","HSVToHex","lighterColorHex","background","border","highlight","hover","RGBToHSV","minRGB","maxRGB","d","cssUtil","cssText","styles","style","trim","parts","addCssText","currentStyles","newStyles","removeCssText","removeStyles","HSVToRGB","floor","f","q","t","test","isValidRGBA","rgba","selectiveBridgeObject","fields","referenceObject","objectTo","bridgeObject","insertSort","compare","k","j","mergeOptions","mergeTarget","options","globalOptions","enabled","binarySearchCustom","orderedItems","comparator","field","field2","iteration","low","high","middle","item","searchResult","binarySearchValue","sidePreference","prevValue","nextValue","easingFunctions","linear","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","getScrollBarWidth","inner","document","createElement","width","height","outer","position","visibility","overflow","appendChild","body","w1","offsetWidth","w2","clientWidth","topMost","pile","accessors","candidate","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","next","done","member","err","global","hide","Iterators","TO_STRING_TAG","collections","NAME","Collection","proto","prototype","addToUnscopables","step","toIObject","iterated","kind","_t","_i","_k","O","index","Arguments","IObject","defined","it","cof","propertyIsEnumerable","LIBRARY","$export","redefine","has","$iterCreate","setToStringTag","getPrototypeOf","ITERATOR","BUGGY","keys","returnThis","Base","Constructor","DEFAULT","IS_SET","FORCED","methods","IteratorPrototype","getMethod","TAG","DEF_VALUES","VALUES_BUG","$native","$default","$entries","$anyNative","entries","name","values","P","F","core","ctx","source","own","out","IS_FORCED","IS_GLOBAL","G","IS_STATIC","S","IS_PROTO","IS_BIND","B","IS_WRAP","W","expProto","C","apply","Function","virtual","R","U","self","__g","version","__e","aFunction","that","dP","createDesc","anObject","IE8_DOM_DEFINE","toPrimitive","defineProperty","Attributes","isObject","get","is","val","bitmap","enumerable","configurable","writable","create","descriptor","dPs","enumBugKeys","IE_PROTO","Empty","createDict","iframeDocument","iframe","display","src","contentWindow","open","write","lt","close","Properties","getKeys","defineProperties","$keys","arrayIndexOf","names","toLength","toIndex","IS_INCLUDES","$this","el","fromIndex","toInteger","ceil","shared","uid","store","px","random","documentElement","def","tag","stat","Symbol","USE_SYMBOL","toObject","ObjectProto","$at","point","TO_STRING","pos","l","charCodeAt","charAt","getIterator","iterFn","classof","getIteratorMethod","ARG","tryGet","T","callee","$Object","D","fails","KEY","exp","_iterator2","_symbol","_symbol2","_typeof","DESCRIPTORS","META","$fails","wks","wksExt","wksDefine","keyOf","enumKeys","gOPNExt","$GOPD","$DP","gOPD","gOPN","$Symbol","$JSON","JSON","_stringify","stringify","HIDDEN","TO_PRIMITIVE","isEnum","SymbolRegistry","AllSymbols","OPSymbols","USE_NATIVE","QObject","setter","findChild","setSymbolDesc","protoDesc","wrap","sym","isSymbol","iterator","$defineProperty","$defineProperties","$create","$propertyIsEnumerable","E","$getOwnPropertyDescriptor","$getOwnPropertyNames","$getOwnPropertySymbols","IS_OP","$set","set","symbols","for","keyFor","useSetter","useSimple","getOwnPropertyDescriptor","getOwnPropertyNames","getOwnPropertySymbols","replacer","$replacer","args","setDesc","isExtensible","FREEZE","preventExtensions","setMeta","w","fastKey","getWeak","onFreeze","meta","NEED","gOPS","pIE","getSymbols","arg","windowNames","getWindowNames","hiddenKeys","hooks","hookCallback","input","isObjectEmpty","isUndefined","res","hasOwnProp","createUTC","locale","strict","createLocalOrUTC","utc","defaultParsingFlags","empty","unusedTokens","unusedInput","charsLeftOver","nullInput","invalidMonth","invalidFormat","userInvalidated","iso","parsedDateParts","meridiem","rfc2822","weekdayMismatch","getParsingFlags","_pf","isValid","_isValid","flags","parsedParts","some$1","isNowValid","_d","getTime","invalidWeekday","_strict","bigHour","isFrozen","createInvalid","NaN","copyConfig","to","from","_isAMomentObject","_f","_l","_tzm","_isUTC","_offset","_locale","momentProperties","Moment","config","updateInProgress","updateOffset","absFloor","number","toInt","argumentForCoercion","coercedNumber","isFinite","compareArrays","array1","array2","dontConvert","lengthDiff","abs","diffs","warn","msg","suppressDeprecationWarnings","console","deprecate","firstTime","deprecationHandler","stack","deprecateSimple","deprecations","isFunction","_config","_dayOfMonthOrdinalParseLenient","RegExp","_dayOfMonthOrdinalParse","_ordinalParse","mergeConfigs","parentConfig","childConfig","Locale","calendar","mom","now","output","_calendar","longDateFormat","_longDateFormat","formatUpper","toUpperCase","invalidDate","_invalidDate","ordinal","_ordinal","relativeTime","withoutSuffix","string","isFuture","_relativeTime","pastFuture","diff","addUnitAlias","unit","shorthand","lowerCase","toLowerCase","aliases","normalizeUnits","units","normalizeObjectUnits","inputObject","normalizedProp","normalizedInput","addUnitPriority","priority","priorities","getPrioritizedUnits","unitsObj","u","sort","makeGetSet","keepTime","set$1","stringGet","stringSet","prioritized","zeroFill","targetLength","forceSign","absNumber","zerosToFill","pow","addFormatToken","token","padded","func","formatTokenFunctions","localeData","removeFormattingTokens","makeFormatFunction","formattingTokens","formatMoment","expandFormat","formatFunctions","replaceLongDateFormatTokens","localFormattingTokens","lastIndex","addRegexToken","regex","strictRegex","regexes","isStrict","getParseRegexForToken","unescapeFormat","regexEscape","matched","p1","p2","p3","p4","addParseToken","tokens","addWeekParseToken","_w","addTimeToArrayFromToken","_a","daysInMonth","year","month","UTC","getUTCDate","localeMonths","_months","isFormat","MONTHS_IN_FORMAT","localeMonthsShort","_monthsShort","handleStrictParse","monthName","ii","llc","toLocaleLowerCase","_monthsParse","_longMonthsParse","_shortMonthsParse","monthsShort","months","indexOf$1","localeMonthsParse","_monthsParseExact","setMonth","dayOfMonth","monthsParse","date","getSetMonth","getDaysInMonth","monthsShortRegex","computeMonthsParse","_monthsShortStrictRegex","_monthsShortRegex","defaultMonthsShortRegex","monthsRegex","_monthsStrictRegex","_monthsRegex","defaultMonthsRegex","cmpLenRev","shortPieces","longPieces","mixedPieces","daysInYear","isLeapYear","getIsLeapYear","createDate","y","M","ms","getFullYear","setFullYear","createUTCDate","getUTCFullYear","setUTCFullYear","firstWeekOffset","dow","doy","fwd","getUTCDay","dayOfYearFromWeeks","week","weekday","resYear","resDayOfYear","localWeekday","weekOffset","dayOfYear","weekOfYear","resWeek","weeksInYear","weekOffsetNext","localeWeek","_week","localeFirstDayOfWeek","localeFirstDayOfYear","getSetWeek","add","getSetISOWeek","parseWeekday","weekdaysParse","parseIsoWeekday","localeWeekdays","_weekdays","day","localeWeekdaysShort","_weekdaysShort","localeWeekdaysMin","_weekdaysMin","handleStrictParse$1","weekdayName","_weekdaysParse","_shortWeekdaysParse","_minWeekdaysParse","weekdaysMin","weekdaysShort","weekdays","localeWeekdaysParse","_weekdaysParseExact","_fullWeekdaysParse","getSetDayOfWeek","getDay","getSetLocaleDayOfWeek","getSetISODayOfWeek","weekdaysRegex","computeWeekdaysParse","_weekdaysStrictRegex","_weekdaysRegex","defaultWeekdaysRegex","weekdaysShortRegex","_weekdaysShortStrictRegex","_weekdaysShortRegex","defaultWeekdaysShortRegex","weekdaysMinRegex","_weekdaysMinStrictRegex","_weekdaysMinRegex","defaultWeekdaysMinRegex","minp","shortp","longp","minPieces","hFormat","hours","kFormat","lowercase","minutes","matchMeridiem","_meridiemParse","localeIsPM","localeMeridiem","isLower","normalizeLocale","chooseLocale","loadLocale","oldLocale","locales","globalLocale","_abbr","code","getSetGlobalLocale","data","getLocale","defineLocale","baseConfig","abbr","parentLocale","localeFamilies","x","updateLocale","listLocales","keys$1","checkOverflow","MONTH","DATE","YEAR","HOUR","MINUTE","SECOND","MILLISECOND","_overflowDayOfYear","_overflowWeeks","WEEK","_overflowWeekday","WEEKDAY","configFromISO","allowTime","dateFormat","timeFormat","tzFormat","extendedIsoRegex","basicIsoRegex","isoDates","isoTimes","tzRegex","configFromStringAndFormat","configFromRFC2822","dayFormat","timezone","timezoneIndex","timezones"," GMT"," EDT"," EST"," CDT"," CST"," MDT"," MST"," PDT"," PST","military","basicRfcRegex","momentDate","momentDay","splice","configFromString","aspNetJsonRegex","createFromInputFallback","defaults","currentDateArray","nowValue","_useUTC","getUTCMonth","getMonth","getDate","configFromArray","currentDate","yearToUse","dayOfYearFromWeekInfo","_dayOfYear","_nextDay","setUTCMinutes","getUTCMinutes","weekYear","temp","weekdayOverflow","GG","createLocal","curWeek","gg","ISO_8601","RFC_2822","parsedInput","skipped","stringLength","totalParsedInputLength","_meridiem","meridiemFixWrap","hour","isPm","meridiemHour","isPM","configFromStringAndArray","tempConfig","bestMoment","scoreToBeat","currentScore","score","configFromObject","minute","second","millisecond","createFromConfig","prepareConfig","preparse","configFromInput","isUTC","pickBy","moments","isDurationValid","ordering","unitHasDecimal","parseFloat","isValid$1","createInvalid$1","createDuration","Duration","duration","years","quarters","quarter","weeks","days","seconds","milliseconds","_milliseconds","_days","_data","_bubble","isDuration","absRound","round","offset","separator","utcOffset","sign","offsetFromString","matcher","matches","chunk","chunkOffset","cloneWithOffset","model","clone","setTime","local","getDateOffset","getTimezoneOffset","getSetOffset","keepLocalTime","keepMinutes","localAdjust","matchShortOffset","_changeInProgress","addSubtract","getSetZone","setOffsetToUTC","setOffsetToLocal","subtract","setOffsetToParsedOffset","tZone","matchOffset","hasAlignedHourOffset","isDaylightSavingTime","isDaylightSavingTimeShifted","_isDSTShifted","isLocal","isUtcOffset","isUtc","ret","diffRes","aspNetRegex","isoRegex","parseIso","momentsDifference","inp","positiveMomentsDifference","base","isAfter","isBefore","createAdder","direction","period","dur","tmp","isAdding","getCalendarFormat","myMoment","calendar$1","time","formats","sod","startOf","calendarFormat","localInput","endOf","isBetween","inclusivity","isSame","inputMs","isSameOrAfter","isSameOrBefore","asFloat","zoneDelta","delta","monthDiff","anchor2","adjust","wholeMonthDiff","anchor","inspect","zone","prefix","suffix","inputString","defaultFormatUtc","defaultFormat","postformat","humanize","fromNow","toNow","newLocaleData","isoWeekday","unix","toJSON","isValid$2","parsingFlags","invalidAt","creationData","addWeekYearFormatToken","getter","getSetWeekYear","getSetWeekYearHelper","getSetISOWeekYear","isoWeek","getISOWeeksInYear","getWeeksInYear","weekInfo","weeksTarget","setWeekAll","dayOfYearData","getSetQuarter","getSetDayOfYear","parseMs","getZoneAbbr","getZoneName","createUnix","createInZone","parseZone","preParsePostFormat","get$1","listMonthsImpl","listWeekdaysImpl","localeSorted","shift","listMonths","listMonthsShort","listWeekdays","listWeekdaysShort","listWeekdaysMin","mathAbs","addSubtract$1","add$1","subtract$1","absCeil","bubble","monthsFromDays","monthsToDays","daysToMonths","as","valueOf$1","makeAs","alias","get$2","makeGetter","substituteTimeAgo","relativeTime$1","posNegDuration","thresholds","ss","getSetRelativeTimeRounding","roundingFunction","getSetRelativeTimeThreshold","threshold","limit","withSuffix","toISOString$1","abs$1","Y","asSeconds","some","fun","defaultCalendar","sameDay","nextDay","nextWeek","lastDay","lastWeek","sameElse","defaultLongDateFormat","LTS","LT","L","LL","LLL","LLLL","defaultDayOfMonthOrdinalParse","defaultRelativeTime","future","past","mm","hh","dd","MM","yy","match1","match2","match3","match4","match6","match1to2","match3to4","match5to6","match1to3","match1to4","match1to6","matchUnsigned","matchSigned","matchTimestamp","matchWord","o","defaultLocaleMonths","defaultLocaleMonthsShort","parseTwoDigitYear","getSetYear","defaultLocaleWeek","defaultLocaleWeekdays","defaultLocaleWeekdaysShort","defaultLocaleWeekdaysMin","kInput","_isPm","pos1","pos2","defaultLocaleMeridiemParse","getSetHour","dayOfMonthOrdinalParse","meridiemParse","prototypeMin","prototypeMax","invalid","lang","isoWeekYear","getSetDayOfMonth","getSetMinute","getSetSecond","getSetMillisecond","isoWeeks","isoWeeksInYear","isDST","zoneAbbr","zoneName","dates","isDSTShifted","proto$1","firstDayOfYear","firstDayOfWeek","langData","asMilliseconds","asMinutes","asHours","asDays","asWeeks","asMonths","asYears","proto$2","toIsoString","relativeTimeRounding","relativeTimeThreshold","webpackPolyfill","paths","children","webpackContext","req","resolve","buf","oct","_hexToByte","unparse","bth","_byteToHex","v1","clockseq","_clockseq","msecs","nsecs","_lastNSecs","dt","_lastMSecs","tl","tmh","node","_nodeId","n","rnds","rng","_rng","globalVar","crypto","getRandomValues","_rnds8","Uint8Array","_rnds","_seedBytes","DOMutil","DataSet","DataView","Queue","Graph3d","graph3d","Camera","Filter","Point2d","Point3d","Slider","StepNumber","Hammer","keycharm","prepareElements","JSONcontainer","elementType","redundant","used","cleanupElements","resetElements","getSVGElement","svgContainer","createElementNS","getDOMElement","DOMContainer","insertBefore","drawPoint","groupTemplate","labelObj","setAttributeNS","size","label","xOffset","yOffset","content","textContent","drawBar","rect","_options","_fieldId","fieldId","_type","_subscribers","setOptions","_stringify2","queue","_queue","destroy","on","subscribers","subscribe","off","unsubscribe","_trigger","params","senderId","subscriber","addedIds","me","_addItem","items","update","updatedIds","oldData","updatedData","addOrUpdate","oldItem","_updateItem","ids","firstType","returnType","itemIds","itemId","_getItem","order","_sort","_filterFields","resultant","getIds","getDataSet","mappedItems","filteredItem","itemFields","av","bv","remove","removedIds","removedItems","_remove","ident","clear","maxField","itemField","minField","distinct","fieldType","count","exists","types","raw","converted","delay","Infinity","_timeout","_extended","_flushIfNeeded","flush","original","method","context","entry","clearTimeout","setTimeout","_ids","_onEvent","setData","refresh","oldIds","newIds","viewOptions","getArguments","defaultFilter","dataSet","oldItems","updatedItems","container","SyntaxError","containerElement","dataGroup","DataGroup","dataPoints","Settings","setDefaults","DEFAULTS","colX","colY","colZ","colValue","colFilter","getMouseX","clientX","targetTouches","getMouseY","clientY","_assign","_assign2","Emitter","STYLE","filterLabel","legendLabel","xLabel","yLabel","zLabel","xValueLabel","yValueLabel","zValueLabel","showXAxis","showYAxis","showZAxis","showGrid","showPerspective","showShadow","keepAspectRatio","verticalRatio","dotSizeRatio","dotSizeMinFraction","dotSizeMaxFraction","showAnimationControls","animationInterval","animationPreload","animationAutoStart","axisColor","gridColor","xCenter","yCenter","DOT","tooltip","tooltipStyle","padding","borderRadius","boxShadow","line","borderLeft","dot","showLegend","backgroundColor","dataColor","fill","stroke","strokeWidth","cameraPosition","horizontal","vertical","distance","xBarWidth","yBarWidth","valueMin","valueMax","xMin","xMax","xStep","yMin","yMax","yStep","zMin","zMax","zStep","_setScale","xRange","range","yRange","zRange","z","valueRange","center","zCenter","camera","setArmLocation","_convert3Dto2D","point3d","translation","_convertPointToTranslation","_convertTranslationToScreen","cameraLocation","getCameraLocation","cameraRotation","getCameraRotation","ax","ay","az","cx","cy","cz","sinTx","sin","cosTx","cos","sinTy","cosTy","sinTz","cosTz","bx","by","ex","eye","ey","ez","dx","dy","dz","getArmLength","currentXCenter","frame","canvas","currentYCenter","_calcTranslations","points","trans","screen","transBottom","bottom","dist","sortDepth","_checkValueField","BARCOLOR","BARSIZE","DOTCOLOR","DOTSIZE","_initializeData","rawData","initializeData","getDataTable","dataFilter","setOnLoadCallback","redraw","getDataPoints","_getDataPoints","GRID","SURFACE","dataX","getDistinctValues","dataY","dataMatrix","xIndex","yIndex","pointRight","pointTop","pointCross","LINE","pointNext","noCanvas","fontWeight","innerHTML","onmousedown","_onMouseDown","ontouchstart","_onTouchStart","onmousewheel","_onWheel","ontooltip","_onTooltip","onclick","_onClick","_setSize","_resizeCanvas","clientHeight","animationStart","slider","play","animationStop","stop","_resizeCenter","getCameraPosition","getArmRotation","_readData","_redrawFilter","setPointDrawingMethod","reload","BAR","_redrawBarGraphPoint","_redrawBarColorGraphPoint","_redrawBarSizeGraphPoint","_redrawDotGraphPoint","DOTLINE","_redrawDotLineGraphPoint","_redrawDotColorGraphPoint","_redrawDotSizeGraphPoint","_redrawSurfaceGraphPoint","_redrawGridGraphPoint","_redrawLineGraphPoint","_pointDrawingMethod","_redrawSlider","_redrawClear","_redrawAxis","_redrawDataGraph","_redrawInfo","_redrawLegend","_getContext","getContext","lineJoin","lineCap","clearRect","_dotSize","_getLegendWidth","isSizeLegend","isValueLegend","margin","lineWidth","font","ymax","hue","_hsv2rgb","strokeStyle","beginPath","moveTo","lineTo","strokeRect","widthMin","fillStyle","closePath","legendMin","legendMax","start","end","getCurrent","_line","textAlign","textBaseline","fillText","visible","setValues","setPlayInterval","onchange","getIndex","selectValue","setOnChangeCallback","lineStyle","getLabel","getSelectedValue","drawAxisLabelX","text","armAngle","yMargin","point2d","drawAxisLabelY","drawAxisLabelZ","_line3d","from2d","to2d","prettyStep","xText","yText","zText","gridLenX","gridLenY","textMargin","armVector","defaultXStep","defaultYStep","defaultZStep","from3d","xMin2d","xMax2d","H","V","Hi","X","_getStrokeWidth","_redrawBar","xWidth","yWidth","borderColor","surface","surfaces","corners","avg","transCenter","_polygon","_drawCircle","radius","_calcRadius","arc","PI","_getColorsRegular","_getColorsColor","_getColorsSize","colors","fraction","dotSize","sizeMin","sizeRange","cross","topSideVisible","showGrayBottom","aDiff","bDiff","crossproduct","crossProduct","zAvg","_drawGridLine","_storeMousePosition","startMouseX","startMouseY","_startCameraOffset","getOffset","leftButtonDown","_onMouseUp","which","button","touchDown","startStart","startEnd","startArmRotation","cursor","onmousemove","_onMouseMove","onmouseup","moving","diffX","diffY","ctrlKey","scaleX","scaleY","offXNew","armLength","offYNew","setOffset","horizontalNew","verticalNew","snapValue","setArmRotation","parameters","emit","onclick_callback","boundingRect","mouseX","mouseY","dataPoint","_dataPointFromXY","showTooltip","tooltipTimeout","_hideTooltip","_showTooltip","ontouchmove","_onTouchMove","ontouchend","_onTouchEnd","wheelDelta","detail","oldLength","newLength","setArmLength","_insideTriangle","triangle","bs","cs","closestDataPoint","closestDist","triangle1","triangle2","distX","distY","sqrt","hasBars","dom","contentWidth","contentHeight","offsetHeight","lineHeight","dotWidth","dotHeight","setCameraPosition","setSize","assign","$assign","A","K","aLen","mixin","_callbacks","once","removeListener","removeAllListeners","callbacks","cb","listeners","hasListeners","sub","sum","armLocation","armRotation","cameraOffset","offsetMultiplier","calculateCameraOrientation","_sign","_sign2","mul","rot","xa","za","column","graph","onLoadCallback","loadInBackground","isLoaded","getLoadedProgress","getColumn","getValues","getValue","dataView","progress","prev","bar","MozBorderRadius","slide","togglePlay","onChangeCallback","playTimeout","playInterval","playLoop","setIndex","playNext","interval","clearInterval","getPlayInterval","setPlayLoop","doLoop","onChange","indexToLeft","startClientX","startSlideX","leftToIndex","_start","_end","precision","_current","setRange","isNumeric","setStep","calculatePrettyStep","log10","log","LN10","step1","step2","step5","toPrecision","getStep","checkFirst","Range","combine","expand","newMin","newMax","isEmpty","capitalize","str","prefixFieldName","fieldName","forceCopy","dst","srcKey","dstKey","safeCopy","OPTIONKEYS","PREFIXEDOPTIONKEYS","setSpecialSettings","setBackgroundColor","setDataColor","setStyle","setShowLegend","isLegendGraphStyle","getStyleNumberByName","styleName","STYLENAME","checkStyleNumber","valid","styleNumber","borderWidth","borderStyle","camPos","dot-line","dot-color","dot-size","grid","bar-color","bar-size","dataTable","_onChange","withBars","defaultXBarWidth","getSmallestDifference","defaultYBarWidth","_initializeRange","getColumnRange","_setRangeDefaults","defaultValueMin","defaultValueMax","_collectRangeSettings","upper","barWidth","range_label","step_label","settings","smallest_diff","getNumberOfRows","defaultMin","defaultMax","propagating","__WEBPACK_AMD_DEFINE_FACTORY__","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","_firstTarget","hammer","events","propagatedHandler","srcEvent","_handled","stopped","stopPropagation","srcStop","bind","firstTarget","elemHammer","_handlers","Manager","PropagatingHammer","wrapper","pointerType","isFirst","handler","eventType","hammers","idx","exportName","setTimeoutContext","timeout","bindFn","invokeArrayArg","each","message","deprecationMessage","inherit","child","properties","childP","baseP","_super","boolOrFn","TYPE_FUNCTION","ifUndefined","val1","val2","addEventListeners","splitStr","removeEventListeners","inStr","find","inArray","findByKey","uniqueArray","results","prefixed","property","camelProp","VENDOR_PREFIXES","uniqueId","_uniqueId","getWindowForElement","doc","ownerDocument","defaultView","parentWindow","Input","manager","inputTarget","domHandler","ev","enable","init","createInputInstance","inputClass","SUPPORT_POINTER_EVENTS","PointerEventInput","SUPPORT_ONLY_TOUCH","TouchInput","SUPPORT_TOUCH","TouchMouseInput","MouseInput","inputHandler","pointersLen","pointers","changedPointersLen","changedPointers","INPUT_START","isFinal","INPUT_END","INPUT_CANCEL","session","computeInputData","recognize","prevInput","pointersLength","firstInput","simpleCloneInputData","firstMultiple","offsetCenter","getCenter","timeStamp","deltaTime","angle","getAngle","getDistance","computeDeltaXY","offsetDirection","getDirection","deltaX","deltaY","overallVelocity","getVelocity","overallVelocityX","overallVelocityY","getScale","rotation","getRotation","maxPointers","computeIntervalInputData","offsetDelta","prevDelta","velocity","velocityX","velocityY","last","lastInterval","COMPUTE_INTERVAL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","PROPS_XY","atan2","PROPS_CLIENT_XY","evEl","MOUSE_ELEMENT_EVENTS","evWin","MOUSE_WINDOW_EVENTS","pressed","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","pointerEvents","SingleTouchInput","evTarget","SINGLE_TOUCH_TARGET_EVENTS","SINGLE_TOUCH_WINDOW_EVENTS","started","normalizeSingleTouches","all","touches","changed","changedTouches","TOUCH_TARGET_EVENTS","targetIds","getTouches","allTouches","INPUT_MOVE","identifier","changedTargetTouches","touch","mouse","primaryTouch","lastTouches","recordTouches","eventData","setLastTouch","lastTouch","lts","removeLastTouch","DEDUP_TIMEOUT","isSyntheticEvent","DEDUP_DISTANCE","TouchAction","cleanTouchActions","actions","TOUCH_ACTION_NONE","hasPanX","TOUCH_ACTION_PAN_X","hasPanY","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_AUTO","Recognizer","state","STATE_POSSIBLE","simultaneous","requireFail","stateStr","STATE_CANCELLED","STATE_ENDED","STATE_CHANGED","STATE_BEGAN","directionStr","getRecognizerByNameIfManager","otherRecognizer","recognizer","AttrRecognizer","PanRecognizer","pX","pY","PinchRecognizer","PressRecognizer","_timer","_input","RotateRecognizer","SwipeRecognizer","TapRecognizer","pTime","pCenter","recognizers","preset","handlers","oldCssProps","touchAction","toggleCssProps","recognizeWith","requireFailure","cssProps","triggerDomEvent","gestureEvent","createEvent","initEvent","gesture","dispatchEvent","TEST_ELEMENT","nextKey","dest","merge","MOBILE_REGEX","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","DIRECTION_ALL","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM","2","3","4","5","MSPointerEvent","PointerEvent","removePointer","eventTypeNormalized","isTouch","storeIndex","pointerId","SINGLE_TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TOUCH_INPUT_MAP","inputEvent","inputData","isMouse","sourceCapabilities","firesTouchEvents","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_MAP","touchMap","cssSupports","CSS","supports","compute","getTouchAction","preventDefaults","prevented","hasNone","isTapPointer","isTapMovement","isTapTouchTime","preventSrc","STATE_RECOGNIZED","dropRecognizeWith","dropRequireFailure","hasRequireFailures","canRecognizeWith","additionalEvent","tryEmit","canEmit","inputDataClone","reset","process","attrTest","optionPointers","isRecognized","directionTest","hasMoved","inOut","validPointers","validMovement","validTime","taps","posThreshold","validTouchTime","failTimeout","validInterval","validMultiTap","tapCount","VERSION","domEvents","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","force","curRecognizer","existing","STATE_FAILED","Tap","Pan","Swipe","Pinch","Rotate","Press","_exportFunctions","_bound","keydown","keyup","fromCharCode","down","handleEvent","up","keyCode","bound","shiftKey","bindAll","getKey","unbind","newBindings","Timeline","Graph2d","timeline","Core","DateUtil","TimeStep","components","Item","BackgroundItem","BoxItem","PointItem","RangeItem","BackgroundGroup","Component","CurrentTime","CustomTime","DataAxis","DataScale","GraphGroup","Group","ItemSet","Legend","LineGraph","TimeAxis","groups","forthArgument","throttleRedraw","defaultOptions","autoResize","orientation","axis","maxHeight","minHeight","rtl","directionFromDom","domNode","getComputedStyle","parentElement","rollingMode","domProps","emitter","hiddenDates","timeAxis","toScreen","_toScreen","toGlobalScreen","_toGlobalScreen","toTime","_toTime","toGlobalTime","_toGlobalTime","timeAxis2","currentTime","itemSet","itemsData","groupsData","getEventProperties","ondblclick","oncontextmenu","onmouseover","onpointerdown","onpointermove","onpointerup","fitDone","getItemRange","setWindow","animation","fit","setGroups","setItems","_redraw","printStyle","allOptions","configureOptions","Configurator","Validator","_createConfigurator","markDirty","refreshItems","validate","selection","getSelection","setSelection","newDataSet","group","focus","itemData","dataset","getDataRange","minItem","maxItem","getStart","getEnd","factor","groupShowing","show","repositionX","startSide","getWidthRight","endSide","getWidthLeft","lhs","rhs","centerContainer","itemFromTarget","groupFromTarget","customTime","customTimeFromTarget","snap","snappedTime","what","foreground","labelSet","groupId","pageX","pageY","toggleRollingMode","rolling","stopRolling","startRolling","millisecondsPerPixelCache","deltaDifference","scaleOffset","startToFront","endToFront","moveable","zoomable","zoomMin","zoomMax","follow","animationTimer","_onDragStart","_onDrag","_onDragEnd","_onMouseWheel","_onTouch","_onPinch","rollingModeBtn","validateDirection","conversion","currentTimeTimer","byUser","finalStart","finalEnd","_cancelAnimation","initStart","initEnd","easingName","easingFunction","initTime","anyChanged","dragging","ease","_applyRange","updateHiddenDates","timeoutID","getMillisecondsPerPixel","newStart","newEnd","getRange","totalHidden","previousDelta","_isInsideRange","allowDragging","getHiddenDurationBetween","diffRange","safeStart","snapAwayFromHidden","safeEnd","startDate","endDate","zoomKey","horizontalScroll","pointerDate","pointer","getPointer","_pointerToDate","zoom","centerDate","hiddenDuration","hiddenDurationBefore","getHiddenDurationBefore","hiddenDurationAfter","move","onTouch","onRelease","offTouch","offRelease","disablePreventDefaultVertically","pinchRecognizer","_isResized","resized","_previousWidth","_previousHeight","convertHiddenOptions","repeat","dateItem","totalRange","pixelTime","runUntil","dayOffset","removeDuplicates","startHidden","isHidden","endHidden","rangeStart","rangeEnd","hidden","safeDates","printDates","stepOverHiddenDates","timeStep","previousTime","stepInHidden","currentValue","current","switchedYear","switchedMonth","switchedDay","hiddenBeforeStart","getHiddenDurationBeforeStart","rangeAfterEnd","correctTimeForHidden","totalDuration","partialDuration","accumulatedHiddenDuration","getAccumulatedHiddenDuration","timeOffset","requiredDuration","previousPoint","correctionEnabled","hammerUtil","Activator","onMouseWheel","isActive","verticalScroll","scrollTop","adjusted","_setScrollTop","onMouseScrollSide","handleDragOver","itemAddedToTimeline","dataTransfer","dropEffect","handleDrop","getData","_onAddItem","backgroundVertical","backgroundHorizontal","leftContainer","rightContainer","shadowTop","shadowBottom","shadowTopLeft","shadowBottomLeft","shadowTopRight","shadowBottomRight","scrollTopMin","initialDrawDone","_origRedraw","initialItemSetDrawn","customTimes","redrawCount","drawPoints","onRender","clickToUse","activator","_initAutoResize","component","configurator","configure","appliedOptions","setModuleOptions","active","_stopAutoResize","setCustomTime","getCustomTime","setCustomTimeTitle","title","setCustomTitle","addCustomTime","timestamp","removeCustomTime","getVisibleItems","getWindow","zoomIn","percentage","newInterval","zoomOut","borderRootHeight","borderRootWidth","autoHeight","containerHeight","scrollbarWidth","_setDOM","_updateScrollTop","visibilityTop","visibilityBottom","contentsOverflow","centerWidth","repaint","setCurrentTime","getCurrentTime","_startAutoResize","_onResize","lastWidth","lastHeight","watchTimer","setInterval","initialScrollTop","oldScrollTop","_getScrollTop","newScrollTop","align","stackSubgroups","groupOrderSwap","fromGroup","toGroup","targetOrder","groupOrder","selectable","multiselect","itemsAlwaysDraggable","editable","updateTime","updateGroup","overrideItems","groupEditable","onAdd","onUpdate","onMove","onRemove","onMoving","onAddGroup","onMoveGroup","onRemoveGroup","showTooltips","followMouse","overflowMethod","tooltipOnItemUpdateTime","itemOptions","itemListeners","_onAdd","_onUpdate","_onRemove","groupListeners","_onAddGroups","_onUpdateGroups","_onRemoveGroups","groupIds","popup","touchParams","groupTouchParams","Popup","UNGROUPED","BACKGROUND","box","_updateUngrouped","backgroundGroup","_onSelectItem","_onMultiSelectItem","groupHammer","_onGroupClick","_onGroupDragStart","_onGroupDrag","_onGroupDragEnd","_onMouseOver","_onMouseOut","dirty","displayed","unselect","select","rawVisibleItems","isVisible","visibleItems","_deselect","_orderGroups","visibleInterval","zoomed","lastVisibleInterval","scrolled","lastRangeStart","changedStackOption","lastStack","changedStackSubgroupsOption","lastStackSubgroups","forceRestack","firstGroup","_firstGroup","firstMargin","nonFirstMargin","groupMargin","groupResized","firstGroupIndex","firstGroupId","ungrouped","_getGroupId","getLabelSet","oldItemsData","getItems","nestedGroups","nestedGroupId","updatedNestedGroup","nestedInGroup","showNested","_order","getGroups","removeItem","_getType","selected","_removeItem","groupData","groupOptions","_orderNestedGroups","newGroupIdsOrder","nestedGroup","nestedGroupIds","_constructByEndArray","endArray","dragLeftItem","dragRightItem","itemProps","_getGroupIndex","itemIsDragging","selectedItem","initialX","dragLeft","_cloneItemData","dragRight","baseGroupIndex","itemsToDrag","groupIndex","groupOffset","metaKey","_onDragStartAddItem","xAbs","newItem","offsetLeft","updateGroupAllowed","newGroupBase","initial","initialEnd","initialStart","newOffset","_moveToGroup","oldGroup","collapsedDirClassName","originalOrder","movingUp","targetGroupTop","draggedGroupHeight","targetGroup","draggedGroup","newOrder","origOrder","draggedId","numGroups","curPos","orgOffset","slippedPosition","switchGroup","shouldBeGroup","switchGroupId","oldSelection","newSelection","itemFromRelatedTarget","getTitle","setText","setPosition","offsetTop","_onUpdateItem","newItemData","itemGroup","lastSelectedGroup","multiselectPerGroup","_getItemRange","_item","itemFromElement","cur","relatedTarget","itemSetFromTarget","minimumStep","autoScale","FORMAT","minorLabels","majorLabels","setMoment","setFormat","setMinimumStep","roundToMinor","hasNext","setScale","setAutoScale","stepYear","stepMonth","stepDay","stepHour","stepMinute","stepSecond","stepMillisecond","isMajor","getLabelMinor","getLabelMajor","getClassName","even","today","_moment","currentWeek","currentMonth","subgroups","subgroupIndex","subgroupOrderer","subgroupOrder","stackDirty","itemsInRange","byStart","byEnd","checkRangedItems","marker","templateFunction","Element","paddingRight","paddingLeft","getLabelWidth","markerHeight","lastMarkerHeight","_calculateSubGroupHeights","lastIsVisible","_isGroupVisible","restack","_updateSubgroupsSizes","customOrderedItems","_updateItemsInRange","nostack","_calculateHeight","repositionY","resetSubgroups","subgroup","setParent","_addToSubgroup","orderSubgroups","_checkIfVisible","subgroupId","sortArray","sortField","_removeFromSubgroup","itemIndex","removeFromDataSet","startArray","orderByStart","orderByEnd","oldVisibleItems","visibleItemsLookup","lowerBound","upperBound","searchFunction","_checkIfVisibleWithReference","initialPosByStart","_traceVisible","initialPosByEnd","initialPos","breakCondition","changeSubgroup","oldSubgroup","newSubgroup","collidingItem","jj","collision","newTop","otherSubgroup","collisionByTimes","baseClassName","visibleFrame","_updateContents","_updateDataAttributes","_updateStyle","maxWidth","_repaintOnItemUpdateTimeTooltip","_repaintDeleteButton","_repaintDragCenter","_repaintDragLeft","_repaintDragRight","limitSize","contentStartPosition","parentWidth","boxWidth","_updateEditStatus","dragCenter","dragCenterItem","deleteButton","onItemUpdateTimeTooltip","itemDistanceFromTop","template","itemVisibleFrameContent","visibleFrameTemplateFunction","frameElement","itemVisibleFrameContentElement","getElementsByClassName","visibleFrameTemplate","_contentToString","dataAttributes","attributes","setAttribute","removeAttribute","outerHTML","widthInMs","previousRight","previousLeft","itemSetHeight","marginLeft","marginRight","itemSubgroup","_classCallCheck2","_classCallCheck3","_createClass2","_createClass3","doShow","isLeft","isTop","instance","_defineProperty","_defineProperty2","protoProps","staticProps","desc","lines","majorTexts","minorTexts","lineTop","showMinorLabels","showMajorLabels","maxMinorChars","parentChanged","_calculateCharSize","minorLabelHeight","minorCharHeight","majorLabelHeight","majorCharHeight","minorLineHeight","minorLineWidth","majorLineHeight","majorLineWidth","foregroundNextSibling","nextSibling","backgroundNextSibling","_repaintLabels","timeLabelsize","minorCharWidth","xNext","showMinorGrid","prevWidth","labelMinor","xFirstMajorLabel","_repaintMinorText","_repaintMajorText","_repaintMajorLine","_repaintMinorLine","warnedForOverflow","leftTime","leftText","widthText","majorCharWidth","pop","createTextNode","childNodes","measureCharMinor","measureCharMajor","overlay","_onTapOverlay","onClick","_hasParent","deactivate","escListener","activate","eventParams","drag","warned","substring","showCurrentTime","errorFound","referenceOptions","subObject","usedOptions","path","check","__any__","getSuggestion","__type__","checkFields","referenceOption","refOptionObj","optionType","refOptionType","print","printLocation","localSearch","findInOptions","globalSearch","indexMatch","closestMatch","recursive","closestMatchPath","lowerCaseOption","op","levenshteinDistance","_j","_j2","matrix","bool","boolean","function","any","null","groupsDraggable","ColorPicker","parentModule","defaultContainer","pixelRatio","changedOptions","allowCreation","initialized","popupCounter","showButton","moduleOptions","domElements","popupDiv","popupLimit","popupHistory","colorPicker","_removePopup","_clean","_this","counter","_handleObject","_makeItem","_makeHeader","generateButton","_printOptions","onmouseout","optionsContainer","_push","_showPopupIfNeeded","_len","_key","div","objectLabel","selectedValue","_update","_makeLabel","popupString","popupValue","oninput","_setupPopup","_this2","html","hideTimeout","deleteTimeout","_this3","correspondingElement","checkbox","checked","_this4","defaultColor","_showColorPicker","_this5","insertTo","setColor","setUpdateCallback","colorString","setCloseCallback","checkOnly","visibleInSet","subObj","newPath","_getValue","_handleArray","_makeTextInput","_makeCheckbox","draw","physics","solver","enabledPath","enabledValue","_label","error","_makeColorField","_makeDropdown","_makeRange","_constructOptions","optionsObj","getOptions","generated","centerCoordinates","hueCircle","initialColor","previousColor","applied","updateCallback","closeCallback","_bindHammer","htmlColors","black","navy","darkblue","mediumblue","darkgreen","teal","darkcyan","deepskyblue","darkturquoise","mediumspringgreen","lime","springgreen","aqua","cyan","midnightblue","dodgerblue","lightseagreen","forestgreen","seagreen","darkslategray","limegreen","mediumseagreen","turquoise","royalblue","steelblue","darkslateblue","mediumturquoise","indigo","darkolivegreen","cadetblue","cornflowerblue","mediumaquamarine","dimgray","slateblue","olivedrab","slategray","lightslategray","mediumslateblue","lawngreen","chartreuse","aquamarine","maroon","purple","olive","gray","skyblue","lightskyblue","blueviolet","darkred","darkmagenta","saddlebrown","darkseagreen","lightgreen","mediumpurple","darkviolet","palegreen","darkorchid","yellowgreen","sienna","brown","darkgray","lightblue","greenyellow","paleturquoise","lightsteelblue","powderblue","firebrick","darkgoldenrod","mediumorchid","rosybrown","darkkhaki","silver","mediumvioletred","indianred","peru","chocolate","tan","lightgrey","palevioletred","thistle","orchid","goldenrod","crimson","gainsboro","plum","burlywood","lightcyan","lavender","darksalmon","violet","palegoldenrod","lightcoral","khaki","aliceblue","honeydew","azure","sandybrown","wheat","beige","whitesmoke","mintcream","ghostwhite","salmon","antiquewhite","linen","lightgoldenrodyellow","oldlace","fuchsia","magenta","deeppink","orangered","tomato","hotpink","coral","darkorange","lightsalmon","orange","lightpink","pink","gold","peachpuff","navajowhite","moccasin","bisque","mistyrose","blanchedalmond","papayawhip","lavenderblush","seashell","cornsilk","lemonchiffon","floralwhite","snow","yellow","lightyellow","ivory","white","setInitial","htmlColor","_isColorString","rgbaArray","_rgbaArray","rgbObj","alpha","_setColor","_generateHueCircle","_hide","_updatePicker","alert","angleConvert","colorPickerSelector","colorPickerCanvas","pixelRation","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","setTransform","putImageData","circle","brightnessRange","opacityRange","initialColorDiv","newColorDiv","colorPickerDiv","opacityDiv","brightnessDiv","arrowDiv","_setOpacity","_setBrightness","brightnessLabel","opacityLabel","cancelButton","applyButton","_apply","saveButton","_save","loadButton","_loadLast","pinch","_moveSelector","sat","sfac","fillRect","getImageData","centerY","centerX","newLeft","linegraph","initialLoad","getLegend","isGroupVisible","yAxisLeft","yAxisRight","legendLeft","legendRight","screenToValue","yAxisOrientation","defaultGroup","sampling","graphHeight","shaded","barChart","sideBySide","interpolation","parametrization","dataAxis","legend","abortedGraphUpdate","updateSVGheight","updateSVGheightOnResize","forceGraphUpdate","lastStart","svgElements","groupsUsingDefaultStyles","svg","framework","Bars","Lines","Points","_removeGroup","_updateAllGroupData","removeGroup","_updateGroup","addGroup","groupsContent","idMap","groupCounts","existingItemsMap","existing_items","extended","orginalY","_updateGraph","rangePerPixelInv","_getSortedGroupIds","grouplist","zIndex","bz","groupRanges","minDate","maxDate","_getRelevantData","_applySampling","_convertXcoordinates","_getYRanges","_updateYAxis","below","excludeFromStacking","_stack","_convertYcoordinates","calcPath","subGroupId","drawShading","subData","subPrevPoint","subNextPoint","dateComparator","first","dataContainer","increment","amountOfPoints","xDistance","pointsPerPixel","sampledData","combinedDataLeft","combinedDataRight","getYRange","getStackedYRange","minVal","maxVal","yAxisLeftUsed","yAxisRightUsed","minLeft","minRight","maxLeft","maxRight","ignore","_toggleAxisVisiblity","drawIcons","master","masterAxis","lineOffset","tempGroups","axisUsed","datapoints","screen_x","screen_y","screen_end","svgHeight","convertValue","setZeroPosition","linegraphOptions","icons","majorLinesOffset","minorLinesOffset","labelOffsetX","labelOffsetY","iconWidth","alignZeros","linegraphSVG","DOMelements","labels","conversionFactor","minWidth","stepPixels","zeroCrossing","amountOfSteps","iconsRemoved","amountOfGroups","lineContainer","graphOptions","_redrawGroupIcons","iconOffset","groupArray","iconHeight","_cleanupIcons","activeGroups","_redrawLabels","_redrawTitle","customRange","autoScaleEnd","autoScaleStart","followScale","maxLabelSize","getLines","major","_redrawLabel","_redrawLine","titleWidth","titleCharHeight","characterHeight","largestWidth","textMinor","textMajor","textTitle","measureCharTitle","titleCharWidth","zeroAlign","formattingFunction","majorSteps","minorSteps","customLines","minorStepIdx","magnitudefactor","determineScale","rounded","setCharHeight","setHeight","minimumStepValue","orderOfMagnitude","solutionFound","is_major","getFirstMajor","majorStep","formatValue","bottomOffset","oldStepIdx","oldStart","oldEnd","increaseMagnitude","decreaseMagnitude","otherZero","otherStep","newRange","myOriginalZero","majorOffset","zeroOffset","pixels","usingDefaultStyle","zeroPosition","drawIcon","icon","Bargraph","fillHeight","outline","originalWidth","bar1Height","bar2Height","processedGroupData","coreDistance","drawData","combinedData","intersections","barPoints","_getDataIntersections","heightOffset","_getSafeDrawData","amount","resolved","accumulatedNegative","accumulatedPositive","dataWidth","pointData","groupLabel","_getStackedYRange","xpos","getGroupTemplate","callbackResult","getCallback","Line","_catmullRom","_linear","fillPath","pathArray","subPathArray","dFill","zero","serializePath","inverse","_catmullRomUniform","p0","bp1","bp2","d1","d2","d3","N","d3powA","d2powA","d3pow2A","d2pow2A","d1pow2A","d1powA","side","iconSize","iconSpacing","excludeFromLegend","textArea","scrollableHeight","drawLegendIcons","paddingTop","Network","network","Images","dotparser","gephiParser","convertDot","DOTToGraph","convertGephi","parseGephi","nodes","nodeIndices","edges","edgeIndices","eventListeners","onTap","onDoubleTap","onHold","onDragStart","onDrag","onDragEnd","onPinch","onMouseMove","onContext","functions","createNode","createEdge","view","bindEventListeners","images","Groups","Canvas","selectionHandler","SelectionHandler","interactionHandler","InteractionHandler","View","renderer","CanvasRenderer","PhysicsEngine","layoutEngine","LayoutEngine","clustering","ClusterEngine","manipulation","ManipulationSystem","nodesHandler","NodesHandler","edgesHandler","EdgesHandler","KamadaKawai","_require","_require2","layout","interaction","networkOptions","_updateVisibleIndices","nodeId","edgeId","_updateValueRange","unselectAll","dotData","gephi","gephiData","valueTotal","setValueRange","canvasToDOM","DOMtoCanvas","findNode","isCluster","openCluster","cluster","getNodesInCluster","clusterByConnection","clusterByHubsize","clusterOutliers","getSeed","enableEditMode","disableEditMode","addNodeMode","editNode","editNodeMode","addEdgeMode","editEdgeMode","deleteSelected","getPositions","storePositions","moveNode","getBoundingBox","getConnectedNodes","objectId","getConnectedEdges","startSimulation","stopSimulation","stabilize","getSelectedNodes","getSelectedEdges","getNodeAt","getEdgeAt","edge","selectNodes","selectEdges","getViewPosition","releaseNode","getOptionsFromConfigurator","CanvasRenderingContext2D","square","s2","ir","triangleDown","star","diamond","roundRect","r2d","ellipse_vis","ox","oy","xe","ye","xm","ym","bezierCurveTo","database","wEllipse","hEllipse","ymb","yeb","arrowEndpoint","xt","yt","xi","yi","xl","yl","xr","yr","circleEndpoint","xc","yc","dashedLine","x2","y2","pattern","patternLength","slope","distRemaining","patternIndex","dashLength","parseDOT","parseGraph","nextPreview","isAlphaNumeric","regexAlphaNumeric","setValue","addNode","graphs","attr","addEdge","getToken","tokenType","TOKENTYPE","NULL","isComment","DELIMITER","c2","DELIMITERS","IDENTIFIER","newSyntaxError","UNKNOWN","chop","parseStatements","parseStatement","subgraph","parseSubgraph","parseEdge","parseAttributeStatement","parseNodeStatement","subgraphs","parseAttributeList","maxLength","forEach2","elem1","elem2","setProp","convertAttr","mapping","visProp","visPropI","graphData","dotNode","graphNode","NODE_ATTR_MAPPING","image","shape","convertEdge","dotEdge","graphEdge","EDGE_ATTR_MAPPING","arrows","subEdge","fontsize","fontcolor","labelfontcolor","fontname","fillcolor","labeltooltip","{","}","[","]",";","=",",","->","--","gephiJSON","inheritColor","fixed","gEdges","gNodes","gEdge","gNode","edit","del","back","editEdge","addDescription","edgeDescription","editEdgeDescription","createEdgeError","deleteClusterError","editClusterError","_CachedImage","_CachedImage2","imageBroken","url","brokenUrl","imageToLoadBrokenUrlOn","onerror","imageToRedrawWith","cachedImage","img","onload","_fixImageCoordinates","_redrawWithImage","_tryloadBrokenUrl","imageToCache","CachedImage","NUM_ITERATIONS","Image","coordinates","_fillMipMap","drawImage","iterations","_to","_isImageOk","complete","naturalWidth","defaultIndex","groupsArray","defaultGroups","useDefaultGroups","optionFields","groupName","groupname","_index","Node","Label","nodesListeners","borderWidthSelected","brokenImage","face","strokeColor","vadjust","multi","bold","mod","boldital","ital","mono","labelHighlightBold","level","mass","scaling","maxVisible","drawThreshold","customScalingFunction","shadow","shapeProperties","borderDashes","useImageSize","useBorderWithImage","nodeOptions","parseOptions","updateShape","updateLabelModule","needsRefresh","_nodeId2","doNotEmit","oldNodesData","newNodes","positionInitially","changedData","dataChanged","clearPositions","dataArray","_node","_node2","boundingBox","nodeList","nodeObj","toId","fromId","edgeList","Box","Circle","CircularImage","Database","Diamond","Dot","Ellipse","Icon","Square","Star","Text","Triangle","TriangleDown","imagelist","baseSize","baseFontSize","predefinedPosition","labelModule","currentShape","checkMass","groupObj","choosify","_load_images","propagateFonts","imageObj","load","unselected","imageObjAlt","chooser","chosen","chosenNode","shadowColor","shadowSize","shadowX","shadowY","constrain","refreshNeeded","distanceToBorder","sizeDiff","fontDiff","getFormattingValues","updateBoundingBox","resize","parentOptions","newOptions","parsedColor","strId","_slicedToArray2","_slicedToArray3","edgelabel","pointToSelf","fontOptions","yLine","isEdgeLabel","elementOptions","labelDirty","constrainWidth","maxWdt","minWdt","widthConstraint","widthConstraintMaximum","widthConstraintMinimum","constrainHeight","minHgt","valign","heightConstraint","heightConstraintMinimum","heightConstraintValign","chosenLabel","margins","widthBias","heightBias","pathP","opt","getP","mods","modOptions","modDefaults","parseFontString","ratio","baseline","viewFontSize","calculateLabelSize","_drawBackground","_drawText","fontSize","_setAlignment2","_setAlignment","_setAlignment3","labelHeight","lineCount","blocks","block","_getColor2","_getColor","_getColor3","fontColor","strokeText","initialStrokeColor","_processLabel","markupSystem","system","decodeMarkupSystem","splitMarkdownBlocks","splitHtmlBlocks","beginable","spacing","buffer","modStack","modName","emitBlock","ch","unshift","selectedState","hoverState","accumulate","addAndAccumulate","_nlLines","splitBlocks","_values","words","atStart","measure","lastMeasure","pre","measureText","_values2","_measure","_values3","_words","_text","_measure2","_lastMeasure","_pre","_text2","_measure3","outOptions","inOptions","newOptionsArray","_isIterable2","_isIterable3","sliceIterator","_arr","_n","_e","_s","isIterable","_getPrototypeOf","_getPrototypeOf2","_possibleConstructorReturn2","_possibleConstructorReturn3","_inherits2","_inherits3","_NodeBase2","_NodeBase3","_NodeBase","__proto__","_setMargins","textSize","getTextSize","initContextForDraw","performFill","_updateBoundingBox","_addBoundingBoxMargin","$getPrototypeOf","ReferenceError","_setPrototypeOf","_setPrototypeOf2","subClass","superClass","setPrototypeOf","buggy","NodeBase","adjustSizes","shadowBlur","shadowOffsetX","shadowOffsetY","setLineDash","dashes","differentState","save","enableBorderDashes","disableBorderDashes","restore","enableShadow","disableShadow","performStroke","_CircleImageBase2","_CircleImageBase3","_CircleImageBase","diameter","_drawRawCircle","CircleImageBase","labelOffset","setImages","selection_changed","imageTmp","ratio_width","ratio_height","globalAlpha","drawImageAtPosition","labelDimensions","_resizeImage","switchImages","clip","_drawImageAtPosition","_drawImageLabel","_distanceToBorder","_ShapeBase2","_ShapeBase3","_ShapeBase","_drawShape","ShapeBase","sizeMultiplier","_icon","neutralborderWidth","selectionLineWidth","Edge","edgesListeners","scaleFactor","arrowStrikethrough","hoverWidth","selectionWidth","selfReferenceSize","smooth","forceDirection","roundness","edgeData","edgeOptions","reconnectEdges","updateEdgeType","_edgeId","oldEdgesData","edgesData","oldEdge","disconnect","showInternalIds","connect","cleanup","CubicBezierEdge","BezierEdgeDynamic","BezierEdgeStatic","StraightEdge","baseWidth","edgeType","connected","_setInteractionWidths","chosenEdge","toArrow","fromArrow","middleArrow","inheritsColor","toArrowScale","toArrowType","middleArrowScale","middleArrowType","fromArrowScale","fromArrowType","selectedWidth","changeInType","attachEdge","detachEdge","widthDiff","viaNode","getViaNode","arrowData","fromPoint","toPoint","getArrowData","drawLine","drawArrows","drawLabel","drawArrowHead","node1","node2","getPoint","translate","_rotateForLabelAlignment","_pointOnCircle","xFrom","yFrom","xTo","yTo","xObj","yObj","getDistanceToEdge","angleInDegrees","rotate","colorsDefined","_CubicBezierEdgeBase2","_CubicBezierEdgeBase3","_CubicBezierEdgeBase","viaNodes","via1","via2","_bezierCurve","x1","y1","_getViaCoordinates","nearNode","_findBorderPositionBezier","x3","y3","_ref","_ref2","_getDistanceToBezierEdge","_ref3","_ref4","vec","_BezierEdgeBase2","_BezierEdgeBase3","CubicBezierEdgeBase","_BezierEdgeBase","minDistance","lastX","lastY","_getDistanceToLine","_EdgeBase2","_EdgeBase3","BezierEdgeBase","_EdgeBase","distanceToPoint","difference","via","viaNode1","viaNode2","hasNode1","hasNode2","quadraticCurveTo","EdgeBase","colorDirty","getColor","_drawDashedLine","_drawLine","_getCircleData2","_getCircleData","_getCircleData3","_circle","lineDashOffset","_getCircleData4","_getCircleData5","_getCircleData6","_getCircleData7","_x","_y","_radius","_findBorderPosition","_findBorderPositionCircle","_getCircleData8","_getCircleData9","grd","createLinearGradient","fromColor","toColor","addColorStop","_getDistanceToEdge","_getCircleData10","_getCircleData11","py","something","arrowPoint","guideOffset","findBorderPosition","guidePos","_getCircleData12","_getCircleData13","_boundFunction","positionBezierNode","physicsChange","setupSupportNode","parentEdgeId","cr","xVia","yVia","stepX","stepY","_stepX","_stepY","_stepX2","_stepY2","pi","originalAngle","myAngle","_pi","_originalAngle","_myAngle","_stepX3","_stepY3","edgeSegmentLength","toBorderDist","toBorderPoint","borderPos","NetworkUtil","HierarchicalStatus","childrenReference","parentReference","levels","trees","isTree","parentNodeId","childNodeId","accumulator","_getMaxLevel","nodeA","nodeB","minLevel","min_x","max_x","min_y","max_y","initialRandomSeed","randomSeed","setPhysics","optionsBackup","improvedLayout","hierarchical","levelSeparation","nodeSpacing","treeSpacing","blockShifting","edgeMinimization","parentCentralization","sortMethod","setupHierarchicalLayout","layoutNetwork","getStaticType","prevHierarchicalState","adaptAllOptionsForHierarchicalLayout","backupPhysics","nodesArray","seededRandom","indices","positionDefined","clusterOptions","clusterEdgeProperties","startLength","before","clusterBridges","_declusterAll","info","kamadaKawai","springLength","solve","_shiftToCenter","getRangeCore","findCenter","clustersPresent","definedLevel","undefinedLevel","lastNodeOnLevel","treeIndex","distributionOrdering","distributionIndex","distributionOrderingPresence","_determineLevelsByHubsize","_determineLevelsDirected","_determineLevelsCustomCallback","ensureLevel","distribution","_getDistribution","_generateMap","_placeNodesByHierarchy","_condenseHierarchy","stillShifting","branches","shiftTree","_getPositionForHierarchy","_setPositionForHierarchy","getTreeSize","_isVertical","getTreeSizes","treeWidths","getBranchNodes","getBranchBoundary","branchMap","maxLevel","minSpace","maxSpace","branchNode","_getSpaceAroundNode2","_getSpaceAroundNode","_getSpaceAroundNode3","minSpaceNode","maxSpaceNode","getCollisionLevel","maxLevel1","getMaxLevel","maxLevel2","hasSameParent","parents1","parents2","shiftElementsCloser","centerParents","levelNodes","branchShiftCallback","centerParent","diffAbs","branchNodes1","branchNodes2","_getBranchBoundary","_getBranchBoundary2","max1","_getBranchBoundary3","_getBranchBoundary4","min2","minSpace2","_shiftBlock","_centerParent","minimizeEdgeLength","allEdges","nodeLevel","C2","referenceNodes","aboveEdges","otherNode","getFx","_i2","getDFx","_i3","getGuess","guess","guessMap","_i4","fx","dfx","nodePosition","branchNodes","_getBranchBoundary5","_getBranchBoundary6","minSpaceBranch","maxSpaceBranch","branchOffset","_getSpaceAroundNode4","_getSpaceAroundNode5","newPosition","reverse","treeSizes","shiftBy","useMap","prevNode","nextNode","nextPos","parents","parentId","_getCenterPosition","_getSpaceAroundNode6","_getSpaceAroundNode7","positionedNodes","nodeArray","_indexArrayToNodes","_sortNodeArray","handledNodeCount","_validatePositionAndContinue","parentLevel","childRef","_i5","childNode","childNodeLevel","previousPos","sharedParent","_findCommonParent","withChild","_placeBranchNodes","idArray","hubSizes","nodeIds","_getActiveEdges","levelDownstream","_getHubSizes","hubSize","_crawlNetwork","levelByDirection","levelA","cloneOptions","setMinLevelToZero","_this6","_this7","fillInRelations","addRelation","checkIfTree","_this8","startingNodeId","crawler","tree","_this9","shifter","childA","childB","_this10","iterateParents","parentRef","findParent","foundParent","branch","minPos","maxPos","allNodes","specificNodes","minY","maxY","minX","maxX","clonedOptions","amountOfConnections","BarnesHutSolver","Repulsion","HierarchicalRepulsion","SpringSolver","HierarchicalSpringSolver","CentralGravitySolver","ForceAtlas2BasedRepulsionSolver","ForceAtlas2BasedCentralGravitySolver","physicsBody","physicsNodeIndices","physicsEdgeIndices","forces","velocities","physicsEnabled","simulationInterval","requiresTimeout","previousStates","referenceState","freezeCache","renderTimer","adaptiveTimestep","adaptiveTimestepEnabled","adaptiveCounter","adaptiveInterval","stabilized","startedStabilization","stabilizationIterations","ready","barnesHut","theta","gravitationalConstant","centralGravity","springConstant","damping","avoidOverlap","forceAtlas2Based","repulsion","nodeDistance","hierarchicalRepulsion","maxVelocity","minVelocity","stabilization","updateInterval","onlyDynamicEdges","timestep","layoutFailed","initPhysics","updatePhysicsData","nodesSolver","edgesSolver","gravitySolver","modelOptions","viewFunction","simulationStep","_emitStabilized","startTime","physicsTick","runDoubleSpeed","amountOfIterations","calculateForces","moveNodes","revert","_evaluateStepQuality","positions","vx","vy","reference","maxNodeVelocity","averageNodeVelocity","nodeVelocity","_performStep","targetIterations","_freezeNodes","_stabilizationBatch","running","sendProgress","_finalizeStabilization","_restoreFrozenNodes","forceSize","arrowSize","barnesHutTree","thetaInversed","overlapAvoidanceFactor","nodeCount","_formBarnesHutTree","_getForceContribution","NW","NE","SW","SE","parentBranch","childrenCount","centerOfMass","calcSize","_calculateForces","gravityForce","fy","rootSize","halfRootSize","_splitBranch","_placeInTree","totalMass","totalMassInv","biggestSize","skipMassUpdate","_updateBranchMass","_placeInRegion","region","containedNode","_insertRegion","childSize","_drawBranch","RepulsionSolver","repulsingForce","HierarchicalRepulsionSolver","edgeLength","node3","_calculateSpringForce","springForce","springFx","springFy","totalFx","totalFy","correctionFx","correctionFy","_nodeId3","_BarnesHutSolver2","_BarnesHutSolver3","_BarnesHutSolver","degree","_CentralGravitySolver2","_CentralGravitySolver3","_CentralGravitySolver","Cluster","clusteredNodes","clusteredEdges","hubsize","_getHubSize","_checkOptions","nodesToCluster","refreshData","joinCondition","childNodesObj","childEdgesObj","_cluster","edgeCount","clusters","usedNodes","relevantEdgeCount","gatheringSuccessful","_getConnectedId","clusterByEdgeCount","clusterNodeProperties","parentClonedOptions","childClonedOptions","childNodeIDs","childEdge","otherNodeId","childKeys","createEdges","_edge","newEdge","clusteringEdgeReplacingId","edgeReplacedById","_backupEdgeOptions","allowSingleNodeCluster","processProperties","childNodesOptions","childEdgesOptions","_clonedOptions","clusterId","_getClusterPosition","clusterNode","containedNodes","containedEdges","_createClusterEdges","originalOptions","clusterNodeId","releaseFunction","clusterPosition","newPositions","_containedNode","_nodeId4","_containedNode2","_nodeId5","_containedNode3","edgesToBeDeleted","otherCluster","transferEdge","replacedEdge","_restoreEdge","clusteredNodeId","startEdgeId","allEdgeIds","getClusteredEdges","clusteredEdgeId","baseEdgeId","average","averageSquared","hubCounter","largestHub","variance","standardDeviation","hubThreshold","_Node2","_Node3","_Node","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","redrawRequested","renderingActive","renderRequests","allowRedraw","hideEdgesOnDrag","hideNodesOnDrag","_determineBrowserMethod","_resizeNodes","_requestRedraw","_startRendering","cancelAnimationFrame","_renderStep","_drawEdges","_drawNodes","alwaysShow","topLeft","bottomRight","viewableArea","isSelected","isBoundingBoxOverlappingWith","browserType","resizeTimer","resizeFunction","cameraState","canvasViewCenter","hammerFrame","_cleanUp","previousWidth","previousHeight","widthRatio","heightRatio","newScale","currentViewCenter","distanceFromCenter","tabIndex","_setPixelRatio","_prepareValue","emitEvent","oldWidth","oldHeight","previousRatio","_getCameraState","newWidth","newHeight","_setCameraState","_determinePixelRatio","_XconvertCanvasToDOM","_YconvertCanvasToDOM","_XconvertDOMtoCanvas","_YconvertDOMtoCanvas","animationSpeed","renderRefreshRate","animationEasingFunction","easingTime","sourceScale","targetScale","sourceTranslation","targetTranslation","lockedOnNodeId","lockedOnNodeOffset","touchTime","initialZoom","zoomLevel","yDistance","xZoomLevel","yZoomLevel","animationOptions","lockedOnNode","animateView","locked","_transitionRedraw","viewCenter","_lockedRedraw","finished","NavigationHandler","navigationHandler","popupObj","popupTimer","dragNodes","dragView","keyboard","speed","bindToWindow","navigationButtons","tooltipDelay","zoomView","pinched","checkSelectionChanges","_generateClickEvent","previousSelection","selectAdditionalOnPoint","selectOnPoint","currentSelection","deselectedItems","_determineDifference","selectedItems","firstSet","secondSet","arrayDiff","firstArr","secondArr","selectObject","selectionObj","xFixed","yFixed","scaleOld","preScaleDragPointer","scaleFrac","tx","ty","postScaleDragPointer","popupVisible","_checkHidePopup","_checkShowPopup","hoverObject","pointerObj","previousPopupObjId","nodeUnderCursor","popupType","overlappingNodes","isOverlappingWith","overlappingEdges","popupTargetType","popupTargetId","_pointerToPositionObject","stillOnObj","overNode","iconsCreated","navigationHammers","boundFunctions","activated","configureKeyboardBindings","loadNavigationElements","cleanNavigation","navigationDOM","navigationDivs","navigationDivActions","_fit","bindToRedraw","_stopMovement","boundAction","unbindFromRedraw","hoverObj","selectConnectedEdges","hoverConnectedEdges","updateSelection","selectionChanged","deselectObject","emptySelection","DOM","highlightEdges","_selectConnectedEdges","_addToSelection","_removeFromSelection","canvasPos","returnNode","positionObject","_getAllNodesOverlappingWith","_getEdgesOverlappingWith","returnEdge","mindist","overlappingEdge","_unselectConnectedEdges","clusterSize","_addToHover","hoverChanged","blurObject","_hoverConnectedEdges","RangeError","editMode","manipulationDiv","editModeDiv","closeDiv","manipulationHammers","temporaryUIFunctions","temporaryEventFunctions","temporaryIds","guiEnabled","inMode","selectedControlNode","initiallyActive","deleteNode","deleteEdge","controlNodeStyle","_restore","_setup","showManipulatorToolbar","_createEditButton","manipulationDOM","selectedNodeCount","_getSelectedNodeCount","selectedEdgeCount","_getSelectedEdgeCount","selectedTotalCount","needSeperator","_createAddNodeButton","_createSeperator","_createAddEdgeButton","_createEditNodeButton","_createEditEdgeButton","_createDeleteButton","_bindHammerToDiv","toggleEditMode","_temporaryBindEvent","_createBackButton","_createDescription","_performAddNode","_getSelectedNode","finalizedData","_temporaryBindUI","_handleConnect","_finishConnect","_dragControlNode","editWithoutDrag","edgeBeingEditedId","_performEditEdge","controlNodeFrom","_getNewTargetNode","controlNodeTo","_controlNodeTouch","_controlNodeDragStart","_controlNodeDrag","_controlNodeDragEnd","findBorderPositions","selectedNodes","selectedEdges","deleteFunction","_createWrappers","_removeManipulationDOM","_createButton","_cleanManipulatorHammers","_cleanupTemporaryNodesAndEdges","_unbindTemporaryUIs","_unbindTemporaryEvents","deleteBtnClass","labelClassName","newFunction","boundFunction","UIfunctionName","functionName","eventName","domElement","indexTempEdge","indexTempNode","fromSelect","toSelect","overlappingNodeIds","targetNode","connectionEdge","connectFromId","_performAddEdge","clickData","defaultData","sourceNodeId","targetNodeId","eeFunct","maximum","minimum","_FloydWarshall","_FloydWarshall2","edgeStrength","distanceSolver","edgesArray","ignoreClusters","D_matrix","getDistances","_createL_matrix","_createK_matrix","_createE_matrix","maxIterations","maxEnergy","highE_nodeId","dE_dx","dE_dy","delta_m","subIterations","_getHighestEnergyNode2","_getHighestEnergyNode","_getHighestEnergyNode3","_moveNode","_getEnergy2","_getEnergy","_getEnergy3","maxEnergyNodeId","dE_dx_max","dE_dy_max","nodeIdx","_getEnergy4","_getEnergy5","_E_sums$m","E_sums","d2E_dx2","d2E_dxdy","d2E_dy2","x_m","y_m","km","K_matrix","lm","L_matrix","iIdx","x_i","y_i","kmat","lmat","denominator","_updateE_matrix","E_matrix","mIdx","_mIdx","colm","kcolm","lcolm","cell","oldDx","oldDy","FloydWarshall","knode","inode","icolm","jnode","jcolm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA,cAEA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD,IACQ,kBAAXG,SAAyBA,OAAOC,IAC9CD,UAAWH,GACe,gBAAZC,SACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,KACbK,KAAM,WACT,MAAgB,UAAUC,GAKhB,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUP,OAGnC,IAAIC,GAASO,EAAiBD,IAC7BP,WACAS,GAAIF,EACJG,QAAQ,EAUT,OANAL,GAAQE,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOS,QAAS,EAGTT,EAAOD,QAvBf,GAAIQ,KAqCJ,OATAF,GAAoBM,EAAIP,EAGxBC,EAAoBO,EAAIL,EAGxBF,EAAoBQ,EAAI,GAGjBR,EAAoB,KAK/B,SAAUL,EAAQD,EAASM,GAI/B,GAAIS,GAAOT,EAAoB,EAG/BS,GAAKC,OAAOhB,EAASM,EAAoB,KAGzCS,EAAKC,OAAOhB,EAASM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AI,EAAGA,EAAIiqI,EAAWjqI,IAG7B,IAAK,GAFD6lJ,GAAQ9rB,EAAW/5H,GACnBulJ,EAAQ/C,EAASqD,GACZvmB,EAAM,EAAGA,EAAM2K,EAAY,EAAG3K,IAGrC,IAAK,GAFDwmB,GAAQ/rB,EAAWuF,GACnBymB,EAAQvD,EAASsD,GACZt7D,EAAK80C,EAAM,EAAG90C,EAAKy/C,EAAWz/C,IAAM,CAC3C,GAAIw7D,GAAQjsB,EAAWvvC,GACnBy7D,EAAQzD,EAASwD,GAEjBj8I,EAAMlV,KAAKL,IAAIuxJ,EAAMC,GAAQD,EAAMF,GAASN,EAAMS,GACtDD,GAAMC,GAASj8I,EACfk8I,EAAMH,GAAS/7I,EAKrB,MAAOy4I,OAGJoD,IAGT5zJ,GAAiB,QAAI4zJ","file":"vis"} \ No newline at end of file +{"version":3,"sources":["C:\\Users\\yotamberk\\Desktop\\workspace\\vis/dist/vis.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","default","instance","Constructor","TypeError","_defineProperty","_defineProperty2","obj","defineProperties","target","props","length","descriptor","writable","key","protoProps","staticProps","_interopRequireDefault","copyOrDelete","a","b","prop","allowDeletion","doDeletion","undefined","_getIterator2","_getIterator3","_create","_create2","_keys","_keys2","_typeof2","_typeof3","moment","uuid","isNumber","Number","recursiveDOMDelete","DOMobject","hasChildNodes","firstChild","removeChild","giveRange","min","max","total","value","scale","Math","isString","String","isDate","Date","ASPDateRegex","exec","isNaN","parse","randomUUID","v4","assignAllKeys","fillIfDefined","arguments","extend","other","selectiveExtend","Array","isArray","Error","selectiveDeepExtend","constructor","deepExtend","selectiveNotDeepExtend","propsToExclude","indexOf","push","protoExtend","equalArray","len","convert","type","match","Boolean","valueOf","isMoment","toDate","getType","toISOString","format","copyAndExtendArray","arr","newValue","newArr","copyArray","getAbsoluteLeft","elem","getBoundingClientRect","left","getAbsoluteRight","right","getAbsoluteTop","top","addClassName","classNames","classes","className","split","newClasses","concat","filter","join","removeClassName","oldClasses","forEach","callback","toArray","array","updateProperty","throttle","fn","scheduled","requestAnimationFrame","addEventListener","element","action","listener","useCapture","navigator","userAgent","attachEvent","removeEventListener","detachEvent","preventDefault","event","window","returnValue","getTarget","srcElement","nodeType","parentNode","hasParent","parent","e","option","asBoolean","defaultValue","asNumber","asString","asSize","asElement","hexToRGB","hex","shorthandRegex","replace","r","g","result","parseInt","overrideOpacity","color","opacity","rgb","substr","RGBToHex","red","green","blue","toString","slice","parseColor","isValidRGB","map","isValidHex","hsv","hexToHSV","lighterColorHSV","h","v","darkerColorHSV","darkerColorHex","HSVToHex","lighterColorHex","background","border","highlight","hover","RGBToHSV","minRGB","maxRGB","cssUtil","cssText","styles","style","trim","parts","addCssText","currentStyles","newStyles","removeCssText","removeStyles","HSVToRGB","floor","f","q","t","test","isValidRGBA","rgba","selectiveBridgeObject","fields","referenceObject","objectTo","bridgeObject","Element","insertSort","compare","k","j","mergeOptions","mergeTarget","options","globalOptions","isPresent","isObject","srcOption","globalPassed","x","globalOption","globalEnabled","enabled","src","dst","binarySearchCustom","orderedItems","comparator","field","field2","iteration","low","high","middle","item","searchResult","binarySearchValue","sidePreference","prevValue","nextValue","easingFunctions","linear","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","getScrollBarWidth","inner","document","createElement","width","height","outer","position","visibility","overflow","appendChild","body","w1","offsetWidth","w2","clientWidth","topMost","pile","accessors","candidate","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_step","_iterator","next","done","member","err","self","ReferenceError","_setPrototypeOf","_setPrototypeOf2","subClass","superClass","__proto__","_iterator2","_symbol","_symbol2","_typeof","core","version","__e","hammerMock","noop","on","off","destroy","emit","set","propagating","Hammer","DataSet","data","_options","_data","_fieldId","fieldId","_type","_subscribers","add","setOptions","_stringify","_stringify2","util","Queue","queue","_queue","subscribers","_trigger","params","senderId","subscriber","id","addedIds","me","_addItem","items","update","updatedIds","oldData","updatedData","addOrUpdate","oldItem","_updateItem","console","warn","args","ids","firstType","returnType","itemIds","itemId","_getItem","order","_sort","_filterFields","resultant","getIds","getDataSet","mappedItems","filteredItem","itemFields","sort","av","bv","remove","removedIds","removedItems","_remove","ident","clear","maxField","itemField","minField","distinct","values","fieldType","count","exists","types","raw","converted","DataView","_ids","_onEvent","apply","setData","refresh","oldIds","newIds","viewOptions","getArguments","defaultFilter","dataSet","oldItems","updatedItems","subscribe","unsubscribe","store","uid","Symbol","USE_SYMBOL","prepareElements","JSONcontainer","elementType","redundant","used","cleanupElements","resetElements","getSVGElement","svgContainer","shift","createElementNS","getDOMElement","DOMContainer","insertBefore","drawPoint","y","groupTemplate","labelObj","point","setAttributeNS","size","label","xOffset","yOffset","content","textContent","drawBar","rect","printStyle","_classCallCheck2","_classCallCheck3","_createClass2","_createClass3","errorFound","allOptions","Validator","referenceOptions","subObject","usedOptions","path","check","__any__","getSuggestion","referenceOption","is_object","refOptionObj","__type__","checkFields","log","message","printLocation","optionType","refOptionType","print","_isAMomentObject","localSearch","findInOptions","globalSearch","msg","indexMatch","distance","closestMatch","recursive","closestMatchPath","lowerCaseOption","toLowerCase","op","levenshteinDistance","prefix","str","_j","_i","_j2","matrix","charAt","Component","redraw","_isResized","resized","_previousWidth","_previousHeight","global","ctx","hide","$export","source","own","out","IS_FORCED","F","IS_GLOBAL","G","IS_STATIC","S","IS_PROTO","P","IS_BIND","B","IS_WRAP","W","expProto","C","Function","virtual","R","U","__g","anObject","IE8_DOM_DEFINE","toPrimitive","dP","O","Attributes","it","NodeBase","labelModule","radius","margin","refreshNeeded","boundingBox","bottom","adjustSizes","angle","borderWidth","resize","abs","cos","sin","shadow","shadowColor","shadowBlur","shadowSize","shadowOffsetX","shadowX","shadowOffsetY","shadowY","borderDashes","setLineDash","dashes","shapeProperties","selected","differentState","view","lineWidth","strokeStyle","borderColor","fillStyle","save","enableBorderDashes","stroke","disableBorderDashes","restore","enableShadow","fill","disableShadow","performStroke","_updateBoundingBox","textSize","getTextSize","_getPrototypeOf","_getPrototypeOf2","_possibleConstructorReturn2","_possibleConstructorReturn3","_inherits2","_inherits3","_NodeBase2","_NodeBase3","ShapeBase","_NodeBase","needsRefresh","shape","sizeMultiplier","initContextForDraw","performFill","calculateLabelSize","yLabel","draw","updateBoundingBox","IObject","defined","createDesc","_isIterable2","_isIterable3","sliceIterator","_arr","_n","_d","_e","_s","$keys","enumBugKeys","keys","Point3d","z","subtract","sub","sum","avg","crossProduct","crossproduct","sqrt","__WEBPACK_AMD_DEFINE_FACTORY__","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","keycharm","container","_exportFunctions","_bound","keydown","keyup","fromCharCode","code","down","handleEvent","up","keyCode","bound","shiftKey","bind","bindAll","getKey","unbind","newBindings","reset","convertHiddenOptions","hiddenDates","repeat","dateItem","start","end","updateHiddenDates","domProps","centerContainer","range","totalRange","pixelTime","startDate","endDate","duration","offset","runUntil","clone","day","dayOfYear","year","dayOffset","diff","date","month","removeDuplicates","startHidden","isHidden","endHidden","rangeStart","rangeEnd","hidden","startToFront","endToFront","_applyRange","safeDates","printDates","dates","stepOverHiddenDates","timeStep","previousTime","stepInHidden","currentValue","current","_end","switchedYear","switchedMonth","switchedDay","toScreen","Core","time","conversion","getHiddenDurationBetween","hiddenBeforeStart","getHiddenDurationBeforeStart","rangeAfterEnd","correctTimeForHidden","toTime","hiddenDuration","totalDuration","partialDuration","accumulatedHiddenDuration","getAccumulatedHiddenDuration","getHiddenDurationBefore","timeOffset","requiredDuration","previousPoint","snapAwayFromHidden","direction","correctionEnabled","onTouch","hammer","inputHandler","isFirst","onRelease","isFinal","offTouch","offRelease","disablePreventDefaultVertically","pinchRecognizer","getTouchAction","Item","dom","displayed","groupShowing","dirty","editable","_updateEditStatus","stack","select","unselect","group","itemSet","_moveToGroup","stackDirty","subgroup","changeSubgroup","setParent","show","isVisible","repositionX","repositionY","_repaintDragCenter","updateTime","dragCenter","dragCenterItem","emitter","stopPropagation","_onUpdateItem","box","dragLeft","_repaintDeleteButton","anchor","overrideItems","deleteButton","rtl","title","removeFromDataSet","_repaintOnItemUpdateTimeTooltip","tooltipOnItemUpdateTime","onItemUpdateTimeTooltip","touchParams","itemIsDragging","itemDistanceFromTop","scrollTop","orientation","templateFunction","template","innerHTML","_updateContents","itemVisibleFrameContent","visibleFrameTemplateFunction","itemData","itemsData","frameElement","itemVisibleFrameContentElement","getElementsByClassName","visibleFrameTemplate","_contentToString","_updateDataAttributes","dataAttributes","attributes","setAttribute","removeAttribute","_updateStyle","outerHTML","updateGroup","getWidthLeft","getWidthRight","getTitle","bitmap","px","random","propertyIsEnumerable","delay","Infinity","_timeout","_extended","_flushIfNeeded","flush","methods","original","method","context","entry","clearTimeout","setTimeout","Emitter","mixin","_callbacks","once","removeListener","removeAllListeners","callbacks","cb","splice","listeners","hasListeners","TimeAxis","foreground","lines","majorTexts","minorTexts","minimumStep","lineTop","defaultOptions","axis","showMinorLabels","showMajorLabels","maxMinorChars","TimeStep","FORMAT","timeAxis","DateUtil","locale","lang","parentChanged","_calculateCharSize","minorLabelHeight","minorCharHeight","majorLabelHeight","majorCharHeight","minorLineHeight","minorLineWidth","majorLineHeight","majorLineWidth","foregroundNextSibling","nextSibling","backgroundNextSibling","_repaintLabels","backgroundVertical","timeLabelsize","minorCharWidth","step","setMoment","setFormat","setScale","xNext","isMajor","showMinorGrid","prevWidth","line","labelMinor","xFirstMajorLabel","getCurrent","hasNext","getClassName","getLabelMinor","_repaintMinorText","_repaintMajorText","getLabelMajor","_repaintMajorLine","_repaintMinorLine","warnedForOverflow","leftTime","leftText","widthText","majorCharWidth","pop","text","createTextNode","childNodes","measureCharMinor","clientHeight","measureCharMajor","CustomTime","locales","customTime","eventParams","onMouseWheel","_onMouseWheel","bar","drag","_onDragStart","_onDrag","_onDragEnd","threshold","DIRECTION_HORIZONTAL","warned","toUpperCase","substring","setCustomTime","getCustomTime","setCustomTitle","dragging","deltaX","customTimeFromTarget","Label","ComponentUtil","Box","Circle","CircularImage","Database","Diamond","Dot","Ellipse","Icon","Image","Square","Hexagon","Star","Text","Triangle","TriangleDown","_require","Node","imagelist","grouplist","edges","baseSize","baseFontSize","font","predefinedPosition","edge","index","currentShape","checkMass","parseFloat","parseOptions","chooser","choosify","_load_images","updateLabelModule","updateShape","physics","image","imageObj","load","brokenImage","unselected","imageObjAlt","borderRadius","updateGroupOptions","currentGroup","distanceToBorder","fixed","scaling","customScalingFunction","sizeDiff","fontDiff","getFormattingValues","ret","visible","pointInRect","getSize","nodeId","labelId","parentOptions","newOptions","groupList","groupObj","parsedColor","mass","strId","subOption","allowed","chosen","chosenEdge","rotationPoint","tmp","Iterators","TO_STRING_TAG","DOMIterables","NAME","Collection","proto","val","dPs","IE_PROTO","Empty","createDict","iframeDocument","iframe","display","contentWindow","open","write","lt","close","create","Properties","ceil","shared","def","has","TAG","tag","stat","$at","iterated","_t","LIBRARY","wksExt","$Symbol","getOwnPropertySymbols","Range","now","hours","minutes","seconds","milliseconds","millisecondsPerPixelCache","rolling","deltaDifference","scaleOffset","moveable","zoomable","zoomMin","zoomMax","rollingMode","follow","touch","animationTimer","_onTouch","_onPinch","rollingModeBtn","startRolling","validateDirection","setRange","stopRolling","interval","animation","center","currentTimeTimer","frameCallback","byUser","finalStart","finalEnd","_cancelAnimation","initStart","initEnd","easingName","easingFunction","initTime","anyChanged","ease","changed","timeoutID","getMillisecondsPerPixel","newStart","newEnd","getRange","totalHidden","previousDelta","_isInsideRange","allowDragging","cursor","delta","deltaY","diffRange","safeStart","safeEnd","wheelDelta","detail","zoomKey","pointerDate","pointer","getPointer","clientX","clientY","_pointerToDate","zoom","centerDate","hiddenDurationBefore","hiddenDurationAfter","move","moveTo","hammerUtil","Activator","isActive","wheelDeltaY","wheelDeltaX","HORIZONTAL_AXIS","verticalScroll","adjusted","_setScrollTop","_redraw","horizontalScroll","onMouseScrollSide","handleDragOver","itemAddedToTimeline","dataTransfer","dropEffect","handleDrop","JSON","getData","_onAddItem","_onDropObjectOnItem","getEventProperties","backgroundHorizontal","leftContainer","rightContainer","shadowTop","shadowBottom","shadowTopLeft","shadowBottomLeft","shadowTopRight","shadowBottomRight","scrollTopMin","initialDrawDone","initialRangeChangeDone","_origRedraw","properties","initialItemSetDrawn","enable","customTimes","redrawCount","timeAxis2","components","drawPoints","onRender","clickToUse","activator","_initAutoResize","component","configurator","_createConfigurator","configure","appliedOptions","setModuleOptions","active","setItems","setGroups","_stopAutoResize","setCustomTimeTitle","addCustomTime","timestamp","some","removeCustomTime","getVisibleItems","fit","getDataRange","setWindow","getWindow","zoomIn","percentage","newInterval","zoomOut","maxHeight","minHeight","offsetHeight","borderRootHeight","borderRootWidth","contentHeight","autoHeight","containerHeight","scrollbarWidth","_setDOM","_updateScrollTop","visibilityTop","visibilityBottom","RegExp","contentsOverflow","DIRECTION_ALL","centerWidth","repaint","setCurrentTime","currentTime","getCurrentTime","_toTime","_toGlobalTime","_toScreen","_toGlobalScreen","autoResize","_startAutoResize","_onResize","lastWidth","lastHeight","watchTimer","setInterval","clearInterval","initialScrollTop","oldScrollTop","_getScrollTop","newScrollTop","_start","autoScale","minorLabels","millisecond","second","minute","hour","weekday","week","majorLabels","defaultFormat","setMinimumStep","roundToMinor","prev","nextWeek","isSame","setAutoScale","stepYear","stepMonth","stepDay","stepHour","stepMinute","stepSecond","stepMillisecond","snap","round","even","today","_moment","currentWeek","currentMonth","CurrentTime","showCurrentTime","stop","Group","groupId","subgroups","subgroupStack","subgroupStackAll","doInnerStack","subgroupIndex","subgroupOrderer","subgroupOrder","nestedGroups","showNested","nestedInGroup","visibleItems","itemsInRange","byStart","byEnd","checkRangedItems","groupEditable","marker","collapsedDirClassName","paddingRight","paddingLeft","getLabelWidth","_didMarkerHeightChange","markerHeight","lastMarkerHeight","redrawQueue","redrawQueueLength","fns","_calculateGroupSizeAndPosition","offsetTop","offsetLeft","_redrawItems","forceRestack","lastIsVisible","visibleSubgroups","stackSubgroups","stackSubgroupsWithInnerStack","customOrderedItems","_updateItemsInRange","nostack","_didResize","labelWidth","labelHeight","_applyGroupHeight","_updateItemsVerticalPosition","ii","returnQueue","_updateSubGroupHeights","_isGroupVisible","_updateSubgroupsSizes","_calculateHeight","resetSubgroups","vertical","labelSet","_addToSubgroup","orderSubgroups","_checkIfVisible","subgroupId","itemEnd","initialEnd","sortArray","sortField","_removeFromSubgroup","itemIndex","removeItem","startArray","endArray","orderByStart","orderByEnd","oldVisibleItems","visibleItemsLookup","lowerBound","upperBound","searchFunction","_checkIfVisibleWithReference","initialPosByStart","_traceVisible","initialPosByEnd","initialPos","breakCondition","oldSubgroup","newSubgroup","BackgroundGroup","RangeItem","baseClassName","_createDomElement","frame","visibleFrame","_appendDomElement","_updateDirtyDomComponents","maxWidth","_getDomComponentsSizes","getComputedStyle","_updateDomComponentsSizes","sizes","_repaintDomAdditionals","_repaintDragLeft","_repaintDragRight","limitSize","contentStartPosition","contentWidth","parentWidth","align","boxWidth","itemsAlwaysDraggable","dragLeftItem","dragRight","dragRightItem","ColorPicker","Configurator","parentModule","defaultContainer","configureOptions","pixelRatio","changedOptions","allowCreation","initialized","popupCounter","showButton","moduleOptions","domElements","popupDiv","popupLimit","popupHistory","colorPicker","wrapper","_removePopup","_clean","_this","counter","_handleObject","_makeItem","_makeHeader","generateButton","onclick","_printOptions","onmouseover","onmouseout","optionsContainer","_push","_showPopupIfNeeded","base","_len","_key","div","objectLabel","selectedValue","onchange","_update","_makeLabel","popupString","popupValue","input","oninput","_setupPopup","string","_this2","html","hideTimeout","deleteTimeout","_this3","correspondingElement","checkbox","checked","_this4","defaultColor","backgroundColor","_showColorPicker","_this5","insertTo","setColor","setUpdateCallback","colorString","setCloseCallback","checkOnly","visibleInSet","subObj","newPath","_getValue","_handleArray","_makeTextInput","_makeCheckbox","solver","enabledPath","enabledValue","_label","error","_makeColorField","_makeDropdown","_makeRange","_constructOptions","optionsObj","getOptions","Points","getGroupTemplate","callbackResult","getCallback","framework","DOMutil","dataset","screen_x","screen_y","svgElements","svg","drawIcon","iconWidth","iconHeight","fillHeight","outline","CircleImageBase","labelOffset","setImages","selection_changed","imageTmp","useImageSize","ratio_width","ratio_height","circle","globalAlpha","factor","interpolation","drawImageAtPosition","labelDimensions","lineCount","CubicBezierEdge","BezierEdgeDynamic","BezierEdgeStatic","StraightEdge","Edge","fromId","toId","labelDirty","baseWidth","from","to","edgeType","connected","dataChanged","updateEdgeType","_setInteractionWidths","connect","toArrow","arrows","fromArrow","middleArrow","inheritsColor","inherit","toArrowScale","scaleFactor","toArrowType","middleArrowScale","middleArrowType","fromArrowScale","fromArrowType","arrowStrikethrough","selectedWidth","selectionWidth","hoverWidth","smooth","changeInType","cleanup","disconnect","nodes","attachEdge","detachEdge","widthDiff","viaNode","getViaNode","arrowData","fromPoint","toPoint","getArrowData","drawLine","drawArrows","drawLabel","drawArrowHead","node1","node2","pointToSelf","getPoint","_getRotation","translate","rotate","selfReferenceSize","_pointOnCircle","edgeId","isOverlappingWith","xFrom","yFrom","xTo","yTo","xObj","yObj","getDistanceToEdge","yLine","dy","dx","atan2","PI","copyFromGlobals","isValidLabel","fromColor","toColor","colorsDefined","_EdgeBase2","_EdgeBase3","BezierEdgeBase","_EdgeBase","nearNode","pos","distanceToPoint","difference","_getViaCoordinates","node","pow","x1","y1","x2","y2","x3","y3","via","minDistance","lastX","lastY","_getDistanceToLine","viaNode1","viaNode2","hasNode1","hasNode2","beginPath","bezierCurveTo","quadraticCurveTo","lineTo","NetworkUtil","allNodes","specificNodes","minY","maxY","minX","maxX","clonedOptions","amountOfConnections","cof","redefine","$iterCreate","setToStringTag","getPrototypeOf","ITERATOR","BUGGY","returnThis","Base","DEFAULT","IS_SET","FORCED","IteratorPrototype","getMethod","kind","DEF_VALUES","VALUES_BUG","$native","$default","$entries","$anyNative","entries","aFunction","that","is","toIObject","arrayIndexOf","names","toObject","ObjectProto","ARG","tryGet","T","callee","fails","KEY","exp","hiddenKeys","getOwnPropertyNames","pIE","gOPD","getOwnPropertyDescriptor","Point2d","Slider","play","MozBorderRadius","slide","onmousedown","_onMouseDown","togglePlay","onChangeCallback","playTimeout","playInterval","playLoop","getIndex","setIndex","playNext","setOnChangeCallback","setPlayInterval","getPlayInterval","setPlayLoop","doLoop","onChange","indexToLeft","setValues","which","button","startClientX","startSlideX","onmousemove","_onMouseMove","onmouseup","_onMouseUp","leftToIndex","StepNumber","prettyStep","precision","_current","isNumeric","isFinite","setStep","calculatePrettyStep","log10","LN10","step1","step2","step5","toPrecision","getStep","checkFirst","isEmpty","capitalize","prefixFieldName","fieldName","forceCopy","srcKey","dstKey","safeCopy","setDefaults","DEFAULTS","OPTIONKEYS","PREFIXEDOPTIONKEYS","setSpecialSettings","showGrayBottom","showTooltip","onclick_callback","eye","setBackgroundColor","setDataColor","dataColor","setStyle","setShowLegend","showLegend","setCameraPosition","cameraPosition","tooltip","tooltipStyle","isLegendGraphStyle","STYLE","DOTCOLOR","DOTSIZE","getStyleNumberByName","styleName","number","STYLENAME","checkStyleNumber","valid","styleNumber","strokeWidth","borderStyle","camPos","camera","Camera","setArmRotation","horizontal","setArmLength","BAR","BARCOLOR","BARSIZE","DOT","DOTLINE","GRID","LINE","SURFACE","dot","dot-line","dot-color","dot-size","grid","surface","bar-color","bar-size","armLocation","armRotation","armLength","cameraOffset","offsetMultiplier","cameraLocation","cameraRotation","calculateCameraOrientation","_sign","_sign2","setOffset","sign","mul","getOffset","setArmLocation","getArmRotation","rot","getArmLength","getCameraLocation","getCameraRotation","xa","za","Filter","dataGroup","column","graph","getDistinctValues","selectValue","dataPoints","loaded","onLoadCallback","animationPreload","loadInBackground","isLoaded","getLoadedProgress","getLabel","filterLabel","getColumn","getSelectedValue","getValues","getValue","_getDataPoints","dataView","setOnLoadCallback","progress","overlay","_onTapOverlay","onClick","_hasParent","deactivate","escListener","activate","ItemSet","groupOrderSwap","fromGroup","toGroup","groups","targetOrder","groupOrder","selectable","multiselect","onDropObjectOnItem","objectData","onAdd","onUpdate","onMove","onRemove","onMoving","onAddGroup","onMoveGroup","onRemoveGroup","showTooltips","followMouse","overflowMethod","itemOptions","groupsData","itemListeners","_onAdd","_onUpdate","_onRemove","groupListeners","_onAddGroups","groupData","updatedGroups","nestedGroupId","updatedNestedGroup","_onUpdateGroups","_onRemoveGroups","groupIds","selection","popup","groupTouchParams","BoxItem","PointItem","BackgroundItem","Popup","UNGROUPED","BACKGROUND","_updateUngrouped","backgroundGroup","_onSelectItem","_onMultiSelectItem","groupHammer","_onGroupClick","_onGroupDragStart","_onGroupDrag","_onGroupDragEnd","DIRECTION_VERTICAL","_onMouseOver","_onMouseOut","markDirty","refreshItems","setSelection","getSelection","rawVisibleItems","_deselect","_orderGroups","visibleInterval","zoomed","lastVisibleInterval","scrolled","lastRangeStart","changedStackOption","lastStack","changedStackSubgroupsOption","lastStackSubgroups","firstGroup","_firstGroup","firstMargin","nonFirstMargin","groupMargin","redrawResults","groupResized","firstGroupIndex","firstGroupId","ungrouped","_getGroupId","getLabelSet","oldItemsData","getItems","_order","getGroups","_getType","_removeItem","groupOptions","_orderNestedGroups","newGroupIdsOrder","nestedGroup","nestedGroupIds","_constructByEndArray","itemFromTarget","itemProps","_getGroupIndex","selectedItem","initialX","_cloneItemData","srcEvent","ctrlKey","metaKey","_onDragStartAddItem","baseGroupIndex","itemsToDrag","groupIndex","groupOffset","xAbs","getScale","groupFromTarget","newItem","updateGroupAllowed","newGroupBase","initialStart","initial","newOffset","oldGroup","nestingGroup","originalOrder","movingUp","targetGroupTop","draggedGroupHeight","targetGroup","draggedGroup","newOrder","origOrder","draggedId","numGroups","curPos","orgOffset","slippedPosition","switchGroup","shouldBeGroup","switchGroupId","oldSelection","newSelection","itemFromRelatedTarget","setText","setPosition","newItemData","itemGroup","lastSelectedGroup","multiselectPerGroup","_getItemRange","_item","itemFromElement","cur","relatedTarget","itemSetFromTarget","force","collidingItem","jj","collision","substack","subgroupHeight","baseTop","newTop","otherSubgroup","collisionByTimes","subgroupItems","doSubStack","widthInMs","getTime","previous","itemSetHeight","lineHeight","marginLeft","marginRight","itemSubgroup","padding","doShow","isLeft","isTop","bool","boolean","function","throttleRedraw","any","onInitialDrawComplete","null","groupsDraggable","LineGraph","yAxisOrientation","defaultGroup","sampling","graphHeight","shaded","barChart","sideBySide","parametrization","alpha","dataAxis","legend","abortedGraphUpdate","updateSVGheight","updateSVGheightOnResize","forceGraphUpdate","lastStart","groupsUsingDefaultStyles","DataAxis","GraphGroup","Legend","Bars","Lines","yAxisLeft","yAxisRight","legendLeft","legendRight","_removeGroup","_updateAllGroupData","removeGroup","_updateGroup","addGroup","groupsContent","idMap","groupCounts","existingItemsMap","existing_items","newLength","extended","orginalY","_updateGraph","rangePerPixelInv","_getSortedGroupIds","zIndex","az","bz","groupRanges","minDate","toGlobalTime","maxDate","_getRelevantData","_applySampling","_convertXcoordinates","_getYRanges","_updateYAxis","below","excludeFromStacking","_stack","_convertYcoordinates","paths","calcPath","subGroupId","drawShading","subData","subPrevPoint","subNextPoint","dateComparator","first","last","dataContainer","increment","amountOfPoints","xDistance","toGlobalScreen","pointsPerPixel","sampledData","idx","combinedDataLeft","combinedDataRight","getYRange","getStackedYRange","minVal","maxVal","yAxisLeftUsed","yAxisRightUsed","minLeft","minRight","maxLeft","maxRight","ignore","_toggleAxisVisiblity","drawIcons","master","masterAxis","lineOffset","tempGroups","axisUsed","datapoints","screen_end","svgHeight","convertValue","setZeroPosition","linegraphOptions","icons","majorLinesOffset","minorLinesOffset","labelOffsetX","labelOffsetY","alignZeros","linegraphSVG","DOMelements","labels","conversionFactor","minWidth","stepPixels","zeroCrossing","amountOfSteps","iconsRemoved","amountOfGroups","lineContainer","DataScale","graphOptions","_redrawGroupIcons","iconOffset","groupArray","getLegend","_cleanupIcons","activeGroups","_redrawLabels","_redrawTitle","customRange","autoScaleEnd","autoScaleStart","followScale","maxLabelSize","getLines","major","_redrawLabel","_redrawLine","titleWidth","titleCharHeight","screenToValue","characterHeight","textAlign","largestWidth","textMinor","textMajor","textTitle","measureCharTitle","titleCharWidth","zeroAlign","formattingFunction","majorSteps","minorSteps","customLines","minorStepIdx","magnitudefactor","determineScale","rounded","setCharHeight","setHeight","minimumStepValue","orderOfMagnitude","solutionFound","is_major","getFirstMajor","majorStep","formatValue","bottomOffset","oldStepIdx","oldStart","oldEnd","increaseMagnitude","decreaseMagnitude","otherZero","otherStep","newRange","myOriginalZero","majorOffset","zeroOffset","pixels","usingDefaultStyle","zeroPosition","icon","yMin","yMax","Bargraph","barWidth","originalWidth","bar1Height","bar2Height","processedGroupData","coreDistance","drawData","combinedData","intersections","barPoints","_getDataIntersections","heightOffset","_getSafeDrawData","nextKey","amount","resolved","accumulatedNegative","accumulatedPositive","dataWidth","pointData","groupLabel","_getStackedYRange","xpos","Line","_catmullRom","_linear","fillPath","pathArray","subPathArray","dFill","zero","serializePath","inverse","_catmullRomUniform","p0","p1","p2","p3","bp1","bp2","d1","d2","d3","A","N","M","d3powA","d2powA","d3pow2A","d2pow2A","d1pow2A","d1powA","side","iconSize","iconSpacing","excludeFromLegend","textArea","scrollableHeight","drawLegendIcons","paddingTop","parseDOT","parseGraph","nextPreview","isAlphaNumeric","regexAlphaNumeric","merge","setValue","addNode","graphs","attr","addEdge","createEdge","getToken","tokenType","TOKENTYPE","NULL","token","isComment","DELIMITER","c2","DELIMITERS","IDENTIFIER","newSyntaxError","UNKNOWN","SyntaxError","chop","strict","parseStatements","parseStatement","subgraph","parseSubgraph","parseEdge","parseAttributeStatement","parseNodeStatement","subgraphs","parseAttributeList","edgeStyles","dashed","solid","dotted","maxLength","forEach2","array1","array2","elem1","elem2","setProp","convertAttr","mapping","visProp","visPropI","DOTToGraph","dotData","graphData","dotNode","graphNode","NODE_ATTR_MAPPING","convertEdge","dotEdge","graphEdge","EDGE_ATTR_MAPPING","subEdge","fontsize","fontcolor","labelfontcolor","fontname","fillcolor","labeltooltip","{","}","[","]",";","=",",","->","--","parseGephi","gephiJSON","inheritColor","gEdges","gNodes","gEdge","gNode","_CachedImage","_CachedImage2","Images","images","imageBroken","url","brokenUrl","imageToLoadBrokenUrlOn","onerror","imageToRedrawWith","cachedImage","img","onload","_fixImageCoordinates","init","_redrawWithImage","_tryloadBrokenUrl","imageToCache","_slicedToArray2","_slicedToArray3","LabelSplitter","multiFontStyle","edgelabel","fontOptions","isEdgeLabel","elementOptions","initFontOptions","newFontOptions","parseFontString","vadjust","constrainWidth","maxWdt","minWdt","constrainHeight","minHgt","valign","widthConstraint","widthConstraintMaximum","widthConstraintMinimum","heightConstraint","heightConstraintMinimum","heightConstraintValign","propagateFonts","constrain","margins","widthBias","heightBias","dstPile","srcPile","addFontToPile","tmpShorthand","opt","multiName","multiFont","optionNames","mod","getFontOption","fontPile","addFontOptionsToPile","getBasicOptions","modOptions","tmpMultiFontOptions","getFontOptions","baseline","viewFontSize","drawThreshold","maxVisible","_drawBackground","_drawText","fillRect","_setAlignment2","_setAlignment","_setAlignment3","blocks","block","_getColor2","_getColor","strokeColor","_getColor3","fontColor","lineJoin","strokeText","fillText","textBaseline","initialStrokeColor","_processLabel","face","labelHighlightBold","fontString","selectedState","hoverState","inText","process","state","_processLabelText","outOptions","inOptions","newOptionsArray","EndPoints","EdgeBase","colorDirty","getColor","_drawDashedLine","_drawLine","_line","_getCircleData2","_getCircleData","_getCircleData3","_circle","lineCap","pattern","lineDashOffset","_getCircleData4","_getCircleData5","dashedLine","_getCircleData6","_getCircleData7","_x","_y","_radius","_findBorderPosition","_findBorderPositionCircle","_getCircleData$slice","_getCircleData$slice2","grd","createLinearGradient","addColorStop","arc","_getDistanceToEdge","_getCircleData8","_getCircleData9","py","something","u","arrowPoint","guideOffset","findBorderPosition","guidePos","_getCircleData10","_getCircleData11","EndPoint","points","xt","yt","closePath","Arrow","_EndPoint","transform","drawPath","Bar","BarnesHutSolver","physicsBody","barnesHutTree","randomSeed","thetaInversed","theta","overlapAvoidanceFactor","avoidOverlap","gravitationalConstant","physicsNodeIndices","nodeIndices","nodeCount","_formBarnesHutTree","_getForceContributions","parentBranch","_getForceContribution","children","NW","NE","SW","SE","childrenCount","centerOfMass","calcSize","_calculateForces","gravityForce","fx","fy","forces","_node","rootSize","halfRootSize","centerX","centerY","level","_splitBranch","_placeInTree","totalMass","totalMassInv","biggestSize","skipMassUpdate","_updateBranchMass","region","_placeInRegion","seededRandom","containedNode","_insertRegion","childSize","_drawBranch","branch","CentralGravitySolver","centralGravity","endPoints","multi","bold","boldital","ital","mono","roundness","forceDirection","maximum","useDefaultGroups","interaction","dragNodes","dragView","hideEdgesOnDrag","hideNodesOnDrag","keyboard","speed","bindToWindow","navigationButtons","selectConnectedEdges","hoverConnectedEdges","tooltipDelay","zoomView","layout","improvedLayout","hierarchical","levelSeparation","nodeSpacing","treeSpacing","blockShifting","edgeMinimization","parentCentralization","sortMethod","manipulation","initiallyActive","editNode","editEdge","editWithoutDrag","deleteNode","deleteEdge","controlNodeStyle","borderWidthSelected","minimum","useBorderWithImage","barnesHut","springLength","springConstant","damping","forceAtlas2Based","repulsion","nodeDistance","hierarchicalRepulsion","maxVelocity","minVelocity","stabilization","iterations","updateInterval","onlyDynamicEdges","timestep","adaptiveTimestep","addToUnscopables","_k","Arguments","getKeys","toLength","toAbsoluteIndex","IS_INCLUDES","$this","el","fromIndex","toInteger","documentElement","TO_STRING","charCodeAt","getIterator","iterFn","classof","getIteratorMethod","$Object","D","DESCRIPTORS","META","$fails","wks","wksDefine","enumKeys","gOPNExt","$GOPD","$DP","gOPN","$JSON","stringify","HIDDEN","TO_PRIMITIVE","isEnum","SymbolRegistry","AllSymbols","OPSymbols","USE_NATIVE","QObject","setter","findChild","setSymbolDesc","protoDesc","wrap","sym","isSymbol","iterator","$defineProperty","$defineProperties","$create","$propertyIsEnumerable","E","$getOwnPropertyDescriptor","$getOwnPropertyNames","$getOwnPropertySymbols","IS_OP","$set","es6Symbols","wellKnownSymbols","for","keyFor","useSetter","useSimple","replacer","$replacer","setDesc","isExtensible","FREEZE","preventExtensions","setMeta","w","fastKey","getWeak","onFreeze","meta","NEED","gOPS","getSymbols","symbols","arg","windowNames","getWindowNames","hooks","hookCallback","isObjectEmpty","isUndefined","res","hasOwnProp","createUTC","createLocalOrUTC","utc","defaultParsingFlags","empty","unusedTokens","unusedInput","charsLeftOver","nullInput","invalidMonth","invalidFormat","userInvalidated","iso","parsedDateParts","meridiem","rfc2822","weekdayMismatch","getParsingFlags","_pf","isValid","_isValid","flags","parsedParts","isNowValid","invalidWeekday","_strict","bigHour","isFrozen","createInvalid","NaN","copyConfig","_f","_l","_tzm","_isUTC","_offset","_locale","momentProperties","Moment","config","updateInProgress","updateOffset","absFloor","toInt","argumentForCoercion","coercedNumber","compareArrays","dontConvert","lengthDiff","diffs","suppressDeprecationWarnings","deprecate","firstTime","deprecationHandler","deprecateSimple","deprecations","isFunction","_config","_dayOfMonthOrdinalParseLenient","_dayOfMonthOrdinalParse","_ordinalParse","mergeConfigs","parentConfig","childConfig","Locale","calendar","mom","output","_calendar","longDateFormat","_longDateFormat","formatUpper","invalidDate","_invalidDate","ordinal","_ordinal","relativeTime","withoutSuffix","isFuture","_relativeTime","pastFuture","addUnitAlias","unit","shorthand","lowerCase","aliases","normalizeUnits","units","normalizeObjectUnits","inputObject","normalizedProp","normalizedInput","addUnitPriority","priority","priorities","getPrioritizedUnits","unitsObj","zeroFill","targetLength","forceSign","absNumber","zerosToFill","addFormatToken","padded","func","formatTokenFunctions","localeData","removeFormattingTokens","makeFormatFunction","formattingTokens","formatMoment","expandFormat","formatFunctions","replaceLongDateFormatTokens","localFormattingTokens","lastIndex","addRegexToken","regex","strictRegex","regexes","isStrict","getParseRegexForToken","unescapeFormat","regexEscape","matched","p4","addParseToken","tokens","addWeekParseToken","_w","addTimeToArrayFromToken","_a","daysInYear","isLeapYear","getIsLeapYear","makeGetSet","keepTime","set$1","daysInMonth","stringGet","stringSet","prioritized","modMonth","localeMonths","_months","isFormat","MONTHS_IN_FORMAT","localeMonthsShort","_monthsShort","handleStrictParse","monthName","llc","toLocaleLowerCase","_monthsParse","_longMonthsParse","_shortMonthsParse","monthsShort","months","localeMonthsParse","_monthsParseExact","setMonth","dayOfMonth","monthsParse","getSetMonth","getDaysInMonth","monthsShortRegex","computeMonthsParse","_monthsShortStrictRegex","_monthsShortRegex","defaultMonthsShortRegex","monthsRegex","_monthsStrictRegex","_monthsRegex","defaultMonthsRegex","cmpLenRev","shortPieces","longPieces","mixedPieces","createDate","ms","getFullYear","setFullYear","createUTCDate","UTC","getUTCFullYear","setUTCFullYear","firstWeekOffset","dow","doy","fwd","getUTCDay","dayOfYearFromWeeks","resYear","resDayOfYear","localWeekday","weekOffset","weekOfYear","resWeek","weeksInYear","weekOffsetNext","localeWeek","_week","localeFirstDayOfWeek","localeFirstDayOfYear","getSetWeek","getSetISOWeek","parseWeekday","weekdaysParse","parseIsoWeekday","localeWeekdays","_weekdays","localeWeekdaysShort","_weekdaysShort","localeWeekdaysMin","_weekdaysMin","handleStrictParse$1","weekdayName","_weekdaysParse","_shortWeekdaysParse","_minWeekdaysParse","weekdaysMin","weekdaysShort","weekdays","localeWeekdaysParse","_weekdaysParseExact","_fullWeekdaysParse","getSetDayOfWeek","getDay","getSetLocaleDayOfWeek","getSetISODayOfWeek","weekdaysRegex","computeWeekdaysParse","_weekdaysStrictRegex","_weekdaysRegex","defaultWeekdaysRegex","weekdaysShortRegex","_weekdaysShortStrictRegex","_weekdaysShortRegex","defaultWeekdaysShortRegex","weekdaysMinRegex","_weekdaysMinStrictRegex","_weekdaysMinRegex","defaultWeekdaysMinRegex","minp","shortp","longp","minPieces","hFormat","kFormat","lowercase","matchMeridiem","_meridiemParse","localeIsPM","localeMeridiem","isLower","normalizeLocale","chooseLocale","loadLocale","oldLocale","globalLocale","_abbr","getSetGlobalLocale","getLocale","defineLocale","baseConfig","abbr","parentLocale","localeFamilies","updateLocale","listLocales","checkOverflow","MONTH","DATE","YEAR","HOUR","MINUTE","SECOND","MILLISECOND","_overflowDayOfYear","_overflowWeeks","WEEK","_overflowWeekday","WEEKDAY","defaults","currentDateArray","nowValue","_useUTC","getUTCMonth","getUTCDate","getMonth","getDate","configFromArray","currentDate","yearToUse","dayOfYearFromWeekInfo","_dayOfYear","_nextDay","setUTCMinutes","getUTCMinutes","weekYear","temp","weekdayOverflow","GG","createLocal","curWeek","gg","configFromISO","allowTime","dateFormat","timeFormat","tzFormat","extendedIsoRegex","basicIsoRegex","isoDates","isoTimes","tzRegex","configFromStringAndFormat","extractFromRFC2822Strings","yearStr","monthStr","dayStr","hourStr","minuteStr","secondStr","untruncateYear","defaultLocaleMonthsShort","preprocessRFC2822","checkWeekday","weekdayStr","parsedInput","defaultLocaleWeekdaysShort","calculateOffset","obsOffset","militaryOffset","numOffset","obsOffsets","hm","configFromRFC2822","parsedArray","configFromString","aspNetJsonRegex","createFromInputFallback","ISO_8601","RFC_2822","skipped","stringLength","totalParsedInputLength","_meridiem","meridiemFixWrap","isPm","meridiemHour","isPM","configFromStringAndArray","tempConfig","bestMoment","scoreToBeat","currentScore","score","configFromObject","createFromConfig","prepareConfig","preparse","configFromInput","isUTC","pickBy","moments","isDurationValid","ordering","unitHasDecimal","isValid$1","createInvalid$1","createDuration","Duration","years","quarters","quarter","weeks","days","_milliseconds","_days","_bubble","isDuration","absRound","separator","utcOffset","offsetFromString","matcher","matches","chunk","chunkOffset","cloneWithOffset","model","setTime","local","getDateOffset","getTimezoneOffset","getSetOffset","keepLocalTime","keepMinutes","localAdjust","matchShortOffset","_changeInProgress","addSubtract","getSetZone","setOffsetToUTC","setOffsetToLocal","setOffsetToParsedOffset","tZone","matchOffset","hasAlignedHourOffset","isDaylightSavingTime","isDaylightSavingTimeShifted","_isDSTShifted","isLocal","isUtcOffset","isUtc","diffRes","aspNetRegex","isoRegex","parseIso","momentsDifference","inp","positiveMomentsDifference","isAfter","isBefore","createAdder","period","dur","isAdding","getCalendarFormat","myMoment","calendar$1","formats","sod","startOf","calendarFormat","localInput","endOf","isBetween","inclusivity","inputMs","isSameOrAfter","isSameOrBefore","asFloat","zoneDelta","monthDiff","anchor2","adjust","wholeMonthDiff","inspect","zone","suffix","inputString","defaultFormatUtc","postformat","humanize","fromNow","toNow","newLocaleData","isoWeekday","unix","toJSON","isValid$2","parsingFlags","invalidAt","creationData","addWeekYearFormatToken","getSetWeekYear","getSetWeekYearHelper","getSetISOWeekYear","isoWeek","getISOWeeksInYear","getWeeksInYear","weekInfo","weeksTarget","setWeekAll","dayOfYearData","getSetQuarter","getSetDayOfYear","parseMs","getZoneAbbr","getZoneName","createUnix","createInZone","parseZone","preParsePostFormat","get$1","listMonthsImpl","listWeekdaysImpl","localeSorted","listMonths","listMonthsShort","listWeekdays","listWeekdaysShort","listWeekdaysMin","mathAbs","addSubtract$1","add$1","subtract$1","absCeil","bubble","monthsFromDays","monthsToDays","daysToMonths","as","valueOf$1","makeAs","alias","clone$1","get$2","makeGetter","substituteTimeAgo","relativeTime$1","posNegDuration","thresholds","ss","getSetRelativeTimeRounding","roundingFunction","getSetRelativeTimeThreshold","limit","withSuffix","toISOString$1","abs$1","Y","toFixed","asSeconds","totalSign","ymSign","daysSign","hmsSign","fun","defaultCalendar","sameDay","nextDay","lastDay","lastWeek","sameElse","defaultLongDateFormat","LTS","LT","L","LL","LLL","LLLL","defaultDayOfMonthOrdinalParse","defaultRelativeTime","future","past","mm","hh","dd","MM","yy","match1","match2","match3","match4","match6","match1to2","match3to4","match5to6","match1to3","match1to4","match1to6","matchUnsigned","matchSigned","matchTimestamp","matchWord","parseTwoDigitYear","getSetYear","defaultLocaleMonths","defaultLocaleWeek","defaultLocaleWeekdays","defaultLocaleWeekdaysMin","kInput","_isPm","pos1","pos2","defaultLocaleMeridiemParse","getSetHour","dayOfMonthOrdinalParse","meridiemParse","UT","GMT","EDT","EST","CDT","CST","MDT","MST","PDT","PST","prototypeMin","prototypeMax","invalid","isoWeekYear","getSetDayOfMonth","getSetMinute","getSetSecond","getSetMillisecond","isoWeeks","isoWeeksInYear","isDST","zoneAbbr","zoneName","isDSTShifted","proto$1","firstDayOfYear","firstDayOfWeek","langData","asMilliseconds","asMinutes","asHours","asDays","asWeeks","asMonths","asYears","proto$2","toIsoString","relativeTimeRounding","relativeTimeThreshold","webpackPolyfill","webpackEmptyContext","req","resolve","buf","oct","_hexToByte","unparse","bth","_byteToHex","v1","clockseq","_clockseq","msecs","nsecs","_lastNSecs","dt","_lastMSecs","tl","tmh","_nodeId","rnds","rng","_rng","globalVar","crypto","getRandomValues","_rnds8","Uint8Array","_rnds","_seedBytes","eval","Graph3d","graph3d","containerElement","DataGroup","Settings","colX","colY","colZ","colValue","getMouseX","targetTouches","getMouseY","_assign","_assign2","_require2","legendLabel","xLabel","zLabel","xValueLabel","yValueLabel","zValueLabel","showXAxis","showYAxis","showZAxis","showGrid","showPerspective","showShadow","keepAspectRatio","verticalRatio","dotSizeRatio","dotSizeMinFraction","dotSizeMaxFraction","showAnimationControls","animationInterval","animationAutoStart","axisColor","gridColor","xCenter","yCenter","boxShadow","borderLeft","xBarWidth","yBarWidth","valueMin","valueMax","xMin","xMax","xStep","yStep","zMin","zMax","zStep","_setScale","xRange","yRange","zRange","valueRange","zCenter","_convert3Dto2D","point3d","translation","_convertPointToTranslation","_convertTranslationToScreen","ax","ay","cx","cy","cz","sinTx","cosTx","sinTy","cosTy","sinTz","cosTz","bx","by","ex","ey","ez","dz","currentXCenter","canvas","currentYCenter","_calcTranslations","trans","screen","transBottom","dist","sortDepth","_initializeRanges","dg","getDataPoints","dataX","dataY","dataMatrix","xIndex","yIndex","pointRight","pointTop","pointCross","_checkValueField","pointNext","noCanvas","fontWeight","ontouchstart","_onTouchStart","onmousewheel","_onWheel","ontooltip","_onTooltip","_onClick","_setSize","_resizeCanvas","animationStart","dataFilter","slider","animationStop","_resizeCenter","getCameraPosition","_readData","initializeData","_redrawFilter","validate","setPointDrawingMethod","getDataTable","_redrawBarGraphPoint","_redrawBarColorGraphPoint","_redrawBarSizeGraphPoint","_redrawDotGraphPoint","_redrawDotLineGraphPoint","_redrawDotColorGraphPoint","_redrawDotSizeGraphPoint","_redrawSurfaceGraphPoint","_redrawGridGraphPoint","_redrawLineGraphPoint","_pointDrawingMethod","_redrawSlider","_redrawClear","_redrawAxis","_redrawDataGraph","_redrawInfo","_redrawLegend","_getContext","getContext","clearRect","_dotSize","_getLegendWidth","isSizeLegend","isValueLegend","ymax","hue","_hsv2rgb","strokeRect","widthMin","legendMin","legendMax","info","getInfo","lineStyle","drawAxisLabelX","armAngle","yMargin","point2d","drawAxisLabelY","drawAxisLabelZ","_line3d","from2d","to2d","xText","yText","zText","gridLenX","gridLenY","textMargin","armVector","defaultXStep","defaultYStep","_msg","defaultZStep","from3d","_msg2","xMin2d","xMax2d","H","V","Hi","X","_getStrokeWidth","_redrawBar","xWidth","yWidth","surfaces","corners","transCenter","_polygon","_drawCircle","_calcRadius","_getColorsRegular","_getColorsColor","_getColorsSize","colors","fraction","dotSize","sizeMin","sizeRange","cross","topSideVisible","aDiff","bDiff","zAvg","_drawGridLine","_storeMousePosition","startMouseX","startMouseY","_startCameraOffset","leftButtonDown","touchDown","startStart","startEnd","startArmRotation","moving","diffX","diffY","scaleX","scaleY","offXNew","offYNew","horizontalNew","verticalNew","snapValue","parameters","boundingRect","mouseX","mouseY","dataPoint","_dataPointFromXY","tooltipTimeout","_hideTooltip","_showTooltip","ontouchmove","_onTouchMove","ontouchend","_onTouchEnd","oldLength","_insideTriangle","triangle","bs","cs","closestDataPoint","closestDist","triangle1","triangle2","distX","distY","hasBars","dotWidth","dotHeight","setSize","assign","$assign","K","aLen","desc","colorOptions","dataTable","rawData","_onChange","withBars","defaultXBarWidth","getSmallestDifference","defaultYBarWidth","_initializeRange","getColumnRange","_setRangeDefaults","defaultValueMin","defaultValueMax","_collectRangeSettings","upper","range_label","step_label","settings","expand","smallest_diff","getNumberOfRows","defaultMin","defaultMax","initDataAsMatrix","reload","combine","newMin","newMax","_firstTarget","events","propagatedHandler","_handled","stopped","srcStop","firstTarget","elemHammer","_handlers","Manager","PropagatingHammer","pointerType","handler","eventType","hammers","exportName","setTimeoutContext","timeout","bindFn","invokeArrayArg","each","deprecationMessage","child","childP","baseP","_super","boolOrFn","TYPE_FUNCTION","ifUndefined","val1","val2","addEventListeners","splitStr","removeEventListeners","inStr","find","inArray","findByKey","uniqueArray","results","prefixed","camelProp","VENDOR_PREFIXES","uniqueId","_uniqueId","getWindowForElement","doc","ownerDocument","defaultView","parentWindow","Input","manager","inputTarget","domHandler","ev","createInputInstance","inputClass","SUPPORT_POINTER_EVENTS","PointerEventInput","SUPPORT_ONLY_TOUCH","TouchInput","SUPPORT_TOUCH","TouchMouseInput","MouseInput","pointersLen","pointers","changedPointersLen","changedPointers","INPUT_START","INPUT_END","INPUT_CANCEL","session","computeInputData","recognize","prevInput","pointersLength","firstInput","simpleCloneInputData","firstMultiple","offsetCenter","getCenter","timeStamp","deltaTime","getAngle","getDistance","computeDeltaXY","offsetDirection","getDirection","overallVelocity","getVelocity","overallVelocityX","overallVelocityY","rotation","getRotation","maxPointers","computeIntervalInputData","offsetDelta","prevDelta","velocity","velocityX","velocityY","lastInterval","COMPUTE_INTERVAL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","PROPS_XY","PROPS_CLIENT_XY","evEl","MOUSE_ELEMENT_EVENTS","evWin","MOUSE_WINDOW_EVENTS","pressed","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","pointerEvents","SingleTouchInput","evTarget","SINGLE_TOUCH_TARGET_EVENTS","SINGLE_TOUCH_WINDOW_EVENTS","started","normalizeSingleTouches","all","touches","changedTouches","TOUCH_TARGET_EVENTS","targetIds","getTouches","allTouches","INPUT_MOVE","identifier","changedTargetTouches","mouse","primaryTouch","lastTouches","recordTouches","eventData","setLastTouch","lastTouch","lts","removeLastTouch","DEDUP_TIMEOUT","isSyntheticEvent","DEDUP_DISTANCE","TouchAction","cleanTouchActions","actions","TOUCH_ACTION_NONE","hasPanX","TOUCH_ACTION_PAN_X","hasPanY","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_AUTO","Recognizer","STATE_POSSIBLE","simultaneous","requireFail","stateStr","STATE_CANCELLED","STATE_ENDED","STATE_CHANGED","STATE_BEGAN","directionStr","getRecognizerByNameIfManager","otherRecognizer","recognizer","AttrRecognizer","PanRecognizer","pX","pY","PinchRecognizer","PressRecognizer","_timer","_input","RotateRecognizer","SwipeRecognizer","TapRecognizer","pTime","pCenter","recognizers","preset","handlers","oldCssProps","touchAction","toggleCssProps","recognizeWith","requireFailure","cssProps","triggerDomEvent","gestureEvent","createEvent","initEvent","gesture","dispatchEvent","TEST_ELEMENT","dest","MOBILE_REGEX","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM","2","3","4","5","MSPointerEvent","PointerEvent","removePointer","eventTypeNormalized","isTouch","storeIndex","pointerId","SINGLE_TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TOUCH_INPUT_MAP","inputEvent","inputData","isMouse","sourceCapabilities","firesTouchEvents","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_MAP","touchMap","cssSupports","CSS","supports","compute","preventDefaults","prevented","hasNone","isTapPointer","isTapMovement","isTapTouchTime","preventSrc","STATE_RECOGNIZED","dropRecognizeWith","dropRequireFailure","hasRequireFailures","canRecognizeWith","additionalEvent","tryEmit","canEmit","inputDataClone","attrTest","optionPointers","isRecognized","directionTest","hasMoved","inOut","validPointers","validMovement","validTime","taps","posThreshold","validTouchTime","failTimeout","validInterval","validMultiTap","tapCount","VERSION","domEvents","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","curRecognizer","existing","STATE_FAILED","Tap","Pan","Swipe","Pinch","Rotate","Press","Timeline","Graph2d","timeline","forthArgument","directionFromDom","domNode","parentElement","ondblclick","oncontextmenu","onpointerdown","onpointermove","onpointerup","initialFitDone","getItemRange","getStart","getEnd","getItemVerticalScroll","leftHeight","shouldScroll","itemTop","currentScrollHeight","targetOffset","scrollOffset","newDataSet","focus","startPos","initialVerticalScroll","verticalAnimationFrame","willDraw","setFinalVerticalPosition","finalVerticalScroll","finalVerticalCallback","minItem","maxItem","startSide","endSide","lhs","rhs","snappedTime","what","pageX","pageY","toggleRollingMode","generated","centerCoordinates","hueCircle","initialColor","previousColor","applied","updateCallback","closeCallback","_bindHammer","htmlColors","black","navy","darkblue","mediumblue","darkgreen","teal","darkcyan","deepskyblue","darkturquoise","mediumspringgreen","lime","springgreen","aqua","cyan","midnightblue","dodgerblue","lightseagreen","forestgreen","seagreen","darkslategray","limegreen","mediumseagreen","turquoise","royalblue","steelblue","darkslateblue","mediumturquoise","indigo","darkolivegreen","cadetblue","cornflowerblue","mediumaquamarine","dimgray","slateblue","olivedrab","slategray","lightslategray","mediumslateblue","lawngreen","chartreuse","aquamarine","maroon","purple","olive","gray","skyblue","lightskyblue","blueviolet","darkred","darkmagenta","saddlebrown","darkseagreen","lightgreen","mediumpurple","darkviolet","palegreen","darkorchid","yellowgreen","sienna","brown","darkgray","lightblue","greenyellow","paleturquoise","lightsteelblue","powderblue","firebrick","darkgoldenrod","mediumorchid","rosybrown","darkkhaki","silver","mediumvioletred","indianred","peru","chocolate","tan","lightgrey","palevioletred","thistle","orchid","goldenrod","crimson","gainsboro","plum","burlywood","lightcyan","lavender","darksalmon","violet","palegoldenrod","lightcoral","khaki","aliceblue","honeydew","azure","sandybrown","wheat","beige","whitesmoke","mintcream","ghostwhite","salmon","antiquewhite","linen","lightgoldenrodyellow","oldlace","fuchsia","magenta","deeppink","orangered","tomato","hotpink","coral","darkorange","lightsalmon","orange","lightpink","pink","gold","peachpuff","navajowhite","moccasin","bisque","mistyrose","blanchedalmond","papayawhip","lavenderblush","seashell","cornsilk","lemonchiffon","floralwhite","snow","yellow","lightyellow","ivory","white","setInitial","htmlColor","_isColorString","rgbaArray","_rgbaArray","rgbObj","_setColor","_generateHueCircle","_hide","_updatePicker","alert","angleConvert","colorPickerSelector","colorPickerCanvas","pixelRation","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","setTransform","putImageData","brightnessRange","opacityRange","initialColorDiv","newColorDiv","colorPickerDiv","opacityDiv","brightnessDiv","arrowDiv","_setOpacity","_setBrightness","brightnessLabel","opacityLabel","cancelButton","applyButton","_apply","saveButton","_save","loadButton","_loadLast","pinch","_moveSelector","sat","sfac","getImageData","newLeft","linegraph","initialLoad","isGroupVisible","Network","network","dotparser","gephiParser","convertDot","convertGephi","edgeIndices","eventListeners","onTap","onDoubleTap","onHold","onDragStart","onDrag","onDragEnd","onPinch","onMouseMove","onContext","functions","createNode","bindEventListeners","Groups","Canvas","selectionHandler","SelectionHandler","interactionHandler","InteractionHandler","View","renderer","CanvasRenderer","PhysicsEngine","layoutEngine","LayoutEngine","clustering","ClusterEngine","ManipulationSystem","nodesHandler","NodesHandler","edgesHandler","EdgesHandler","KamadaKawai","networkOptions","_updateVisibleIndices","_isClusteredNode","fromNode","toNode","edgeNodesPresent","_isClusteredEdge","_updateState","_updateValueRange","unselectAll","gephi","gephiData","valueTotal","setValueRange","canvasToDOM","DOMtoCanvas","findNode","isCluster","openCluster","cluster","getNodesInCluster","clusterByConnection","clusterByHubsize","clusterOutliers","getSeed","enableEditMode","disableEditMode","addNodeMode","editNodeMode","addEdgeMode","editEdgeMode","deleteSelected","getPositions","storePositions","moveNode","getBoundingBox","getConnectedNodes","objectId","getConnectedEdges","startSimulation","stopSimulation","stabilize","getSelectedNodes","getSelectedEdges","getNodeAt","getEdgeAt","selectNodes","selectEdges","getViewPosition","releaseNode","getOptionsFromConfigurator","CanvasRenderingContext2D","square","s2","ir","triangleDown","star","diamond","roundRect","r2d","ellipse_vis","ox","oy","xe","ye","xm","ym","database","wEllipse","hEllipse","ymb","yeb","patternLength","slope","distRemaining","patternIndex","dashLength","hexagon","edit","del","back","addDescription","edgeDescription","editEdgeDescription","createEdgeError","deleteClusterError","editClusterError","CachedImage","NUM_ITERATIONS","h2","h4","h8","h16","w4","w8","w16","coordinates","_fillMipMap","drawImage","_to","defaultIndex","groupsArray","defaultGroups","optionFields","groupName","groupname","shouldCreate","_index","nodesListeners","_nodeId2","doNotEmit","oldNodesData","newNodes","positionInitially","changedData","oldValue","clearPositions","dataArray","_node2","nodeList","nodeObj","edgeList","isIterable","LabelAccumulator","textWidth","measureText","finalize","nlLines","splitBlocks","_text","splitStringIntoLines","_mod","_text2","append","newLine","_i2","markupSystem","system","spacing","buffer","modStack","modName","emitBlock","ch","unshift","beginable","decodeMarkupSystem","splitMarkdownBlocks","splitHtmlBlocks","curWidth","words","pre","newText","overMaxWidth","appendLast","getLongestFit","word","getLongestFitWord","newW","tmpText","_add","tmpLines","tmpLine","firstEmptyBlock","tmpBlocks","determineLineHeights","determineLabelSize","removeEmptyBlocks","_setMargins","dimensions","getDimensionsFromLabel","_addBoundingBoxMargin","$getPrototypeOf","setPrototypeOf","buggy","_CircleImageBase2","_CircleImageBase3","_CircleImageBase","diameter","_drawRawCircle","_resizeImage","switchImages","clip","_drawImageAtPosition","_drawImageLabel","_distanceToBorder","_ShapeBase2","_ShapeBase3","_ShapeBase","_drawShape","_icon","neutralborderWidth","selectionLineWidth","edgesListeners","edgeData","smoothOptions","reconnectEdges","_edgeId","oldEdgesData","edgesData","oldEdge","showInternalIds","_addMissingEdges","_removeInvalidEdges","edgesToDelete","addIds","_CubicBezierEdgeBase2","_CubicBezierEdgeBase3","_CubicBezierEdgeBase","viaNodes","via1","via2","_bezierCurve","_findBorderPositionBezier","_ref","_ref2","_getDistanceToBezierEdge","_ref3","_ref4","vec","_BezierEdgeBase2","_BezierEdgeBase3","CubicBezierEdgeBase","_BezierEdgeBase","_boundFunction","positionBezierNode","physicsChange","setupSupportNode","parentEdgeId","cr","xVia","yVia","stepX","stepY","_stepX","_stepY","_stepX2","_stepY2","pi","originalAngle","myAngle","_pi","_originalAngle","_myAngle","_stepX3","_stepY3","edgeSegmentLength","toBorderDist","toBorderPoint","borderPos","Repulsion","HierarchicalRepulsion","SpringSolver","HierarchicalSpringSolver","ForceAtlas2BasedRepulsionSolver","ForceAtlas2BasedCentralGravitySolver","physicsEdgeIndices","velocities","physicsEnabled","simulationInterval","requiresTimeout","previousStates","referenceState","freezeCache","renderTimer","adaptiveTimestepEnabled","adaptiveCounter","adaptiveInterval","stabilized","startedStabilization","stabilizationIterations","ready","layoutFailed","initPhysics","updatePhysicsData","nodesSolver","edgesSolver","gravitySolver","modelOptions","viewFunction","simulationStep","_emitStabilized","startTime","physicsTick","runDoubleSpeed","amountOfIterations","solve","moveNodes","_evaluateStepQuality","_startStabilizing","physicsStep","revert","adjustTimeStep","nodeIds","positions","vx","vy","reference","maxNodeVelocity","averageNodeVelocity","nodeVelocity","_performStep","maxV","calculateComponentVelocity","targetIterations","_freezeNodes","_stabilizationBatch","running","sendProgress","_finalizeStabilization","_restoreFrozenNodes","forceSize","arrowSize","RepulsionSolver","repulsingForce","HierarchicalRepulsionSolver","edgeLength","node3","_calculateSpringForce","springForce","springFx","springFy","totalFx","totalFy","_i3","correctionFx","correctionFy","_i4","_nodeId3","_BarnesHutSolver2","_BarnesHutSolver3","_BarnesHutSolver","degree","_CentralGravitySolver2","_CentralGravitySolver3","_CentralGravitySolver","Cluster","clusteredNodes","clusteredEdges","hubsize","_getHubSize","_checkOptions","nodesToCluster","refreshData","joinCondition","childNodesObj","childEdgesObj","cloneOptions","_cluster","edgeCount","clusters","usedNodes","relevantEdgeCount","checkJoinCondition","findClusterData","foundCluster","gatheringSuccessful","childNodeId","_getConnectedId","_m","clusterByEdgeCount","clusterNodeProperties","parentNodeId","parentClonedOptions","childClonedOptions","childNodeIDs","childNode","childEdge","clusterEdgeProperties","otherNodeId","childKeys","createEdges","newEdges","_j3","createdEdge","_edge","newEdge","matchToDirection","matchFromDirection","_createClusteredEdge","clusteringEdgeReplacingIds","edgeReplacedById","_backupEdgeOptions","tmpNodesToRemove","allowSingleNodeCluster","processProperties","childNodesOptions","childEdgesOptions","_clonedOptions","clusterId","_getClusterPosition","clusterNode","containedNodes","containedEdges","_clusterEdges","originalOptions","clusterNodeId","parentIndex","parentClusterNodeId","_openChildCluster","releaseFunction","clusterPosition","newPositions","_nodeId4","_containedNode","_nodeId5","_containedNode2","edgesToBeDeleted","otherNode","transferId","transferEdge","otherCluster","_restoreEdge","nodesArray","_nodeId6","reverse","clusteredNodeId","startEdgeId","allEdgeIds","getClusteredEdges","clusteredEdgeId","getBaseEdges","IdsToHandle","doneIds","foundIds","nextId","nextEdge","replacingIds","replacingId","average","averageSquared","hubCounter","largestHub","variance","standardDeviation","hubThreshold","baseEdge","extraOptions","childEdges","_obj","_createClusterEdges","_edge2","_nodeId7","clusteredNode","deletedNodeIds","deletedEdgeIds","eachClusterNode","_node3","endPointsValid","replacedIds","numValid","containedEdgeId","containedEdge","deletedEdgeId","_filter","shouldBeClustered","clusterFrom","_getClusterNodeForNode","clusterTo","continueLoop","clustersToOpen","numNodes","allowSingle","_Node","childClusterId","childCluster","clusterEdge","parentClusterEdge","srcId","_initRequestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","msRequestAnimationFrame","redrawRequested","renderingActive","renderRequests","allowRedraw","_determineBrowserMethod","_resizeNodes","_requestRedraw","_startRendering","cancelAnimationFrame","timer","myWindow","_requestNextFrame","_renderStep","_drawEdges","_drawNodes","alwaysShow","topLeft","bottomRight","viewableArea","isSelected","isBoundingBoxOverlappingWith","browserType","resizeTimer","resizeFunction","cameraState","canvasViewCenter","hammerFrame","_cleanUp","previousWidth","previousHeight","widthRatio","heightRatio","newScale","currentViewCenter","distanceFromCenter","tabIndex","_setPixelRatio","_prepareValue","emitEvent","oldWidth","oldHeight","previousRatio","_getCameraState","newWidth","newHeight","_setCameraState","numerator","_determinePixelRatio","_XconvertCanvasToDOM","_YconvertCanvasToDOM","_XconvertDOMtoCanvas","_YconvertDOMtoCanvas","animationSpeed","renderRefreshRate","animationEasingFunction","easingTime","sourceScale","targetScale","sourceTranslation","targetTranslation","lockedOnNodeId","lockedOnNodeOffset","touchTime","initialZoom","zoomLevel","positionDefined","yDistance","xZoomLevel","yZoomLevel","findCenter","animationOptions","nodePosition","lockedOnNode","animateView","locked","_transitionRedraw","viewCenter","_lockedRedraw","finished","NavigationHandler","navigationHandler","popupObj","popupTimer","pinched","checkSelectionChanges","_generateClickEvent","previousSelection","selectAdditionalOnPoint","selectOnPoint","currentSelection","deselectedItems","_determineDifference","selectedItems","firstSet","secondSet","arrayDiff","firstArr","secondArr","selectObject","selectionObj","xFixed","yFixed","scaleOld","preScaleDragPointer","scaleFrac","tx","ty","postScaleDragPointer","popupVisible","_checkHidePopup","_checkShowPopup","hoverObject","pointerObj","previousPopupObjId","nodeUnderCursor","popupType","overlappingNodes","overlappingEdges","popupTargetType","popupTargetId","_pointerToPositionObject","stillOnObj","overNode","iconsCreated","navigationHammers","boundFunctions","activated","configureKeyboardBindings","loadNavigationElements","cleanNavigation","navigationDOM","navigationDivs","navigationDivActions","_fit","bindToRedraw","_stopMovement","boundAction","unbindFromRedraw","hoverObj","updateSelection","selectionChanged","deselectObject","DOM","emptySelection","_initBaseEvent","getClickedItems","highlightEdges","_selectConnectedEdges","_addToSelection","_removeFromSelection","canvasPos","returnNode","positionObject","_getAllNodesOverlappingWith","_getEdgesOverlappingWith","returnEdge","mindist","overlappingEdge","_unselectConnectedEdges","clusterSize","_addToHover","hoverChanged","emitBlurEvent","emitHoverEvent","_hoverConnectedEdges","idArray","RangeError","getItemsOnPoint","_ret","HorizontalStrategy","VerticalStrategy","HierarchicalStatus","childrenReference","parentReference","trees","distributionOrdering","levels","distributionIndex","isTree","treeIndex","treeId","accumulator","_getMaxLevel","nodeA","nodeB","minLevel","min_x","max_x","min_y","max_y","parents1","parents2","curLevel","initialRandomSeed","setPhysics","optionsBackup","setupHierarchicalLayout","layoutNetwork","curveType","prevHierarchicalState","setDirectionStrategy","adaptAllOptionsForHierarchicalLayout","backupPhysics","indices","clusterOptions","startLength","before","clusterBridges","_declusterAll","kamadaKawai","_shiftToCenter","getRangeCore","clustersPresent","definedLevel","undefinedLevel","lastNodeOnLevel","_determineLevelsByHubsize","_determineLevelsDirected","_determineLevelsCustomCallback","ensureLevel","distribution","_getDistribution","_generateMap","_placeNodesByHierarchy","_condenseHierarchy","stillShifting","branches","shiftTree","getTreeSizes","treeWidths","numTrees","getTreeSize","getBranchNodes","getBranchBoundary","branchMap","maxLevel","minSpace","maxSpace","branchNode","getPosition","_getSpaceAroundNode2","_getSpaceAroundNode","_getSpaceAroundNode3","minSpaceNode","maxSpaceNode","getCollisionLevel","maxLevel1","getMaxLevel","maxLevel2","shiftElementsCloser","centerParents","hier","levelNodes","hasSameParent","inSameSubNetwork","branchShiftCallback","centerParent","diffAbs","branchNodes1","branchNodes2","branchNodeBoundary1","branchNodeBoundary2","max1","min2","minSpace2","_shiftBlock","_centerParent","minimizeEdgeLength","allEdges","nodeLevel","C2","referenceNodes","aboveEdges","getFx","getDFx","getGuess","guess","guessMap","dfx","branchNodes","branchBoundary","minSpaceBranch","maxSpaceBranch","branchOffset","_getSpaceAroundNode4","_getSpaceAroundNode5","newPosition","getLevels","treeSizes","shiftBy","useMap","prevNode","nextNode","nextPos","parents","parentId","_getCenterPosition","_getSpaceAroundNode6","_getSpaceAroundNode7","positionedNodes","nodeArray","_indexArrayToNodes","handledNodeCount","_validatePositionAndContinue","parentLevel","childRef","_i5","childNodeLevel","previousPos","sharedParent","_findCommonParent","withChild","_placeBranchNodes","fix","hubSizes","hubSize","_getActiveEdges","_this6","levelDownstream","_getHubSizes","_crawlNetwork","_this7","levelByDirection","levelA","setMinLevelToZero","_this8","isBidirectional","otherEdge","levelB","_this9","fillInRelations","addRelation","checkIfTree","_this10","startingNodeId","crawler","tree","setTreeIndex","_this11","shifter","childA","childB","_this12","iterateParents","parentRef","findParent","foundParent","isVertical","minPos","maxPos","DirectionInterface","abstract","fake_use","_DirectionInterface","addToOrdering","_DirectionInterface2","editMode","manipulationDiv","editModeDiv","closeDiv","manipulationHammers","temporaryUIFunctions","temporaryEventFunctions","temporaryIds","guiEnabled","inMode","selectedControlNode","_restore","_setup","showManipulatorToolbar","_createEditButton","manipulationDOM","selectedNodeCount","_getSelectedNodeCount","selectedEdgeCount","_getSelectedEdgeCount","selectedTotalCount","needSeperator","_createAddNodeButton","_createSeperator","_createAddEdgeButton","_createEditNodeButton","_createEditEdgeButton","_createDeleteButton","_bindHammerToDiv","toggleEditMode","_temporaryBindEvent","_createBackButton","_createDescription","_performAddNode","_getSelectedNode","finalizedData","_temporaryBindUI","_handleConnect","_finishConnect","_dragControlNode","_dragStartEdge","edgeBeingEditedId","_performEditEdge","controlNodeFrom","_getNewTargetNode","controlNodeTo","_controlNodeTouch","_controlNodeDragStart","_controlNodeDrag","_controlNodeDragEnd","findBorderPositions","selectedNodes","selectedEdges","deleteFunction","_createWrappers","_removeManipulationDOM","_createButton","_cleanManipulatorHammers","_cleanupTemporaryNodesAndEdges","_unbindTemporaryUIs","_unbindTemporaryEvents","deleteBtnClass","labelClassName","newFunction","boundFunction","UIfunctionName","functionName","eventName","domElement","indexTempEdge","indexTempNode","fromSelect","toSelect","overlappingNodeIds","targetNode","connectionEdge","connectFromId","_performAddEdge","clickData","defaultData","sourceNodeId","targetNodeId","eeFunct","_FloydWarshall","_FloydWarshall2","edgeStrength","distanceSolver","edgesArray","ignoreClusters","D_matrix","getDistances","_createL_matrix","_createK_matrix","_createE_matrix","maxIterations","maxEnergy","highE_nodeId","dE_dx","dE_dy","delta_m","subIterations","_getHighestEnergyNode2","_getHighestEnergyNode","_getHighestEnergyNode3","_moveNode","_getEnergy2","_getEnergy","_getEnergy3","maxEnergyNodeId","dE_dx_max","dE_dy_max","nodeIdx","_getEnergy4","_getEnergy5","_E_sums$m","E_sums","d2E_dx2","d2E_dxdy","d2E_dy2","x_m","y_m","km","K_matrix","lm","L_matrix","iIdx","x_i","y_i","kmat","lmat","denominator","_updateE_matrix","E_matrix","mIdx","_mIdx","colm","kcolm","lcolm","cell","oldDx","oldDy","FloydWarshall","knode","inode","icolm","jnode","jcolm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA,cAEA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD,IACQ,kBAAXG,SAAyBA,OAAOC,IAC9CD,UAAWH,GACe,gBAAZC,SACdA,QAAa,IAAID,IAEjBD,EAAU,IAAIC,KACbK,KAAM,WACT,MAAgB,UAAUC,GAKhB,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUP,OAGnC,IAAIC,GAASO,EAAiBD,IAC7BE,EAAGF,EACHG,GAAG,EACHV,WAUD,OANAK,GAAQE,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOS,GAAI,EAGJT,EAAOD,QAvBf,GAAIQ,KA4DJ,OAhCAF,GAAoBM,EAAIP,EAGxBC,EAAoBO,EAAIL,EAGxBF,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,GAC9BK,cAAc,EACdC,YAAY,EACZC,IAAKN,KAMRV,EAAoBiB,EAAI,SAAStB,GAChC,GAAIe,GAASf,GAAUA,EAAOuB,WAC7B,WAAwB,MAAOvB,GAAgB,SAC/C,WAA8B,MAAOA,GAEtC,OADAK,GAAoBQ,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRV,EAAoBW,EAAI,SAASQ,EAAQC,GAAY,MAAOR,QAAOS,UAAUC,eAAejB,KAAKc,EAAQC,IAGzGpB,EAAoBuB,EAAI,GAGjBvB,EAAoBA,EAAoBwB,EAAI,OAKvD,SAAU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,EAAMH,GAASljI,EAKrB,MAAO4/H,OAGJoD,IAGT3hK,GAAiB,QAAI2hK","file":"vis"} \ No newline at end of file diff --git a/dist/vis.min.js b/dist/vis.min.js index d7bb1da7..1136c8a1 100644 --- a/dist/vis.min.js +++ b/dist/vis.min.js @@ -4,8 +4,8 @@ * * A dynamic, browser-based visualization library. * - * @version 4.20.1 - * @date 2017-07-02 + * @version 4.21.0 + * @date 2017-10-12 * * @license * Copyright (C) 2011-2017 Almende B.V, http://almende.com @@ -22,25 +22,26 @@ * * Vis.js may be distributed under either license. */ -"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vis=e():t.vis=e()}(this,function(){return function(t){function e(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return t[o].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){var o=i(1);o.extend(e,i(87)),o.extend(e,i(117)),o.extend(e,i(159))},function(t,e,i){function o(t){return t&&t.__esModule?t:{default:t}}var n=i(2),s=o(n),r=i(55),a=o(r),h=i(58),d=o(h),l=i(62),u=o(l),c=i(82),p=i(86);e.isNumber=function(t){return t instanceof Number||"number"==typeof t},e.recursiveDOMDelete=function(t){if(t)for(;!0===t.hasChildNodes();)e.recursiveDOMDelete(t.firstChild),t.removeChild(t.firstChild)},e.giveRange=function(t,e,i,o){if(e==t)return.5;var n=1/(e-t);return Math.max(0,(o-t)*n)},e.isString=function(t){return t instanceof String||"string"==typeof t},e.isDate=function(t){if(t instanceof Date)return!0;if(e.isString(t)){if(f.exec(t))return!0;if(!isNaN(Date.parse(t)))return!0}return!1},e.randomUUID=function(){return p.v4()},e.assignAllKeys=function(t,e){for(var i in t)t.hasOwnProperty(i)&&"object"!==(0,u.default)(t[i])&&(t[i]=e)},e.fillIfDefined=function(t,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var n in t)void 0!==i[n]&&("object"!==(0,u.default)(i[n])?void 0!==i[n]&&null!==i[n]||void 0===t[n]||!0!==o?t[n]=i[n]:delete t[n]:"object"===(0,u.default)(t[n])&&e.fillIfDefined(t[n],i[n],o))},e.protoExtend=function(t,e){for(var i=1;i3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s=2;s3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(o))throw new TypeError("Arrays are not supported by deepExtend");for(var s in o)if(o.hasOwnProperty(s)&&-1==t.indexOf(s))if(o[s]&&o[s].constructor===Object)void 0===i[s]&&(i[s]={}),i[s].constructor===Object?e.deepExtend(i[s],o[s]):null===o[s]&&void 0!==i[s]&&!0===n?delete i[s]:i[s]=o[s];else if(Array.isArray(o[s])){i[s]=[];for(var r=0;r=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,o)):t.attachEvent("on"+e,i)},e.removeEventListener=function(t,e,i,o){t.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,o)):t.detachEvent("on"+e,i)},e.preventDefault=function(t){t||(t=window.event),t.preventDefault?t.preventDefault():t.returnValue=!1},e.getTarget=function(t){t||(t=window.event);var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!=e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},e.hasParent=function(t,e){for(var i=t;i;){if(i===e)return!0;i=i.parentNode}return!1},e.option={},e.option.asBoolean=function(t,e){return"function"==typeof t&&(t=t()),null!=t?0!=t:e||null},e.option.asNumber=function(t,e){return"function"==typeof t&&(t=t()),null!=t?Number(t)||e||null:e||null},e.option.asString=function(t,e){return"function"==typeof t&&(t=t()),null!=t?String(t):e||null},e.option.asSize=function(t,i){return"function"==typeof t&&(t=t()),e.isString(t)?t:e.isNumber(t)?t+"px":i||null},e.option.asElement=function(t,e){return"function"==typeof t&&(t=t()),t||e||null},e.hexToRGB=function(t){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(e,function(t,e,i,o){return e+e+i+i+o+o});var i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},e.overrideOpacity=function(t,i){if(-1!=t.indexOf("rgba"))return t;if(-1!=t.indexOf("rgb")){var o=t.substr(t.indexOf("(")+1).replace(")","").split(",");return"rgba("+o[0]+","+o[1]+","+o[2]+","+i+")"}var o=e.hexToRGB(t);return null==o?t:"rgba("+o.r+","+o.g+","+o.b+","+i+")"},e.RGBToHex=function(t,e,i){return"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},e.parseColor=function(t){var i;if(!0===e.isString(t)){if(!0===e.isValidRGB(t)){var o=t.substr(4).substr(0,t.length-5).split(",").map(function(t){return parseInt(t)});t=e.RGBToHex(o[0],o[1],o[2])}if(!0===e.isValidHex(t)){var n=e.hexToHSV(t),s={h:n.h,s:.8*n.s,v:Math.min(1,1.02*n.v)},r={h:n.h,s:Math.min(1,1.25*n.s),v:.8*n.v},a=e.HSVToHex(r.h,r.s,r.v),h=e.HSVToHex(s.h,s.s,s.v);i={background:t,border:a,highlight:{background:h,border:a},hover:{background:h,border:a}}}else i={background:t,border:t,highlight:{background:t,border:t},hover:{background:t,border:t}}}else i={},i.background=t.background||void 0,i.border=t.border||void 0,e.isString(t.highlight)?i.highlight={border:t.highlight,background:t.highlight}:(i.highlight={},i.highlight.background=t.highlight&&t.highlight.background||void 0,i.highlight.border=t.highlight&&t.highlight.border||void 0),e.isString(t.hover)?i.hover={border:t.hover,background:t.hover}:(i.hover={},i.hover.background=t.hover&&t.hover.background||void 0,i.hover.border=t.hover&&t.hover.border||void 0);return i},e.RGBToHSV=function(t,e,i){t/=255,e/=255,i/=255;var o=Math.min(t,Math.min(e,i)),n=Math.max(t,Math.max(e,i));if(o==n)return{h:0,s:0,v:o};var s=t==o?e-i:i==o?t-e:i-t;return{h:60*((t==o?3:i==o?1:5)-s/(n-o))/360,s:(n-o)/n,v:n}};var m={split:function(t){var e={};return t.split(";").forEach(function(t){if(""!=t.trim()){var i=t.split(":"),o=i[0].trim(),n=i[1].trim();e[o]=n}}),e},join:function(t){return(0,d.default)(t).map(function(e){return e+": "+t[e]}).join("; ")}};e.addCssText=function(t,i){var o=m.split(t.style.cssText),n=m.split(i),s=e.extend(o,n);t.style.cssText=m.join(s)},e.removeCssText=function(t,e){var i=m.split(t.style.cssText),o=m.split(e);for(var n in o)o.hasOwnProperty(n)&&delete i[n];t.style.cssText=m.join(i)},e.HSVToRGB=function(t,e,i){var o,n,s,r=Math.floor(6*t),a=6*t-r,h=i*(1-e),d=i*(1-a*e),l=i*(1-(1-a)*e);switch(r%6){case 0:o=i,n=l,s=h;break;case 1:o=d,n=i,s=h;break;case 2:o=h,n=i,s=l;break;case 3:o=h,n=d,s=i;break;case 4:o=l,n=h,s=i;break;case 5:o=i,n=h,s=d}return{r:Math.floor(255*o),g:Math.floor(255*n),b:Math.floor(255*s)}},e.HSVToHex=function(t,i,o){var n=e.HSVToRGB(t,i,o);return e.RGBToHex(n.r,n.g,n.b)},e.hexToHSV=function(t){var i=e.hexToRGB(t);return e.RGBToHSV(i.r,i.g,i.b)},e.isValidHex=function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},e.isValidRGB=function(t){return t=t.replace(" ",""),/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(t)},e.isValidRGBA=function(t){return t=t.replace(" ",""),/rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(t)},e.selectiveBridgeObject=function(t,i){if("object"==(void 0===i?"undefined":(0,u.default)(i))){for(var o=(0,a.default)(i),n=0;n0&&e(o,t[n-1])<0;n--)t[n]=t[n-1];t[n]=o}return t},e.mergeOptions=function(t,e,i){var o=(arguments.length>3&&void 0!==arguments[3]&&arguments[3],arguments.length>4&&void 0!==arguments[4]?arguments[4]:{});if(null===e[i])t[i]=(0,a.default)(o[i]);else if(void 0!==e[i])if("boolean"==typeof e[i])t[i].enabled=e[i];else{void 0===e[i].enabled&&(t[i].enabled=!0);for(var n in e[i])e[i].hasOwnProperty(n)&&(t[i][n]=e[i][n])}},e.binarySearchCustom=function(t,e,i,o){for(var n=0,s=0,r=t.length-1;s<=r&&n<1e4;){var a=Math.floor((s+r)/2),h=t[a],d=void 0===o?h[i]:h[i][o],l=e(d);if(0==l)return a;-1==l?s=a+1:r=a-1,n++}return-1},e.binarySearchValue=function(t,e,i,o,n){for(var s,r,a,h,d=0,l=0,u=t.length-1,n=void 0!=n?n:function(t,e){return t==e?0:t0)return"before"==o?Math.max(0,h-1):h;if(n(r,e)<0&&n(a,e)>0)return"before"==o?h:Math.min(t.length-1,h+1);n(r,e)<0?l=h+1:u=h-1,d++}return-1},e.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},e.getScrollBarWidth=function(){var t=document.createElement("p");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.visibility="hidden",e.style.width="200px",e.style.height="150px",e.style.overflow="hidden",e.appendChild(t),document.body.appendChild(e);var i=t.offsetWidth;e.style.overflow="scroll";var o=t.offsetWidth;return i==o&&(o=e.clientWidth),document.body.removeChild(e),i-o},e.topMost=function(t,e){var i=void 0;Array.isArray(e)||(e=[e]);var o=!0,n=!1,r=void 0;try{for(var a,h=(0,s.default)(t);!(o=(a=h.next()).done);o=!0){var d=a.value;if(d){i=d[e[0]];for(var l=1;l=t.length?(this._t=void 0,n(1)):"keys"==e?n(0,i):"values"==e?n(0,t[i]):n(0,[i,t[i]])},"values"),s.Arguments=s.Array,o("keys"),o("values"),o("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e){t.exports={}},function(t,e,i){var o=i(10),n=i(12);t.exports=function(t){return o(n(t))}},function(t,e,i){var o=i(11);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==o(t)?t.split(""):Object(t)}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var o=i(14),n=i(15),s=i(30),r=i(20),a=i(31),h=i(8),d=i(32),l=i(46),u=i(48),c=i(47)("iterator"),p=!([].keys&&"next"in[].keys()),f=function(){return this};t.exports=function(t,e,i,m,v,g,y){d(i,e,m);var b,_,w,x=function(t){if(!p&&t in S)return S[t];switch(t){case"keys":case"values":return function(){return new i(this,t)}}return function(){return new i(this,t)}},k=e+" Iterator",D="values"==v,M=!1,S=t.prototype,O=S[c]||S["@@iterator"]||v&&S[v],C=O||x(v),T=v?D?x("entries"):C:void 0,E="Array"==e?S.entries||O:O;if(E&&(w=u(E.call(new t)))!==Object.prototype&&(l(w,k,!0),o||a(w,c)||r(w,c,f)),D&&O&&"values"!==O.name&&(M=!0,C=function(){return O.call(this)}),o&&!y||!p&&!M&&S[c]||r(S,c,C),h[e]=C,h[k]=f,v)if(b={values:D?C:x("values"),keys:g?C:x("keys"),entries:T},y)for(_ in b)_ in S||s(S,_,b[_]);else n(n.P+n.F*(p||M),e,b);return b}},function(t,e){t.exports=!0},function(t,e,i){var o=i(16),n=i(17),s=i(18),r=i(20),a=function(t,e,i){var h,d,l,u=t&a.F,c=t&a.G,p=t&a.S,f=t&a.P,m=t&a.B,v=t&a.W,g=c?n:n[e]||(n[e]={}),y=g.prototype,b=c?o:p?o[e]:(o[e]||{}).prototype;c&&(i=e);for(h in i)(d=!u&&b&&void 0!==b[h])&&h in g||(l=d?b[h]:i[h],g[h]=c&&"function"!=typeof b[h]?i[h]:m&&d?s(l,o):v&&b[h]==l?function(t){var e=function(e,i,o){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,o)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(l):f&&"function"==typeof l?s(Function.call,l):l,f&&((g.virtual||(g.virtual={}))[h]=l,t&a.R&&y&&!y[h]&&r(y,h,l)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var i=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)},function(t,e,i){var o=i(19);t.exports=function(t,e,i){if(o(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,o){return t.call(e,i,o)};case 3:return function(i,o,n){return t.call(e,i,o,n)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var o=i(21),n=i(29);t.exports=i(25)?function(t,e,i){return o.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var o=i(22),n=i(24),s=i(28),r=Object.defineProperty;e.f=i(25)?Object.defineProperty:function(t,e,i){if(o(t),e=s(e,!0),o(i),n)try{return r(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var o=i(23);t.exports=function(t){if(!o(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){t.exports=!i(25)&&!i(26)(function(){return 7!=Object.defineProperty(i(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){t.exports=!i(26)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){var o=i(23),n=i(16).document,s=o(n)&&o(n.createElement);t.exports=function(t){return s?n.createElement(t):{}}},function(t,e,i){var o=i(23);t.exports=function(t,e){if(!o(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!o(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!o(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!o(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){t.exports=i(20)},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var o=i(33),n=i(29),s=i(46),r={};i(20)(r,i(47)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=o(r,{next:n(1,i)}),s(t,e+" Iterator")}},function(t,e,i){var o=i(22),n=i(34),s=i(44),r=i(41)("IE_PROTO"),a=function(){},h=function(){var t,e=i(27)("iframe"),o=s.length;for(e.style.display="none",i(45).appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write(" diff --git a/examples/timeline/interaction/eventListeners.html b/examples/timeline/interaction/eventListeners.html index ae16dc67..6b07d5b6 100644 --- a/examples/timeline/interaction/eventListeners.html +++ b/examples/timeline/interaction/eventListeners.html @@ -34,7 +34,8 @@ var container = document.getElementById('visualization'); var options = { - editable: true + editable: true, + onInitialDrawComplete: function() { logEvent('Timeline initial draw completed', {}); }, }; var timeline = new vis.Timeline(container, items, options); diff --git a/examples/timeline/interaction/setSelection.html b/examples/timeline/interaction/setSelection.html index 36278797..45901bf1 100644 --- a/examples/timeline/interaction/setSelection.html +++ b/examples/timeline/interaction/setSelection.html @@ -26,6 +26,21 @@

+
+

If the height of the timeline is limited some items may be vertically offscreen. This demo uses Timeline.setSelection(ids, {focus: true}) and demonstrates that focusing on an item will +cause the timeline to scroll vertically to the item that is being focused on. You can use the buttons below select a random item either above or below the currently selected item. +

+ + +
+ +

If focusing on multiple items only the first item will be scrolled to. Try entering several ids and hitting select.

+

+Select item(s):
+

+ +
+ \ No newline at end of file diff --git a/examples/timeline/other/drag&drop.html b/examples/timeline/other/drag&drop.html index ab0d589d..fa323156 100644 --- a/examples/timeline/other/drag&drop.html +++ b/examples/timeline/other/drag&drop.html @@ -27,6 +27,27 @@ font-size: inherit; cursor: move; } + li.object-item { + list-style: none; + width: 150px; + color: #1A1A1A; + background-color: #D5DDF6; + border: 1px solid #97B0F8; + border-radius: 2px; + margin-bottom: 5px; + padding: 5px 12px; + } + li.object-item:before { + content: "≣"; + font-family: Arial, sans-serif; + display: inline-block; + font-size: inherit; + cursor: move; + } + .items-panel { + display: flex; + justify-content: space-around; + } @@ -37,23 +58,33 @@

For this to work, you will have to define your own 'dragstart' eventListener on each item in your list of items (make sure that any new item added to the list is attached to this eventListener 'dragstart' handler). This 'dragstart' handler must set dataTransfer - notice you can set the item's information as you want this way.

-
-

Items:

-
    -
  • - item 1 - box -
  • -
  • - item 2 - point -
  • -
  • - item 3 - range -
  • -
  • - item 3 - range - fixed times -
    - (start: now, end: now + 10 min) + +
    +
    +

    Items:

    +
      +
    • + item 1 - box +
    • +
    • + item 2 - point +
    • +
    • + item 3 - range +
    • +
    • + item 3 - range - fixed times -
      + (start: now, end: now + 10 min) +
    • +
    +
    + +
    +

    Object with "target:'item'":

    +
  • + object with target:'item'
  • -
+
diff --git a/examples/timeline/other/stressPerformance.html b/examples/timeline/other/stressPerformance.html new file mode 100644 index 00000000..94906e06 --- /dev/null +++ b/examples/timeline/other/stressPerformance.html @@ -0,0 +1,66 @@ + + + + + + Timeline | Stress Performance example + + + + + + +
+ + + + + \ No newline at end of file diff --git a/index.html b/index.html index 3875e7b6..c5016113 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ - +