10 lines
423 KiB
JavaScript
10 lines
423 KiB
JavaScript
|
|
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,s(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function a(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw a}}return s}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||u(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function u(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var c="undefined"==typeof window?null:window,d=c?c.navigator:null;c&&c.document;var h,f,p,v,g,y,m,b,x,w,E,k,T,C,P,S,B,D,_,A,M,R,I,N,L,z,O,V,F=l(""),X=l({}),j=l((function(){})),Y="undefined"==typeof HTMLElement?"undefined":l(HTMLElement),q=function(e){return e&&e.instanceString&&U(e.instanceString)?e.instanceString():null},W=function(e){return null!=e&&l(e)==F},U=function(e){return null!=e&&l(e)===j},H=function(e){return!$(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},K=function(e){return null!=e&&l(e)===X&&!H(e)&&e.constructor===Object},G=function(e){return null!=e&&l(e)===l(1)&&!isNaN(e)},Z=function(e){return"undefined"===Y?void 0:null!=e&&e instanceof HTMLElement},$=function(e){return Q(e)||J(e)},Q=function(e){return"collection"===q(e)&&e._private.single},J=function(e){return"collection"===q(e)&&!e._private.single},ee=function(e){return"core"===q(e)},te=function(e){return"stylesheet"===q(e)},ne=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},re=function(e){return function(e){return null!=e&&l(e)===X}(e)&&U(e.then)},ae=function(e,t){t||(t=fun
|
||
|
|
/*!
|
||
|
|
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
||
|
|
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
||
|
|
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
||
|
|
*/
|
||
|
|
var Vr=function(e){if(!(this instanceof Vr))return new Vr(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Vr.prototype={fulfill:function(e){return Fr(this,1,"fulfillValue",e)},reject:function(e){return Fr(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Vr;return n.onFulfilled.push(Yr(e,r,"fulfill")),n.onRejected.push(Yr(t,r,"reject")),Xr(n),r.proxy}};var Fr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Xr(e)),e},Xr=function(e){1===e.state?jr(e,"onFulfilled",e.fulfillValue):2===e.state&&jr(e,"onRejected",e.rejectReason)},jr=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(a):setTimeout(a,0)}},Yr=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var a;try{a=e(r)}catch(e){return void t.reject(e)}qr(t,a)}}},qr=function(e,t){if(e!==t&&e.proxy!==t){var n;if("object"===l(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(t){return void e.reject(t)}if("function"!=typeof n)e.fulfill(t);else{var r=!1;try{n.call(t,(function(n){r||(r=!0,n===t?e.reject(new TypeError("circular thenable chain")):qr(e,n))}),(function(t){r||(r=!0,e.reject(t))}))}catch(t){r||e.reject(t)}}}else e.reject(new TypeError("cannot resolve promise with itself"))};Vr.all=function(e){return new Vr((function(t,n){for(var r=new Array(e.length),a=0,i=function(n,i){r[n]=i,++a===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then((function(e){i(t,e)}),(function(e){n(e)})):i(t,r)}(o)}))},Vr.resolve=function(e){return new Vr((function(t,n){t(e)}))},Vr.reject=function(e){return new Vr((function(t,n){n(e)}))};var Wr="undefined"!=typeof Promise?Promise:Vr,Ur=function(e,t,n){var r=ee(e),a=!r,i=this._private=ge({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&U(i.complete)&&i.completes.push(i.complete),a){var o=e.position();i.startPosition=i.startPosition||{x:o.x,y:o.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var s=e.pan();i.startPan={x:s.x,y:s.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},Hr=Ur.prototype;ge(Hr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),$(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var a=e.style[r],i=a.name,o=e.startStyle[i];e.startStyle[i]=a,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;if("frame"===e)t=n.frames;else t=n.completes;return new Wr((function(e,n){
|
||
|
|
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Vl(e,t,n,r){var a=.1,i="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var o=0;o<4;++o)if("number"!=typeof arguments[o]||isNaN(arguments[o])||!isFinite(arguments[o]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var s=i?new Float32Array(11):new Array(11);function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function c(e){return 3*e}function d(e,t,n){return((l(t,n)*e+u(t,n))*e+c(t))*e}function h(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+c(t)}function f(t){for(var r=0,i=1;10!==i&&s[i]<=t;++i)r+=a;--i;var o=r+(t-s[i])/(s[i+1]-s[i])*a,l=h(o,e,n);return l>=.001?function(t,r){for(var a=0;a<4;++a){var i=h(r,e,n);if(0===i)return r;r-=(d(r,e,n)-t)/i}return r}(t,o):0===l?o:function(t,r,a){var i,o,s=0;do{(i=d(o=r+(a-r)/2,e,n)-t)>0?a=o:r=o}while(Math.abs(i)>1e-7&&++s<10);return o}(t,r,r+a)}var p=!1;function v(){p=!0,e===t&&n===r||function(){for(var t=0;t<11;++t)s[t]=d(t*a,e,n)}()}var g=function(a){return p||v(),e===t&&n===r?a:0===a?0:1===a?1:d(f(a),t,r)};g.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var y="generateBezier("+[e,t,n,r]+")";return g.toString=function(){return y},g}
|
||
|
|
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Fl=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),l=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),u=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,a){var i,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,l.tension=t,l.friction=r,o=(i=null!==a)?(c=e(t,r))/a*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return u[e*(u.length-1)|0]}:c}}(),Xl=function(e,t,n,r){var a=Vl(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},jl={linear:function(e,t,n){return e+(t-e)*n},ease:Xl(.25,.1,.25,1),"ease-in":Xl(.42,0,1,1),"ease-out":Xl(0,0,.58,1),"ease-in-out":Xl(.42,0,.58,1),"ease-in-sine":Xl(.47,0,.745,.715),"ease-out-sine":Xl(.39,.575,.565,1),"ease-in-out-sine":Xl(.445,.05,.55,.95),"ease-in-quad":Xl(.55,.085,.68,.53),"ease-out-quad":Xl(.25,.46,.45,.94),"ease-in-out-quad":Xl(.455,.03,.515,.955),"ease-in-cubic":Xl(.55,.055,.675,.19),"ease-out-cubic":Xl(.215,.61,.355,1),"ease-in-out-cubic":Xl(.645,.045,.355,1),"ease-in-quart":Xl(.895,.03,.685,.22),"ease-out-quart":Xl(.165,.84,.44,1),"ease-in-out-quart":Xl(.77,0,.175,1),"ease-in-quint":Xl(.755,.05,.855,.06),"ease-out-quint":Xl(.23,1,.32,1),"ease-in-out-quint":Xl(.86,0,.07,1),"ease-in-expo":Xl(.95,.05,.795,.035),"ease-out-expo":Xl(.19,1,.22,1),"ease-in-out-expo":Xl(1,0,0,1),"ease-in-circ":Xl(.6,.04,.98,.335),"ease-out-circ":Xl(.075,.82,.165,1),"ease-in-out-circ":Xl(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return jl.linear;var r=Fl(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Xl};function Yl(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function ql(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function Wl(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=ql(e,a),s=ql(t,a);if(G(o)&&G(s))return Yl(i,o,s,n,r);if(H(o)&&H(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],d=s[u];if(null!=c&&null!=d){var h=Yl(i,c,d,n,r);l.push(h)}else l.push(d)}return l}}function Ul(e,t,n,r){var a=!r,i=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=jl.linear;else{var c,d,h;if(W(s))c=u.parse("transition-timing-function",s).value;else c=s;W(c)?(d=c,h=[]):(d=c[1],h=c.slice(2).map((function(e){return+e}))),h.length>0?("spring"===d&&h.push(o.duration),o.easingImpl=jl[d].apply(null,h)):o.easingImpl=jl[d]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&a&&!e.locked()){var y={};Hl(v.x,g.x)&&(y.x=Wl(v.x,g.x,f,p)),Hl(v.y,g.y)&&(y.y=Wl(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,b=o.pan,x=i.pan,w=null!=b&&r;w&&(Hl(m.x,b.x)&&(x.x=Wl(m.x,b.x,f,p)),Hl(m.y,b.y)&&(x.y=Wl(m.y,b.y,f,p)),e.emit("pan"));var E=o.startZoom,k=o.zoom,T=null!=k&&r;T&&(Hl(E,k)&&(i.zoom=$t(i.minZoom,Wl(E,k,f,p),i.maxZoom)),e.emit("zoom")),(w||T)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&a){for(var P=0;P<C.length;P++){var S=C[P],B=S.name,D=S,_=o.startStyle[B],A=Wl(_,D,f,p,u.properties[_.name]);u.overrideBypass(e,B,A)}e.emit("style")}}return o.progress=f,f}function Hl(e,t){return null!=e&&null!=t&&(!(!G(e)||!G(t))||!(!e||!t))}function Kl(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function Gl(e,t){var n=t._private.aniEles,r=[];function a(t,n){var a=t._private,i=a.animation.current,o=a.animation.queue,s=!1;if(0===i.length){var l=o.shift();l&&i.push(l)}for(var u=function(e){for(var t=e.length-1;
|