sg-vhuman
Version:
简单的数字人虚拟形象组件
3 lines • 318 kB
JavaScript
(function(mt,ht){typeof exports=="object"&&typeof module<"u"?ht(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ht):(mt=typeof globalThis<"u"?globalThis:mt||self,ht(mt["sg-vhuman"]={},mt.Vue))})(this,function(mt,ht){"use strict";class xt{constructor(){this.peerConnection=null,this.remoteStream=null}async initializeConnection(f={iceServers:[{urls:"stun:stun.l.google.com:19302"}]}){try{return this.peerConnection=new RTCPeerConnection(f),this.peerConnection.addTransceiver("video",{direction:"recvonly"}),this.peerConnection.addTransceiver("audio",{direction:"recvonly"}),this.setupPeerConnectionListeners(),!0}catch(st){return console.error("Failed to initialize WebRTC connection:",st),!1}}setupPeerConnectionListeners(){this.peerConnection.onicecandidate=f=>{f.candidate&&this.onIceCandidate(f.candidate)},this.peerConnection.ontrack=f=>{this.remoteStream=f.streams[0],this.onRemoteStreamReceived(this.remoteStream)}}async createOffer(){try{const f=await this.peerConnection.createOffer();return await this.peerConnection.setLocalDescription(f),this.peerConnection.localDescription}catch(f){throw console.error("Error creating offer:",f),f}}async handleAnswer(f){try{await this.peerConnection.setRemoteDescription(new RTCSessionDescription(f))}catch(st){throw console.error("Error handling answer:",st),st}}onIceCandidate(f){}onRemoteStreamReceived(f){}closeConnection(){this.peerConnection&&this.peerConnection.close(),this.remoteStream=null,this.peerConnection=null}}function wt(q){if(Object.prototype.hasOwnProperty.call(q,"__esModule"))return q;var f=q.default;if(typeof f=="function"){var st=function rt(){return this instanceof rt?Reflect.construct(f,arguments,this.constructor):f.apply(this,arguments)};st.prototype=f.prototype}else st={};return Object.defineProperty(st,"__esModule",{value:!0}),Object.keys(q).forEach(function(rt){var at=Object.getOwnPropertyDescriptor(q,rt);Object.defineProperty(st,rt,at.get?at:{enumerable:!0,get:function(){return q[rt]}})}),st}var _t={};const yt=wt(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ct;function Tt(){return Ct||(Ct=1,function(q){/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */var f=f||{version:"5.3.0"};if(q.fabric=f,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?f.document=document:f.document=document.implementation.createHTMLDocument(""),f.window=window;else{var st=yt,rt=new st.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;f.document=rt.document,f.jsdomImplForWrapper=yt.implForWrapper,f.nodeCanvas=yt.Canvas,f.window=rt,DOMParser=f.window.DOMParser}f.isTouchSupported="ontouchstart"in f.window||"ontouchstart"in f.document||f.window&&f.window.navigator&&f.window.navigator.maxTouchPoints>0,f.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",f.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],f.DPI=96,f.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",f.commaWsp="(?:\\s+,?\\s*|,\\s*)",f.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/ig,f.reNonWord=/[ \n\.,;!\?\-]/,f.fontPaths={},f.iMatrix=[1,0,0,1,0,0],f.svgNS="http://www.w3.org/2000/svg",f.perfLimitSizeTotal=2097152,f.maxCacheSideLimit=4096,f.minCacheSideLimit=256,f.charWidthsCache={},f.textureSize=2048,f.disableStyleCopyPaste=!1,f.enableGLFiltering=!0,f.devicePixelRatio=f.window.devicePixelRatio||f.window.webkitDevicePixelRatio||f.window.mozDevicePixelRatio||1,f.browserShadowBlurConstant=1,f.arcToSegmentsCache={},f.boundsOfCurveCache={},f.cachesBoundsOfCurve=!0,f.forceGLPutImageData=!1,f.initFilterBackend=function(){if(f.enableGLFiltering&&f.isWebglSupported&&f.isWebglSupported(f.textureSize))return console.log("max texture size: "+f.maxTextureSize),new f.WebglFilterBackend({tileSize:f.textureSize});if(f.Canvas2dFilterBackend)return new f.Canvas2dFilterBackend},typeof document<"u"&&typeof window<"u"&&(window.fabric=f),function(){function c(t,n){if(this.__eventListeners[t]){var a=this.__eventListeners[t];n?a[a.indexOf(n)]=!1:f.util.array.fill(a,!1)}}function s(t,n){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var a in t)this.on(a,t[a]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(n);return this}function h(t,n){var a=(function(){n.apply(this,arguments),this.off(t,a)}).bind(this);this.on(t,a)}function o(t,n){if(arguments.length===1)for(var a in t)h.call(this,a,t[a]);else h.call(this,t,n);return this}function e(t,n){if(!this.__eventListeners)return this;if(arguments.length===0)for(t in this.__eventListeners)c.call(this,t);else if(arguments.length===1&&typeof arguments[0]=="object")for(var a in t)c.call(this,a,t[a]);else c.call(this,t,n);return this}function r(t,n){if(!this.__eventListeners)return this;var a=this.__eventListeners[t];if(!a)return this;for(var i=0,l=a.length;i<l;i++)a[i]&&a[i].call(this,n||{});return this.__eventListeners[t]=a.filter(function(u){return u!==!1}),this}f.Observable={fire:r,on:s,once:o,off:e}}(),f.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var c=0,s=arguments.length;c<s;c++)this._onObjectAdded(arguments[c]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(c,s,h){var o=this._objects;return h?o[s]=c:o.splice(s,0,c),this._onObjectAdded&&this._onObjectAdded(c),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var c=this._objects,s,h=!1,o=0,e=arguments.length;o<e;o++)s=c.indexOf(arguments[o]),s!==-1&&(h=!0,c.splice(s,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[o]));return this.renderOnAddRemove&&h&&this.requestRenderAll(),this},forEachObject:function(c,s){for(var h=this.getObjects(),o=0,e=h.length;o<e;o++)c.call(s,h[o],o,h);return this},getObjects:function(c){return typeof c>"u"?this._objects.concat():this._objects.filter(function(s){return s.type===c})},item:function(c){return this._objects[c]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(c,s){return this._objects.indexOf(c)>-1?!0:s?this._objects.some(function(h){return typeof h.contains=="function"&&h.contains(c,!0)}):!1},complexity:function(){return this._objects.reduce(function(c,s){return c+=s.complexity?s.complexity():0,c},0)}},f.CommonMethods={_setOptions:function(c){for(var s in c)this.set(s,c[s])},_initGradient:function(c,s){c&&c.colorStops&&!(c instanceof f.Gradient)&&this.set(s,new f.Gradient(c))},_initPattern:function(c,s,h){c&&c.source&&!(c instanceof f.Pattern)?this.set(s,new f.Pattern(c,h)):h&&h()},_setObject:function(c){for(var s in c)this._set(s,c[s])},set:function(c,s){return typeof c=="object"?this._setObject(c):this._set(c,s),this},_set:function(c,s){this[c]=s},toggle:function(c){var s=this.get(c);return typeof s=="boolean"&&this.set(c,!s),this},get:function(c){return this[c]}},function(c){var s=Math.sqrt,h=Math.atan2,o=Math.pow,e=Math.PI/180,r=Math.PI/2;f.util={cos:function(t){if(t===0)return 1;t<0&&(t=-t);var n=t/r;switch(n){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(t===0)return 0;var n=t/r,a=1;switch(t<0&&(a=-1),n){case 1:return a;case 2:return 0;case 3:return-a}return Math.sin(t)},removeFromArray:function(t,n){var a=t.indexOf(n);return a!==-1&&t.splice(a,1),t},getRandomInt:function(t,n){return Math.floor(Math.random()*(n-t+1))+t},degreesToRadians:function(t){return t*e},radiansToDegrees:function(t){return t/e},rotatePoint:function(t,n,a){var i=new f.Point(t.x-n.x,t.y-n.y),l=f.util.rotateVector(i,a);return new f.Point(l.x,l.y).addEquals(n)},rotateVector:function(t,n){var a=f.util.sin(n),i=f.util.cos(n),l=t.x*i-t.y*a,u=t.x*a+t.y*i;return{x:l,y:u}},createVector:function(t,n){return new f.Point(n.x-t.x,n.y-t.y)},calcAngleBetweenVectors:function(t,n){return Math.acos((t.x*n.x+t.y*n.y)/(Math.hypot(t.x,t.y)*Math.hypot(n.x,n.y)))},getHatVector:function(t){return new f.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,n,a){var i=f.util.createVector(t,n),l=f.util.createVector(t,a),u=f.util.calcAngleBetweenVectors(i,l),d=f.util.calcAngleBetweenVectors(f.util.rotateVector(i,u),l),g=u*(d===0?1:-1)/2;return{vector:f.util.getHatVector(f.util.rotateVector(i,g)),angle:u}},projectStrokeOnPoints:function(t,n,a){var i=[],l=n.strokeWidth/2,u=n.strokeUniform?new f.Point(1/n.scaleX,1/n.scaleY):new f.Point(1,1),d=function(g){var m=l/Math.hypot(g.x,g.y);return new f.Point(g.x*m*u.x,g.y*m*u.y)};return t.length<=1||t.forEach(function(g,m){var v=new f.Point(g.x,g.y),y,w;m===0?(w=t[m+1],y=a?d(f.util.createVector(w,v)).addEquals(v):t[t.length-1]):m===t.length-1?(y=t[m-1],w=a?d(f.util.createVector(y,v)).addEquals(v):t[0]):(y=t[m-1],w=t[m+1]);var M=f.util.getBisector(v,y,w),X=M.vector,W=M.angle,G,N;if(n.strokeLineJoin==="miter"&&(G=-l/Math.sin(W/2),N=new f.Point(X.x*G*u.x,X.y*G*u.y),Math.hypot(N.x,N.y)/l<=n.strokeMiterLimit)){i.push(v.add(N)),i.push(v.subtract(N));return}G=-l*Math.SQRT2,N=new f.Point(X.x*G*u.x,X.y*G*u.y),i.push(v.add(N)),i.push(v.subtract(N))}),i},transformPoint:function(t,n,a){return a?new f.Point(n[0]*t.x+n[2]*t.y,n[1]*t.x+n[3]*t.y):new f.Point(n[0]*t.x+n[2]*t.y+n[4],n[1]*t.x+n[3]*t.y+n[5])},makeBoundingBoxFromPoints:function(t,n){if(n)for(var a=0;a<t.length;a++)t[a]=f.util.transformPoint(t[a],n);var i=[t[0].x,t[1].x,t[2].x,t[3].x],l=f.util.array.min(i),u=f.util.array.max(i),d=u-l,g=[t[0].y,t[1].y,t[2].y,t[3].y],m=f.util.array.min(g),v=f.util.array.max(g),y=v-m;return{left:l,top:m,width:d,height:y}},invertTransform:function(t){var n=1/(t[0]*t[3]-t[1]*t[2]),a=[n*t[3],-n*t[1],-n*t[2],n*t[0]],i=f.util.transformPoint({x:t[4],y:t[5]},a,!0);return a[4]=-i.x,a[5]=-i.y,a},toFixed:function(t,n){return parseFloat(Number(t).toFixed(n))},parseUnit:function(t,n){var a=/\D{0,2}$/.exec(t),i=parseFloat(t);switch(n||(n=f.Text.DEFAULT_SVG_FONT_SIZE),a[0]){case"mm":return i*f.DPI/25.4;case"cm":return i*f.DPI/2.54;case"in":return i*f.DPI;case"pt":return i*f.DPI/72;case"pc":return i*f.DPI/72*12;case"em":return i*n;default:return i}},falseFunction:function(){return!1},getKlass:function(t,n){return t=f.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),f.util.resolveNamespace(n)[t]},getSvgAttributes:function(t){var n=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":n=n.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":n=n.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":n=n.concat(["offset","stop-color","stop-opacity"]);break}return n},resolveNamespace:function(t){if(!t)return f;var n=t.split("."),a=n.length,i,l=c||f.window;for(i=0;i<a;++i)l=l[n[i]];return l},loadImage:function(t,n,a,i){if(!t){n&&n.call(a,t);return}var l=f.util.createImage(),u=function(){n&&n.call(a,l,!1),l=l.onload=l.onerror=null};l.onload=u,l.onerror=function(){f.log("Error loading "+l.src),n&&n.call(a,null,!0),l=l.onload=l.onerror=null},t.indexOf("data")!==0&&i!==void 0&&i!==null&&(l.crossOrigin=i),t.substring(0,14)==="data:image/svg"&&(l.onload=null,f.util.loadImageInDom(l,u)),l.src=t},loadImageInDom:function(t,n){var a=f.document.createElement("div");a.style.width=a.style.height="1px",a.style.left=a.style.top="-100%",a.style.position="absolute",a.appendChild(t),f.document.querySelector("body").appendChild(a),t.onload=function(){n(),a.parentNode.removeChild(a),a=null}},enlivenObjects:function(t,n,a,i){t=t||[];var l=[],u=0,d=t.length;function g(){++u===d&&n&&n(l.filter(function(m){return m}))}if(!d){n&&n(l);return}t.forEach(function(m,v){if(!m||!m.type){g();return}var y=f.util.getKlass(m.type,a);y.fromObject(m,function(w,M){M||(l[v]=w),i&&i(m,w,M),g()})})},enlivenObjectEnlivables:function(t,n,a){var i=f.Object.ENLIVEN_PROPS.filter(function(l){return!!t[l]});f.util.enlivenObjects(i.map(function(l){return t[l]}),function(l){var u={};i.forEach(function(d,g){u[d]=l[g],n&&(n[d]=l[g])}),a&&a(u)})},enlivenPatterns:function(t,n){t=t||[];function a(){++l===u&&n&&n(i)}var i=[],l=0,u=t.length;if(!u){n&&n(i);return}t.forEach(function(d,g){d&&d.source?new f.Pattern(d,function(m){i[g]=m,a()}):(i[g]=d,a())})},groupSVGElements:function(t,n,a){var i;return t&&t.length===1?(typeof a<"u"&&(t[0].sourcePath=a),t[0]):(n&&(n.width&&n.height?n.centerPoint={x:n.width/2,y:n.height/2}:(delete n.width,delete n.height)),i=new f.Group(t,n),typeof a<"u"&&(i.sourcePath=a),i)},populateWithProperties:function(t,n,a){if(a&&Array.isArray(a))for(var i=0,l=a.length;i<l;i++)a[i]in t&&(n[a[i]]=t[a[i]])},createCanvasElement:function(){return f.document.createElement("canvas")},copyCanvasElement:function(t){var n=f.util.createCanvasElement();return n.width=t.width,n.height=t.height,n.getContext("2d").drawImage(t,0,0),n},toDataURL:function(t,n,a){return t.toDataURL("image/"+n,a)},createImage:function(){return f.document.createElement("img")},multiplyTransformMatrices:function(t,n,a){return[t[0]*n[0]+t[2]*n[1],t[1]*n[0]+t[3]*n[1],t[0]*n[2]+t[2]*n[3],t[1]*n[2]+t[3]*n[3],a?0:t[0]*n[4]+t[2]*n[5]+t[4],a?0:t[1]*n[4]+t[3]*n[5]+t[5]]},qrDecompose:function(t){var n=h(t[1],t[0]),a=o(t[0],2)+o(t[1],2),i=s(a),l=(t[0]*t[3]-t[2]*t[1])/i,u=h(t[0]*t[2]+t[1]*t[3],a);return{angle:n/e,scaleX:i,scaleY:l,skewX:u/e,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return f.iMatrix.concat();var n=f.util.degreesToRadians(t.angle),a=f.util.cos(n),i=f.util.sin(n);return[a,i,-i,a,0,0]},calcDimensionsMatrix:function(t){var n=typeof t.scaleX>"u"?1:t.scaleX,a=typeof t.scaleY>"u"?1:t.scaleY,i=[t.flipX?-n:n,0,0,t.flipY?-a:a,0,0],l=f.util.multiplyTransformMatrices,u=f.util.degreesToRadians;return t.skewX&&(i=l(i,[1,0,Math.tan(u(t.skewX)),1],!0)),t.skewY&&(i=l(i,[1,Math.tan(u(t.skewY)),0,1],!0)),i},composeMatrix:function(t){var n=[1,0,0,1,t.translateX||0,t.translateY||0],a=f.util.multiplyTransformMatrices;return t.angle&&(n=a(n,f.util.calcRotateMatrix(t))),(t.scaleX!==1||t.scaleY!==1||t.skewX||t.skewY||t.flipX||t.flipY)&&(n=a(n,f.util.calcDimensionsMatrix(t))),n},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,n,a,i){i>0&&(n>i?n-=i:n=0,a>i?a-=i:a=0);var l=!0,u,d,g=t.getImageData(n,a,i*2||1,i*2||1),m=g.data.length;for(u=3;u<m&&(d=g.data[u],l=d<=0,l!==!1);u+=4);return g=null,l},parsePreserveAspectRatioAttribute:function(t){var n="meet",a="Mid",i="Mid",l=t.split(" "),u;return l&&l.length&&(n=l.pop(),n!=="meet"&&n!=="slice"?(u=n,n="meet"):l.length&&(u=l.pop())),a=u!=="none"?u.slice(1,4):"none",i=u!=="none"?u.slice(5,8):"none",{meetOrSlice:n,alignX:a,alignY:i}},clearFabricFontCache:function(t){t=(t||"").toLowerCase(),t?f.charWidthsCache[t]&&delete f.charWidthsCache[t]:f.charWidthsCache={}},limitDimsByArea:function(t,n){var a=Math.sqrt(n*t),i=Math.floor(n/a);return{x:Math.floor(a),y:i}},capValue:function(t,n,a){return Math.max(t,Math.min(n,a))},findScaleToFit:function(t,n){return Math.min(n.width/t.width,n.height/t.height)},findScaleToCover:function(t,n){return Math.max(n.width/t.width,n.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map(function(n){return f.util.toFixed(n,f.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(t,n){var a=f.util.invertTransform(n),i=f.util.multiplyTransformMatrices(a,t.calcOwnMatrix());f.util.applyTransformToObject(t,i)},addTransformToObject:function(t,n){f.util.applyTransformToObject(t,f.util.multiplyTransformMatrices(n,t.calcOwnMatrix()))},applyTransformToObject:function(t,n){var a=f.util.qrDecompose(n),i=new f.Point(a.translateX,a.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",a.scaleX),t.set("scaleY",a.scaleY),t.skewX=a.skewX,t.skewY=a.skewY,t.angle=a.angle,t.setPositionByOrigin(i,"center","center")},sizeAfterTransform:function(t,n,a){var i=t/2,l=n/2,u=[{x:-i,y:-l},{x:i,y:-l},{x:-i,y:l},{x:i,y:l}],d=f.util.calcDimensionsMatrix(a),g=f.util.makeBoundingBoxFromPoints(u,d);return{x:g.width,y:g.height}},mergeClipPaths:function(t,n){var a=t,i=n;a.inverted&&!i.inverted&&(a=n,i=t),f.util.applyTransformToObject(i,f.util.multiplyTransformMatrices(f.util.invertTransform(a.calcTransformMatrix()),i.calcTransformMatrix()));var l=a.inverted&&i.inverted;return l&&(a.inverted=i.inverted=!1),new f.Group([a],{clipPath:i,inverted:l})},hasStyleChanged:function(t,n,a){return a=a||!1,t.fill!==n.fill||t.stroke!==n.stroke||t.strokeWidth!==n.strokeWidth||t.fontSize!==n.fontSize||t.fontFamily!==n.fontFamily||t.fontWeight!==n.fontWeight||t.fontStyle!==n.fontStyle||t.textBackgroundColor!==n.textBackgroundColor||t.deltaY!==n.deltaY||a&&(t.overline!==n.overline||t.underline!==n.underline||t.linethrough!==n.linethrough)},stylesToArray:function(a,n){for(var a=f.util.object.clone(a,!0),i=n.split(`
`),l=-1,u={},d=[],g=0;g<i.length;g++){if(!a[g]){l+=i[g].length;continue}for(var m=0;m<i[g].length;m++){l++;var v=a[g][m];if(v&&Object.keys(v).length>0){var y=f.util.hasStyleChanged(u,v,!0);y?d.push({start:l,end:l+1,style:v}):d[d.length-1].end++}u=v||{}}}return d},stylesFromArray:function(t,n){if(!Array.isArray(t))return t;for(var a=n.split(`
`),i=-1,l=0,u={},d=0;d<a.length;d++)for(var g=0;g<a[d].length;g++)i++,t[l]&&t[l].start<=i&&i<t[l].end&&(u[d]=u[d]||{},u[d][g]=Object.assign({},t[l].style),i===t[l].end-1&&l++);return u}}}(q),function(){var c=Array.prototype.join,s={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},h={m:"l",M:"L"};function o(p,b,x,S,E,C,_,T,P,F,k){var R=f.util.cos(p),Y=f.util.sin(p),U=f.util.cos(b),D=f.util.sin(b),O=x*E*U-S*C*D+_,I=S*E*U+x*C*D+T,j=F+P*(-x*E*Y-S*C*R),A=k+P*(-S*E*Y+x*C*R),B=O+P*(x*E*D+S*C*U),V=I+P*(S*E*D-x*C*U);return["C",j,A,B,V,O,I]}function e(p,b,x,S,E,C,_){var T=Math.PI,P=_*T/180,F=f.util.sin(P),k=f.util.cos(P),R=0,Y=0;x=Math.abs(x),S=Math.abs(S);var U=-k*p*.5-F*b*.5,D=-k*b*.5+F*p*.5,O=x*x,I=S*S,j=D*D,A=U*U,B=O*I-O*j-I*A,V=0;if(B<0){var tt=Math.sqrt(1-B/(O*I));x*=tt,S*=tt}else V=(E===C?-1:1)*Math.sqrt(B/(O*j+I*A));var $=V*x*D/S,L=-V*S*U/x,Z=k*$-F*L+p*.5,et=F*$+k*L+b*.5,it=r(1,0,(U-$)/x,(D-L)/S),ot=r((U-$)/x,(D-L)/S,(-U-$)/x,(-D-L)/S);C===0&&ot>0?ot-=2*T:C===1&&ot<0&&(ot+=2*T);for(var nt=Math.ceil(Math.abs(ot/T*2)),ut=[],lt=ot/nt,vt=8/3*Math.sin(lt/4)*Math.sin(lt/4)/Math.sin(lt/2),pt=it+lt,gt=0;gt<nt;gt++)ut[gt]=o(it,pt,k,F,x,S,Z,et,vt,R,Y),R=ut[gt][5],Y=ut[gt][6],it=pt,pt+=lt;return ut}function r(p,b,x,S){var E=Math.atan2(b,p),C=Math.atan2(S,x);return C>=E?C-E:2*Math.PI-(E-C)}function t(p,b,x,S,E,C,_,T){var P;if(f.cachesBoundsOfCurve&&(P=c.call(arguments),f.boundsOfCurveCache[P]))return f.boundsOfCurveCache[P];var F=Math.sqrt,k=Math.min,R=Math.max,Y=Math.abs,U=[],D=[[],[]],O,I,j,A,B,V,tt,$;I=6*p-12*x+6*E,O=-3*p+9*x-9*E+3*_,j=3*x-3*p;for(var L=0;L<2;++L){if(L>0&&(I=6*b-12*S+6*C,O=-3*b+9*S-9*C+3*T,j=3*S-3*b),Y(O)<1e-12){if(Y(I)<1e-12)continue;A=-j/I,0<A&&A<1&&U.push(A);continue}tt=I*I-4*j*O,!(tt<0)&&($=F(tt),B=(-I+$)/(2*O),0<B&&B<1&&U.push(B),V=(-I-$)/(2*O),0<V&&V<1&&U.push(V))}for(var Z,et,it=U.length,ot=it,nt;it--;)A=U[it],nt=1-A,Z=nt*nt*nt*p+3*nt*nt*A*x+3*nt*A*A*E+A*A*A*_,D[0][it]=Z,et=nt*nt*nt*b+3*nt*nt*A*S+3*nt*A*A*C+A*A*A*T,D[1][it]=et;D[0][ot]=p,D[1][ot]=b,D[0][ot+1]=_,D[1][ot+1]=T;var ut=[{x:k.apply(null,D[0]),y:k.apply(null,D[1])},{x:R.apply(null,D[0]),y:R.apply(null,D[1])}];return f.cachesBoundsOfCurve&&(f.boundsOfCurveCache[P]=ut),ut}function n(p,b,x){for(var S=x[1],E=x[2],C=x[3],_=x[4],T=x[5],P=x[6],F=x[7],k=e(P-p,F-b,S,E,_,T,C),R=0,Y=k.length;R<Y;R++)k[R][1]+=p,k[R][2]+=b,k[R][3]+=p,k[R][4]+=b,k[R][5]+=p,k[R][6]+=b;return k}function a(p){var b=0,x=0,S=p.length,E=0,C=0,_,T,P,F=[],k,R,Y;for(T=0;T<S;++T){switch(P=!1,_=p[T].slice(0),_[0]){case"l":_[0]="L",_[1]+=b,_[2]+=x;case"L":b=_[1],x=_[2];break;case"h":_[1]+=b;case"H":_[0]="L",_[2]=x,b=_[1];break;case"v":_[1]+=x;case"V":_[0]="L",x=_[1],_[1]=b,_[2]=x;break;case"m":_[0]="M",_[1]+=b,_[2]+=x;case"M":b=_[1],x=_[2],E=_[1],C=_[2];break;case"c":_[0]="C",_[1]+=b,_[2]+=x,_[3]+=b,_[4]+=x,_[5]+=b,_[6]+=x;case"C":R=_[3],Y=_[4],b=_[5],x=_[6];break;case"s":_[0]="S",_[1]+=b,_[2]+=x,_[3]+=b,_[4]+=x;case"S":k==="C"?(R=2*b-R,Y=2*x-Y):(R=b,Y=x),b=_[3],x=_[4],_[0]="C",_[5]=_[3],_[6]=_[4],_[3]=_[1],_[4]=_[2],_[1]=R,_[2]=Y,R=_[3],Y=_[4];break;case"q":_[0]="Q",_[1]+=b,_[2]+=x,_[3]+=b,_[4]+=x;case"Q":R=_[1],Y=_[2],b=_[3],x=_[4];break;case"t":_[0]="T",_[1]+=b,_[2]+=x;case"T":k==="Q"?(R=2*b-R,Y=2*x-Y):(R=b,Y=x),_[0]="Q",b=_[1],x=_[2],_[1]=R,_[2]=Y,_[3]=b,_[4]=x;break;case"a":_[0]="A",_[6]+=b,_[7]+=x;case"A":P=!0,F=F.concat(n(b,x,_)),b=_[6],x=_[7];break;case"z":case"Z":b=E,x=C;break}P||F.push(_),k=_[0]}return F}function i(p,b,x,S){return Math.sqrt((x-p)*(x-p)+(S-b)*(S-b))}function l(p){return p*p*p}function u(p){return 3*p*p*(1-p)}function d(p){return 3*p*(1-p)*(1-p)}function g(p){return(1-p)*(1-p)*(1-p)}function m(p,b,x,S,E,C,_,T){return function(P){var F=l(P),k=u(P),R=d(P),Y=g(P);return{x:_*F+E*k+x*R+p*Y,y:T*F+C*k+S*R+b*Y}}}function v(p,b,x,S,E,C,_,T){return function(P){var F=1-P,k=3*F*F*(x-p)+6*F*P*(E-x)+3*P*P*(_-E),R=3*F*F*(S-b)+6*F*P*(C-S)+3*P*P*(T-C);return Math.atan2(R,k)}}function y(p){return p*p}function w(p){return 2*p*(1-p)}function M(p){return(1-p)*(1-p)}function X(p,b,x,S,E,C){return function(_){var T=y(_),P=w(_),F=M(_);return{x:E*T+x*P+p*F,y:C*T+S*P+b*F}}}function W(p,b,x,S,E,C){return function(_){var T=1-_,P=2*T*(x-p)+2*_*(E-x),F=2*T*(S-b)+2*_*(C-S);return Math.atan2(F,P)}}function G(p,b,x){var S={x:b,y:x},E,C=0,_;for(_=1;_<=100;_+=1)E=p(_/100),C+=i(S.x,S.y,E.x,E.y),S=E;return C}function N(p,b){for(var x=0,S=0,E=p.iterator,C={x:p.x,y:p.y},_,T,P=.01,F=p.angleFinder,k;S<b&&P>1e-4;)_=E(x),k=x,T=i(C.x,C.y,_.x,_.y),T+S>b?(x-=P,P/=2):(C=_,x+=P,S+=T);return _.angle=F(k),_}function H(p){for(var b=0,x=p.length,S,E=0,C=0,_=0,T=0,P=[],F,k,R,Y=0;Y<x;Y++){switch(S=p[Y],k={x:E,y:C,command:S[0]},S[0]){case"M":k.length=0,_=E=S[1],T=C=S[2];break;case"L":k.length=i(E,C,S[1],S[2]),E=S[1],C=S[2];break;case"C":F=m(E,C,S[1],S[2],S[3],S[4],S[5],S[6]),R=v(E,C,S[1],S[2],S[3],S[4],S[5],S[6]),k.iterator=F,k.angleFinder=R,k.length=G(F,E,C),E=S[5],C=S[6];break;case"Q":F=X(E,C,S[1],S[2],S[3],S[4]),R=W(E,C,S[1],S[2],S[3],S[4]),k.iterator=F,k.angleFinder=R,k.length=G(F,E,C),E=S[3],C=S[4];break;case"Z":case"z":k.destX=_,k.destY=T,k.length=i(E,C,_,T),E=_,C=T;break}b+=k.length,P.push(k)}return P.push({length:b,x:E,y:C}),P}function z(p,b,x){x||(x=H(p));for(var S=0;b-x[S].length>0&&S<x.length-2;)b-=x[S].length,S++;var E=x[S],C=b/E.length,_=E.command,T=p[S],P;switch(_){case"M":return{x:E.x,y:E.y,angle:0};case"Z":case"z":return P=new f.Point(E.x,E.y).lerp(new f.Point(E.destX,E.destY),C),P.angle=Math.atan2(E.destY-E.y,E.destX-E.x),P;case"L":return P=new f.Point(E.x,E.y).lerp(new f.Point(T[1],T[2]),C),P.angle=Math.atan2(T[2]-E.y,T[1]-E.x),P;case"C":return N(E,b);case"Q":return N(E,b)}}function K(p){var b=[],x=[],S,E,C=f.rePathCommand,_="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",T="("+_+")"+f.commaWsp,P="([01])"+f.commaWsp+"?",F=T+"?"+T+"?"+T+P+P+T+"?("+_+")",k=new RegExp(F,"g"),R,Y,U;if(!p||!p.match)return b;U=p.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);for(var D=0,O,I=U.length;D<I;D++){S=U[D],Y=S.slice(1).trim(),x.length=0;var j=S.charAt(0);if(O=[j],j.toLowerCase()==="a")for(var A;A=k.exec(Y);)for(var B=1;B<A.length;B++)x.push(A[B]);else for(;R=C.exec(Y);)x.push(R[0]);for(var B=0,V=x.length;B<V;B++)E=parseFloat(x[B]),isNaN(E)||O.push(E);var tt=s[j.toLowerCase()],$=h[j]||j;if(O.length-1>tt)for(var L=1,Z=O.length;L<Z;L+=tt)b.push([j].concat(O.slice(L,L+tt))),j=$;else b.push(O)}return b}function Q(p,b){var x=[],S,E=new f.Point(p[0].x,p[0].y),C=new f.Point(p[1].x,p[1].y),_=p.length,T=1,P=0,F=_>2;for(b=b||0,F&&(T=p[2].x<C.x?-1:p[2].x===C.x?0:1,P=p[2].y<C.y?-1:p[2].y===C.y?0:1),x.push(["M",E.x-T*b,E.y-P*b]),S=1;S<_;S++){if(!E.eq(C)){var k=E.midPointFrom(C);x.push(["Q",E.x,E.y,k.x,k.y])}E=p[S],S+1<p.length&&(C=p[S+1])}return F&&(T=E.x>p[S-2].x?1:E.x===p[S-2].x?0:-1,P=E.y>p[S-2].y?1:E.y===p[S-2].y?0:-1),x.push(["L",E.x+T*b,E.y+P*b]),x}function J(p,b,x){return x&&(b=f.util.multiplyTransformMatrices(b,[1,0,0,1,-x.x,-x.y])),p.map(function(S){for(var E=S.slice(0),C={},_=1;_<S.length-1;_+=2)C.x=S[_],C.y=S[_+1],C=f.util.transformPoint(C,b),E[_]=C.x,E[_+1]=C.y;return E})}f.util.joinPath=function(p){return p.map(function(b){return b.join(" ")}).join(" ")},f.util.parsePath=K,f.util.makePathSimpler=a,f.util.getSmoothPathFromPoints=Q,f.util.getPathSegmentsInfo=H,f.util.getBoundsOfCurve=t,f.util.getPointOnPath=z,f.util.transformPath=J}(),function(){var c=Array.prototype.slice;function s(t,n){for(var a=c.call(arguments,2),i=[],l=0,u=t.length;l<u;l++)i[l]=a.length?t[l][n].apply(t[l],a):t[l][n].call(t[l]);return i}function h(t,n){return r(t,n,function(a,i){return a>=i})}function o(t,n){return r(t,n,function(a,i){return a<i})}function e(t,n){for(var a=t.length;a--;)t[a]=n;return t}function r(t,n,a){if(!(!t||t.length===0)){var i=t.length-1,l=n?t[i][n]:t[i];if(n)for(;i--;)a(t[i][n],l)&&(l=t[i][n]);else for(;i--;)a(t[i],l)&&(l=t[i]);return l}}f.util.array={fill:e,invoke:s,min:o,max:h}}(),function(){function c(h,o,e){if(e)if(!f.isLikelyNode&&o instanceof Element)h=o;else if(o instanceof Array){h=[];for(var r=0,t=o.length;r<t;r++)h[r]=c({},o[r],e)}else if(o&&typeof o=="object")for(var n in o)n==="canvas"||n==="group"?h[n]=null:o.hasOwnProperty(n)&&(h[n]=c({},o[n],e));else h=o;else for(var n in o)h[n]=o[n];return h}function s(h,o){return c({},h,o)}f.util.object={extend:c,clone:s},f.util.object.extend(f.util,f.Observable)}(),function(){function c(r){return r.replace(/-+(.)?/g,function(t,n){return n?n.toUpperCase():""})}function s(r,t){return r.charAt(0).toUpperCase()+(t?r.slice(1):r.slice(1).toLowerCase())}function h(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function o(r){var t=0,n,a=[];for(t=0,n;t<r.length;t++)(n=e(r,t))!==!1&&a.push(n);return a}function e(r,t){var n=r.charCodeAt(t);if(isNaN(n))return"";if(n<55296||n>57343)return r.charAt(t);if(55296<=n&&n<=56319){if(r.length<=t+1)throw"High surrogate without following low surrogate";var a=r.charCodeAt(t+1);if(56320>a||a>57343)throw"High surrogate without following low surrogate";return r.charAt(t)+r.charAt(t+1)}if(t===0)throw"Low surrogate without preceding high surrogate";var i=r.charCodeAt(t-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1}f.util.string={camelize:c,capitalize:s,escapeXml:h,graphemeSplit:o}}(),function(){var c=Array.prototype.slice,s=function(){},h=function(){for(var n in{toString:1})if(n==="toString")return!1;return!0}(),o=function(n,a,i){for(var l in a)l in n.prototype&&typeof n.prototype[l]=="function"&&(a[l]+"").indexOf("callSuper")>-1?n.prototype[l]=function(u){return function(){var d=this.constructor.superclass;this.constructor.superclass=i;var g=a[u].apply(this,arguments);if(this.constructor.superclass=d,u!=="initialize")return g}}(l):n.prototype[l]=a[l],h&&(a.toString!==Object.prototype.toString&&(n.prototype.toString=a.toString),a.valueOf!==Object.prototype.valueOf&&(n.prototype.valueOf=a.valueOf))};function e(){}function r(n){for(var a=null,i=this;i.constructor.superclass;){var l=i.constructor.superclass.prototype[n];if(i[n]!==l){a=l;break}i=i.constructor.superclass.prototype}return a?arguments.length>1?a.apply(this,c.call(arguments,1)):a.call(this):console.log("tried to callSuper "+n+", method not found in prototype chain",this)}function t(){var n=null,a=c.call(arguments,0);typeof a[0]=="function"&&(n=a.shift());function i(){this.initialize.apply(this,arguments)}i.superclass=n,i.subclasses=[],n&&(e.prototype=n.prototype,i.prototype=new e,n.subclasses.push(i));for(var l=0,u=a.length;l<u;l++)o(i,a[l],n);return i.prototype.initialize||(i.prototype.initialize=s),i.prototype.constructor=i,i.prototype.callSuper=r,i}f.util.createClass=t}(),function(){var c=!!f.document.createElement("div").attachEvent,s=["touchstart","touchmove","touchend"];f.util.addListener=function(o,e,r,t){o&&o.addEventListener(e,r,c?!1:t)},f.util.removeListener=function(o,e,r,t){o&&o.removeEventListener(e,r,c?!1:t)};function h(o){var e=o.changedTouches;return e&&e[0]?e[0]:o}f.util.getPointer=function(o){var e=o.target,r=f.util.getScrollLeftTop(e),t=h(o);return{x:t.clientX+r.left,y:t.clientY+r.top}},f.util.isTouchEvent=function(o){return s.indexOf(o.type)>-1||o.pointerType==="touch"}}(),function(){function c(t,n){var a=t.style;if(!a)return t;if(typeof n=="string")return t.style.cssText+=";"+n,n.indexOf("opacity")>-1?r(t,n.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var i in n)if(i==="opacity")r(t,n[i]);else{var l=i==="float"||i==="cssFloat"?typeof a.styleFloat>"u"?"cssFloat":"styleFloat":i;a.setProperty(l,n[i])}return t}var s=f.document.createElement("div"),h=typeof s.style.opacity=="string",o=typeof s.style.filter=="string",e=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,r=function(t){return t};h?r=function(t,n){return t.style.opacity=n,t}:o&&(r=function(t,n){var a=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(a.zoom=1),e.test(a.filter)?(n=n>=.9999?"":"alpha(opacity="+n*100+")",a.filter=a.filter.replace(e,n)):a.filter+=" alpha(opacity="+n*100+")",t}),f.util.setStyle=c}(),function(){var c=Array.prototype.slice;function s(g){return typeof g=="string"?f.document.getElementById(g):g}var h,o=function(g){return c.call(g,0)};try{h=o(f.document.childNodes)instanceof Array}catch{}h||(o=function(g){for(var m=new Array(g.length),v=g.length;v--;)m[v]=g[v];return m});function e(g,m){var v=f.document.createElement(g);for(var y in m)y==="class"?v.className=m[y]:y==="for"?v.htmlFor=m[y]:v.setAttribute(y,m[y]);return v}function r(g,m){g&&(" "+g.className+" ").indexOf(" "+m+" ")===-1&&(g.className+=(g.className?" ":"")+m)}function t(g,m,v){return typeof m=="string"&&(m=e(m,v)),g.parentNode&&g.parentNode.replaceChild(m,g),m.appendChild(g),m}function n(g){for(var m=0,v=0,y=f.document.documentElement,w=f.document.body||{scrollLeft:0,scrollTop:0};g&&(g.parentNode||g.host)&&(g=g.parentNode||g.host,g===f.document?(m=w.scrollLeft||y.scrollLeft||0,v=w.scrollTop||y.scrollTop||0):(m+=g.scrollLeft||0,v+=g.scrollTop||0),!(g.nodeType===1&&g.style.position==="fixed")););return{left:m,top:v}}function a(g){var m,v=g&&g.ownerDocument,y={left:0,top:0},w={left:0,top:0},M,X={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!v)return w;for(var W in X)w[X[W]]+=parseInt(i(g,W),10)||0;return m=v.documentElement,typeof g.getBoundingClientRect<"u"&&(y=g.getBoundingClientRect()),M=n(g),{left:y.left+M.left-(m.clientLeft||0)+w.left,top:y.top+M.top-(m.clientTop||0)+w.top}}var i;f.document.defaultView&&f.document.defaultView.getComputedStyle?i=function(g,m){var v=f.document.defaultView.getComputedStyle(g,null);return v?v[m]:void 0}:i=function(g,m){var v=g.style[m];return!v&&g.currentStyle&&(v=g.currentStyle[m]),v},function(){var g=f.document.documentElement.style,m="userSelect"in g?"userSelect":"MozUserSelect"in g?"MozUserSelect":"WebkitUserSelect"in g?"WebkitUserSelect":"KhtmlUserSelect"in g?"KhtmlUserSelect":"";function v(w){return typeof w.onselectstart<"u"&&(w.onselectstart=f.util.falseFunction),m?w.style[m]="none":typeof w.unselectable=="string"&&(w.unselectable="on"),w}function y(w){return typeof w.onselectstart<"u"&&(w.onselectstart=null),m?w.style[m]="":typeof w.unselectable=="string"&&(w.unselectable=""),w}f.util.makeElementUnselectable=v,f.util.makeElementSelectable=y}();function l(g){var m=f.jsdomImplForWrapper(g);return m._canvas||m._image}function u(g){if(f.isLikelyNode){var m=f.jsdomImplForWrapper(g);m&&(m._image=null,m._canvas=null,m._currentSrc=null,m._attributes=null,m._classList=null)}}function d(g,m){g.imageSmoothingEnabled=g.imageSmoothingEnabled||g.webkitImageSmoothingEnabled||g.mozImageSmoothingEnabled||g.msImageSmoothingEnabled||g.oImageSmoothingEnabled,g.imageSmoothingEnabled=m}f.util.setImageSmoothing=d,f.util.getById=s,f.util.toArray=o,f.util.addClass=r,f.util.makeElement=e,f.util.wrapElement=t,f.util.getScrollLeftTop=n,f.util.getElementOffset=a,f.util.getNodeCanvas=l,f.util.cleanUpJsdomNode=u}(),function(){function c(o,e){return o+(/\?/.test(o)?"&":"?")+e}function s(){}function h(o,e){e||(e={});var r=e.method?e.method.toUpperCase():"GET",t=e.onComplete||function(){},n=new f.window.XMLHttpRequest,a=e.body||e.parameters;return n.onreadystatechange=function(){n.readyState===4&&(t(n),n.onreadystatechange=s)},r==="GET"&&(a=null,typeof e.parameters=="string"&&(o=c(o,e.parameters))),n.open(r,o,!0),(r==="POST"||r==="PUT")&&n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.send(a),n}f.util.request=h}(),f.log=console.log,f.warn=console.warn,function(){var c=f.util.object.extend,s=f.util.object.clone,h=[];f.util.object.extend(h,{cancelAll:function(){var l=this.splice(0);return l.forEach(function(u){u.cancel()}),l},cancelByCanvas:function(l){if(!l)return[];var u=this.filter(function(d){return typeof d.target=="object"&&d.target.canvas===l});return u.forEach(function(d){d.cancel()}),u},cancelByTarget:function(l){var u=this.findAnimationsByTarget(l);return u.forEach(function(d){d.cancel()}),u},findAnimationIndex:function(l){return this.indexOf(this.findAnimation(l))},findAnimation:function(l){return this.find(function(u){return u.cancel===l})},findAnimationsByTarget:function(l){return l?this.filter(function(u){return u.target===l}):[]}});function o(){return!1}function e(l,u,d,g){return-d*Math.cos(l/g*(Math.PI/2))+d+u}function r(l){l||(l={});var u=!1,d,g=function(){var m=f.runningAnimations.indexOf(d);return m>-1&&f.runningAnimations.splice(m,1)[0]};return d=c(s(l),{cancel:function(){return u=!0,g()},currentValue:"startValue"in l?l.startValue:0,completionRate:0,durationRate:0}),f.runningAnimations.push(d),a(function(m){var v=m||+new Date,y=l.duration||500,w=v+y,M,X=l.onChange||o,W=l.abort||o,G=l.onComplete||o,N=l.easing||e,H="startValue"in l?l.startValue.length>0:!1,z="startValue"in l?l.startValue:0,K="endValue"in l?l.endValue:100,Q=l.byValue||(H?z.map(function(J,p){return K[p]-z[p]}):K-z);l.onStart&&l.onStart(),function J(p){M=p||+new Date;var b=M>w?y:M-v,x=b/y,S=H?z.map(function(C,_){return N(b,z[_],Q[_],y)}):N(b,z,Q,y),E=Math.abs(H?(S[0]-z[0])/Q[0]:(S-z)/Q);if(d.currentValue=H?S.slice():S,d.completionRate=E,d.durationRate=x,!u){if(W(S,E,x)){g();return}if(M>w){d.currentValue=H?K.slice():K,d.completionRate=1,d.durationRate=1,X(H?K.slice():K,1,1),G(K,1,1),g();return}else X(S,E,x),a(J)}}(v)}),d.cancel}var t=f.window.requestAnimationFrame||f.window.webkitRequestAnimationFrame||f.window.mozRequestAnimationFrame||f.window.oRequestAnimationFrame||f.window.msRequestAnimationFrame||function(l){return f.window.setTimeout(l,1e3/60)},n=f.window.cancelAnimationFrame||f.window.clearTimeout;function a(){return t.apply(f.window,arguments)}function i(){return n.apply(f.window,arguments)}f.util.animate=r,f.util.requestAnimFrame=a,f.util.cancelAnimFrame=i,f.runningAnimations=h}(),function(){function c(h,o,e){var r="rgba("+parseInt(h[0]+e*(o[0]-h[0]),10)+","+parseInt(h[1]+e*(o[1]-h[1]),10)+","+parseInt(h[2]+e*(o[2]-h[2]),10);return r+=","+(h&&o?parseFloat(h[3]+e*(o[3]-h[3])):1),r+=")",r}function s(h,o,e,r){var t=new f.Color(h).getSource(),n=new f.Color(o).getSource(),a=r.onComplete,i=r.onChange;return r=r||{},f.util.animate(f.util.object.extend(r,{duration:e||500,startValue:t,endValue:n,byValue:n,easing:function(l,u,d,g){var m=r.colorEasing?r.colorEasing(l,g):1-Math.cos(l/g*(Math.PI/2));return c(u,d,m)},onComplete:function(l,u,d){if(a)return a(c(n,n,0),u,d)},onChange:function(l,u,d){if(i){if(Array.isArray(l))return i(c(l,l,0),u,d);i(l,u,d)}}}))}f.util.animateColor=s}(),function(){function c(p,b,x,S){return p<Math.abs(b)?(p=b,S=x/4):b===0&&p===0?S=x/(2*Math.PI)*Math.asin(1):S=x/(2*Math.PI)*Math.asin(b/p),{a:p,c:b,p:x,s:S}}function s(p,b,x){return p.a*Math.pow(2,10*(b-=1))*Math.sin((b*x-p.s)*(2*Math.PI)/p.p)}function h(p,b,x,S){return x*((p=p/S-1)*p*p+1)+b}function o(p,b,x,S){return p/=S/2,p<1?x/2*p*p*p+b:x/2*((p-=2)*p*p+2)+b}function e(p,b,x,S){return x*(p/=S)*p*p*p+b}function r(p,b,x,S){return-x*((p=p/S-1)*p*p*p-1)+b}function t(p,b,x,S){return p/=S/2,p<1?x/2*p*p*p*p+b:-x/2*((p-=2)*p*p*p-2)+b}function n(p,b,x,S){return x*(p/=S)*p*p*p*p+b}function a(p,b,x,S){return x*((p=p/S-1)*p*p*p*p+1)+b}function i(p,b,x,S){return p/=S/2,p<1?x/2*p*p*p*p*p+b:x/2*((p-=2)*p*p*p*p+2)+b}function l(p,b,x,S){return-x*Math.cos(p/S*(Math.PI/2))+x+b}function u(p,b,x,S){return x*Math.sin(p/S*(Math.PI/2))+b}function d(p,b,x,S){return-x/2*(Math.cos(Math.PI*p/S)-1)+b}function g(p,b,x,S){return p===0?b:x*Math.pow(2,10*(p/S-1))+b}function m(p,b,x,S){return p===S?b+x:x*(-Math.pow(2,-10*p/S)+1)+b}function v(p,b,x,S){return p===0?b:p===S?b+x:(p/=S/2,p<1?x/2*Math.pow(2,10*(p-1))+b:x/2*(-Math.pow(2,-10*--p)+2)+b)}function y(p,b,x,S){return-x*(Math.sqrt(1-(p/=S)*p)-1)+b}function w(p,b,x,S){return x*Math.sqrt(1-(p=p/S-1)*p)+b}function M(p,b,x,S){return p/=S/2,p<1?-x/2*(Math.sqrt(1-p*p)-1)+b:x/2*(Math.sqrt(1-(p-=2)*p)+1)+b}function X(p,b,x,S){var E=1.70158,C=0,_=x;if(p===0)return b;if(p/=S,p===1)return b+x;C||(C=S*.3);var T=c(_,x,C,E);return-s(T,p,S)+b}function W(p,b,x,S){var E=1.70158,C=0,_=x;if(p===0)return b;if(p/=S,p===1)return b+x;C||(C=S*.3);var T=c(_,x,C,E);return T.a*Math.pow(2,-10*p)*Math.sin((p*S-T.s)*(2*Math.PI)/T.p)+T.c+b}function G(p,b,x,S){var E=1.70158,C=0,_=x;if(p===0)return b;if(p/=S/2,p===2)return b+x;C||(C=S*(.3*1.5));var T=c(_,x,C,E);return p<1?-.5*s(T,p,S)+b:T.a*Math.pow(2,-10*(p-=1))*Math.sin((p*S-T.s)*(2*Math.PI)/T.p)*.5+T.c+b}function N(p,b,x,S,E){return E===void 0&&(E=1.70158),x*(p/=S)*p*((E+1)*p-E)+b}function H(p,b,x,S,E){return E===void 0&&(E=1.70158),x*((p=p/S-1)*p*((E+1)*p+E)+1)+b}function z(p,b,x,S,E){return E===void 0&&(E=1.70158),p/=S/2,p<1?x/2*(p*p*(((E*=1.525)+1)*p-E))+b:x/2*((p-=2)*p*(((E*=1.525)+1)*p+E)+2)+b}function K(p,b,x,S){return x-Q(S-p,0,x,S)+b}function Q(p,b,x,S){return(p/=S)<1/2.75?x*(7.5625*p*p)+b:p<2/2.75?x*(7.5625*(p-=1.5/2.75)*p+.75)+b:p<2.5/2.75?x*(7.5625*(p-=2.25/2.75)*p+.9375)+b:x*(7.5625*(p-=2.625/2.75)*p+.984375)+b}function J(p,b,x,S){return p<S/2?K(p*2,0,x,S)*.5+b:Q(p*2-S,0,x,S)*.5+x*.5+b}f.util.ease={easeInQuad:function(p,b,x,S){return x*(p/=S)*p+b},easeOutQuad:function(p,b,x,S){return-x*(p/=S)*(p-2)+b},easeInOutQuad:function(p,b,x,S){return p/=S/2,p<1?x/2*p*p+b:-x/2*(--p*(p-2)-1)+b},easeInCubic:function(p,b,x,S){return x*(p/=S)*p*p+b},easeOutCubic:h,easeInOutCubic:o,easeInQuart:e,easeOutQuart:r,easeInOutQuart:t,easeInQuint:n,easeOutQuint:a,easeInOutQuint:i,easeInSine:l,easeOutSine:u,easeInOutSine:d,easeInExpo:g,easeOutExpo:m,easeInOutExpo:v,easeInCirc:y,easeOutCirc:w,easeInOutCirc:M,easeInElastic:X,easeOutElastic:W,easeInOutElastic:G,easeInBack:N,easeOutBack:H,easeInOutBack:z,easeInBounce:K,easeOutBounce:Q,easeInOutBounce:J}}(),function(c){var s=c.fabric||(c.fabric={}),h=s.util.object.extend,o=s.util.object.clone,e=s.util.toFixed,r=s.util.parseUnit,t=s.util.multiplyTransformMatrices,n=["path","circle","polygon","polyline","ellipse","rect","line","image","text"],a=["symbol","image","marker","pattern","view","svg"],i=["pattern","defs","symbol","metadata","clipPath","mask","desc"],l=["symbol","g","a","svg","clipPath","defs"],u={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},d={stroke:"strokeOpacity",fill:"fillOpacity"},g="font-size",m="clip-path";s.svgValidTagNamesRegEx=w(n),s.svgViewBoxElementsRegEx=w(a),s.svgInvalidAncestorsRegEx=w(i),s.svgValidParentsRegEx=w(l),s.cssRules={},s.gradientDefs={},s.clipPaths={};function v(C){return C in u?u[C]:C}function y(C,_,T,P){var F=Array.isArray(_),k;if((C==="fill"||C==="stroke")&&_==="none")_="";else{if(C==="strokeUniform")return _==="non-scaling-stroke";if(C==="strokeDashArray")_==="none"?_=null:_=_.replace(/,/g," ").split(/\s+/).map(parseFloat);else if(C==="transformMatrix")T&&T.transformMatrix?_=t(T.transformMatrix,s.parseTransformAttribute(_)):_=s.parseTransformAttribute(_);else if(C==="visible")_=_!=="none"&&_!=="hidden",T&&T.visible===!1&&(_=!1);else if(C==="opacity")_=parseFloat(_),T&&typeof T.opacity<"u"&&(_*=T.opacity);else if(C==="textAnchor")_=_==="start"?"left":_==="end"?"right":"center";else if(C==="charSpacing")k=r(_,P)/P*1e3;else if(C==="paintFirst"){var R=_.indexOf("fill"),Y=_.indexOf("stroke"),_="fill";(R>-1&&Y>-1&&Y<R||R===-1&&Y>-1)&&(_="stroke")}else{if(C==="href"||C==="xlink:href"||C==="font")return _;if(C==="imageSmoothing")return _==="optimizeQuality";k=F?_.map(r):r(_,P)}}return!F&&isNaN(k)?_:k}function w(C){return new RegExp("^("+C.join("|")+")\\b","i")}function M(C){for(var _ in d)if(!(typeof C[d[_]]>"u"||C[_]==="")){if(typeof C[_]>"u"){if(!s.Object.prototype[_])continue;C[_]=s.Object.prototype[_]}if(C[_].indexOf("url(")!==0){var T=new s.Color(C[_]);C[_]=T.setAlpha(e(T.getAlpha()*C[d[_]],2)).toRgba()}}return C}function X(C,_){var T,P=[],F,k,R;for(k=0,R=_.length;k<R;k++)T=_[k],F=C.getElementsByTagName(T),P=P.concat(Array.prototype.slice.call(F));return P}s.parseTransformAttribute=function(){function C(L,Z){var et=s.util.cos(Z[0]),it=s.util.sin(Z[0]),ot=0,nt=0;Z.length===3&&(ot=Z[1],nt=Z[2]),L[0]=et,L[1]=it,L[2]=-it,L[3]=et,L[4]=ot-(et*ot-it*nt),L[5]=nt-(it*ot+et*nt)}function _(L,Z){var et=Z[0],it=Z.length===2?Z[1]:Z[0];L[0]=et,L[3]=it}function T(L,Z,et){L[et]=Math.tan(s.util.degreesToRadians(Z[0]))}function P(L,Z){L[4]=Z[0],Z.length===2&&(L[5]=Z[1])}var F=s.iMatrix,k=s.reNum,R=s.commaWsp,Y="(?:(skewX)\\s*\\(\\s*("+k+")\\s*\\))",U="(?:(skewY)\\s*\\(\\s*("+k+")\\s*\\))",D="(?:(rotate)\\s*\\(\\s*("+k+")(?:"+R+"("+k+")"+R+"("+k+"))?\\s*\\))",O="(?:(scale)\\s*\\(\\s*("+k+")(?:"+R+"("+k+"))?\\s*\\))",I="(?:(translate)\\s*\\(\\s*("+k+")(?:"+R+"("+k+"))?\\s*\\))",j="(?:(matrix)\\s*\\(\\s*("+k+")"+R+"("+k+")"+R+"("+k+")"+R+"("+k+")"+R+"("+k+")"+R+"("+k+")\\s*\\))",A="(?:"+j+"|"+I+"|"+O+"|"+D+"|"+Y+"|"+U+")",B="(?:"+A+"(?:"+R+"*"+A+")*)",V="^\\s*(?:"+B+"?)\\s*$",tt=new RegExp(V),$=new RegExp(A,"g");return function(L){var Z=F.concat(),et=[];if(!L||L&&!tt.test(L))return Z;L.replace($,function(ot){var nt=new RegExp(A).exec(ot).filter(function(vt){return!!vt}),ut=nt[1],lt=nt.slice(2).map(parseFloat);switch(ut){case"translate":P(Z,lt);break;case"rotate":lt[0]=s.util.degreesToRadians(lt[0]),C(Z,lt);break;case"scale":_(Z,lt);break;case"skewX":T(Z,lt,2);break;case"skewY":T(Z,lt,1);break;case"matrix":Z=lt;break}et.push(Z.concat()),Z=F.concat()});for(var it=et[0];et.length>1;)et.shift(),it=s.util.multiplyTransformMatrices(it,et[0]);return it}}();function W(C,_){var T,P;C.replace(/;\s*$/,"").split(";").forEach(function(F){var k=F.split(":");T=k[0].trim().toLowerCase(),P=k[1].trim(),_[T]=P})}function G(C,_){var T,P;for(var F in C)typeof C[F]>"u"||(T=F.toLowerCase(),P=C[F],_[T]=P)}function N(C,_){var T={};for(var P in s.cssRules[_])if(H(C,P.split(" ")))for(var F in s.cssRules[_][P])T[F]=s.cssRules[_][P][F];return T}function H(C,_){var T,P=!0;return T=K(C,_.pop()),T&&_.length&&(P=z(C,_)),T&&P&&_.length===0}function z(C,_){for(var T,P=!0;C.parentNode&&C.parentNode.nodeType===1&&_.length;)P&&(T=_.pop()),C=C.parentNode,P=K(C,T);return _.length===0}function K(C,_){var T=C.nodeName,P=C.getAttribute("class"),F=C.getAttribute("id"),k,R;if(k=new RegExp("^"+T,"i"),_=_.replace(k,""),F&&_.length&&(k=new RegExp("#"+F+"(?![a-zA-Z\\-]+)","i"),_=_.replace(k,"")),P&&_.length)for(P=P.split(" "),R=P.length;R--;)k=new RegExp("\\."+P[R]+"(?![a-zA-Z\\-]+)","i"),_=_.replace(k,"");return _.length===0}function Q(C,_){var T;if(C.getElementById&&(T=C.getElementById(_)),T)return T;var P,F,k,R=C.getElementsByTagName("*");for(F=0,k=R.length;F<k;F++)if(P=R[F],_===P.getAttribute("id"))return P}function J(C){for(var _=X(C,["use","svg:use"]),T=0;_.length&&T<_.length;){var P=_[T],F=P.getAttribute("xlink:href")||P.getAttribute("href");if(F===null)return;var k=F.slice(1),R=P.getAttribute("x")||0,Y=P.getAttribute("y")||0,U=Q(C,k).cloneNode(!0),D=(U.getAttribute("transform")||"")+" translate("+R+", "+Y+")",O,I=_.length,j,A,B,V,tt=s.svgNS;if(b(U),/^svg$/i.test(U.nodeName)){var $=U.ownerDocument.createElementNS(tt,"g");for(A=0,B=U.attributes,V=B.length;A<V;A++)j=B.item(A),$.setAttributeNS(tt,j.nodeName,j.nodeValue);for(;U.firstChild;)$.appendChild(U.firstChild);U=$}for(A=0,B=P.attributes,V=B.length;A<V;A++)j=B.item(A),!(j.nodeName==="x"||j.nodeName==="y"||j.nodeName==="xlink:href"||j.nodeName==="href")&&(j.nodeName==="transform"?D=j.nodeValue+" "+D:U.setAttribute(j.nodeName,j.nodeValue));U.setAttribute("transform",D),U.setAttribute("instantiated_by_use","1"),U.removeAttribute("id"),O=P.parentNode,O.replaceChild(U,P),_.length===I&&T++}}var p=new RegExp("^\\s*("+s.reNum+"+)\\s*,?\\s*("+s.reNum+"+)\\s*,?\\s*("+s.reNum+"+)\\s*,?\\s*("+s.reNum+"+)\\s*$");function b(C){if(!s.svgViewBoxElementsRegEx.test(C.nodeName))return{};var _=C.getAttribute("viewBox"),T=1,P=1,F=0,k=0,R,Y,U,D,O=C.getAttribute("width"),I=C.getAttribute("height"),j=C.getAttribute("x")||0,A=C.getAttribute("y")||0,B=C.getAttribute("preserveAspectRatio")||"",V=!_||!(_=_.match(p)),tt=!O||!I||O==="100%"||I==="100%",$=V&&tt,L={},Z="",et=0,it=0;if(L.width=0,L.height=0,L.toBeParsed=$,V&&(j||A)&&C.parentNode&&C.parentNode.nodeName!=="#document"&&(Z=" translate("+r(j)+" "+r(A)+") ",U=(C.getAttribute("transform")||"")+Z,C.setAttribute("transform",U),C.removeAttribute("x"),C.removeAttribute("y")),$)return L;if(V)return L.width=r(O),L.height=r(I),L;if(F=-parseFloat(_[1]),k=-parseFloat(_[2]),R=parseFloat(_[3]),Y=parseFloat(_[4]),L.minX=F,L.minY=k,L.viewBoxWidth=R,L.viewBoxHeight=Y,tt?(L.width=R,L.height=Y):(L.width=r(O),L.height=r(I),T=L.width/R,P=L.height/Y),B=s.util.parsePreserveAspectRatioAttribute(B),B.alignX!=="none"&&(B.meetOrSlice==="meet"&&(P=T=T>P?P:T),B.meetOrSlice==="slice"&&(P=T=T>P?T:P),et=L.width-R*T,it=L.height-Y*T,B.alignX==="Mid"&&(et/=2),B.alignY==="Mid"&&(it/=2),B.alignX==="Min"&&(et=0),B.alignY==="Min"&&(it=0)),T===1&&P===1&&F===0&&k===0&&j===0&&A===0)return L;if((j||A)&&C.parentNode.nodeName!=="#document"&&(Z=" translate("+r(j)+" "+r(A)+") "),U=Z+" matrix("+T+" 0 0 "+P+" "+(F*T+et)+" "+(k*P+it)+") ",C.nodeName==="svg"){for(D=C.ownerDocument.createElementNS(s.svgNS,"g");C.firstChild;)D.appendChild(C.firstChild);C.appendChild(D)}else D=C,D.removeAttribute("x"),D.removeAttribute("y"),U=D.getAttribute("transform")+U;return D.setAttribute("transform",U),L}function x(C,_){for(;C&&(C=C.parentNode);)if(C.nodeName&&_.test(C.nodeName.replace("svg:",""))&&!C.getAttribute("instantiated_by_use"))return!0;return!1}s.parseSVGDocument=function(C,_,T,P){if(C){J(C);var F=s.Object.__uid++,k,R,Y=b(C),U=s.util.toArray(C.getElementsByTagName("*"));if(Y.crossOrigin=P&&P.crossOrigin,Y.svgUid=F,U.length===0&&s.isLikelyNode){U=C.selectNodes('//*[name(.)!="svg"]');var D=[];for(k=0,R=U.length;k<R;k++)D[k]=U[k];U=D}var O=U.filter(function(j){return b(j),s.svgValidTagNamesRegEx.test(j.nodeName.replace("svg:",""))&&!x(j,s.svgInvalidAncestorsRegEx)});if(!O||O&&!O.length){_&&_([],{});return}var I={};U.filter(function(j){return j.nodeName.replace("svg:","")==="clipPath"}).forEach(function(j){var A=j.getAttribute("id");I[A]=s.util.toArray(j.getElementsByTagName("*")).filter(function(B){return s.svgValidTagNamesRegEx.test(B.nodeName.replace("svg:",""))})}),s.gradientDefs[F]=s.getGradientDefs(C),s.cssRules[F]=s.getCSSRules(C),s.clipPaths[F]=I,s.parseElements(O,function(j,A){_&&(_(j,Y,A,U),delete s.gradientDefs[F],delete s.cssRules[F],delete s.clipPaths[F])},o(Y),T,P)}};function S(C,_){var T=["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"],P="xlink:href",F=_.getAttribute(P).slice(1),k=Q(C,F);if(k&&k.getAttribute(P)&&S(C,k),T.forEach(function(Y){k&&!_.hasAttribute(Y)&&k.hasAttribute(Y)&&_.setAttribute(Y,k.getAttribute(Y))}),!_.children.length)for(var R=k.cloneNode(!0);R.firstChild;)_.appendChild(R.firstChild);_.removeAttribute(P)}var E=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+s.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+s.reNum+"))?\\s+(.*)");h(s,{parseFontDeclaration:function(C,_){var T=C.match(E);if(T){var P=T[1],F=T[3],k=T[4],R=T[5],Y=T[6];P&&(_.fontStyle=P),F&&(_.fontWeight=isNaN(parseFloat(F))?F:parseFloat(F)),k&&(_.fontSize=r(k)),Y&&(_.fontFamily=Y),R&&(_.lineHeight=R==="normal"?1:R)}},getGradientDefs:function(C){var _=["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"],T=X(C,_),P,F=0,k={};for(F=T.length;F--;)P=T[F],P.getAttribute("xlink:href")&&S(C,P),k[P.getAttribute("id")]=P;return k},parseAttributes:function(C,_,T){if(C){var P,F={},k,R;typeof T>"u"&&(T=C.getAttribute("svgUid")),C.parentNode&&s.svgValidParentsRegEx.test(C.parentNode.nodeName)&&(F=s.parseAttributes(C.parentNode,_,T));var Y=_.reduce(function(B,V){return P=C.getAttribute(V),P&&(B[V]=P),B},{}),U=h(N(C,T),s.parseStyleAttribute(C));Y=h(Y,U),U[m]&&C.setAttribute(m,U[m]),k=R=F.fontSize||s.Text.DEFAULT_SVG_FONT_SIZE,Y[g]&&(Y[g]=k=r(Y[g],R));var D,O,I={};for(var j in Y)D=v(j),O=y(D,Y[j],F,k),I[D]=O;I&