UNPKG

dynamsoft-camera-enhancer

Version:

Allow your website to easily control cameras on desktop and mobile devices.

11 lines 513 kB
/*! * Dynamsoft JavaScript Library * @product Dynamsoft Camera Enhancer JS Edition * @website https://www.dynamsoft.com * @copyright Copyright 2024, Dynamsoft Corporation * @author Dynamsoft * @version 4.1.1 * @fileoverview Dynamsoft JavaScript Library for Camera Enhancer * More info on DCE JS: https://www.dynamsoft.com/camera-enhancer/docs/programming/javascript/?ver=latest */ import{CoreModule as t,workerAutoResources as e,mapPackageRegister as i,isRect as r,isPolygon as n,isDSImageData as s,EnumImagePixelFormat as o,isLineSegment as a,isQuad as h,isPoint as l,isDSRect as c,handleEngineResourcePaths as u,EnumCapturedResultItemType as d,EnumCrossVerificationStatus as f,ImageSourceAdapter as g,EnumImageTagType as m,EnumIntermediateResultUnitType as p,EnumBufferOverflowProtectionMode as v,EnumErrorCode as y}from"dynamsoft-core";const _="undefined"==typeof self,w="function"==typeof importScripts,b=(()=>{if(!w){if(!_&&document.currentScript){let t=document.currentScript.src,e=t.indexOf("?");if(-1!=e)t=t.substring(0,e);else{let e=t.indexOf("#");-1!=e&&(t=t.substring(0,e))}return t.substring(0,t.lastIndexOf("/")+1)}return"./"}})();t.engineResourcePaths.dce={version:"4.1.1",path:b,isInternal:!0},e.dce={wasm:!1,js:!1},i.dce={};class x{static getVersion(){return"4.1.1"}}function C(t,e,i,r){if("a"===i&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?r:"a"===i?r.call(t):r?r.value:e.get(t)}function S(t,e,i,r,n){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?n.call(t,i):n?n.value=i:e.set(t,i),i}let T,E,O,A,I;"function"==typeof SuppressedError&&SuppressedError,"undefined"!=typeof navigator&&(T=navigator,E=T.userAgent,O=T.platform,A=T.mediaDevices),function(){if(!_){const t={Edge:{search:"Edg",verSearch:"Edg"},OPR:null,Chrome:null,Safari:{str:T.vendor,search:"Apple",verSearch:["Version","iPhone OS","CPU OS"]},Firefox:null,Explorer:{search:"MSIE",verSearch:"MSIE"}},e={HarmonyOS:null,Android:null,iPhone:null,iPad:null,Windows:{str:O,search:"Win"},Mac:{str:O},Linux:{str:O}};let i="unknownBrowser",r=0,n="unknownOS";for(let e in t){const n=t[e]||{};let s=n.str||E,o=n.search||e,a=n.verStr||E,h=n.verSearch||e;if(h instanceof Array||(h=[h]),-1!=s.indexOf(o)){i=e;for(let t of h){let e=a.indexOf(t);if(-1!=e){r=parseFloat(a.substring(e+t.length+1));break}}break}}for(let t in e){const i=e[t]||{};let r=i.str||E,s=i.search||t;if(-1!=r.indexOf(s)){n=t;break}}"Linux"==n&&-1!=E.indexOf("Windows NT")&&(n="HarmonyOS"),I={browser:i,version:r,OS:n}}_&&(I={browser:"ssr",version:0,OS:"ssr"})}();const L="undefined"!=typeof WebAssembly&&E&&!(/Safari/.test(E)&&!/Chrome/.test(E)&&/\(.+\s11_2_([2-6]).*\)/.test(E)),D=!("undefined"==typeof Worker),M=!(!A||!A.getUserMedia),F=async()=>{let t=!1;if(M)try{(await A.getUserMedia({video:!0})).getTracks().forEach((t=>{t.stop()})),t=!0}catch(t){}return t};"Chrome"===I.browser&&I.version>66||"Safari"===I.browser&&I.version>13||"OPR"===I.browser&&I.version>43||"Edge"===I.browser&&I.version;var P={653:(t,e,i)=>{var r,n,s,o,a,h,l,c,u,d,f,g,m,p,v,y,_,w,b,x,C,S=S||{version:"5.2.1"};if(e.fabric=S,"undefined"!=typeof document&&"undefined"!=typeof window)document instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document)?S.document=document:S.document=document.implementation.createHTMLDocument(""),S.window=window;else{var T=new(i(192).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;S.document=T.document,S.jsdomImplForWrapper=i(898).implForWrapper,S.nodeCanvas=i(245).Canvas,S.window=T,DOMParser=S.window.DOMParser}function E(t,e){var i=t.canvas,r=e.targetCanvas,n=r.getContext("2d");n.translate(0,r.height),n.scale(1,-1);var s=i.height-r.height;n.drawImage(i,0,s,r.width,r.height,0,0,r.width,r.height)}function O(t,e){var i=e.targetCanvas.getContext("2d"),r=e.destinationWidth,n=e.destinationHeight,s=r*n*4,o=new Uint8Array(this.imageBuffer,0,s),a=new Uint8ClampedArray(this.imageBuffer,0,s);t.readPixels(0,0,r,n,t.RGBA,t.UNSIGNED_BYTE,o);var h=new ImageData(a,r,n);i.putImageData(h,0,0)}S.isTouchSupported="ontouchstart"in S.window||"ontouchstart"in S.document||S.window&&S.window.navigator&&S.window.navigator.maxTouchPoints>0,S.isLikelyNode="undefined"!=typeof Buffer&&"undefined"==typeof window,S.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"],S.DPI=96,S.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",S.commaWsp="(?:\\s+,?\\s*|,\\s*)",S.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,S.reNonWord=/[ \n\.,;!\?\-]/,S.fontPaths={},S.iMatrix=[1,0,0,1,0,0],S.svgNS="http://www.w3.org/2000/svg",S.perfLimitSizeTotal=2097152,S.maxCacheSideLimit=4096,S.minCacheSideLimit=256,S.charWidthsCache={},S.textureSize=2048,S.disableStyleCopyPaste=!1,S.enableGLFiltering=!0,S.devicePixelRatio=S.window.devicePixelRatio||S.window.webkitDevicePixelRatio||S.window.mozDevicePixelRatio||1,S.browserShadowBlurConstant=1,S.arcToSegmentsCache={},S.boundsOfCurveCache={},S.cachesBoundsOfCurve=!0,S.forceGLPutImageData=!1,S.initFilterBackend=function(){return S.enableGLFiltering&&S.isWebglSupported&&S.isWebglSupported(S.textureSize)?(console.log("max texture size: "+S.maxTextureSize),new S.WebglFilterBackend({tileSize:S.textureSize})):S.Canvas2dFilterBackend?new S.Canvas2dFilterBackend:void 0},"undefined"!=typeof document&&"undefined"!=typeof window&&(window.fabric=S),function(){function t(t,e){if(this.__eventListeners[t]){var i=this.__eventListeners[t];e?i[i.indexOf(e)]=!1:S.util.array.fill(i,!1)}}function e(t,e){var i=function(){e.apply(this,arguments),this.off(t,i)}.bind(this);this.on(t,i)}S.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var i=this.__eventListeners[t];if(!i)return this;for(var r=0,n=i.length;r<n;r++)i[r]&&i[r].call(this,e||{});return this.__eventListeners[t]=i.filter((function(t){return!1!==t})),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var i in t)this.on(i,t[i]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,i){if(1===arguments.length)for(var r in t)e.call(this,r,t[r]);else e.call(this,t,i);return this},off:function(e,i){if(!this.__eventListeners)return this;if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"==typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,i);return this}}}(),S.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,i){var r=this._objects;return i?r[e]=t:r.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,i=!1,r=0,n=arguments.length;r<n;r++)-1!==(t=e.indexOf(arguments[r]))&&(i=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&i&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var i=this.getObjects(),r=0,n=i.length;r<n;r++)t.call(e,i[r],r,i);return this},getObjects:function(t){return void 0===t?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some((function(e){return"function"==typeof e.contains&&e.contains(t,!0)}))},complexity:function(){return this._objects.reduce((function(t,e){return t+(e.complexity?e.complexity():0)}),0)}},S.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){!t||!t.colorStops||t instanceof S.Gradient||this.set(e,new S.Gradient(t))},_initPattern:function(t,e,i){!t||!t.source||t instanceof S.Pattern?i&&i():this.set(e,new S.Pattern(t,i))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},r=e,n=Math.sqrt,s=Math.atan2,o=Math.pow,a=Math.PI/180,h=Math.PI/2,S.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/h){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/h){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var i=t.indexOf(e);return-1!==i&&t.splice(i,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*a},radiansToDegrees:function(t){return t/a},rotatePoint:function(t,e,i){var r=new S.Point(t.x-e.x,t.y-e.y),n=S.util.rotateVector(r,i);return new S.Point(n.x,n.y).addEquals(e)},rotateVector:function(t,e){var i=S.util.sin(e),r=S.util.cos(e);return{x:t.x*r-t.y*i,y:t.x*i+t.y*r}},createVector:function(t,e){return new S.Point(e.x-t.x,e.y-t.y)},calcAngleBetweenVectors:function(t,e){return Math.acos((t.x*e.x+t.y*e.y)/(Math.hypot(t.x,t.y)*Math.hypot(e.x,e.y)))},getHatVector:function(t){return new S.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,e,i){var r=S.util.createVector(t,e),n=S.util.createVector(t,i),s=S.util.calcAngleBetweenVectors(r,n),o=s*(0===S.util.calcAngleBetweenVectors(S.util.rotateVector(r,s),n)?1:-1)/2;return{vector:S.util.getHatVector(S.util.rotateVector(r,o)),angle:s}},projectStrokeOnPoints:function(t,e,i){var r=[],n=e.strokeWidth/2,s=e.strokeUniform?new S.Point(1/e.scaleX,1/e.scaleY):new S.Point(1,1),o=function(t){var e=n/Math.hypot(t.x,t.y);return new S.Point(t.x*e*s.x,t.y*e*s.y)};return t.length<=1||t.forEach((function(a,h){var l,c,u=new S.Point(a.x,a.y);0===h?(c=t[h+1],l=i?o(S.util.createVector(c,u)).addEquals(u):t[t.length-1]):h===t.length-1?(l=t[h-1],c=i?o(S.util.createVector(l,u)).addEquals(u):t[0]):(l=t[h-1],c=t[h+1]);var d,f,g=S.util.getBisector(u,l,c),m=g.vector,p=g.angle;if("miter"===e.strokeLineJoin&&(d=-n/Math.sin(p/2),f=new S.Point(m.x*d*s.x,m.y*d*s.y),Math.hypot(f.x,f.y)/n<=e.strokeMiterLimit))return r.push(u.add(f)),void r.push(u.subtract(f));d=-n*Math.SQRT2,f=new S.Point(m.x*d*s.x,m.y*d*s.y),r.push(u.add(f)),r.push(u.subtract(f))})),r},transformPoint:function(t,e,i){return i?new S.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new S.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var i=0;i<t.length;i++)t[i]=S.util.transformPoint(t[i],e);var r=[t[0].x,t[1].x,t[2].x,t[3].x],n=S.util.array.min(r),s=S.util.array.max(r)-n,o=[t[0].y,t[1].y,t[2].y,t[3].y],a=S.util.array.min(o);return{left:n,top:a,width:s,height:S.util.array.max(o)-a}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),i=[e*t[3],-e*t[1],-e*t[2],e*t[0]],r=S.util.transformPoint({x:t[4],y:t[5]},i,!0);return i[4]=-r.x,i[5]=-r.y,i},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var i=/\D{0,2}$/.exec(t),r=parseFloat(t);switch(e||(e=S.Text.DEFAULT_SVG_FONT_SIZE),i[0]){case"mm":return r*S.DPI/25.4;case"cm":return r*S.DPI/2.54;case"in":return r*S.DPI;case"pt":return r*S.DPI/72;case"pc":return r*S.DPI/72*12;case"em":return r*e;default:return r}},falseFunction:function(){return!1},getKlass:function(t,e){return t=S.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),S.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"])}return e},resolveNamespace:function(t){if(!t)return S;var e,i=t.split("."),n=i.length,s=r||S.window;for(e=0;e<n;++e)s=s[i[e]];return s},loadImage:function(t,e,i,r){if(t){var n=S.util.createImage(),s=function(){e&&e.call(i,n,!1),n=n.onload=n.onerror=null};n.onload=s,n.onerror=function(){S.log("Error loading "+n.src),e&&e.call(i,null,!0),n=n.onload=n.onerror=null},0!==t.indexOf("data")&&null!=r&&(n.crossOrigin=r),"data:image/svg"===t.substring(0,14)&&(n.onload=null,S.util.loadImageInDom(n,s)),n.src=t}else e&&e.call(i,t)},loadImageInDom:function(t,e){var i=S.document.createElement("div");i.style.width=i.style.height="1px",i.style.left=i.style.top="-100%",i.style.position="absolute",i.appendChild(t),S.document.querySelector("body").appendChild(i),t.onload=function(){e(),i.parentNode.removeChild(i),i=null}},enlivenObjects:function(t,e,i,r){var n=[],s=0,o=(t=t||[]).length;function a(){++s===o&&e&&e(n.filter((function(t){return t})))}o?t.forEach((function(t,e){t&&t.type?S.util.getKlass(t.type,i).fromObject(t,(function(i,s){s||(n[e]=i),r&&r(t,i,s),a()})):a()})):e&&e(n)},enlivenObjectEnlivables:function(t,e,i){var r=S.Object.ENLIVEN_PROPS.filter((function(e){return!!t[e]}));S.util.enlivenObjects(r.map((function(e){return t[e]})),(function(t){var n={};r.forEach((function(i,r){n[i]=t[r],e&&(e[i]=t[r])})),i&&i(n)}))},enlivenPatterns:function(t,e){function i(){++n===s&&e&&e(r)}var r=[],n=0,s=(t=t||[]).length;s?t.forEach((function(t,e){t&&t.source?new S.Pattern(t,(function(t){r[e]=t,i()})):(r[e]=t,i())})):e&&e(r)},groupSVGElements:function(t,e,i){var r;return t&&1===t.length?t[0]:(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),r=new S.Group(t,e),void 0!==i&&(r.sourcePath=i),r)},populateWithProperties:function(t,e,i){if(i&&Array.isArray(i))for(var r=0,n=i.length;r<n;r++)i[r]in t&&(e[i[r]]=t[i[r]])},createCanvasElement:function(){return S.document.createElement("canvas")},copyCanvasElement:function(t){var e=S.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,i){return t.toDataURL("image/"+e,i)},createImage:function(){return S.document.createElement("img")},multiplyTransformMatrices:function(t,e,i){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],i?0:t[0]*e[4]+t[2]*e[5]+t[4],i?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var e=s(t[1],t[0]),i=o(t[0],2)+o(t[1],2),r=n(i),h=(t[0]*t[3]-t[2]*t[1])/r,l=s(t[0]*t[2]+t[1]*t[3],i);return{angle:e/a,scaleX:r,scaleY:h,skewX:l/a,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return S.iMatrix.concat();var e=S.util.degreesToRadians(t.angle),i=S.util.cos(e),r=S.util.sin(e);return[i,r,-r,i,0,0]},calcDimensionsMatrix:function(t){var e=void 0===t.scaleX?1:t.scaleX,i=void 0===t.scaleY?1:t.scaleY,r=[t.flipX?-e:e,0,0,t.flipY?-i:i,0,0],n=S.util.multiplyTransformMatrices,s=S.util.degreesToRadians;return t.skewX&&(r=n(r,[1,0,Math.tan(s(t.skewX)),1],!0)),t.skewY&&(r=n(r,[1,Math.tan(s(t.skewY)),0,1],!0)),r},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],i=S.util.multiplyTransformMatrices;return t.angle&&(e=i(e,S.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=i(e,S.util.calcDimensionsMatrix(t))),e},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,e,i,r){r>0&&(e>r?e-=r:e=0,i>r?i-=r:i=0);var n,s=!0,o=t.getImageData(e,i,2*r||1,2*r||1),a=o.data.length;for(n=3;n<a&&0!=(s=o.data[n]<=0);n+=4);return o=null,s},parsePreserveAspectRatioAttribute:function(t){var e,i="meet",r=t.split(" ");return r&&r.length&&("meet"!==(i=r.pop())&&"slice"!==i?(e=i,i="meet"):r.length&&(e=r.pop())),{meetOrSlice:i,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?S.charWidthsCache[t]&&delete S.charWidthsCache[t]:S.charWidthsCache={}},limitDimsByArea:function(t,e){var i=Math.sqrt(e*t),r=Math.floor(e/i);return{x:Math.floor(i),y:r}},capValue:function(t,e,i){return Math.max(t,Math.min(e,i))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map((function(t){return S.util.toFixed(t,S.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"},removeTransformFromObject:function(t,e){var i=S.util.invertTransform(e),r=S.util.multiplyTransformMatrices(i,t.calcOwnMatrix());S.util.applyTransformToObject(t,r)},addTransformToObject:function(t,e){S.util.applyTransformToObject(t,S.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var i=S.util.qrDecompose(e),r=new S.Point(i.translateX,i.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",i.scaleX),t.set("scaleY",i.scaleY),t.skewX=i.skewX,t.skewY=i.skewY,t.angle=i.angle,t.setPositionByOrigin(r,"center","center")},sizeAfterTransform:function(t,e,i){var r=t/2,n=e/2,s=[{x:-r,y:-n},{x:r,y:-n},{x:-r,y:n},{x:r,y:n}],o=S.util.calcDimensionsMatrix(i),a=S.util.makeBoundingBoxFromPoints(s,o);return{x:a.width,y:a.height}},mergeClipPaths:function(t,e){var i=t,r=e;i.inverted&&!r.inverted&&(i=e,r=t),S.util.applyTransformToObject(r,S.util.multiplyTransformMatrices(S.util.invertTransform(i.calcTransformMatrix()),r.calcTransformMatrix()));var n=i.inverted&&r.inverted;return n&&(i.inverted=r.inverted=!1),new S.Group([i],{clipPath:r,inverted:n})}},function(){var t=Array.prototype.join,e={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i={m:"l",M:"L"};function r(t,e,i,r,n,s,o,a,h,l,c){var u=S.util.cos(t),d=S.util.sin(t),f=S.util.cos(e),g=S.util.sin(e),m=i*n*f-r*s*g+o,p=r*n*f+i*s*g+a;return["C",l+h*(-i*n*d-r*s*u),c+h*(-r*n*d+i*s*u),m+h*(i*n*g+r*s*f),p+h*(r*n*g-i*s*f),m,p]}function n(t,e,i,r){var n=Math.atan2(e,t),s=Math.atan2(r,i);return s>=n?s-n:2*Math.PI-(n-s)}function s(t,e,i){for(var s=i[1],o=i[2],a=i[3],h=i[4],l=i[5],c=function(t,e,i,s,o,a,h){var l=Math.PI,c=h*l/180,u=S.util.sin(c),d=S.util.cos(c),f=0,g=0,m=-d*t*.5-u*e*.5,p=-d*e*.5+u*t*.5,v=(i=Math.abs(i))*i,y=(s=Math.abs(s))*s,_=p*p,w=m*m,b=v*y-v*_-y*w,x=0;if(b<0){var C=Math.sqrt(1-b/(v*y));i*=C,s*=C}else x=(o===a?-1:1)*Math.sqrt(b/(v*_+y*w));var T=x*i*p/s,E=-x*s*m/i,O=d*T-u*E+.5*t,A=u*T+d*E+.5*e,I=n(1,0,(m-T)/i,(p-E)/s),L=n((m-T)/i,(p-E)/s,(-m-T)/i,(-p-E)/s);0===a&&L>0?L-=2*l:1===a&&L<0&&(L+=2*l);for(var D=Math.ceil(Math.abs(L/l*2)),M=[],F=L/D,P=8/3*Math.sin(F/4)*Math.sin(F/4)/Math.sin(F/2),k=I+F,R=0;R<D;R++)M[R]=r(I,k,d,u,i,s,O,A,P,f,g),f=M[R][5],g=M[R][6],I=k,k+=F;return M}(i[6]-t,i[7]-e,s,o,h,l,a),u=0,d=c.length;u<d;u++)c[u][1]+=t,c[u][2]+=e,c[u][3]+=t,c[u][4]+=e,c[u][5]+=t,c[u][6]+=e;return c}function o(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}function a(t,e,i,r,n,s,o,a){return function(h){var l,c=(l=h)*l*l,u=function(t){return 3*t*t*(1-t)}(h),d=function(t){return 3*t*(1-t)*(1-t)}(h),f=function(t){return(1-t)*(1-t)*(1-t)}(h);return{x:o*c+n*u+i*d+t*f,y:a*c+s*u+r*d+e*f}}}function h(t,e,i,r,n,s,o,a){return function(h){var l=1-h,c=3*l*l*(i-t)+6*l*h*(n-i)+3*h*h*(o-n),u=3*l*l*(r-e)+6*l*h*(s-r)+3*h*h*(a-s);return Math.atan2(u,c)}}function l(t,e,i,r,n,s){return function(o){var a,h=(a=o)*a,l=function(t){return 2*t*(1-t)}(o),c=function(t){return(1-t)*(1-t)}(o);return{x:n*h+i*l+t*c,y:s*h+r*l+e*c}}}function c(t,e,i,r,n,s){return function(o){var a=1-o,h=2*a*(i-t)+2*o*(n-i),l=2*a*(r-e)+2*o*(s-r);return Math.atan2(l,h)}}function u(t,e,i){var r,n,s={x:e,y:i},a=0;for(n=1;n<=100;n+=1)r=t(n/100),a+=o(s.x,s.y,r.x,r.y),s=r;return a}function d(t){for(var e,i,r,n,s=0,d=t.length,f=0,g=0,m=0,p=0,v=[],y=0;y<d;y++){switch(r={x:f,y:g,command:(e=t[y])[0]},e[0]){case"M":r.length=0,m=f=e[1],p=g=e[2];break;case"L":r.length=o(f,g,e[1],e[2]),f=e[1],g=e[2];break;case"C":i=a(f,g,e[1],e[2],e[3],e[4],e[5],e[6]),n=h(f,g,e[1],e[2],e[3],e[4],e[5],e[6]),r.iterator=i,r.angleFinder=n,r.length=u(i,f,g),f=e[5],g=e[6];break;case"Q":i=l(f,g,e[1],e[2],e[3],e[4]),n=c(f,g,e[1],e[2],e[3],e[4]),r.iterator=i,r.angleFinder=n,r.length=u(i,f,g),f=e[3],g=e[4];break;case"Z":case"z":r.destX=m,r.destY=p,r.length=o(f,g,m,p),f=m,g=p}s+=r.length,v.push(r)}return v.push({length:s,x:f,y:g}),v}S.util.joinPath=function(t){return t.map((function(t){return t.join(" ")})).join(" ")},S.util.parsePath=function(t){var r,n,s,o,a,h=[],l=[],c=S.rePathCommand,u="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",d="("+u+")"+S.commaWsp,f="([01])"+S.commaWsp+"?",g=new RegExp(d+"?"+d+"?"+d+f+f+d+"?("+u+")","g");if(!t||!t.match)return h;for(var m,p=0,v=(a=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;p<v;p++){o=(r=a[p]).slice(1).trim(),l.length=0;var y=r.charAt(0);if(m=[y],"a"===y.toLowerCase())for(var _;_=g.exec(o);)for(var w=1;w<_.length;w++)l.push(_[w]);else for(;s=c.exec(o);)l.push(s[0]);w=0;for(var b=l.length;w<b;w++)n=parseFloat(l[w]),isNaN(n)||m.push(n);var x=e[y.toLowerCase()],C=i[y]||y;if(m.length-1>x)for(var T=1,E=m.length;T<E;T+=x)h.push([y].concat(m.slice(T,T+x))),y=C;else h.push(m)}return h},S.util.makePathSimpler=function(t){var e,i,r,n,o,a,h=0,l=0,c=t.length,u=0,d=0,f=[];for(i=0;i<c;++i){switch(r=!1,(e=t[i].slice(0))[0]){case"l":e[0]="L",e[1]+=h,e[2]+=l;case"L":h=e[1],l=e[2];break;case"h":e[1]+=h;case"H":e[0]="L",e[2]=l,h=e[1];break;case"v":e[1]+=l;case"V":e[0]="L",l=e[1],e[1]=h,e[2]=l;break;case"m":e[0]="M",e[1]+=h,e[2]+=l;case"M":h=e[1],l=e[2],u=e[1],d=e[2];break;case"c":e[0]="C",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l,e[5]+=h,e[6]+=l;case"C":o=e[3],a=e[4],h=e[5],l=e[6];break;case"s":e[0]="S",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l;case"S":"C"===n?(o=2*h-o,a=2*l-a):(o=h,a=l),h=e[3],l=e[4],e[0]="C",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=o,e[2]=a,o=e[3],a=e[4];break;case"q":e[0]="Q",e[1]+=h,e[2]+=l,e[3]+=h,e[4]+=l;case"Q":o=e[1],a=e[2],h=e[3],l=e[4];break;case"t":e[0]="T",e[1]+=h,e[2]+=l;case"T":"Q"===n?(o=2*h-o,a=2*l-a):(o=h,a=l),e[0]="Q",h=e[1],l=e[2],e[1]=o,e[2]=a,e[3]=h,e[4]=l;break;case"a":e[0]="A",e[6]+=h,e[7]+=l;case"A":r=!0,f=f.concat(s(h,l,e)),h=e[6],l=e[7];break;case"z":case"Z":h=u,l=d}r||f.push(e),n=e[0]}return f},S.util.getSmoothPathFromPoints=function(t,e){var i,r=[],n=new S.Point(t[0].x,t[0].y),s=new S.Point(t[1].x,t[1].y),o=t.length,a=1,h=0,l=o>2;for(e=e||0,l&&(a=t[2].x<s.x?-1:t[2].x===s.x?0:1,h=t[2].y<s.y?-1:t[2].y===s.y?0:1),r.push(["M",n.x-a*e,n.y-h*e]),i=1;i<o;i++){if(!n.eq(s)){var c=n.midPointFrom(s);r.push(["Q",n.x,n.y,c.x,c.y])}n=t[i],i+1<t.length&&(s=t[i+1])}return l&&(a=n.x>t[i-2].x?1:n.x===t[i-2].x?0:-1,h=n.y>t[i-2].y?1:n.y===t[i-2].y?0:-1),r.push(["L",n.x+a*e,n.y+h*e]),r},S.util.getPathSegmentsInfo=d,S.util.getBoundsOfCurve=function(e,i,r,n,s,o,a,h){var l;if(S.cachesBoundsOfCurve&&(l=t.call(arguments),S.boundsOfCurveCache[l]))return S.boundsOfCurveCache[l];var c,u,d,f,g,m,p,v,y=Math.sqrt,_=Math.min,w=Math.max,b=Math.abs,x=[],C=[[],[]];u=6*e-12*r+6*s,c=-3*e+9*r-9*s+3*a,d=3*r-3*e;for(var T=0;T<2;++T)if(T>0&&(u=6*i-12*n+6*o,c=-3*i+9*n-9*o+3*h,d=3*n-3*i),b(c)<1e-12){if(b(u)<1e-12)continue;0<(f=-d/u)&&f<1&&x.push(f)}else(p=u*u-4*d*c)<0||(0<(g=(-u+(v=y(p)))/(2*c))&&g<1&&x.push(g),0<(m=(-u-v)/(2*c))&&m<1&&x.push(m));for(var E,O,A,I=x.length,L=I;I--;)E=(A=1-(f=x[I]))*A*A*e+3*A*A*f*r+3*A*f*f*s+f*f*f*a,C[0][I]=E,O=A*A*A*i+3*A*A*f*n+3*A*f*f*o+f*f*f*h,C[1][I]=O;C[0][L]=e,C[1][L]=i,C[0][L+1]=a,C[1][L+1]=h;var D=[{x:_.apply(null,C[0]),y:_.apply(null,C[1])},{x:w.apply(null,C[0]),y:w.apply(null,C[1])}];return S.cachesBoundsOfCurve&&(S.boundsOfCurveCache[l]=D),D},S.util.getPointOnPath=function(t,e,i){i||(i=d(t));for(var r=0;e-i[r].length>0&&r<i.length-2;)e-=i[r].length,r++;var n,s=i[r],a=e/s.length,h=s.command,l=t[r];switch(h){case"M":return{x:s.x,y:s.y,angle:0};case"Z":case"z":return(n=new S.Point(s.x,s.y).lerp(new S.Point(s.destX,s.destY),a)).angle=Math.atan2(s.destY-s.y,s.destX-s.x),n;case"L":return(n=new S.Point(s.x,s.y).lerp(new S.Point(l[1],l[2]),a)).angle=Math.atan2(l[2]-s.y,l[1]-s.x),n;case"C":case"Q":return function(t,e){for(var i,r,n,s=0,a=0,h=t.iterator,l={x:t.x,y:t.y},c=.01,u=t.angleFinder;a<e&&c>1e-4;)i=h(s),n=s,(r=o(l.x,l.y,i.x,i.y))+a>e?(s-=c,c/=2):(l=i,s+=c,a+=r);return i.angle=u(n),i}(s,e)}},S.util.transformPath=function(t,e,i){return i&&(e=S.util.multiplyTransformMatrices(e,[1,0,0,1,-i.x,-i.y])),t.map((function(t){for(var i=t.slice(0),r={},n=1;n<t.length-1;n+=2)r.x=t[n],r.y=t[n+1],r=S.util.transformPoint(r,e),i[n]=r.x,i[n+1]=r.y;return i}))}}(),function(){var t=Array.prototype.slice;function e(t,e,i){if(t&&0!==t.length){var r=t.length-1,n=e?t[r][e]:t[r];if(e)for(;r--;)i(t[r][e],n)&&(n=t[r][e]);else for(;r--;)i(t[r],n)&&(n=t[r]);return n}}S.util.array={fill:function(t,e){for(var i=t.length;i--;)t[i]=e;return t},invoke:function(e,i){for(var r=t.call(arguments,2),n=[],s=0,o=e.length;s<o;s++)n[s]=r.length?e[s][i].apply(e[s],r):e[s][i].call(e[s]);return n},min:function(t,i){return e(t,i,(function(t,e){return t<e}))},max:function(t,i){return e(t,i,(function(t,e){return t>=e}))}}}(),function(){function t(e,i,r){if(r)if(!S.isLikelyNode&&i instanceof Element)e=i;else if(i instanceof Array){e=[];for(var n=0,s=i.length;n<s;n++)e[n]=t({},i[n],r)}else if(i&&"object"==typeof i)for(var o in i)"canvas"===o||"group"===o?e[o]=null:i.hasOwnProperty(o)&&(e[o]=t({},i[o],r));else e=i;else for(var o in i)e[o]=i[o];return e}S.util.object={extend:t,clone:function(e,i){return t({},e,i)}},S.util.object.extend(S.util,S.Observable)}(),function(){function t(t,e){var i=t.charCodeAt(e);if(isNaN(i))return"";if(i<55296||i>57343)return t.charAt(e);if(55296<=i&&i<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var r=t.charCodeAt(e+1);if(56320>r||r>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var n=t.charCodeAt(e-1);if(55296>n||n>56319)throw"Low surrogate without preceding high surrogate";return!1}S.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(e){var i,r=0,n=[];for(r=0;r<e.length;r++)!1!==(i=t(e,r))&&n.push(i);return n}}}(),function(){var t=Array.prototype.slice,e=function(){},i=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),r=function(t,e,r){for(var n in e)n in t.prototype&&"function"==typeof t.prototype[n]&&(e[n]+"").indexOf("callSuper")>-1?t.prototype[n]=function(t){return function(){var i=this.constructor.superclass;this.constructor.superclass=r;var n=e[t].apply(this,arguments);if(this.constructor.superclass=i,"initialize"!==t)return n}}(n):t.prototype[n]=e[n],i&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function n(){}function s(e){for(var i=null,r=this;r.constructor.superclass;){var n=r.constructor.superclass.prototype[e];if(r[e]!==n){i=n;break}r=r.constructor.superclass.prototype}return i?arguments.length>1?i.apply(this,t.call(arguments,1)):i.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}S.util.createClass=function(){var i=null,o=t.call(arguments,0);function a(){this.initialize.apply(this,arguments)}"function"==typeof o[0]&&(i=o.shift()),a.superclass=i,a.subclasses=[],i&&(n.prototype=i.prototype,a.prototype=new n,i.subclasses.push(a));for(var h=0,l=o.length;h<l;h++)r(a,o[h],i);return a.prototype.initialize||(a.prototype.initialize=e),a.prototype.constructor=a,a.prototype.callSuper=s,a}}(),l=!!S.document.createElement("div").attachEvent,c=["touchstart","touchmove","touchend"],S.util.addListener=function(t,e,i,r){t&&t.addEventListener(e,i,!l&&r)},S.util.removeListener=function(t,e,i,r){t&&t.removeEventListener(e,i,!l&&r)},S.util.getPointer=function(t){var e=t.target,i=S.util.getScrollLeftTop(e),r=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:r.clientX+i.left,y:r.clientY+i.top}},S.util.isTouchEvent=function(t){return c.indexOf(t.type)>-1||"touch"===t.pointerType},d="string"==typeof(u=S.document.createElement("div")).style.opacity,f="string"==typeof u.style.filter,g=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,m=function(t){return t},d?m=function(t,e){return t.style.opacity=e,t}:f&&(m=function(t,e){var i=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(i.zoom=1),g.test(i.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",i.filter=i.filter.replace(g,e)):i.filter+=" alpha(opacity="+100*e+")",t}),S.util.setStyle=function(t,e){var i=t.style;if(!i)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?m(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e)"opacity"===r?m(t,e[r]):i["float"===r||"cssFloat"===r?void 0===i.styleFloat?"cssFloat":"styleFloat":r]=e[r];return t},function(){var t,e,i,r,n=Array.prototype.slice,s=function(t){return n.call(t,0)};try{t=s(S.document.childNodes)instanceof Array}catch(t){}function o(t,e){var i=S.document.createElement(t);for(var r in e)"class"===r?i.className=e[r]:"for"===r?i.htmlFor=e[r]:i.setAttribute(r,e[r]);return i}function a(t){for(var e=0,i=0,r=S.document.documentElement,n=S.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===S.document?(e=n.scrollLeft||r.scrollLeft||0,i=n.scrollTop||r.scrollTop||0):(e+=t.scrollLeft||0,i+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:i}}t||(s=function(t){for(var e=new Array(t.length),i=t.length;i--;)e[i]=t[i];return e}),e=S.document.defaultView&&S.document.defaultView.getComputedStyle?function(t,e){var i=S.document.defaultView.getComputedStyle(t,null);return i?i[e]:void 0}:function(t,e){var i=t.style[e];return!i&&t.currentStyle&&(i=t.currentStyle[e]),i},i=S.document.documentElement.style,r="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",S.util.makeElementUnselectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=S.util.falseFunction),r?t.style[r]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},S.util.makeElementSelectable=function(t){return void 0!==t.onselectstart&&(t.onselectstart=null),r?t.style[r]="":"string"==typeof t.unselectable&&(t.unselectable=""),t},S.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},S.util.getById=function(t){return"string"==typeof t?S.document.getElementById(t):t},S.util.toArray=s,S.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},S.util.makeElement=o,S.util.wrapElement=function(t,e,i){return"string"==typeof e&&(e=o(e,i)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},S.util.getScrollLeftTop=a,S.util.getElementOffset=function(t){var i,r,n=t&&t.ownerDocument,s={left:0,top:0},o={left:0,top:0},h={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!n)return o;for(var l in h)o[h[l]]+=parseInt(e(t,l),10)||0;return i=n.documentElement,void 0!==t.getBoundingClientRect&&(s=t.getBoundingClientRect()),r=a(t),{left:s.left+r.left-(i.clientLeft||0)+o.left,top:s.top+r.top-(i.clientTop||0)+o.top}},S.util.getNodeCanvas=function(t){var e=S.jsdomImplForWrapper(t);return e._canvas||e._image},S.util.cleanUpJsdomNode=function(t){if(S.isLikelyNode){var e=S.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}S.util.request=function(e,i){i||(i={});var r=i.method?i.method.toUpperCase():"GET",n=i.onComplete||function(){},s=new S.window.XMLHttpRequest,o=i.body||i.parameters;return s.onreadystatechange=function(){4===s.readyState&&(n(s),s.onreadystatechange=t)},"GET"===r&&(o=null,"string"==typeof i.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,i.parameters))),s.open(r,e,!0),"POST"!==r&&"PUT"!==r||s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(o),s}}(),S.log=console.log,S.warn=console.warn,function(){var t=S.util.object.extend,e=S.util.object.clone,i=[];function r(){return!1}function n(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e}S.util.object.extend(i,{cancelAll:function(){var t=this.splice(0);return t.forEach((function(t){t.cancel()})),t},cancelByCanvas:function(t){if(!t)return[];var e=this.filter((function(e){return"object"==typeof e.target&&e.target.canvas===t}));return e.forEach((function(t){t.cancel()})),e},cancelByTarget:function(t){var e=this.findAnimationsByTarget(t);return e.forEach((function(t){t.cancel()})),e},findAnimationIndex:function(t){return this.indexOf(this.findAnimation(t))},findAnimation:function(t){return this.find((function(e){return e.cancel===t}))},findAnimationsByTarget:function(t){return t?this.filter((function(e){return e.target===t})):[]}});var s=S.window.requestAnimationFrame||S.window.webkitRequestAnimationFrame||S.window.mozRequestAnimationFrame||S.window.oRequestAnimationFrame||S.window.msRequestAnimationFrame||function(t){return S.window.setTimeout(t,1e3/60)},o=S.window.cancelAnimationFrame||S.window.clearTimeout;function a(){return s.apply(S.window,arguments)}S.util.animate=function(i){i||(i={});var s,o=!1,h=function(){var t=S.runningAnimations.indexOf(s);return t>-1&&S.runningAnimations.splice(t,1)[0]};return s=t(e(i),{cancel:function(){return o=!0,h()},currentValue:"startValue"in i?i.startValue:0,completionRate:0,durationRate:0}),S.runningAnimations.push(s),a((function(t){var e,l=t||+new Date,c=i.duration||500,u=l+c,d=i.onChange||r,f=i.abort||r,g=i.onComplete||r,m=i.easing||n,p="startValue"in i&&i.startValue.length>0,v="startValue"in i?i.startValue:0,y="endValue"in i?i.endValue:100,_=i.byValue||(p?v.map((function(t,e){return y[e]-v[e]})):y-v);i.onStart&&i.onStart(),function t(i){var r=(e=i||+new Date)>u?c:e-l,n=r/c,w=p?v.map((function(t,e){return m(r,v[e],_[e],c)})):m(r,v,_,c),b=p?Math.abs((w[0]-v[0])/_[0]):Math.abs((w-v)/_);if(s.currentValue=p?w.slice():w,s.completionRate=b,s.durationRate=n,!o){if(!f(w,b,n))return e>u?(s.currentValue=p?y.slice():y,s.completionRate=1,s.durationRate=1,d(p?y.slice():y,1,1),g(y,1,1),void h()):(d(w,b,n),void a(t));h()}}(l)})),s.cancel},S.util.requestAnimFrame=a,S.util.cancelAnimFrame=function(){return o.apply(S.window,arguments)},S.runningAnimations=i}(),function(){function t(t,e,i){var r="rgba("+parseInt(t[0]+i*(e[0]-t[0]),10)+","+parseInt(t[1]+i*(e[1]-t[1]),10)+","+parseInt(t[2]+i*(e[2]-t[2]),10);return(r+=","+(t&&e?parseFloat(t[3]+i*(e[3]-t[3])):1))+")"}S.util.animateColor=function(e,i,r,n){var s=new S.Color(e).getSource(),o=new S.Color(i).getSource(),a=n.onComplete,h=n.onChange;return n=n||{},S.util.animate(S.util.object.extend(n,{duration:r||500,startValue:s,endValue:o,byValue:o,easing:function(e,i,r,s){return t(i,r,n.colorEasing?n.colorEasing(e,s):1-Math.cos(e/s*(Math.PI/2)))},onComplete:function(e,i,r){if(a)return a(t(o,o,0),i,r)},onChange:function(e,i,r){if(h){if(Array.isArray(e))return h(t(e,e,0),i,r);h(e,i,r)}}}))}}(),function(){function t(t,e,i,r){return t<Math.abs(e)?(t=e,r=i/4):r=0===e&&0===t?i/(2*Math.PI)*Math.asin(1):i/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:i,s:r}}function e(t,e,i){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*i-t.s)*(2*Math.PI)/t.p)}function i(t,e,i,n){return i-r(n-t,0,i,n)+e}function r(t,e,i,r){return(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e}S.util.ease={easeInQuad:function(t,e,i,r){return i*(t/=r)*t+e},easeOutQuad:function(t,e,i,r){return-i*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,r){return i*(t/=r)*t*t+e},easeOutCubic:function(t,e,i,r){return i*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,i,r){return i*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,i,r){return-i*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,i,r){return i*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,i,r){return i*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,r){return(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,i,r){return-i*Math.cos(t/r*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,r){return i*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,i,r){return-i/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,i,r){return 0===t?e:i*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,i,r){return t===r?e+i:i*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,i,r){return 0===t?e:t===r?e+i:(t/=r/2)<1?i/2*Math.pow(2,10*(t-1))+e:i/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,i,r){return-i*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,i,r){return i*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,i,r){return(t/=r/2)<1?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(i,r,n,s){var o=0;return 0===i?r:1==(i/=s)?r+n:(o||(o=.3*s),-e(t(n,n,o,1.70158),i,s)+r)},easeOutElastic:function(e,i,r,n){var s=0;if(0===e)return i;if(1==(e/=n))return i+r;s||(s=.3*n);var o=t(r,r,s,1.70158);return o.a*Math.pow(2,-10*e)*Math.sin((e*n-o.s)*(2*Math.PI)/o.p)+o.c+i},easeInOutElastic:function(i,r,n,s){var o=0;if(0===i)return r;if(2==(i/=s/2))return r+n;o||(o=s*(.3*1.5));var a=t(n,n,o,1.70158);return i<1?-.5*e(a,i,s)+r:a.a*Math.pow(2,-10*(i-=1))*Math.sin((i*s-a.s)*(2*Math.PI)/a.p)*.5+a.c+r},easeInBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*(t/=r)*t*((n+1)*t-n)+e},easeOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),i*((t=t/r-1)*t*((n+1)*t+n)+1)+e},easeInOutBack:function(t,e,i,r,n){return void 0===n&&(n=1.70158),(t/=r/2)<1?i/2*(t*t*((1+(n*=1.525))*t-n))+e:i/2*((t-=2)*t*((1+(n*=1.525))*t+n)+2)+e},easeInBounce:i,easeOutBounce:r,easeInOutBounce:function(t,e,n,s){return t<s/2?.5*i(2*t,0,n,s)+e:.5*r(2*t-s,0,n,s)+.5*n+e}}}(),function(t){var e=t.fabric||(t.fabric={}),i=e.util.object.extend,r=e.util.object.clone,n=e.util.toFixed,s=e.util.parseUnit,o=e.util.multiplyTransformMatrices,a={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"},h={stroke:"strokeOpacity",fill:"fillOpacity"},l="font-size",c="clip-path";function u(t){return t in a?a[t]:t}function d(t,i,r,n){var a,h=Array.isArray(i);if("fill"!==t&&"stroke"!==t||"none"!==i){if("strokeUniform"===t)return"non-scaling-stroke"===i;if("strokeDashArray"===t)i="none"===i?null:i.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)i=r&&r.transformMatrix?o(r.transformMatrix,e.parseTransformAttribute(i)):e.parseTransformAttribute(i);else if("visible"===t)i="none"!==i&&"hidden"!==i,r&&!1===r.visible&&(i=!1);else if("opacity"===t)i=parseFloat(i),r&&void 0!==r.opacity&&(i*=r.opacity);else if("textAnchor"===t)i="start"===i?"left":"end"===i?"right":"center";else if("charSpacing"===t)a=s(i,n)/n*1e3;else if("paintFirst"===t){var l=i.indexOf("fill"),c=i.indexOf("stroke");i="fill",(l>-1&&c>-1&&c<l||-1===l&&c>-1)&&(i="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return i;if("imageSmoothing"===t)return"optimizeQuality"===i;a=h?i.map(s):s(i,n)}}else i="";return!h&&isNaN(a)?i:a}function f(t){return new RegExp("^("+t.join("|")+")\\b","i")}function g(t,e){var i,r,n,s,o=[];for(n=0,s=e.length;n<s;n++)i=e[n],r=t.getElementsByTagName(i),o=o.concat(Array.prototype.slice.call(r));return o}function m(t,e){var i,r=!0;return(i=p(t,e.pop()))&&e.length&&(r=function(t,e){for(var i,r=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)r&&(i=e.pop()),r=p(t=t.parentNode,i);return 0===e.length}(t,e)),i&&r&&0===e.length}function p(t,e){var i,r,n=t.nodeName,s=t.getAttribute("class"),o=t.getAttribute("id");if(i=new RegExp("^"+n,"i"),e=e.replace(i,""),o&&e.length&&(i=new RegExp("#"+o+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"")),s&&e.length)for(r=(s=s.split(" ")).length;r--;)i=new RegExp("\\."+s[r]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(i,"");return 0===e.length}function v(t,e){var i;if(t.getElementById&&(i=t.getElementById(e)),i)return i;var r,n,s,o=t.getElementsByTagName("*");for(n=0,s=o.length;n<s;n++)if(e===(r=o[n]).getAttribute("id"))return r}e.svgValidTagNamesRegEx=f(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=f(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=f(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=f(["symbol","g","a","svg","clipPath","defs"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,i,r){t[r]=Math.tan(e.util.degreesToRadians(i[0]))}var i=e.iMatrix,r=e.reNum,n=e.commaWsp,s="(?:(?:(matrix)\\s*\\(\\s*("+r+")"+n+"("+r+")"+n+"("+r+")"+n+"("+r+")"+n+"("+r+")"+n+"("+r+")\\s*\\))|(?:(translate)\\s*\\(\\s*("+r+")(?:"+n+"("+r+"))?\\s*\\))|(?:(scale)\\s*\\(\\s*("+r+")(?:"+n+"("+r+"))?\\s*\\))|(?:(rotate)\\s*\\(\\s*("+r+")(?:"+n+"("+r+")"+n+"("+r+"))?\\s*\\))|(?:(skewX)\\s*\\(\\s*("+r+")\\s*\\))|(?:(skewY)\\s*\\(\\s*("+r+")\\s*\\)))",o=new RegExp("^\\s*(?:(?:"+s+"(?:"+n+"*"+s+")*)?)\\s*$"),a=new RegExp(s,"g");return function(r){var n=i.concat(),h=[];if(!r||r&&!o.test(r))return n;r.replace(a,(function(r){var o=new RegExp(s).exec(r).filter((function(t){return!!t})),a=o[1],l=o.slice(2).map(parseFloat);switch(a){case"translate":!function(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}(n,l);break;case"rotate":l[0]=e.util.degreesToRadians(l[0]),function(t,i){var r=e.util.cos(i[0]),n=e.util.sin(i[0]),s=0,o=0;3===i.length&&(s=i[1],o=i[2]),t[0]=r,t[1]=n,t[2]=-n,t[3]=r,t[4]=s-(r*s-n*o),t[5]=o-(n*s+r*o)}(n,l);break;case"scale":!function(t,e){var i=e[0],r=2===e.length?e[1]:e[0];t[0]=i,t[3]=r}(n,l);break;case"skewX":t(n,l,2);break;case"skewY":t(n,l,1);break;case"matrix":n=l}h.push(n.concat()),n=i.concat()}));for(var l=h[0];h.length>1;)h.shift(),l=e.util.multiplyTransformMatrices(l,h[0]);return l}}();var y=new RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");function _(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var i,r,n,o,a,h,l=t.getAttribute("viewBox"),c=1,u=1,d=t.getAttribute("width"),f=t.getAttribute("height"),g=t.getAttribute("x")||0,m=t.getAttribute("y")||0,p=t.getAttribute("preserveAspectRatio")||"",v=!l||!(l=l.match(y)),_=!d||!f||"100%"===d||"100%"===f,w=v&&_,b={},x="",C=0,S=0;if(b.width=0,b.height=0,b.toBeParsed=w,v&&(g||m)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(x=" translate("+s(g)+" "+s(m)+") ",a=(t.getAttribute("transform")||"")+x,t.setAttribute("transform",a),t.removeAttribute("x"),t.removeAttribute("y")),w)return b;if(v)return b.width=s(d),b.height=s(f),b;if(i=-parseFloat(l[1]),r=-parseFloat(l[2]),n=parseFloat(l[3]),o=parseFloat(l[4]),b.minX=i,b.minY=r,b.viewBoxWidth=n,b.viewBoxHeight=o,_?(b.width=n,b.height=o):(b.width=s(d),b.height=s(f),c=b.width/n,u=b.height/o),"none"!==(p=e.util.parsePreserveAspectRatioAttribute(p)).alignX&&("meet"===p.meetOrSlice&&(u=c=c>u?u:c),"slice"===p.meetOrSlice&&(u=c=c>u?c:u),C=b.width-n*c,S=b.height-o*c,"Mid"===p.alignX&&(C/=2),"Mid"===p.alignY&&(S/=2),"Min"===p.alignX&&(C=0),"Min"===p.alignY&&(S=0)),1===c&&1===u&&0===i&&0===r&&0===g&&0===m)return b;if((g||m)&&"#document"!==t.parentNode.nodeName&&(x=" translate("+s(g)+" "+s(m)+") "),a=x+" matrix("+c+" 0 0 "+u+" "+(i*c+C)+" "+(r*u+S)+") ","svg"===t.nodeName){for(h=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)h.appendChild(t.firstChild);t.appendChild(h)}else(h=t).removeAttribute("x"),h.removeAttribute("y"),a=h.getAttribute("transform")+a;return h.setAttribute("transform",a),b}function w(t,e){var i="xlink:href",r=v(t,e.getAttribute(i).slice(1));if(r&&r.getAttribute(i)&&w(t,r),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach((function(t){r&&!e.hasAttribute(t)&&r.hasAttribute(t)&&e.setAttribute(t,r.getAttribute(t))})),!e.children.length)for(var n=r.cloneNode(!0);n.firstChild;)e.appendChild(n.firstChild);e.removeAttribute(i)}e.parseSVGDocument=function(t,i,n,s){if(t){!function(t){for(var i=g(t,["use","svg:use"]),r=0;i.length&&r<i.length;){var n=i[r],s=n.getAttribute("xlink:href")||n.getAttribute("href");if(null===s)return;var o,a,h,l,c=s.slice(1),u=n.getAttribute("x")||0,d=n.getAttribute("y")||0,f=v(t,c).cloneNode(!0),m=(f.getAttribute("transform")||"")+" translate("+u+", "+d+")",p=i.length,y=e.svgNS;if(_(f),/^svg$/i.test(f.nodeName)){var w=f.ownerDocument.createElementNS(y,"g");for(a=0,l=(h=f.attributes).length;a<l;a++)o=h.item(a),w.setAttributeNS(y,o.nodeName,o.nodeValue);for(;f.firstChild;)w.appendChild(f.firstChild);f=w}for(a=0,l=(h=n.attributes).length;a<l;a++)"x"!==(o=h.item(a)).nodeName&&"y"!==o.nodeName&&"xlink:href"!==o.nodeName&&"href"!==o.nodeName&&("transform"===o.nodeName?m=o.nodeValue+" "+m:f.setAttribute(o.nodeName,o.nodeValue));f.setAttribute("transform",m),f.setAttribute("instantiated_by_use","1"),f.removeAttribute("id"),n.parentNode.replaceChild(f,n),i.length===p&&r++}}(t);var o,a,h=e.Object.__uid++,l=_(t),c=e.util.toArray(t.getElementsByTagName("*"));if(l.crossOrigin=s&&s.crossOrigin,l.svgUid=h,0===c.length&&e.isLikelyNode){var u=[];for(o=0,a=(c=t.selectNodes('//*[name(.)!="svg"]')).length;o<a;o++)u[o]=c[o];c=u}var d=c.filter((function(t){return _(t),e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))&&!function(t,e){for(;t&&(t=t.parentNode);)if(t.nodeName&&e.test(t.nodeName.replace("svg:",""))&&!t.getAttribute("instantiated_by_use"))return!0;return!1}(t,e.svgInvalidAncestorsRegEx)}));if(!d||d&&!d.length)i&&i([],{});else{var f={};c.filter((function(t){return"clipPath"===t.nodeName.replace("svg:","")})).forEach((function(t){var i=t.getAttribute("id");f[i]=e.util.toArray(t.getElementsByTagName("*")).filter((function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))}))})),e.gradientDefs[h]=e.getGradientDefs(t),e.cssRules[h]=e.getCSSRules(t),e.clipPaths[h]=f,e.parseElements(d,(function(t,r){i&&(i(t,l,r,c),delete e.gradientDefs[h],delete e.cssRules[h],delete e.clipPaths[h])}),r(l),n,s)}}};var b=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+e.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+e.reNum+"))?\\s+(.*)");i(e,{parseFontDeclaration:function(t,e){var i=t.match(b);if(i){var r=i[1],n=i[3],o=i[4],a=i[5],h=i[6];r&&(e.fontStyle=r),n&&(e.fontWeight=isNaN(parseFloat(n))?n:parseFloat(n)),o&&(e.fontSize=s(o)),h&&(e.fontFamily=h),a&&(e.lineHeight="normal"===a?1:a)}},getGradientDefs:function(t){var e,i=g(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),r=0,n={};for(r=i.length;r--;)(e=i[r]).getAttribute("xlink:href")&&w(t,e),n[e.getAttribute("id")]=e;return n},parseAttributes:function(t,r,o){if(t){var a,f,g,p={};void 0===o&&(o=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(p=e.parseAttributes(t.parentNode,r,o));var v=r.reduce((function(e,i){return(a=t.getAttribute(i))&&(e[i]=a),e}),{}),y=i(function(t,i){var r={};for(var n in e.cssRules[i])if(m(t,n.split(" ")))for(var s in e.cssRules[i][n])r[s]=e.cssRules[i][n][s];return r}(t,o),e.parseStyleAttribute(t));v=i(v,y),y[c]&&t.setAttribute(c,y[c]),f=g=p.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,v[l]&&(v[l]=f=s(v[l],g));var _,w,b={};for(var x in v)w=d(_=u(x),v[x],p,f),b[_]=w;b&&b.font&&e.parseFontDeclaration(b.font,b);var C=i(p,b);return e.svgValidParentsRegEx.test(t.nodeName)?C:function(t){for(var i in h)if(void 0!==t[h[i]]&&""!==t[i]){if(void 0===t[i]){if(!e.Object.prototype[i])continue;t[i]=e.Object.prototype[i]}if(0!==t[i].indexOf("url(")){var r=new e.Color(t[i]);t[i]=r.setAlpha(n(r.getAlpha()*t[h[i]],2)).toRgba()}}return t}(C)}},parseElements:function(t,i,r,n,s){new e.ElementsParser(t,i,r,n,s).parse()},parseStyleAttribute:function(t){var e={},i=t.getAttribute("style");return i?("string"==typeof i?function(t,e){var i,r;t.replace(/;\s*$/,"").split(";").forEach((function(t){var n=t.split(":");i=n[0].trim().toLowerCase(),r=n[1].trim(),e[i]=r}))}(i,e):function(t,e){var