UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 148 kB
!function(t){"function"==typeof define&&define.amd?define(["kendo.core.min","kendo.color.min","kendo.popup.min","kendo.icons.min"],t):t()}((function(){var t;t=window.kendo.jQuery,kendo.drawing.util=kendo.drawing.util||{},kendo.deepExtend(kendo.drawing.util,{createPromise:function(){return t.Deferred()},promiseAll:function(e){return t.when.apply(t,e)},extendStatic:function(t,e){if(e)if("function"==typeof e.__proto__)t.__proto__=e;else for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}}),function(t){window.kendo.util=window.kendo.util||{};var e=kendo.Class.extend({init:function(t){this._size=t,this._length=0,this._map={}},put:function(t,e){var n=this._map,o={key:t,value:e};n[t]=o,this._head?(this._tail.newer=o,o.older=this._tail,this._tail=o):this._head=this._tail=o,this._length>=this._size?(n[this._head.key]=null,this._head=this._head.newer,this._head.older=null):this._length++},get:function(t){var e=this._map[t];if(e)return e===this._head&&e!==this._tail&&(this._head=e.newer,this._head.older=null),e!==this._tail&&(e.older&&(e.older.newer=e.newer,e.newer.older=e.older),e.older=this._tail,e.newer=null,this._tail.newer=e,this._tail=e),e.value}}),n=/\r?\n|\r|\t/g;function o(t){return String(t).replace(n," ")}function r(t){var e=[];for(var n in t)e.push(n+t[n]);return e.sort().join("")}function i(t){for(var e=2166136261,n=0;n<t.length;++n)e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24),e^=t.charCodeAt(n);return e>>>0}var s,a={baselineMarkerSize:1};"undefined"!=typeof document&&((s=document.createElement("div")).style.cssText="position: absolute !important; top: -4000px !important; width: auto !important; height: auto !important;padding: 0 !important; margin: 0 !important; border: 0 !important;line-height: normal !important; visibility: hidden !important; white-space: pre!important;");var p=kendo.Class.extend({init:function(n){this._cache=new e(1e3),this.options=t.extend({},a,n)},measure:function(t,e,n){if(void 0===n&&(n={}),null==t)return{width:0,height:0,baseline:0};var a=i(t+r(e)),p=this._cache.get(a);if(p)return p;var c={width:0,height:0,baseline:0},h=n.box||s,u=this._baselineMarker().cloneNode(!1);for(var l in e){var f=e[l];void 0!==f&&(h.style[l]=f)}var d=!1!==n.normalizeText?o(t):String(t);return h.textContent=d,h.appendChild(u),document.body.appendChild(h),d.length&&(c.width=h.offsetWidth-this.options.baselineMarkerSize,c.height=h.offsetHeight,c.baseline=u.offsetTop+this.options.baselineMarkerSize),c.width>0&&c.height>0&&this._cache.put(a,c),h.parentNode.removeChild(h),c},_baselineMarker:function(){var t=document.createElement("div");return t.style.cssText="display: inline-block; vertical-align: baseline;width: "+this.options.baselineMarkerSize+"px; height: "+this.options.baselineMarkerSize+"px;overflow: hidden;",t}});p.current=new p,kendo.deepExtend(kendo.util,{LRUCache:e,TextMetrics:p,measureText:function(t,e,n){return p.current.measure(t,e,n)},objectKey:r,hashKey:i,normalizeText:o})}(window.kendo.jQuery),function(t){window.kendo=window.kendo||{};var e=kendo.drawing.util,n=e.extendStatic,o=kendo.Class,r=kendo.util,i=kendo.support.browser,s=e.createPromise,a=e.promiseAll,p=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.observers=function(){return this._observers=this._observers||[],this._observers},e.prototype.addObserver=function(t){return this._observers?this._observers.push(t):this._observers=[t],this},e.prototype.removeObserver=function(t){var e=this.observers(),n=e.indexOf(t);return-1!==n&&e.splice(n,1),this},e.prototype.trigger=function(t,e){var n=this._observers;if(n&&!this._suspended)for(var o=0;o<n.length;o++){var r=n[o];r[t]&&r[t](e)}return this},e.prototype.optionsChange=function(t){void 0===t&&(t={}),t.element=this,this.trigger("optionsChange",t)},e.prototype.geometryChange=function(){this.trigger("geometryChange",{element:this})},e.prototype.suspend=function(){return this._suspended=(this._suspended||0)+1,this},e.prototype.resume=function(){return this._suspended=Math.max((this._suspended||0)-1,0),this},e.prototype._observerField=function(t,e){this[t]&&this[t].removeObserver(this),this[t]=e,e.addObserver(this)},e}(o);function c(t,e){return t.push.apply(t,e),t}var h={1:"i",10:"x",100:"c",2:"ii",20:"xx",200:"cc",3:"iii",30:"xxx",300:"ccc",4:"iv",40:"xl",400:"cd",5:"v",50:"l",500:"d",6:"vi",60:"lx",600:"dc",7:"vii",70:"lxx",700:"dcc",8:"viii",80:"lxxx",800:"dccc",9:"ix",90:"xc",900:"cm",1e3:"m"};function u(t){for(var e=[1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],n="";t>0;)t<e[0]?e.shift():(n+=h[e[0]],t-=e[0]);return n}function l(t){return void 0!==t}var f=1;function d(){return"kdef"+f++}var y=Math.PI/180,g=Number.MAX_VALUE,m=-Number.MAX_VALUE;function v(t){return t/y}var x=String.fromCharCode;var w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function b(t){for(var e="",n=0,o=function(t){for(var e="",n=0;n<t.length;n++){var o=t.charCodeAt(n);if(55296<=o&&o<=56319){var r=o,i=t.charCodeAt(++n);isNaN(i)||(o=1024*(r-55296)+(i-56320)+65536)}o<128?e+=x(o):o<2048?(e+=x(192|o>>>6),e+=x(128|63&o)):o<65536?(e+=x(224|o>>>12),e+=x(128|o>>>6&63),e+=x(128|63&o)):o<1114111&&(e+=x(240|o>>>18),e+=x(128|o>>>12&63),e+=x(128|o>>>6&63),e+=x(128|63&o))}return e}(t);n<o.length;){var r=o.charCodeAt(n++),i=o.charCodeAt(n++),s=o.charCodeAt(n++),a=r>>2,p=(3&r)<<4|i>>4,c=(15&i)<<2|s>>6,h=63&s;isNaN(i)?c=h=64:isNaN(s)&&(h=64),e=e+w.charAt(a)+w.charAt(p)+w.charAt(c)+w.charAt(h)}return e}function _(t){return l((t.x||{}).location)?{x:t.x.location,y:t.y.location}:{x:t.pageX||t.clientX||0,y:t.pageY||t.clientY||0}}function C(t){return void 0===t&&(t={}),t.touch?t.touch.initialTouch:t.target}function T(t){return""===t||null===t||"none"===t||"transparent"===t||!l(t)}function k(t){if(t)return t[t.length-1]}function O(t,e,n){return Math.max(Math.min(t,n),e)}function M(t,e){if(t.length<2)return t.slice();return function t(n){if(n.length<=1)return n;var o=Math.floor(n.length/2),r=n.slice(0,o),i=n.slice(o);return function(t,n){for(var o=[],r=0,i=0,s=0;r<t.length&&i<n.length;)e(t[r],n[i])<=0?o[s++]=t[r++]:o[s++]=n[i++];return r<t.length&&o.push.apply(o,t.slice(r)),i<n.length&&o.push.apply(o,n.slice(i)),o}(r=t(r),i=t(i))}(t)}var S=Date.now||function(){return(new Date).getTime()};function E(t){return t*y}function A(t,e){var n,o=(n=e)?Math.pow(10,n):1;return Math.round(t*o)/o}function P(t,e){return l(t)?t:e}function z(t,e){for(var n in e)for(var o=n.trim().split(" "),r=0;r<o.length;r++)t.addEventListener(o[r],e[n],!1)}function N(t){var e=t.getBoundingClientRect(),n=document.documentElement;return{top:e.top+(window.pageYOffset||n.scrollTop)-(n.clientTop||0),left:e.left+(window.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}}function j(t,e){for(var n={},o=window.getComputedStyle(t)||{},r=Array.isArray(e)?e:[e],i=0;i<r.length;i++){var s=r[i];n[s]=o[s]}return n}function R(t){return isNaN(t)?t:t+"px"}function B(t,e){if(!e){var n=j(t,["width","height"]);return{width:parseInt(n.width,10),height:parseInt(n.height,10)}}var o=e.width,r=e.height;l(o)&&(t.style.width=R(o)),l(r)&&(t.style.height=R(r))}function F(t,e){for(var n in void 0===e&&(e={}),e)for(var o=n.trim().split(" "),r=0;r<o.length;r++)t.removeEventListener(o[r],e[n],!1)}function L(t){var e=j(t,["paddingLeft","paddingTop"]),n=e.paddingLeft,o=e.paddingTop;return{top:parseFloat(o),left:parseFloat(n)}}var I=function(t){function e(e,n,o,r,i,s){void 0===e&&(e=0),void 0===n&&(n=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===s&&(s=0),t.call(this),this.a=e,this.b=n,this.c=o,this.d=r,this.e=i,this.f=s}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.multiplyCopy=function(t){return new e(this.a*t.a+this.c*t.b,this.b*t.a+this.d*t.b,this.a*t.c+this.c*t.d,this.b*t.c+this.d*t.d,this.a*t.e+this.c*t.f+this.e,this.b*t.e+this.d*t.f+this.f)},e.prototype.invert=function(){var t=this,n=t.a,o=t.b,r=t.c,i=t.d,s=t.e,a=t.f,p=n*i-o*r;return 0===p?null:new e(i/p,-o/p,-r/p,n/p,(r*a-i*s)/p,(o*s-n*a)/p)},e.prototype.clone=function(){return new e(this.a,this.b,this.c,this.d,this.e,this.f)},e.prototype.equals=function(t){return!!t&&(this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.e===t.e&&this.f===t.f)},e.prototype.round=function(t){return this.a=A(this.a,t),this.b=A(this.b,t),this.c=A(this.c,t),this.d=A(this.d,t),this.e=A(this.e,t),this.f=A(this.f,t),this},e.prototype.toArray=function(t){var e=[this.a,this.b,this.c,this.d,this.e,this.f];if(l(t))for(var n=0;n<e.length;n++)e[n]=A(e[n],t);return e},e.prototype.toString=function(t,e){return void 0===e&&(e=","),this.toArray(t).join(e)},e.translate=function(t,n){return new e(1,0,0,1,t,n)},e.unit=function(){return new e(1,0,0,1,0,0)},e.rotate=function(t,n,o){var r=new e;return r.a=Math.cos(E(t)),r.b=Math.sin(E(t)),r.c=-r.b,r.d=r.a,r.e=n-n*r.a+o*r.b||0,r.f=o-o*r.a-n*r.b||0,r},e.scale=function(t,n){return new e(t,0,0,n,0,0)},e}(o);I.IDENTITY=I.unit();var D=/matrix\((.*)\)/;function H(t){var e=getComputedStyle(t).transform;return"none"===e?I.unit():function(t){var e=t.match(D);if(null===e||2!==e.length)return I.unit();var n=e[1].split(",").map((function(t){return parseFloat(t)}));return new(Function.prototype.bind.apply(I,[null].concat(n)))}(e)}function q(t){if(!t)return I.unit();for(var e=H(t),n=t.parentElement;n;){var o=H(n);e=e.multiplyCopy(o),n=n.parentElement}return e.b=e.c=e.e=e.f=0,e}var G={append:c,arabicToRoman:u,createPromise:s,defined:l,definitionId:d,deg:v,encodeBase64:b,eventCoordinates:_,eventElement:C,isTransparent:T,last:k,limitValue:O,mergeSort:M,now:S,promiseAll:a,rad:E,round:A,valueOrDefault:P,bindEvents:z,elementOffset:N,elementSize:B,elementStyles:j,unbindEvents:F,elementPadding:L,elementScale:q,DEG_TO_RAD:y,MAX_NUM:g,MIN_NUM:m},$={}.toString,V=function(t){function e(e,n){for(var o in void 0===n&&(n=""),t.call(this),this.prefix=n,e){var r=e[o];r=this._wrap(r,o),this[o]=r}}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.get=function(t){for(var e=t.split("."),n=this;e.length&&n;){n=n[e.shift()]}return n},e.prototype.set=function(t,e){this.get(t)!==e&&(this._set(t,this._wrap(e,t)),this.optionsChange({field:this.prefix+t,value:e}))},e.prototype._set=function(t,n){var o=t.indexOf(".")>=0,r=this,i=t;if(o){for(var s=i.split("."),a=this.prefix;s.length>1;){a+=(i=s.shift())+".";var p=r[i];p||((p=new e({},a)).addObserver(this),r[i]=p),r=p}i=s[0]}r._clear(i),r[i]=n},e.prototype._clear=function(t){var e=this[t];e&&e.removeObserver&&e.removeObserver(this)},e.prototype._wrap=function(t,n){var r=$.call(t),i=t;return null!==i&&l(i)&&"[object Object]"===r&&(t instanceof e||t instanceof o||(i=new e(i,this.prefix+n+".")),i.addObserver(this)),i},e}(p);function U(t){return function(e){return this[t]!==e&&(this[t]=e,this.geometryChange()),this}}function X(t){return function(){return this[t]}}var Y=function(t,e){var o=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e}(t);return function(t,e){for(var n=0;n<e.length;n++){var o=e[n],r=o.charAt(0).toUpperCase()+o.substring(1,o.length);t["set"+r]=U(o),t["get"+r]=X(o)}}(o.prototype,e),o};function W(t){return t&&"function"==typeof t.matrix?t.matrix():t}var Q=function(t){function e(e,n){t.call(this),this.x=e||0,this.y=n||0}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={ZERO:{}};return e.prototype.equals=function(t){return t&&t.x===this.x&&t.y===this.y},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.rotate=function(t,n){var o=e.create(n)||e.ZERO;return this.transform(I.rotate(t,o.x,o.y))},e.prototype.translate=function(t,e){return this.x+=t,this.y+=e,this.geometryChange(),this},e.prototype.translateWith=function(t){return this.translate(t.x,t.y)},e.prototype.move=function(t,e){return this.x=this.y=0,this.translate(t,e)},e.prototype.scale=function(t,e){return void 0===e&&(e=t),this.x*=t,this.y*=e,this.geometryChange(),this},e.prototype.scaleCopy=function(t,e){return this.clone().scale(t,e)},e.prototype.transform=function(t){var e=W(t),n=this.x,o=this.y;return this.x=e.a*n+e.c*o+e.e,this.y=e.b*n+e.d*o+e.f,this.geometryChange(),this},e.prototype.transformCopy=function(t){var e=this.clone();return t&&e.transform(t),e},e.prototype.distanceTo=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},e.prototype.round=function(t){return this.x=A(this.x,t),this.y=A(this.y,t),this.geometryChange(),this},e.prototype.toArray=function(t){var e=l(t);return[e?A(this.x,t):this.x,e?A(this.y,t):this.y]},e.prototype.toString=function(t,e){void 0===e&&(e=" ");var n=this.x,o=this.y;return l(t)&&(n=A(n,t),o=A(o,t)),n+e+o},e.create=function(t,n){if(l(t))return t instanceof e?t:1===arguments.length&&2===t.length?new e(t[0],t[1]):new e(t,n)},e.min=function(){for(var t=arguments,n=g,o=g,r=0;r<arguments.length;r++){var i=t[r];n=Math.min(i.x,n),o=Math.min(i.y,o)}return new e(n,o)},e.max=function(){for(var t=arguments,n=m,o=m,r=0;r<arguments.length;r++){var i=t[r];n=Math.max(i.x,n),o=Math.max(i.y,o)}return new e(n,o)},e.minPoint=function(){return new e(m,m)},e.maxPoint=function(){return new e(g,g)},o.ZERO.get=function(){return new e(0,0)},Object.defineProperties(e,o),e}(Y(p,["x","y"])),Z=function(t){function e(e,n){t.call(this),this.width=e||0,this.height=n||0}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={ZERO:{}};return e.prototype.equals=function(t){return t&&t.width===this.width&&t.height===this.height},e.prototype.clone=function(){return new e(this.width,this.height)},e.prototype.toArray=function(t){var e=l(t);return[e?A(this.width,t):this.width,e?A(this.height,t):this.height]},e.create=function(t,n){if(l(t))return t instanceof e?t:1===arguments.length&&2===t.length?new e(t[0],t[1]):new e(t,n)},o.ZERO.get=function(){return new e(0,0)},Object.defineProperties(e,o),e}(Y(p,["width","height"])),J=function(t){function e(e,n,o){void 0===e&&(e=new Q),void 0===n&&(n=new Z),void 0===o&&(o=0),t.call(this),this.setOrigin(e),this.setSize(n),this.setCornerRadius(o)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.clone=function(){return new e(this.origin.clone(),this.size.clone())},e.prototype.equals=function(t){return t&&t.origin.equals(this.origin)&&t.size.equals(this.size)},e.prototype.setOrigin=function(t){return this._observerField("origin",Q.create(t)),this.geometryChange(),this},e.prototype.getOrigin=function(){return this.origin},e.prototype.setCornerRadius=function(t){return this.cornerRadius=Array.isArray(t)?t:[t,t],this.geometryChange(),this},e.prototype.getCornerRadius=function(){return this.cornerRadius},e.prototype.setSize=function(t){return this._observerField("size",Z.create(t)),this.geometryChange(),this},e.prototype.getSize=function(){return this.size},e.prototype.width=function(){return this.size.width},e.prototype.height=function(){return this.size.height},e.prototype.topLeft=function(){return this.origin.clone()},e.prototype.bottomRight=function(){return this.origin.clone().translate(this.width(),this.height())},e.prototype.topRight=function(){return this.origin.clone().translate(this.width(),0)},e.prototype.bottomLeft=function(){return this.origin.clone().translate(0,this.height())},e.prototype.center=function(){return this.origin.clone().translate(this.width()/2,this.height()/2)},e.prototype.bbox=function(t){var n=this.topLeft().transformCopy(t),o=this.topRight().transformCopy(t),r=this.bottomRight().transformCopy(t),i=this.bottomLeft().transformCopy(t);return e.fromPoints(n,o,r,i)},e.prototype.transformCopy=function(t){return e.fromPoints(this.topLeft().transform(t),this.bottomRight().transform(t))},e.prototype.expand=function(t,e){return void 0===e&&(e=t),this.size.width+=2*t,this.size.height+=2*e,this.origin.translate(-t,-e),this},e.prototype.expandCopy=function(t,e){return this.clone().expand(t,e)},e.prototype.containsPoint=function(t){var e=this.origin,n=this.bottomRight();return!(t.x<e.x||t.y<e.y||n.x<t.x||n.y<t.y)},e.prototype._isOnPath=function(t,e){var n=this.expandCopy(e,e),o=this.expandCopy(-e,-e);return n.containsPoint(t)&&!o.containsPoint(t)},e.fromPoints=function(){var t=Q.min.apply(null,arguments),n=Q.max.apply(null,arguments),o=new Z(n.x-t.x,n.y-t.y);return new e(t,o)},e.union=function(t,n){return e.fromPoints(Q.min(t.topLeft(),n.topLeft()),Q.max(t.bottomRight(),n.bottomRight()))},e.intersect=function(t,n){var o={left:t.topLeft().x,top:t.topLeft().y,right:t.bottomRight().x,bottom:t.bottomRight().y},r={left:n.topLeft().x,top:n.topLeft().y,right:n.bottomRight().x,bottom:n.bottomRight().y};if(o.left<=r.right&&r.left<=o.right&&o.top<=r.bottom&&r.top<=o.bottom)return e.fromPoints(new Q(Math.max(o.left,r.left),Math.max(o.top,r.top)),new Q(Math.min(o.right,r.right),Math.min(o.bottom,r.bottom)))},e}(p),K=function(t){function e(e){void 0===e&&(e=I.unit()),t.call(this),this._matrix=e}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.clone=function(){return new e(this._matrix.clone())},e.prototype.equals=function(t){return t&&t._matrix.equals(this._matrix)},e.prototype.translate=function(t,e){return this._matrix=this._matrix.multiplyCopy(I.translate(t,e)),this._optionsChange(),this},e.prototype.scale=function(t,e,n){void 0===e&&(e=t),void 0===n&&(n=null);var o=n;return o&&(o=Q.create(o),this._matrix=this._matrix.multiplyCopy(I.translate(o.x,o.y))),this._matrix=this._matrix.multiplyCopy(I.scale(t,e)),o&&(this._matrix=this._matrix.multiplyCopy(I.translate(-o.x,-o.y))),this._optionsChange(),this},e.prototype.rotate=function(t,e){var n=Q.create(e)||Q.ZERO;return this._matrix=this._matrix.multiplyCopy(I.rotate(t,n.x,n.y)),this._optionsChange(),this},e.prototype.multiply=function(t){var e=W(t);return this._matrix=this._matrix.multiplyCopy(e),this._optionsChange(),this},e.prototype.matrix=function(t){return t?(this._matrix=t,this._optionsChange(),this):this._matrix},e.prototype._optionsChange=function(){this.optionsChange({field:"transform",value:this})},e}(p);function tt(t){return null===t?null:t instanceof K?t:new K(t)}var et=function(t){function e(e){t.call(this),this._initOptions(e)}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return o.nodeType.get=function(){return"Rect"},e.prototype._initOptions=function(t){void 0===t&&(t={});var e=t.clip,n=t.transform;n&&(t.transform=tt(n)),e&&!e.id&&(e.id=d()),this.options=new V(t),this.options.addObserver(this)},e.prototype.transform=function(t){if(!l(t))return this.options.get("transform");this.options.set("transform",tt(t))},e.prototype.parentTransform=function(){for(var t,e=this;e.parent;){var n=(e=e.parent).transform();n&&(t=n.matrix().multiplyCopy(t||I.unit()))}if(t)return tt(t)},e.prototype.currentTransform=function(t){void 0===t&&(t=this.parentTransform());var e,n=W(this.transform()),o=W(t);if(e=n&&o?o.multiplyCopy(n):n||o)return tt(e)},e.prototype.visible=function(t){return l(t)?(this.options.set("visible",t),this):!1!==this.options.get("visible")},e.prototype.clip=function(t){var e=this.options;return l(t)?(t&&!t.id&&(t.id=d()),e.set("clip",t),this):e.get("clip")},e.prototype.opacity=function(t){return l(t)?(this.options.set("opacity",t),this):P(this.options.get("opacity"),1)},e.prototype.clippedBBox=function(t){var e=this._clippedBBox(t);if(e){var n=this.clip();return n?J.intersect(e,n.bbox(t)):e}},e.prototype.containsPoint=function(t,e){if(this.visible()){var n=this.currentTransform(e),o=t;return n&&(o=t.transformCopy(n.matrix().invert())),this._hasFill()&&this._containsPoint(o)||this._isOnPath&&this._hasStroke()&&this._isOnPath(o)}return!1},e.prototype._hasFill=function(){var t=this.options.fill;return t&&!T(t.color)},e.prototype._hasStroke=function(){var t=this.options.stroke;return t&&t.width>0&&!T(t.color)},e.prototype._clippedBBox=function(t){return this.bbox(t)},Object.defineProperties(e.prototype,o),e}(p);function nt(t,e,n,o){var r=0,i=0;return o&&(r=Math.atan2(o.c*n,o.a*e),0!==o.b&&(i=Math.atan2(o.d*n,o.b*e))),{x:r,y:i}}var ot=Math.PI/2,rt=function(t){function e(e,n){void 0===e&&(e=new Q),void 0===n&&(n=0),t.call(this),this.setCenter(e),this.setRadius(n)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.setCenter=function(t){return this._observerField("center",Q.create(t)),this.geometryChange(),this},e.prototype.getCenter=function(){return this.center},e.prototype.equals=function(t){return t&&t.center.equals(this.center)&&t.radius===this.radius},e.prototype.clone=function(){return new e(this.center.clone(),this.radius)},e.prototype.pointAt=function(t){return this._pointAt(E(t))},e.prototype.bbox=function(t){for(var e=nt(this.center,this.radius,this.radius,t),n=Q.maxPoint(),o=Q.minPoint(),r=0;r<4;r++){var i=this._pointAt(e.x+r*ot).transformCopy(t),s=this._pointAt(e.y+r*ot).transformCopy(t),a=new Q(i.x,s.y);n=Q.min(n,a),o=Q.max(o,a)}return J.fromPoints(n,o)},e.prototype._pointAt=function(t){var e=this.center,n=this.radius;return new Q(e.x+n*Math.cos(t),e.y+n*Math.sin(t))},e.prototype.containsPoint=function(t){var e=this.center,n=this.radius;return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(n,2)},e.prototype._isOnPath=function(t,e){var n=this.center,o=this.radius,r=n.distanceTo(t);return o-e<=r&&r<=o+e},e}(Y(p,["radius"])),it=function(t){return function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.fill=function(t,e){var n=this.options;if(l(t)){if(t&&"Gradient"!==t.nodeType){var o={color:t};l(e)&&(o.opacity=e),n.set("fill",o)}else n.set("fill",t);return this}return n.get("fill")},e.prototype.stroke=function(t,e,n){return l(t)?(this.options.set("stroke.color",t),l(e)&&this.options.set("stroke.width",e),l(n)&&this.options.set("stroke.opacity",n),this):this.options.get("stroke")},e}(t)},st=I.IDENTITY.toString(),at=function(t){return function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.bbox=function(t){var e,n=W(this.currentTransform(t)),o=n?n.toString():st;this._bboxCache&&this._matrixHash===o?e=this._bboxCache.clone():(e=this._bbox(n),this._bboxCache=e?e.clone():null,this._matrixHash=o);var r=this.options.get("stroke.width");return r&&e&&e.expand(r/2),e},e.prototype.geometryChange=function(){delete this._bboxCache,this.trigger("geometryChange",{element:this})},e}(t)};function pt(t){var e="_"+t;return function(t){return l(t)?(this._observerField(e,t),this.geometryChange(),this):this[e]}}var ct=function(t,e){void 0===e&&(e=["geometry"]);var o=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e}(t);return function(t,e){for(var n=0;n<e.length;n++)t[e[n]]=pt(e[n])}(o.prototype,e),o},ht=function(t){function e(e,n){void 0===e&&(e=new rt),void 0===n&&(n={}),t.call(this,n),this.geometry(e),l(this.options.stroke)||this.stroke("#000")}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return o.nodeType.get=function(){return"Circle"},e.prototype.rawBBox=function(){return this._geometry.bbox()},e.prototype._bbox=function(t){return this._geometry.bbox(t)},e.prototype._containsPoint=function(t){return this.geometry().containsPoint(t)},e.prototype._isOnPath=function(t){return this.geometry()._isOnPath(t,this.options.stroke.width/2)},Object.defineProperties(e.prototype,o),e}(it(at(ct(et)))),ut=10;function lt(t,e,n){return void 0===n&&(n=ut),0===A(Math.abs(t-e),n)}function ft(t,e,n){return t<e||lt(t,e,n)}var dt=Math.pow,yt=function(t){function e(e,n){void 0===e&&(e=new Q),void 0===n&&(n={}),t.call(this),this.setCenter(e),this.radiusX=n.radiusX,this.radiusY=n.radiusY||n.radiusX,this.startAngle=n.startAngle,this.endAngle=n.endAngle,this.anticlockwise=n.anticlockwise||!1,this.xRotation=n.xRotation}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.clone=function(){return new e(this.center,{radiusX:this.radiusX,radiusY:this.radiusY,startAngle:this.startAngle,endAngle:this.endAngle,anticlockwise:this.anticlockwise})},e.prototype.setCenter=function(t){return this._observerField("center",Q.create(t)),this.geometryChange(),this},e.prototype.getCenter=function(){return this.center},e.prototype.pointAt=function(t){var e=this.center,n=E(t);return new Q(e.x+this.radiusX*Math.cos(n),e.y+this.radiusY*Math.sin(n))},e.prototype.curvePoints=function(){var t,e=this.startAngle,n=this.anticlockwise?-1:1,o=[this.pointAt(e)],r=this._arcInterval(),i=r.endAngle-r.startAngle,s=Math.ceil(i/45),a=i/s,p=e;this.xRotation&&(t=tt().rotate(this.xRotation,this.center));for(var c=1;c<=s;c++){var h=p+n*a,u=this._intervalCurvePoints(p,h,t);o.push(u.cp1,u.cp2,u.p2),p=h}return o},e.prototype.bbox=function(t){for(var e=this._arcInterval(),n=e.startAngle,o=e.endAngle,r=nt(this.center,this.radiusX,this.radiusY,t),i=v(r.x),s=v(r.y),a=this.pointAt(o).transformCopy(t),p=mt(i,n),c=mt(s,n),h=this.pointAt(n).transformCopy(t),u=Q.min(h,a),l=Q.max(h,a);p<o||c<o;){var f=void 0;p<o&&(f=this.pointAt(p).transformCopy(t),p+=90);var d=void 0;c<o&&(d=this.pointAt(c).transformCopy(t),c+=90),h=new Q(f.x,d.y),u=Q.min(u,h),l=Q.max(l,h)}return J.fromPoints(u,l)},e.prototype._arcInterval=function(){var t=this,e=t.startAngle,n=t.endAngle,o=t.anticlockwise;if(o){var r=e;e=n,n=r}return(e>n||o&&e===n)&&(n+=360),{startAngle:e,endAngle:n}},e.prototype._intervalCurvePoints=function(t,e,n){var o=this.pointAt(t),r=this.pointAt(e),i=this._derivativeAt(t),s=this._derivativeAt(e),a=(E(e)-E(t))/3,p=new Q(o.x+a*i.x,o.y+a*i.y),c=new Q(r.x-a*s.x,r.y-a*s.y);return n&&(o.transform(n),r.transform(n),p.transform(n),c.transform(n)),{p1:o,cp1:p,cp2:c,p2:r}},e.prototype._derivativeAt=function(t){var e=E(t);return new Q(-this.radiusX*Math.sin(e),this.radiusY*Math.cos(e))},e.prototype.containsPoint=function(t){var e,n=this._arcInterval(),o=n.endAngle-n.startAngle,r=this,i=r.center,s=r.radiusX,a=r.radiusY,p=i.distanceTo(t),c=Math.atan2(t.y-i.y,t.x-i.x),h=s*a/Math.sqrt(dt(s,2)*dt(Math.sin(c),2)+dt(a,2)*dt(Math.cos(c),2)),u=this.pointAt(this.startAngle).round(ut),l=this.pointAt(this.endAngle).round(ut),f=function(t,e,n,o){var r=e.x-t.x,i=o.x-n.x,s=e.y-t.y,a=o.y-n.y,p=t.x-n.x,c=t.y-n.y,h=r*a-i*s,u=(r*c-s*p)/h,l=(i*c-a*p)/h;if(u>=0&&u<=1&&l>=0&&l<=1)return new Q(t.x+l*r,t.y+l*s)}(i,t.round(ut),u,l);if(o<180)e=f&&ft(i.distanceTo(f),p)&&ft(p,h);else{var d=gt(i.x,i.y,s,a,t.x,t.y);360!==d&&(d=(360+d)%360);var y=n.startAngle<=d&&d<=n.endAngle;e=y&&ft(p,h)||!y&&(!f||f.equals(t))}return e},e.prototype._isOnPath=function(t,e){var n=this._arcInterval(),o=this.center,r=gt(o.x,o.y,this.radiusX,this.radiusY,t.x,t.y);return 360!==r&&(r=(360+r)%360),n.startAngle<=r&&r<=n.endAngle&&this.pointAt(r).distanceTo(t)<=e},e.fromPoints=function(t,n,o,r,i,s,a){var p=function(t){var e=t.x1,n=t.y1,o=t.x2,r=t.y2,i=t.rx,s=t.ry,a=t.largeArc,p=t.swipe,c=t.rotation;void 0===c&&(c=0);var h=E(c),u=Math.cos(h),l=Math.sin(h),f=u*(e-o)/2+l*(n-r)/2,d=-l*(e-o)/2+u*(n-r)/2,y=a!==p?1:-1,g=Math.pow(f,2),m=Math.pow(d,2),x=Math.pow(i,2),w=Math.pow(s,2),b=g/x+m/w;b>1&&(i*=b=Math.sqrt(g/x+m/w),x=Math.pow(i,2),s*=b,w=Math.pow(s,2));var _=y*Math.sqrt((x*w-x*m-w*g)/(x*m+w*g));isNaN(_)&&(_=0);var C=_*(i*d)/s,T=s*f*-_/i,k=u*C-l*T+(e+o)/2,O=l*C+u*T+(n+r)/2,M=(f-C)/i,S=(d-T)/s,P=-(f+C)/i,z=-(d+T)/s,N=(S>=0?1:-1)*v(Math.acos(M/Math.sqrt(M*M+S*S))),j=A((M*P+S*z)/(Math.sqrt(M*M+S*S)*Math.sqrt(P*P+z*z)),10),R=(M*z-S*P>=0?1:-1)*v(Math.acos(j));!p&&R>0&&(R-=360);p&&R<0&&(R+=360);var B=N+R,F=B>=0?1:-1;return B=Math.abs(B)%360*F,{center:new Q(k,O),startAngle:N,endAngle:B,radiusX:i,radiusY:s,xRotation:c}}({x1:t.x,y1:t.y,x2:n.x,y2:n.y,rx:o,ry:r,largeArc:i,swipe:s,rotation:a});return new e(p.center,{startAngle:p.startAngle,endAngle:p.endAngle,radiusX:p.radiusX,radiusY:p.radiusY,xRotation:p.xRotation,anticlockwise:0===s})},e}(Y(p,["radiusX","radiusY","startAngle","endAngle","anticlockwise"]));function gt(t,e,n,o,r,i){var s=A((r-t)/n,3),a=A((i-e)/o,3);return A(v(Math.atan2(a,s)))}function mt(t,e){for(var n=t;n<e;)n+=90;return n}var vt=[].push,xt=[].pop,wt=[].splice,bt=[].shift,_t=[].slice,Ct=[].unshift,Tt=function(t){function e(e){void 0===e&&(e=[]),t.call(this),this.length=0,this._splice(0,e.length,e)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.elements=function(t){return t?(this._splice(0,this.length,t),this._change(),this):this.slice(0)},e.prototype.push=function(){var t=arguments,e=vt.apply(this,t);return this._add(t),e},e.prototype.slice=function(){return _t.call(this)},e.prototype.pop=function(){var t=this.length,e=xt.apply(this);return t&&this._remove([e]),e},e.prototype.splice=function(t,e){var n=_t.call(arguments,2),o=this._splice(t,e,n);return this._change(),o},e.prototype.shift=function(){var t=this.length,e=bt.apply(this);return t&&this._remove([e]),e},e.prototype.unshift=function(){var t=arguments,e=Ct.apply(this,t);return this._add(t),e},e.prototype.indexOf=function(t){for(var e=this.length,n=0;n<e;n++)if(this[n]===t)return n;return-1},e.prototype._splice=function(t,e,n){var o=wt.apply(this,[t,e].concat(n));return this._clearObserver(o),this._setObserver(n),o},e.prototype._add=function(t){this._setObserver(t),this._change()},e.prototype._remove=function(t){this._clearObserver(t),this._change()},e.prototype._setObserver=function(t){for(var e=0;e<t.length;e++)t[e].addObserver(this)},e.prototype._clearObserver=function(t){for(var e=0;e<t.length;e++)t[e].removeObserver(this)},e.prototype._change=function(){},e}(p),kt=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype._change=function(){this.geometryChange()},e}(Tt);function Ot(t,e,n){var o=v(Math.atan2(e.y-t.y,e.x-t.x));return n.transformCopy(tt().rotate(-o,t)).x<t.x}function Mt(t,e,n){var o=1-t;return Math.pow(o,3)*n[0][e]+3*Math.pow(o,2)*t*n[1][e]+3*Math.pow(t,2)*o*n[2][e]+Math.pow(t,3)*n[3][e]}function St(t,e){return[-t[0][e]+3*t[1][e]-3*t[2][e]+t[3][e],3*(t[0][e]-2*t[1][e]+t[2][e]),3*(-t[0][e]+t[1][e]),t[0][e]]}var Et=function(t){function e(e,n){void 0===e&&(e=0),void 0===n&&(n=0),t.call(this),this.real=e,this.img=n}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.add=function(t){return new e(A(this.real+t.real,ut),A(this.img+t.img,ut))},e.prototype.addConstant=function(t){return new e(this.real+t,this.img)},e.prototype.negate=function(){return new e(-this.real,-this.img)},e.prototype.multiply=function(t){return new e(this.real*t.real-this.img*t.img,this.real*t.img+this.img*t.real)},e.prototype.multiplyConstant=function(t){return new e(this.real*t,this.img*t)},e.prototype.nthRoot=function(t){var n=Math.atan2(this.img,this.real),o=Math.sqrt(Math.pow(this.img,2)+Math.pow(this.real,2)),r=Math.pow(o,1/t);return new e(r*Math.cos(n/t),r*Math.sin(n/t))},e.prototype.equals=function(t){return this.real===t.real&&this.img===t.img},e.prototype.isReal=function(){return 0===this.img},e}(o);function At(t){return t<0?-1:1}function Pt(t,e,n,o){if(0===t)return function(t,e,n){var o=Math.sqrt(Math.pow(e,2)-4*t*n);return[(-e+o)/(2*t),(-e-o)/(2*t)]}(e,n,o);var r,i,s,a,p,c,h,u=(3*t*n-Math.pow(e,2))/(3*Math.pow(t,2)),l=(2*Math.pow(e,3)-9*t*e*n+27*Math.pow(t,2)*o)/(27*Math.pow(t,3)),f=Math.pow(u/3,3)+Math.pow(l/2,2),d=new Et(0,1),y=-e/(3*t);f<0?(r=new Et(-l/2,Math.sqrt(-f)).nthRoot(3),i=new Et(-l/2,-Math.sqrt(-f)).nthRoot(3)):(r=-l/2+Math.sqrt(f),r=new Et(At(r)*Math.pow(Math.abs(r),1/3)),i=-l/2-Math.sqrt(f),i=new Et(At(i)*Math.pow(Math.abs(i),1/3))),s=r.add(i),c=r.add(i).multiplyConstant(-.5),h=r.add(i.negate()).multiplyConstant(Math.sqrt(3)/2),a=c.add(d.multiply(h)),p=c.add(d.negate().multiply(h));var g=[];return s.isReal()&&g.push(A(s.real+y,ut)),a.isReal()&&g.push(A(a.real+y,ut)),p.isReal()&&g.push(A(p.real+y,ut)),g}function zt(t,e,n,o,r){for(var i,s=St(t,o),a=Pt(s[0],s[1],s[2],s[3]-e[o]),p=0;p<a.length;p++)if(0<=a[p]&&a[p]<=1&&(i=Mt(a[p],n,t),Math.abs(i-e[n])<=r))return!0}function Nt(t,e,n){var o;if(t.x!==e.x){var r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),p=r<=n.x&&n.x<i;o=s===a?n.y<=s&&p:p&&(a-s)*((t.x-e.x)*(t.y-e.y)>0?n.x-r:i-n.x)/(i-r)+s-n.y>=0}return o?1:0}function jt(t){var e="_"+t;return function(t){return l(t)?(this._observerField(e,Q.create(t)),this.geometryChange(),this):this[e]}}var Rt=function(t,e){var o=function(t){function e(){t.apply(this,arguments)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e}(t);return function(t,e){for(var n=0;n<e.length;n++)t[e[n]]=jt(e[n])}(o.prototype,e),o},Bt=function(t){function e(e,n,o){t.call(this),this.anchor(e||new Q),this.controlIn(n),this.controlOut(o)}return n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor,e.prototype.bboxTo=function(t,e){var n=this.anchor().transformCopy(e),o=t.anchor().transformCopy(e);return this.controlOut()&&t.controlIn()?this._curveBoundingBox(n,this.controlOut().transformCopy(e),t.controlIn().transformCopy(e),o):this._lineBoundingBox(n,o)},e.prototype._lineBoundingBox=function(t,e){return J.fromPoints(t,e)},e.prototype._curveBoundingBox=function(t,e,n,o){var r=[t,e,n,o],i=this._curveExtremesFor(r,"x"),s=this._curveExtremesFor(r,"y"),a=Ft([i.min,i.max,t.x,o.x]),p=Ft([s.min,s.max,t.y,o.y]);return J.fromPoints(new Q(a.min,p.min),new Q(a.max,p.max))},e.prototype._curveExtremesFor=function(t,e){var n=this._curveExtremes(t[0][e],t[1][e],t[2][e],t[3][e]);return{min:Mt(n.min,e,t),max:Mt(n.max,e,t)}},e.prototype._curveExtremes=function(t,e,n,o){var r=t-3*e+3*n-o,i=-2*(t-2*e+n),s=t-e,a=Math.sqrt(i*i-4*r*s),p=0,c=1;0===r?0!==i&&(p=c=-s/i):isNaN(a)||(p=(-i+a)/(2*r),c=(-i-a)/(2*r));var h=Math.max(Math.min(p,c),0);(h<0||h>1)&&(h=0);var u=Math.min(Math.max(p,c),1);return(u>1||u<0)&&(u=1),{min:h,max:u}},e.prototype._intersectionsTo=function(t,e){var n;return n=this.controlOut()&&t.controlIn()?function(t,e,n){for(var o,r=St(t,"x"),i=Pt(r[0],r[1],r[2],r[3]-e.x),s=0,a=0;a<i.length;a++)(lt(o=Mt(i[a],"y",t),e.y)||o>e.y)&&((0===i[a]||1===i[a])&&n.bottomRight().x>e.x||0<i[a]&&i[a]<1)&&s++;return s}([this.anchor(),this.controlOut(),t.controlIn(),t.anchor()],e,this.bboxTo(t)):Nt(this.anchor(),t.anchor(),e),n},e.prototype._isOnCurveTo=function(t,e,n,o){if(this.bboxTo(t).expand(n,n).containsPoint(e)){var r=this.anchor(),i=this.controlOut(),s=t.controlIn(),a=t.anchor();if("start"===o&&r.distanceTo(e)<=n)return!Ot(r,i,e);if("end"===o&&a.distanceTo(e)<=n)return!Ot(a,s,e);var p=[r,i,s,a];if(zt(p,e,"x","y",n)||zt(p,e,"y","x",n))return!0;var c=tt().rotate(45,e),h=[r.transformCopy(c),i.transformCopy(c),s.transformCopy(c),a.transformCopy(c)];return zt(h,e,"x","y",n)||zt(h,e,"y","x",n)}},e.prototype._isOnLineTo=function(t,e,n){var o=this.anchor(),r=t.anchor(),i=v(Math.atan2(r.y-o.y,r.x-o.x));return new J([o.x,o.y-n/2],[o.distanceTo(r),n]).containsPoint(e.transformCopy(tt().rotate(-i,o)))},e.prototype._isOnPathTo=function(t,e,n,o){return this.controlOut()&&t.controlIn()?this._isOnCurveTo(t,e,n/2,o):this._isOnLineTo(t,e,n)},e}(Rt(p,["anchor","controlIn","controlOut"]));function Ft(t){for(var e=t.length,n=g,o=m,r=0;r<e;r++)o=Math.max(o,t[r]),n=Math.min(n,t[r]);return{min:n,max:o}}var Lt={Circle:rt,Arc:yt,Rect:J,Point:Q,Segment:Bt,Matrix:I,Size:Z,toMatrix:W,Transformation:K,transform:tt},It="x",Dt="y";function Ht(t,e){for(;e[t+1]&&(e[t].equals(e[t+1])||e[t+1].equals(e[t+2]));)e.splice(t+1,1)}function qt(t,e){var n=(e.y-t.y)/(e.x-t.x);return[t.y-n*t.x,n]}function Gt(t,e,n){var o,r=It,i=Dt,s=!1,a=!1;if(function(t,e,n){var o=Qt(qt(t,e),n.x);return t.x===e.x&&e.x===n.x||A(o,1)===A(n.y,1)}(t,e,n))o=Vt(t,e,It,Dt);else{var p={x:Ut(t,e,n,It),y:Ut(t,e,n,Dt)};if(p.x&&p.y)o=Vt(t,n,It,Dt),s=!0;else if(function(t,e,n){var o=!1;if(t.x===e.x)o=!0;else if(e.x===n.x)(e.y<n.y&&t.y<=e.y||n.y<e.y&&e.y<=t.y)&&(o=!0);else{var r=Qt(qt(t,e),n.x);t.y<=e.y&&n.y<=r||e.y<=t.y&&n.y>=r||(o=!0)}return o}(t,e,n)&&(r=Dt,i=It),p[r])o=0;else o=.01*(n[i]<t[i]&&t[i]<=e[i]||t[i]<n[i]&&e[i]<=t[i]?Zt((n[i]-t[i])*(e[r]-t[r])):-Zt((n[r]-t[r])*(e[i]-t[i]))),a=!0}var c=Yt(o,t,e,r,i);if(a){var h=r;r=i,i=h}var u=Xt(o,e,n,r,i);return s&&($t(t,e,c,o),$t(e,n,u,o)),[c,u]}function $t(t,e,n,o){t.y<e.y?e.y<n.y?(n.x=t.x+(e.y-t.y)/o,n.y=e.y):n.y<t.y&&(n.x=e.x-(e.y-t.y)/o,n.y=t.y):n.y<e.y?(n.x=t.x-(t.y-e.y)/o,n.y=e.y):t.y<n.y&&(n.x=e.x+(t.y-e.y)/o,n.y=t.y)}function Vt(t,e,n,o){var r=e[n]-t[n],i=e[o]-t[o];return 0===r?0:i/r}function Ut(t,e,n,o){return n[o]>e[o]&&e[o]>t[o]||n[o]<e[o]&&e[o]<t[o]}function Xt(t,e,n,o,r){var i=e[o],s=.333*(n[o]-i);return Wt(i+s,e[r]+s*t,o,r)}function Yt(t,e,n,o,r){var i=e[o],s=n[o],a=.333*(s-i);return Wt(s-a,n[r]-a*t,o,r)}function Wt(t,e,n,o){var r=new Q;return r[n]=t,r[o]=e,r}function Qt(t,e){for(var n=t.length,o=0,r=0;r<n;r++)o+=Math.pow(e,r)*t[r];return o}function Zt(t){return t<=0?-1:1}var Jt={l:function(t,e){for(var n=e.parameters,o=e.position,r=0;r<n.length;r+=2){var i=new Q(n[r],n[r+1]);e.isRelative&&i.translateWith(o),t.lineTo(i.x,i.y),o.x=i.x,o.y=i.y}},c:function(t,e){for(var n=e.parameters,o=e.position,r=0;r<n.length;r+=6){var i=new Q(n[r],n[r+1]),s=new Q(n[r+2],n[r+3]),a=new Q(n[r+4],n[r+5]);e.isRelative&&(s.translateWith(o),i.translateWith(o),a.translateWith(o)),t.curveTo(i,s,a),o.x=a.x,o.y=a.y}},v:function(t,e){var n=e.isRelative?0:e.position.x;Kt(e.parameters,!0,n),this.l(t,e)},h:function(t,e){var n=e.isRelative?0:e.position.y;Kt(e.parameters,!1,n),this.l(t,e)},a:function(t,e){for(var n=e.parameters,o=e.position,r=0;r<n.length;r+=7){var i=n[r],s=n[r+1],a=n[r+2],p=n[r+3],c=n[r+4],h=new Q(n[r+5],n[r+6]);e.isRelative&&h.translateWith(o),o.x===h.x&&o.y===h.y||(t.arcTo(h,i,s,p,c,a),o.x=h.x,o.y=h.y)}},s:function(t,e){var n,o=e.parameters,r=e.position,i=e.previousCommand;"s"!==i&&"c"!==i||(n=k(k(t.paths).segments).controlIn());for(var s=0;s<o.length;s+=4){var a=new Q(o[s],o[s+1]),p=new Q(o[s+2],o[s+3]),c=void 0;e.isRelative&&(a.translateWith(r),p.translateWith(r)),c=n?te(n,r):r.clone(),n=a,t.curveTo(c,a,p),r.x=p.x,r.y=p.y}},q:function(t,e){for(var n=e.parameters,o=e.position,r=0;r<n.length;r+=4){var i=new Q(n[r],n[r+1]),s=new Q(n[r+2],n[r+3]);e.isRelative&&(i.translateWith(o),s.translateWith(o));var a=ne(o,i,s);t.curveTo(a.controlOut,a.controlIn,s),o.x=s.x,o.y=s.y}},t:function(t,e){var n,o=e.parameters,r=e.position,i=e.previousCommand;"q"!==i&&"t"!==i||(n=k(k(t.paths).segments).controlIn().clone().translateWith(r.scaleCopy(-1/3)).scale(1.5));for(var s=0;s<o.length;s+=2){var a=new Q(o[s],o[s+1]);e.isRelative&&a.translateWith(r),n=n?te(n,r):r.clone();var p=ne(r,n,a);t.curveTo(p.controlOut,p.controlIn,a),r.x=a.x,r.y=a.y}}};function Kt(t,e,n){for(var o=e?0:1,r=0;r<t.length;r+=2)t.splice(r+o,0,n)}function te(t,e){if(t&&e)return e.scaleCopy(2).translate(-t.x,-t.y)}var ee=1/3;function ne(t,e,n){var o=e.clone().scale(2/3);return{controlOut:o.clone().translateWith(t.scaleCopy(ee)),controlIn:o.translateWith(n.scaleCopy(ee))}}var oe=/([a-df-z]{1})([^a-df-z]*)(z)?/gi,re=/[,\s]?([+\-]?(?:\d*\.\d+|\d+)(?:[eE][+\-]?\d+)?)/g;function ie(t,e){var n,o=new Q;return e.replace(oe,(function(e,r,i,s){var a=r.toLowerCase(),p=a===r,c=function(t){var e=[];return t.replace(re,(function(t,n){e.push(parseFloat(n))})),e}(i.trim());if("m"===a&&(p?(o.x+=c[0],o.y+=c[1]):(o.x=c[0],o.y=c[1]),t.moveTo(o.x,o.y),c.length>2&&(a="l",c.splice(0,2))),Jt[a])Jt[a](t,{parameters:c,position:o,isRelative:p,previousCommand:n}),s&&"z"===s.toLowerCase()&&t.close();else if("m"!==a)throw new Error("Error while parsing SVG path. Unsupported command: "+a);n=a})),t}function se(t,e,n){for(var o,r=0;r<t.length;r++){var i=t[r];if(i.visible()){var s=e?i.bbox(n):i.rawBBox();s&&(o=o?J.union(o,s):s)}}return o}function ae(t,e){for(var n,o=0;o<t.length;o++){var r=t[o];if(r.visible()){var i=r.clippedBBox(e);i&&(n=n?J.union(n,i):i)}}return n}var pe=" ",ce=function(t){function e(e){t.call(this,e),this.segments=new kt,this.segments.addObserver(this),l(this.options.stroke)||(this.stroke("#000"),l(this.options.stroke.lineJoin)||this.options.set("stroke.lineJoin","miter"))}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return o.nodeType.get=function(){return"Path"},e.prototype.moveTo=function(t,e){return this.suspend(),this.segments.elements([]),this.resume(),this.lineTo(t,e),this},e.prototype.lineTo=function(t,e){var n=l(e)?new Q(t,e):t,o=new Bt(n);return this.segments.push(o),this},e.prototype.curveTo=function(t,e,n){if(this.segments.length>0){var o=k(this.segments),r=new Bt(n,e);this.suspend(),o.controlOut(t),this.resume(),this.segments.push(r)}return this},e.prototype.arc=function(t,e,n,o,r){if(this.segments.length>0){var i=k(this.segments).anchor(),s=E(t),a=new Q(i.x-n*Math.cos(s),i.y-o*Math.sin(s)),p=new yt(a,{startAngle:t,endAngle:e,radiusX:n,radiusY:o,anticlockwise:r});this._addArcSegments(p)}return this},e.prototype.arcTo=function(t,e,n,o,r,i){if(this.segments.length>0){var s=k(this.segments).anchor(),a=yt.fromPoints(s,Q.create(t),e,n,o,r,i);this._addArcSegments(a)}return this},e.prototype._addArcSegments=function(t){this.suspend();for(var e=t.curvePoints(),n=1;n<e.length;n+=3)this.curveTo(e[n],e[n+1],e[n+2]);this.resume(),this.geometryChange()},e.prototype.close=function(){return this.options.closed=!0,this.geometryChange(),this},e.prototype.rawBBox=function(){return this._bbox()},e.prototype.toString=function(t){var e,n,o,r="",i=this.segments,s=i.length;if(s>0){for(var a,p=[],c=(o=t,function(){for(var t=arguments,e=[],n=arguments.length;n--;)e[n]=t[n];return e.map((function(t){return t.toString(o)})).join(pe)}),h=1;h<s;h++){var u=(e=i[h-1],n=i[h],e.controlOut()&&n.controlIn()?"C":"L");u!==a&&(a=u,p.push(u)),"L"===u?p.push(c(i[h].anchor())):p.push(c(i[h-1].controlOut(),i[h].controlIn(),i[h].anchor()))}r="M"+c(i[0].anchor())+pe+p.join(pe),this.options.closed&&(r+="Z")}return r},e.prototype._containsPoint=function(t){for(var e,n,o=this.segments,r=o.length,i=0,s=1;s<r;s++)e=o[s-1],n=o[s],i+=e._intersectionsTo(n,t);return!this.options.closed&&o[0].anchor().equals(o[r-1].anchor())||(i+=Nt(o[0].anchor(),o[r-1].anchor(),t)),i%2!=0},e.prototype._isOnPath=function(t,e){var n=this.segments,o=n.length,r=e||this.options.stroke.width;if(o>1){if(n[0]._isOnPathTo(n[1],t,r,"start"))return!0;for(var i=2;i<=o-2;i++)if(n[i-1]._isOnPathTo(n[i],t,r))return!0;if(n[o-2]._isOnPathTo(n[o-1],t,r,"end"))return!0}return!1},e.prototype._bbox=function(t){var e,n=this.segments,o=n.length;if(1===o){var r=n[0].anchor().transformCopy(t);e=new J(r,Z.ZERO)}else if(o>0)for(var i=1;i<o;i++){var s=n[i-1].bboxTo(n[i],t);e=e?J.union(e,s):s}return e},e.parse=function(t,e){return he.parse(t,e)},e.fromRect=function(t,n){var o=new e(n),r=t.cornerRadius,i=r[0],s=r[1];if(0===i&&0===s)o.moveTo(t.topLeft()).lineTo(t.topRight()).lineTo(t.bottomRight()).lineTo(t.bottomLeft()).close();else{var a=t.origin,p=a.x,c=a.y,h=t.width(),u=t.height();i=O(i,0,h/2),s=O(s,0,u/2),o.moveTo(p+i,c).lineTo(p+h-i,c).arcTo([p+h,c+s],i,s,!1).lineTo(p+h,c+u-s).arcTo([p+h-i,c+u],i,s,!1).lineTo(p+i,c+u).arcTo([p,c+u-s],i,s,!1).lineTo(p,c+s).arcTo([p+i,c],i,s,!1)}return o},e.fromPoints=function(t,n){if(t){for(var o=new e(n),r=0;r<t.length;r++){var i=Q.create(t[r]);i&&(0===r?o.moveTo(i):o.lineTo(i))}return o}},e.curveFromPoints=function(t,n){if(t){var o=function(t,e){var n=t.slice(0),o=[],r=n.length;if(r>2&&(Ht(0,n),r=n.length),r<2||2===r&&n[0].equals(n[1]))return o;var i,s,a=n[0],p=n[1],c=n[2];for(o.push(new Bt(a));a.equals(n[r-1]);)e=!0,n.pop(),r--;if(2===r){var h=Vt(a,p,It,Dt);return k(o).controlOut(Xt(h,a,p,It,Dt)),o.push(new Bt(p,Yt(h,a,p,It,Dt))),o}if(e){var u=Gt(a=n[r-1],p=n[0],c=n[1]);i=u[1],s=u[0]}else i=Xt(Vt(a,p,It,Dt),a,p,It,Dt);for(var l=i,f=0;f<=r-3;f++)if(Ht(f,n),f+3<=(r=n.length)){var d=Gt(a=n[f],p=n[f+1],c=n[f+2]);k(o).controlOut(l),l=d[1];var y=d[0];o.push(new Bt(p,y))}if(e){var g=Gt(a=n[r-2],p=n[r-1],c=n[0]);k(o).controlOut(l),o.push(new Bt(p,g[0])),k(o).controlOut(g[1]),o.push(new Bt(c,s))}else{var m=Vt(p,c,It,Dt);k(o).controlOut(l),o.push(new Bt(c,Yt(m,p,c,It,Dt)))}return o}(t),r=new e(n);return r.segments.push.apply(r.segments,o),r}},e.fromArc=function(t,n){var o=new e(n),r=t.startAngle,i=t.pointAt(r);return o.moveTo(i.x,i.y),o.arc(r,t.endAngle,t.radiusX,t.radiusY,t.anticlockwise),o},Object.defineProperties(e.prototype,o),e}(it(at(et))),he=function(t){function e(e){t.call(this,e),this.paths=new kt,this.paths.addObserver(this),l(this.options.stroke)||this.stroke("#000")}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return e.parse=function(t,n){return ie(new e(n),t)},e.prototype.toString=function(t){var e=this.paths,n="";if(e.length>0){for(var o=[],r=0;r<e.length;r++)o.push(e[r].toString(t));n=o.join(pe)}return n},o.nodeType.get=function(){return"MultiPath"},e.prototype.moveTo=function(t,e){var n=new ce;return n.moveTo(t,e),this.paths.push(n),this},e.prototype.lineTo=function(t,e){return this.paths.length>0&&k(this.paths).lineTo(t,e),this},e.prototype.curveTo=function(t,e,n){return this.paths.length>0&&k(this.paths).curveTo(t,e,n),this},e.prototype.arc=function(t,e,n,o,r){return this.paths.length>0&&k(this.paths).arc(t,e,n,o,r),this},e.prototype.arcTo=function(t,e,n,o,r,i){return this.paths.length>0&&k(this.paths).arcTo(t,e,n,o,r,i),this},e.prototype.close=function(){return this.paths.length>0&&k(this.paths).close(),this},e.prototype._bbox=function(t){return se(this.paths,!0,t)},e.prototype.rawBBox=function(){return se(this.paths,!1)},e.prototype._containsPoint=function(t){for(var e=this.paths,n=0;n<e.length;n++)if(e[n]._containsPoint(t))return!0;return!1},e.prototype._isOnPath=function(t){for(var e=this.paths,n=this.options.stroke.width,o=0;o<e.length;o++)if(e[o]._isOnPath(t,n))return!0;return!1},e.prototype._clippedBBox=function(t){return ae(this.paths,this.currentTransform(t))},Object.defineProperties(e.prototype,o),e}(it(at(et))),ue=function(t){function e(e,n){void 0===e&&(e=new yt),void 0===n&&(n={}),t.call(this,n),this.geometry(e),l(this.options.stroke)||this.stroke("#000")}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return o.nodeType.get=function(){return"Arc"},e.prototype._bbox=function(t){return this._geometry.bbox(t)},e.prototype.rawBBox=function(){return this.geometry().bbox()},e.prototype.toPath=function(){var t=new ce,e=this.geometry().curvePoints();if(e.length>0){t.moveTo(e[0].x,e[0].y);for(var n=1;n<e.length;n+=3)t.curveTo(e[n],e[n+1],e[n+2])}return t},e.prototype._containsPoint=function(t){return this.geometry().containsPoint(t)},e.prototype._isOnPath=function(t){return this.geometry()._isOnPath(t,this.options.stroke.width/2)},Object.defineProperties(e.prototype,o),e}(it(at(ct(et)))),le=function(t){function e(e,n,o){void 0===n&&(n=new Q),void 0===o&&(o={}),t.call(this,o),this.content(e),this.position(n),this.options.font||(this.options.font="12px sans-serif"),l(this.options.fill)||this.fill("#000")}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return o.nodeType.get=function(){return"Text"},e.prototype.content=function(t){return l(t)?(this.options.set("content",t),this):this.options.get("content")},e.prototype.measure=function(){return r.measureText(this.content(),{font:this.options.get("font")})},e.prototype.rect=function(){var t=this.measure(),e=this.position().clone();return new J(e,[t.width,t.height])},e.prototype.bbox=function(t){var e=W(this.currentTransform(t));return this.rect().bbox(e)},e.prototype.rawBBox=function(){return this.rect().bbox()},e.prototype._containsPoint=function(t){return this.rect().containsPoint(t)},Object.defineProperties(e.prototype,o),e}(it(Rt(et,["position"]))),fe=function(t){function e(e,n,o){void 0===n&&(n=new J),void 0===o&&(o={}),t.call(this,o),this.src(e),this.rect(n)}n(e,t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.fn=e.prototype,e.fn.init=e.fn.constructor;var o={nodeType:{}};return o.nodeType.get=function(){return"Image"},e.prototype.src=function(t){return l(t)?(this.options.set("src",t),this):this.options.get("src")},e.prototype.bbox=function(t){var e=W(this.currentTransform(t));return this._rect.bbox(e)},e.prototype.rawBBox=function(){return this._rect.bbox()},e.prototype._containsPoint=function(t){return this._rect.containsPoint(t)},e.prototype._hasFill=function(){return this.src()},Object.defineProperties(e.prototype,o),e}(ct(et,["rect"])),de=function(t,e){return function(t){function o(){t.apply(this,arguments)}return n(o,t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.fn=o.prototype,o.fn.init=o.fn.constructor,o.prototype.traverse=function(t){for(var n=this[e],o=0;o<n.length;o++){var r=n[o];r.traverse?r.traverse(t):t(r)}return this},o}(t)},ye=function(t){function e(e){t.call(this,e),this.children=[]}n(e,t),e.prototype=Object.create(t&&t.prototype),e.proto