diff --git a/xenpaper/CNAME b/xenpaper/CNAME new file mode 100644 index 0000000..8924b1a --- /dev/null +++ b/xenpaper/CNAME @@ -0,0 +1 @@ +xenpaper.com \ No newline at end of file diff --git a/xenpaper/android-chrome-192x192.png b/xenpaper/android-chrome-192x192.png new file mode 100644 index 0000000..28e6aa7 Binary files /dev/null and b/xenpaper/android-chrome-192x192.png differ diff --git a/xenpaper/android-chrome-512x512.png b/xenpaper/android-chrome-512x512.png new file mode 100644 index 0000000..3c5b0fa Binary files /dev/null and b/xenpaper/android-chrome-512x512.png differ diff --git a/xenpaper/apple-touch-icon.png b/xenpaper/apple-touch-icon.png new file mode 100644 index 0000000..9134348 Binary files /dev/null and b/xenpaper/apple-touch-icon.png differ diff --git a/xenpaper/asset-manifest.json b/xenpaper/asset-manifest.json new file mode 100644 index 0000000..d063008 --- /dev/null +++ b/xenpaper/asset-manifest.json @@ -0,0 +1,20 @@ +{ + "files": { + "main.js": "/static/js/main.bbf5526c.chunk.js", + "main.js.map": "/static/js/main.bbf5526c.chunk.js.map", + "runtime-main.js": "/static/js/runtime-main.8b262454.js", + "runtime-main.js.map": "/static/js/runtime-main.8b262454.js.map", + "static/js/2.08158775.chunk.js": "/static/js/2.08158775.chunk.js", + "static/js/2.08158775.chunk.js.map": "/static/js/2.08158775.chunk.js.map", + "static/js/3.2bd85485.chunk.js": "/static/js/3.2bd85485.chunk.js", + "static/js/3.2bd85485.chunk.js.map": "/static/js/3.2bd85485.chunk.js.map", + "index.html": "/index.html", + "static/js/2.08158775.chunk.js.LICENSE.txt": "/static/js/2.08158775.chunk.js.LICENSE.txt", + "static/media/xenpaper-logo-512x512.19f23cff.png": "/static/media/xenpaper-logo-512x512.19f23cff.png" + }, + "entrypoints": [ + "static/js/runtime-main.8b262454.js", + "static/js/2.08158775.chunk.js", + "static/js/main.bbf5526c.chunk.js" + ] +} \ No newline at end of file diff --git a/xenpaper/favicon-16x16.png b/xenpaper/favicon-16x16.png new file mode 100644 index 0000000..f60f47e Binary files /dev/null and b/xenpaper/favicon-16x16.png differ diff --git a/xenpaper/favicon-32x32.png b/xenpaper/favicon-32x32.png new file mode 100644 index 0000000..ceae99f Binary files /dev/null and b/xenpaper/favicon-32x32.png differ diff --git a/xenpaper/favicon.ico b/xenpaper/favicon.ico new file mode 100644 index 0000000..39a2999 Binary files /dev/null and b/xenpaper/favicon.ico differ diff --git a/xenpaper/index.html b/xenpaper/index.html new file mode 100644 index 0000000..37b46d1 --- /dev/null +++ b/xenpaper/index.html @@ -0,0 +1 @@ +Xenpaper
\ No newline at end of file diff --git a/xenpaper/manifest.json b/xenpaper/manifest.json new file mode 100644 index 0000000..6a181e6 --- /dev/null +++ b/xenpaper/manifest.json @@ -0,0 +1,35 @@ +{ + "short_name": "Xenpaper", + "name": "Xenpaper", + "icons": [ + { + "src": "favicon.ico", + "sizes": "16x16", + "type": "image/x-icon" + }, + { + "src": "favicon-16x16.png", + "sizes": "16x16", + "type": "image/png" + }, + { + "src": "favicon-32x32.png", + "sizes": "32x32 24x24", + "type": "image/png" + }, + { + "src": "android-chrome-192x192.png", + "type": "image/png", + "sizes": "64x64 192x192" + }, + { + "src": "android-chrome-512x512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/xenpaper/robots.txt b/xenpaper/robots.txt new file mode 100644 index 0000000..9dd52a5 --- /dev/null +++ b/xenpaper/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/xenpaper/site.webmanifest b/xenpaper/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/xenpaper/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/xenpaper/static/js/2.08158775.chunk.js b/xenpaper/static/js/2.08158775.chunk.js new file mode 100644 index 0000000..cd5c062 --- /dev/null +++ b/xenpaper/static/js/2.08158775.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 2.08158775.chunk.js.LICENSE.txt */ +(this["webpackJsonp@xenpaper/xenpaper-app"]=this["webpackJsonp@xenpaper/xenpaper-app"]||[]).push([[2],[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e,t){for(var n=0;n1?t-1:0),r=1;r0?" Args: "+n.join(", "):""))}var C=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,i=r;e>=i;)(i<<=1)<0&&O(16,""+e);this.groupSizes=new Uint32Array(i),this.groupSizes.set(n),this.length=i;for(var a=r;a=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),i=r+n,a=r;a=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(k))return r}}(n),a=void 0!==i?i.nextSibling:null;r.setAttribute(k,"active"),r.setAttribute("data-styled-version","5.3.0");var o=L();return o&&r.setAttribute("nonce",o),n.insertBefore(r,a),r},F=function(){function e(e){var t=this.element=z(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(l+=e+",")})),r+=""+s+u+'{content:"'+l+'"}/*!sc*/\n'}}}return r}(this)},e}(),q=/(a)(d)/gi,H=function(e){return String.fromCharCode(e+(e>25?39:97))};function Y(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=H(t%52)+n;return(H(t%52)+n).replace(q,"$1-$2")}var X=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},$=function(e){return X(5381,e)};function Q(e){for(var t=0;t>>0);if(!t.hasNameForId(r,o)){var s=n(a,"."+o,void 0,r);t.insertRules(r,o,s)}i.push(o),this.staticRulesId=o}else{for(var u=this.rules.length,l=X(this.baseHash,n.hash),c="",f=0;f>>0);if(!t.hasNameForId(r,v)){var g=n(c,"."+v,void 0,r);t.insertRules(r,v,g)}i.push(v)}}return i.join(" ")},e}(),J=/^\s*\/\/.*$/gm,ee=[":","[",".","#"];function te(e){var t,n,r,i,a=void 0===e?m:e,o=a.options,s=void 0===o?m:o,l=a.plugins,c=void 0===l?g:l,f=new u.a(s),h=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,i,a,o,s,u,l,c,f){switch(n){case 1:if(0===c&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(i[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){h.push(e)})),p=function(e,r,a){return 0===r&&-1!==ee.indexOf(a[n.length])||a.match(i)?e:"."+t};function v(e,a,o,s){void 0===s&&(s="&");var u=e.replace(J,""),l=a&&o?o+" "+a+" { "+u+" }":u;return t=s,n=a,r=new RegExp("\\"+n+"\\b","g"),i=new RegExp("(\\"+n+"\\b){2,}"),f(o||!a?"":a,l)}return f.use([].concat(c,[function(e,t,i){2===e&&i.length&&i[0].lastIndexOf(n)>0&&(i[0]=i[0].replace(r,p))},d,function(e){if(-2===e){var t=h;return h=[],t}}])),v.hash=c.length?c.reduce((function(e,t){return t.name||O(15),X(e,t.name)}),5381).toString():"",v}var ne=a.a.createContext(),re=(ne.Consumer,a.a.createContext()),ie=(re.Consumer,new U),ae=te();function oe(){return Object(i.useContext)(ne)||ie}function se(){return Object(i.useContext)(re)||ae}function ue(e){var t=Object(i.useState)(e.stylisPlugins),n=t[0],r=t[1],o=oe(),u=Object(i.useMemo)((function(){var t=o;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),l=Object(i.useMemo)((function(){return te({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return Object(i.useEffect)((function(){s()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]),a.a.createElement(ne.Provider,{value:u},a.a.createElement(re.Provider,{value:l},e.children))}var le=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ae);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return O(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=ae),this.name+e.hash},e}(),ce=/([A-Z])/,fe=/([A-Z])/g,he=/^ms-/,de=function(e){return"-"+e.toLowerCase()};function pe(e){return ce.test(e)?e.replace(fe,de).replace(he,"-ms-"):e}var ve=function(e){return null==e||!1===e||""===e};function ge(e,t,n,r){if(Array.isArray(e)){for(var i,a=[],o=0,s=e.length;o1?t-1:0),r=1;r?@[\\\]^`{|}~-]+/g,_e=/(^-|-$)/g;function ke(e){return e.replace(be,"-").replace(_e,"")}var we=function(e){return Y($(e)>>>0)};function xe(e){return"string"==typeof e&&!0}var Se=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Oe=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function Ce(e,t,n){var r=e[n];Se(t)&&Se(r)?Te(r,t):e[n]=t}function Te(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0||(i[n]=e[n]);return i}(t,["componentId"]),a=r&&r+"-"+(xe(e)?e:ke(b(e)));return Pe(e,d({},i,{attrs:w,componentId:a}),n)},Object.defineProperty(S,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Te({},e.defaultProps,t):t}}),S.toString=function(){return"."+S.styledComponentId},o&&h()(S,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),S}var Me=function(e){return function e(t,n,i){if(void 0===i&&(i=m),!Object(r.isValidElementType)(n))return O(1,String(n));var a=function(){return t(n,i,me.apply(void 0,arguments))};return a.withConfig=function(r){return e(t,n,d({},i,{},r))},a.attrs=function(r){return e(t,n,d({},i,{attrs:Array.prototype.concat(i.attrs,r).filter(Boolean)}))},a}(Pe,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){Me[e]=Me(e)}));var Re=function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=Q(e),U.registerId(this.componentId+1)}var t=e.prototype;return t.createStyles=function(e,t,n,r){var i=r(ge(this.rules,t,n,r).join(""),""),a=this.componentId+e;n.insertRules(a,a,i)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&U.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)},e}();function Ie(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r"+t+""},this.getStyleTags=function(){return e.sealed?O(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return O(2);var n=((t={})[k]="",t["data-styled-version"]="5.3.0",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),r=L();return r&&(n.nonce=r),[a.a.createElement("style",d({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new U({isServer:!0}),this.sealed=!1}var t=e.prototype;t.collectStyles=function(e){return this.sealed?O(2):a.a.createElement(ue,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return O(3)}}();t.d=Me}).call(this,n(55))},function(e,t,n){"use strict";function r(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return l})),n.d(t,"d",(function(){return f})),n.d(t,"c",(function(){return h})),n.d(t,"e",(function(){return d})),n.d(t,"f",(function(){return v}));var r=n(9);function i(e,t,n){for(var r=n.pos,i=n.line,a=n.column;re.lastSeen.pos&&Object.assign(e.lastSeen,i(e.text,e.pos,e.lastSeen))};function o(e){if("function"===typeof e)return e;if(e instanceof RegExp)return t=e,function(e){a(e);var n=t.exec(e.text.substring(e.pos));if(!n)return e;for(var i=Object(r.a)(Object(r.a)({},e),{},{pos:e.pos+n[0].length}),o=1;o0?s(n):n,a=t[r](i);if(a===i)return e;(a.pos>i.pos||a.sp>i.sp)&&(n=a)}return n}}function l(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:0;return{text:e,ignore:[],stack:[],sp:0,lastSeen:i(e,t,{pos:0,line:1,column:1}),pos:t}};function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r){if("string"!==typeof r)throw new Error("Parsing function expects a string input");var i=p(r,t),a=e(i);if(i===a||!n&&a.pos=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}},function(e,t,n){e.exports=n(71)()},function(e,t,n){"use strict";n.d(t,"b",(function(){return us})),n.d(t,"c",(function(){return ns})),n.d(t,"e",(function(){return Wa})),n.d(t,"d",(function(){return vs})),n.d(t,"a",(function(){return gs}));var r="14.7.77",i=n(27),a=n(12),o=n(0),s=new WeakSet,u=new WeakMap,l=new WeakMap,c=new WeakMap,f=new WeakMap,h=new WeakMap,d=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,m={construct:function(){return m}},y=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,b=function(e,t){for(var n=[],r=e.replace(/^[\s]+/,""),i=r.match(y);null!==i;){var a=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(a,new URL(a,t).toString());n.push(o),i=(r=r.slice(i[0].length).replace(/^[\s]+/,"")).match(y)}return[n.join(";"),r]},_=function(e){if(void 0!==e&&!Array.isArray(e))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},k=function(e){if(!function(e){try{new new Proxy(e,m)}catch(t){return!1}return!0}(e))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===e.prototype||"object"!==typeof e.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},w=function(e,t){var n=e.get(t);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},x=function(e,t){var n=Array.from(e).filter(t);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");var r=Object(a.a)(n,1)[0];return e.delete(r),r},S=function(e,t,n,r){var i=w(e,t),a=x(i,(function(e){return e[0]===n&&e[1]===r}));return 0===i.size&&e.delete(t),a},O=function(e){return w(d,e)},C=function(e){if(s.has(e))throw new Error("The AudioNode is already stored.");s.add(e),O(e).forEach((function(e){return e(!0)}))},T=function(e){return"port"in e},E=function(e){if(!s.has(e))throw new Error("The AudioNode is not stored.");s.delete(e),O(e).forEach((function(e){return e(!1)}))},j=function(e,t){!T(e)&&t.every((function(e){return 0===e.size}))&&E(e)},A=n(9),P=n(1),M=n(3),R=n(2),I={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},D=n(8),N=n.n(D),L=n(13),z=function(e,t){return e.context===t},F=function(e){try{e.copyToChannel(new Float32Array(1),0,-1)}catch(t){return!1}return!0},B=function(){return new DOMException("","IndexSizeError")},V=function(e){var t;e.getChannelData=(t=e.getChannelData,function(n){try{return t.call(e,n)}catch(r){if(12===r.code)throw B();throw r}})},W={numberOfChannels:1},G=n(7),U=-34028234663852886e22,q=-U,H=function(e){return s.has(e)},Y={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},X=n(14),$=n(19),Q=function(e){return w(u,e)},K=function(e){return w(c,e)},Z=function e(t,n){Q(t).activeInputs.forEach((function(r){return r.forEach((function(r){var i=Object(a.a)(r,1)[0];n.includes(t)||e(i,[].concat(Object(X.a)(n),[t]))}))}));var r,i=function(e){return"playbackRate"in e}(t)?[t.playbackRate]:T(t)?Array.from(t.parameters.values()):function(e){return"frequency"in e&&"gain"in e}(t)?[t.Q,t.detune,t.frequency,t.gain]:function(e){return"offset"in e}(t)?[t.offset]:function(e){return!("frequency"in e)&&"gain"in e}(t)?[t.gain]:function(e){return"detune"in e&&"frequency"in e}(t)?[t.detune,t.frequency]:function(e){return"pan"in e}(t)?[t.pan]:[],o=Object($.a)(i);try{for(o.s();!(r=o.n()).done;){var s=r.value,u=K(s);void 0!==u&&u.activeInputs.forEach((function(t){var r=Object(a.a)(t,1)[0];return e(r,n)}))}}catch(l){o.e(l)}finally{o.f()}H(t)&&E(t)},J=function(e){Z(e.destination,[])},ee=function(e){return void 0===e||"number"===typeof e||"string"===typeof e&&("balanced"===e||"interactive"===e||"playback"===e)},te=function(e){return"context"in e},ne=function(e){return te(e[0])},re=function(e,t,n,r){var i,a=Object($.a)(e);try{for(a.s();!(i=a.n()).done;){if(n(i.value)){if(r)return!1;throw Error("The set contains at least one similar element.")}}}catch(o){a.e(o)}finally{a.f()}return e.add(t),!0},ie=function(e,t,n,r){var i=Object(a.a)(n,2),o=i[0],s=i[1];re(e,[t,o,s],(function(e){return e[0]===t&&e[1]===o}),r)},ae=function(e,t,n){var r=Object(a.a)(t,3),i=r[0],o=r[1],s=r[2],u=e.get(i);void 0===u?e.set(i,new Set([[o,s]])):re(u,[o,s],(function(e){return e[0]===o}),n)},oe=function(e){return"inputs"in e},se=function(e,t,n,r){if(oe(t)){var i=t.inputs[r];return e.connect(i,n,0),[i,n,0]}return e.connect(t,n,r),[t,n,r]},ue=function(e,t,n){var r,i=Object($.a)(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(a[0]===t&&a[1]===n)return e.delete(a),a}}catch(o){i.e(o)}finally{i.f()}return null},le=function(e,t){if(!O(e).delete(t))throw new Error("Missing the expected event listener.")},ce=function(e,t,n){var r=w(e,t),i=x(r,(function(e){return e[0]===n}));return 0===r.size&&e.delete(t),i},fe=function(e,t,n,r){oe(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},he=function(e){return w(l,e)},de=function(e){return w(f,e)},pe=function(e){return p.has(e)},ve=function(e){return!s.has(e)},ge=function(e){return new Promise((function(t){var n=e.createScriptProcessor(256,1,1),r=e.createGain(),i=e.createBuffer(1,2,44100),a=i.getChannelData(0);a[0]=1,a[1]=1;var o=e.createBufferSource();o.buffer=i,o.loop=!0,o.connect(n).connect(e.destination),o.connect(r),o.disconnect(r),n.onaudioprocess=function(r){var i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(function(e){return 1===e}))?t(!0):t(!1),o.stop(),n.onaudioprocess=null,o.disconnect(n),n.disconnect(e.destination)},o.start()}))},me=function(e,t){var n,r=new Map,i=Object($.a)(e);try{for(i.s();!(n=i.n()).done;){var a,o=n.value,s=Object($.a)(o);try{for(s.s();!(a=s.n()).done;){var u=a.value,l=r.get(u);r.set(u,void 0===l?1:l+1)}}catch(c){s.e(c)}finally{s.f()}}}catch(c){i.e(c)}finally{i.f()}r.forEach((function(e,n){return t(n,e)}))},ye=function(e){return"context"in e},be=function(e,t,n,r){var i=K(t),a=i.activeInputs,o=i.passiveInputs,s=Q(e).outputs,u=O(e),l=function(i){var s=he(e),u=de(t);if(i){var l=ce(o,e,n);ie(a,e,l,!1),r||pe(e)||s.connect(u,n)}else{var c=function(e,t,n){return x(e,(function(e){return e[0]===t&&e[1]===n}))}(a,e,n);ae(o,c,!1),r||pe(e)||s.disconnect(u,n)}};return!!re(s,[t,n],(function(e){return e[0]===t&&e[1]===n}),!0)&&(u.add(l),H(e)?ie(a,e,[n,l],!0):ae(o,[e,n,l],!0),!0)},_e=function(e,t,n,r,i){var o=function(e,t,n,r){var i=Q(t),a=i.activeInputs,o=i.passiveInputs,s=ue(a[r],e,n);return null===s?[S(o,e,n,r)[2],!1]:[s[2],!0]}(e,n,r,i),s=Object(a.a)(o,2),u=s[0],l=s[1];if(null!==u&&(le(e,u),!l||t||pe(e)||fe(he(e),he(n),r,i)),H(n)){var c=Q(n).activeInputs;j(n,c)}},ke=function(e,t,n,r){var i=function(e,t,n){var r=K(t),i=r.activeInputs,a=r.passiveInputs,o=ue(i,e,n);return null===o?[ce(a,e,n)[1],!1]:[o[2],!0]}(e,n,r),o=Object(a.a)(i,2),s=o[0],u=o[1];null!==s&&(le(e,s),!u||t||pe(e)||he(e).disconnect(de(n),r))},we=function(){function e(t){Object(o.a)(this,e),this._map=new Map(t)}return Object(P.a)(e,[{key:"size",get:function(){return this._map.size}},{key:"entries",value:function(){return this._map.entries()}},{key:"forEach",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._map.forEach((function(r,i){return e.call(n,r,i,t)}))}},{key:"get",value:function(e){return this._map.get(e)}},{key:"has",value:function(e){return this._map.has(e)}},{key:"keys",value:function(){return this._map.keys()}},{key:"values",value:function(){return this._map.values()}}]),e}(),xe={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},Se=n(18);function Oe(e,t,n,r,i){if("function"===typeof e.copyFromChannel)0===t[n].byteLength&&(t[n]=new Float32Array(128)),e.copyFromChannel(t[n],r,i);else{var a=e.getChannelData(r);if(0===t[n].byteLength)t[n]=a.slice(i,i+128);else{var o=new Float32Array(a.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);t[n].set(o)}}}var Ce=function(e,t,n,r,i){"function"===typeof e.copyToChannel?0!==t[n].byteLength&&e.copyToChannel(t[n],r,i):0!==t[n].byteLength&&e.getChannelData(r).set(t[n],i)},Te=function(e,t){for(var n=[],r=0;r0&&null!==n)for(var u=0;u0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;if("number"===typeof i&&i<0||r<0||n<0)throw new RangeError("The parameters can't be negative.");t.call(e,n,r,i)})},Je=function(e){var t;e.stop=(t=e.stop,function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(n<0)throw new RangeError("The parameter can't be negative.");t.call(e,n)})},et=function(e,t){return null===e?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(e*t)))))},tt=function(e){return new Promise((function(t,n){var r=new MessageChannel,i=r.port1,a=r.port2;i.onmessage=function(e){var n=e.data;i.close(),a.close(),t(n)},i.onmessageerror=function(e){var t=e.data;i.close(),a.close(),n(t)},a.postMessage(e)}))},nt=function(){var e=Object(L.a)(N.a.mark((function e(t,n){var r;return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tt(n);case 2:return r=e.sent,e.abrupt("return",new t(r));case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),rt=function(e,t){var n=e.createBiquadFilter();return $e(n,t),Ke(n,t,"Q"),Ke(n,t,"detune"),Ke(n,t,"frequency"),Ke(n,t,"gain"),Xe(n,t,"type"),n},it=function(e,t){var n=e.createChannelSplitter(t.numberOfOutputs);return $e(n,t),function(e){var t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:function(){return t},set:function(e){if(e!==t)throw Be()}}),Object.defineProperty(e,"channelCountMode",{get:function(){return"explicit"},set:function(e){if("explicit"!==e)throw Be()}}),Object.defineProperty(e,"channelInterpretation",{get:function(){return"discrete"},set:function(e){if("discrete"!==e)throw Be()}})}(n),n},at=n(25),ot=function(e,t){return e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e},st=function(e,t){var n=e.createDelay(t.maxDelayTime);return $e(n,t),Ke(n,t,"delayTime"),n},ut=function(e,t){var n=e.createGain();return $e(n,t),Ke(n,t,"gain"),n};function lt(e,t){var n=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/n,(e[1]*t[0]-e[0]*t[1])/n]}function ct(e,t){for(var n,r,i=[0,0],a=e.length-1;a>=0;a-=1)r=t,(i=[(n=i)[0]*r[0]-n[1]*r[1],n[0]*r[1]+n[1]*r[0]])[0]+=e[a];return i}var ft,ht,dt,pt,vt,gt,mt,yt,bt,_t,kt,wt,xt,St,Ot,Ct,Tt,Et,jt,At,Pt,Mt,Rt,It,Dt,Nt,Lt,zt,Ft,Bt,Vt,Wt,Gt,Ut,qt,Ht,Yt,Xt,$t,Qt,Kt,Zt,Jt,en,tn,nn,rn,an,on,sn,un,ln,cn,fn,hn,dn,pn,vn,gn,mn,yn,bn,_n=function(e,t,n,r){return e.createScriptProcessor(t,n,r)},kn=function(){return new DOMException("","NotSupportedError")},wn={numberOfChannels:1},xn={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Sn={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},On={disableNormalization:!1},Cn={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Tn=function(){return new DOMException("","UnknownError")},En={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},jn=function(e){if(null===e)return!1;var t=e.length;return t%2!==0?0!==e[Math.floor(t/2)]:e[t/2-1]+e[t/2]!==0},An=function(e,t,n,r){for(var i=Object.getPrototypeOf(e);!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);var a=Object.getOwnPropertyDescriptor(i,t),o=a.get,s=a.set;Object.defineProperty(e,t,{get:n(o),set:r(s)})},Pn=function(e){var t=e.createOscillator();try{t.start(-1)}catch(n){return n instanceof RangeError}return!1},Mn=function(e){var t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch(r){return!1}},Rn=function(e){var t=e.createOscillator();try{t.stop(-1)}catch(n){return n instanceof RangeError}return!1},In=function(e,t){var n=t.createGain();e.connect(n);var r,i=(r=e.disconnect,function(){r.call(e,n),e.removeEventListener("ended",i)});e.addEventListener("ended",i),ot(e,n),e.stop=function(t){var r=!1;return function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(r)try{t.call(e,i)}catch(a){n.gain.setValueAtTime(0,i)}else t.call(e,i),r=!0}}(e.stop)},Dn=function(e,t){return function(n){var r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),"function"===typeof t?t.call(e,n):t.handleEvent.call(e,n)}},Nn=(ft=re,function(e,t,n,r){var i=Object(a.a)(n,3),o=i[0],s=i[1],u=i[2];ft(e[s],[t,o,u],(function(e){return e[0]===t&&e[1]===o}),r)}),Ln=function(e){return function(t,n,r,i){var o=Object(a.a)(r,3),s=o[0],u=o[1],l=o[2],c=t.get(s);void 0===c?t.set(s,new Set([[u,n,l]])):e(c,[u,n,l],(function(e){return e[0]===u&&e[1]===n}),i)}}(re),zn=(ht=x,function(e,t,n,r){return ht(e[r],(function(e){return e[0]===t&&e[1]===n}))}),Fn=new WeakMap,Bn=function(e){return function(t){var n;return null!==(n=e.get(t))&&void 0!==n?n:0}}(Fn),Vn=(dt=new Map,pt=new WeakMap,function(e,t){var n=pt.get(e);if(void 0!==n)return n;var r=dt.get(e);if(void 0!==r)return r;try{var i=t();return i instanceof Promise?(dt.set(e,i),i.catch((function(){return!1})).then((function(t){return dt.delete(e),pt.set(e,t),t}))):(pt.set(e,i),i)}catch(a){return pt.set(e,!1),!1}}),Wn="undefined"===typeof window?null:window,Gn=(vt=Vn,gt=B,function(e,t){var n=e.createAnalyser();if($e(n,t),!(t.maxDecibels>t.minDecibels))throw gt();return Xe(n,t,"fftSize"),Xe(n,t,"maxDecibels"),Xe(n,t,"minDecibels"),Xe(n,t,"smoothingTimeConstant"),vt(Qe,(function(){return Qe(n)}))||function(e){e.getFloatTimeDomainData=function(t){var n=new Uint8Array(t.length);e.getByteTimeDomainData(n);for(var r=Math.max(n.length,e.fftSize),i=0;i1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=ye(e)?t(e,n,i):t(e,n),o=r.get(e);return void 0===o?r.set(e,[{input:i,output:n}]):o.every((function(e){return e.input!==i||e.output!==n}))&&o.push({input:i,output:n}),a}),e.disconnect=(n=e.disconnect,function(t,i,o){if(n.apply(e),void 0===t)r.clear();else if("number"===typeof t){var s,u=Object($.a)(r);try{for(u.s();!(s=u.n()).done;){var l=Object(a.a)(s.value,2),c=l[0],f=l[1].filter((function(e){return e.output!==t}));0===f.length?r.delete(c):r.set(c,f)}}catch(m){u.e(m)}finally{u.f()}}else if(r.has(t))if(void 0===i)r.delete(t);else{var h=r.get(t);if(void 0!==h){var d=h.filter((function(e){return e.output!==i&&(e.input!==o||void 0===o)}));0===d.length?r.delete(t):r.set(t,d)}}var p,v=Object($.a)(r);try{var g=function(){var t=Object(a.a)(p.value,2),n=t[0];t[1].forEach((function(t){ye(n)?e.connect(n,t.output,t.input):e.connect(n,t.output)}))};for(v.s();!(p=v.n()).done;)g()}catch(m){v.e(m)}finally{v.f()}})}(i),l.set(Object(G.a)(u),i),d.set(Object(G.a)(u),new Set),"closed"!==t.state&&r&&C(Object(G.a)(u)),e(Object(G.a)(u),s,i),u}return Object(P.a)(_,[{key:"channelCount",get:function(){return this._nativeAudioNode.channelCount},set:function(e){this._nativeAudioNode.channelCount=e}},{key:"channelCountMode",get:function(){return this._nativeAudioNode.channelCountMode},set:function(e){this._nativeAudioNode.channelCountMode=e}},{key:"channelInterpretation",get:function(){return this._nativeAudioNode.channelInterpretation},set:function(e){this._nativeAudioNode.channelInterpretation=e}},{key:"context",get:function(){return this._context}},{key:"numberOfInputs",get:function(){return this._nativeAudioNode.numberOfInputs}},{key:"numberOfOutputs",get:function(){return this._nativeAudioNode.numberOfOutputs}},{key:"connect",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();var o=p(this._context),l=y(o);if(g(e)||m(e))throw s();if(te(e)){var c=he(e);try{var h,d=se(this._nativeAudioNode,c,n,a),v=ve(this);if(l||v)(h=this._nativeAudioNode).disconnect.apply(h,Object(X.a)(d));"closed"!==this.context.state&&!v&&ve(e)&&C(e)}catch(S){if(12===S.code)throw s();throw S}var b=t(this,e,n,a,l);if(b){var _=f([this],e);me(_,r(l))}return e}var k=de(e);if("playbackRate"===k.name&&1024===k.maxValue)throw u();try{this._nativeAudioNode.connect(k,n),(l||ve(this))&&this._nativeAudioNode.disconnect(k,n)}catch(S){if(12===S.code)throw s();throw S}var w=be(this,e,n,l);if(w){var x=f([this],e);me(x,r(l))}}},{key:"disconnect",value:function(e,t,n){var r,a=p(this._context),o=y(a);if(void 0===e)r=function(e,t){var n,r=Q(e),i=[],a=Object($.a)(r.outputs);try{for(a.s();!(n=a.n()).done;){var o=n.value;ne(o)?_e.apply(void 0,[e,t].concat(Object(X.a)(o))):ke.apply(void 0,[e,t].concat(Object(X.a)(o))),i.push(o[0])}}catch(s){a.e(s)}finally{a.f()}return r.outputs.clear(),i}(this,o);else if("number"===typeof e){if(e<0||e>=this.numberOfOutputs)throw i();r=function(e,t,n){var r,i=Q(e),a=[],o=Object($.a)(i.outputs);try{for(o.s();!(r=o.n()).done;){var s=r.value;s[1]===n&&(ne(s)?_e.apply(void 0,[e,t].concat(Object(X.a)(s))):ke.apply(void 0,[e,t].concat(Object(X.a)(s))),a.push(s[0]),i.outputs.delete(s))}}catch(u){o.e(u)}finally{o.f()}return a}(this,o,e)}else{if(void 0!==t&&(t<0||t>=this.numberOfOutputs))throw i();if(te(e)&&void 0!==n&&(n<0||n>=e.numberOfInputs))throw i();if(0===(r=function(e,t,n,r,i){var a=Q(e);return Array.from(a.outputs).filter((function(e){return e[0]===n&&(void 0===r||e[1]===r)&&(void 0===i||e[2]===i)})).map((function(n){return ne(n)?_e.apply(void 0,[e,t].concat(Object(X.a)(n))):ke.apply(void 0,[e,t].concat(Object(X.a)(n))),a.outputs.delete(n),n[0]}))}(this,o,e,t,n)).length)throw s()}var u,l=Object($.a)(r);try{for(l.s();!(u=l.n()).done;){var h=u.value,d=f([this],h);me(d,c)}}catch(v){l.e(v)}finally{l.f()}}}]),_}(h)}((Ot=u,function(e,t,n){for(var r=[],i=0;ithis._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,n()}},{key:"minDecibels",get:function(){return this._nativeAnalyserNode.minDecibels},set:function(e){var t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,n()}},{key:"smoothingTimeConstant",get:function(){return this._nativeAnalyserNode.smoothingTimeConstant},set:function(e){this._nativeAnalyserNode.smoothingTimeConstant=e}},{key:"getByteFrequencyData",value:function(e){this._nativeAnalyserNode.getByteFrequencyData(e)}},{key:"getByteTimeDomainData",value:function(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}},{key:"getFloatFrequencyData",value:function(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}},{key:"getFloatTimeDomainData",value:function(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}}]),u}(e)}(nr,Hn,B,Gn,Yn,$n),ir=new WeakSet,ar=function(e){return null===e?null:e.hasOwnProperty("AudioBuffer")?e.AudioBuffer:null}(Wn),or=(Ct=new Uint32Array(1),function(e){return Ct[0]=e,Ct[0]}),sr=function(e,t){return function(n){n.copyFromChannel=function(r,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=e(a),s=e(i);if(s>=n.numberOfChannels)throw t();for(var u=n.length,l=n.getChannelData(s),c=r.length,f=o<0?-o:0;f+o2&&void 0!==arguments[2]?arguments[2]:0,o=e(a),s=e(i);if(s>=n.numberOfChannels)throw t();for(var u=n.length,l=n.getChannelData(s),c=r.length,f=o<0?-o:0;f+o2&&void 0!==arguments[2]?arguments[2]:0,o=e(a),s=e(i);if(o2&&void 0!==arguments[2]?arguments[2]:0,o=e(a),s=e(i);if(o0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2?arguments[2]:void 0;if(n)throw Be();t.call(e,r,i,a),n=!0}}(e.start)}(d),t(r,(function(){return r(f)}))||u(d),t(i,(function(){return i(f)}))||l(d,f),t(a,(function(){return a(f)}))||Ze(d),t(o,(function(){return o(f)}))||c(d,f),t(s,(function(){return s(f)}))||Je(d),e(f,d),d}}(cr,Vn,(function(e){var t=e.createBufferSource();t.start();try{t.start()}catch(n){return!0}return!1}),(function(e){var t=e.createBufferSource(),n=e.createBuffer(1,1,44100);t.buffer=n;try{t.start(0,1)}catch(r){return!1}return!0}),(function(e){var t=e.createBufferSource();t.start();try{t.stop()}catch(n){return!1}return!0}),Pn,Mn,Rn,(function(e){var t;e.start=(t=e.start,function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,a=e.buffer,o=null===a?r:Math.min(a.duration,r);null!==a&&o>a.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,o,i)})}),(Mt=An,function(e,t){var n=t.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=n),Mt(e,"buffer",(function(t){return function(){var r=t.call(e);return r===n?null:r}}),(function(t){return function(r){return t.call(e,null===r?n:r)}}))}),In),pr=function(e,t){return function(n,r,i,a){return e(r).replay(i),t(r,n,i,a)}}(function(e){return function(t){var n=e(t);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer}}(K),fr),vr=function(e,t,n,r,i){return function(){var a=new WeakMap,o=null,s=null,u=function(){var u=Object(L.a)(N.a.mark((function u(l,c,f){var h,d,p,v;return N.a.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if(h=n(l),(d=z(h,c))||(p={buffer:h.buffer,channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,loop:h.loop,loopEnd:h.loopEnd,loopStart:h.loopStart,playbackRate:h.playbackRate.value},h=t(c,p),null!==o&&(v=h).start.apply(v,Object(X.a)(o)),null!==s&&h.stop(s)),a.set(c,h),d){u.next=9;break}return u.next=7,r(c,l.playbackRate,h.playbackRate,f);case 7:u.next=11;break;case 9:return u.next=11,e(c,l.playbackRate,h.playbackRate,f);case 11:return u.next=13,i(l,c,h,f);case 13:return u.abrupt("return",h);case 14:case"end":return u.stop()}}),u)})));return function(e,t,n){return u.apply(this,arguments)}}();return{set start(e){o=e},set stop(e){s=e},render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):u(e,t,n)}}}}(hr,dr,he,pr,qn),gr=function(e,t,n,r,a,o,s,u,l,c,f,h,d){return function(p,v,g){var m=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,y=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,b=new i.AutomationEventList(g.defaultValue),_=v?r(b):null,k={get defaultValue(){return g.defaultValue},get maxValue(){return null===m?g.maxValue:m},get minValue(){return null===y?g.minValue:y},get value(){return g.value},set value(e){g.value=e,k.setValueAtTime(e,p.context.currentTime)},cancelAndHoldAtTime:function(e){if("function"===typeof g.cancelAndHoldAtTime)null===_&&b.flush(p.context.currentTime),b.add(a(e)),g.cancelAndHoldAtTime(e);else{var t=Array.from(b).pop();null===_&&b.flush(p.context.currentTime),b.add(a(e));var n=Array.from(b).pop();g.cancelScheduledValues(e),t!==n&&void 0!==n&&("exponentialRampToValue"===n.type?g.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?g.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?g.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&g.setValueCurveAtTime(n.values,n.startTime,n.duration))}return k},cancelScheduledValues:function(e){return null===_&&b.flush(p.context.currentTime),b.add(o(e)),g.cancelScheduledValues(e),k},exponentialRampToValueAtTime:function(e,t){if(0===e)throw new RangeError;if(!Number.isFinite(t)||t<0)throw new RangeError;return null===_&&b.flush(p.context.currentTime),b.add(s(e,t)),g.exponentialRampToValueAtTime(e,t),k},linearRampToValueAtTime:function(e,t){return null===_&&b.flush(p.context.currentTime),b.add(u(e,t)),g.linearRampToValueAtTime(e,t),k},setTargetAtTime:function(e,t,n){return null===_&&b.flush(p.context.currentTime),b.add(l(e,t,n)),g.setTargetAtTime(e,t,n),k},setValueAtTime:function(e,t){return null===_&&b.flush(p.context.currentTime),b.add(c(e,t)),g.setValueAtTime(e,t),k},setValueCurveAtTime:function(e,t,n){var r=e instanceof Float32Array?e:new Float32Array(e);if(null!==h&&"webkitAudioContext"===h.name){for(var i=t+n,a=p.context.sampleRate,o=Math.ceil(t*a),s=Math.floor(i*a),u=s-o,l=new Float32Array(u),c=0;c0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;if(this._nativeAudioBufferSourceNode.start(t,n,r),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===r?[t,n]:[t,n,r]),"closed"!==this.context.state){C(this);var i=function t(){e._nativeAudioBufferSourceNode.removeEventListener("ended",t),H(e)&&E(e)};this._nativeAudioBufferSourceNode.addEventListener("ended",i)}}},{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._nativeAudioBufferSourceNode.stop(e),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=e)}}]),c}(e)}(nr,vr,gr,Be,dr,Yn,$n,Dn),yr=function(e,t,n,r,i,a,s,u){return function(e){Object(M.a)(c,e);var l=Object(R.a)(c);function c(e,n){var r;Object(o.a)(this,c);var f=a(e),h=s(f),d=i(f,n,h),p=h?t(u):null;return(r=l.call(this,e,!1,d,p))._isNodeOfNativeOfflineAudioContext=h,r._nativeAudioDestinationNode=d,r}return Object(P.a)(c,[{key:"channelCount",get:function(){return this._nativeAudioDestinationNode.channelCount},set:function(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=e}},{key:"channelCountMode",get:function(){return this._nativeAudioDestinationNode.channelCountMode},set:function(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=e}},{key:"maxChannelCount",get:function(){return this._nativeAudioDestinationNode.maxChannelCount}}]),c}(e)}(nr,(function(e){var t=null,n=function(){var t=Object(L.a)(N.a.mark((function t(n,r,i){var a;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=r.destination,t.next=3,e(n,r,a,i);case 3:return t.abrupt("return",a);case 4:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}();return{render:function(e,r,i){return null===t&&(t=n(e,r,i)),t}}}),B,Be,function(e,t){return function(n,r,i){var a=n.destination;if(a.channelCount!==r)try{a.channelCount=r}catch(s){}i&&"explicit"!==a.channelCountMode&&(a.channelCountMode="explicit"),0===a.maxChannelCount&&Object.defineProperty(a,"maxChannelCount",{value:r});var o=e(n,{channelCount:r,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,gain:1});return t(o,"channelCount",(function(e){return function(){return e.call(o)}}),(function(e){return function(t){e.call(o,t);try{a.channelCount=t}catch(n){if(t>a.maxChannelCount)throw n}}})),t(o,"channelCountMode",(function(e){return function(){return e.call(o)}}),(function(e){return function(t){e.call(o,t),a.channelCountMode=t}})),t(o,"channelInterpretation",(function(e){return function(){return e.call(o)}}),(function(e){return function(t){e.call(o,t),a.channelInterpretation=t}})),Object.defineProperty(o,"maxChannelCount",{get:function(){return a.maxChannelCount}}),o.connect(a),o}}(ut,An),Yn,$n,qn),br=function(e,t,n,r,i){return function(){var a=new WeakMap,o=function(){var o=Object(L.a)(N.a.mark((function o(s,u,l){var c,f,h;return N.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(c=n(s),(f=z(c,u))||(h={Q:c.Q.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,detune:c.detune.value,frequency:c.frequency.value,gain:c.gain.value,type:c.type},c=t(u,h)),a.set(u,c),f){o.next=15;break}return o.next=7,r(u,s.Q,c.Q,l);case 7:return o.next=9,r(u,s.detune,c.detune,l);case 9:return o.next=11,r(u,s.frequency,c.frequency,l);case 11:return o.next=13,r(u,s.gain,c.gain,l);case 13:o.next=23;break;case 15:return o.next=17,e(u,s.Q,c.Q,l);case 17:return o.next=19,e(u,s.detune,c.detune,l);case 19:return o.next=21,e(u,s.frequency,c.frequency,l);case 21:return o.next=23,e(u,s.gain,c.gain,l);case 23:return o.next=25,i(s,u,c,l);case 25:return o.abrupt("return",c);case 26:case"end":return o.stop()}}),o)})));return function(e,t,n){return o.apply(this,arguments)}}();return{render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):o(e,t,n)}}}}(hr,rt,he,pr,qn),_r=function(e){return function(t,n){return e.set(t,n)}}(Fn),kr=(It=gr,Dt=br,Nt=Ve,Lt=rt,zt=Yn,Ft=$n,Bt=_r,function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e,r){var i;Object(o.a)(this,n);var a=zt(e),s=Object(A.a)(Object(A.a)({},Ae),r),u=Lt(a,s),l=Ft(a),c=l?Dt():null;return(i=t.call(this,e,!1,u,c))._Q=It(Object(G.a)(i),l,u.Q,q,U),i._detune=It(Object(G.a)(i),l,u.detune,1200*Math.log2(q),-1200*Math.log2(q)),i._frequency=It(Object(G.a)(i),l,u.frequency,e.sampleRate/2,0),i._gain=It(Object(G.a)(i),l,u.gain,40*Math.log10(q),U),i._nativeBiquadFilterNode=u,Bt(Object(G.a)(i),1),i}return Object(P.a)(n,[{key:"detune",get:function(){return this._detune}},{key:"frequency",get:function(){return this._frequency}},{key:"gain",get:function(){return this._gain}},{key:"Q",get:function(){return this._Q}},{key:"type",get:function(){return this._nativeBiquadFilterNode.type},set:function(e){this._nativeBiquadFilterNode.type=e}},{key:"getFrequencyResponse",value:function(e,t,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,n)}catch(r){if(11===r.code)throw Nt();throw r}if(e.length!==t.length||t.length!==n.length)throw Nt()}}]),n}(nr)),wr=function(e,t){return function(n,r,i){var a,o,s=new Set;return n.connect=(a=n.connect,function(i){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=0===s.size;if(t(i))return a.call(n,i,o,u),e(s,[i,o,u],(function(e){return e[0]===i&&e[1]===o&&e[2]===u}),!0),l&&r(),i;a.call(n,i,o),e(s,[i,o],(function(e){return e[0]===i&&e[1]===o}),!0),l&&r()}),n.disconnect=(o=n.disconnect,function(e,r,a){var u=s.size>0;if(void 0===e)o.apply(n),s.clear();else if("number"===typeof e){o.call(n,e);var l,c=Object($.a)(s);try{for(c.s();!(l=c.n()).done;){var f=l.value;f[1]===e&&s.delete(f)}}catch(g){c.e(g)}finally{c.f()}}else{t(e)?o.call(n,e,r,a):o.call(n,e,r);var h,d=Object($.a)(s);try{for(d.s();!(h=d.n()).done;){var p=h.value;p[0]!==e||void 0!==r&&p[1]!==r||void 0!==a&&p[2]!==a||s.delete(p)}}catch(g){d.e(g)}finally{d.f()}}var v=0===s.size;u&&v&&i()}),n}}(re,er),xr=(Vt=Be,Wt=wr,function(e,t){t.channelCount=1,t.channelCountMode="explicit",Object.defineProperty(t,"channelCount",{get:function(){return 1},set:function(){throw Vt()}}),Object.defineProperty(t,"channelCountMode",{get:function(){return"explicit"},set:function(){throw Vt()}});var n=e.createBufferSource();Wt(t,(function(){for(var e=t.numberOfInputs,r=0;r0&&void 0!==arguments[0]?arguments[0]:0;l.start.call(l,e)},stop:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;l.stop.call(l,e)}};return e(i,l),r(ot(h,c),(function(){return l.connect(c)}),(function(){return l.disconnect(c)}))}}(cr,dr,ut,wr),Er=function(e,t,n,r,i){return function(a,o){if(void 0===a.createConstantSource)return n(a,o);var s=a.createConstantSource();return $e(s,o),Ke(s,o,"offset"),t(r,(function(){return r(a)}))||Ze(s),t(i,(function(){return i(a)}))||Je(s),e(a,s),s}}(cr,Vn,Tr,Pn,Rn),jr=function(e,t,n,r,i,a,s){return function(e){Object(M.a)(l,e);var u=Object(R.a)(l);function l(e,s){var c;Object(o.a)(this,l);var f=i(e),h=Object(A.a)(Object(A.a)({},Re),s),d=r(f,h),p=a(f),v=p?n():null;return(c=u.call(this,e,!1,d,v))._constantSourceNodeRenderer=v,c._nativeConstantSourceNode=d,c._offset=t(Object(G.a)(c),p,d.offset,q,U),c._onended=null,c}return Object(P.a)(l,[{key:"offset",get:function(){return this._offset}},{key:"onended",get:function(){return this._onended},set:function(e){var t="function"===typeof e?s(this,e):null;this._nativeConstantSourceNode.onended=t;var n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===t?e:n}},{key:"start",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){C(this);var n=function t(){e._nativeConstantSourceNode.removeEventListener("ended",t),H(e)&&E(e)};this._nativeConstantSourceNode.addEventListener("ended",n)}}},{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._nativeConstantSourceNode.stop(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=e)}}]),l}(e)}(nr,gr,function(e,t,n,r,i){return function(){var a=new WeakMap,o=null,s=null,u=function(){var u=Object(L.a)(N.a.mark((function u(l,c,f){var h,d,p;return N.a.wrap((function(u){for(;;)switch(u.prev=u.next){case 0:if(h=n(l),(d=z(h,c))||(p={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,offset:h.offset.value},h=t(c,p),null!==o&&h.start(o),null!==s&&h.stop(s)),a.set(c,h),d){u.next=9;break}return u.next=7,r(c,l.offset,h.offset,f);case 7:u.next=11;break;case 9:return u.next=11,e(c,l.offset,h.offset,f);case 11:return u.next=13,i(l,c,h,f);case 13:return u.abrupt("return",h);case 14:case"end":return u.stop()}}),u)})));return function(e,t,n){return u.apply(this,arguments)}}();return{set start(e){o=e},set stop(e){s=e},render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):u(e,t,n)}}}}(hr,Er,he,pr,qn),Er,Yn,$n,Dn),Ar=function(e,t){return function(n,r){var i=n.createConvolver();if($e(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),Xe(i,r,"buffer"),r.channelCount>2)throw e();if(t(i,"channelCount",(function(e){return function(){return e.call(i)}}),(function(t){return function(n){if(n>2)throw e();return t.call(i,n)}})),"max"===r.channelCountMode)throw e();return t(i,"channelCountMode",(function(e){return function(){return e.call(i)}}),(function(t){return function(n){if("max"===n)throw e();return t.call(i,n)}})),i}}(kn,An),Pr=function(e,t,n,r,i,a){return function(e){Object(M.a)(u,e);var s=Object(R.a)(u);function u(e,l){var c;Object(o.a)(this,u);var f=r(e),h=Object(A.a)(Object(A.a)({},Ie),l),d=n(f,h),p=i(f)?t():null;return(c=s.call(this,e,!1,d,p))._isBufferNullified=!1,c._nativeConvolverNode=d,null!==h.buffer&&a(Object(G.a)(c),h.buffer.duration),c}return Object(P.a)(u,[{key:"buffer",get:function(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer},set:function(e){if(this._nativeConvolverNode.buffer=e,null===e&&null!==this._nativeConvolverNode.buffer){var t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,44100),this._isBufferNullified=!0,a(this,0)}else this._isBufferNullified=!1,a(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}},{key:"normalize",get:function(){return this._nativeConvolverNode.normalize},set:function(e){this._nativeConvolverNode.normalize=e}}]),u}(e)}(nr,function(e,t,n){return function(){var r=new WeakMap,i=function(){var i=Object(L.a)(N.a.mark((function i(a,o,s){var u,l;return N.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(u=t(a),z(u,o)||(l={buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,disableNormalization:!u.normalize},u=e(o,l)),r.set(o,u),!oe(u)){i.next=9;break}return i.next=7,n(a,o,u.inputs[0],s);case 7:i.next=11;break;case 9:return i.next=11,n(a,o,u,s);case 11:return i.abrupt("return",u);case 12:case"end":return i.stop()}}),i)})));return function(e,t,n){return i.apply(this,arguments)}}();return{render:function(e,t,n){var a=r.get(t);return void 0!==a?Promise.resolve(a):i(e,t,n)}}}}(Ar,he,qn),Ar,Yn,$n,_r),Mr=function(e,t,n,r,i,a,s){return function(e){Object(M.a)(l,e);var u=Object(R.a)(l);function l(e,c){var f;Object(o.a)(this,l);var h=i(e),d=Object(A.a)(Object(A.a)({},Ne),c),p=r(h,d),v=a(h),g=v?n(d.maxDelayTime):null;return(f=u.call(this,e,!1,p,g))._delayTime=t(Object(G.a)(f),v,p.delayTime),s(Object(G.a)(f),d.maxDelayTime),f}return Object(P.a)(l,[{key:"delayTime",get:function(){return this._delayTime}}]),l}(e)}(nr,gr,function(e,t,n,r,i){return function(a){var o=new WeakMap,s=function(){var s=Object(L.a)(N.a.mark((function s(u,l,c){var f,h,d;return N.a.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:if(f=n(u),(h=z(f,l))||(d={channelCount:f.channelCount,channelCountMode:f.channelCountMode,channelInterpretation:f.channelInterpretation,delayTime:f.delayTime.value,maxDelayTime:a},f=t(l,d)),o.set(l,f),h){s.next=9;break}return s.next=7,r(l,u.delayTime,f.delayTime,c);case 7:s.next=11;break;case 9:return s.next=11,e(l,u.delayTime,f.delayTime,c);case 11:return s.next=13,i(u,l,f,c);case 13:return s.abrupt("return",f);case 14:case"end":return s.stop()}}),s)})));return function(e,t,n){return s.apply(this,arguments)}}();return{render:function(e,t,n){var r=o.get(t);return void 0!==r?Promise.resolve(r):s(e,t,n)}}}}(hr,st,he,pr,qn),st,Yn,$n,_r),Rr=(Gt=kn,function(e,t){var n=e.createDynamicsCompressor();if($e(n,t),t.channelCount>2)throw Gt();if("max"===t.channelCountMode)throw Gt();return Ke(n,t,"attack"),Ke(n,t,"knee"),Ke(n,t,"ratio"),Ke(n,t,"release"),Ke(n,t,"threshold"),n}),Ir=function(e,t,n,r,i,a,s,u){return function(e){Object(M.a)(c,e);var l=Object(R.a)(c);function c(e,i){var f;Object(o.a)(this,c);var h=a(e),d=Object(A.a)(Object(A.a)({},ze),i),p=r(h,d),v=s(h),g=v?n():null;return(f=l.call(this,e,!1,p,g))._attack=t(Object(G.a)(f),v,p.attack),f._knee=t(Object(G.a)(f),v,p.knee),f._nativeDynamicsCompressorNode=p,f._ratio=t(Object(G.a)(f),v,p.ratio),f._release=t(Object(G.a)(f),v,p.release),f._threshold=t(Object(G.a)(f),v,p.threshold),u(Object(G.a)(f),.006),f}return Object(P.a)(c,[{key:"attack",get:function(){return this._attack}},{key:"channelCount",get:function(){return this._nativeDynamicsCompressorNode.channelCount},set:function(e){var t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,i()}},{key:"channelCountMode",get:function(){return this._nativeDynamicsCompressorNode.channelCountMode},set:function(e){var t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,"max"===e)throw this._nativeDynamicsCompressorNode.channelCountMode=t,i()}},{key:"knee",get:function(){return this._knee}},{key:"ratio",get:function(){return this._ratio}},{key:"reduction",get:function(){return"number"===typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}},{key:"release",get:function(){return this._release}},{key:"threshold",get:function(){return this._threshold}}]),c}(e)}(nr,gr,function(e,t,n,r,i){return function(){var a=new WeakMap,o=function(){var o=Object(L.a)(N.a.mark((function o(s,u,l){var c,f,h;return N.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(c=n(s),(f=z(c,u))||(h={attack:c.attack.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,knee:c.knee.value,ratio:c.ratio.value,release:c.release.value,threshold:c.threshold.value},c=t(u,h)),a.set(u,c),f){o.next=17;break}return o.next=7,r(u,s.attack,c.attack,l);case 7:return o.next=9,r(u,s.knee,c.knee,l);case 9:return o.next=11,r(u,s.ratio,c.ratio,l);case 11:return o.next=13,r(u,s.release,c.release,l);case 13:return o.next=15,r(u,s.threshold,c.threshold,l);case 15:o.next=27;break;case 17:return o.next=19,e(u,s.attack,c.attack,l);case 19:return o.next=21,e(u,s.knee,c.knee,l);case 21:return o.next=23,e(u,s.ratio,c.ratio,l);case 23:return o.next=25,e(u,s.release,c.release,l);case 25:return o.next=27,e(u,s.threshold,c.threshold,l);case 27:return o.next=29,i(s,u,c,l);case 29:return o.abrupt("return",c);case 30:case"end":return o.stop()}}),o)})));return function(e,t,n){return o.apply(this,arguments)}}();return{render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):o(e,t,n)}}}}(hr,Rr,he,pr,qn),Rr,kn,Yn,$n,_r),Dr=function(e,t,n,r,i,a){return function(e){Object(M.a)(u,e);var s=Object(R.a)(u);function u(e,l){var c;Object(o.a)(this,u);var f=i(e),h=Object(A.a)(Object(A.a)({},Fe),l),d=r(f,h),p=a(f),v=p?n():null;return(c=s.call(this,e,!1,d,v))._gain=t(Object(G.a)(c),p,d.gain,q,U),c}return Object(P.a)(u,[{key:"gain",get:function(){return this._gain}}]),u}(e)}(nr,gr,function(e,t,n,r,i){return function(){var a=new WeakMap,o=function(){var o=Object(L.a)(N.a.mark((function o(s,u,l){var c,f,h;return N.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(c=n(s),(f=z(c,u))||(h={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,gain:c.gain.value},c=t(u,h)),a.set(u,c),f){o.next=9;break}return o.next=7,r(u,s.gain,c.gain,l);case 7:o.next=11;break;case 9:return o.next=11,e(u,s.gain,c.gain,l);case 11:return o.next=13,i(s,u,c,l);case 13:return o.abrupt("return",c);case 14:case"end":return o.stop()}}),o)})));return function(e,t,n){return o.apply(this,arguments)}}();return{render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):o(e,t,n)}}}}(hr,ut,he,pr,qn),ut,Yn,$n),Nr=function(e,t,n,r){return function(i,a,o){var s=o.channelCount,u=o.channelCountMode,l=o.channelInterpretation,c=o.feedback,f=o.feedforward,h=et(a,i.sampleRate),d=c instanceof Float64Array?c:new Float64Array(c),p=f instanceof Float64Array?f:new Float64Array(f),v=d.length,g=p.length,m=Math.min(v,g);if(0===v||v>20)throw r();if(0===d[0])throw t();if(0===g||g>20)throw r();if(0===p[0])throw t();if(1!==d[0]){for(var y=0;y0&&void 0!==arguments[0]?arguments[0]:0;if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){C(this);var n=function t(){e._nativeOscillatorNode.removeEventListener("ended",t),H(e)&&E(e)};this._nativeOscillatorNode.addEventListener("ended",n)}}},{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._nativeOscillatorNode.stop(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=e)}}]),l}(e)}(nr,gr,Gr,function(e,t,n,r,i){return function(){var a=new WeakMap,o=null,s=null,u=null,l=function(){var l=Object(L.a)(N.a.mark((function l(c,f,h){var d,p,v;return N.a.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(d=n(c),(p=z(d,f))||(v={channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:null===o?void 0:o,type:d.type},d=t(f,v),null!==s&&d.start(s),null!==u&&d.stop(u)),a.set(f,d),p){l.next=11;break}return l.next=7,r(f,c.detune,d.detune,h);case 7:return l.next=9,r(f,c.frequency,d.frequency,h);case 9:l.next=15;break;case 11:return l.next=13,e(f,c.detune,d.detune,h);case 13:return l.next=15,e(f,c.frequency,d.frequency,h);case 15:return l.next=17,i(c,f,d,h);case 17:return l.abrupt("return",d);case 18:case"end":return l.stop()}}),l)})));return function(e,t,n){return l.apply(this,arguments)}}();return{set periodicWave(e){o=e},set start(e){s=e},set stop(e){u=e},render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):l(e,t,n)}}}}(hr,Gr,he,pr,qn),Yn,$n,Dn),qr=(qt=dr,function(e,t){var n=qt(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),r=e.createBuffer(1,2,44100);return n.buffer=r,n.loop=!0,n.connect(t),n.start(),function(){n.stop(),n.disconnect(t)}}),Hr=function(e,t,n,r,i){return function(a,o){var s=o.curve,u=o.oversample,l=Object(at.a)(o,["curve","oversample"]),c=a.createWaveShaper(),f=a.createWaveShaper();$e(c,l),$e(f,l);var h=n(a,Object(A.a)(Object(A.a)({},l),{},{gain:1})),d=n(a,Object(A.a)(Object(A.a)({},l),{},{gain:-1})),p=n(a,Object(A.a)(Object(A.a)({},l),{},{gain:1})),v=n(a,Object(A.a)(Object(A.a)({},l),{},{gain:-1})),g=null,m=!1,y=null,b={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(e){h.channelCount=e,d.channelCount=e,c.channelCount=e,p.channelCount=e,f.channelCount=e,v.channelCount=e},get channelCountMode(){return c.channelCountMode},set channelCountMode(e){h.channelCountMode=e,d.channelCountMode=e,c.channelCountMode=e,p.channelCountMode=e,f.channelCountMode=e,v.channelCountMode=e},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(e){h.channelInterpretation=e,d.channelInterpretation=e,c.channelInterpretation=e,p.channelInterpretation=e,f.channelInterpretation=e,v.channelInterpretation=e},get context(){return c.context},get curve(){return y},set curve(n){if(null!==n&&n.length<2)throw t();if(null===n)c.curve=n,f.curve=n;else{var i=n.length,o=new Float32Array(i+2-i%2),s=new Float32Array(i+2-i%2);o[0]=n[0],s[0]=-n[i-1];for(var u=Math.ceil((i+1)/2),l=(i+1)/2-1,d=1;d2)throw o();if("max"===O.channelCountMode)throw o();$e(C,O);var T={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},E=n(l,Object(A.a)(Object(A.a)({},T),{},{channelInterpretation:"speakers",numberOfInputs:6})),j=r(l,Object(A.a)(Object(A.a)({},O),{},{gain:1})),P=r(l,Object(A.a)(Object(A.a)({},T),{},{gain:1})),M=r(l,Object(A.a)(Object(A.a)({},T),{},{gain:0})),R=r(l,Object(A.a)(Object(A.a)({},T),{},{gain:0})),I=r(l,Object(A.a)(Object(A.a)({},T),{},{gain:0})),D=r(l,Object(A.a)(Object(A.a)({},T),{},{gain:0})),N=r(l,Object(A.a)(Object(A.a)({},T),{},{gain:0})),L=i(l,256,6,1),z=a(l,Object(A.a)(Object(A.a)({},T),{},{curve:new Float32Array([1,1]),oversample:"none"})),F=[g,m,y],B=[_,k,w];L.onaudioprocess=function(e){var t=e.inputBuffer,n=[t.getChannelData(0)[0],t.getChannelData(1)[0],t.getChannelData(2)[0]];n.some((function(e,t){return e!==F[t]}))&&(C.setOrientation.apply(C,n),F=n);var r=[t.getChannelData(3)[0],t.getChannelData(4)[0],t.getChannelData(5)[0]];r.some((function(e,t){return e!==B[t]}))&&(C.setPosition.apply(C,r),B=r)},Object.defineProperty(M.gain,"defaultValue",{get:function(){return 0}}),Object.defineProperty(R.gain,"defaultValue",{get:function(){return 0}}),Object.defineProperty(I.gain,"defaultValue",{get:function(){return 0}}),Object.defineProperty(D.gain,"defaultValue",{get:function(){return 0}}),Object.defineProperty(N.gain,"defaultValue",{get:function(){return 0}});var V={get bufferSize(){},get channelCount(){return C.channelCount},set channelCount(e){if(e>2)throw o();j.channelCount=e,C.channelCount=e},get channelCountMode(){return C.channelCountMode},set channelCountMode(e){if("max"===e)throw o();j.channelCountMode=e,C.channelCountMode=e},get channelInterpretation(){return C.channelInterpretation},set channelInterpretation(e){j.channelInterpretation=e,C.channelInterpretation=e},get coneInnerAngle(){return C.coneInnerAngle},set coneInnerAngle(e){C.coneInnerAngle=e},get coneOuterAngle(){return C.coneOuterAngle},set coneOuterAngle(e){C.coneOuterAngle=e},get coneOuterGain(){return C.coneOuterGain},set coneOuterGain(e){if(e<0||e>1)throw t();C.coneOuterGain=e},get context(){return C.context},get distanceModel(){return C.distanceModel},set distanceModel(e){C.distanceModel=e},get inputs(){return[j]},get maxDistance(){return C.maxDistance},set maxDistance(e){if(e<0)throw new RangeError;C.maxDistance=e},get numberOfInputs(){return C.numberOfInputs},get numberOfOutputs(){return C.numberOfOutputs},get orientationX(){return P.gain},get orientationY(){return M.gain},get orientationZ(){return R.gain},get panningModel(){return C.panningModel},set panningModel(e){C.panningModel=e},get positionX(){return I.gain},get positionY(){return D.gain},get positionZ(){return N.gain},get refDistance(){return C.refDistance},set refDistance(e){if(e<0)throw new RangeError;C.refDistance=e},get rolloffFactor(){return C.rolloffFactor},set rolloffFactor(e){if(e<0)throw new RangeError;C.rolloffFactor=e},addEventListener:function(){return j.addEventListener(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])},dispatchEvent:function(){return j.dispatchEvent(arguments.length<=0?void 0:arguments[0])},removeEventListener:function(){return j.removeEventListener(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])}};f!==V.coneInnerAngle&&(V.coneInnerAngle=f),h!==V.coneOuterAngle&&(V.coneOuterAngle=h),d!==V.coneOuterGain&&(V.coneOuterGain=d),p!==V.distanceModel&&(V.distanceModel=p),v!==V.maxDistance&&(V.maxDistance=v),g!==V.orientationX.value&&(V.orientationX.value=g),m!==V.orientationY.value&&(V.orientationY.value=m),y!==V.orientationZ.value&&(V.orientationZ.value=y),b!==V.panningModel&&(V.panningModel=b),_!==V.positionX.value&&(V.positionX.value=_),k!==V.positionY.value&&(V.positionY.value=k),w!==V.positionZ.value&&(V.positionZ.value=w),x!==V.refDistance&&(V.refDistance=x),S!==V.rolloffFactor&&(V.rolloffFactor=S),1===F[0]&&0===F[1]&&0===F[2]||C.setOrientation.apply(C,Object(X.a)(F)),0===B[0]&&0===B[1]&&0===B[2]||C.setPosition.apply(C,Object(X.a)(B));return u(ot(V,C),(function(){j.connect(C),e(j,z,0,0),z.connect(P).connect(E,0,0),z.connect(M).connect(E,0,1),z.connect(R).connect(E,0,2),z.connect(I).connect(E,0,3),z.connect(D).connect(E,0,4),z.connect(N).connect(E,0,5),E.connect(L).connect(l.destination)}),(function(){j.disconnect(C),s(j,z,0,0),z.disconnect(P),P.disconnect(E),z.disconnect(M),M.disconnect(E),z.disconnect(R),R.disconnect(E),z.disconnect(I),I.disconnect(E),z.disconnect(D),D.disconnect(E),z.disconnect(N),N.disconnect(E),E.disconnect(L),L.disconnect(l.destination)}))}}(se,Be,Sr,ut,_n,Yr,kn,fe,wr),$r=(Ht=Xr,function(e,t){var n=e.createPanner();return void 0===n.orientationX?Ht(e,t):($e(n,t),Ke(n,t,"orientationX"),Ke(n,t,"orientationY"),Ke(n,t,"orientationZ"),Ke(n,t,"positionX"),Ke(n,t,"positionY"),Ke(n,t,"positionZ"),Xe(n,t,"coneInnerAngle"),Xe(n,t,"coneOuterAngle"),Xe(n,t,"coneOuterGain"),Xe(n,t,"distanceModel"),Xe(n,t,"maxDistance"),Xe(n,t,"panningModel"),Xe(n,t,"refDistance"),Xe(n,t,"rolloffFactor"),n)}),Qr=function(e,t,n,r,i,a,s){return function(e){Object(M.a)(l,e);var u=Object(R.a)(l);function l(e,c){var f;Object(o.a)(this,l);var h=i(e),d=Object(A.a)(Object(A.a)({},Sn),c),p=n(h,d),v=a(h),g=v?r():null;return(f=u.call(this,e,!1,p,g))._nativePannerNode=p,f._orientationX=t(Object(G.a)(f),v,p.orientationX,q,U),f._orientationY=t(Object(G.a)(f),v,p.orientationY,q,U),f._orientationZ=t(Object(G.a)(f),v,p.orientationZ,q,U),f._positionX=t(Object(G.a)(f),v,p.positionX,q,U),f._positionY=t(Object(G.a)(f),v,p.positionY,q,U),f._positionZ=t(Object(G.a)(f),v,p.positionZ,q,U),s(Object(G.a)(f),1),f}return Object(P.a)(l,[{key:"coneInnerAngle",get:function(){return this._nativePannerNode.coneInnerAngle},set:function(e){this._nativePannerNode.coneInnerAngle=e}},{key:"coneOuterAngle",get:function(){return this._nativePannerNode.coneOuterAngle},set:function(e){this._nativePannerNode.coneOuterAngle=e}},{key:"coneOuterGain",get:function(){return this._nativePannerNode.coneOuterGain},set:function(e){this._nativePannerNode.coneOuterGain=e}},{key:"distanceModel",get:function(){return this._nativePannerNode.distanceModel},set:function(e){this._nativePannerNode.distanceModel=e}},{key:"maxDistance",get:function(){return this._nativePannerNode.maxDistance},set:function(e){this._nativePannerNode.maxDistance=e}},{key:"orientationX",get:function(){return this._orientationX}},{key:"orientationY",get:function(){return this._orientationY}},{key:"orientationZ",get:function(){return this._orientationZ}},{key:"panningModel",get:function(){return this._nativePannerNode.panningModel},set:function(e){this._nativePannerNode.panningModel=e}},{key:"positionX",get:function(){return this._positionX}},{key:"positionY",get:function(){return this._positionY}},{key:"positionZ",get:function(){return this._positionZ}},{key:"refDistance",get:function(){return this._nativePannerNode.refDistance},set:function(e){this._nativePannerNode.refDistance=e}},{key:"rolloffFactor",get:function(){return this._nativePannerNode.rolloffFactor},set:function(e){this._nativePannerNode.rolloffFactor=e}}]),l}(e)}(nr,gr,$r,function(e,t,n,r,i,a,o,s,u,l){return function(){var c=new WeakMap,f=null,h=function(){var h=Object(L.a)(N.a.mark((function h(d,p,v){var g,m,y,b,_,k,w;return N.a.wrap((function(h){for(;;)switch(h.prev=h.next){case 0:if(g=null,m=a(d),y={channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation},b=Object(A.a)(Object(A.a)({},y),{},{coneInnerAngle:m.coneInnerAngle,coneOuterAngle:m.coneOuterAngle,coneOuterGain:m.coneOuterGain,distanceModel:m.distanceModel,maxDistance:m.maxDistance,panningModel:m.panningModel,refDistance:m.refDistance,rolloffFactor:m.rolloffFactor}),_=z(m,p),"bufferSize"in m?g=r(p,Object(A.a)(Object(A.a)({},y),{},{gain:1})):_||(k=Object(A.a)(Object(A.a)({},b),{},{orientationX:m.orientationX.value,orientationY:m.orientationY.value,orientationZ:m.orientationZ.value,positionX:m.positionX.value,positionY:m.positionY.value,positionZ:m.positionZ.value}),m=i(p,k)),c.set(p,null===g?m:g),null===g){h.next=12;break}return h.delegateYield(N.a.mark((function e(){var a,c,h,m,_,k,w,x,S,O,C,T,E,j;return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==f){e.next=7;break}if(null!==o){e.next=3;break}throw new Error("Missing the native OfflineAudioContext constructor.");case 3:a=new o(6,d.context.length,p.sampleRate),(c=t(a,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6})).connect(a.destination),f=Object(L.a)(N.a.mark((function e(){var t,r;return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([d.orientationX,d.orientationY,d.orientationZ,d.positionX,d.positionY,d.positionZ].map(function(){var e=Object(L.a)(N.a.mark((function e(t,r){var i;return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n(a,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===r?1:0}),e.next=3,s(a,t,i.offset,v);case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 2:for(t=e.sent,r=0;r<6;r+=1)t[r].connect(c,0,r),t[r].start(0);return e.abrupt("return",l(a));case 5:case"end":return e.stop()}}),e)})))();case 7:return e.next=9,f;case 9:return h=e.sent,m=r(p,Object(A.a)(Object(A.a)({},y),{},{gain:1})),e.next=13,u(d,p,m,v);case 13:for(_=[],k=0;kg){var y=(m-g)/(16384-g)*u;h[m]=Math.cos(y),d[m]=Math.sin(y),p[m]=0,v[m]=1}else{var b=m/(16384-g)*u;h[m]=1,d[m]=0,p[m]=Math.cos(b),v[m]=Math.sin(b)}var _=t(e,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),k=n(e,Object(A.a)(Object(A.a)({},l),{},{gain:0})),w=r(e,Object(A.a)(Object(A.a)({},c),{},{curve:h})),x=n(e,Object(A.a)(Object(A.a)({},l),{},{gain:0})),S=r(e,Object(A.a)(Object(A.a)({},c),{},{curve:d})),O=r(e,Object(A.a)(Object(A.a)({},c),{},{curve:s})),C=n(e,Object(A.a)(Object(A.a)({},l),{},{gain:0})),T=r(e,Object(A.a)(Object(A.a)({},c),{},{curve:p})),E=n(e,Object(A.a)(Object(A.a)({},l),{},{gain:0})),j=r(e,Object(A.a)(Object(A.a)({},c),{},{curve:v}));return{connectGraph:function(){i.connect(_),i.connect(void 0===O.inputs?O:O.inputs[0]),_.connect(k,0),_.connect(x,0),_.connect(C,1),_.connect(E,1),O.connect(a),a.connect(void 0===w.inputs?w:w.inputs[0]),a.connect(void 0===S.inputs?S:S.inputs[0]),a.connect(void 0===T.inputs?T:T.inputs[0]),a.connect(void 0===j.inputs?j:j.inputs[0]),w.connect(k.gain),S.connect(x.gain),T.connect(C.gain),j.connect(E.gain),k.connect(f,0,0),C.connect(f,0,0),x.connect(f,0,1),E.connect(f,0,1)},disconnectGraph:function(){i.disconnect(_),i.disconnect(void 0===O.inputs?O:O.inputs[0]),_.disconnect(k,0),_.disconnect(x,0),_.disconnect(C,1),_.disconnect(E,1),O.disconnect(a),a.disconnect(void 0===w.inputs?w:w.inputs[0]),a.disconnect(void 0===S.inputs?S:S.inputs[0]),a.disconnect(void 0===T.inputs?T:T.inputs[0]),a.disconnect(void 0===j.inputs?j:j.inputs[0]),w.disconnect(k.gain),S.disconnect(x.gain),T.disconnect(C.gain),j.disconnect(E.gain),k.disconnect(f,0,0),C.disconnect(f,0,0),x.disconnect(f,0,1),E.disconnect(f,0,1)}}}(e,f,h,d);throw i()};return function(t,r){var o=r.channelCount,s=r.channelCountMode,u=r.pan,l=Object(at.a)(r,["channelCount","channelCountMode","pan"]);if("max"===s)throw i();var c=e(t,Object(A.a)(Object(A.a)({},l),{},{channelCount:1,channelCountMode:s,numberOfInputs:2})),h=n(t,Object(A.a)(Object(A.a)({},l),{},{channelCount:o,channelCountMode:s,gain:1})),d=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:u}),p=f(t,o,h,d,c),v=p.connectGraph,g=p.disconnectGraph;Object.defineProperty(d.gain,"defaultValue",{get:function(){return 0}}),Object.defineProperty(d.gain,"maxValue",{get:function(){return 1}}),Object.defineProperty(d.gain,"minValue",{get:function(){return-1}});var m={get bufferSize(){},get channelCount(){return h.channelCount},set channelCount(e){if(h.channelCount!==e){y&&g();var n=f(t,e,h,d,c);v=n.connectGraph,g=n.disconnectGraph,y&&v()}h.channelCount=e},get channelCountMode(){return h.channelCountMode},set channelCountMode(e){if("clamped-max"===e||"max"===e)throw i();h.channelCountMode=e},get channelInterpretation(){return h.channelInterpretation},set channelInterpretation(e){h.channelInterpretation=e},get context(){return h.context},get inputs(){return[h]},get numberOfInputs(){return h.numberOfInputs},get numberOfOutputs(){return h.numberOfOutputs},get pan(){return d.gain},addEventListener:function(){return h.addEventListener(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])},dispatchEvent:function(){return h.dispatchEvent(arguments.length<=0?void 0:arguments[0])},removeEventListener:function(){return h.removeEventListener(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2])}},y=!1;return a(ot(m,c),(function(){v(),y=!0}),(function(){g(),y=!1}))}}(Sr,it,ut,Yr,kn,wr),kn),Jr=function(e,t,n,r,i,a){return function(e){Object(M.a)(u,e);var s=Object(R.a)(u);function u(e,l){var c;Object(o.a)(this,u);var f=i(e),h=Object(A.a)(Object(A.a)({},Cn),l),d=n(f,h),p=a(f),v=p?r():null;return(c=s.call(this,e,!1,d,v))._pan=t(Object(G.a)(c),p,d.pan),c}return Object(P.a)(u,[{key:"pan",get:function(){return this._pan}}]),u}(e)}(nr,gr,Zr,function(e,t,n,r,i){return function(){var a=new WeakMap,o=function(){var o=Object(L.a)(N.a.mark((function o(s,u,l){var c,f,h;return N.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(c=n(s),(f=z(c,u))||(h={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,pan:c.pan.value},c=t(u,h)),a.set(u,c),f){o.next=9;break}return o.next=7,r(u,s.pan,c.pan,l);case 7:o.next=11;break;case 9:return o.next=11,e(u,s.pan,c.pan,l);case 11:if(!oe(c)){o.next=16;break}return o.next=14,i(s,u,c.inputs[0],l);case 14:o.next=18;break;case 16:return o.next=18,i(s,u,c,l);case 18:return o.abrupt("return",c);case 19:case"end":return o.stop()}}),o)})));return function(e,t,n){return o.apply(this,arguments)}}();return{render:function(e,t,n){var r=a.get(t);return void 0!==r?Promise.resolve(r):o(e,t,n)}}}}(hr,Zr,he,pr,qn),Yn,$n),ei=function(e,t,n){return function(){var r=new WeakMap,i=function(){var i=Object(L.a)(N.a.mark((function i(a,o,s){var u,l;return N.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(u=t(a),z(u,o)||(l={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,curve:u.curve,oversample:u.oversample},u=e(o,l)),r.set(o,u),!oe(u)){i.next=9;break}return i.next=7,n(a,o,u.inputs[0],s);case 7:i.next=11;break;case 9:return i.next=11,n(a,o,u,s);case 11:return i.abrupt("return",u);case 12:case"end":return i.stop()}}),i)})));return function(e,t,n){return i.apply(this,arguments)}}();return{render:function(e,t,n){var a=r.get(t);return void 0!==a?Promise.resolve(a):i(e,t,n)}}}}(Yr,he,qn),ti=function(e,t,n,r,i,a,s){return function(e){Object(M.a)(l,e);var u=Object(R.a)(l);function l(e,t){var c;Object(o.a)(this,l);var f=i(e),h=Object(A.a)(Object(A.a)({},En),t),d=n(f,h),p=a(f)?r():null;return(c=u.call(this,e,!0,d,p))._isCurveNullified=!1,c._nativeWaveShaperNode=d,s(Object(G.a)(c),1),c}return Object(P.a)(l,[{key:"curve",get:function(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve},set:function(e){if(null===e)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}},{key:"oversample",get:function(){return this._nativeWaveShaperNode.oversample},set:function(e){this._nativeWaveShaperNode.oversample=e}}]),l}(e)}(nr,Be,Yr,ei,Yn,$n,_r),ni=function(e){return null!==e&&e.isSecureContext}(Wn),ri=function(e){return function(t,n,r){Object.defineProperties(e,{currentFrame:{configurable:!0,get:function(){return Math.round(t*n)}},currentTime:{configurable:!0,get:function(){return t}}});try{return r()}finally{null!==e&&(delete e.currentFrame,delete e.currentTime)}}}(Wn),ii=new WeakMap,ai=function(e,t){return function(n){var r=e.get(n);if(void 0!==r)return r;if(null===t)throw new Error("Missing the native OfflineAudioContext constructor.");return r=new t(1,1,44100),e.set(n,r),r}}(ii,Xn),oi=function(e){return null===e?null:e.hasOwnProperty("AudioWorkletNode")?e.AudioWorkletNode:null}(Wn),si=ni?function(e,t,n,r,i,s,u,l,c,f,h,d){return function(p,g){var m=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{credentials:"omit"},y=s(p);if(void 0!==y.audioWorklet)return Promise.all([i(g),Promise.resolve(e(h,h))]).then((function(e){var t=Object(a.a)(e,2),n=Object(a.a)(t[0],2),r=n[0],i=n[1],o=t[1],s=b(r,i),c=Object(a.a)(s,2),f=c[0],h=c[1],d=o?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}",p=o?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));",v=o?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));",g="".concat(f,";((AudioWorkletProcessor,registerProcessor)=>{").concat(h,"\n})(").concat(d,",(n,p)=>registerProcessor(n,class extends p{").concat(p,"process(i,o,p){").concat(v,"return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac',class extends AudioWorkletProcessor{process(){return !1}})"),_=new Blob([g],{type:"application/javascript; charset=utf-8"}),k=URL.createObjectURL(_);return y.audioWorklet.addModule(k,m).then((function(){if(l(y))return y;var e=u(y);return e.audioWorklet.addModule(k,m).then((function(){return e}))})).then((function(e){try{new AudioWorkletNode(e,"__sac")}catch(t){throw new SyntaxError}})).finally((function(){return URL.revokeObjectURL(k)}))}));var w=f.get(p);if(void 0!==w&&w.has(g))return Promise.resolve();var x=c.get(p);if(void 0!==x){var S=x.get(g);if(void 0!==S)return S}var O=i(g).then((function(e){var t=Object(a.a)(e,2),r=t[0],i=t[1],o=b(r,i),s=Object(a.a)(o,2),u=s[0],l=s[1],c="".concat(u,";((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{").concat(l,"\n})})(window,'_AWGS')");return n(c)})).then((function(){var e=d._AWGS.pop();if(void 0===e)throw new SyntaxError;r(y.currentTime,y.sampleRate,(function(){return e((function e(){Object(o.a)(this,e)}),void 0,(function(e,n){if(""===e.trim())throw t();var r=v.get(y);if(void 0!==r){if(r.has(e))throw t();k(n),_(n.parameterDescriptors),r.set(e,n)}else k(n),_(n.parameterDescriptors),v.set(y,new Map([[e,n]]))}),y.sampleRate,void 0,void 0)}))}));return void 0===x?c.set(p,new Map([[g,O]])):x.set(g,O),O.then((function(){var e=f.get(p);void 0===e?f.set(p,new Set([g])):e.add(g)})).finally((function(){var e=c.get(p);void 0!==e&&e.delete(g)})),O}}(Vn,kn,function(e){return function(t){return new Promise((function(n,r){if(null!==e){var i=e.document.head;if(null===i)r(new SyntaxError);else{var a=e.document.createElement("script"),o=new Blob([t],{type:"application/javascript"}),s=URL.createObjectURL(o),u=e.onerror,l=function(){e.onerror=u,URL.revokeObjectURL(s)};e.onerror=function(t,n,i,a,o){return n===s||n===e.location.href&&1===i&&1===a?(l(),r(o),!1):null!==u?u(t,n,i,a,o):void 0},a.onerror=function(){l(),r(new SyntaxError)},a.onload=function(){l(),n()},a.src=s,a.type="module",i.appendChild(a)}}else r(new SyntaxError)}))}}(Wn),ri,(Yt=function(){return new DOMException("","AbortError")},function(){var e=Object(L.a)(N.a.mark((function e(t){var n;return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(t);case 3:if(!(n=e.sent).ok){e.next=10;break}return e.next=7,n.text();case 7:return e.t0=e.sent,e.t1=n.url,e.abrupt("return",[e.t0,e.t1]);case 10:e.next=14;break;case 12:e.prev=12,e.t2=e.catch(0);case 14:throw Yt();case 15:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(t){return e.apply(this,arguments)}}()),Yn,ai,$n,new WeakMap,new WeakMap,function(e,t){return Object(L.a)(N.a.mark((function n(){var r,i,a,o,s,u,l;return N.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null!==e){n.next=2;break}return n.abrupt("return",!0);case 2:if(null!==t){n.next=4;break}return n.abrupt("return",!1);case 4:return r=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),i=new t(1,128,44100),a=URL.createObjectURL(r),o=!1,s=!1,n.prev=9,n.next=12,i.audioWorklet.addModule(a);case 12:return u=new e(i,"a",{numberOfOutputs:0}),l=i.createOscillator(),u.port.onmessage=function(){return o=!0},u.onprocessorerror=function(){return s=!0},l.connect(u),l.start(0),n.next=20,i.startRendering();case 20:n.next=24;break;case 22:n.prev=22,n.t0=n.catch(9);case 24:return n.prev=24,URL.revokeObjectURL(a),n.finish(24);case 27:return n.abrupt("return",o&&!s);case 28:case"end":return n.stop()}}),n,null,[[9,22,24,27]])})))}(oi,Xn),Wn):void 0,ui=function(e,t){return function(n){return e(n)||t(n)}}(Jn,$n),li=function(e,t,n,r,i,a,o,s,u,l,c){return function(f,h){var d=o(f)?f:a(f);if(i.has(h)){var p=n();return Promise.reject(p)}try{i.add(h)}catch(v){}return t(u,(function(){return u(d)}))?d.decodeAudioData(h).then((function(n){return Object(L.a)(N.a.mark((function e(){return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,De(h);case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))(),t(s,(function(){return s(n)}))||c(n),e.add(n),n})):new Promise((function(t,n){var i=function(){var e=Object(L.a)(N.a.mark((function e(){return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,De(h);case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),a=function(e){n(e),i()};try{d.decodeAudioData(h,(function(n){"function"!==typeof n.copyFromChannel&&(l(n),V(n)),e.add(n),i().then((function(){return t(n)}))}),(function(e){a(null===e?r():e)}))}catch(p){a(p)}}))}}(ir,Vn,(function(){return new DOMException("","DataCloneError")}),(function(){return new DOMException("","EncodingError")}),new WeakSet,Yn,ui,F,He,sr,ur),ci=(Xt=si,$t=rr,Qt=lr,Kt=mr,Zt=kr,Jt=Or,en=Cr,tn=jr,nn=Pr,rn=li,an=Mr,on=Ir,sn=Dr,un=Fr,ln=Ur,cn=Qr,fn=Kr,hn=Jr,dn=ti,function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e,r){var i;return Object(o.a)(this,n),(i=t.call(this,e,r))._nativeContext=e,i._audioWorklet=void 0===Xt?void 0:{addModule:function(e,t){return Xt(Object(G.a)(i),e,t)}},i}return Object(P.a)(n,[{key:"audioWorklet",get:function(){return this._audioWorklet}},{key:"createAnalyser",value:function(){return new $t(this)}},{key:"createBiquadFilter",value:function(){return new Zt(this)}},{key:"createBuffer",value:function(e,t,n){return new Qt({length:t,numberOfChannels:e,sampleRate:n})}},{key:"createBufferSource",value:function(){return new Kt(this)}},{key:"createChannelMerger",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6;return new Jt(this,{numberOfInputs:e})}},{key:"createChannelSplitter",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6;return new en(this,{numberOfOutputs:e})}},{key:"createConstantSource",value:function(){return new tn(this)}},{key:"createConvolver",value:function(){return new nn(this)}},{key:"createDelay",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new an(this,{maxDelayTime:e})}},{key:"createDynamicsCompressor",value:function(){return new on(this)}},{key:"createGain",value:function(){return new sn(this)}},{key:"createIIRFilter",value:function(e,t){return new un(this,{feedback:t,feedforward:e})}},{key:"createOscillator",value:function(){return new ln(this)}},{key:"createPanner",value:function(){return new cn(this)}},{key:"createPeriodicWave",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{disableNormalization:!1};return new fn(this,Object(A.a)(Object(A.a)({},n),{},{imag:t,real:e}))}},{key:"createStereoPanner",value:function(){return new hn(this)}},{key:"createWaveShaper",value:function(){return new dn(this)}},{key:"decodeAudioData",value:function(e,t,n){return rn(this._nativeContext,e).then((function(e){return"function"===typeof t&&t(e),e})).catch((function(e){throw"function"===typeof n&&n(e),e}))}}]),n}(Wr)),fi=function(e,t,n,r){return function(e){Object(M.a)(a,e);var i=Object(R.a)(a);function a(e,s){var u;Object(o.a)(this,a);var l=n(e),c=t(l,s);if(r(l))throw TypeError();return(u=i.call(this,e,!0,c,null))._nativeMediaElementAudioSourceNode=c,u}return Object(P.a)(a,[{key:"mediaElement",get:function(){return this._nativeMediaElementAudioSourceNode.mediaElement}}]),a}(e)}(nr,(function(e,t){return e.createMediaElementSource(t.mediaElement)}),Yn,$n),hi=function(e,t,n,r){return function(e){Object(M.a)(a,e);var i=Object(R.a)(a);function a(e,s){var u;Object(o.a)(this,a);var l=n(e);if(r(l))throw new TypeError;var c=Object(A.a)(Object(A.a)({},qe),s),f=t(l,c);return(u=i.call(this,e,!1,f,null))._nativeMediaStreamAudioDestinationNode=f,u}return Object(P.a)(a,[{key:"stream",get:function(){return this._nativeMediaStreamAudioDestinationNode.stream}}]),a}(e)}(nr,(function(e,t){var n=e.createMediaStreamDestination();return $e(n,t),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:function(){return 0}}),n}),Yn,$n),di=function(e,t,n,r){return function(e){Object(M.a)(a,e);var i=Object(R.a)(a);function a(e,s){var u;Object(o.a)(this,a);var l=n(e),c=t(l,s);if(r(l))throw new TypeError;return(u=i.call(this,e,!0,c,null))._nativeMediaStreamAudioSourceNode=c,u}return Object(P.a)(a,[{key:"mediaStream",get:function(){return this._nativeMediaStreamAudioSourceNode.mediaStream}}]),a}(e)}(nr,(function(e,t){var n=t.mediaStream,r=n.getAudioTracks();r.sort((function(e,t){return e.idt.id?1:0}));var i=r.slice(0,1),a=e.createMediaStreamSource(new MediaStream(i));return Object.defineProperty(a,"mediaStream",{value:n}),a}),Yn,$n),pi=function(e,t,n){return function(e){Object(M.a)(i,e);var r=Object(R.a)(i);function i(e,a){Object(o.a)(this,i);var s=n(e),u=t(s,a);return r.call(this,e,!0,u,null)}return i}(e)}(nr,function(e,t){return function(n,r){var i=r.mediaStreamTrack;if("function"===typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(i);var a=new MediaStream([i]),o=n.createMediaStreamSource(a);if("audio"!==i.kind)throw e();if(t(n))throw new TypeError;return o}}(Be,$n),Yn),vi=function(e,t,n,r,i,a,s,u,l){return function(e){Object(M.a)(f,e);var c=Object(R.a)(f);function f(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Object(o.a)(this,f),null===l)throw new Error("Missing the native AudioContext constructor.");try{t=new l(i)}catch(d){if(12===d.code&&"sampleRate is not in range"===d.message)throw n();throw d}if(null===t)throw r();if(!ee(i.latencyHint))throw new TypeError("The provided value '".concat(i.latencyHint,"' is not a valid enum value of type AudioContextLatencyCategory."));if(void 0!==i.sampleRate&&t.sampleRate!==i.sampleRate)throw n();e=c.call(this,t,2);var a=i.latencyHint,s=t,u=s.sampleRate;if(e._baseLatency="number"===typeof t.baseLatency?t.baseLatency:"balanced"===a?512/u:"interactive"===a||void 0===a?256/u:"playback"===a?1024/u:128*Math.max(2,Math.min(128,Math.round(a*u/128)))/u,e._nativeAudioContext=t,"webkitAudioContext"===l.name?(e._nativeGainNode=t.createGain(),e._nativeOscillatorNode=t.createOscillator(),e._nativeGainNode.gain.value=1e-37,e._nativeOscillatorNode.connect(e._nativeGainNode).connect(t.destination),e._nativeOscillatorNode.start()):(e._nativeGainNode=null,e._nativeOscillatorNode=null),e._state=null,"running"===t.state){e._state="suspended";var h=function n(){"suspended"===e._state&&(e._state=null),t.removeEventListener("statechange",n)};t.addEventListener("statechange",h)}return e}return Object(P.a)(f,[{key:"baseLatency",get:function(){return this._baseLatency}},{key:"state",get:function(){return null!==this._state?this._state:this._nativeAudioContext.state}},{key:"close",value:function(){var e=this;return"closed"===this.state?this._nativeAudioContext.close().then((function(){throw t()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((function(){null!==e._nativeGainNode&&null!==e._nativeOscillatorNode&&(e._nativeOscillatorNode.stop(),e._nativeGainNode.disconnect(),e._nativeOscillatorNode.disconnect()),J(e)})))}},{key:"createMediaElementSource",value:function(e){return new i(this,{mediaElement:e})}},{key:"createMediaStreamDestination",value:function(){return new a(this)}},{key:"createMediaStreamSource",value:function(e){return new s(this,{mediaStream:e})}},{key:"createMediaStreamTrackSource",value:function(e){return new u(this,{mediaStreamTrack:e})}},{key:"resume",value:function(){var e=this;return"suspended"===this._state?new Promise((function(t,n){e._nativeAudioContext.addEventListener("statechange",(function r(){e._nativeAudioContext.removeEventListener("statechange",r),"running"===e._nativeAudioContext.state?t():e.resume().then(t,n)}))})):this._nativeAudioContext.resume().catch((function(e){if(void 0===e||15===e.code)throw t();throw e}))}},{key:"suspend",value:function(){return this._nativeAudioContext.suspend().catch((function(e){if(void 0===e)throw t();throw e}))}}]),f}(e)}(ci,Be,kn,Tn,fi,hi,di,pi,Zn),gi=(pn=Vr,function(e){var t=pn.get(e);if(void 0===t)throw new Error("The context has no set of AudioWorkletNodes.");return t}),mi=(vn=gi,function(e,t){vn(e).add(t)}),yi=function(e){return function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=t[r];if(void 0===a)throw e();return ye(n)?a.connect(n,0,i):a.connect(n,0)}}(B),bi=function(e){return function(t,n){e(t).delete(n)}}(gi),_i=function(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return void 0===n?t.forEach((function(e){return e.disconnect()})):"number"===typeof n?Le(e,t,n).disconnect():ye(n)?void 0===r?t.forEach((function(e){return e.disconnect(n)})):void 0===i?Le(e,t,r).disconnect(n,0):Le(e,t,r).disconnect(n,0,i):void 0===r?t.forEach((function(e){return e.disconnect(n)})):Le(e,t,r).disconnect(n,0)}}(B),ki=new WeakMap,wi=function(e,t){return function(n){return t(e,n)}}(ki,w),xi=function(e,t,n,r,i,a,o,s,u,l,c,f,h){return function(d,p,v,m){if(0===m.numberOfInputs&&0===m.numberOfOutputs)throw u();var y=Array.isArray(m.outputChannelCount)?m.outputChannelCount:Array.from(m.outputChannelCount);if(y.some((function(e){return e<1})))throw u();if(y.length!==m.numberOfOutputs)throw t();if("explicit"!==m.channelCountMode)throw u();var b=m.channelCount*m.numberOfInputs,_=y.reduce((function(e,t){return e+t}),0),k=void 0===v.parameterDescriptors?0:v.parameterDescriptors.length;if(b+k>6||_>6)throw u();for(var w=new MessageChannel,x=[],S=[],O=0;O0&&R.disconnect(I);for(var e=0,t=0;e0)return re.set(n,M/128),t;var r=re.get(n);return void 0===r?[]:(t.every((function(e){return e.every((function(e){return 0===e}))}))&&(1===r?re.delete(n):re.set(n,r-1)),t)})),l=c(d.currentTime+r/d.sampleRate,d.sampleRate,(function(){return K.process(u,J,ee)}));te=l;for(var f=0,h=0;f0&&R.connect(I);for(var e=0,t=0;e0?(p.removeEventListener("statechange",t),n.stopImmediatePropagation(),u._waitForThePromiseToSettle(n)):e+=1)}}()),(u=a.call(this,p,h))._length=f,u._nativeOfflineAudioContext=p,u._state=null,u}return Object(P.a)(s,[{key:"length",get:function(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}},{key:"state",get:function(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}},{key:"startRendering",value:function(){var e=this;return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally((function(){e._state=null,J(e)})))}},{key:"_waitForThePromiseToSettle",value:function(e){var t=this;null===this._state?this._nativeOfflineAudioContext.dispatchEvent(e):setTimeout((function(){return t._waitForThePromiseToSettle(e)}))}}]),s}(e)}(ci,Vn,Be,ji,Ai)),Mi=function(e,t){return function(n){var r=e.get(n);return t(r)||t(n)}}(h,Jn),Ri=(gn=l,mn=er,function(e){return gn.has(e)||mn(e)}),Ii=(yn=f,bn=tr,function(e){return yn.has(e)||bn(e)}),Di=function(e,t){return function(n){var r=e.get(n);return t(r)||t(n)}}(h,$n);function Ni(e,t){if(!e)throw new Error(t)}function Li(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0;if(!(t<=e&&e<=n))throw new RangeError("Value must be within [".concat(t,", ").concat(n,"], got: ").concat(e))}function zi(e){e.isOffline||"running"===e.state||Vi('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}var Fi=console;function Bi(){var e;(e=Fi).log.apply(e,arguments)}function Vi(){var e;(e=Fi).warn.apply(e,arguments)}function Wi(e){return"undefined"===typeof e}function Gi(e){return!Wi(e)}function Ui(e){return"function"===typeof e}function qi(e){return"number"===typeof e}function Hi(e){return"[object Object]"===Object.prototype.toString.call(e)&&e.constructor===Object}function Yi(e){return"boolean"===typeof e}function Xi(e){return Array.isArray(e)}function $i(e){return"string"===typeof e}function Qi(e){return $i(e)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(e)}function Ki(e){return new vi(e)}function Zi(e,t,n){return new Pi(e,t,n)}var Ji="object"===typeof self?self:null,ea=Ji&&(Ji.hasOwnProperty("AudioContext")||Ji.hasOwnProperty("webkitAudioContext"));var ta=n(6),na=n(5);function ra(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}function ia(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(t){a(t)}}function s(e){try{u(r.throw(e))}catch(t){a(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))}Object.create;Object.create;"function"===typeof SuppressedError&&SuppressedError;var aa=function(){function e(t,n,r){Object(o.a)(this,e),this._callback=t,this._type=n,this._updateInterval=r,this._createClock()}return Object(P.a)(e,[{key:"_createWorker",value:function(){var e=new Blob(["\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ".concat((1e3*this._updateInterval).toFixed(1),";\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t")],{type:"text/javascript"}),t=URL.createObjectURL(e),n=new Worker(t);n.onmessage=this._callback.bind(this),this._worker=n}},{key:"_createTimeout",value:function(){var e=this;this._timeout=setTimeout((function(){e._createTimeout(),e._callback()}),1e3*this._updateInterval)}},{key:"_createClock",value:function(){if("worker"===this._type)try{this._createWorker()}catch(e){this._type="timeout",this._createClock()}else"timeout"===this._type&&this._createTimeout()}},{key:"_disposeClock",value:function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=0),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}},{key:"updateInterval",get:function(){return this._updateInterval},set:function(e){this._updateInterval=Math.max(e,128/44100),"worker"===this._type&&this._worker.postMessage(Math.max(1e3*e,1))}},{key:"type",get:function(){return this._type},set:function(e){this._disposeClock(),this._type=e,this._createClock()}},{key:"dispose",value:function(){this._disposeClock()}}]),e}();function oa(e){return Ii(e)}function sa(e){return Ri(e)}function ua(e){return Di(e)}function la(e){return Mi(e)}function ca(e){return e instanceof AudioBuffer}function fa(e,t){return"value"===e||oa(t)||sa(t)||ca(t)}function ha(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,i={},a=Array.from(t);if(Hi(a[0])&&r&&!Reflect.has(a[0],r)){var o=Object.keys(a[0]).some((function(t){return Reflect.has(e,t)}));o||(ha(i,Object(Se.a)({},r,a[0])),n.splice(n.indexOf(r),1),a.shift())}if(1===a.length&&Hi(a[0]))ha(i,a[0]);else for(var s=0;st+ma}function ba(e,t){return ya(e,t)||ka(e,t)}function _a(e,t){return e+mathis.memory){var r=this.length-this.memory;this._timeline.splice(0,r)}return this}},{key:"remove",value:function(e){var t=this._timeline.indexOf(e);return-1!==t&&this._timeline.splice(t,1),this}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"time",n=this._search(e,t);return-1!==n?this._timeline[n]:null}},{key:"peek",value:function(){return this._timeline[0]}},{key:"shift",value:function(){return this._timeline.shift()}},{key:"getAfter",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"time",n=this._search(e,t);return n+10&&this._timeline[t-1].time=0?this._timeline[n-1]:null}},{key:"cancel",value:function(e){if(this._timeline.length>1){var t=this._search(e);if(t>=0)if(ka(this._timeline[t].time,e)){for(var n=t;n>=0&&ka(this._timeline[n].time,e);n--)t=n;this._timeline=this._timeline.slice(0,t)}else this._timeline=this._timeline.slice(0,t+1);else this._timeline=[]}else 1===this._timeline.length&&ba(this._timeline[0].time,e)&&(this._timeline=[]);return this}},{key:"cancelBefore",value:function(e){var t=this._search(e);return t>=0&&(this._timeline=this._timeline.slice(t+1)),this}},{key:"previousEvent",value:function(e){var t=this._timeline.indexOf(e);return t>0?this._timeline[t-1]:null}},{key:"_search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"time";if(0===this._timeline.length)return-1;var n=0,r=this._timeline.length,i=r;if(r>0&&this._timeline[r-1][t]<=e)return r-1;for(;n1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._timeline.length-1;this._timeline.slice(t,n+1).forEach(e)}},{key:"forEach",value:function(e){return this._iterate(e),this}},{key:"forEachBefore",value:function(e,t){var n=this._search(e);return-1!==n&&this._iterate(t,0,n),this}},{key:"forEachAfter",value:function(e,t){var n=this._search(e);return this._iterate(t,n+1),this}},{key:"forEachBetween",value:function(e,t,n){var r=this._search(e),i=this._search(t);return-1!==r&&-1!==i?(this._timeline[r].time!==e&&(r+=1),this._timeline[i].time===t&&(i-=1),this._iterate(n,r,i)):-1===r&&this._iterate(n,0,i),this}},{key:"forEachFrom",value:function(e,t){for(var n=this._search(e);n>=0&&this._timeline[n].time>=e;)n--;return this._iterate(t,n+1),this}},{key:"forEachAtTime",value:function(e,t){var n=this._search(e);if(-1!==n&&ka(this._timeline[n].time,e)){for(var r=n,i=n;i>=0&&ka(this._timeline[i].time,e);i--)r=i;this._iterate((function(e){t(e)}),r,n)}return this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._timeline=[],this}}],[{key:"getDefaults",value:function(){return{memory:1/0,increasing:!1}}}]),n}(ga),Sa=[];function Oa(e){Sa.push(e)}var Ca=[];function Ta(e){Ca.push(e)}function Ea(e){Ca.forEach((function(t){return t(e)}))}var ja=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="Emitter",e}return Object(P.a)(n,[{key:"on",value:function(e,t){var n=this;return e.split(/\W+/).forEach((function(e){Wi(n._events)&&(n._events={}),n._events.hasOwnProperty(e)||(n._events[e]=[]),n._events[e].push(t)})),this}},{key:"once",value:function(e,t){var n=this;return this.on(e,(function r(){t.apply(void 0,arguments),n.off(e,r)})),this}},{key:"off",value:function(e,t){var n=this;return e.split(/\W+/).forEach((function(r){if(Wi(n._events)&&(n._events={}),n._events.hasOwnProperty(e))if(Wi(t))n._events[e]=[];else for(var i=n._events[e],a=i.length-1;a>=0;a--)i[a]===t&&i.splice(a,1)})),this}},{key:"emit",value:function(e){if(this._events&&this._events.hasOwnProperty(e)){for(var t=this._events[e].slice(0),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0,n=t?e.length:1,r=t?e[0].length:e.length,i=Ba(),a=i.createBuffer(n,r,i.sampleRate),o=t||1!==n?e:[e],s=0;s1&&void 0!==arguments[1]?arguments[1]:this.duration,r=Math.floor(e*this.sampleRate),i=Math.floor(t*this.sampleRate);Ni(r0}},{key:"duration",get:function(){return this._buffer?this._buffer.duration:0}},{key:"length",get:function(){return this._buffer?this._buffer.length:0}},{key:"numberOfChannels",get:function(){return this._buffer?this._buffer.numberOfChannels:0}},{key:"reverse",get:function(){return this._reversed},set:function(e){this._reversed!==e&&(this._reversed=e,this._reverse())}}],[{key:"getDefaults",value:function(){return{onerror:Da,onload:Da,reverse:!1}}},{key:"fromArray",value:function(e){return(new n).fromArray(e)}},{key:"fromUrl",value:function(e){return ia(this,void 0,void 0,N.a.mark((function t(){var r;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new n,t.next=3,r.load(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))}},{key:"load",value:function(e){return ia(this,void 0,void 0,N.a.mark((function t(){var r,i,a,o,s,u,l,c,f,h;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=e.match(/\[([^\]\[]+\|.+)\]$/))){t.next=23;break}i=r[1].split("|"),a=i[0],o=Object($.a)(i),t.prev=5,o.s();case 7:if((s=o.n()).done){t.next=14;break}if(u=s.value,!n.supportsType(u)){t.next=12;break}return a=u,t.abrupt("break",14);case 12:t.next=7;break;case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(5),o.e(t.t0);case 19:return t.prev=19,o.f(),t.finish(19);case 22:e=e.replace(r[0],a);case 23:return l=""===n.baseUrl||n.baseUrl.endsWith("/")?n.baseUrl:n.baseUrl+"/",t.next=26,fetch(l+e);case 26:if((c=t.sent).ok){t.next=29;break}throw new Error("could not load url: ".concat(e));case 29:return t.next=31,c.arrayBuffer();case 31:return f=t.sent,t.next=34,Ba().decodeAudioData(f);case 34:return h=t.sent,t.abrupt("return",h);case 36:case"end":return t.stop()}}),t,null,[[5,16,19,22]])})))}},{key:"supportsType",value:function(e){var t=e.split("."),n=t[t.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}},{key:"loaded",value:function(){return ia(this,void 0,void 0,N.a.mark((function e(){return N.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.resolve();case 2:if(!n.downloads.length){e.next=7;break}return e.next=5,n.downloads[0];case 5:e.next=2;break;case 7:case"end":return e.stop()}}),e)})))}}]),n}(ga);Na.baseUrl="",Na.downloads=[];var La=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.call(this,{clockSource:"offline",context:ua(arguments[0])?arguments[0]:Zi(arguments[0],arguments[1]*arguments[2],arguments[2]),lookAhead:0,updateInterval:ua(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]})).name="OfflineContext",e._currentTime=0,e.isOffline=!0,e._duration=ua(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1],e}return Object(P.a)(n,[{key:"now",value:function(){return this._currentTime}},{key:"currentTime",get:function(){return this._currentTime}},{key:"_renderClock",value:function(e){return ia(this,void 0,void 0,N.a.mark((function t(){var n,r;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0;case 1:if(!(this._duration-this._currentTime>=0)){t.next=11;break}if(this.emit("tick"),this._currentTime+=128/this.sampleRate,n++,r=Math.floor(this.sampleRate/128),!e||n%r!==0){t.next=9;break}return t.next=9,new Promise((function(e){return setTimeout(e,1)}));case 9:t.next=1;break;case 11:case"end":return t.stop()}}),t,this)})))}},{key:"render",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return ia(this,void 0,void 0,N.a.mark((function t(){var n;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.workletsAreReady();case 2:return t.next=4,this._renderClock(e);case 4:return t.next=6,this._context.startRendering();case 6:return n=t.sent,t.abrupt("return",new Na(n));case 8:case"end":return t.stop()}}),t,this)})))}},{key:"close",value:function(){return Promise.resolve()}}]),n}(Pa),za=new Ma,Fa=za;function Ba(){return Fa===za&&ea&&Va(new Pa),Fa}function Va(e){Fa=la(e)?new Pa(e):ua(e)?new La(e):e}function Wa(){return Fa.resume()}if(Ji&&!Ji.TONE_SILENCE_LOGGING){var Ga="v";0;var Ua=" * Tone.js ".concat(Ga).concat(r," * ");console.log("%c".concat(Ua),"background: #000; color: #fff")}function qa(e){return Math.pow(10,e/20)}function Ha(e){return Math.log(e)/Math.LN10*20}function Ya(e){return Math.pow(2,e/12)}var Xa=440;function $a(e){return Math.round(Qa(e))}function Qa(e){return 69+12*Math.log2(e/Xa)}function Ka(e){return Xa*Math.pow(2,(e-69)/12)}var Za=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="TimeClass",e}return Object(P.a)(n,[{key:"_getExpressions",value:function(){var e=this;return Object.assign(Object(ta.a)(Object(na.a)(n.prototype),"_getExpressions",this).call(this),{now:{method:function(t){return e._now()+new e.constructor(e.context,t).valueOf()},regexp:/^\+(.+)/},quantize:{method:function(t){var r=new n(e.context,t).valueOf();return e._secondsToUnits(e.context.transport.nextSubdivision(r))},regexp:/^@(.+)/}})}},{key:"quantize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=new this.constructor(this.context,e).valueOf(),r=this.valueOf(),i=Math.round(r/n),a=i*n,o=a-r;return r+o*t}},{key:"toNotation",value:function(){for(var e=this,t=this.toSeconds(),r=["1m"],i=1;i<9;i++){var a=Math.pow(2,i);r.push(a+"n."),r.push(a+"n"),r.push(a+"t")}r.push("0");var o=r[0],s=new n(this.context,r[0]).toSeconds();return r.forEach((function(r){var i=new n(e.context,r).toSeconds();Math.abs(i-t)3&&(r=parseFloat(parseFloat(i).toFixed(3))),[n,t,r].join(":")}},{key:"toTicks",value:function(){var e=this._beatsToUnits(1),t=this.valueOf()/e;return Math.round(t*this._getPPQ())}},{key:"toSeconds",value:function(){return this.valueOf()}},{key:"toMidi",value:function(){return $a(this.toFrequency())}},{key:"_now",value:function(){return this.context.now()}}]),n}(function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e,r,i){var a;return Object(o.a)(this,n),(a=t.call(this)).defaultUnits="s",a._val=r,a._units=i,a.context=e,a._expressions=a._getExpressions(),a}return Object(P.a)(n,[{key:"_getExpressions",value:function(){var e=this;return{hz:{method:function(t){return e._frequencyToUnits(parseFloat(t))},regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:function(t){return e._ticksToUnits(parseInt(t,10))},regexp:/^(\d+)i$/i},m:{method:function(t){return e._beatsToUnits(parseInt(t,10)*e._getTimeSignature())},regexp:/^(\d+)m$/i},n:{method:function(t,n){var r=parseInt(t,10),i="."===n?1.5:1;return 1===r?e._beatsToUnits(e._getTimeSignature())*i:e._beatsToUnits(4/r)*i},regexp:/^(\d+)n(\.?)$/i},number:{method:function(t){return e._expressions[e.defaultUnits].method.call(e,t)},regexp:/^(\d+(?:\.\d+)?)$/},s:{method:function(t){return e._secondsToUnits(parseFloat(t))},regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:function(t){return parseInt(t,10)/e.context.sampleRate},regexp:/^(\d+)samples$/},t:{method:function(t){var n=parseInt(t,10);return e._beatsToUnits(8/(3*Math.floor(n)))},regexp:/^(\d+)t$/i},tr:{method:function(t,n,r){var i=0;return t&&"0"!==t&&(i+=e._beatsToUnits(e._getTimeSignature()*parseFloat(t))),n&&"0"!==n&&(i+=e._beatsToUnits(parseFloat(n))),r&&"0"!==r&&(i+=e._beatsToUnits(parseFloat(r)/4)),i},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}},{key:"valueOf",value:function(){if(this._val instanceof n&&this.fromType(this._val),Wi(this._val))return this._noArg();if($i(this._val)&&Wi(this._units)){for(var e in this._expressions)if(this._expressions[e].regexp.test(this._val.trim())){this._units=e;break}}else if(Hi(this._val)){var t=0;for(var r in this._val)if(Gi(this._val[r])){var i=this._val[r];t+=new this.constructor(this.context,r).valueOf()*i}return t}if(Gi(this._units)){var a=this._expressions[this._units],o=this._val.toString().trim().match(a.regexp);return o?a.method.apply(this,o.slice(1)):a.method.call(this,this._val)}return $i(this._val)?parseFloat(this._val):this._val}},{key:"_frequencyToUnits",value:function(e){return 1/e}},{key:"_beatsToUnits",value:function(e){return 60/this._getBpm()*e}},{key:"_secondsToUnits",value:function(e){return e}},{key:"_ticksToUnits",value:function(e){return e*this._beatsToUnits(1)/this._getPPQ()}},{key:"_noArg",value:function(){return this._now()}},{key:"_getBpm",value:function(){return this.context.transport.bpm.value}},{key:"_getTimeSignature",value:function(){return this.context.transport.timeSignature}},{key:"_getPPQ",value:function(){return this.context.transport.PPQ}},{key:"fromType",value:function(e){switch(this._units=void 0,this.defaultUnits){case"s":this._val=e.toSeconds();break;case"i":this._val=e.toTicks();break;case"hz":this._val=e.toFrequency();break;case"midi":this._val=e.toMidi()}return this}},{key:"toFrequency",value:function(){return 1/this.toSeconds()}},{key:"toSamples",value:function(){return this.toSeconds()*this.context.sampleRate}},{key:"toMilliseconds",value:function(){return 1e3*this.toSeconds()}}]),n}(ga));var Ja=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="Frequency",e.defaultUnits="hz",e}return Object(P.a)(n,[{key:"_getExpressions",value:function(){return Object.assign({},Object(ta.a)(Object(na.a)(n.prototype),"_getExpressions",this).call(this),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method:function(e){return"midi"===this.defaultUnits?e:n.mtof(e)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method:function(e,t){var r=eo[e.toLowerCase()]+12*(parseInt(t,10)+1);return"midi"===this.defaultUnits?r:n.mtof(r)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(e,t,n){var r=1;return e&&"0"!==e&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),t&&"0"!==t&&(r*=this._beatsToUnits(parseFloat(t))),n&&"0"!==n&&(r*=this._beatsToUnits(parseFloat(n)/4)),r}}})}},{key:"transpose",value:function(e){return new n(this.context,this.valueOf()*Ya(e))}},{key:"harmonize",value:function(e){var t=this;return e.map((function(e){return t.transpose(e)}))}},{key:"toMidi",value:function(){return $a(this.valueOf())}},{key:"toNote",value:function(){var e=this.toFrequency(),t=Math.log2(e/n.A4),r=Math.round(12*t)+57,i=Math.floor(r/12);return i<0&&(r+=-12*i),to[r%12]+i.toString()}},{key:"toSeconds",value:function(){return 1/Object(ta.a)(Object(na.a)(n.prototype),"toSeconds",this).call(this)}},{key:"toTicks",value:function(){var e=this._beatsToUnits(1),t=this.valueOf()/e;return Math.floor(t*this._getPPQ())}},{key:"_noArg",value:function(){return 0}},{key:"_frequencyToUnits",value:function(e){return e}},{key:"_ticksToUnits",value:function(e){return 1/(60*e/(this._getBpm()*this._getPPQ()))}},{key:"_beatsToUnits",value:function(e){return 1/Object(ta.a)(Object(na.a)(n.prototype),"_beatsToUnits",this).call(this,e)}},{key:"_secondsToUnits",value:function(e){return 1/e}}],[{key:"A4",get:function(){return Xa},set:function(e){!function(e){Xa=e}(e)}},{key:"mtof",value:function(e){return Ka(e)}},{key:"ftom",value:function(e){return $a(e)}}]),n}(Za),eo={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},to=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];var no=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="TransportTime",e}return Object(P.a)(n,[{key:"_now",value:function(){return this.context.transport.seconds}}]),n}(Za);var ro=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),e=t.call(this);var r=da(n.getDefaults(),arguments,["context"]);return e.defaultContext?e.context=e.defaultContext:e.context=r.context,e}return Object(P.a)(n,[{key:"now",value:function(){return this.context.currentTime+this.context.lookAhead}},{key:"immediate",value:function(){return this.context.currentTime}},{key:"sampleTime",get:function(){return 1/this.context.sampleRate}},{key:"blockTime",get:function(){return 128/this.context.sampleRate}},{key:"toSeconds",value:function(e){return new Za(this.context,e).toSeconds()}},{key:"toFrequency",value:function(e){return new Ja(this.context,e).toFrequency()}},{key:"toTicks",value:function(e){return new no(this.context,e).toTicks()}},{key:"_getPartialProperties",value:function(e){var t=this.get();return Object.keys(t).forEach((function(n){Wi(e[n])&&delete t[n]})),t}},{key:"get",value:function(){var e=this,t=this.constructor.getDefaults();return Object.keys(t).forEach((function(r){if(Reflect.has(e,r)){var i=e[r];Gi(i)&&Gi(i.value)&&Gi(i.setValueAtTime)?t[r]=i.value:i instanceof n?t[r]=i._getPartialProperties(t[r]):Xi(i)||qi(i)||$i(i)||Yi(i)?t[r]=i:delete t[r]}})),t}},{key:"set",value:function(e){var t=this;return Object.keys(e).forEach((function(r){Reflect.has(t,r)&&Gi(t[r])&&(t[r]&&Gi(t[r].value)&&Gi(t[r].setValueAtTime)?t[r].value!==e[r]&&(t[r].value=e[r]):t[r]instanceof n?t[r].set(e[r]):t[r]=e[r])})),this}}],[{key:"getDefaults",value:function(){return{context:Ba()}}}]),n}(ga),io=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"stopped";return Object(o.a)(this,n),(e=t.call(this)).name="StateTimeline",e._initial=r,e.setStateAtTime(e._initial,0),e}return Object(P.a)(n,[{key:"getValueAtTime",value:function(e){var t=this.get(e);return null!==t?t.state:this._initial}},{key:"setStateAtTime",value:function(e,t,n){return Li(t,0),this.add(Object.assign({},n,{state:e,time:t})),this}},{key:"getLastState",value:function(e,t){for(var n=this._search(t);n>=0;n--){var r=this._timeline[n];if(r.state===e)return r}}},{key:"getNextState",value:function(e,t){var n=this._search(t);if(-1!==n)for(var r=n;r0,"timeConstant must be a number greater than 0");var i=this.toSeconds(t);return this._assertRange(r),Ni(isFinite(r)&&isFinite(i),"Invalid argument(s) to setTargetAtTime: ".concat(JSON.stringify(e),", ").concat(JSON.stringify(t))),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:r}),this.log(this.units,"setTargetAtTime",e,i,n),this._param.setTargetAtTime(r,i,n),this}},{key:"setValueCurveAtTime",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;n=this.toSeconds(n),t=this.toSeconds(t);var i=this._fromType(e[0])*r;this.setValueAtTime(this._toType(i),t);for(var a=n/(e.length-1),o=1;o1&&void 0!==arguments[1]?arguments[1]:.1,n=arguments.length>2?arguments[2]:void 0;return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(e,t,n):this.linearRampTo(e,t,n),this}},{key:"apply",value:function(e){var t=this.context.currentTime;e.setValueAtTime(this.getValueAtTime(t),t);var n=this._events.get(t);if(n&&"setTargetAtTime"===n.type)for(var r=this._events.getAfter(n.time),i=r?r.time:t+2,a=(i-t)/10,o=t;o0,"ToneAudioNode does not have any internal nodes");var t=e[0];return{channelCount:t.channelCount,channelCountMode:t.channelCountMode,channelInterpretation:t.channelInterpretation}}},{key:"channelCount",get:function(){return this._getChannelProperties().channelCount},set:function(e){var t=this._getChannelProperties();this._setChannelProperties(Object.assign(t,{channelCount:e}))}},{key:"channelCountMode",get:function(){return this._getChannelProperties().channelCountMode},set:function(e){var t=this._getChannelProperties();this._setChannelProperties(Object.assign(t,{channelCountMode:e}))}},{key:"channelInterpretation",get:function(){return this._getChannelProperties().channelInterpretation},set:function(e){var t=this._getChannelProperties();this._setChannelProperties(Object.assign(t,{channelInterpretation:e}))}},{key:"connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return uo(this,e,t,n),this}},{key:"toDestination",value:function(){return this.connect(this.context.destination),this}},{key:"toMaster",value:function(){return Vi("toMaster() has been renamed toDestination()"),this.toDestination()}},{key:"disconnect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return lo(this,e,t,n),this}},{key:"chain",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;for(Ni(Gi(e),"Cannot connect from undefined node"),Ni(Gi(t),"Cannot connect to undefined node"),(t instanceof oo||sa(t))&&Ni(t.numberOfInputs>0,"Cannot connect to node with no inputs"),Ni(e.numberOfOutputs>0,"Cannot connect from node with no outputs");t instanceof oo||t instanceof ao;)Gi(t.input)&&(t=t.input);for(;e instanceof oo;)Gi(e.output)&&(e=e.output);oa(t)?e.connect(t,n):e.connect(t,n,r)}function lo(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(Gi(t))for(;t instanceof oo;)t=t.input;for(;!sa(e);)Gi(e.output)&&(e=e.output);oa(t)?e.disconnect(t,n):sa(t)?e.disconnect(t,n,r):e.disconnect()}var co=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["gain","units"]))).name="Gain",e._gainNode=e.context.createGain(),e.input=e._gainNode,e.output=e._gainNode;var r=da(n.getDefaults(),arguments,["gain","units"]);return e.gain=new ao({context:e.context,convert:r.convert,param:e._gainNode.gain,units:r.units,value:r.gain,minValue:r.minValue,maxValue:r.maxValue}),Ra(Object(G.a)(e),"gain"),e}return Object(P.a)(n,[{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._gainNode.disconnect(),this.gain.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{convert:!0,gain:1,units:"gain"})}}]),n}(oo),fo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(o.a)(this,n),(r=t.call(this,e)).onended=Da,r._startTime=-1,r._stopTime=-1,r._timeout=-1,r.output=new co({context:r.context,gain:0}),r._gainNode=r.output,r.getStateAtTime=function(e){var t=this.toSeconds(e);return-1!==this._startTime&&t>=this._startTime&&(-1===this._stopTime||t<=this._stopTime)?"started":"stopped"},r._fadeIn=e.fadeIn,r._fadeOut=e.fadeOut,r._curve=e.curve,r.onended=e.onended,r}return Object(P.a)(n,[{key:"_startGain",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;Ni(-1===this._startTime,"Source cannot be started more than once");var n=this.toSeconds(this._fadeIn);return this._startTime=e+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,e),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(t,e+n):this._gainNode.gain.exponentialApproachValueAtTime(t,e,n)):this._gainNode.gain.setValueAtTime(t,e),this}},{key:"stop",value:function(e){return this.log("stop",e),this._stopGain(this.toSeconds(e)),this}},{key:"_stopGain",value:function(e){var t=this;Ni(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();var n=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(e)+n,this._stopTime=Math.max(this._stopTime,this.context.currentTime),n>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,n,e):this._gainNode.gain.targetRampTo(0,n,e):(this._gainNode.gain.cancelAndHoldAtTime(e),this._gainNode.gain.setValueAtTime(0,e)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout((function(){var e="exponential"===t._curve?2*n:0;t._stopSource(t.now()+e),t._onended()}),this._stopTime-this.context.currentTime),this}},{key:"_onended",value:function(){var e=this;if(this.onended!==Da&&(this.onended(this),this.onended=Da,!this.context.isOffline)){var t=function(){return e.dispose()};"undefined"!==typeof window.requestIdleCallback?window.requestIdleCallback(t):setTimeout(t,1e3)}}},{key:"state",get:function(){return this.getStateAtTime(this.now())}},{key:"cancelStop",value:function(){return this.log("cancelStop"),Ni(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._gainNode.disconnect(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Da})}}]),n}(oo),ho=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["offset"]))).name="ToneConstantSource",e._source=e.context.createConstantSource();var r=da(n.getDefaults(),arguments,["offset"]);return uo(e._source,e._gainNode),e.offset=new ao({context:e.context,convert:r.convert,param:e._source.offset,units:r.units,value:r.offset,minValue:r.minValue,maxValue:r.maxValue}),e}return Object(P.a)(n,[{key:"start",value:function(e){var t=this.toSeconds(e);return this.log("start",t),this._startGain(t),this._source.start(t),this}},{key:"_stopSource",value:function(e){this._source.stop(e)}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(fo.getDefaults(),{convert:!0,offset:1,units:"number"})}}]),n}(fo),po=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["value","units"]))).name="Signal",e.override=!0;var r=da(n.getDefaults(),arguments,["value","units"]);return e.output=e._constantSource=new ho({context:e.context,convert:r.convert,offset:r.value,units:r.units,minValue:r.minValue,maxValue:r.maxValue}),e._constantSource.start(0),e.input=e._param=e._constantSource.offset,e}return Object(P.a)(n,[{key:"connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return vo(this,e,t,n),this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._param.dispose(),this._constantSource.dispose(),this}},{key:"setValueAtTime",value:function(e,t){return this._param.setValueAtTime(e,t),this}},{key:"getValueAtTime",value:function(e){return this._param.getValueAtTime(e)}},{key:"setRampPoint",value:function(e){return this._param.setRampPoint(e),this}},{key:"linearRampToValueAtTime",value:function(e,t){return this._param.linearRampToValueAtTime(e,t),this}},{key:"exponentialRampToValueAtTime",value:function(e,t){return this._param.exponentialRampToValueAtTime(e,t),this}},{key:"exponentialRampTo",value:function(e,t,n){return this._param.exponentialRampTo(e,t,n),this}},{key:"linearRampTo",value:function(e,t,n){return this._param.linearRampTo(e,t,n),this}},{key:"targetRampTo",value:function(e,t,n){return this._param.targetRampTo(e,t,n),this}},{key:"exponentialApproachValueAtTime",value:function(e,t,n){return this._param.exponentialApproachValueAtTime(e,t,n),this}},{key:"setTargetAtTime",value:function(e,t,n){return this._param.setTargetAtTime(e,t,n),this}},{key:"setValueCurveAtTime",value:function(e,t,n,r){return this._param.setValueCurveAtTime(e,t,n,r),this}},{key:"cancelScheduledValues",value:function(e){return this._param.cancelScheduledValues(e),this}},{key:"cancelAndHoldAtTime",value:function(e){return this._param.cancelAndHoldAtTime(e),this}},{key:"rampTo",value:function(e,t,n){return this._param.rampTo(e,t,n),this}},{key:"value",get:function(){return this._param.value},set:function(e){this._param.value=e}},{key:"convert",get:function(){return this._param.convert},set:function(e){this._param.convert=e}},{key:"units",get:function(){return this._param.units}},{key:"overridden",get:function(){return this._param.overridden},set:function(e){this._param.overridden=e}},{key:"maxValue",get:function(){return this._param.maxValue}},{key:"minValue",get:function(){return this._param.minValue}},{key:"apply",value:function(e){return this._param.apply(e),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{convert:!0,units:"number",value:0})}}]),n}(oo);function vo(e,t,n,r){(t instanceof ao||oa(t)||t instanceof po&&t.override)&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0),t instanceof po&&(t.overridden=!0)),uo(e,t,n,r)}var go=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["value"]))).name="TickParam",e._events=new xa(1/0),e._multiplier=1;var r=da(n.getDefaults(),arguments,["value"]);return e._multiplier=r.multiplier,e._events.cancel(0),e._events.add({ticks:0,time:0,type:"setValueAtTime",value:e._fromType(r.value)}),e.setValueAtTime(r.value,0),e}return Object(P.a)(n,[{key:"setTargetAtTime",value:function(e,t,n){t=this.toSeconds(t),this.setRampPoint(t);for(var r=this._fromType(e),i=this._events.get(t),a=Math.round(Math.max(1/n,1)),o=0;o<=a;o++){var s=n*o+t,u=this._exponentialApproach(i.time,i.value,r,n,s);this.linearRampToValueAtTime(this._toType(u),s)}return this}},{key:"setValueAtTime",value:function(e,t){var r=this.toSeconds(t);Object(ta.a)(Object(na.a)(n.prototype),"setValueAtTime",this).call(this,e,t);var i=this._events.get(r),a=this._events.previousEvent(i),o=this._getTicksUntilEvent(a,r);return i.ticks=Math.max(o,0),this}},{key:"linearRampToValueAtTime",value:function(e,t){var r=this.toSeconds(t);Object(ta.a)(Object(na.a)(n.prototype),"linearRampToValueAtTime",this).call(this,e,t);var i=this._events.get(r),a=this._events.previousEvent(i),o=this._getTicksUntilEvent(a,r);return i.ticks=Math.max(o,0),this}},{key:"exponentialRampToValueAtTime",value:function(e,t){t=this.toSeconds(t);for(var n=this._fromType(e),r=this._events.get(t),i=Math.round(Math.max(10*(t-r.time),1)),a=(t-r.time)/i,o=0;o<=i;o++){var s=a*o+r.time,u=this._exponentialInterpolate(r.time,r.value,t,n,s);this.linearRampToValueAtTime(this._toType(u),s)}return this}},{key:"_getTicksUntilEvent",value:function(e,t){if(null===e)e={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Wi(e.ticks)){var n=this._events.previousEvent(e);e.ticks=this._getTicksUntilEvent(n,e.time)}var r=this._fromType(this.getValueAtTime(e.time)),i=this._fromType(this.getValueAtTime(t)),a=this._events.get(t);return a&&a.time===t&&"setValueAtTime"===a.type&&(i=this._fromType(this.getValueAtTime(t-this.sampleTime))),.5*(t-e.time)*(r+i)+e.ticks}},{key:"getTicksAtTime",value:function(e){var t=this.toSeconds(e),n=this._events.get(t);return Math.max(this._getTicksUntilEvent(n,t),0)}},{key:"getDurationOfTicks",value:function(e,t){var n=this.toSeconds(t),r=this.getTicksAtTime(t);return this.getTimeOfTick(r+e)-n}},{key:"getTimeOfTick",value:function(e){var t=this._events.get(e,"ticks"),n=this._events.getAfter(e,"ticks");if(t&&t.ticks===e)return t.time;if(t&&n&&"linearRampToValueAtTime"===n.type&&t.value!==n.value){var r=this._fromType(this.getValueAtTime(t.time)),i=(this._fromType(this.getValueAtTime(n.time))-r)/(n.time-t.time),a=Math.sqrt(Math.pow(r,2)-2*i*(t.ticks-e)),o=(-r+a)/i;return(o>0?o:(-r-a)/i)+t.time}return t?0===t.value?1/0:t.time+(e-t.ticks)/t.value:e/this._initialValue}},{key:"ticksToTime",value:function(e,t){return this.getDurationOfTicks(e,t)}},{key:"timeToTicks",value:function(e,t){var n=this.toSeconds(t),r=this.toSeconds(e),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+r)-i}},{key:"_fromType",value:function(e){return"bpm"===this.units&&this.multiplier?1/(60/e/this.multiplier):Object(ta.a)(Object(na.a)(n.prototype),"_fromType",this).call(this,e)}},{key:"_toType",value:function(e){return"bpm"===this.units&&this.multiplier?e/this.multiplier*60:Object(ta.a)(Object(na.a)(n.prototype),"_toType",this).call(this,e)}},{key:"multiplier",get:function(){return this._multiplier},set:function(e){var t=this.value;this._multiplier=e,this.cancelScheduledValues(0),this.setValueAtTime(t,0)}}],[{key:"getDefaults",value:function(){return Object.assign(ao.getDefaults(),{multiplier:1,units:"hertz",value:1})}}]),n}(ao),mo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["value"]))).name="TickSignal";var r=da(n.getDefaults(),arguments,["value"]);return e.input=e._param=new go({context:e.context,convert:r.convert,multiplier:r.multiplier,param:e._constantSource.offset,units:r.units,value:r.value}),e}return Object(P.a)(n,[{key:"ticksToTime",value:function(e,t){return this._param.ticksToTime(e,t)}},{key:"timeToTicks",value:function(e,t){return this._param.timeToTicks(e,t)}},{key:"getTimeOfTick",value:function(e){return this._param.getTimeOfTick(e)}},{key:"getDurationOfTicks",value:function(e,t){return this._param.getDurationOfTicks(e,t)}},{key:"getTicksAtTime",value:function(e){return this._param.getTicksAtTime(e)}},{key:"multiplier",get:function(){return this._param.multiplier},set:function(e){this._param.multiplier=e}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._param.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(po.getDefaults(),{multiplier:1,units:"hertz",value:1})}}]),n}(po),yo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency"]))).name="TickSource",e._state=new io,e._tickOffset=new xa;var r=da(n.getDefaults(),arguments,["frequency"]);return e.frequency=new mo({context:e.context,units:r.units,value:r.frequency}),Ra(Object(G.a)(e),"frequency"),e._state.setStateAtTime("stopped",0),e.setTicksAtTime(0,0),e}return Object(P.a)(n,[{key:"state",get:function(){return this.getStateAtTime(this.now())}},{key:"start",value:function(e,t){var n=this.toSeconds(e);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),Gi(t)&&this.setTicksAtTime(t,n)),this}},{key:"stop",value:function(e){var t=this.toSeconds(e);if("stopped"===this._state.getValueAtTime(t)){var n=this._state.get(t);n&&n.time>0&&(this._tickOffset.cancel(n.time),this._state.cancel(n.time))}return this._state.cancel(t),this._state.setStateAtTime("stopped",t),this.setTicksAtTime(0,t),this}},{key:"pause",value:function(e){var t=this.toSeconds(e);return"started"===this._state.getValueAtTime(t)&&this._state.setStateAtTime("paused",t),this}},{key:"cancel",value:function(e){return e=this.toSeconds(e),this._state.cancel(e),this._tickOffset.cancel(e),this}},{key:"getTicksAtTime",value:function(e){var t=this,n=this.toSeconds(e),r=this._state.getLastState("stopped",n),i={state:"paused",time:n};this._state.add(i);var a=r,o=0;return this._state.forEachBetween(r.time,n+this.sampleTime,(function(e){var n=a.time,r=t._tickOffset.get(e.time);r&&r.time>=a.time&&(o=r.ticks,n=r.time),"started"===a.state&&"started"!==e.state&&(o+=t.frequency.getTicksAtTime(e.time)-t.frequency.getTicksAtTime(n)),a=e})),this._state.remove(i),o}},{key:"ticks",get:function(){return this.getTicksAtTime(this.now())},set:function(e){this.setTicksAtTime(e,this.now())}},{key:"seconds",get:function(){return this.getSecondsAtTime(this.now())},set:function(e){var t=this.now(),n=this.frequency.timeToTicks(e,t);this.setTicksAtTime(n,t)}},{key:"getSecondsAtTime",value:function(e){var t=this;e=this.toSeconds(e);var n=this._state.getLastState("stopped",e),r={state:"paused",time:e};this._state.add(r);var i=n,a=0;return this._state.forEachBetween(n.time,e+this.sampleTime,(function(e){var n=i.time,r=t._tickOffset.get(e.time);r&&r.time>=i.time&&(a=r.seconds,n=r.time),"started"===i.state&&"started"!==e.state&&(a+=e.time-n),i=e})),this._state.remove(r),a}},{key:"setTicksAtTime",value:function(e,t){return t=this.toSeconds(t),this._tickOffset.cancel(t),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(e,t),ticks:e,time:t}),this}},{key:"getStateAtTime",value:function(e){return e=this.toSeconds(e),this._state.getValueAtTime(e)}},{key:"getTimeOfTick",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.now(),n=this._tickOffset.get(t),r=this._state.get(t),i=Math.max(n.time,r.time),a=this.frequency.getTicksAtTime(i)+e-n.ticks;return this.frequency.getTimeOfTick(a)}},{key:"forEachTickBetween",value:function(e,t,n){var r=this,i=this._state.get(e);this._state.forEachBetween(e,t,(function(t){i&&"started"===i.state&&"started"!==t.state&&r.forEachTickBetween(Math.max(i.time,e),t.time-r.sampleTime,n),i=t}));var a=null;if(i&&"started"===i.state){var o=Math.max(i.time,e),s=this.frequency.getTicksAtTime(o),u=s-this.frequency.getTicksAtTime(i.time),l=Math.ceil(u)-u;l=ka(l,1)?0:l;for(var c=this.frequency.getTimeOfTick(s+l);c1&&void 0!==arguments[1]?arguments[1]:this.now();return this._tickSource.getTimeOfTick(e,t)}},{key:"getTicksAtTime",value:function(e){return this._tickSource.getTicksAtTime(e)}},{key:"nextTickTime",value:function(e,t){var n=this.toSeconds(t),r=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(r+e,n)}},{key:"_loop",value:function(){var e=this,t=this._lastUpdate,n=this.now();this._lastUpdate=n,this.log("loop",t,n),t!==n&&(this._state.forEachBetween(t,n,(function(t){switch(t.state){case"started":var n=e._tickSource.getTicksAtTime(t.time);e.emit("start",t.time,n);break;case"stopped":0!==t.time&&e.emit("stop",t.time);break;case"paused":e.emit("pause",t.time)}})),this._tickSource.forEachTickBetween(t,n,(function(t,n){e.callback(t,n)})))}},{key:"getStateAtTime",value:function(e){var t=this.toSeconds(e);return this._state.getValueAtTime(t)}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(ro.getDefaults(),{callback:Da,frequency:1,units:"hertz"})}}]),n}(ro);ja.mixin(bo);var _o=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this)).name="ToneAudioBuffers",e._buffers=new Map,e._loadingCount=0;var r=da(n.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");return e.baseUrl=r.baseUrl,Object.keys(r.urls).forEach((function(t){e._loadingCount++;var n=r.urls[t];e.add(t,n,e._bufferLoaded.bind(Object(G.a)(e),r.onload),r.onerror)})),e}return Object(P.a)(n,[{key:"has",value:function(e){return this._buffers.has(e.toString())}},{key:"get",value:function(e){return Ni(this.has(e),"ToneAudioBuffers has no buffer named: ".concat(e)),this._buffers.get(e.toString())}},{key:"_bufferLoaded",value:function(e){this._loadingCount--,0===this._loadingCount&&e&&e()}},{key:"loaded",get:function(){return Array.from(this._buffers).every((function(e){var t=Object(a.a)(e,2);t[0];return t[1].loaded}))}},{key:"add",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Da,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Da;return $i(t)?this._buffers.set(e.toString(),new Na(this.baseUrl+t,n,r)):this._buffers.set(e.toString(),new Na(t,n,r)),this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._buffers.forEach((function(e){return e.dispose()})),this._buffers.clear(),this}}],[{key:"getDefaults",value:function(){return{baseUrl:"",onerror:Da,onload:Da,urls:{}}}}]),n}(ga),ko=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="MidiClass",e.defaultUnits="midi",e}return Object(P.a)(n,[{key:"_frequencyToUnits",value:function(e){return $a(Object(ta.a)(Object(na.a)(n.prototype),"_frequencyToUnits",this).call(this,e))}},{key:"_ticksToUnits",value:function(e){return $a(Object(ta.a)(Object(na.a)(n.prototype),"_ticksToUnits",this).call(this,e))}},{key:"_beatsToUnits",value:function(e){return $a(Object(ta.a)(Object(na.a)(n.prototype),"_beatsToUnits",this).call(this,e))}},{key:"_secondsToUnits",value:function(e){return $a(Object(ta.a)(Object(na.a)(n.prototype),"_secondsToUnits",this).call(this,e))}},{key:"toMidi",value:function(){return this.valueOf()}},{key:"toFrequency",value:function(){return Ka(this.toMidi())}},{key:"transpose",value:function(e){return new n(this.context,this.toMidi()+e)}}]),n}(Ja);var wo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="Ticks",e.defaultUnits="i",e}return Object(P.a)(n,[{key:"_now",value:function(){return this.context.transport.ticks}},{key:"_beatsToUnits",value:function(e){return this._getPPQ()*e}},{key:"_secondsToUnits",value:function(e){return Math.floor(e/(60/this._getBpm())*this._getPPQ())}},{key:"_ticksToUnits",value:function(e){return e}},{key:"toTicks",value:function(){return this.valueOf()}},{key:"toSeconds",value:function(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}]),n}(no);var xo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="Draw",e.expiration=.25,e.anticipation=.008,e._events=new xa,e._boundDrawLoop=e._drawLoop.bind(Object(G.a)(e)),e._animationFrame=-1,e}return Object(P.a)(n,[{key:"schedule",value:function(e,t){return this._events.add({callback:e,time:this.toSeconds(t)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}},{key:"cancel",value:function(e){return this._events.cancel(this.toSeconds(e)),this}},{key:"_drawLoop",value:function(){for(var e=this.context.currentTime;this._events.length&&this._events.peek().time-this.anticipation<=e;){var t=this._events.shift();t&&e-t.time<=this.expiration&&t.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}]),n}(ro);Oa((function(e){e.draw=new xo({context:e})})),Ta((function(e){e.draw.dispose()}));var So=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="IntervalTimeline",e._root=null,e._length=0,e}return Object(P.a)(n,[{key:"add",value:function(e){Ni(Gi(e.time),"Events must have a time property"),Ni(Gi(e.duration),"Events must have a duration parameter"),e.time=e.time.valueOf();var t=new Oo(e.time,e.time+e.duration,e);for(null===this._root?this._root=t:this._root.insert(t),this._length++;null!==t;)t.updateHeight(),t.updateMax(),this._rebalance(t),t=t.parent;return this}},{key:"remove",value:function(e){if(null!==this._root){var t=[];this._root.search(e.time,t);for(var n=0,r=t;n0)if(null===e.left.right)(t=e.left).right=e.right,n=t;else{for(t=e.left.right;null!==t.right;)t=t.right;t.parent&&(t.parent.right=t.left,n=t.parent,t.left=e.left,t.right=e.right)}else if(null===e.right.left)(t=e.right).left=e.left,n=t;else{for(t=e.right.left;null!==t.left;)t=t.left;t.parent&&(t.parent.left=t.right,n=t.parent,t.left=e.left,t.right=e.right)}null!==e.parent?e.isLeftChild()?e.parent.left=t:e.parent.right=t:this._setRoot(t),n&&this._rebalance(n)}e.dispose()}},{key:"_rotateLeft",value:function(e){var t=e.parent,n=e.isLeftChild(),r=e.right;r&&(e.right=r.left,r.left=e),null!==t?n?t.left=r:t.right=r:this._setRoot(r)}},{key:"_rotateRight",value:function(e){var t=e.parent,n=e.isLeftChild(),r=e.left;r&&(e.left=r.right,r.right=e),null!==t?n?t.left=r:t.right=r:this._setRoot(r)}},{key:"_rebalance",value:function(e){var t=e.getBalance();t>1&&e.left?e.left.getBalance()<0?this._rotateLeft(e.left):this._rotateRight(e):t<-1&&e.right&&(e.right.getBalance()>0?this._rotateRight(e.right):this._rotateLeft(e))}},{key:"get",value:function(e){if(null!==this._root){var t=[];if(this._root.search(e,t),t.length>0){for(var n=t[0],r=1;rn.low&&(n=t[r]);return n.event}}return null}},{key:"forEach",value:function(e){if(null!==this._root){var t=[];this._root.traverse((function(e){return t.push(e)})),t.forEach((function(t){t.event&&e(t.event)}))}return this}},{key:"forEachAtTime",value:function(e,t){if(null!==this._root){var n=[];this._root.search(e,n),n.forEach((function(e){e.event&&t(e.event)}))}return this}},{key:"forEachFrom",value:function(e,t){if(null!==this._root){var n=[];this._root.searchAfter(e,n),n.forEach((function(e){e.event&&t(e.event)}))}return this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),null!==this._root&&this._root.traverse((function(e){return e.dispose()})),this._root=null,this}}]),n}(ga),Oo=function(){function e(t,n,r){Object(o.a)(this,e),this._left=null,this._right=null,this.parent=null,this.height=0,this.event=r,this.low=t,this.high=n,this.max=this.high}return Object(P.a)(e,[{key:"insert",value:function(e){e.low<=this.low?null===this.left?this.left=e:this.left.insert(e):null===this.right?this.right=e:this.right.insert(e)}},{key:"search",value:function(e,t){e>this.max||(null!==this.left&&this.left.search(e,t),this.low<=e&&this.high>e&&t.push(this),this.low>e||null!==this.right&&this.right.search(e,t))}},{key:"searchAfter",value:function(e,t){this.low>=e&&(t.push(this),null!==this.left&&this.left.searchAfter(e,t)),null!==this.right&&this.right.searchAfter(e,t)}},{key:"traverse",value:function(e){e(this),null!==this.left&&this.left.traverse(e),null!==this.right&&this.right.traverse(e)}},{key:"updateHeight",value:function(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}},{key:"updateMax",value:function(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}},{key:"getBalance",value:function(){var e=0;return null!==this.left&&null!==this.right?e=this.left.height-this.right.height:null!==this.left?e=this.left.height+1:null!==this.right&&(e=-(this.right.height+1)),e}},{key:"isLeftChild",value:function(){return null!==this.parent&&this.parent.left===this}},{key:"left",get:function(){return this._left},set:function(e){this._left=e,null!==e&&(e.parent=this),this.updateHeight(),this.updateMax()}},{key:"right",get:function(){return this._right},set:function(e){this._right=e,null!==e&&(e.parent=this),this.updateHeight(),this.updateMax()}},{key:"dispose",value:function(){this.parent=null,this._left=null,this._right=null,this.event=null}}]),e}(),Co=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["volume"]))).name="Volume";var r=da(n.getDefaults(),arguments,["volume"]);return e.input=e.output=new co({context:e.context,gain:r.volume,units:"decibels"}),e.volume=e.output.gain,Ra(Object(G.a)(e),"volume"),e._unmutedVolume=r.volume,e.mute=r.mute,e}return Object(P.a)(n,[{key:"mute",get:function(){return this.volume.value===-1/0},set:function(e){!this.mute&&e?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!e&&(this.volume.value=this._unmutedVolume)}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.input.dispose(),this.volume.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{mute:!1,volume:0})}}]),n}(oo),To=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments))).name="Destination",e.input=new Co({context:e.context}),e.output=new co({context:e.context}),e.volume=e.input.volume;var r=da(n.getDefaults(),arguments);return so(e.input,e.output,e.context.rawContext.destination),e.mute=r.mute,e._internalChannels=[e.input,e.context.rawContext.destination,e.output],e}return Object(P.a)(n,[{key:"mute",get:function(){return this.input.mute},set:function(e){this.input.mute=e}},{key:"chain",value:function(){this.input.disconnect();for(var e=arguments.length,t=new Array(e),n=0;n=this.time&&t>=this._nextTick&&this._nextTick+this._intervalthis.time&&(this._nextTick=this.time+Math.ceil((t-this.time)/this._interval)*this._interval),this._currentId=this.transport.scheduleOnce(this.invoke.bind(this),new wo(this.context,this._nextTick).toSeconds()),this._nextTick+=this._interval,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new wo(this.context,this._nextTick).toSeconds())}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this}}],[{key:"getDefaults",value:function(){return Object.assign({},jo.getDefaults(),{duration:1/0,interval:1,once:!1})}}]),n}(jo),Po=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments))).name="Transport",e._loop=new Eo(!1),e._loopStart=0,e._loopEnd=0,e._scheduledEvents={},e._timeline=new xa,e._repeatedEvents=new So,e._syncedSignals=[],e._swingAmount=0;var r=da(n.getDefaults(),arguments);return e._ppq=r.ppq,e._clock=new bo({callback:e._processTick.bind(Object(G.a)(e)),context:e.context,frequency:0,units:"bpm"}),e._bindClockEvents(),e.bpm=e._clock.frequency,e._clock.frequency.multiplier=r.ppq,e.bpm.setValueAtTime(r.bpm,0),Ra(Object(G.a)(e),"bpm"),e._timeSignature=r.timeSignature,e._swingTicks=r.ppq/2,e}return Object(P.a)(n,[{key:"_processTick",value:function(e,t){if(this._loop.get(e)&&t>=this._loopEnd&&(this.emit("loopEnd",e),this._clock.setTicksAtTime(this._loopStart,e),t=this._loopStart,this.emit("loopStart",e,this._clock.getSecondsAtTime(e)),this.emit("loop",e)),this._swingAmount>0&&t%this._ppq!==0&&t%(2*this._swingTicks)!==0){var n=t%(2*this._swingTicks)/(2*this._swingTicks),r=Math.sin(n*Math.PI)*this._swingAmount;e+=new wo(this.context,2*this._swingTicks/3).toSeconds()*r}this._timeline.forEachAtTime(t,(function(t){return t.invoke(e)}))}},{key:"schedule",value:function(e,t){var n=new jo(this,{callback:e,time:new no(this.context,t).toTicks()});return this._addEvent(n,this._timeline)}},{key:"scheduleRepeat",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0,i=new Ao(this,{callback:e,duration:new Za(this.context,r).toTicks(),interval:new Za(this.context,t).toTicks(),time:new no(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}},{key:"scheduleOnce",value:function(e,t){var n=new jo(this,{callback:e,once:!0,time:new no(this.context,t).toTicks()});return this._addEvent(n,this._timeline)}},{key:"clear",value:function(e){if(this._scheduledEvents.hasOwnProperty(e)){var t=this._scheduledEvents[e.toString()];t.timeline.remove(t.event),t.event.dispose(),delete this._scheduledEvents[e.toString()]}return this}},{key:"_addEvent",value:function(e,t){return this._scheduledEvents[e.id.toString()]={event:e,timeline:t},t.add(e),e.id}},{key:"cancel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=this.toTicks(t);return this._timeline.forEachFrom(n,(function(t){return e.clear(t.id)})),this._repeatedEvents.forEachFrom(n,(function(t){return e.clear(t.id)})),this}},{key:"_bindClockEvents",value:function(){var e=this;this._clock.on("start",(function(t,n){n=new wo(e.context,n).toSeconds(),e.emit("start",t,n)})),this._clock.on("stop",(function(t){e.emit("stop",t)})),this._clock.on("pause",(function(t){e.emit("pause",t)}))}},{key:"state",get:function(){return this._clock.getStateAtTime(this.now())}},{key:"start",value:function(e,t){var n;return Gi(t)&&(n=this.toTicks(t)),this._clock.start(e,n),this}},{key:"stop",value:function(e){return this._clock.stop(e),this}},{key:"pause",value:function(e){return this._clock.pause(e),this}},{key:"toggle",value:function(e){return e=this.toSeconds(e),"started"!==this._clock.getStateAtTime(e)?this.start(e):this.stop(e),this}},{key:"timeSignature",get:function(){return this._timeSignature},set:function(e){Xi(e)&&(e=e[0]/e[1]*4),this._timeSignature=e}},{key:"loopStart",get:function(){return new Za(this.context,this._loopStart,"i").toSeconds()},set:function(e){this._loopStart=this.toTicks(e)}},{key:"loopEnd",get:function(){return new Za(this.context,this._loopEnd,"i").toSeconds()},set:function(e){this._loopEnd=this.toTicks(e)}},{key:"loop",get:function(){return this._loop.get(this.now())},set:function(e){this._loop.set(e,this.now())}},{key:"setLoopPoints",value:function(e,t){return this.loopStart=e,this.loopEnd=t,this}},{key:"swing",get:function(){return this._swingAmount},set:function(e){this._swingAmount=e}},{key:"swingSubdivision",get:function(){return new wo(this.context,this._swingTicks).toNotation()},set:function(e){this._swingTicks=this.toTicks(e)}},{key:"position",get:function(){var e=this.now(),t=this._clock.getTicksAtTime(e);return new wo(this.context,t).toBarsBeatsSixteenths()},set:function(e){var t=this.toTicks(e);this.ticks=t}},{key:"seconds",get:function(){return this._clock.seconds},set:function(e){var t=this.now(),n=this._clock.frequency.timeToTicks(e,t);this.ticks=n}},{key:"progress",get:function(){if(this.loop){var e=this.now();return(this._clock.getTicksAtTime(e)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}},{key:"ticks",get:function(){return this._clock.ticks},set:function(e){if(this._clock.ticks!==e){var t=this.now();if("started"===this.state){var n=this._clock.getTicksAtTime(t),r=t+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,t);this.emit("stop",r),this._clock.setTicksAtTime(e,r),this.emit("start",r,this._clock.getSecondsAtTime(r))}else this._clock.setTicksAtTime(e,t)}}},{key:"getTicksAtTime",value:function(e){return Math.round(this._clock.getTicksAtTime(e))}},{key:"getSecondsAtTime",value:function(e){return this._clock.getSecondsAtTime(e)}},{key:"PPQ",get:function(){return this._clock.frequency.multiplier},set:function(e){this._clock.frequency.multiplier=e}},{key:"nextSubdivision",value:function(e){if(e=this.toTicks(e),"started"!==this.state)return 0;var t=this.now(),n=e-this.getTicksAtTime(t)%e;return this._clock.nextTickTime(n,t)}},{key:"syncSignal",value:function(e,t){if(!t){var n=this.now();if(0!==e.getValueAtTime(n)){var r=1/(60/this.bpm.getValueAtTime(n)/this.PPQ);t=e.getValueAtTime(n)/r}else t=0}var i=new co(t);return this.bpm.connect(i),i.connect(e._param),this._syncedSignals.push({initial:e.value,ratio:i,signal:e}),e.value=0,this}},{key:"unsyncSignal",value:function(e){for(var t=this._syncedSignals.length-1;t>=0;t--){var n=this._syncedSignals[t];n.signal===e&&(n.ratio.dispose(),n.signal.value=n.initial,this._syncedSignals.splice(t,1))}return this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._clock.dispose(),Ia(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(ro.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}}]),n}(ro);ja.mixin(Po),Oa((function(e){e.transport=new Po({context:e})})),Ta((function(e){e.transport.dispose()}));var Mo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(o.a)(this,n),(r=t.call(this,e)).input=void 0,r._state=new io("stopped"),r._synced=!1,r._scheduled=[],r._syncedStart=Da,r._syncedStop=Da,r._state.memory=100,r._state.increasing=!0,r._volume=r.output=new Co({context:r.context,mute:e.mute,volume:e.volume}),r.volume=r._volume.volume,Ra(Object(G.a)(r),"volume"),r.onstop=e.onstop,r}return Object(P.a)(n,[{key:"state",get:function(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}},{key:"mute",get:function(){return this._volume.mute},set:function(e){this._volume.mute=e}},{key:"_clampToCurrentTime",value:function(e){return this._synced?e:Math.max(e,this.context.currentTime)}},{key:"start",value:function(e,t,n){var r=this,i=Wi(e)&&this._synced?this.context.transport.seconds:this.toSeconds(e);if(i=this._clampToCurrentTime(i),this._synced||"started"!==this._state.getValueAtTime(i))if(this.log("start",i),this._state.setStateAtTime("started",i),this._synced){var a=this._state.get(i);a&&(a.offset=this.toSeconds(pa(t,0)),a.duration=n?this.toSeconds(n):void 0);var o=this.context.transport.schedule((function(e){r._start(e,t,n)}),i);this._scheduled.push(o),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>i&&this._syncedStart(this.now(),this.context.transport.seconds)}else zi(this.context),this._start(i,t,n);else Ni(ya(i,this._state.get(i).time),"Start time must be strictly greater than previous start time"),this._state.cancel(i),this._state.setStateAtTime("started",i),this.log("restart",i),this.restart(i,t,n);return this}},{key:"stop",value:function(e){var t=Wi(e)&&this._synced?this.context.transport.seconds:this.toSeconds(e);if(t=this._clampToCurrentTime(t),"started"===this._state.getValueAtTime(t)||Gi(this._state.getNextState("started",t))){if(this.log("stop",t),this._synced){var n=this.context.transport.schedule(this._stop.bind(this),t);this._scheduled.push(n)}else this._stop(t);this._state.cancel(t),this._state.setStateAtTime("stopped",t)}return this}},{key:"restart",value:function(e,t,n){return e=this.toSeconds(e),"started"===this._state.getValueAtTime(e)&&(this._state.cancel(e),this._restart(e,t,n)),this}},{key:"sync",value:function(){var e=this;return this._synced||(this._synced=!0,this._syncedStart=function(t,n){if(n>0){var r=e._state.get(n);if(r&&"started"===r.state&&r.time!==n){var i,a=n-e.toSeconds(r.time);r.duration&&(i=e.toSeconds(r.duration)-a),e._start(t,e.toSeconds(r.offset)+a,i)}}},this._syncedStop=function(t){var n=e.context.transport.getSecondsAtTime(Math.max(t-e.sampleTime,0));"started"===e._state.getValueAtTime(n)&&e._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}},{key:"unsync",value:function(){var e=this;return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach((function(t){return e.context.transport.clear(t)})),this._scheduled=[],this._state.cancel(0),this._stop(0),this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.onstop=Da,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{mute:!1,onstop:Da,volume:0})}}]),n}(oo),Ro=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["url","onload"]))).name="ToneBufferSource",e._source=e.context.createBufferSource(),e._internalChannels=[e._source],e._sourceStarted=!1,e._sourceStopped=!1;var r=da(n.getDefaults(),arguments,["url","onload"]);return uo(e._source,e._gainNode),e._source.onended=function(){return e._stopSource()},e.playbackRate=new ao({context:e.context,param:e._source.playbackRate,units:"positive",value:r.playbackRate}),e.loop=r.loop,e.loopStart=r.loopStart,e.loopEnd=r.loopEnd,e._buffer=new Na(r.url,r.onload,r.onerror),e._internalChannels.push(e._source),e}return Object(P.a)(n,[{key:"fadeIn",get:function(){return this._fadeIn},set:function(e){this._fadeIn=e}},{key:"fadeOut",get:function(){return this._fadeOut},set:function(e){this._fadeOut=e}},{key:"curve",get:function(){return this._curve},set:function(e){this._curve=e}},{key:"start",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;Ni(this.buffer.loaded,"buffer is either not set or not loaded");var i=this.toSeconds(e);this._startGain(i,r),t=this.loop?pa(t,this.loopStart):pa(t,0);var a=Math.max(this.toSeconds(t),0);if(this.loop){var o=this.toSeconds(this.loopEnd)||this.buffer.duration,s=this.toSeconds(this.loopStart),u=o-s;ba(a,o)&&(a=(a-s)%u+s),ka(a,this.buffer.duration)&&(a=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,_a(a,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,a)),Gi(n)){var l=this.toSeconds(n);l=Math.max(l,0),this.stop(i+l)}return this}},{key:"_stopSource",value:function(e){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(e)),this._onended())}},{key:"loopStart",get:function(){return this._source.loopStart},set:function(e){this._source.loopStart=this.toSeconds(e)}},{key:"loopEnd",get:function(){return this._source.loopEnd},set:function(e){this._source.loopEnd=this.toSeconds(e)}},{key:"buffer",get:function(){return this._buffer},set:function(e){this._buffer.set(e)}},{key:"loop",get:function(){return this._source.loop},set:function(e){this._source.loop=e,this._sourceStarted&&this.cancelStop()}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(fo.getDefaults(),{url:new Na,loop:!1,loopEnd:0,loopStart:0,onload:Da,onerror:Da,playbackRate:1})}}]),n}(fo);function Io(e,t){return ia(this,void 0,void 0,N.a.mark((function n(){var r,i,a;return N.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t/e.context.sampleRate,i=new La(1,r,e.context.sampleRate),new e.constructor(Object.assign(e.get(),{frequency:2/r,detune:0,context:i})).toDestination().start(0),n.next=6,i.render();case 6:return a=n.sent,n.abrupt("return",a.getChannelData(0));case 8:case"end":return n.stop()}}),n)})))}var Do=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","type"]))).name="ToneOscillatorNode",e._oscillator=e.context.createOscillator(),e._internalChannels=[e._oscillator];var r=da(n.getDefaults(),arguments,["frequency","type"]);return uo(e._oscillator,e._gainNode),e.type=r.type,e.frequency=new ao({context:e.context,param:e._oscillator.frequency,units:"frequency",value:r.frequency}),e.detune=new ao({context:e.context,param:e._oscillator.detune,units:"cents",value:r.detune}),Ra(Object(G.a)(e),["frequency","detune"]),e}return Object(P.a)(n,[{key:"start",value:function(e){var t=this.toSeconds(e);return this.log("start",t),this._startGain(t),this._oscillator.start(t),this}},{key:"_stopSource",value:function(e){this._oscillator.stop(e)}},{key:"setPeriodicWave",value:function(e){return this._oscillator.setPeriodicWave(e),this}},{key:"type",get:function(){return this._oscillator.type},set:function(e){this._oscillator.type=e}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(fo.getDefaults(),{detune:0,frequency:440,type:"sine"})}}]),n}(fo),No=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","type"]))).name="Oscillator",e._oscillator=null;var r=da(n.getDefaults(),arguments,["frequency","type"]);return e.frequency=new po({context:e.context,units:"frequency",value:r.frequency}),Ra(Object(G.a)(e),"frequency"),e.detune=new po({context:e.context,units:"cents",value:r.detune}),Ra(Object(G.a)(e),"detune"),e._partials=r.partials,e._partialCount=r.partialCount,e._type=r.type,r.partialCount&&"custom"!==r.type&&(e._type=e.baseType+r.partialCount.toString()),e.phase=r.phase,e}return Object(P.a)(n,[{key:"_start",value:function(e){var t=this,n=this.toSeconds(e),r=new Do({context:this.context,onended:function(){return t.onstop(t)}});this._oscillator=r,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(n)}},{key:"_stop",value:function(e){var t=this.toSeconds(e);this._oscillator&&this._oscillator.stop(t)}},{key:"_restart",value:function(e){var t=this.toSeconds(e);return this.log("restart",t),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(t),this}},{key:"syncFrequency",value:function(){return this.context.transport.syncSignal(this.frequency),this}},{key:"unsyncFrequency",value:function(){return this.context.transport.unsyncSignal(this.frequency),this}},{key:"_getCachedPeriodicWave",value:function(){var e=this;if("custom"===this._type)return n._periodicWaveCache.find((function(t){return t.phase===e._phase&&(n=t.partials,r=e._partials,n.length===r.length&&n.every((function(e,t){return r[t]===e})));var n,r}));var t=n._periodicWaveCache.find((function(t){return t.type===e._type&&t.phase===e._phase}));return this._partialCount=t?t.partialCount:this._partialCount,t}},{key:"type",get:function(){return this._type},set:function(e){this._type=e;var t=-1!==["sine","square","sawtooth","triangle"].indexOf(e);if(0===this._phase&&t)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=e);else{var r=this._getCachedPeriodicWave();if(Gi(r)){var i=r.partials,o=r.wave;this._wave=o,this._partials=i,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{var s=this._getRealImaginary(e,this._phase),u=Object(a.a)(s,2),l=u[0],c=u[1],f=this.context.createPeriodicWave(l,c);this._wave=f,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),n._periodicWaveCache.push({imag:c,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:l,type:this._type,wave:this._wave}),n._periodicWaveCache.length>100&&n._periodicWaveCache.shift()}}}},{key:"baseType",get:function(){return this._type.replace(this.partialCount.toString(),"")},set:function(e){this.partialCount&&"custom"!==this._type&&"custom"!==e?this.type=e+this.partialCount:this.type=e}},{key:"partialCount",get:function(){return this._partialCount},set:function(e){Li(e,0);var t=this._type,n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(t=n[1]),"custom"!==this._type)this.type=0===e?t:t+e.toString();else{var r=new Float32Array(e);this._partials.forEach((function(e,t){return r[t]=e})),this._partials=Array.from(r),this.type=this._type}}},{key:"_getRealImaginary",value:function(e,t){var n=2048,r=new Float32Array(n),i=new Float32Array(n),a=1;if("custom"===e){if(a=this._partials.length+1,this._partialCount=this._partials.length,n=a,0===this._partials.length)return[r,i]}else{var o=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(e);o?(a=parseInt(o[2],10)+1,this._partialCount=parseInt(o[2],10),e=o[1],n=a=Math.max(a,2)):this._partialCount=0,this._partials=[]}for(var s=1;s>1&1?-1:1):0,this._partials[s-1]=l;break;case"custom":l=this._partials[s-1];break;default:throw new TypeError("Oscillator: invalid type: "+e)}0!==l?(r[s]=-l*Math.sin(t*s),i[s]=l*Math.cos(t*s)):(r[s]=0,i[s]=0)}return[r,i]}},{key:"_inverseFFT",value:function(e,t,n){for(var r=0,i=e.length,a=0;a0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(Mo.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}}]),n}(Mo);No._periodicWaveCache=[];var Lo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){return Object(o.a)(this,n),t.call(this,Object.assign(da(n.getDefaults(),arguments,["context"])))}return Object(P.a)(n,[{key:"connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return vo(this,e,t,n),this}}]),n}(oo),zo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,Object.assign(da(n.getDefaults(),arguments,["mapping","length"])))).name="WaveShaper",e._shaper=e.context.createWaveShaper(),e.input=e._shaper,e.output=e._shaper;var r=da(n.getDefaults(),arguments,["mapping","length"]);return Xi(r.mapping)||r.mapping instanceof Float32Array?e.curve=Float32Array.from(r.mapping):Ui(r.mapping)&&e.setMap(r.mapping,r.length),e}return Object(P.a)(n,[{key:"setMap",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,n=new Float32Array(t),r=0,i=t;r0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(No.getDefaults(),{harmonicity:1,modulationType:"square"})}}]),n}(Mo),Wo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","type","modulationType"]))).name="FMOscillator",e._modulationNode=new co({context:e.context,gain:0});var r=da(n.getDefaults(),arguments,["frequency","type","modulationType"]);return e._carrier=new No({context:e.context,detune:r.detune,frequency:0,onstop:function(){return e.onstop(Object(G.a)(e))},phase:r.phase,type:r.type}),e.detune=e._carrier.detune,e.frequency=new po({context:e.context,units:"frequency",value:r.frequency}),e._modulator=new No({context:e.context,phase:r.phase,type:r.modulationType}),e.harmonicity=new Bo({context:e.context,units:"positive",value:r.harmonicity}),e.modulationIndex=new Bo({context:e.context,units:"positive",value:r.modulationIndex}),e.frequency.connect(e._carrier.frequency),e.frequency.chain(e.harmonicity,e._modulator.frequency),e.frequency.chain(e.modulationIndex,e._modulationNode),e._modulator.connect(e._modulationNode.gain),e._modulationNode.connect(e._carrier.frequency),e._carrier.connect(e.output),e.detune.connect(e._modulator.detune),Ra(Object(G.a)(e),["modulationIndex","frequency","detune","harmonicity"]),e}return Object(P.a)(n,[{key:"_start",value:function(e){this._modulator.start(e),this._carrier.start(e)}},{key:"_stop",value:function(e){this._modulator.stop(e),this._carrier.stop(e)}},{key:"_restart",value:function(e){return this._modulator.restart(e),this._carrier.restart(e),this}},{key:"type",get:function(){return this._carrier.type},set:function(e){this._carrier.type=e}},{key:"baseType",get:function(){return this._carrier.baseType},set:function(e){this._carrier.baseType=e}},{key:"partialCount",get:function(){return this._carrier.partialCount},set:function(e){this._carrier.partialCount=e}},{key:"modulationType",get:function(){return this._modulator.type},set:function(e){this._modulator.type=e}},{key:"phase",get:function(){return this._carrier.phase},set:function(e){this._carrier.phase=e,this._modulator.phase=e}},{key:"partials",get:function(){return this._carrier.partials},set:function(e){this._carrier.partials=e}},{key:"asArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(No.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}}]),n}(Mo),Go=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","width"]))).name="PulseOscillator",e._widthGate=new co({context:e.context,gain:0}),e._thresh=new zo({context:e.context,mapping:function(e){return e<=0?-1:1}});var r=da(n.getDefaults(),arguments,["frequency","width"]);return e.width=new po({context:e.context,units:"audioRange",value:r.width}),e._triangle=new No({context:e.context,detune:r.detune,frequency:r.frequency,onstop:function(){return e.onstop(Object(G.a)(e))},phase:r.phase,type:"triangle"}),e.frequency=e._triangle.frequency,e.detune=e._triangle.detune,e._triangle.chain(e._thresh,e.output),e.width.chain(e._widthGate,e._thresh),Ra(Object(G.a)(e),["width","frequency","detune"]),e}return Object(P.a)(n,[{key:"_start",value:function(e){e=this.toSeconds(e),this._triangle.start(e),this._widthGate.gain.setValueAtTime(1,e)}},{key:"_stop",value:function(e){e=this.toSeconds(e),this._triangle.stop(e),this._widthGate.gain.cancelScheduledValues(e),this._widthGate.gain.setValueAtTime(0,e)}},{key:"_restart",value:function(e){this._triangle.restart(e),this._widthGate.gain.cancelScheduledValues(e),this._widthGate.gain.setValueAtTime(1,e)}},{key:"phase",get:function(){return this._triangle.phase},set:function(e){this._triangle.phase=e}},{key:"type",get:function(){return"pulse"}},{key:"baseType",get:function(){return"pulse"}},{key:"partials",get:function(){return[]}},{key:"partialCount",get:function(){return 0}},{key:"carrierType",set:function(e){this._triangle.type=e}},{key:"asArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(Mo.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}}]),n}(Mo),Uo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","type","spread"]))).name="FatOscillator",e._oscillators=[];var r=da(n.getDefaults(),arguments,["frequency","type","spread"]);return e.frequency=new po({context:e.context,units:"frequency",value:r.frequency}),e.detune=new po({context:e.context,units:"cents",value:r.detune}),e._spread=r.spread,e._type=r.type,e._phase=r.phase,e._partials=r.partials,e._partialCount=r.partialCount,e.count=r.count,Ra(Object(G.a)(e),["frequency","detune"]),e}return Object(P.a)(n,[{key:"_start",value:function(e){e=this.toSeconds(e),this._forEach((function(t){return t.start(e)}))}},{key:"_stop",value:function(e){e=this.toSeconds(e),this._forEach((function(t){return t.stop(e)}))}},{key:"_restart",value:function(e){this._forEach((function(t){return t.restart(e)}))}},{key:"_forEach",value:function(e){for(var t=0;t1){var t=-e/2,n=e/(this._oscillators.length-1);this._forEach((function(e,r){return e.detune.value=t+n*r}))}}},{key:"count",get:function(){return this._oscillators.length},set:function(e){var t=this;if(Li(e,1),this._oscillators.length!==e){this._forEach((function(e){return e.dispose()})),this._oscillators=[];for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.frequency.dispose(),this.detune.dispose(),this._forEach((function(e){return e.dispose()})),this}}],[{key:"getDefaults",value:function(){return Object.assign(No.getDefaults(),{count:3,spread:20,type:"sawtooth"})}}]),n}(Mo),qo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","modulationFrequency"]))).name="PWMOscillator",e.sourceType="pwm",e._scale=new Bo({context:e.context,value:2});var r=da(n.getDefaults(),arguments,["frequency","modulationFrequency"]);return e._pulse=new Go({context:e.context,frequency:r.modulationFrequency}),e._pulse.carrierType="sine",e.modulationFrequency=e._pulse.frequency,e._modulator=new No({context:e.context,detune:r.detune,frequency:r.frequency,onstop:function(){return e.onstop(Object(G.a)(e))},phase:r.phase}),e.frequency=e._modulator.frequency,e.detune=e._modulator.detune,e._modulator.chain(e._scale,e._pulse.width),e._pulse.connect(e.output),Ra(Object(G.a)(e),["modulationFrequency","frequency","detune"]),e}return Object(P.a)(n,[{key:"_start",value:function(e){e=this.toSeconds(e),this._modulator.start(e),this._pulse.start(e)}},{key:"_stop",value:function(e){e=this.toSeconds(e),this._modulator.stop(e),this._pulse.stop(e)}},{key:"_restart",value:function(e){this._modulator.restart(e),this._pulse.restart(e)}},{key:"type",get:function(){return"pwm"}},{key:"baseType",get:function(){return"pwm"}},{key:"partials",get:function(){return[]}},{key:"partialCount",get:function(){return 0}},{key:"phase",get:function(){return this._modulator.phase},set:function(e){this._modulator.phase=e}},{key:"asArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(Mo.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}}]),n}(Mo),Ho={am:Vo,fat:Uo,fm:Wo,oscillator:No,pulse:Go,pwm:qo},Yo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["frequency","type"]))).name="OmniOscillator";var r=da(n.getDefaults(),arguments,["frequency","type"]);return e.frequency=new po({context:e.context,units:"frequency",value:r.frequency}),e.detune=new po({context:e.context,units:"cents",value:r.detune}),Ra(Object(G.a)(e),["frequency","detune"]),e.set(r),e}return Object(P.a)(n,[{key:"_start",value:function(e){this._oscillator.start(e)}},{key:"_stop",value:function(e){this._oscillator.stop(e)}},{key:"_restart",value:function(e){return this._oscillator.restart(e),this}},{key:"type",get:function(){var e=this,t="";return["am","fm","fat"].some((function(t){return e._sourceType===t}))&&(t=this._sourceType),t+this._oscillator.type},set:function(e){"fm"===e.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=e.substr(2)):"am"===e.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=e.substr(2)):"fat"===e.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=e.substr(3)):"pwm"===e?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===e?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=e)}},{key:"partials",get:function(){return this._oscillator.partials},set:function(e){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=e)}},{key:"partialCount",get:function(){return this._oscillator.partialCount},set:function(e){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=e)}},{key:"set",value:function(e){return Reflect.has(e,"type")&&e.type&&(this.type=e.type),Object(ta.a)(Object(na.a)(n.prototype),"set",this).call(this,e),this}},{key:"_createNewOscillator",value:function(e){var t=this;if(e!==this._sourceType){this._sourceType=e;var n=Ho[e],r=this.now();if(this._oscillator){var i=this._oscillator;i.stop(r),this.context.setTimeout((function(){return i.dispose()}),this.blockTime)}this._oscillator=new n({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=function(){return t.onstop(t)},"started"===this.state&&this._oscillator.start(r)}}},{key:"phase",get:function(){return this._oscillator.phase},set:function(e){this._oscillator.phase=e}},{key:"sourceType",get:function(){return this._sourceType},set:function(e){var t="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(t=this._oscillator.type),"fm"===e?this.type="fm"+t:"am"===e?this.type="am"+t:"fat"===e?this.type="fat"+t:"oscillator"===e?this.type=t:"pulse"===e?this.type="pulse":"pwm"===e&&(this.type="pwm")}},{key:"_getOscType",value:function(e,t){return e instanceof Ho[t]}},{key:"baseType",get:function(){return this._oscillator.baseType},set:function(e){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===e||"pwm"===e||(this._oscillator.baseType=e)}},{key:"width",get:function(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}},{key:"count",get:function(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0},set:function(e){this._getOscType(this._oscillator,"fat")&&qi(e)&&(this._oscillator.count=e)}},{key:"spread",get:function(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0},set:function(e){this._getOscType(this._oscillator,"fat")&&qi(e)&&(this._oscillator.spread=e)}},{key:"modulationType",get:function(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0},set:function(e){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&$i(e)&&(this._oscillator.modulationType=e)}},{key:"modulationIndex",get:function(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}},{key:"harmonicity",get:function(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}},{key:"modulationFrequency",get:function(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}},{key:"asArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",Io(this,e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(No.getDefaults(),Wo.getDefaults(),Vo.getDefaults(),Uo.getDefaults(),Go.getDefaults(),qo.getDefaults())}}]),n}(Mo);function Xo(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){Li(r,e,t),n.set(this,r)}})}}function $o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){Li(this.toSeconds(r),e,t),n.set(this,r)}})}}var Qo=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["url","onload"]))).name="Player",e._activeSources=new Set;var r=da(n.getDefaults(),arguments,["url","onload"]);return e._buffer=new Na({onload:e._onload.bind(Object(G.a)(e),r.onload),onerror:r.onerror,reverse:r.reverse,url:r.url}),e.autostart=r.autostart,e._loop=r.loop,e._loopStart=r.loopStart,e._loopEnd=r.loopEnd,e._playbackRate=r.playbackRate,e.fadeIn=r.fadeIn,e.fadeOut=r.fadeOut,e}return Object(P.a)(n,[{key:"load",value:function(e){return ia(this,void 0,void 0,N.a.mark((function t(){return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._buffer.load(e);case 2:return this._onload(),t.abrupt("return",this);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"_onload",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Da;e(),this.autostart&&this.start()}},{key:"_onSourceEnd",value:function(e){this.onstop(this),this._activeSources.delete(e),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}},{key:"start",value:function(e,t,r){return Object(ta.a)(Object(na.a)(n.prototype),"start",this).call(this,e,t,r),this}},{key:"_start",value:function(e,t,n){t=this._loop?pa(t,this._loopStart):pa(t,0);var r=this.toSeconds(t),i=n;n=pa(n,Math.max(this._buffer.duration-r,0));var a=this.toSeconds(n);a/=this._playbackRate,e=this.toSeconds(e);var o=new Ro({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(e+a),this._state.setStateAtTime("stopped",e+a,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&Wi(i)?o.start(e,r):o.start(e,r,a-this.toSeconds(this.fadeOut))}},{key:"_stop",value:function(e){var t=this.toSeconds(e);this._activeSources.forEach((function(e){return e.stop(t)}))}},{key:"restart",value:function(e,t,r){return Object(ta.a)(Object(na.a)(n.prototype),"restart",this).call(this,e,t,r),this}},{key:"_restart",value:function(e,t,n){this._stop(e),this._start(e,t,n)}},{key:"seek",value:function(e,t){var n=this.toSeconds(t);if("started"===this._state.getValueAtTime(n)){var r=this.toSeconds(e);this._stop(n),this._start(n,r)}return this}},{key:"setLoopPoints",value:function(e,t){return this.loopStart=e,this.loopEnd=t,this}},{key:"loopStart",get:function(){return this._loopStart},set:function(e){this._loopStart=e,this.buffer.loaded&&Li(this.toSeconds(e),0,this.buffer.duration),this._activeSources.forEach((function(t){t.loopStart=e}))}},{key:"loopEnd",get:function(){return this._loopEnd},set:function(e){this._loopEnd=e,this.buffer.loaded&&Li(this.toSeconds(e),0,this.buffer.duration),this._activeSources.forEach((function(t){t.loopEnd=e}))}},{key:"buffer",get:function(){return this._buffer},set:function(e){this._buffer.set(e)}},{key:"loop",get:function(){return this._loop},set:function(e){if(this._loop!==e&&(this._loop=e,this._activeSources.forEach((function(t){t.loop=e})),e)){var t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(e){this._playbackRate=e;var t=this.now(),n=this._state.getNextState("stopped",t);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach((function(e){return e.cancelStop()}))),this._activeSources.forEach((function(n){n.playbackRate.setValueAtTime(e,t)}))}},{key:"reverse",get:function(){return this._buffer.reverse},set:function(e){this._buffer.reverse=e}},{key:"loaded",get:function(){return this._buffer.loaded}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._activeSources.forEach((function(e){return e.dispose()})),this._activeSources.clear(),this._buffer.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(Mo.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:Da,onerror:Da,playbackRate:1,reverse:!1})}}]),n}(Mo);ra([$o(0)],Qo.prototype,"fadeIn",void 0),ra([$o(0)],Qo.prototype,"fadeOut",void 0);var Ko=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["attack","decay","sustain","release"]))).name="Envelope",e._sig=new po({context:e.context,value:0}),e.output=e._sig,e.input=void 0;var r=da(n.getDefaults(),arguments,["attack","decay","sustain","release"]);return e.attack=r.attack,e.decay=r.decay,e.sustain=r.sustain,e.release=r.release,e.attackCurve=r.attackCurve,e.releaseCurve=r.releaseCurve,e.decayCurve=r.decayCurve,e}return Object(P.a)(n,[{key:"value",get:function(){return this.getValueAtTime(this.now())}},{key:"_getCurve",value:function(e,t){if($i(e))return e;var n;for(n in Zo)if(Zo[n][t]===e)return n;return e}},{key:"_setCurve",value:function(e,t,n){if($i(n)&&Reflect.has(Zo,n)){var r=Zo[n];Hi(r)?"_decayCurve"!==e&&(this[e]=r[t]):this[e]=r}else{if(!Xi(n)||"_decayCurve"===e)throw new Error("Envelope: invalid curve: "+n);this[e]=n}}},{key:"attackCurve",get:function(){return this._getCurve(this._attackCurve,"In")},set:function(e){this._setCurve("_attackCurve","In",e)}},{key:"releaseCurve",get:function(){return this._getCurve(this._releaseCurve,"Out")},set:function(e){this._setCurve("_releaseCurve","Out",e)}},{key:"decayCurve",get:function(){return this._decayCurve},set:function(e){Ni(["linear","exponential"].some((function(t){return t===e})),"Invalid envelope curve: ".concat(e)),this._decayCurve=e}},{key:"triggerAttack",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.log("triggerAttack",e,t),e=this.toSeconds(e);var n=this.toSeconds(this.attack),r=n,i=this.toSeconds(this.decay),a=this.getValueAtTime(e);if(a>0){var o=1/r,s=1-a;r=s/o}if(r0){var n=this.toSeconds(this.release);n2&&void 0!==arguments[2]?arguments[2]:1;return t=this.toSeconds(t),this.triggerAttack(t,n),this.triggerRelease(t+this.toSeconds(e)),this}},{key:"cancel",value:function(e){return this._sig.cancelScheduledValues(this.toSeconds(e)),this}},{key:"connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return vo(this,e,t,n),this}},{key:"asArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024;return ia(this,void 0,void 0,N.a.mark((function t(){var n,r,i,a,o,s,u,l;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e/this.context.sampleRate,r=new La(1,n,this.context.sampleRate),i=this.toSeconds(this.attack)+this.toSeconds(this.decay),a=i+this.toSeconds(this.release),s=a+(o=.1*a),(u=new this.constructor(Object.assign(this.get(),{attack:n*this.toSeconds(this.attack)/s,decay:n*this.toSeconds(this.decay)/s,release:n*this.toSeconds(this.release)/s,context:r})))._sig.toDestination(),u.triggerAttackRelease(n*(i+o)/s,0),t.next=11,r.render();case 11:return l=t.sent,t.abrupt("return",l.getChannelData(0));case 13:case"end":return t.stop()}}),t,this)})))}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._sig.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}}]),n}(oo);ra([$o(0)],Ko.prototype,"attack",void 0),ra([$o(0)],Ko.prototype,"decay",void 0),ra([Xo(0,1)],Ko.prototype,"sustain",void 0),ra([$o(0)],Ko.prototype,"release",void 0);var Zo=function(){var e,t,n=128,r=[];for(e=0;e2&&void 0!==arguments[2]?arguments[2]:1;this.log("triggerAttack",e,t,n);var r=this.toSeconds(t);return this._triggerEnvelopeAttack(r,n),this.setNote(e,r),this}},{key:"triggerRelease",value:function(e){this.log("triggerRelease",e);var t=this.toSeconds(e);return this._triggerEnvelopeRelease(t),this}},{key:"setNote",value:function(e,t){var n=this.toSeconds(t),r=e instanceof Ja?e.toFrequency():e;if(this.portamento>0&&this.getLevelAtTime(n)>.05){var i=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(r,i,n)}else this.frequency.setValueAtTime(r,n);return this}}],[{key:"getDefaults",value:function(){return Object.assign(Jo.getDefaults(),{detune:0,onsilence:Da,portamento:0})}}]),n}(Jo);ra([$o(0)],es.prototype,"portamento",void 0);var ts=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["attack","decay","sustain","release"]))).name="AmplitudeEnvelope",e._gainNode=new co({context:e.context,gain:0}),e.output=e._gainNode,e.input=e._gainNode,e._sig.connect(e._gainNode.gain),e.output=e._gainNode,e.input=e._gainNode,e}return Object(P.a)(n,[{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._gainNode.dispose(),this}}]),n}(Ko),ns=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments))).name="Synth";var r=da(n.getDefaults(),arguments);return e.oscillator=new Yo(Object.assign({context:e.context,detune:r.detune,onstop:function(){return e.onsilence(Object(G.a)(e))}},r.oscillator)),e.frequency=e.oscillator.frequency,e.detune=e.oscillator.detune,e.envelope=new ts(Object.assign({context:e.context},r.envelope)),e.oscillator.chain(e.envelope,e.output),Ra(Object(G.a)(e),["oscillator","frequency","detune","envelope"]),e}return Object(P.a)(n,[{key:"_triggerEnvelopeAttack",value:function(e,t){if(this.envelope.triggerAttack(e,t),this.oscillator.start(e),0===this.envelope.sustain){var n=this.toSeconds(this.envelope.attack),r=this.toSeconds(this.envelope.decay);this.oscillator.stop(e+n+r)}}},{key:"_triggerEnvelopeRelease",value:function(e){this.envelope.triggerRelease(e),this.oscillator.stop(e+this.toSeconds(this.envelope.release))}},{key:"getLevelAtTime",value:function(e){return e=this.toSeconds(e),this.envelope.getValueAtTime(e)}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.oscillator.dispose(),this.envelope.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(es.getDefaults(),{envelope:Object.assign(va(Ko.getDefaults(),Object.keys(oo.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(va(Yo.getDefaults(),[].concat(Object(X.a)(Object.keys(Mo.getDefaults())),["frequency","detune"])),{type:"triangle"})})}}]),n}(es),rs=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments))).name="MembraneSynth",e.portamento=0;var r=da(n.getDefaults(),arguments);return e.pitchDecay=r.pitchDecay,e.octaves=r.octaves,Ra(Object(G.a)(e),["oscillator","envelope"]),e}return Object(P.a)(n,[{key:"setNote",value:function(e,t){var n=this.toSeconds(t),r=this.toFrequency(e instanceof Ja?e.toFrequency():e),i=r*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(r,n+this.toSeconds(this.pitchDecay)),this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this}}],[{key:"getDefaults",value:function(){return ha(es.getDefaults(),ns.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}}]),n}(ns);ra([Xo(0)],rs.prototype,"octaves",void 0),ra([$o(0)],rs.prototype,"pitchDecay",void 0);var is=new Set;function as(e){is.add(e)}function os(e,t){var n='registerProcessor("'.concat(e,'", ').concat(t,")");is.add(n)}as('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]]. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');as("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");as("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");var ss="feedback-comb-filter";os(ss,'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');var us=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["voice","options"]))).name="PolySynth",e._availableVoices=[],e._activeVoices=[],e._voices=[],e._gcTimeout=-1,e._averageActiveVoices=0;var r=da(n.getDefaults(),arguments,["voice","options"]);Ni(!qi(r.voice),"DEPRECATED: The polyphony count is no longer the first argument.");var i=r.voice.getDefaults();e.options=Object.assign(i,r.options),e.voice=r.voice,e.maxPolyphony=r.maxPolyphony,e._dummyVoice=e._getNextAvailableVoice();var a=e._voices.indexOf(e._dummyVoice);return e._voices.splice(a,1),e._gcTimeout=e.context.setInterval(e._collectGarbage.bind(Object(G.a)(e)),1),e}return Object(P.a)(n,[{key:"activeVoices",get:function(){return this._activeVoices.length}},{key:"_makeVoiceAvailable",value:function(e){this._availableVoices.push(e);var t=this._activeVoices.findIndex((function(t){return t.voice===e}));this._activeVoices.splice(t,1)}},{key:"_getNextAvailableVoice",value:function(){if(this._availableVoices.length)return this._availableVoices.shift();if(this._voices.lengthMath.ceil(this._averageActiveVoices+1)){var e=this._availableVoices.shift(),t=this._voices.indexOf(e);this._voices.splice(t,1),this.context.isOffline||e.dispose()}}},{key:"_triggerAttack",value:function(e,t,n){var r=this;e.forEach((function(e){var i=new ko(r.context,e).toMidi(),a=r._getNextAvailableVoice();a&&(a.triggerAttack(e,t,n),r._activeVoices.push({midi:i,voice:a,released:!1}),r.log("triggerAttack",e,t))}))}},{key:"_triggerRelease",value:function(e,t){var n=this;e.forEach((function(e){var r=new ko(n.context,e).toMidi(),i=n._activeVoices.find((function(e){var t=e.midi,n=e.released;return t===r&&!n}));i&&(i.voice.triggerRelease(t),i.released=!0,n.log("triggerRelease",e,t))}))}},{key:"_scheduleEvent",value:function(e,t,n,r){var i=this;Ni(!this.disposed,"Synth was already disposed"),n<=this.now()?"attack"===e?this._triggerAttack(t,n,r):this._triggerRelease(t,n):this.context.setTimeout((function(){i._scheduleEvent(e,t,n,r)}),n-this.now())}},{key:"triggerAttack",value:function(e,t,n){Array.isArray(e)||(e=[e]);var r=this.toSeconds(t);return this._scheduleEvent("attack",e,r,n),this}},{key:"triggerRelease",value:function(e,t){Array.isArray(e)||(e=[e]);var n=this.toSeconds(t);return this._scheduleEvent("release",e,n),this}},{key:"triggerAttackRelease",value:function(e,t,n,r){var i=this.toSeconds(n);if(this.triggerAttack(e,i,r),Xi(t)){Ni(Xi(e),"If the duration is an array, the notes must also be an array"),e=e;for(var a=0;a0,"The duration must be greater than 0"),this.triggerRelease(e[a],i+s)}}else{var u=this.toSeconds(t);Ni(u>0,"The duration must be greater than 0"),this.triggerRelease(e,i+u)}return this}},{key:"sync",value:function(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}},{key:"set",value:function(e){var t=va(e,["onsilence","context"]);return this.options=ha(this.options,t),this._voices.forEach((function(e){return e.set(t)})),this._dummyVoice.set(t),this}},{key:"get",value:function(){return this._dummyVoice.get()}},{key:"releaseAll",value:function(e){var t=this.toSeconds(e);return this._activeVoices.forEach((function(e){e.voice.triggerRelease(t)})),this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._dummyVoice.dispose(),this._voices.forEach((function(e){return e.dispose()})),this._activeVoices=[],this._availableVoices=[],this.context.clearInterval(this._gcTimeout),this}}],[{key:"getDefaults",value:function(){return Object.assign(Jo.getDefaults(),{maxPolyphony:32,options:{},voice:ns})}}]),n}(Jo),ls=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"))).name="Sampler",e._activeSources=new Map;var r=da(n.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"),i={};return Object.keys(r.urls).forEach((function(t){var n=parseInt(t,10);if(Ni(Qi(t)||qi(n)&&isFinite(n),"url key is neither a note or midi pitch: ".concat(t)),Qi(t)){var a=new Ja(e.context,t).toMidi();i[a]=r.urls[t]}else qi(n)&&isFinite(n)&&(i[n]=r.urls[n])})),e._buffers=new _o({urls:i,onload:r.onload,baseUrl:r.baseUrl,onerror:r.onerror}),e.attack=r.attack,e.release=r.release,e.curve=r.curve,e._buffers.loaded&&Promise.resolve().then(r.onload),e}return Object(P.a)(n,[{key:"_findClosest",value:function(e){for(var t=0;t<96;){if(this._buffers.has(e+t))return-t;if(this._buffers.has(e-t))return t;t++}throw new Error("No available buffers for note: ".concat(e))}},{key:"triggerAttack",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return this.log("triggerAttack",e,t,r),Array.isArray(e)||(e=[e]),e.forEach((function(e){var i=Qa(new Ja(n.context,e).toFrequency()),a=Math.round(i),o=i-a,s=n._findClosest(a),u=a-s,l=n._buffers.get(u),c=Ya(s+o),f=new Ro({url:l,context:n.context,curve:n.curve,fadeIn:n.attack,fadeOut:n.release,playbackRate:c}).connect(n.output);f.start(t,0,l.duration/c,r),Xi(n._activeSources.get(a))||n._activeSources.set(a,[]),n._activeSources.get(a).push(f),f.onended=function(){if(n._activeSources&&n._activeSources.has(a)){var e=n._activeSources.get(a),t=e.indexOf(f);-1!==t&&e.splice(t,1)}}})),this}},{key:"triggerRelease",value:function(e,t){var n=this;return this.log("triggerRelease",e,t),Array.isArray(e)||(e=[e]),e.forEach((function(e){var r=new Ja(n.context,e).toMidi();if(n._activeSources.has(r)&&n._activeSources.get(r).length){var i=n._activeSources.get(r);t=n.toSeconds(t),i.forEach((function(e){e.stop(t)})),n._activeSources.set(r,[])}})),this}},{key:"releaseAll",value:function(e){var t=this.toSeconds(e);return this._activeSources.forEach((function(e){for(;e.length;){e.shift().stop(t)}})),this}},{key:"sync",value:function(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}},{key:"triggerAttackRelease",value:function(e,t,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=this.toSeconds(n);return this.triggerAttack(e,a,i),Xi(t)?(Ni(Xi(e),"notes must be an array when duration is array"),e.forEach((function(e,n){var i=t[Math.min(n,t.length-1)];r.triggerRelease(e,a+r.toSeconds(i))}))):this.triggerRelease(e,a+this.toSeconds(t)),this}},{key:"add",value:function(e,t,n){if(Ni(Qi(e)||isFinite(e),"note must be a pitch or midi: ".concat(e)),Qi(e)){var r=new Ja(this.context,e).toMidi();this._buffers.add(r,t,n)}else this._buffers.add(e,t,n);return this}},{key:"loaded",get:function(){return this._buffers.loaded}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._buffers.dispose(),this._activeSources.forEach((function(e){e.forEach((function(e){return e.dispose()}))})),this._activeSources.clear(),this}}],[{key:"getDefaults",value:function(){return Object.assign(Jo.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Da,onerror:Da,release:.1,urls:{}})}}]),n}(Jo);ra([$o(0)],ls.prototype,"attack",void 0),ra([$o(0)],ls.prototype,"release",void 0);var cs=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,Object.assign(da(n.getDefaults(),arguments,["pan"])))).name="Panner",e._panner=e.context.createStereoPanner(),e.input=e._panner,e.output=e._panner;var r=da(n.getDefaults(),arguments,["pan"]);return e.pan=new ao({context:e.context,param:e._panner.pan,value:r.pan,minValue:-1,maxValue:1}),e._panner.channelCount=r.channelCount,e._panner.channelCountMode="explicit",Ra(Object(G.a)(e),"pan"),e}return Object(P.a)(n,[{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._panner.disconnect(),this.pan.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{pan:0,channelCount:1})}}]),n}(oo),fs="bit-crusher";os(fs,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\n\t\t\t\tautomationRate: 'k-rate'\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, _channel, parameters) {\n\t\t\tconst step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");var hs=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["solo"]))).name="Solo";var r=da(n.getDefaults(),arguments,["solo"]);return e.input=e.output=new co({context:e.context}),n._allSolos.has(e.context)||n._allSolos.set(e.context,new Set),n._allSolos.get(e.context).add(Object(G.a)(e)),e.solo=r.solo,e}return Object(P.a)(n,[{key:"solo",get:function(){return this._isSoloed()},set:function(e){e?this._addSolo():this._removeSolo(),n._allSolos.get(this.context).forEach((function(e){return e._updateSolo()}))}},{key:"muted",get:function(){return 0===this.input.gain.value}},{key:"_addSolo",value:function(){n._soloed.has(this.context)||n._soloed.set(this.context,new Set),n._soloed.get(this.context).add(this)}},{key:"_removeSolo",value:function(){n._soloed.has(this.context)&&n._soloed.get(this.context).delete(this)}},{key:"_isSoloed",value:function(){return n._soloed.has(this.context)&&n._soloed.get(this.context).has(this)}},{key:"_noSolos",value:function(){return!n._soloed.has(this.context)||n._soloed.has(this.context)&&0===n._soloed.get(this.context).size}},{key:"_updateSolo",value:function(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),n._allSolos.get(this.context).delete(this),this._removeSolo(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{solo:!1})}}]),n}(oo);hs._allSolos=new Map,hs._soloed=new Map;var ds=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["pan","volume"]))).name="PanVol";var r=da(n.getDefaults(),arguments,["pan","volume"]);return e._panner=e.input=new cs({context:e.context,pan:r.pan,channelCount:r.channelCount}),e.pan=e._panner.pan,e._volume=e.output=new Co({context:e.context,volume:r.volume}),e.volume=e._volume.volume,e._panner.connect(e._volume),e.mute=r.mute,Ra(Object(G.a)(e),["pan","volume"]),e}return Object(P.a)(n,[{key:"mute",get:function(){return this._volume.mute},set:function(e){this._volume.mute=e}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}}]),n}(oo);(function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;Object(o.a)(this,n),(e=t.call(this,da(n.getDefaults(),arguments,["volume","pan"]))).name="Channel";var r=da(n.getDefaults(),arguments,["volume","pan"]);return e._solo=e.input=new hs({solo:r.solo,context:e.context}),e._panVol=e.output=new ds({context:e.context,pan:r.pan,volume:r.volume,mute:r.mute,channelCount:r.channelCount}),e.pan=e._panVol.pan,e.volume=e._panVol.volume,e._solo.connect(e._panVol),Ra(Object(G.a)(e),["pan","volume"]),e}return Object(P.a)(n,[{key:"solo",get:function(){return this._solo.solo},set:function(e){this._solo.solo=e}},{key:"muted",get:function(){return this._solo.muted||this.mute}},{key:"mute",get:function(){return this._panVol.mute},set:function(e){this._panVol.mute=e}},{key:"_getBus",value:function(e){return n.buses.has(e)||n.buses.set(e,new co({context:this.context})),n.buses.get(e)}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._getBus(e),r=new co({context:this.context,units:"decibels",gain:t});return this.connect(r),r.connect(n),r}},{key:"receive",value:function(e){return this._getBus(e).connect(this),this}},{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}}]),n}(oo)).buses=new Map;var ps=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e;return Object(o.a)(this,n),(e=t.apply(this,arguments)).name="Listener",e.positionX=new ao({context:e.context,param:e.context.rawContext.listener.positionX}),e.positionY=new ao({context:e.context,param:e.context.rawContext.listener.positionY}),e.positionZ=new ao({context:e.context,param:e.context.rawContext.listener.positionZ}),e.forwardX=new ao({context:e.context,param:e.context.rawContext.listener.forwardX}),e.forwardY=new ao({context:e.context,param:e.context.rawContext.listener.forwardY}),e.forwardZ=new ao({context:e.context,param:e.context.rawContext.listener.forwardZ}),e.upX=new ao({context:e.context,param:e.context.rawContext.listener.upX}),e.upY=new ao({context:e.context,param:e.context.rawContext.listener.upY}),e.upZ=new ao({context:e.context,param:e.context.rawContext.listener.upZ}),e}return Object(P.a)(n,[{key:"dispose",value:function(){return Object(ta.a)(Object(na.a)(n.prototype),"dispose",this).call(this),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}}],[{key:"getDefaults",value:function(){return Object.assign(oo.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}}]),n}(oo);Oa((function(e){e.listener=new ps({context:e})})),Ta((function(e){e.listener.dispose()}));var vs=Ba().transport;var gs=Ba().destination;Ba().destination;Ba().listener;Ba().draw;Ba()},function(e,t,n){"use strict";n.d(t,"d",(function(){return v})),n.d(t,"i",(function(){return G})),n.d(t,"c",(function(){return b})),n.d(t,"g",(function(){return g})),n.d(t,"k",(function(){return k})),n.d(t,"e",(function(){return x})),n.d(t,"b",(function(){return j})),n.d(t,"a",(function(){return M})),n.d(t,"h",(function(){return D})),n.d(t,"f",(function(){return C})),n.d(t,"j",(function(){return te}));var r=n(23),i=n.n(r),a=function(e,t){var n=i()({},e,t);for(var r in e){var a;e[r]&&"object"===typeof t[r]&&i()(n,((a={})[r]=i()(e[r],t[r]),a))}return n},o={breakpoints:[40,52,64].map((function(e){return e+"em"}))},s=function(e){return"@media screen and (min-width: "+e+")"},u=function(e,t){return l(t,e,e)},l=function(e,t,n,r,i){for(t=t&&t.split?t.split("."):[t],r=0;r1&&u.forEach((function(n){var i;r[n]=e(((i={})[n]=t[n],i))})),r},f=function(e,t,n,r,a){var o={};return r.slice(0,e.length).forEach((function(r,s){var u,l=e[s],c=t(r,n,a);l?i()(o,((u={})[l]=i()({},o[l],c),u)):i()(o,c)})),o},h=function(e,t,n,r,a){var o={};for(var u in r){var l=e[u],c=t(r[u],n,a);if(l){var f,h=s(l);i()(o,((f={})[h]=i()({},o[h],c),f))}else i()(o,c)}return o},d=function(e){var t=e.properties,n=e.property,r=e.scale,i=e.transform,a=void 0===i?u:i,o=e.defaultScale;t=t||[n];var s=function(e,n,r){var i={},o=a(e,n,r);if(null!==o)return t.forEach((function(e){i[e]=o})),i};return s.scale=r,s.defaults=o,s},p=function(e){void 0===e&&(e={});var t={};return Object.keys(e).forEach((function(n){var r=e[n];t[n]=!0!==r?"function"!==typeof r?d(r):r:d({property:n,scale:n})})),c(t)},v=function(){for(var e={},t=arguments.length,n=new Array(t),r=0;r1?e:100*e+"%")}},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},size:{properties:["width","height"],scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0}),m=g,y={color:{property:"color",scale:"colors"},backgroundColor:{property:"backgroundColor",scale:"colors"},opacity:!0};y.bg=y.backgroundColor;var b=p(y),_=b,k=p({fontFamily:{property:"fontFamily",scale:"fonts"},fontSize:{property:"fontSize",scale:"fontSizes",defaultScale:[12,14,16,20,24,32,48,64,72]},fontWeight:{property:"fontWeight",scale:"fontWeights"},lineHeight:{property:"lineHeight",scale:"lineHeights"},letterSpacing:{property:"letterSpacing",scale:"letterSpacings"},textAlign:!0,fontStyle:!0}),w=k,x=p({alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:!0,flex:!0,flexGrow:!0,flexShrink:!0,flexBasis:!0,justifySelf:!0,alignSelf:!0,order:!0}),S=x,O={space:[0,4,8,16,32,64,128,256,512]},C=p({gridGap:{property:"gridGap",scale:"space",defaultScale:O.space},gridColumnGap:{property:"gridColumnGap",scale:"space",defaultScale:O.space},gridRowGap:{property:"gridRowGap",scale:"space",defaultScale:O.space},gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridAutoRows:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0}),T=C,E={border:{property:"border",scale:"borders"},borderWidth:{property:"borderWidth",scale:"borderWidths"},borderStyle:{property:"borderStyle",scale:"borderStyles"},borderColor:{property:"borderColor",scale:"colors"},borderRadius:{property:"borderRadius",scale:"radii"},borderTop:{property:"borderTop",scale:"borders"},borderTopLeftRadius:{property:"borderTopLeftRadius",scale:"radii"},borderTopRightRadius:{property:"borderTopRightRadius",scale:"radii"},borderRight:{property:"borderRight",scale:"borders"},borderBottom:{property:"borderBottom",scale:"borders"},borderBottomLeftRadius:{property:"borderBottomLeftRadius",scale:"radii"},borderBottomRightRadius:{property:"borderBottomRightRadius",scale:"radii"},borderLeft:{property:"borderLeft",scale:"borders"},borderX:{properties:["borderLeft","borderRight"],scale:"borders"},borderY:{properties:["borderTop","borderBottom"],scale:"borders"},borderTopWidth:{property:"borderTopWidth",scale:"borderWidths"},borderTopColor:{property:"borderTopColor",scale:"colors"},borderTopStyle:{property:"borderTopStyle",scale:"borderStyles"}};E.borderTopLeftRadius={property:"borderTopLeftRadius",scale:"radii"},E.borderTopRightRadius={property:"borderTopRightRadius",scale:"radii"},E.borderBottomWidth={property:"borderBottomWidth",scale:"borderWidths"},E.borderBottomColor={property:"borderBottomColor",scale:"colors"},E.borderBottomStyle={property:"borderBottomStyle",scale:"borderStyles"},E.borderBottomLeftRadius={property:"borderBottomLeftRadius",scale:"radii"},E.borderBottomRightRadius={property:"borderBottomRightRadius",scale:"radii"},E.borderLeftWidth={property:"borderLeftWidth",scale:"borderWidths"},E.borderLeftColor={property:"borderLeftColor",scale:"colors"},E.borderLeftStyle={property:"borderLeftStyle",scale:"borderStyles"},E.borderRightWidth={property:"borderRightWidth",scale:"borderWidths"},E.borderRightColor={property:"borderRightColor",scale:"colors"},E.borderRightStyle={property:"borderRightStyle",scale:"borderStyles"};var j=p(E),A=j,P={background:!0,backgroundImage:!0,backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0};P.bgImage=P.backgroundImage,P.bgSize=P.backgroundSize,P.bgPosition=P.backgroundPosition,P.bgRepeat=P.backgroundRepeat;var M=p(P),R=M,I={space:[0,4,8,16,32,64,128,256,512]},D=p({position:!0,zIndex:{property:"zIndex",scale:"zIndices"},top:{property:"top",scale:"space",defaultScale:I.space},right:{property:"right",scale:"space",defaultScale:I.space},bottom:{property:"bottom",scale:"space",defaultScale:I.space},left:{property:"left",scale:"space",defaultScale:I.space}}),N=D,L={space:[0,4,8,16,32,64,128,256,512]},z=function(e){return"number"===typeof e&&!isNaN(e)},F=function(e,t){if(!z(e))return l(t,e,e);var n=e<0,r=Math.abs(e),i=l(t,r,r);return z(i)?i*(n?-1:1):n?"-"+i:i},B={};B.margin={margin:{property:"margin",scale:"space",transform:F,defaultScale:L.space},marginTop:{property:"marginTop",scale:"space",transform:F,defaultScale:L.space},marginRight:{property:"marginRight",scale:"space",transform:F,defaultScale:L.space},marginBottom:{property:"marginBottom",scale:"space",transform:F,defaultScale:L.space},marginLeft:{property:"marginLeft",scale:"space",transform:F,defaultScale:L.space},marginX:{properties:["marginLeft","marginRight"],scale:"space",transform:F,defaultScale:L.space},marginY:{properties:["marginTop","marginBottom"],scale:"space",transform:F,defaultScale:L.space}},B.margin.m=B.margin.margin,B.margin.mt=B.margin.marginTop,B.margin.mr=B.margin.marginRight,B.margin.mb=B.margin.marginBottom,B.margin.ml=B.margin.marginLeft,B.margin.mx=B.margin.marginX,B.margin.my=B.margin.marginY,B.padding={padding:{property:"padding",scale:"space",defaultScale:L.space},paddingTop:{property:"paddingTop",scale:"space",defaultScale:L.space},paddingRight:{property:"paddingRight",scale:"space",defaultScale:L.space},paddingBottom:{property:"paddingBottom",scale:"space",defaultScale:L.space},paddingLeft:{property:"paddingLeft",scale:"space",defaultScale:L.space},paddingX:{properties:["paddingLeft","paddingRight"],scale:"space",defaultScale:L.space},paddingY:{properties:["paddingTop","paddingBottom"],scale:"space",defaultScale:L.space}},B.padding.p=B.padding.padding,B.padding.pt=B.padding.paddingTop,B.padding.pr=B.padding.paddingRight,B.padding.pb=B.padding.paddingBottom,B.padding.pl=B.padding.paddingLeft,B.padding.px=B.padding.paddingX,B.padding.py=B.padding.paddingY;var V=p(B.margin),W=p(B.padding),G=v(V,W);p({boxShadow:{property:"boxShadow",scale:"shadows"},textShadow:{property:"textShadow",scale:"shadows"}});function U(){return(U=Object.assign||function(e){for(var t=1;t=0)return q(e,t,t);var n=Math.abs(t),r=q(e,n,n);return"string"===typeof r?"-"+r:-1*r},Z=["margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","top","bottom","left","right"].reduce((function(e,t){var n;return U({},e,((n={})[t]=K,n))}),{}),J=function e(t){return function(n){void 0===n&&(n={});var r=U({},Y,{},n.theme||n),i={},a=function(e){return function(t){var n={},r=q(t,"breakpoints",H),i=[null].concat(r.map((function(e){return"@media screen and (min-width: "+e+")"})));for(var a in e){var o="function"===typeof e[a]?e[a](t):e[a];if(null!=o)if(Array.isArray(o))for(var s=0;s1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:d(e)?2:p(e)?3:0}function l(e,t){return 2===u(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return 2===u(e)?e.get(t):e[t]}function f(e,t,n){var r=u(e);2===r?e.set(t,n):3===r?(e.delete(t),e.add(n)):e[t]=n}function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e){return U&&e instanceof Map}function p(e){return q&&e instanceof Set}function v(e){return e.o||e.t}function g(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=J(e);delete t[$];for(var n=Z(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=y),Object.freeze(e),t&&s(e,(function(e,t){return m(t,!0)}),!0)),e}function y(){r(2)}function b(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function _(e){var t=ee[e];return t||r(18,e),t}function k(e,t){ee[e]||(ee[e]=t)}function w(){return W}function x(e,t){t&&(_("Patches"),e.u=[],e.s=[],e.v=t)}function S(e){O(e),e.p.forEach(T),e.p=null}function O(e){e===W&&(W=e.l)}function C(e){return W={p:[],l:W,h:e,m:!0,_:0}}function T(e){var t=e[$];0===t.i||1===t.i?t.j():t.g=!0}function E(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.O||_("ES5").S(t,e,i),i?(n[$].P&&(S(t),r(4)),a(e)&&(e=j(t,e),t.l||P(t,e)),t.u&&_("Patches").M(n[$],e,t.u,t.s)):e=j(t,n,[]),S(t),t.u&&t.v(t.u,t.s),e!==Y?e:void 0}function j(e,t,n){if(b(t))return t;var r=t[$];if(!r)return s(t,(function(i,a){return A(e,r,t,i,a,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return P(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=g(r.k):r.o;s(3===r.i?new Set(i):i,(function(t,a){return A(e,r,i,t,a,n)})),P(e,i,!1),n&&e.u&&_("Patches").R(r,n,e.u,e.s)}return r.o}function A(e,t,n,r,o,s){if(i(o)){var u=j(e,o,s&&t&&3!==t.i&&!l(t.D,r)?s.concat(r):void 0);if(f(n,r,u),!i(u))return;e.m=!1}if(a(o)&&!b(o)){if(!e.h.F&&e._<1)return;j(e,o),t&&t.A.l||P(e,o)}}function P(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&m(t,n)}function M(e,t){var n=e[$];return(n?v(n):e)[t]}function R(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function I(e){e.P||(e.P=!0,e.l&&I(e.l))}function D(e){e.o||(e.o=g(e.t))}function N(e,t,n){var r=d(t)?_("MapSet").N(t,n):p(t)?_("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:w(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=r,a=te;n&&(i=[r],a=ne);var o=Proxy.revocable(i,a),s=o.revoke,u=o.proxy;return r.k=u,r.j=s,u}(t,n):_("ES5").J(t,n);return(n?n.A:w()).p.push(r),r}function L(e){return i(e)||r(22,e),function e(t){if(!a(t))return t;var n,r=t[$],i=u(t);if(r){if(!r.P&&(r.i<4||!_("ES5").K(r)))return r.t;r.I=!0,n=z(t,i),r.I=!1}else n=z(t,i);return s(n,(function(t,i){r&&c(r.t,t)===i||f(n,t,e(i))})),3===i?new Set(n):n}(e)}function z(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return g(e)}function F(){function e(t){if(!a(t))return t;if(Array.isArray(t))return t.map(e);if(d(t))return new Map(Array.from(t.entries()).map((function(t){return[t[0],e(t[1])]})));if(p(t))return new Set(Array.from(t).map(e));var n=Object.create(Object.getPrototypeOf(t));for(var r in t)n[r]=e(t[r]);return l(t,X)&&(n[X]=t[X]),n}function t(t){return i(t)?e(t):t}var n="add";k("Patches",{$:function(t,i){return i.forEach((function(i){for(var a=i.path,o=i.op,s=t,l=0;l1?r-1:0),a=1;a1?r-1:0),a=1;a=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}var a=_("Patches").$;return i(e)?a(e,t):this.produce(e,(function(e){return a(e,t.slice(n+1))}))},e}()),ie=re.produce,ae=re.produceWithPatches.bind(re),oe=re.setAutoFreeze.bind(re),se=(re.setUseProxies.bind(re),re.applyPatches.bind(re));re.createDraft.bind(re),re.finishDraft.bind(re);t.b=ie},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return R})),n.d(t,"b",(function(){return P})),n.d(t,"c",(function(){return M}));var r=n(10),i=n.n(r);var a=n(24);function o(){return(o=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function k(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&n.callAllDeriveCallbacks(0,y),n.callAllChangeCallbacks()}}},this.applyChanges=function(e){var t,r;n.value=g(n.value,e.value),n.nodes=g(n.nodes,e.nodes),n.changeBuffer={value:((null===(t=n.changeBuffer)||void 0===t?void 0:t.value)||[]).concat(e.value),nodes:((null===(r=n.changeBuffer)||void 0===r?void 0:r.nodes)||[]).concat(e.nodes)}},this.replace=function(e){e?n.setBuffer||(n.setBuffer={value:[],nodes:[]}):n.setBuffer=void 0},this.newHistoryItem=function(){n.setBuffer=n.replaceByDefault?{value:[],nodes:[]}:void 0},this.deriving=!1,this.callAllDeriveCallbacks=function(e,t){n.deriveCallbackRefs.forEach((function(r){n.derive(r,e,t)}))},this.derive=function(e,t,r){var i;if(!n.deriving){n.deriving=!0;var a=e[0],o=null!==(i=n.changeBuffer)&&void 0!==i?i:{value:[],nodes:[]};a(n.value,{go:t,replace:r,patches:o}),n.deriving=!1}},this.buffer=function(){n.bufferingChanges=!0,n.newHistoryItem()},this.done=function(){n.bufferingChanges=!1,n.callAllChangeCallbacks()},this.callAllChangeCallbacks=function(){n.bufferingChanges||(n.newHistoryItem(),n.changeBuffer&&(n.changeCallbackRefs.forEach((function(e){var t=e[0],r=e[1],i=n.valueGettersByType[t](r);n.change(e,i,n.changeBuffer)})),n.changeBuffer=void 0))},this.change=function(e,t,n){var r=e[2],i=e[3];Object.is(t,i)||(r(t,{patches:n}),e[3]=t)},this.historyIndex=0,this.historyStack=[],this.historyState={canUndo:!1,canRedo:!1},this.historyPush=function(e){n.historyStack.length=n.historyIndex,n.historyStack.push(e),n.historyStack.length>n.historyLimit?n.historyStack.shift():n.historyIndex++,n.updateHistoryState()},this.historyReplace=function(e){if(0!==n.historyIndex){n.historyStack.length=n.historyIndex;var t=n.historyStack[n.historyIndex-1];n.historyStack[n.historyIndex-1]={do:{value:t.do.value.concat(e.do.value),nodes:t.do.nodes.concat(e.do.nodes)},undo:{value:e.undo.value.concat(t.undo.value),nodes:e.undo.nodes.concat(t.undo.nodes)}}}},this.going=!1,this.go=function(e){if(0!==e&&!n.going){n.going=!0;var t=Math.min(Math.max(0,n.historyIndex+e),n.historyStack.length),r=e>0?n.historyStack.slice(n.historyIndex,t).map((function(e){return e.do})):n.historyStack.slice(t,n.historyIndex).reverse().map((function(e){return e.undo})),i={value:[],nodes:[]};r.forEach((function(e){var t,n;(t=i.value).push.apply(t,e.value),(n=i.nodes).push.apply(n,e.nodes)})),n.historyIndex=t,n.updateHistoryState(),n.applyChanges(i),n.callAllDeriveCallbacks(e,!1),n.callAllChangeCallbacks(),n.going=!1}},this.updateHistoryState=function(){var e=n.historyIndex>0,t=n.historyIndex=t:w(n)>=t})),r=this._automationEvents[n];if(-1!==n&&(this._automationEvents=this._automationEvents.slice(0,n)),_(e)){var i=this._automationEvents[this._automationEvents.length-1];if(void 0!==r&&v(r)){if(T(i))throw new Error("The internal list is malformed.");var a=m(i)?i.startTime+i.duration:w(i),o=m(i)?i.values[i.values.length-1]:i.value,s=d(r)?x(t,a,o,r):S(t,a,o,r),h=d(r)?u(s,t,this._currenTime):l(s,t,this._currenTime);this._automationEvents.push(h)}void 0!==i&&T(i)&&this._automationEvents.push(c(this.getValue(t),t)),void 0!==i&&m(i)&&i.startTime+i.duration>t&&(this._automationEvents[this._automationEvents.length-1]=f(new Float32Array([6,7]),i.startTime,t-i.startTime))}}else{var g=this._automationEvents.findIndex((function(e){return w(e)>t})),y=-1===g?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[g-1];if(void 0!==y&&m(y)&&w(y)+y.duration>t)return!1;var b=d(e)?u(e.value,e.endTime,this._currenTime):p(e)?l(e.value,t,this._currenTime):e;if(-1===g)this._automationEvents.push(b);else{if(m(e)&&t+e.duration>w(this._automationEvents[g]))return!1;this._automationEvents.splice(g,0,b)}}return!0}},{key:"flush",value:function(e){var t=this._automationEvents.findIndex((function(t){return w(t)>e}));if(t>1){var n=this._automationEvents.slice(t-1),r=n[0];T(r)&&n.unshift(c(y(this._automationEvents,t-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:"getValue",value:function(e){if(0===this._automationEvents.length)return this._defaultValue;var t=this._automationEvents.findIndex((function(t){return w(t)>e})),n=this._automationEvents[t],r=(-1===t?this._automationEvents.length:t)-1,i=this._automationEvents[r];if(void 0!==i&&T(i)&&(void 0===n||!v(n)||n.insertTime>e))return h(e,y(this._automationEvents,r-1,i.startTime,this._defaultValue),i);if(void 0!==i&&g(i)&&(void 0===n||!v(n)))return i.value;if(void 0!==i&&m(i)&&(void 0===n||!v(n)||i.startTime+i.duration>e))return et?t:e}function a(e,t){return e359;)e-=360;return e}(e),t=a(i(t,100),0),n=a(i(n,100),0),"#"+r(e,t/=100,n/=100).map((function(e){return(256+e).toString(16).substr(-2)})).join("")}},function(e,t,n){"use strict";e.exports=n(52)},function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[1,0,0,1,0,0];Object(l.a)(this,e),this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}return Object(c.a)(e,[{key:"reset",value:function(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}},{key:"copy",value:function(){return new e(this.m)}},{key:"copyInto",value:function(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}},{key:"point",value:function(e){var t=this.m;return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}},{key:"translate",value:function(e,t){return this.m[4]+=this.m[0]*e+this.m[2]*t,this.m[5]+=this.m[1]*e+this.m[3]*t,this}},{key:"scale",value:function(e,t){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=t,this.m[3]*=t,this}},{key:"rotate",value:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.m[0]*t+this.m[2]*n,i=this.m[1]*t+this.m[3]*n,a=this.m[0]*-n+this.m[2]*t,o=this.m[1]*-n+this.m[3]*t;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=o,this}},{key:"getTranslation",value:function(){return{x:this.m[4],y:this.m[5]}}},{key:"skew",value:function(e,t){var n=this.m[0]+this.m[2]*t,r=this.m[1]+this.m[3]*t,i=this.m[2]+this.m[0]*e,a=this.m[3]+this.m[1]*e;return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this}},{key:"multiply",value:function(e){var t=this.m[0]*e.m[0]+this.m[2]*e.m[1],n=this.m[1]*e.m[0]+this.m[3]*e.m[1],r=this.m[0]*e.m[2]+this.m[2]*e.m[3],i=this.m[1]*e.m[2]+this.m[3]*e.m[3],a=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],o=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}},{key:"invert",value:function(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),t=this.m[3]*e,n=-this.m[1]*e,r=-this.m[2]*e,i=this.m[0]*e,a=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),o=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=t,this.m[1]=n,this.m[2]=r,this.m[3]=i,this.m[4]=a,this.m[5]=o,this}},{key:"getMatrix",value:function(){return this.m}},{key:"setAbsolutePosition",value:function(e,t){var n=this.m[0],r=this.m[1],i=this.m[2],a=this.m[3],o=this.m[4],s=(n*(t-this.m[5])-r*(e-o))/(n*a-r*i),u=(e-o-i*s)/n;return this.translate(u,s)}},{key:"decompose",value:function(){var e=this.m[0],t=this.m[1],n=this.m[2],r=this.m[3],i=e*r-t*n,a={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=e||0!=t){var o=Math.sqrt(e*e+t*t);a.rotation=t>0?Math.acos(e/o):-Math.acos(e/o),a.scaleX=o,a.scaleY=i/o,a.skewX=(e*n+t*r)/i,a.skewY=0}else if(0!=n||0!=r){var s=Math.sqrt(n*n+r*r);a.rotation=Math.PI/2-(r>0?Math.acos(-n/s):-Math.acos(n/s)),a.scaleX=i/s,a.scaleY=s,a.skewX=0,a.skewY=(e*n+t*r)/i}return a.rotation=b._getRotation(a.rotation),a}}]),e}(),h=Math.PI/180,d=180/Math.PI,p="Konva error: ",v={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},g=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,m=[],y="undefined"!==typeof requestAnimationFrame&&requestAnimationFrame||function(e){setTimeout(e,60)},b={_isElement:function(e){return!(!e||1!=e.nodeType)},_isFunction:function(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject:function(e){return!!e&&e.constructor===Object},_isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},_isNumber:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&!isNaN(e)&&isFinite(e)},_isString:function(e){return"[object String]"===Object.prototype.toString.call(e)},_isBoolean:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},isObject:function(e){return e instanceof Object},isValidSelector:function(e){if("string"!==typeof e)return!1;var t=e[0];return"#"===t||"."===t||t===t.toUpperCase()},_sign:function(e){return 0===e||e>0?1:-1},requestAnimFrame:function(e){m.push(e),1===m.length&&y((function(){var e=m;m=[],e.forEach((function(e){e()}))}))},createCanvasElement:function(){var e=document.createElement("canvas");try{e.style=e.style||{}}catch(t){}return e},createImageElement:function(){return document.createElement("img")},_isInDocument:function(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage:function(e,t){var n=b.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex:function(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb:function(e){e=e.replace("#","");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}},getRandomColor:function(){for(var e=(16777215*Math.random()<<0).toString(16);e.length<6;)e="0"+e;return"#"+e},getRGB:function(e){var t;return e in v?{r:(t=v[e])[0],g:t[1],b:t[2]}:"#"===e[0]?this._hexToRgb(e.substring(1)):"rgb("===e.substr(0,4)?(t=g.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA:function(e){return e=e||"black",b._namedColorToRBA(e)||b._hex3ColorToRGBA(e)||b._hex6ColorToRGBA(e)||b._rgbColorToRGBA(e)||b._rgbaColorToRGBA(e)||b._hslColorToRGBA(e)},_namedColorToRBA:function(e){var t=v[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA:function(e){if(0===e.indexOf("rgb(")){var t=(e=e.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA:function(e){if(0===e.indexOf("rgba(")){var t=(e=e.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex6ColorToRGBA:function(e){if("#"===e[0]&&7===e.length)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex3ColorToRGBA:function(e){if("#"===e[0]&&4===e.length)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA:function(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){var t,n,r,i=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),l=(m=i,Object(a.a)(m)||Object(o.a)(m)||Object(s.a)(m)||Object(u.a)()),c=(l[0],l.slice(1)),f=Number(c[0])/360,h=Number(c[1])/100,d=Number(c[2])/100;if(0===h)return r=255*d,{r:Math.round(r),g:Math.round(r),b:Math.round(r),a:1};for(var p=2*d-(t=d<.5?d*(1+h):d+h-d*h),v=[0,0,0],g=0;g<3;g++)(n=f+1/3*-(g-1))<0&&n++,n>1&&n--,r=6*n<1?p+6*(t-p)*n:2*n<1?t:3*n<2?p+(t-p)*(2/3-n)*6:p,v[g]=255*r;return{r:Math.round(v[0]),g:Math.round(v[1]),b:Math.round(v[2]),a:1}}var m},haveIntersection:function(e,t){return!(t.x>e.x+e.width||t.x+t.widthe.y+e.height||t.y+t.height1?(o=n,s=r,u=(n-i)*(n-i)+(r-a)*(r-a)):u=((o=e+c*(n-e))-i)*(o-i)+((s=t+c*(r-t))-a)*(s-a)}return[o,s,u]},_getProjectionToLine:function(e,t,n){var r=b.cloneObject(e),i=Number.MAX_VALUE;return t.forEach((function(a,o){if(n||o!==t.length-1){var s=t[(o+1)%t.length],u=b._getProjectionToSegment(a.x,a.y,s.x,s.y,e.x,e.y),l=u[0],c=u[1],f=u[2];ft.length){var o=t;t=e,e=o}for(r=0;r255?255:e<0?0:Math.round(e)}function w(){if(i.a.isUnminified)return function(e,t){return b._isNumber(e)||b.warn(_(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function x(e){if(i.a.isUnminified)return function(t,n){var r=b._isNumber(t),i=b._isArray(t)&&t.length==e;return r||i||b.warn(_(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}function S(){if(i.a.isUnminified)return function(e,t){return b._isNumber(e)||"auto"===e||b.warn(_(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function O(){if(i.a.isUnminified)return function(e,t){return b._isString(e)||b.warn(_(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function C(){if(i.a.isUnminified)return function(e,t){var n=b._isString(e),r="[object CanvasGradient]"===Object.prototype.toString.call(e)||e&&e.addColorStop;return n||r||b.warn(_(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function T(){if(i.a.isUnminified)return function(e,t){return!0===e||!1===e||b.warn(_(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}var E="get",j="set",A={addGetterSetter:function(e,t,n,r,i){A.addGetter(e,t,n),A.addSetter(e,t,r,i),A.addOverloadedGetterSetter(e,t)},addGetter:function(e,t,n){var r=E+b._capitalize(t);e.prototype[r]=e.prototype[r]||function(){var e=this.attrs[t];return void 0===e?n:e}},addSetter:function(e,t,n,r){var i=j+b._capitalize(t);e.prototype[i]||A.overWriteSetter(e,t,n,r)},overWriteSetter:function(e,t,n,r){var i=j+b._capitalize(t);e.prototype[i]=function(e){return n&&void 0!==e&&null!==e&&(e=n.call(this,e,t)),this._setAttr(t,e),r&&r.call(this),this}},addComponentsGetterSetter:function(e,t,n,r,a){var o,s,u=n.length,l=b._capitalize,c=E+l(t),f=j+l(t);e.prototype[c]=function(){var e={};for(o=0;o=100&&t.shift()}},{key:"reset",value:function(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}},{key:"getCanvas",value:function(){return this.canvas}},{key:"clear",value:function(e){var t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}},{key:"_applyLineCap",value:function(e){var t=e.getLineCap();t&&this.setAttr("lineCap",t)}},{key:"_applyOpacity",value:function(e){var t=e.getAbsoluteOpacity();1!==t&&this.setAttr("globalAlpha",t)}},{key:"_applyLineJoin",value:function(e){var t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}},{key:"setAttr",value:function(e,t){this._context[e]=t}},{key:"arc",value:function(e,t,n,r,i,a){this._context.arc(e,t,n,r,i,a)}},{key:"arcTo",value:function(e,t,n,r,i){this._context.arcTo(e,t,n,r,i)}},{key:"beginPath",value:function(){this._context.beginPath()}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){this._context.bezierCurveTo(e,t,n,r,i,a)}},{key:"clearRect",value:function(e,t,n,r){this._context.clearRect(e,t,n,r)}},{key:"clip",value:function(){this._context.clip()}},{key:"closePath",value:function(){this._context.closePath()}},{key:"createImageData",value:function(e,t){var n=arguments;return 2===n.length?this._context.createImageData(e,t):1===n.length?this._context.createImageData(e):void 0}},{key:"createLinearGradient",value:function(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}},{key:"createPattern",value:function(e,t){return this._context.createPattern(e,t)}},{key:"createRadialGradient",value:function(e,t,n,r,i,a){return this._context.createRadialGradient(e,t,n,r,i,a)}},{key:"drawImage",value:function(e,t,n,r,i,a,o,s,u){var l=arguments,c=this._context;3===l.length?c.drawImage(e,t,n):5===l.length?c.drawImage(e,t,n,r,i):9===l.length&&c.drawImage(e,t,n,r,i,a,o,s,u)}},{key:"ellipse",value:function(e,t,n,r,i,a,o,s){this._context.ellipse(e,t,n,r,i,a,o,s)}},{key:"isPointInPath",value:function(e,t){return this._context.isPointInPath(e,t)}},{key:"fill",value:function(e){e?this._context.fill(e):this._context.fill()}},{key:"fillRect",value:function(e,t,n,r){this._context.fillRect(e,t,n,r)}},{key:"strokeRect",value:function(e,t,n,r){this._context.strokeRect(e,t,n,r)}},{key:"fillText",value:function(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}},{key:"measureText",value:function(e){return this._context.measureText(e)}},{key:"getImageData",value:function(e,t,n,r){return this._context.getImageData(e,t,n,r)}},{key:"lineTo",value:function(e,t){this._context.lineTo(e,t)}},{key:"moveTo",value:function(e,t){this._context.moveTo(e,t)}},{key:"rect",value:function(e,t,n,r){this._context.rect(e,t,n,r)}},{key:"putImageData",value:function(e,t,n){this._context.putImageData(e,t,n)}},{key:"quadraticCurveTo",value:function(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}},{key:"restore",value:function(){this._context.restore()}},{key:"rotate",value:function(e){this._context.rotate(e)}},{key:"save",value:function(){this._context.save()}},{key:"scale",value:function(e,t){this._context.scale(e,t)}},{key:"setLineDash",value:function(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}},{key:"getLineDash",value:function(){return this._context.getLineDash()}},{key:"setTransform",value:function(e,t,n,r,i,a){this._context.setTransform(e,t,n,r,i,a)}},{key:"stroke",value:function(e){e?this._context.stroke(e):this._context.stroke()}},{key:"strokeText",value:function(e,t,n,r){this._context.strokeText(e,t,n,r)}},{key:"transform",value:function(e,t,n,r,i,a){this._context.transform(e,t,n,r,i,a)}},{key:"translate",value:function(e,t){this._context.translate(e,t)}},{key:"_enableTrace",value:function(){var e,t,n=this,r=D.length,i=this.setAttr,a=function(e){var r,i=n[e];n[e]=function(){return t=I(Array.prototype.slice.call(arguments,0)),r=i.apply(n,arguments),n._trace({method:e,args:t}),r}};for(e=0;e0&&void 0!==arguments[0]?arguments[0]:{width:0,height:0};return Object(l.a)(this,n),(e=t.call(this,r)).context=new z(Object(P.a)(e)),e.setSize(r.width,r.height),e}return n}(B),W=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{width:0,height:0};return Object(l.a)(this,n),(e=t.call(this,r)).hitCanvas=!0,e.context=new F(Object(P.a)(e)),e.setSize(r.width,r.height),e}return n}(B),G={get isDragging(){var e=!1;return G._dragElements.forEach((function(t){"dragging"===t.dragStatus&&(e=!0)})),e},justDragged:!1,get node(){var e;return G._dragElements.forEach((function(t){e=t.node})),e},_dragElements:new Map,_drag:function(e){var t=[];G._dragElements.forEach((function(n,r){var i=n.node,a=i.getStage();a.setPointersPositions(e),void 0===n.pointerId&&(n.pointerId=b._getFirstPointerId(e));var o=a._changedPointerPositions.find((function(e){return e.id===n.pointerId}));if(o){if("dragging"!==n.dragStatus){var s=i.dragDistance();if(Math.max(Math.abs(o.x-n.startPointerPos.x),Math.abs(o.y-n.startPointerPos.y))1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isVisible(e)&&this._isListening(e);var n=this.getLayer(),r=!1;G._dragElements.forEach((function(e){"dragging"===e.dragStatus&&("Stage"===e.node.nodeType||e.node.getLayer()===n)&&(r=!0)}));var a=!t&&!i.a.hitOnDragEnabled&&r;return this.isListening()&&this.isVisible()&&!a}},{key:"show",value:function(){return this.visible(!0),this}},{key:"hide",value:function(){return this.visible(!1),this}},{key:"getZIndex",value:function(){return this.index||0}},{key:"getAbsoluteZIndex",value:function(){var e,t,n,r,i=this.getDepth(),a=this,o=0;return"Stage"!==a.nodeType&&function s(u){for(e=[],t=u.length,n=0;n0&&e[0].getDepth()<=i&&s(e)}(a.getStage().getChildren()),o}},{key:"getDepth",value:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e}},{key:"_batchTransformChanges",value:function(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(te),this._clearSelfAndDescendantCache(H)),this._needClearTransformCache=!1}},{key:"setPosition",value:function(e){var t=this;return this._batchTransformChanges((function(){t.x(e.x),t.y(e.y)})),this}},{key:"getPosition",value:function(){return{x:this.x(),y:this.y()}}},{key:"getRelativePointerPosition",value:function(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var t=this.getAbsoluteTransform().copy();return t.invert(),t.point(e)}},{key:"getAbsolutePosition",value:function(e){for(var t=!1,n=this.parent;n;){if(n.isCached()){t=!0;break}n=n.parent}t&&!e&&(e=!0);var r=this.getAbsoluteTransform(e).getMatrix(),i=new f,a=this.offset();return i.m=r.slice(),i.translate(a.x,a.y),i.getTranslation()}},{key:"setAbsolutePosition",value:function(e){var t=this._clearTransform();this.attrs.x=t.x,this.attrs.y=t.y,delete t.x,delete t.y,this._clearCache(te);var n=this._getAbsoluteTransform().copy();return n.invert(),n.translate(e.x,e.y),e={x:this.attrs.x+n.getTranslation().x,y:this.attrs.y+n.getTranslation().y},this._setTransform(t),this.setPosition({x:e.x,y:e.y}),this._clearCache(te),this._clearSelfAndDescendantCache(H),this}},{key:"_setTransform",value:function(e){var t;for(t in e)this.attrs[t]=e[t]}},{key:"_clearTransform",value:function(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}},{key:"move",value:function(e){var t=e.x,n=e.y,r=this.x(),i=this.y();return void 0!==t&&(r+=t),void 0!==n&&(i+=n),this.setPosition({x:r,y:i}),this}},{key:"_eachAncestorReverse",value:function(e,t){var n,r,i=[],a=this.getParent();if(!t||t._id!==this._id){for(i.unshift(this);a&&(!t||a._id!==t._id);)i.unshift(a),a=a.parent;for(n=i.length,r=0;r0&&(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0)}},{key:"moveToBottom",value:function(){if(!this.parent)return b.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0&&(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}},{key:"setZIndex",value:function(e){if(!this.parent)return b.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&b.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var t=this.index;return this.parent.children.splice(t,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}},{key:"getAbsoluteOpacity",value:function(){return this._getCache(U,this._getAbsoluteOpacity)}},{key:"_getAbsoluteOpacity",value:function(){var e=this.opacity(),t=this.getParent();return t&&!t._isUnderCache&&(e*=t.getAbsoluteOpacity()),e}},{key:"moveTo",value:function(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}},{key:"toObject",value:function(){var e,t,n,r,i={},a=this.getAttrs();for(e in i.attrs={},a)t=a[e],b.isObject(t)&&!b._isPlainObject(t)&&!b._isArray(t)||(n="function"===typeof this[e]&&this[e],delete a[e],r=n?n.call(this):null,a[e]=t,r!==t&&(i.attrs[e]=t));return i.className=this.getClassName(),b._prepareToStringify(i)}},{key:"toJSON",value:function(){return JSON.stringify(this.toObject())}},{key:"getParent",value:function(){return this.parent}},{key:"findAncestors",value:function(e,t,n){var r=[];t&&this._isMatch(e)&&r.push(this);for(var i=this.parent;i;){if(i===n)return r;i._isMatch(e)&&r.push(i),i=i.parent}return r}},{key:"isAncestorOf",value:function(e){return!1}},{key:"findAncestor",value:function(e,t,n){return this.findAncestors(e,t,n)[0]}},{key:"_isMatch",value:function(e){if(!e)return!1;if("function"===typeof e)return e(this);var t,n,r=e.replace(/ /g,"").split(","),i=r.length;for(t=0;t1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return t.target=t.target||this,n?this._fireAndBubble(e,t):this._fire(e,t),this}},{key:"getAbsoluteTransform",value:function(e){return e?this._getAbsoluteTransform(e):this._getCache(H,this._getAbsoluteTransform)}},{key:"_getAbsoluteTransform",value:function(e){var t;if(e)return t=new f,this._eachAncestorReverse((function(e){var n=e.transformsEnabled();"all"===n?t.multiply(e.getTransform()):"position"===n&&t.translate(e.x()-e.offsetX(),e.y()-e.offsetY())}),e),t;t=this._cache.get(H)||new f,this.parent?this.parent.getAbsoluteTransform().copyInto(t):t.reset();var n=this.transformsEnabled();if("all"===n)t.multiply(this.getTransform());else if("position"===n){var r=this.attrs.x||0,i=this.attrs.y||0,a=this.attrs.offsetX||0,o=this.attrs.offsetY||0;t.translate(r-a,i-o)}return t.dirty=!1,t}},{key:"getAbsoluteScale",value:function(e){for(var t=this;t;)t._isUnderCache&&(e=t),t=t.getParent();var n=this.getAbsoluteTransform(e).decompose();return{x:n.scaleX,y:n.scaleY}}},{key:"getAbsoluteRotation",value:function(){return this.getAbsoluteTransform().decompose().rotation}},{key:"getTransform",value:function(){return this._getCache(te,this._getTransform)}},{key:"_getTransform",value:function(){var e,t,n=this._cache.get(te)||new f;n.reset();var r=this.x(),a=this.y(),o=i.a.getAngle(this.rotation()),s=null!==(e=this.attrs.scaleX)&&void 0!==e?e:1,u=null!==(t=this.attrs.scaleY)&&void 0!==t?t:1,l=this.attrs.skewX||0,c=this.attrs.skewY||0,h=this.attrs.offsetX||0,d=this.attrs.offsetY||0;return 0===r&&0===a||n.translate(r,a),0!==o&&n.rotate(o),0===l&&0===c||n.skew(l,c),1===s&&1===u||n.scale(s,u),0===h&&0===d||n.translate(-1*h,-1*d),n.dirty=!1,n}},{key:"clone",value:function(e){var t,n,r,i,a,o=b.cloneObject(this.attrs);for(t in e)o[t]=e[t];var s=new this.constructor(o);for(t in this.eventListeners)for(r=(n=this.eventListeners[t]).length,i=0;i1&&void 0!==arguments[1])||arguments[1];G._dragElements.has(this._id)||this._createDragElement(e);var n=G._dragElements.get(this._id);n.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},t)}},{key:"_setDragPosition",value:function(e,t){var n=this.getStage()._getPointerById(t.pointerId);if(n){var r={x:n.x-t.offset.x,y:n.y-t.offset.y},i=this.dragBoundFunc();if(void 0!==i){var a=i.call(this,r,e);a?r=a:b.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}},{key:"stopDrag",value:function(e){var t=G._dragElements.get(this._id);t&&(t.dragStatus="stopped"),G._endDragBefore(e),G._endDragAfter(e)}},{key:"setDraggable",value:function(e){this._setAttr("draggable",e),this._dragChange()}},{key:"isDragging",value:function(){var e=G._dragElements.get(this._id);return!!e&&"dragging"===e.dragStatus}},{key:"_listenDrag",value:function(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(e){var t=this;if((!(void 0!==e.evt.button)||i.a.dragButtons.indexOf(e.evt.button)>=0)&&!this.isDragging()){var n=!1;G._dragElements.forEach((function(e){t.isAncestorOf(e.node)&&(n=!0)})),n||this._createDragElement(e)}}))}},{key:"_dragChange",value:function(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;var e=G._dragElements.get(this._id),t=e&&"dragging"===e.dragStatus,n=e&&"ready"===e.dragStatus;t?this.stopDrag():n&&G._dragElements.delete(this._id)}}},{key:"_dragCleanup",value:function(){this.off("mousedown.konva"),this.off("touchstart.konva")}},{key:"isClientRectOnScreen",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{x:0,y:0},t=this.getStage();if(!t)return!1;var n={x:-e.x,y:-e.y,width:t.width()+e.x,height:t.height()+e.y};return b.haveIntersection(n,this.getClientRect())}}],[{key:"create",value:function(e,t){return b._isString(e)&&(e=JSON.parse(e)),this._createNode(e,t)}},{key:"_createNode",value:function(t,n){var r,a,o,s=e.prototype.getClassName.call(t),u=t.children;if(n&&(t.attrs.container=n),i.a[s]||(b.warn('Can not find a node with class name "'+s+'". Fallback to "Shape".'),s="Shape"),r=new(0,i.a[s])(t.attrs),u)for(a=u.length,o=0;o0}},{key:"removeChildren",value:function(){return this.getChildren().forEach((function(e){e.parent=null,e.index=0,e.remove()})),this.children=[],this}},{key:"destroyChildren",value:function(){return this.getChildren().forEach((function(e){e.parent=null,e.index=0,e.destroy()})),this.children=[],this}},{key:"add",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n1){for(var r=0;r0?t[0]:void 0}},{key:"_generalFind",value:function(e,t){var n=[];return this._descendants((function(r){var i=r._isMatch(e);return i&&n.push(r),!(!i||!t)})),n}},{key:"_descendants",value:function(e){var t,n=this.getChildren(),r=Object(se.a)(n);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(e(i))return!0;if(i.hasChildren()&&i._descendants(e))return!0}}catch(a){r.e(a)}finally{r.f()}return!1}},{key:"toObject",value:function(){var e=ae.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach((function(t){e.children.push(t.toObject())})),e}},{key:"isAncestorOf",value:function(e){for(var t=e.getParent();t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}},{key:"clone",value:function(e){var t=ae.prototype.clone.call(this,e);return this.getChildren().forEach((function(e){t.add(e.clone())})),t}},{key:"getAllIntersections",value:function(e){var t=[];return this.find("Shape").forEach((function(n){n.isVisible()&&n.intersects(e)&&t.push(n)})),t}},{key:"_clearSelfAndDescendantCache",value:function(e){var t;Object(ue.a)(Object(le.a)(n.prototype),"_clearSelfAndDescendantCache",this).call(this,e),this.isCached()||null===(t=this.children)||void 0===t||t.forEach((function(t){t._clearSelfAndDescendantCache(e)}))}},{key:"_setChildrenIndices",value:function(){var e;null===(e=this.children)||void 0===e||e.forEach((function(e,t){e.index=t})),this._requestDraw()}},{key:"drawScene",value:function(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas(),i=r&&r.getContext(),a=this._getCanvasCache(),o=a&&a.scene,s=r&&r.isCache;if(!this.isVisible()&&!s)return this;if(o){i.save();var u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",r,t);return this}},{key:"drawHit",value:function(e,t){if(!this.shouldDrawHit(t))return this;var n=this.getLayer(),r=e||n&&n.hitCanvas,i=r&&r.getContext(),a=this._getCanvasCache();if(a&&a.hit){i.save();var o=this.getAbsoluteTransform(t).getMatrix();i.transform(o[0],o[1],o[2],o[3],o[4],o[5]),this._drawCachedHitCanvas(i),i.restore()}else this._drawChildren("drawHit",r,t);return this}},{key:"_drawChildren",value:function(e,t,n){var r,i=t&&t.getContext(),a=this.clipWidth(),o=this.clipHeight(),s=this.clipFunc(),u=a&&o||s,l=n===this;if(u){i.save();var c=this.getAbsoluteTransform(n),f=c.getMatrix();if(i.transform(f[0],f[1],f[2],f[3],f[4],f[5]),i.beginPath(),s)s.call(this,i,this);else{var h=this.clipX(),d=this.clipY();i.rect(h,d,a,o)}i.clip(),f=c.copy().invert().getMatrix(),i.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var p=!l&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===e;p&&(i.save(),i._applyGlobalCompositeOperation(this)),null===(r=this.children)||void 0===r||r.forEach((function(r){r[e](t,n)})),p&&i.restore(),u&&i.restore()}},{key:"getClientRect",value:function(e){var t,n,r,i,a,o=(e=e||{}).skipTransform,s=e.relativeTo,u={x:1/0,y:1/0,width:0,height:0},l=this;null===(t=this.children)||void 0===t||t.forEach((function(t){if(t.visible()){var o=t.getClientRect({relativeTo:l,skipShadow:e.skipShadow,skipStroke:e.skipStroke});0===o.width&&0===o.height||(void 0===n?(n=o.x,r=o.y,i=o.x+o.width,a=o.y+o.height):(n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+o.width),a=Math.max(a,o.y+o.height)))}}));for(var c=this.find("Shape"),f=!1,h=0;h=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse"},He=function(e){var t=qe(e);return"pointer"===t?i.a.pointerEventsEnabled&&Ue.pointer:"touch"===t?Ue.touch:"mouse"===t?Ue.mouse:void 0};function Ye(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(e.clipFunc||e.clipWidth||e.clipHeight)&&b.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var Xe=[],$e=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(l.a)(this,n),(r=t.call(this,Ye(e)))._pointerPositions=[],r._changedPointerPositions=[],r._buildDOM(),r._bindContentEvents(),Xe.push(Object(P.a)(r)),r.on("widthChange.konva heightChange.konva",r._resizeDOM),r.on("visibleChange.konva",r._checkVisibility),r.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(function(){Ye(r.attrs)})),r._checkVisibility(),r}return Object(c.a)(n,[{key:"_validateAdd",value:function(e){var t="Layer"===e.getType(),n="FastLayer"===e.getType();t||n||b.throw("You may only add layers to the stage.")}},{key:"_checkVisibility",value:function(){if(this.content){var e=this.visible()?"":"none";this.content.style.display=e}}},{key:"setContainer",value:function(e){if("string"===typeof e){if("."===e.charAt(0)){var t=e.slice(1);e=document.getElementsByClassName(t)[0]}else{var n;n="#"!==e.charAt(0)?e:e.slice(1),e=document.getElementById(n)}if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}},{key:"shouldDrawHit",value:function(){return!0}},{key:"clear",value:function(){var e,t=this.children,n=t.length;for(e=0;e-1&&Xe.splice(t,1),this}},{key:"getPointerPosition",value:function(){var e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(b.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}},{key:"_getPointerById",value:function(e){return this._pointerPositions.find((function(t){return t.id===e}))}},{key:"getPointersPositions",value:function(){return this._pointerPositions}},{key:"getStage",value:function(){return this}},{key:"getContent",value:function(){return this.content}},{key:"_toKonvaCanvas",value:function(e){(e=e||{}).x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var t=new V({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach((function(t){if(t.isVisible()){var r=t._toKonvaCanvas(e);n.drawImage(r._canvas,e.x,e.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),t}},{key:"getIntersection",value:function(e){if(!e)return null;var t,n=this.children;for(t=n.length-1;t>=0;t--){var r=n[t].getIntersection(e);if(r)return r}return null}},{key:"_resizeDOM",value:function(){var e=this.width(),t=this.height();this.content&&(this.content.style.width=e+"px",this.content.style.height=t+"px"),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach((function(n){n.setSize({width:e,height:t}),n.draw()}))}},{key:"add",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),a=1;a1){for(var o=0;o5&&b.warn("The stage has "+s+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),i.a.isBrowser&&this.content.appendChild(e.canvas._canvas),this}},{key:"getParent",value:function(){return null}},{key:"getLayer",value:function(){return null}},{key:"hasPointerCapture",value:function(e){return _e(e,this)}},{key:"setPointerCapture",value:function(e){ke(e,this)}},{key:"releaseCapture",value:function(e){we(e)}},{key:"getLayers",value:function(){return this.children}},{key:"_bindContentEvents",value:function(){var e=this;i.a.isBrowser&&Ge.forEach((function(t){var n=Object(pe.a)(t,2),r=n[0],i=n[1];e.content.addEventListener(r,(function(t){e[i](t)}))}))}},{key:"_pointerenter",value:function(e){this.setPointersPositions(e);var t=He(e.type);this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}},{key:"_pointerover",value:function(e){this.setPointersPositions(e);var t=He(e.type);this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}},{key:"_getTargetShape",value:function(e){var t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}},{key:"_pointerleave",value:function(e){var t=He(e.type),n=qe(e.type);if(t){this.setPointersPositions(e);var r=this._getTargetShape(n),a=!G.isDragging||i.a.hitOnDragEnabled;r&&a?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):a&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}},{key:"_pointerdown",value:function(e){var t=this,n=He(e.type),r=qe(e.type);if(n){this.setPointersPositions(e);var a=!1;this._changedPointerPositions.forEach((function(o){var s=t.getIntersection(o);if(G.justDragged=!1,i.a["_"+r+"ListenClick"]=!0,s&&s.isListening()){i.a.capturePointerEventsEnabled&&s.setPointerCapture(o.id),t[r+"ClickStartShape"]=s,s._fireAndBubble(n.pointerdown,{evt:e,pointerId:o.id}),a=!0;var u=e.type.indexOf("touch")>=0;s.preventDefault()&&e.cancelable&&u&&e.preventDefault()}})),a||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}},{key:"_pointermove",value:function(e){var t=this,n=He(e.type),r=qe(e.type);if(n&&(G.isDragging&&G.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e),!G.isDragging||i.a.hitOnDragEnabled)){var a={},o=!1,s=this._getTargetShape(r);this._changedPointerPositions.forEach((function(i){var u=ye(i.id)||t.getIntersection(i),l=i.id,c={evt:e,pointerId:l},f=s!==u;if(f&&s&&(s._fireAndBubble(n.pointerout,c,u),s._fireAndBubble(n.pointerleave,c,u)),u){if(a[u._id])return;a[u._id]=!0}u&&u.isListening()?(o=!0,f&&(u._fireAndBubble(n.pointerover,c,s),u._fireAndBubble(n.pointerenter,c,s),t[r+"targetShape"]=u),u._fireAndBubble(n.pointermove,c)):s&&(t._fire(n.pointerover,{evt:e,target:t,currentTarget:t,pointerId:l}),t[r+"targetShape"]=null)})),o||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}}},{key:"_pointerup",value:function(e){var t=this,n=He(e.type),r=qe(e.type);if(n){this.setPointersPositions(e);var a=this[r+"ClickStartShape"],o=this[r+"ClickEndShape"],s={},u=!1;this._changedPointerPositions.forEach((function(l){var c=ye(l.id)||t.getIntersection(l);if(c){if(c.releaseCapture(l.id),s[c._id])return;s[c._id]=!0}var f=l.id,h={evt:e,pointerId:f},d=!1;i.a["_"+r+"InDblClickWindow"]?(d=!0,clearTimeout(t[r+"DblTimeout"])):G.justDragged||(i.a["_"+r+"InDblClickWindow"]=!0,clearTimeout(t[r+"DblTimeout"])),t[r+"DblTimeout"]=setTimeout((function(){i.a["_"+r+"InDblClickWindow"]=!1}),i.a.dblClickWindow),c&&c.isListening()?(u=!0,t[r+"ClickEndShape"]=c,c._fireAndBubble(n.pointerup,h),i.a["_"+r+"ListenClick"]&&a&&a===c&&(c._fireAndBubble(n.pointerclick,h),d&&o&&o===c&&c._fireAndBubble(n.pointerdblclick,h))):(t[r+"ClickEndShape"]=null,i.a["_"+r+"ListenClick"]&&t._fire(n.pointerclick,{evt:e,target:t,currentTarget:t,pointerId:f}),d&&t._fire(n.pointerdblclick,{evt:e,target:t,currentTarget:t,pointerId:f}))})),u||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.a["_"+r+"ListenClick"]=!1,e.cancelable&&e.preventDefault()}}},{key:"_contextmenu",value:function(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Le,{evt:e}):this._fire(Le,{evt:e,target:this,currentTarget:this})}},{key:"_wheel",value:function(e){this.setPointersPositions(e);var t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(We,{evt:e}):this._fire(We,{evt:e,target:this,currentTarget:this})}},{key:"_pointercancel",value:function(e){this.setPointersPositions(e);var t=ye(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Pe,be(e)),we(e.pointerId)}},{key:"_lostpointercapture",value:function(e){we(e.pointerId)}},{key:"setPointersPositions",value:function(e){var t=this,n=this._getContentPosition(),r=null,i=null;void 0!==(e=e||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,(function(e){t._pointerPositions.push({id:e.identifier,x:(e.clientX-n.left)/n.scaleX,y:(e.clientY-n.top)/n.scaleY})})),Array.prototype.forEach.call(e.changedTouches||e.touches,(function(e){t._changedPointerPositions.push({id:e.identifier,x:(e.clientX-n.left)/n.scaleX,y:(e.clientY-n.top)/n.scaleY})}))):(r=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:b._getFirstPointerId(e)}],this._changedPointerPositions=[{x:r,y:i,id:b._getFirstPointerId(e)}])}},{key:"_setPointerPosition",value:function(e){b.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}},{key:"_getContentPosition",value:function(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}},{key:"_buildDOM",value:function(){if(this.bufferCanvas=new V({width:this.width(),height:this.height()}),this.bufferHitCanvas=new W({pixelRatio:1,width:this.width(),height:this.height()}),i.a.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}},{key:"cache",value:function(){return b.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}},{key:"clearCache",value:function(){return this}},{key:"batchDraw",value:function(){return this.getChildren().forEach((function(e){e.batchDraw()})),this}}]),n}(ce);$e.prototype.nodeType="Stage",Object(i.b)($e),A.addGetterSetter($e,"container");var Qe,Ke="hasShadow",Ze="shadowRGBA",Je="patternImage",et="linearGradient",tt="radialGradient";function nt(){return Qe||(Qe=b.createCanvasElement().getContext("2d"))}var rt={};var it=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r,i;for(Object(l.a)(this,n),r=t.call(this,e);!(i=b.getRandomColor())||i in rt;);return r.colorKey=i,rt[i]=Object(P.a)(r),r}return Object(c.a)(n,[{key:"getContext",value:function(){return b.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}},{key:"getCanvas",value:function(){return b.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}},{key:"getSceneFunc",value:function(){return this.attrs.sceneFunc||this._sceneFunc}},{key:"getHitFunc",value:function(){return this.attrs.hitFunc||this._hitFunc}},{key:"hasShadow",value:function(){return this._getCache(Ke,this._hasShadow)}},{key:"_hasShadow",value:function(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}},{key:"_getFillPattern",value:function(){return this._getCache(Je,this.__getFillPattern)}},{key:"__getFillPattern",value:function(){if(this.fillPatternImage()){var e=nt().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){var t=new f;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(i.a.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());var n=t.getMatrix();e.setTransform({a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]})}return e}}},{key:"_getLinearGradient",value:function(){return this._getCache(et,this.__getLinearGradient)}},{key:"__getLinearGradient",value:function(){var e=this.fillLinearGradientColorStops();if(e){for(var t=nt(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),i=t.createLinearGradient(n.x,n.y,r.x,r.y),a=0;a0}},{key:"destroy",value:function(){return ae.prototype.destroy.call(this),delete rt[this.colorKey],delete this.colorKey,this}},{key:"_useBufferCanvas",value:function(e){var t;if(!this.getStage())return!1;if(!(null===(t=this.attrs.perfectDrawEnabled)||void 0===t||t))return!1;var n=e||this.hasFill(),r=this.hasStroke(),i=1!==this.getAbsoluteOpacity();if(n&&r&&i)return!0;var a=this.hasShadow(),o=this.shadowForStrokeEnabled();return!!(n&&r&&a&&o)}},{key:"setStrokeHitEnabled",value:function(e){b.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}},{key:"getStrokeHitEnabled",value:function(){return 0!==this.hitStrokeWidth()}},{key:"getSelfRect",value:function(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}},{key:"getClientRect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.skipTransform,n=e.relativeTo,r=this.getSelfRect(),i=!e.skipStroke&&this.hasStroke(),a=i&&this.strokeWidth()||0,o=r.width+a,s=r.height+a,u=!e.skipShadow&&this.hasShadow(),l=u?this.shadowOffsetX():0,c=u?this.shadowOffsetY():0,f=o+Math.abs(l),h=s+Math.abs(c),d=u&&this.shadowBlur()||0,p=f+2*d,v=h+2*d,g=0;Math.round(a/2)!==a/2&&(g=1);var m={width:p+g,height:v+g,x:-Math.round(a/2+d)+Math.min(l,0)+r.x,y:-Math.round(a/2+d)+Math.min(c,0)+r.y};return t?m:this._transformedRect(m,n)}},{key:"drawScene",value:function(e,t){var n,r,i=this.getLayer(),a=e||i.getCanvas(),o=a.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),l=this.hasShadow(),c=a.isCache,f=t===this;if(!this.isVisible()&&!f)return this;if(s){o.save();var h=this.getAbsoluteTransform(t).getMatrix();return o.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!u)return this;if(o.save(),this._useBufferCanvas()&&!c){(r=(n=this.getStage().bufferCanvas).getContext()).clear(),r.save(),r._applyLineJoin(this);var d=this.getAbsoluteTransform(t).getMatrix();r.transform(d[0],d[1],d[2],d[3],d[4],d[5]),u.call(this,r,this),r.restore();var p=n.pixelRatio;l&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(n._canvas,0,0,n.width/p,n.height/p)}else{if(o._applyLineJoin(this),!f){d=this.getAbsoluteTransform(t).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}l&&o._applyShadow(this),u.call(this,o,this)}return o.restore(),this}},{key:"drawHit",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.shouldDrawHit(t,n))return this;var r=this.getLayer(),i=e||r.hitCanvas,a=i&&i.getContext(),o=this.hitFunc()||this.sceneFunc(),s=this._getCanvasCache(),u=s&&s.hit;if(this.colorKey||b.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),u){a.save();var l=this.getAbsoluteTransform(t).getMatrix();return a.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(a),a.restore(),this}if(!o)return this;a.save(),a._applyLineJoin(this);var c=this===t;if(!c){var f=this.getAbsoluteTransform(t).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5])}return o.call(this,a,this),a.restore(),this}},{key:"drawHitFromCache",value:function(){var e,t,n,r,i,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,o=this._getCanvasCache(),s=this._getCachedSceneCanvas(),u=o.hit,l=u.getContext(),c=u.getWidth(),f=u.getHeight();l.clear(),l.drawImage(s._canvas,0,0,c,f);try{for(n=(t=(e=l.getImageData(0,0,c,f)).data).length,r=b._hexToRgb(this.colorKey),i=0;ia?(t[i]=r.r,t[i+1]=r.g,t[i+2]=r.b,t[i+3]=255):t[i+3]=0;l.putImageData(e,0,0)}catch(h){b.error("Unable to draw hit graph from cached scene canvas. "+h.message)}return this}},{key:"hasPointerCapture",value:function(e){return _e(e,this)}},{key:"setPointerCapture",value:function(e){ke(e,this)}},{key:"releaseCapture",value:function(e){we(e)}}]),n}(ae);it.prototype._fillFunc=function(e){e.fill()},it.prototype._strokeFunc=function(e){e.stroke()},it.prototype._fillFuncHit=function(e){e.fill()},it.prototype._strokeFuncHit=function(e){e.stroke()},it.prototype._centroid=!1,it.prototype.nodeType="Shape",Object(i.b)(it),it.prototype.eventListeners={},it.prototype.on.call(it.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Ke)})),it.prototype.on.call(it.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Ze)})),it.prototype.on.call(it.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetX.konva fillPatternOffsetY.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotation.konva",(function(){this._clearCache(Je)})),it.prototype.on.call(it.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(et)})),it.prototype.on.call(it.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(tt)})),A.addGetterSetter(it,"stroke",void 0,C()),A.addGetterSetter(it,"strokeWidth",2,w()),A.addGetterSetter(it,"fillAfterStrokeEnabled",!1),A.addGetterSetter(it,"hitStrokeWidth","auto",S()),A.addGetterSetter(it,"strokeHitEnabled",!0,T()),A.addGetterSetter(it,"perfectDrawEnabled",!0,T()),A.addGetterSetter(it,"shadowForStrokeEnabled",!0,T()),A.addGetterSetter(it,"lineJoin"),A.addGetterSetter(it,"lineCap"),A.addGetterSetter(it,"sceneFunc"),A.addGetterSetter(it,"hitFunc"),A.addGetterSetter(it,"dash"),A.addGetterSetter(it,"dashOffset",0,w()),A.addGetterSetter(it,"shadowColor",void 0,O()),A.addGetterSetter(it,"shadowBlur",0,w()),A.addGetterSetter(it,"shadowOpacity",1,w()),A.addComponentsGetterSetter(it,"shadowOffset",["x","y"]),A.addGetterSetter(it,"shadowOffsetX",0,w()),A.addGetterSetter(it,"shadowOffsetY",0,w()),A.addGetterSetter(it,"fillPatternImage"),A.addGetterSetter(it,"fill",void 0,C()),A.addGetterSetter(it,"fillPatternX",0,w()),A.addGetterSetter(it,"fillPatternY",0,w()),A.addGetterSetter(it,"fillLinearGradientColorStops"),A.addGetterSetter(it,"strokeLinearGradientColorStops"),A.addGetterSetter(it,"fillRadialGradientStartRadius",0),A.addGetterSetter(it,"fillRadialGradientEndRadius",0),A.addGetterSetter(it,"fillRadialGradientColorStops"),A.addGetterSetter(it,"fillPatternRepeat","repeat"),A.addGetterSetter(it,"fillEnabled",!0),A.addGetterSetter(it,"strokeEnabled",!0),A.addGetterSetter(it,"shadowEnabled",!0),A.addGetterSetter(it,"dashEnabled",!0),A.addGetterSetter(it,"strokeScaleEnabled",!0),A.addGetterSetter(it,"fillPriority","color"),A.addComponentsGetterSetter(it,"fillPatternOffset",["x","y"]),A.addGetterSetter(it,"fillPatternOffsetX",0,w()),A.addGetterSetter(it,"fillPatternOffsetY",0,w()),A.addComponentsGetterSetter(it,"fillPatternScale",["x","y"]),A.addGetterSetter(it,"fillPatternScaleX",1,w()),A.addGetterSetter(it,"fillPatternScaleY",1,w()),A.addComponentsGetterSetter(it,"fillLinearGradientStartPoint",["x","y"]),A.addComponentsGetterSetter(it,"strokeLinearGradientStartPoint",["x","y"]),A.addGetterSetter(it,"fillLinearGradientStartPointX",0),A.addGetterSetter(it,"strokeLinearGradientStartPointX",0),A.addGetterSetter(it,"fillLinearGradientStartPointY",0),A.addGetterSetter(it,"strokeLinearGradientStartPointY",0),A.addComponentsGetterSetter(it,"fillLinearGradientEndPoint",["x","y"]),A.addComponentsGetterSetter(it,"strokeLinearGradientEndPoint",["x","y"]),A.addGetterSetter(it,"fillLinearGradientEndPointX",0),A.addGetterSetter(it,"strokeLinearGradientEndPointX",0),A.addGetterSetter(it,"fillLinearGradientEndPointY",0),A.addGetterSetter(it,"strokeLinearGradientEndPointY",0),A.addComponentsGetterSetter(it,"fillRadialGradientStartPoint",["x","y"]),A.addGetterSetter(it,"fillRadialGradientStartPointX",0),A.addGetterSetter(it,"fillRadialGradientStartPointY",0),A.addComponentsGetterSetter(it,"fillRadialGradientEndPoint",["x","y"]),A.addGetterSetter(it,"fillRadialGradientEndPointX",0),A.addGetterSetter(it,"fillRadialGradientEndPointY",0),A.addGetterSetter(it,"fillPatternRotation",0),A.backCompat(it,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var at=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],ot=at.length,st=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(l.a)(this,n),(r=t.call(this,e)).canvas=new V,r.hitCanvas=new W({pixelRatio:1}),r._waitingForDraw=!1,r.on("visibleChange.konva",r._checkVisibility),r._checkVisibility(),r.on("imageSmoothingEnabledChange.konva",r._setSmoothEnabled),r._setSmoothEnabled(),r}return Object(c.a)(n,[{key:"createPNGStream",value:function(){return this.canvas._canvas.createPNGStream()}},{key:"getCanvas",value:function(){return this.canvas}},{key:"getNativeCanvasElement",value:function(){return this.canvas._canvas}},{key:"getHitCanvas",value:function(){return this.hitCanvas}},{key:"getContext",value:function(){return this.getCanvas().getContext()}},{key:"clear",value:function(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}},{key:"setZIndex",value:function(e){Object(ue.a)(Object(le.a)(n.prototype),"setZIndex",this).call(this,e);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e0?{antialiased:!0}:{}}},{key:"drawScene",value:function(e,t){var n=this.getLayer(),r=e||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),ce.prototype.drawScene.call(this,r,t),this._fire("draw",{node:this}),this}},{key:"drawHit",value:function(e,t){var n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),ce.prototype.drawHit.call(this,r,t),this}},{key:"enableHitGraph",value:function(){return this.hitGraphEnabled(!0),this}},{key:"disableHitGraph",value:function(){return this.hitGraphEnabled(!1),this}},{key:"setHitGraphEnabled",value:function(e){b.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}},{key:"getHitGraphEnabled",value:function(e){return b.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}},{key:"toggleHitCanvas",value:function(){if(this.parent&&this.parent.content){var e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}}]),n}(ce);st.prototype.nodeType="Layer",Object(i.b)(st),A.addGetterSetter(st,"imageSmoothingEnabled",!0),A.addGetterSetter(st,"clearBeforeDraw",!0),A.addGetterSetter(st,"hitGraphEnabled",!0,T());var ut=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(l.a)(this,n),(r=t.call(this,e)).listening(!1),b.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.'),r}return n}(st);ut.prototype.nodeType="FastLayer",Object(i.b)(ut);var lt=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){return Object(l.a)(this,n),t.apply(this,arguments)}return Object(c.a)(n,[{key:"_validateAdd",value:function(e){var t=e.getType();"Group"!==t&&"Shape"!==t&&b.throw("You may only add groups and shapes to groups.")}}]),n}(ce);lt.prototype.nodeType="Group",Object(i.b)(lt);var ct=i.c.performance&&i.c.performance.now?function(){return i.c.performance.now()}:function(){return(new Date).getTime()},ft=function(){function e(t,n){Object(l.a)(this,e),this.id=e.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:ct(),frameRate:0},this.func=t,this.setLayers(n)}return Object(c.a)(e,[{key:"setLayers",value:function(e){var t=[];return t=e?e.length>0?e:[e]:[],this.layers=t,this}},{key:"getLayers",value:function(){return this.layers}},{key:"addLayer",value:function(e){var t,n=this.layers,r=n.length;for(t=0;tthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}},{key:"getTime",value:function(){return this._time}},{key:"setPosition",value:function(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}},{key:"getPosition",value:function(e){return void 0===e&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}},{key:"play",value:function(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}},{key:"reverse",value:function(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}},{key:"seek",value:function(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}},{key:"reset",value:function(){this.pause(),this._time=0,this.update(),this.fire("onReset")}},{key:"finish",value:function(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}},{key:"update",value:function(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}},{key:"onEnterFrame",value:function(){var e=this.getTimer()-this._startTime;2===this.state?this.setTime(e):3===this.state&&this.setTime(this.duration-e)}},{key:"pause",value:function(){this.state=1,this.fire("onPause")}},{key:"getTimer",value:function(){return(new Date).getTime()}}]),e}(),gt=function(){function e(t){Object(l.a)(this,e);var n,r,a=this,o=t.node,s=o._id,u=t.easing||mt.Linear,c=!!t.yoyo;n="undefined"===typeof t.duration?.3:0===t.duration?.001:t.duration,this.node=o,this._id=dt++;var f=o.getLayer()||(o instanceof i.a.Stage?o.getLayers():null);for(r in f||b.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new ft((function(){a.tween.onEnterFrame()}),f),this.tween=new vt(r,(function(e){a._tweenFunc(e)}),u,0,1,1e3*n,c),this._addListeners(),e.attrs[s]||(e.attrs[s]={}),e.attrs[s][this._id]||(e.attrs[s][this._id]={}),e.tweens[s]||(e.tweens[s]={}),t)void 0===ht[r]&&this._addAttr(r,t[r]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}return Object(c.a)(e,[{key:"_addAttr",value:function(t,n){var r,i,a,o,s,u,l,c,f=this.node,h=f._id;if((a=e.tweens[h][t])&&delete e.attrs[h][a][t],r=f.getAttr(t),b._isArray(n))if(i=[],s=Math.max(n.length,r.length),"points"===t&&n.length!==r.length&&(n.length>r.length?(l=r,r=b._prepareArrayForTween(r,n,f.closed())):(u=n,n=b._prepareArrayForTween(n,r,f.closed()))),0===t.indexOf("fill"))for(o=0;o4){for(n=(t=this.getTensionPoints()).length,r=s?0:4,s||e.quadraticCurveTo(t[0],t[1],t[2],t[3]);rl?u:l,v=u>l?1:u/l,g=u>l?l/u:1;e.translate(o,s),e.rotate(h),e.scale(v,g),e.arc(0,0,p,c,c+f,1-d),e.scale(1/v,1/g),e.rotate(-h),e.translate(-o,-s);break;case"z":n=!0,e.closePath()}}n||this.hasFill()?e.fillStrokeShape(this):e.strokeShape(this)}},{key:"getSelfRect",value:function(){var e=[];this.dataArray.forEach((function(t){if("A"===t.command){var r=t.points[4],i=t.points[5],a=t.points[4]+i,o=Math.PI/180;if(Math.abs(r-a)a;s-=o){var u=n.getPointOnEllipticalArc(t.points[0],t.points[1],t.points[2],t.points[3],s,0);e.push(u.x,u.y)}else for(var l=r+o;lthis.dataArray[r].pathLength;)e-=this.dataArray[r].pathLength,++r;if(r===i)return{x:(t=this.dataArray[r-1].points.slice(-2))[0],y:t[1]};if(e<.01)return{x:(t=this.dataArray[r].points.slice(0,2))[0],y:t[1]};var a=this.dataArray[r],o=a.points;switch(a.command){case"L":return n.getPointOnLine(e,a.start.x,a.start.y,o[0],o[1]);case"C":return n.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,o[0],o[1],o[2],o[3],o[4],o[5]);case"Q":return n.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,o[0],o[1],o[2],o[3]);case"A":var s=o[0],u=o[1],l=o[2],c=o[3],f=o[4],h=o[5],d=o[6];return f+=h*e/a.pathLength,n.getPointOnEllipticalArc(s,u,l,c,f,d)}return null}}],[{key:"getLineLength",value:function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}},{key:"getPointOnLine",value:function(e,t,n,r,i,a,o){void 0===a&&(a=t),void 0===o&&(o=n);var s=(i-n)/(r-t+1e-8),u=Math.sqrt(e*e/(1+s*s));r0&&!isNaN(d[0]);){var m,y,b,_,k,w,x,S,O,C,T=null,E=[],j=u,A=l;switch(h){case"l":u+=d.shift(),l+=d.shift(),T="L",E.push(u,l);break;case"L":u=d.shift(),l=d.shift(),E.push(u,l);break;case"m":var P=d.shift(),M=d.shift();if(u+=P,l+=M,T="M",o.length>2&&"z"===o[o.length-1].command)for(var R=o.length-2;R>=0;R--)if("M"===o[R].command){u=o[R].points[0]+P,l=o[R].points[1]+M;break}E.push(u,l),h="l";break;case"M":u=d.shift(),l=d.shift(),T="M",E.push(u,l),h="L";break;case"h":u+=d.shift(),T="L",E.push(u,l);break;case"H":u=d.shift(),T="L",E.push(u,l);break;case"v":l+=d.shift(),T="L",E.push(u,l);break;case"V":l=d.shift(),T="L",E.push(u,l);break;case"C":E.push(d.shift(),d.shift(),d.shift(),d.shift()),u=d.shift(),l=d.shift(),E.push(u,l);break;case"c":E.push(u+d.shift(),l+d.shift(),u+d.shift(),l+d.shift()),u+=d.shift(),l+=d.shift(),T="C",E.push(u,l);break;case"S":y=u,b=l,"C"===(m=o[o.length-1]).command&&(y=u+(u-m.points[2]),b=l+(l-m.points[3])),E.push(y,b,d.shift(),d.shift()),u=d.shift(),l=d.shift(),T="C",E.push(u,l);break;case"s":y=u,b=l,"C"===(m=o[o.length-1]).command&&(y=u+(u-m.points[2]),b=l+(l-m.points[3])),E.push(y,b,u+d.shift(),l+d.shift()),u+=d.shift(),l+=d.shift(),T="C",E.push(u,l);break;case"Q":E.push(d.shift(),d.shift()),u=d.shift(),l=d.shift(),E.push(u,l);break;case"q":E.push(u+d.shift(),l+d.shift()),u+=d.shift(),l+=d.shift(),T="Q",E.push(u,l);break;case"T":y=u,b=l,"Q"===(m=o[o.length-1]).command&&(y=u+(u-m.points[0]),b=l+(l-m.points[1])),u=d.shift(),l=d.shift(),T="Q",E.push(y,b,u,l);break;case"t":y=u,b=l,"Q"===(m=o[o.length-1]).command&&(y=u+(u-m.points[0]),b=l+(l-m.points[1])),u+=d.shift(),l+=d.shift(),T="Q",E.push(y,b,u,l);break;case"A":_=d.shift(),k=d.shift(),w=d.shift(),x=d.shift(),S=d.shift(),O=u,C=l,u=d.shift(),l=d.shift(),T="A",E=this.convertEndpointToCenterParameterization(O,C,u,l,x,S,_,k,w);break;case"a":_=d.shift(),k=d.shift(),w=d.shift(),x=d.shift(),S=d.shift(),O=u,C=l,u+=d.shift(),l+=d.shift(),T="A",E=this.convertEndpointToCenterParameterization(O,C,u,l,x,S,_,k,w)}o.push({command:T||h,points:E,start:{x:j,y:A},pathLength:this.calcLength(j,A,T||h,E)})}"z"!==h&&"Z"!==h||o.push({command:"z",points:[],start:void 0,pathLength:0})}return o}},{key:"calcLength",value:function(e,t,r,i){var a,o,s,u,l=n;switch(r){case"L":return l.getLineLength(e,t,i[0],i[1]);case"C":for(a=0,o=l.getPointOnCubicBezier(0,e,t,i[0],i[1],i[2],i[3],i[4],i[5]),u=.01;u<=1;u+=.01)s=l.getPointOnCubicBezier(u,e,t,i[0],i[1],i[2],i[3],i[4],i[5]),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;return a;case"Q":for(a=0,o=l.getPointOnQuadraticBezier(0,e,t,i[0],i[1],i[2],i[3]),u=.01;u<=1;u+=.01)s=l.getPointOnQuadraticBezier(u,e,t,i[0],i[1],i[2],i[3]),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;return a;case"A":a=0;var c=i[4],f=i[5],h=i[4]+f,d=Math.PI/180;if(Math.abs(c-h)h;u-=d)s=l.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],u,0),a+=l.getLineLength(o.x,o.y,s.x,s.y),o=s;else for(u=c+d;u1&&(o*=Math.sqrt(h),s*=Math.sqrt(h));var d=Math.sqrt((o*o*(s*s)-o*o*(f*f)-s*s*(c*c))/(o*o*(f*f)+s*s*(c*c)));i===a&&(d*=-1),isNaN(d)&&(d=0);var p=d*o*f/s,v=d*-s*c/o,g=(e+n)/2+Math.cos(l)*p-Math.sin(l)*v,m=(t+r)/2+Math.sin(l)*p+Math.cos(l)*v,y=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])},b=function(e,t){return(e[0]*t[0]+e[1]*t[1])/(y(e)*y(t))},_=function(e,t){return(e[0]*t[1]=1&&(S=0),0===a&&S>0&&(S-=2*Math.PI),1===a&&S<0&&(S+=2*Math.PI),[g,m,o,s,k,S,l,a]}}]),n}(it);St.prototype.className="Path",St.prototype._attrsAffectingSize=["data"],Object(i.b)(St),A.addGetterSetter(St,"data");var Ot=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){return Object(l.a)(this,n),t.apply(this,arguments)}return Object(c.a)(n,[{key:"_sceneFunc",value:function(e){Object(ue.a)(Object(le.a)(n.prototype),"_sceneFunc",this).call(this,e);var t=2*Math.PI,r=this.points(),i=r,a=0!==this.tension()&&r.length>4;a&&(i=this.getTensionPoints());var o,s,u=this.pointerLength(),l=r.length;if(a){var c=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[l-2],r[l-1]],f=St.calcLength(i[i.length-4],i[i.length-3],"C",c),h=St.getPointOnQuadraticBezier(Math.min(1,1-u/f),c[0],c[1],c[2],c[3],c[4],c[5]);o=r[l-2]-h.x,s=r[l-1]-h.y}else o=r[l-2]-r[l-4],s=r[l-1]-r[l-3];var d=(Math.atan2(s,o)+t)%t,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[l-2],r[l-1]),e.rotate(d),e.moveTo(0,0),e.lineTo(-u,p/2),e.lineTo(-u,-p/2),e.closePath(),e.restore()),this.pointerAtBeginning()&&(e.save(),e.translate(r[0],r[1]),a?(o=(i[0]+i[2])/2-r[0],s=(i[1]+i[3])/2-r[1]):(o=r[2]-r[0],s=r[3]-r[1]),e.rotate((Math.atan2(-s,-o)+t)%t),e.moveTo(0,0),e.lineTo(-u,p/2),e.lineTo(-u,-p/2),e.closePath(),e.restore());var v=this.dashEnabled();v&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),v&&(this.attrs.dashEnabled=!0)}},{key:"getSelfRect",value:function(){var e=Object(ue.a)(Object(le.a)(n.prototype),"getSelfRect",this).call(this),t=this.pointerWidth()/2;return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}}]),n}(xt);Ot.prototype.className="Arrow",Object(i.b)(Ot),A.addGetterSetter(Ot,"pointerLength",10,w()),A.addGetterSetter(Ot,"pointerWidth",10,w()),A.addGetterSetter(Ot,"pointerAtBeginning",!1),A.addGetterSetter(Ot,"pointerAtEnding",!0);var Ct=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){return Object(l.a)(this,n),t.apply(this,arguments)}return Object(c.a)(n,[{key:"_sceneFunc",value:function(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),e.closePath(),e.fillStrokeShape(this)}},{key:"getWidth",value:function(){return 2*this.radius()}},{key:"getHeight",value:function(){return 2*this.radius()}},{key:"setWidth",value:function(e){this.radius()!==e/2&&this.radius(e/2)}},{key:"setHeight",value:function(e){this.radius()!==e/2&&this.radius(e/2)}}]),n}(it);Ct.prototype._centroid=!0,Ct.prototype.className="Circle",Ct.prototype._attrsAffectingSize=["radius"],Object(i.b)(Ct),A.addGetterSetter(Ct,"radius",0,w());var Tt=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){return Object(l.a)(this,n),t.apply(this,arguments)}return Object(c.a)(n,[{key:"_sceneFunc",value:function(e){var t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,2*Math.PI,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}},{key:"getWidth",value:function(){return 2*this.radiusX()}},{key:"getHeight",value:function(){return 2*this.radiusY()}},{key:"setWidth",value:function(e){this.radiusX(e/2)}},{key:"setHeight",value:function(e){this.radiusY(e/2)}}]),n}(it);Tt.prototype.className="Ellipse",Tt.prototype._centroid=!0,Tt.prototype._attrsAffectingSize=["radiusX","radiusY"],Object(i.b)(Tt),A.addComponentsGetterSetter(Tt,"radius",["x","y"]),A.addGetterSetter(Tt,"radiusX",0,w()),A.addGetterSetter(Tt,"radiusY",0,w());var Et=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(l.a)(this,n),(r=t.call(this,e)).on("imageChange.konva",(function(){r._setImageLoad()})),r._setImageLoad(),r}return Object(c.a)(n,[{key:"_setImageLoad",value:function(){var e=this,t=this.image();t&&t.addEventListener&&t.addEventListener("load",(function(){e._requestDraw()}))}},{key:"_useBufferCanvas",value:function(){return Object(ue.a)(Object(le.a)(n.prototype),"_useBufferCanvas",this).call(this,!0)}},{key:"_sceneFunc",value:function(e){var t,n=this.getWidth(),r=this.getHeight(),i=this.attrs.image;if(i){var a=this.attrs.cropWidth,o=this.attrs.cropHeight;t=a&&o?[i,this.cropX(),this.cropY(),a,o,0,0,n,r]:[i,0,0,n,r]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),i&&e.drawImage.apply(e,t)}},{key:"_hitFunc",value:function(e){var t=this.width(),n=this.height();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}},{key:"getWidth",value:function(){var e,t;return null!==(e=this.attrs.width)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.width}},{key:"getHeight",value:function(){var e,t;return null!==(e=this.attrs.height)&&void 0!==e?e:null===(t=this.image())||void 0===t?void 0:t.height}}],[{key:"fromURL",value:function(e,t){var r=b.createImageElement();r.onload=function(){var e=new n({image:r});t(e)},r.crossOrigin="Anonymous",r.src=e}}]),n}(it);Et.prototype.className="Image",Object(i.b)(Et),A.addGetterSetter(Et,"image"),A.addComponentsGetterSetter(Et,"crop",["x","y","width","height"]),A.addGetterSetter(Et,"cropX",0,w()),A.addGetterSetter(Et,"cropY",0,w()),A.addGetterSetter(Et,"cropWidth",0,w()),A.addGetterSetter(Et,"cropHeight",0,w());var jt=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height"],At="up",Pt="right",Mt="down",Rt="left",It=jt.length,Dt=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(l.a)(this,n),(r=t.call(this,e)).on("add.konva",(function(e){this._addListeners(e.child),this._sync()})),r}return Object(c.a)(n,[{key:"getText",value:function(){return this.find("Text")[0]}},{key:"getTag",value:function(){return this.find("Tag")[0]}},{key:"_addListeners",value:function(e){var t,n=this,r=function(){n._sync()};for(t=0;t1&&(g+=o)}}}},{key:"_hitFunc",value:function(e){var t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}},{key:"setText",value:function(e){var t=b._isString(e)?e:null===e||void 0===e?"":e+"";return this._setAttr("text",t),this}},{key:"getWidth",value:function(){return this.attrs.width===qt||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}},{key:"getHeight",value:function(){return this.attrs.height===qt||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}},{key:"getTextWidth",value:function(){return this.textWidth}},{key:"getTextHeight",value:function(){return b.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}},{key:"measureSize",value:function(e){var t,n=Jt(),r=this.fontSize();return n.save(),n.font=this._getContextFont(),t=n.measureText(e),n.restore(),{width:t.width,height:r}}},{key:"_getContextFont",value:function(){return this.fontStyle()+Qt+this.fontVariant()+Qt+(this.fontSize()+"px ")+this.fontFamily().split(",").map((function(e){var t=(e=e.trim()).indexOf(" ")>=0,n=e.indexOf('"')>=0||e.indexOf("'")>=0;return t&&!n&&(e='"'.concat(e,'"')),e})).join(", ")}},{key:"_addTextLine",value:function(e){this.align()===Ht&&(e=e.trim());var t=this._getTextWidth(e);return this.textArr.push({text:e,width:t})}},{key:"_getTextWidth",value:function(e){var t=this.letterSpacing(),n=e.length;return Jt().measureText(e).width+(n?t*(n-1):0)}},{key:"_setTextData",value:function(){var e=this.text().split("\n"),t=+this.fontSize(),n=0,r=this.lineHeight()*t,i=this.attrs.width,a=this.attrs.height,o=i!==qt&&void 0!==i,s=a!==qt&&void 0!==a,u=this.padding(),l=i-2*u,c=a-2*u,f=0,h=this.wrap(),d="none"!==h,p="char"!==h&&d,v=this.ellipsis();this.textArr=[],Jt().font=this._getContextFont();for(var g=v?this._getTextWidth("\u2026"):0,m=0,y=e.length;ml)for(;b.length>0;){for(var k=0,w=b.length,x="",S=0;k>>1,C=b.slice(0,O+1),T=this._getTextWidth(C)+g;T<=l?(k=O+1,x=C,S=T):w=O}if(!x)break;if(p){var E,j=b[x.length];(E=(j===Qt||"-"===j)&&S<=l?x.length:Math.max(x.lastIndexOf(Qt),x.lastIndexOf("-"))+1)>0&&(k=E,x=x.slice(0,k),S=this._getTextWidth(x))}if(x=x.trimRight(),this._addTextLine(x),n=Math.max(n,S),f+=r,!d||s&&f+r>c){var A=this.textArr[this.textArr.length-1];if(A)if(v)this._getTextWidth(A.text+"\u2026")0&&(_=this._getTextWidth(b))<=l){this._addTextLine(b),f+=r,n=Math.max(n,_);break}}else this._addTextLine(b),f+=r,n=Math.max(n,_);if(s&&f+r>c)break}this.textHeight=t,this.textWidth=n}},{key:"getStrokeScaleEnabled",value:function(){return!0}}]),n}(it);en.prototype._fillFunc=function(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)},en.prototype._strokeFunc=function(e){e.strokeText(this._partialText,this._partialTextX,this._partialTextY)},en.prototype.className="Text",en.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Object(i.b)(en),A.overWriteSetter(en,"width",S()),A.overWriteSetter(en,"height",S()),A.addGetterSetter(en,"fontFamily","Arial"),A.addGetterSetter(en,"fontSize",12,w()),A.addGetterSetter(en,"fontStyle",$t),A.addGetterSetter(en,"fontVariant",$t),A.addGetterSetter(en,"padding",0,w()),A.addGetterSetter(en,"align",Yt),A.addGetterSetter(en,"verticalAlign","top"),A.addGetterSetter(en,"lineHeight",1,w()),A.addGetterSetter(en,"wrap","word"),A.addGetterSetter(en,"ellipsis",!1,T()),A.addGetterSetter(en,"letterSpacing",0,w()),A.addGetterSetter(en,"text","",O()),A.addGetterSetter(en,"textDecoration","");var tn="normal";function nn(e){e.fillText(this.partialText,0,0)}function rn(e){e.strokeText(this.partialText,0,0)}var an=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(e){var r;return Object(l.a)(this,n),(r=t.call(this,e)).dummyCanvas=b.createCanvasElement(),r.dataArray=[],r.dataArray=St.parsePathData(r.attrs.data),r.on("dataChange.konva",(function(){this.dataArray=St.parsePathData(this.attrs.data),this._setTextData()})),r.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva",r._setTextData),r._setTextData(),r}return Object(c.a)(n,[{key:"_sceneFunc",value:function(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();var t=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo;"underline"===t&&e.beginPath();for(var a=0;a=1){var n=t[0].p0;e.moveTo(n.x,n.y)}for(var r=0;r0&&(o+=e.dataArray[s].pathLength);var u=0;"center"===r&&(u=Math.max(0,o/2-a/2)),"right"===r&&(u=Math.max(0,o-a));for(var l,c,f,h=Gt(this.text()),d=this.text().split(" ").length-1,p=-1,v=0,g=function(){v=0;for(var t=e.dataArray,n=p+1;n0)return p=n,t[n];"M"===t[n].command&&(l={x:t[n].points[0],y:t[n].points[1]})}return{}},m=function(t){var i=e._getTextSize(t).width+n;" "===t&&"justify"===r&&(i+=(o-a)/d);var s=0,u=0;for(c=void 0;Math.abs(i-s)/i>.01&&u<20;){u++;for(var h=s;void 0===f;)(f=g())&&h+f.pathLengthi?c=St.getPointOnLine(i,l.x,l.y,f.points[0],f.points[1],l.x,l.y):f=void 0;break;case"A":var m=f.points[4],y=f.points[5],b=f.points[4]+y;0===v?v=m+1e-8:i>s?v+=Math.PI/180*y/Math.abs(y):v-=Math.PI/360*y/Math.abs(y),(y<0&&v=0&&v>b)&&(v=b,p=!0),c=St.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],v,f.points[6]);break;case"C":0===v?v=i>f.pathLength?1e-8:i/f.pathLength:i>s?v+=(i-s)/f.pathLength/2:v=Math.max(v-(s-i)/f.pathLength/2,0),v>1&&(v=1,p=!0),c=St.getPointOnCubicBezier(v,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3],f.points[4],f.points[5]);break;case"Q":0===v?v=i/f.pathLength:i>s?v+=(i-s)/f.pathLength:v-=(s-i)/f.pathLength,v>1&&(v=1,p=!0),c=St.getPointOnQuadraticBezier(v,f.start.x,f.start.y,f.points[0],f.points[1],f.points[2],f.points[3])}void 0!==c&&(s=St.getLineLength(l.x,l.y,c.x,c.y)),p&&(p=!1,f=void 0)}},y=u/(e._getTextSize("C").width+n)-1,b=0;b0&&void 0!==arguments[0]?arguments[0]:[];this._nodes&&this._nodes.length&&this.detach(),this._nodes=t,1===t.length&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((function(t){var n=t._attrsAffectingSize.map((function(e){return e+"Change."+on})).join(" "),r=function(){1===e.nodes().length&&e.useSingleNodeRotation()&&e.rotation(e.nodes()[0].getAbsoluteRotation()),e._resetTransformCache(),e._transforming||e.isDragging()||e.update()};t.on(n,r),t.on(ln,r),t.on("absoluteTransformChange.".concat(on),r),t.on("xChange.".concat(on," yChange.").concat(on),r),e._proxyDrag(t)})),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}},{key:"_proxyDrag",value:function(e){var t,n=this;e.on("dragstart.".concat(on),(function(r){t=e.getAbsolutePosition(),n.isDragging()||e===n.findOne(".back")||n.startDrag(r,!1)})),e.on("dragmove.".concat(on),(function(r){if(t){var i=e.getAbsolutePosition(),a=i.x-t.x,o=i.y-t.y;n.nodes().forEach((function(t){if(t!==e&&!t.isDragging()){var n=t.getAbsolutePosition();t.setAbsolutePosition({x:n.x+a,y:n.y+o}),t.startDrag(r)}})),t=null}}))}},{key:"getNodes",value:function(){return this._nodes||[]}},{key:"getActiveAnchor",value:function(){return this._movingAnchorName}},{key:"detach",value:function(){this._nodes&&this._nodes.forEach((function(e){e.off(".tr-konva")})),this._nodes=[],this._resetTransformCache()}},{key:"_resetTransformCache",value:function(){this._clearCache(un),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}},{key:"_getNodeRect",value:function(){return this._getCache(un,this.__getNodeRect)}},{key:"__getNodeShape",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.rotation(),n=arguments.length>2?arguments[2]:void 0,r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(n),o=e.getAbsolutePosition(n),s=r.x*a.x-e.offsetX()*a.x,u=r.y*a.y-e.offsetY()*a.y,l=(i.a.getAngle(e.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI),c={x:o.x+s*Math.cos(l)+u*Math.sin(-l),y:o.y+u*Math.cos(l)+s*Math.sin(l),width:r.width*a.x,height:r.height*a.y,rotation:l};return dn(c,-i.a.getAngle(t),{x:0,y:0})}},{key:"__getNodeRect",value:function(){var e=this;if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};var t=[];this.nodes().map((function(n){var r=n.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:e.ignoreStroke()}),i=[{x:r.x,y:r.y},{x:r.x+r.width,y:r.y},{x:r.x+r.width,y:r.y+r.height},{x:r.x,y:r.y+r.height}],a=n.getAbsoluteTransform();i.forEach((function(e){var n=a.point(e);t.push(n)}))}));var n,r,a,o,s=new f;s.rotate(-i.a.getAngle(this.rotation())),t.forEach((function(e){var t=s.point(e);void 0===n&&(n=a=t.x,r=o=t.y),n=Math.min(n,t.x),r=Math.min(r,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y)})),s.invert();var u=s.point({x:n,y:r});return{x:u.x,y:u.y,width:a-n,height:o-r,rotation:i.a.getAngle(this.rotation())}}},{key:"getX",value:function(){return this._getNodeRect().x}},{key:"getY",value:function(){return this._getNodeRect().y}},{key:"getWidth",value:function(){return this._getNodeRect().width}},{key:"getHeight",value:function(){return this._getNodeRect().height}},{key:"_createElements",value:function(){this._createBack(),hn.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}},{key:"_createAnchor",value:function(e){var t=this,n=new Lt({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:fn?10:"auto"}),r=this;n.on("mousedown touchstart",(function(e){r._handleMouseDown(e)})),n.on("dragstart",(function(e){n.stopDrag(),e.cancelBubble=!0})),n.on("dragend",(function(e){e.cancelBubble=!0})),n.on("mouseenter",(function(){var r=i.a.getAngle(t.rotation()),a=function(e,t){if("rotater"===e)return"crosshair";t+=b.degToRad(cn[e]||0);var n=(b.radToDeg(t)%360+360)%360;return b._inRange(n,337.5,360)||b._inRange(n,0,22.5)?"ns-resize":b._inRange(n,22.5,67.5)?"nesw-resize":b._inRange(n,67.5,112.5)?"ew-resize":b._inRange(n,112.5,157.5)?"nwse-resize":b._inRange(n,157.5,202.5)?"ns-resize":b._inRange(n,202.5,247.5)?"nesw-resize":b._inRange(n,247.5,292.5)?"ew-resize":b._inRange(n,292.5,337.5)?"nwse-resize":(b.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(e,r);n.getStage().content&&(n.getStage().content.style.cursor=a),t._cursorChange=!0})),n.on("mouseout",(function(){n.getStage().content&&(n.getStage().content.style.cursor=""),t._cursorChange=!1})),this.add(n)}},{key:"_createBack",value:function(){var e=this,t=new it({name:"back",width:0,height:0,draggable:!0,sceneFunc:function(e){var t=this.getParent(),n=t.padding();e.beginPath(),e.rect(-n,-n,this.width()+2*n,this.height()+2*n),e.moveTo(this.width()/2,-n),t.rotateEnabled()&&e.lineTo(this.width()/2,-t.rotateAnchorOffset()*b._sign(this.height())-n),e.fillStrokeShape(this)},hitFunc:function(t,n){if(e.shouldOverdrawWholeArea()){var r=e.padding();t.beginPath(),t.rect(-r,-r,n.width()+2*r,n.height()+2*r),t.fillStrokeShape(n)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",(function(e){e.cancelBubble=!0})),t.on("dragmove",(function(e){e.cancelBubble=!0})),t.on("dragend",(function(e){e.cancelBubble=!0}))}},{key:"_handleMouseDown",value:function(e){this._movingAnchorName=e.target.name().split(" ")[0];var t=this._getNodeRect(),n=t.width,r=t.height,i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/i),this.cos=Math.abs(n/i),"undefined"!==typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=e.target.getAbsolutePosition(),o=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:o.x-a.x,y:o.y-a.y},this._fire("transformstart",{evt:e,target:this.getNode()}),this._nodes.forEach((function(t){t._fire("transformstart",{evt:e,target:t})}))}},{key:"_handleMouseMove",value:function(e){var t,n,r,a=this.findOne("."+this._movingAnchorName),o=a.getStage();o.setPointersPositions(e);var s=o.getPointerPosition(),u={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y},l=a.getAbsolutePosition();a.setAbsolutePosition(u);var c=a.getAbsolutePosition();if(l.x!==c.x||l.y!==c.y)if("rotater"!==this._movingAnchorName){var f=this.keepRatio()||e.shiftKey,h=this.centeredScaling()||e.altKey;if("top-left"===this._movingAnchorName){if(f){var d=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(d.x-a.x(),2)+Math.pow(d.y-a.y(),2));var p=this.findOne(".top-left").x()>d.x?-1:1,v=this.findOne(".top-left").y()>d.y?-1:1;t=r*this.cos*p,n=r*this.sin*v,this.findOne(".top-left").x(d.x-t),this.findOne(".top-left").y(d.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(a.y());else if("top-right"===this._movingAnchorName){if(f){d=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(a.x()-d.x,2)+Math.pow(d.y-a.y(),2));p=this.findOne(".top-right").x()d.y?-1:1;t=r*this.cos*p,n=r*this.sin*v,this.findOne(".top-right").x(d.x+t),this.findOne(".top-right").y(d.y-n)}var g=a.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(a.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(a.x());else if("bottom-left"===this._movingAnchorName){if(f){d=h?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(d.x-a.x(),2)+Math.pow(a.y()-d.y,2));p=d.x=0){var s=o.point({x:2*-this.padding(),y:0});if(e.x+=s.x,e.y+=s.y,e.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=s.x,this._anchorDragOffset.y-=s.y,!a)return void this.update()}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){var u=o.point({x:2*this.padding(),y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=u.x,this._anchorDragOffset.y-=u.y,e.width+=2*this.padding(),!a)return void this.update()}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){var l=o.point({x:0,y:2*-this.padding()});if(e.x+=l.x,e.y+=l.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=l.x,this._anchorDragOffset.y-=l.y,e.height+=2*this.padding(),!a)return void this.update()}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){var c=o.point({x:0,y:2*this.padding()});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=c.x,this._anchorDragOffset.y-=c.y,e.height+=2*this.padding(),!a)return void this.update()}if(this.boundBoxFunc()){var h=this.boundBoxFunc()(r,e);h?e=h:b.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}var d=1e7,p=new f;p.translate(r.x,r.y),p.rotate(r.rotation),p.scale(r.width/d,r.height/d);var v=new f;v.translate(e.x,e.y),v.rotate(e.rotation),v.scale(e.width/d,e.height/d);var g=v.multiply(p.invert());this._nodes.forEach((function(e){var r,i=e.getParent().getAbsoluteTransform(),a=e.getTransform().copy();a.translate(e.offsetX(),e.offsetY());var o=new f;o.multiply(i.copy().invert()).multiply(g).multiply(i).multiply(a);var s=o.decompose();e.setAttrs(s),n._fire("transform",{evt:t,target:e}),e._fire("transform",{evt:t,target:e}),null===(r=e.getLayer())||void 0===r||r.batchDraw()})),this.rotation(b._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}}},{key:"forceUpdate",value:function(){this._resetTransformCache(),this.update()}},{key:"_batchChangeChild",value:function(e,t){this.findOne(e).setAttrs(t)}},{key:"update",value:function(){var e,t=this,n=this._getNodeRect();this.rotation(b._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),o=this.resizeEnabled(),s=this.padding(),u=this.anchorSize();this.find("._anchor").forEach((function(e){e.setAttrs({width:u,height:u,offsetX:u/2,offsetY:u/2,stroke:t.anchorStroke(),strokeWidth:t.anchorStrokeWidth(),fill:t.anchorFill(),cornerRadius:t.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:u/2+s,offsetY:u/2+s,visible:o&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:u/2+s,visible:o&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:u/2-s,offsetY:u/2+s,visible:o&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:u/2+s,visible:o&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:u/2-s,visible:o&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:u/2+s,offsetY:u/2-s,visible:o&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:u/2-s,visible:o&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:u/2-s,offsetY:u/2-s,visible:o&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*b._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),null===(e=this.getLayer())||void 0===e||e.batchDraw()}},{key:"isTransforming",value:function(){return this._transforming}},{key:"stopTransform",value:function(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}},{key:"destroy",value:function(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),lt.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}},{key:"toObject",value:function(){return ae.prototype.toObject.call(this)}}]),n}(lt);vn.prototype.className="Transformer",Object(i.b)(vn),A.addGetterSetter(vn,"enabledAnchors",hn,(function(e){return e instanceof Array||b.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach((function(e){-1===hn.indexOf(e)&&b.warn("Unknown anchor name: "+e+". Available names are: "+hn.join(", "))})),e||[]})),A.addGetterSetter(vn,"flipEnabled",!0,T()),A.addGetterSetter(vn,"resizeEnabled",!0),A.addGetterSetter(vn,"anchorSize",10,w()),A.addGetterSetter(vn,"rotateEnabled",!0),A.addGetterSetter(vn,"rotationSnaps",[]),A.addGetterSetter(vn,"rotateAnchorOffset",50,w()),A.addGetterSetter(vn,"rotationSnapTolerance",5,w()),A.addGetterSetter(vn,"borderEnabled",!0),A.addGetterSetter(vn,"anchorStroke","rgb(0, 161, 255)"),A.addGetterSetter(vn,"anchorStrokeWidth",1,w()),A.addGetterSetter(vn,"anchorFill","white"),A.addGetterSetter(vn,"anchorCornerRadius",0,w()),A.addGetterSetter(vn,"borderStroke","rgb(0, 161, 255)"),A.addGetterSetter(vn,"borderStrokeWidth",1,w()),A.addGetterSetter(vn,"borderDash"),A.addGetterSetter(vn,"keepRatio",!0),A.addGetterSetter(vn,"centeredScaling",!1),A.addGetterSetter(vn,"ignoreStroke",!1),A.addGetterSetter(vn,"padding",0,w()),A.addGetterSetter(vn,"node"),A.addGetterSetter(vn,"nodes"),A.addGetterSetter(vn,"boundBoxFunc"),A.addGetterSetter(vn,"shouldOverdrawWholeArea",!1),A.addGetterSetter(vn,"useSingleNodeRotation",!0),A.backCompat(vn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var gn=function(e){Object(M.a)(n,e);var t=Object(R.a)(n);function n(){return Object(l.a)(this,n),t.apply(this,arguments)}return Object(c.a)(n,[{key:"_sceneFunc",value:function(e){e.beginPath(),e.arc(0,0,this.radius(),0,i.a.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}},{key:"getWidth",value:function(){return 2*this.radius()}},{key:"getHeight",value:function(){return 2*this.radius()}},{key:"setWidth",value:function(e){this.radius(e/2)}},{key:"setHeight",value:function(e){this.radius(e/2)}}]),n}(it);function mn(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}gn.prototype.className="Wedge",gn.prototype._centroid=!0,gn.prototype._attrsAffectingSize=["radius"],Object(i.b)(gn),A.addGetterSetter(gn,"radius",0,w()),A.addGetterSetter(gn,"angle",0,w()),A.addGetterSetter(gn,"clockwise",!1),A.backCompat(gn,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var yn=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],bn=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];A.addGetterSetter(ae,"blurRadius",0,w(),A.afterSetFilter);A.addGetterSetter(ae,"brightness",0,w(),A.afterSetFilter);A.addGetterSetter(ae,"contrast",0,w(),A.afterSetFilter);function _n(e,t,n,r,i){var a=n-t,o=i-r;return 0===a?r+o/2:0===o?r:o*((e-t)/a)+r}A.addGetterSetter(ae,"embossStrength",.5,w(),A.afterSetFilter),A.addGetterSetter(ae,"embossWhiteLevel",.5,w(),A.afterSetFilter),A.addGetterSetter(ae,"embossDirection","top-left",null,A.afterSetFilter),A.addGetterSetter(ae,"embossBlend",!1,null,A.afterSetFilter);A.addGetterSetter(ae,"enhance",0,w(),A.afterSetFilter);A.addGetterSetter(ae,"hue",0,w(),A.afterSetFilter),A.addGetterSetter(ae,"saturation",0,w(),A.afterSetFilter),A.addGetterSetter(ae,"luminance",0,w(),A.afterSetFilter);A.addGetterSetter(ae,"hue",0,w(),A.afterSetFilter),A.addGetterSetter(ae,"saturation",0,w(),A.afterSetFilter),A.addGetterSetter(ae,"value",0,w(),A.afterSetFilter);function kn(e,t,n){var r=4*(n*e.width+t),i=[];return i.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),i}function wn(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}A.addGetterSetter(ae,"kaleidoscopePower",2,w(),A.afterSetFilter),A.addGetterSetter(ae,"kaleidoscopeAngle",0,w(),A.afterSetFilter);A.addGetterSetter(ae,"threshold",0,w(),A.afterSetFilter);A.addGetterSetter(ae,"noise",.2,w(),A.afterSetFilter);A.addGetterSetter(ae,"pixelSize",8,w(),A.afterSetFilter);A.addGetterSetter(ae,"levels",.5,w(),A.afterSetFilter);A.addGetterSetter(ae,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),A.addGetterSetter(ae,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),A.addGetterSetter(ae,"blue",0,k,A.afterSetFilter);A.addGetterSetter(ae,"red",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),A.addGetterSetter(ae,"green",0,(function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)})),A.addGetterSetter(ae,"blue",0,k,A.afterSetFilter),A.addGetterSetter(ae,"alpha",1,(function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e}));A.addGetterSetter(ae,"threshold",.5,w(),A.afterSetFilter);yt.Util._assign(yt,{Arc:bt,Arrow:Ot,Circle:Ct,Ellipse:Tt,Image:Et,Label:Dt,Tag:Nt,Line:xt,Path:St,Rect:Lt,RegularPolygon:zt,Ring:Bt,Sprite:Vt,Star:Wt,Text:en,TextPath:an,Transformer:vn,Wedge:gn,Filters:{Blur:function(e){var t=Math.round(this.blurRadius());t>0&&function(e,t){var n,r,i,a,o,s,u,l,c,f,h,d,p,v,g,m,y,b,_,k,w,x,S,O,C=e.data,T=e.width,E=e.height,j=t+t+1,A=T-1,P=E-1,M=t+1,R=M*(M+1)/2,I=new mn,D=null,N=I,L=null,z=null,F=yn[t],B=bn[t];for(i=1;i>B,0!==S?(S=255/S,C[s]=(l*F>>B)*S,C[s+1]=(c*F>>B)*S,C[s+2]=(f*F>>B)*S):C[s]=C[s+1]=C[s+2]=0,l-=d,c-=p,f-=v,h-=g,d-=L.r,p-=L.g,v-=L.b,g-=L.a,a=u+((a=n+t+1)>B,S>0?(S=255/S,C[a]=(l*F>>B)*S,C[a+1]=(c*F>>B)*S,C[a+2]=(f*F>>B)*S):C[a]=C[a+1]=C[a+2]=0,l-=d,c-=p,f-=v,h-=g,d-=L.r,p-=L.g,v-=L.b,g-=L.a,a=n+((a=r+M)255?255:a,o=(o*=255)<0?0:o>255?255:o,s=(s*=255)<0?0:s>255?255:s,r[t]=a,r[t+1]=o,r[t+2]=s},Emboss:function(e){var t=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),i=this.embossBlend(),a=0,o=0,s=e.data,u=e.width,l=e.height,c=4*u,f=l;switch(r){case"top-left":a=-1,o=-1;break;case"top":a=-1,o=0;break;case"top-right":a=-1,o=1;break;case"right":a=0,o=1;break;case"bottom-right":a=1,o=1;break;case"bottom":a=1,o=0;break;case"bottom-left":a=1,o=-1;break;case"left":a=0,o=-1;break;default:b.error("Unknown emboss direction: "+r)}do{var h=(f-1)*c,d=a;f+d<1&&(d=0),f+d>l&&(d=0);var p=(f-1+d)*u*4,v=u;do{var g=h+4*(v-1),m=o;v+m<1&&(m=0),v+m>u&&(m=0);var y=p+4*(v-1+m),_=s[g]-s[y],k=s[g+1]-s[y+1],w=s[g+2]-s[y+2],x=_,S=x>0?x:-x;if((k>0?k:-k)>S&&(x=k),(w>0?w:-w)>S&&(x=w),x*=t,i){var O=s[g]+x,C=s[g+1]+x,T=s[g+2]+x;s[g]=O>255?255:O<0?0:O,s[g+1]=C>255?255:C<0?0:C,s[g+2]=T>255?255:T<0?0:T}else{var E=n-x;E<0?E=0:E>255&&(E=255),s[g]=s[g+1]=s[g+2]=E}}while(--v)}while(--f)},Enhance:function(e){var t,n,r,i,a=e.data,o=a.length,s=a[0],u=s,l=a[1],c=l,f=a[2],h=f,d=this.enhance();if(0!==d){for(i=0;iu&&(u=t),(n=a[i+1])c&&(c=n),(r=a[i+2])h&&(h=r);var p,v,g,m,y,b,_,k,w;for(u===s&&(u=255,s=0),c===l&&(c=255,l=0),h===f&&(h=255,f=0),d>0?(v=u+d*(255-u),g=s-d*(s-0),y=c+d*(255-c),b=l-d*(l-0),k=h+d*(255-h),w=f-d*(f-0)):(v=u+d*(u-(p=.5*(u+s))),g=s+d*(s-p),y=c+d*(c-(m=.5*(c+l))),b=l+d*(l-m),k=h+d*(h-(_=.5*(h+f))),w=f+d*(f-_)),i=0;im?o:m;var y,b,_,k,w=c,x=l,S=360/x*Math.PI/180;for(b=0;bc&&(_=y,k=0,w=-1),n=0;nb?u:b;var _,k,w,x=h,S=f,O=n.polarRotation||0;for(i=0;i=0&&d=0&&p=0&&d=0&&p=1020?255:0}return o}(t=function(e,t,n){for(var r=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=[],s=0;s=0&&d=0&&p=g))for(n=c;n=m||(i+=k[(r=4*(g*n+t))+0],a+=k[r+1],o+=k[r+2],s+=k[r+3],p+=1);for(i/=p,a/=p,o/=p,s/=p,t=u;t=g))for(n=c;n=m||(k[(r=4*(g*n+t))+0]=i,k[r+1]=a,k[r+2]=o,k[r+3]=s)}},Posterize:function(e){var t,n=Math.round(254*this.levels())+1,r=e.data,i=r.length,a=255/n;for(t=0;t127&&(u=255-u),l>127&&(l=255-l),c>127&&(c=255-c),t[s]=u,t[s+1]=l,t[s+2]=c}while(--o)}while(--i)},Threshold:function(e){var t,n=255*this.threshold(),r=e.data,i=r.length;for(t=0;t2&&void 0!==arguments[2]?arguments[2]:Dn;if(t===n&&console.error("same props"),!jn&&"zIndex"in t&&(console.warn(In),jn=!0),!An&&t.draggable){var r=void 0!==t.x||void 0!==t.y,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(Rn),An=!0)}for(var a in n)if(!En[a]){var o="on"===a.slice(0,2),s=n[a]!==t[a];if(o&&s)"content"===(p=a.substr(2).toLowerCase()).substr(0,7)&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),e.off(p,n[a]);var u=!t.hasOwnProperty(a);u&&e.setAttr(a,void 0)}var l=Mn||t._useStrictMode,c={},f=!1,h={};for(var a in t)if(!En[a]){o="on"===a.slice(0,2);var d=n[a]!==t[a];if(o&&d)"content"===(p=a.substr(2).toLowerCase()).substr(0,7)&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),t[a]&&(h[p]=t[a]);!o&&(t[a]!==n[a]||l&&t[a]!==e.getAttr(a))&&(f=!0,c[a]=t[a])}for(var p in f&&(e.setAttrs(c),Ln(e)),h)e.on(p+Pn,h[p])}function Ln(e){if(!i.a.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}var zn=n(30),Fn={},Bn={};function Vn(e,t){"string"!==typeof t?(e.add(t),Ln(e)):console.error("Do not use plain text as child of Konva.Node. You are using text: "+t)}function Wn(e,t,n){var r=On[e];if(r){var i={},a={};for(var o in t){"on"===o.slice(0,2)?a[o]=t[o]:i[o]=t[o]}var s=new r(i);return Nn(s,a),s}console.error("Konva has no node with the type "+e+'. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/'+e+'" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html')}function Gn(e,t,n){console.error('Text components are not supported for now in ReactKonva. Your text is: "'+e+'"')}function Un(e,t,n){return!1}function qn(e){return e}function Hn(){return null}function Yn(){return null}function Xn(e,t,n,r){return Bn}function $n(){}function Qn(e){}function Kn(e,t){return!1}function Zn(){return Fn}function Jn(){return Fn}On.Node.prototype._applyProps=Nn;var er=setTimeout,tr=clearTimeout,nr=-1;function rr(e,t){return!1}var ir=!1,ar=!0,or=!0;function sr(e,t){t.parent===e?t.moveToTop():e.add(t),Ln(e)}function ur(e,t){t.parent===e?t.moveToTop():e.add(t),Ln(e)}function lr(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),Ln(e)}function cr(e,t,n){lr(e,t,n)}function fr(e,t){t.destroy(),t.off(Pn),Ln(e)}function hr(e,t){t.destroy(),t.off(Pn),Ln(e)}function dr(e,t,n){console.error('Text components are not yet supported in ReactKonva. You text is: "'+n+'"')}function pr(e,t,n){}function vr(e,t,n,r,i){Nn(e,i,r)}function gr(e){e.hide(),Ln(e)}function mr(e){}function yr(e,t){(null==t.visible||t.visible)&&e.show()}function br(e,t){}function _r(e){}var kr=Object.assign||function(e){for(var t=1;td)&&(F=(W=W.replace(" ",":")).length),0r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(g,"$1"+e.trim());case 58:return e.trim()+t.replace(g,"$1"+e.trim());default:if(0<1*n&&0u.charCodeAt(8))break;case 115:o=o.replace(u,"-webkit-"+u)+";"+o;break;case 207:case 102:o=o.replace(u,"-webkit-"+(102r.charCodeAt(0)&&(r=r.trim()),r=[r],00&&void 0!==arguments[0]?arguments[0]:{},t=e.liveMeasure,n=void 0===t||t,a=Object(r.useState)({}),o=a[0],s=a[1],u=Object(r.useState)(null),l=u[0],c=u[1],f=Object(r.useCallback)((function(e){c(e)}),[]);return Object(r.useLayoutEffect)((function(){if(l){var e=function(){return window.requestAnimationFrame((function(){return s(i(l))}))};if(e(),n)return window.addEventListener("resize",e),window.addEventListener("scroll",e),function(){window.removeEventListener("resize",e),window.removeEventListener("scroll",e)}}}),[l]),[f,o,l]}},function(e,t,n){"use strict";e.exports=n(60)},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return fe}));var r=n(20),i=n.n(r),a=n(48),o=n.n(a),s=n(49),u=n.n(s),l=n(10),c=n.n(l),f=n(23),h=n.n(f),d="bodyAttributes",p="htmlAttributes",v="titleAttributes",g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"},m=(Object.keys(g).map((function(e){return g[e]})),"charset"),y="cssText",b="href",_="http-equiv",k="innerHTML",w="itemprop",x="name",S="property",O="rel",C="src",T="target",E={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},j="defaultTitle",A="defer",P="encodeSpecialCharacters",M="onChangeClientState",R="titleTemplate",I=Object.keys(E).reduce((function(e,t){return e[E[t]]=t,e}),{}),D=[g.NOSCRIPT,g.SCRIPT,g.STYLE],N="data-react-helmet",L="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},F=function(){function e(e,t){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},W=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t},G=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!1===t?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},U=function(e){var t=$(e,g.TITLE),n=$(e,R);if(n&&t)return n.replace(/%s/g,(function(){return Array.isArray(t)?t.join(""):t}));var r=$(e,j);return t||r||void 0},q=function(e){return $(e,M)||function(){}},H=function(e,t){return t.filter((function(t){return"undefined"!==typeof t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return B({},e,t)}),{})},Y=function(e,t){return t.filter((function(e){return"undefined"!==typeof e[g.BASE]})).map((function(e){return e[g.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),i=0;i=0;n--){var r=e[n];if(r.hasOwnProperty(t))return r[t]}return null},Q=function(){var e=Date.now();return function(t){var n=Date.now();n-e>16?(e=n,t(n)):setTimeout((function(){Q(t)}),0)}}(),K=function(e){return clearTimeout(e)},Z="undefined"!==typeof window?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||Q:e.requestAnimationFrame||Q,J="undefined"!==typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||K:e.cancelAnimationFrame||K,ee=function(e){return console&&"function"===typeof console.warn&&console.warn(e)},te=null,ne=function(e,t){var n=e.baseTag,r=e.bodyAttributes,i=e.htmlAttributes,a=e.linkTags,o=e.metaTags,s=e.noscriptTags,u=e.onChangeClientState,l=e.scriptTags,c=e.styleTags,f=e.title,h=e.titleAttributes;ae(g.BODY,r),ae(g.HTML,i),ie(f,h);var d={baseTag:oe(g.BASE,n),linkTags:oe(g.LINK,a),metaTags:oe(g.META,o),noscriptTags:oe(g.NOSCRIPT,s),scriptTags:oe(g.SCRIPT,l),styleTags:oe(g.STYLE,c)},p={},v={};Object.keys(d).forEach((function(e){var t=d[e],n=t.newTags,r=t.oldTags;n.length&&(p[e]=n),r.length&&(v[e]=d[e].oldTags)})),t&&t(),u(e,p,v)},re=function(e){return Array.isArray(e)?e.join(""):e},ie=function(e,t){"undefined"!==typeof e&&document.title!==e&&(document.title=re(e)),ae(g.TITLE,t)},ae=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute(N),i=r?r.split(","):[],a=[].concat(i),o=Object.keys(t),s=0;s=0;f--)n.removeAttribute(a[f]);i.length===a.length?n.removeAttribute(N):n.getAttribute(N)!==o.join(",")&&n.setAttribute(N,o.join(","))}},oe=function(e,t){var n=document.head||document.querySelector(g.HEAD),r=n.querySelectorAll(e+"["+"data-react-helmet]"),i=Array.prototype.slice.call(r),a=[],o=void 0;return t&&t.length&&t.forEach((function(t){var n=document.createElement(e);for(var r in t)if(t.hasOwnProperty(r))if(r===k)n.innerHTML=t.innerHTML;else if(r===y)n.styleSheet?n.styleSheet.cssText=t.cssText:n.appendChild(document.createTextNode(t.cssText));else{var s="undefined"===typeof t[r]?"":t[r];n.setAttribute(r,s)}n.setAttribute(N,"true"),i.some((function(e,t){return o=t,n.isEqualNode(e)}))?i.splice(o,1):a.push(n)})),i.forEach((function(e){return e.parentNode.removeChild(e)})),a.forEach((function(e){return n.appendChild(e)})),{oldTags:i,newTags:a}},se=function(e){return Object.keys(e).reduce((function(t,n){var r="undefined"!==typeof e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).reduce((function(t,n){return t[E[n]||n]=e[n],t}),t)},le=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){return function(e,t,n){var r,i=((r={key:t})[N]=!0,r),a=ue(n,i);return[c.a.createElement(g.TITLE,a,t)]}(0,t.title,t.titleAttributes)},toString:function(){return function(e,t,n,r){var i=se(n),a=re(t);return i?"<"+e+' data-react-helmet="true" '+i+">"+G(a,r)+"":"<"+e+' data-react-helmet="true">'+G(a,r)+""}(e,t.title,t.titleAttributes,n)}};case d:case p:return{toComponent:function(){return ue(t)},toString:function(){return se(t)}};default:return{toComponent:function(){return function(e,t){return t.map((function(t,n){var r,i=((r={key:n})[N]=!0,r);return Object.keys(t).forEach((function(e){var n=E[e]||e;if(n===k||n===y){var r=t.innerHTML||t.cssText;i.dangerouslySetInnerHTML={__html:r}}else i[n]=t[e]})),c.a.createElement(e,i)}))}(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var i=Object.keys(r).filter((function(e){return!(e===k||e===y)})).reduce((function(e,t){var i="undefined"===typeof r[t]?t:t+'="'+G(r[t],n)+'"';return e?e+" "+i:i}),""),a=r.innerHTML||r.cssText||"",o=-1===D.indexOf(e);return t+"<"+e+' data-react-helmet="true" '+i+(o?"/>":">"+a+"")}),"")}(e,t,n)}}}},ce=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,i=e.htmlAttributes,a=e.linkTags,o=e.metaTags,s=e.noscriptTags,u=e.scriptTags,l=e.styleTags,c=e.title,f=void 0===c?"":c,h=e.titleAttributes;return{base:le(g.BASE,t,r),bodyAttributes:le(d,n,r),htmlAttributes:le(p,i,r),link:le(g.LINK,a,r),meta:le(g.META,o,r),noscript:le(g.NOSCRIPT,s,r),script:le(g.SCRIPT,u,r),style:le(g.STYLE,l,r),title:le(g.TITLE,{title:f,titleAttributes:h},r)}},fe=function(e){var t,n;return n=t=function(t){function n(){return z(this,n),W(this,t.apply(this,arguments))}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(n,t),n.prototype.shouldComponentUpdate=function(e){return!u()(this.props,e)},n.prototype.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case g.SCRIPT:case g.NOSCRIPT:return{innerHTML:t};case g.STYLE:return{cssText:t}}throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},n.prototype.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren,i=e.newChildProps,a=e.nestedChildren;return B({},r,((t={})[n.type]=[].concat(r[n.type]||[],[B({},i,this.mapNestedChildrenToProps(n,a))]),t))},n.prototype.mapObjectTypeChildren=function(e){var t,n,r=e.child,i=e.newProps,a=e.newChildProps,o=e.nestedChildren;switch(r.type){case g.TITLE:return B({},i,((t={})[r.type]=o,t.titleAttributes=B({},a),t));case g.BODY:return B({},i,{bodyAttributes:B({},a)});case g.HTML:return B({},i,{htmlAttributes:B({},a)})}return B({},i,((n={})[r.type]=B({},a),n))},n.prototype.mapArrayTypeChildrenToProps=function(e,t){var n=B({},t);return Object.keys(e).forEach((function(t){var r;n=B({},n,((r={})[t]=e[t],r))})),n},n.prototype.warnOnInvalidChildren=function(e,t){return!0},n.prototype.mapChildrenToProps=function(e,t){var n=this,r={};return c.a.Children.forEach(e,(function(e){if(e&&e.props){var i=e.props,a=i.children,o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).reduce((function(t,n){return t[I[n]||n]=e[n],t}),t)}(V(i,["children"]));switch(n.warnOnInvalidChildren(e,a),e.type){case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:o,nestedChildren:a});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:o,nestedChildren:a})}}})),t=this.mapArrayTypeChildrenToProps(r,t)},n.prototype.render=function(){var t=this.props,n=t.children,r=V(t,["children"]),i=B({},r);return n&&(i=this.mapChildrenToProps(n,i)),c.a.createElement(e,i)},F(n,null,[{key:"canUseDOM",set:function(t){e.canUseDOM=t}}]),n}(c.a.Component),t.propTypes={base:i.a.object,bodyAttributes:i.a.object,children:i.a.oneOfType([i.a.arrayOf(i.a.node),i.a.node]),defaultTitle:i.a.string,defer:i.a.bool,encodeSpecialCharacters:i.a.bool,htmlAttributes:i.a.object,link:i.a.arrayOf(i.a.object),meta:i.a.arrayOf(i.a.object),noscript:i.a.arrayOf(i.a.object),onChangeClientState:i.a.func,script:i.a.arrayOf(i.a.object),style:i.a.arrayOf(i.a.object),title:i.a.string,titleAttributes:i.a.object,titleTemplate:i.a.string},t.defaultProps={defer:!0,encodeSpecialCharacters:!0},t.peek=e.peek,t.rewind=function(){var t=e.rewind();return t||(t=ce({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),t},n}(o()((function(e){return{baseTag:Y([b,T],e),bodyAttributes:H(d,e),defer:$(e,A),encode:$(e,P),htmlAttributes:H(p,e),linkTags:X(g.LINK,[O,b],e),metaTags:X(g.META,[x,m,_,S,w],e),noscriptTags:X(g.NOSCRIPT,[k],e),onChangeClientState:q(e),scriptTags:X(g.SCRIPT,[C,k],e),styleTags:X(g.STYLE,[y],e),title:U(e),titleAttributes:H(v,e)}}),(function(e){te&&J(te),e.defer?te=Z((function(){ne(e,(function(){te=null}))})):(ne(e),te=null)}),ce)((function(){return null})));fe.renderStatic=fe.rewind}).call(this,n(40))},function(e,t,n){"use strict";var r,i=n(10),a=(r=i)&&"object"===typeof r&&"default"in r?r.default:r;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=!("undefined"===typeof window||!window.document||!window.document.createElement);e.exports=function(e,t,n){if("function"!==typeof e)throw new Error("Expected reducePropsToState to be a function.");if("function"!==typeof t)throw new Error("Expected handleStateChangeOnClient to be a function.");if("undefined"!==typeof n&&"function"!==typeof n)throw new Error("Expected mapStateOnServer to either be undefined or a function.");return function(r){if("function"!==typeof r)throw new Error("Expected WrappedComponent to be a React component.");var u,l=[];function c(){u=e(l.map((function(e){return e.props}))),f.canUseDOM?t(u):n&&(u=n(u))}var f=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i.peek=function(){return u},i.rewind=function(){if(i.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var e=u;return u=void 0,l=[],e};var o=i.prototype;return o.UNSAFE_componentWillMount=function(){l.push(this),c()},o.componentDidUpdate=function(){c()},o.componentWillUnmount=function(){var e=l.indexOf(this);l.splice(e,1),c()},o.render=function(){return a.createElement(r,this.props)},i}(i.PureComponent);return o(f,"displayName","SideEffect("+function(e){return e.displayName||e.name||"Component"}(r)+")"),o(f,"canUseDOM",s),f}}},function(e,t){var n="undefined"!==typeof Element,r="function"===typeof Map,i="function"===typeof Set,a="function"===typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var s,u,l,c;if(Array.isArray(e)){if((s=e.length)!=t.length)return!1;for(u=s;0!==u--;)if(!o(e[u],t[u]))return!1;return!0}if(r&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(c=e.entries();!(u=c.next()).done;)if(!t.has(u.value[0]))return!1;for(c=e.entries();!(u=c.next()).done;)if(!o(u.value[1],t.get(u.value[0])))return!1;return!0}if(i&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(c=e.entries();!(u=c.next()).done;)if(!t.has(u.value[0]))return!1;return!0}if(a&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if((s=e.length)!=t.length)return!1;for(u=s;0!==u--;)if(e[u]!==t[u])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((s=(l=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(u=s;0!==u--;)if(!Object.prototype.hasOwnProperty.call(t,l[u]))return!1;if(n&&e instanceof Element)return!1;for(u=s;0!==u--;)if(("_owner"!==l[u]&&"__v"!==l[u]&&"__o"!==l[u]||!e.$$typeof)&&!o(e[l[u]],t[l[u]]))return!1;return!0}return e!==e&&t!==t}e.exports=function(e,t){try{return o(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},function(e,t,n){"use strict";var r=n(23),i=60103,a=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var o=60109,s=60110,u=60112;t.Suspense=60113;var l=60115,c=60116;if("function"===typeof Symbol&&Symbol.for){var f=Symbol.for;i=f("react.element"),a=f("react.portal"),t.Fragment=f("react.fragment"),t.StrictMode=f("react.strict_mode"),t.Profiler=f("react.profiler"),o=f("react.provider"),s=f("react.context"),u=f("react.forward_ref"),t.Suspense=f("react.suspense"),l=f("react.memo"),c=f("react.lazy")}var h="function"===typeof Symbol&&Symbol.iterator;function d(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n