Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atomiix/atomiix

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atomiix/atomiix - npm Package Compare versions

Comparing version 1.6.1 to 1.6.2

2

lib/atomiix.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.atomiix=t():e.atomiix=t()}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var r,a,i;a=[t],void 0===(i="function"==typeof(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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}function a(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)}var i={lang:{isNullOrUndefined:function(e){return null==e}},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}},o=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),u=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),s=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),c=function(){function e(t){n(this,e),this.options=i.extend({},{languageName:"unnamedlanguage"},t),this.tokenTypes=[]}return t(e,[{key:"addTokenType",value:function(e){if(!e.name)throw new o("Token types must have a 'name' property");if(!e.regexp&&!e.consume)throw new o("Token types must have a 'regexp' property or a 'consume' function");if(e.regexp&&!(e.regexp instanceof RegExp))throw new o("Token types 'regexp' property must be an instance of RegExp");if(e.consume&&"function"!=typeof e.consume)throw new o("Token types 'consume' property must be a function");if(e.interpret&&"function"!=typeof e.interpret)throw new o("Token types 'interpret' property must be a function");this.tokenTypes.push(e)}},{key:"tokenize",value:function(e){if(void 0===e)throw new u("No content provided");if(0===this.tokenTypes.length)throw new u("No token types defined");for(var t,n,r=[],a=e,o=new l,s=this.tokenTypes.length;a.length>0;){for(var c=!1,f=0;f<s;f++){var p=this.tokenTypes[f];if(n=void 0,p.consume){if(!(n=p.consume(a)).success)continue;if(0!==a.indexOf(n.consumed))throw new u("The consume function for "+p.name+" failed to return the start of the remaining content at "+o.line+"."+o.character+" and instead returned "+n.consumed);c=!0,t=n.consumed}else{var h=p.regexp.exec(a);if(!h)continue;if(0!==h.index)continue;c=!0,t=h[0]}var m={content:e=p.interpret?p.interpret(t):n&&!i.lang.isNullOrUndefined(n.content)?n.content:t,type:p.name,line:o.line,character:o.character};p.ignore||r.push(m),a=a.substring(t.length),o.consume(t)}if(!c){var d=a.substring(0,15),g=d.replace("\r","\\r").replace("\t","\\t").replace("\n","\\n");throw new u("No viable alternative at "+o.line+"."+o.character+": '"+g+"...'")}}return r}}]),e}(),f=function(){function e(){n(this,e)}return t(e,null,[{key:"constant",value:function(e,t,n){return n=n||["keyword"],{name:t,regexp:new RegExp("^"+(r=e,r.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"))),role:n};var r}},{key:"floatingPoint",value:function(){return{name:"floating point",regexp:/(^-?\d*\.\d+)/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}}},{key:"integer",value:function(){return{name:"integer",regexp:/^-?\d+/,role:["constant","numeric"],interpret:function(e){return parseInt(e)}}}},{key:"whitespace",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t]+/}}},{key:"whitespaceWithNewlines",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t\r\n]+/}}},{key:"real",value:function(){return{name:"real number",regexp:/^X/,role:["constant","numeric"]}}},{key:"comma",value:function(){return this.constant(",","comma",["punctuation"])}},{key:"period",value:function(){return this.constant(".","period",["punctuation"])}},{key:"star",value:function(){return this.constant("*","star",["punctuation"])}},{key:"colon",value:function(){return this.constant(":","colon",["punctuation"])}},{key:"openParen",value:function(){return this.constant("(","open paren",["punctuation"])}},{key:"closeParen",value:function(){return this.constant(")","close paren",["punctuation"])}},{key:"openBracket",value:function(){return this.constant("{","open bracket",["punctuation"])}},{key:"closeBracket",value:function(){return this.constant("}","close bracket",["punctuation"])}},{key:"openSquareBracket",value:function(){return this.constant("[","open square bracket",["punctuation"])}},{key:"closeSquareBracket",value:function(){return this.constant("]","close square bracket",["punctuation"])}},{key:"JsonString",value:function(){return{name:"string",regexp:/"(?:[^"\\]|\\.)*"/,consume:function(e){var t={success:!1};if(0!==e.indexOf('"'))return t;var n,r="",a=1,i=!1;do{switch(n=e[a],a+=1,n){case'"':i=!0;break;case"\\":var o=e[a];switch(a+=1,o){case'"':return t;case"t":r+="\t";break;case"r":r+="\r";break;case"n":r+="\n";break;case"u":var u=e.substr(a,4);if(4==u.length&&/\d{4}/.test(u)){a+=4;var s=parseInt(u,10),c=String.fromCharCode(s);r+=c}else r+="\\u";break;default:return t}break;default:r+=n}}while(!i);var f=e.substring(0,a),p={success:!0,consumed:f,content:r};return p}}}}]),e}(),p=function(){function e(){n(this,e)}return t(e,[{key:"initialize",value:function(e){if(!e)throw new s("No tokens provided to the parser");if(!(e instanceof Array))throw new s("A non-array was provided to the parser instead of a token array");this.tokens=e}},{key:"la1",value:function(e){if(this.eof())throw new s("No tokens available");return this.tokens[0].type==e}},{key:"match",value:function(e){if(this.eof())throw new s("Expected "+e+" but found EOF");if(!this.la1(e))throw new s("Expected "+e+" but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character);return this.tokens.shift()}},{key:"eof",value:function(){return 0===this.tokens.length}},{key:"expectEof",value:function(){if(!this.eof())throw new s("Expected EOF but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character)}}]),e}(),l=function(){function e(){n(this,e),this.line=1,this.character=1,this.justSeenSlashR=!1}return t(e,[{key:"consume",value:function(e){for(var t=0,n=e.length;t<n;t++)"\r"==e[t]?(this.line+=1,this.character=1,this.justSeenSlashR=!0):"\n"==e[t]?(this.justSeenSlashR||(this.line+=1),this.character=1,this.justSeenSlashR=!1):(this.character+=1,this.justSeenSlashR=!1)}}]),e}();e.PatternDefinitionException=o,e.LexerException=u,e.ParserException=s,e.Lexer=c,e.StandardTokenTypes=f,e.Parser=p,e.LineTracker=l})?r.apply(t,a):r)||(e.exports=i)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MARKTEXT",function(){return ve}),n.d(r,"UNMARKTEXT",function(){return be}),n.d(r,"REPLACETEXT",function(){return we}),n.d(r,"REPLACELINE",function(){return Te}),n.d(r,"DISPLAYINFO",function(){return ke}),n.d(r,"DISPLAYAGENTSTATE",function(){return Ee}),n.d(r,"FLASHMARKEDTEXT",function(){return Se});var a=n(0),i=a.StandardTokenTypes,o=new a.Lexer({languageName:"atomiix"});o.addTokenType(i.whitespace()),o.addTokenType({name:"newline",regexp:/^\n[ \n]*/}),o.addTokenType({name:"comment",ignore:!0,regexp:/^\/\/[^\n]*/}),o.addTokenType(i.constant("->","play arrow")),o.addTokenType(i.constant(">>","double right arrow")),o.addTokenType(i.constant("<<","double left arrow")),o.addTokenType(i.constant("))","increase amplitude")),o.addTokenType(i.constant("((","decrease amplitude")),o.addTokenType(i.constant(":","colon")),o.addTokenType({name:"sustain multiplier",regexp:/^[_~]/}),o.addTokenType(i.openParen()),o.addTokenType(i.closeParen()),o.addTokenType({name:"operator",regexp:/^[*\/+\-!@]+/}),o.addTokenType({name:"beat",regexp:/^\d+(\.\d+)?b/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"number",regexp:/^\d+(\.\d+)?/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"identifier",regexp:/^[a-zA-Z][a-zA-Z0-9]*/}),o.addTokenType({name:"score",regexp:/^[{[\\|][a-zA-Z0-9 ]*[}\]\\|]/}),o.addTokenType({name:"score modifier",regexp:/^[<\\^][0-9]*[>\\^]/});var u=o,s={english:{parser:{commands:{sequence:"future",future:"future",group:"group"},errors:{sequenceUnsupported:"No support for sequence command yet",expectingOpOrModifier:"Unexpected token: Expecting operator or score modifier",expectingNumberOrString:"Unexpected token: Expecting number or string",expectingAgentName:"Unexpected token: Expecting agent name",nonMatchedScoreDelims:function(e,t){return"Score delimiters don't match. Starts with ".concat(e," but ends with ").concat(t)},noPercInstrument:function(e){return"Percussive score shouldn't have instrument: ".concat(e)},missingMelodicInstrument:"Melodic score should have an instrument",missingConcreteInstrument:"Concrete score should have an instrument",invalidScoreDelimiter:function(e){return"".concat(e," is not a supported score delimiter")},nonMatchedScoreModDelims:function(e,t){return"Score modifier delimiters don't match. Starts with ".concat(e," but ends with ").concat(t)},invalidChordName:"Chord names must be single letters"}},interpreter:{commands:{doze:"doze",wake:"wake",nap:"nap",kill:"kill",scale:"scale",scalepush:"scalepush",tonic:"tonic",tempo:"tempo",shake:"shake",reverse:"reverse",shiftr:"shiftr",shiftl:"shiftl",up:"up",down:"down",yoyo:"yoyo",swap:"swap",order:"order",invert:"invert",replace:"replace",remove:"remove",insert:"insert",expand:"expand",grid:"grid",remind:"remind"},errors:{noAgent:function(e){return"No agent called ".concat(e)},noGroup:function(e){return"No group called ".concat(e)},groupExists:function(e){return"".concat(e," is already the name of a group")},agentExists:function(e){return"".concat(e," is already the name of an agent")},unknownStatement:function(e){return"".concat(e," is not a supported statement type")},unknownCommand:function(e){return"".concat(e," is not an existing command")},unknownScore:function(e){return"".concat(e," is not a supported score type")},expectedMelodic:function(e){return"Expected MELODIC score, not ".concat(e)},unknownScale:function(e,t){return"".concat(e," -> ").concat(t," is not a known scale")},expectedArgs:function(e,t){return"".concat(e," expected at least ").concat(t," arguments")},expectedString:function(e,t){return"".concat(e," expected String but got ").concat(t)},expectedNum:function(e,t){return"".concat(e," expected Number but got ").concat(t)},chordDoesntExist:function(e){return"No chord named ".concat(e)}},misc:{upper:"upper",lower:"lower"}}}},c="PROGRAM",f="PLAY",p="ADDFXCHAIN",l="RMFXCHAIN",h="INCRAMP",m="DECRAMP",d="COMMAND",g="FUTURE",y="GROUP",v="SEQUENCE",b="CHORD",w="AGENT",T="NAME",k="SCORE",E="PERCUSSIVE",S="MELODIC",x="CONCRETE",A="SCOREOPERATOR",P="SCOREMODIFIER",M="PANNING",N="SUSTAIN",O="ATTACK",C="EFFECT",j="BEAT",I="NUMBER",R="STRING";function L(e){return{type:c,statements:e}}function D(e){return{type:h,name:e}}function _(e){return{type:m,name:e}}function F(e,t,n,r,a,i,o,u,s){return{type:k,scoreType:e,instrument:t,values:n,durations:r,offset:a,modifiers:i,scoreString:o,line:u,position:s}}function G(e){return{type:C,name:e}}function U(e,t){return{type:j,value:e,modifier:t}}function X(e,t){return{type:I,value:e,modifier:t}}function Y(e,t,n,r){var i=n.content,o=i.charAt(0),u=i.slice(-1),s=!1;switch(o){case"|":s="|"===u;break;case"[":s="]"===u;break;case"{":s="}"===u}if(!s)throw new a.ParserException(e.errors.nonMatchedScoreDelims(o,u));var c,f=i.slice(1,-1);switch(o){case"|":if(t)throw new a.ParserException(e.errors.noPercInstrument(t));return c=q(f),F(E,null,c.chars,c.durations,c.offset,r,i,n.line-1,n.character-1);case"[":if(!t)throw new a.ParserException(e.errors.missingMelodicInstrument);return c=q(f),F(S,t,c.chars.map(function(e){var t=parseInt(e,10);return isNaN(t)?e:t}),c.durations,c.offset,r,i,n.line-1,n.character-1);case"{":if(!t)throw new a.ParserException(e.errors.missingConcreteInstrument);return c=q(f),F(x,t,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,r,i,n.line-1,n.character-1);default:throw new a.ParserException(e.errors.invalidScoreDelimiter(o))}}function q(e){for(var t=[],n=[],r=0,a="",i=0,o=0;o<e.length;o+=1){var u=e[o];" "!==u?(""===a?r=i:(t.push(a),n.push(i)),a=u,i=1):i+=1}return""!=a&&(t.push(a),n.push(i+r)),{chars:t,durations:n,offset:r}}function z(e,t){var n,r=t.charAt(0),i=t.slice(-1),o=!1;switch(r){case"<":n=M,o=">"===i;break;case"^":n=O,o="^"===i}if(!o)throw new a.ParserException(e.errors.nonMatchedScoreModDelims(r,i));return function(e,t){return{type:P,modifierType:e,values:t}}(n,t.slice(1,-1).split("").map(function(e){return parseInt(e,10)}))}var B=new a.Parser;function K(e){return t=e.content,n=e.line-1,r=e.character-1,{type:w,name:t,line:n,position:r};var t,n,r}function H(e){return t=e.content,n=e.line-1,r=e.character-1,{type:T,value:t,line:n,position:r};var t,n,r}B.setLanguage=function(e){this.translation=(s[e]||s.english).parser},B.parse=function(e){this.translation||this.setLanguage("english");var t=u.tokenize(e);return this.initialize(t),this.program()},B.program=function(){for(var e=[];!this.eof();)this.la1("newline")?this.match("newline"):e.push(this.statement());return L(e)},B.statement=function(){var e=this.match("identifier");if(!this.eof()&&this.la1("play arrow")){if(this.match("play arrow"),!this.eof()&&this.la1("open paren"))return this.chord(e);var t=this.score();return function(e,t){return{type:f,agent:e,score:t}}(K(e),t)}if(!this.eof()&&this.la1("double right arrow"))return this.addEffectsChain(H(e));if(!this.eof()&&this.la1("double left arrow"))return this.removeEffectsChain(H(e));if(!this.eof()&&this.la1("increase amplitude"))return this.match("increase amplitude"),D(H(e));if(!this.eof()&&this.la1("decrease amplitude"))return this.match("decrease amplitude"),_(H(e));switch(e.content){case this.translation.commands.group:return this.group(e);case this.translation.commands.future:return this.future(e);case this.translation.commands.sequence:return this.sequence(e);default:return this.command(e)}},B.score=function(){var e="";this.la1("identifier")&&(e=this.match("identifier").content);var t=this.match("score"),n=this.scoreModifiers();return Y(this.translation,e,t,n)},B.scoreModifiers=function(){for(var e=[];!this.eof()&&!this.la1("newline");)if(this.la1("operator")){var t=this.scoreOperator();e.push(t)}else if(this.la1("score modifier")){var n=z(this.translation,this.match("score modifier").content);e.push(n)}else{if(!this.la1("open paren"))throw new a.ParserException(this.translation.errors.expectingOpOrModifier);var r=this.sustainModifier();e.push(r)}return e},B.sustainModifier=function(){var e=null;this.match("open paren");var t=this.match("number").content;return this.la1("sustain multiplier")&&(this.match("sustain multiplier"),e=this.match("number").content),this.match("close paren"),function(e,t){return{type:P,modifierType:N,noteLength:e,multiplier:t}}(t,e)},B.scoreOperator=function(){return function(e,t){return{type:A,operator:e,value:t}}(this.match("operator").content,this.match("number").content)},B.addEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double right arrow");){this.match("double right arrow");var n=this.match("identifier").content;t.push(G(n))}return function(e,t){return{type:p,name:e,effects:t}}(e,t)},B.removeEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double left arrow")&&(this.match("double left arrow"),!this.eof()&&this.la1("identifier")||0!==t.length);){var n=this.match("identifier").content;t.push(G(n))}return function(e,t){return{type:l,name:e,effects:t}}(e,t)},B.future=function(e){var t,n;if(this.la1("number")){var r,a=this.match("number").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t=X(a,r)}else if(this.la1("beat")){var i,o=this.match("beat").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),i=this.match("number").content),t=U(o,i)}if(this.match("double right arrow"),this.la1("increase amplitude"))this.match("increase amplitude"),n=D(H(this.match("identifier")));else if(this.la1("decrease amplitude")){this.match("decrease amplitude"),n=_(H(this.match("identifier")))}else if(this.la1("identifier")){var u=this.match("identifier");n=this.command(u)}return function(e,t,n){return{type:g,timing:e,command:t,token:n}}(t,n,{line:e.line-1,character:e.character-1})},B.sequence=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException(this.translation.errors.expectingAgentName);t.push(this.match("identifier").content)}return function(e,t){return{type:v,name:e,agents:t}}(e,t)},B.chord=function(e){var t=e.content;if(1!==t.length)throw new a.ParserException(this.translation.errors.invalidChordName);this.match("open paren");var n=this.match("number").content;return this.match("close paren"),function(e,t){return{type:b,name:e,notes:t}}(t,"".concat(Math.floor(n)).split("").map(function(e){return parseInt(e,10)}))},B.command=function(e){for(var t=[];!this.eof()&&!this.la1("newline");)if(this.la1("number")){var n=this.match("number").content,r=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t.push(X(n,r))}else if(this.la1("beat")){var i=this.match("beat").content,o=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),o=this.match("number").content),t.push(U(i,o))}else{if(!this.la1("identifier"))throw new a.ParserException(this.translation.errors.expectingNumberOrString);var u=this.match("identifier").content;t.push({type:R,value:u})}return function(e,t,n,r){return{type:d,name:e,args:t,line:n,position:r}}(e.content,t,e.line-1,e.character-1)},B.group=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException(this.translation.errors.expectingAgentName);t.push(this.match("identifier").content)}return function(e,t){return{type:y,name:e,agents:t}}(e,t)};var Z=B,V={names:{major:"major",minor:"minor",melodicMinor:"melMi",harmonicMinor:"harMi",diminished:"dimin",wholeTone:"whlTn",blues:"blues",minorPentatonic:"minPn",majorPentatonic:"majPn",hungarianMinor:"hngMi",persian:"persn",hirojoshi:"hiroj",arabian:"arabn"},notes:{major:[0,0,2,4,5,7,9,11,12,14],minor:[0,0,2,3,5,7,8,10,12,14],melMi:[0,0,2,3,5,7,9,11,13,14],harMi:[0,0,2,3,5,7,8,11,12,14],dimin:[0,0,2,3,5,6,8,9,11,12],whlTn:[0,0,2,4,6,8,10,12,14,16],blues:[0,0,3,5,6,7,10,12,15,17],minPn:[0,0,3,5,7,10,12,15,17,19],majPn:[0,0,2,4,7,9,12,14,16,19],hngMi:[0,0,2,3,6,7,8,11,12,14],persn:[0,0,1,4,5,6,8,11,12,13],hiroj:[0,0,2,3,7,8,12,14,15,19],arabn:[0,0,2,4,5,6,8,10,12,14]}},J="AtomiixRuntimeError",Q="AtomiixOSCError",W="EDITORACTION",$="AUDIOACTION",ee="INBOUNDACTION",te="AGENTMETHOD",ne="FREEAGENT",re="NAPAGENT",ae="ADDAGENTFX",ie="RMAGENTFX",oe="SETAGENTAMP",ue="SETTEMPO",se="FUTURECALLBACK",ce="PLAYPERCUSSIVE",fe="PLAYMELODIC",pe="PLAYCONCRETE";function le(e,t){return{type:$,actionType:te,agent:e,method:t}}function he(e){return{type:$,actionType:ne,agent:e}}function me(e,t,n,r){return{type:$,actionType:se,time:e,timeType:t,repeats:n,callbackID:r}}function de(e,t){return{type:$,actionType:ce,agent:e,notes:t.notes,durations:t.durations,instruments:t.instruments,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function ge(e,t){return{type:$,actionType:fe,agent:e,notes:t.notes,durations:t.durations,instrument:t.instrument,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function ye(e,t){return{type:$,actionType:pe,agent:e,pitch:t.pitch,amplitudes:t.amplitudes,durations:t.durations,instrument:t.instrument,panning:t.panning,offset:t.offset,repeats:t.repeats}}var ve="MARKTEXT",be="UNMARKTEXT",we="REPLACETEXT",Te="REPLACELINE",ke="DISPLAYINFO",Ee="DISPLAYAGENTSTATE",Se="FLASHMARKEDTEXT";function xe(e,t){return{type:W,actionType:Ee,group:e,agentState:t}}function Ae(e){return(Ae="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})(e)}function Pe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ne(e,t,n){return t&&Me(e.prototype,t),n&&Me(e,n),e}function Oe(e,t){return!t||"object"!==Ae(t)&&"function"!=typeof t?Ce(e):t}function Ce(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Le(e,t)}function Ie(e){var t="function"==typeof Map?new Map:void 0;return(Ie=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Re(e,arguments,De(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Le(r,e)})(e)}function Re(e,t,n){return(Re=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&Le(a,n.prototype),a}).apply(null,arguments)}function Le(e,t){return(Le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function De(e){return(De=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _e=function(e){function t(e,n,r){var a;return Pe(this,t),(a=Oe(this,De(t).call(this,e))).name=J,a.lineNumber=n,a.inCallback=r,a.setLineNumber=a.setLineNumber.bind(Ce(a)),a.setCallbackStatus=a.setCallbackStatus.bind(Ce(a)),a.formattedMessage=a.formattedMessage.bind(Ce(a)),a}return je(t,Ie(Error)),Ne(t,[{key:"setLineNumber",value:function(e){this.lineNumber=e}},{key:"setCallbackStatus",value:function(e){this.inCallback=e}},{key:"formattedMessage",value:function(){var e="";void 0!==this.lineNumber&&(e=" on line ".concat(this.lineNumber));var t="";return this.inCallback&&(t=" in callback"),"Error".concat(t).concat(e,": ").concat(this.message)}}]),t}(),Fe=function(e){function t(e){var n;return Pe(this,t),(n=Oe(this,De(t).call(this,e))).name=Q,n.formattedMessage=n.formattedMessage.bind(Ce(n)),n}return je(t,Ie(Error)),Ne(t,[{key:"formattedMessage",value:function(){return"OSCError: ".concat(this.message)}}]),t}();function Ge(e,t,n,r){if(n.length<r)throw new _e(e.translation.errors.expectedArgs(t,r))}function Ue(e,t,n){if(n.type!==R)throw new _e(e.translation.errors.expectedString(t,n.type));return n.value}function Xe(e,t,n){if(n.type!==I)throw new _e(e.translation.errors.expectedNum(t,n.type));return n.value}function Ye(e,t,n,r){return void 0===n?r:Xe(e,t,n)}function qe(e,t,n){var r=[];return e.groups[t]?(e.groups[t].forEach(function(t){r=r.concat(n(e,t))}),r):n(e,t)}var ze={PLAYING:"AGENTSTATEPLAYING",STOPPED:"AGENTSTATESTOPPED",SLEEPING:"AGENTSTATESLEEPING"};function Be(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=V.names[a];if(!i)throw new _e(e.translation.errors.unknownScale(n,a));e.scale=i}function Ke(e,t,n){var r=[],a=Qe(e,t),i=a.score,o=n(i);r.push(function(e,t){return{type:W,actionType:we,group:e,sections:{score:t}}}(t,o));var u={content:o,line:i.line,character:i.position},s=Y(e,i.instrument,u,i.modifiers);return a.score=s,a.playing&&(r=r.concat(nt(e,t))),r}var He=/^[A-Z]/,Ze=/^[a-z]/;var Ve="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");var Je={doze:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),qe(e,Ue(e,n,r[0]),function(e,t){var r=[],a=Qe(e,t);return a&&(a.playing=!1,r.push(le(t,n))),r})},wake:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),qe(e,Ue(e,n,r[0]),function(e,t){var r=[],a=Qe(e,t);return a&&(a.playing=!1,r.push(le(t,n))),r})},nap:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,2);var a=Ue(e,n,r[0]),i=r[1],o=i.value,u=i.type===j?"beats":"seconds",s=i.modifier||1;return qe(e,a,function(e,t){var n=[],r=Qe(e,t);return r&&(r.playing=!1,n.push(function(e,t,n,r){return{type:$,actionType:re,agent:e,time:t,timeType:n,repeats:r}}(t,o,u,s))),n})},kill:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,0),Object.keys(e.agents).map(function(t){return e.agents[t].playing=!1,he(t)})},scale:Be,scalepush:function(e,t){Be(e,t);var n=[];return Object.keys(e.agents).forEach(function(t){Qe(e,t).playing&&(n=n.concat(nt(e,t)))}),n},tonic:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Xe(e,n,r[0]);e.tonic=Math.floor(a)},tempo:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),function(e,t){return{type:$,actionType:ue,tempo:e,glide:t}}(Xe(e,n,r[0]),r[0].modifier)},shake:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").sort(function(){return.5-Math.random()}).join("")+r})},reverse:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").reverse().join("")+r})},shiftr:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=Ye(e,n,r[1],1);return Ke(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.slice(0,-i);return n+a.substr(a.length-i)+o+r})},shiftl:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=Ye(e,n,r[1],1);return Ke(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.substr(0,i);return n+a.slice(i)+o+r})},up:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){return e.scoreType!=E?e.scoreString:e.scoreString.toUpperCase()})},down:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){return e.scoreType!=E?e.scoreString:e.scoreString.toLowerCase()})},yoyo:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return He.test(e)?e.toLowerCase():Ze.test(e)?e.toUpperCase():e}).join("")+r})},swap:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1],a=t.slice(1,-1).split(""),i=a.filter(function(e){return" "!==e}).sort(function(){return.5-Math.random()});return n+a.map(function(e){return" "===e?e:i.pop()}).join("")+r})},order:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1],a=t.slice(1,-1).split(""),i=a.filter(function(e){return" "!==e}).sort().reverse();return n+a.map(function(e){return" "===e?e:i.pop()}).join("")+r})},invert:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]);return Ke(e,a,function(t){if(t.scoreType!==S)throw new _e(e.translation.errors.expectedMelodic(t.scoreType));var n=t.scoreString,r=n[0],a=n[n.length-1];return r+n.slice(1,-1).split("").map(function(e){if(" "===e)return e;var t=parseInt(e,10);return"".concat(Math.abs(t-8))}).join("")+a})},replace:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=function(e,t,n,r){return void 0===n?r:Ue(e,t,n)}(e,n,r[1]);return Ke(e,a,function(t){var n,r=t.scoreString,a=r[0],o=r[r.length-1],u=r.slice(1,-1).split("");switch(t.scoreType){case E:n=i===e.translation.misc.upper?u.map(function(e){return e.charCodeAt(0)<64||e.charCodeAt(0)>90?e:String.fromCharCode(Math.ceil(26*Math.random())+64)}).join(""):i===e.translation.misc.lower?u.map(function(e){return e.charCodeAt(0)<90||e.charCodeAt(0)>116?e:String.fromCharCode(Math.ceil(26*Math.random())+90)}).join(""):u.map(function(e){return" "===e?e:Ve[Math.ceil(52*Math.random())]}).join("");break;case S:case x:n=u.map(function(e){return" "===e?e:Math.ceil(9*Math.random())}).join("")}return a+n+o})},insert:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t,n=e.scoreString,r=n[0],a=n[n.length-1],i=n.slice(1,-1).split("");switch(e.scoreType){case E:t=i.map(function(e){return" "===e&&Math.random()>.5?Ve[Math.ceil(52*Math.random())]:e}).join("");break;case S:case x:t=i.map(function(e){return" "===e&&Math.random()>.5?Math.ceil(9*Math.random()):e}).join("")}return r+t+a})},remove:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return" "!==e&&Math.random()>.5?" ":e}).join("")+r})},expand:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=Ye(e,n,r[1],1);return Ke(e,a,function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return" "===e?e:e+" ".repeat(i)}).join("")+r})},grid:function(e,t,n){var r=t.name,a=t.args,i=t.line,o=[];Ge(e,r,a,1);var u=Math.floor(Xe(e,r,a[0])),s=Math.floor(70/u),c=" |"+(" ".repeat(u-1)+"|").repeat(s);return o.push({type:W,actionType:Te,line:i+n,text:c}),o},remind:function(){var e,t=Object.keys(Je).join("\n");return[(e=t,{type:W,actionType:ke,info:e})]}};function Qe(e,t){var n=e.agents[t];if(!n)throw new _e(e.translation.errors.noAgent(t));return n}function We(e,t,n,r){if(e.groups[t.name])throw new _e(e.translation.errors.groupExists(t.name));var a,i,o,u,s,c,f,p,l,h,m,d=[];return t.line+=r,n.line+=r,e.agents[t.name]=(a=t,i=n,o=!0,u=.5,s=ze.PLAYING,{agent:a,score:i,playing:o,amplitude:u,state:s}),d.push((c=t.name,f=t.line,p=t.position,l=t.position+t.name.length,h=n.position,m=n.position+n.scoreString.length,{type:W,actionType:ve,group:c,sections:{agent:{line:f,start:p,finish:l},score:{line:f,start:h,finish:m}}})),d}function $e(e,t){return e.tonic+V.notes[e.scale][t]}function et(e,t){switch(t.type){case f:return t.agent;default:return null}}function tt(e,t){var n=function(e,t){for(var n=[],r=0;r<t.statements.length;r+=1){var a=et(0,t.statements[r]);a&&n.push(a.name)}return{agentNames:n}}(0,t).agentNames,r=[];return n.forEach(function(t){r.push(he(t)),r=r.concat(function(e,t){var n=e.agents[t];return n&&(n.playing=!1,n.state=ze.STOPPED),[]}(e,t))}),r}function nt(e,t){var n=e.agents[t];if(!n)throw new _e(e.translation.errors.noAgent(t));return ot(e,n.agent,n.score)}function rt(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],a=0;a<t.statements.length;a+=1){var i=t.statements[a],o=void 0;try{o=at(e,i,n)}catch(e){throw e.name===J&&e.setLineNumber(n+a),e}o&&(r=r.concat(o))}return r}function at(e,t,n){switch(t.type){case f:return function(e,t,n){var r=t.agent,a=t.score,i=[];return i=(i=i.concat(ot(e,r,a))).concat(We(e,r,a,n))}(e,t,n);case p:return function(e,t){var n=t.name,r=t.effects,a=n.value;return qe(e,a,function(e,t){var n,a,i=Qe(e,t);return[(n=i.agent.name,a=r.map(function(e){return e.name}),{type:$,actionType:ae,agent:n,fxList:a})]})}(e,t);case l:return function(e,t){var n=t.name,r=t.effects,a=n.value;return qe(e,a,function(e,t){var n,a,i=Qe(e,t);return[(n=i.agent.name,a=r.map(function(e){return e.name}),{type:$,actionType:ie,agent:n,fxList:a})]})}(e,t);case h:return it(e,t,.1);case m:return it(e,t,-.1);case d:return function(e,t,n){var r=t.name,a=e.translation.commands[r];if(!a)throw new _e(e.translation.errors.unknownCommand(r));var i=e.stdlib[a];if(!i)throw new _e(e.translation.errors.unknownCommand(r));return i(e,t,n)}(e,t,n);case g:return function(e,t,n){var r=t.token;r.line+=n;var a=Math.random().toString(36).substring(7)+e.lastCallbackID;e.lastCallbackID+=1,e.callbacks[a]={command:L([t.command]),line:r.line};var i="seconds";t.timing.type===j&&(i="beats");var o=1;t.timing.modifier&&(o=t.timing.modifier);return[me(t.timing.value,i,o,a),(u=a,s=r.line,c=r.character,f=r.character+6,{type:W,actionType:ve,group:u,sections:{future:{line:s,start:c,finish:f}}})];var u,s,c,f}(e,t,n);case y:return function(e,t){var n=t.name,r=t.agents;if(e.agents[n])throw new _e(e.translation.errors.agentExists(n));if(e.groups[n])throw new _e(e.translation.errors.groupExists(n));var a=r.map(function(t){return Qe(e,t),t});return e.groups[n]=a,[]}(e,t);case v:return function(e){throw new _e(e.translation.errors.sequenceUnsupported())}(e);case b:return function(e,t){var n=t.name,r=t.notes;return function(e,t,n){e.chords[t]=n}(e,n,r),[]}(e,t);default:throw new _e(e.translation.errors.unknownStatement(t.type))}}function it(e,t,n){return qe(e,t.name.value,function(e,t){var r,a,i=Qe(e,t);return i.amplitude=Math.min(2,Math.max(0,i.amplitude+n)),[(r=i.agent.name,a=i.amplitude,{type:$,actionType:oe,agent:r,amplitude:a})]})}function ot(e,t,n){var r=n.scoreType;switch(r){case E:return function(e,t,n){var r=ut(e,[60],n.durations,n.modifiers),a=r.notes,i=r.durations,o=r.sustain,u=r.attack,s=r.panning,c=r.repeats,f=n.values,p=n.offset/4,l=function(e,t,n,r,a,i,o,u){return{type:k,scoreType:E,notes:e,durations:t,instruments:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(a,i,f,o,u,s,p,c);return[de(t.name,l)]}(e,t,n);case S:return function(e,t,n){var r=n.values.map(function(t){if("number"==typeof t)return $e(e,t);var n=function(e,t){if(e.chords[t])return e.chords[t];throw new _e(e.translation.errors.chordDoesntExist(t))}(e,t);return n.map(function(t){return $e(e,t)})}),a=ut(e,r,n.durations,n.modifiers),i=a.notes,o=a.durations,u=a.sustain,s=a.attack,c=a.panning,f=a.repeats,p=n.instrument,l=n.offset/4,h=function(e,t,n,r,a,i,o,u){return{type:k,scoreType:S,notes:e,durations:t,instrument:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(i,o,p,u,s,c,l,f);return[ge(t.name,h)]}(e,t,n);case x:return function(e,t,n){var r=ut(e,[],n.durations,n.modifiers),a=r.durations,i=r.panning,o=r.repeats,u=n.values.map(function(e){return e/10}),s=n.instrument,c=n.offset/4,f=function(e,t,n,r,a,i,o){return{type:k,scoreType:x,pitch:e,amplitudes:t,durations:n,instrument:r,panning:a,offset:i,repeats:o}}(60,u,a,s,i,c,o);return[ye(t.name,f)]}(e,t,n);default:throw new _e(e.translation.errors.unknownScore(r))}}function ut(e,t,n,r){for(var a=t,i=n,o=[.25],u=[5],s=[0],c=1,f=0,p="inf",l=function(e){var t=r[e];if(t.type===P)switch(t.modifierType){case M:s=t.values.map(function(e){return(e-1)/4-1});break;case N:o=[1/t.noteLength*(t.multiplier||1)];break;case O:u=t.values}else if(t.type===A)switch(t.operator){case"+":a=a.map(function(e){return"number"==typeof e?e+t.value:e.map(function(e){return e+t.value})});break;case"-":a=a.map(function(e){return"number"==typeof e?e-t.value:e.map(function(e){return e-t.value})});break;case"*":c=t.value;break;case"/":c=1/t.value;break;case"!":f=t.value;break;case"@":p=t.value}},h=0;h<r.length;h+=1)l(h);return i[i.length-1]+=f,i=i.map(function(e){return e/4}).map(function(e){return e*c}),u=u.map(function(e){return e/9}),{notes:a,durations:i,sustain:o,attack:u,panning:s,silences:f,timestretch:c,repeats:p}}var st="AGENTFINISHED",ct="CALLBACKTRIGGER",ft="AGENTSTATECHANGE";function pt(e,t){switch(t.actionType){case st:return function(e,t){var n=t.name,r=[];return e.logger.info("Marking agent ".concat(n," as finished")),function(e,t){var n=e.agents[t];n&&(n.playing=!1)}(e,n),r.push(xe(n,ze.STOPPED)),r}(e,t);case ft:return function(e,t){var n=t.agentName,r=t.agentState,a=Qe(e,n).agent;return a.state=r,[xe(a.name,a.state)]}(e,t);case ct:return function(e,t){var n=t.callbackId,r=t.remaining,a=[],i=e.callbacks[n];if(!i)return e.logger.error("Error: no callback with id ".concat(n)),a;try{a=rt(e,i.command,null)}catch(e){if(e.name===J)throw e.setCallbackStatus(!0),e.setLineNumber(void 0),e}r<1&&delete e.callbacks[n];return a.push(function(e){return{type:W,actionType:Se,group:e}}(n)),a}(e,t);default:e.logger.warning("".concat(t.actionType," is an unknown action type"))}return[]}var lt={playPattern:"/play/pattern",command:"/command",agentAmplitude:"/agent/amplitude",addFX:"/agent/effects/add",rmFX:"/agent/effects/remove",tempo:"/tempo",callback:"/callback"};function ht(e,t){switch(t.actionType){case te:return n=e.command,a=(r=t).agent,i=r.method,gt(n,[{type:"string",value:i},{type:"string",value:a}]);case ne:return function(e,t){var n=t.agent;return gt(e,[{type:"string",value:"free"},{type:"string",value:n}])}(e.command,t);case re:return function(e,t){var n=t.agent,r=t.time,a=t.timeType,i=t.repeats;return gt(e,[{type:"string",value:"nap"},{type:"string",value:n},{type:"float",value:r},{type:"string",value:a},{type:"integer",value:i}])}(e.command,t);case ae:return function(e,t){var n=t.agent,r=t.fxList;return gt(e,[{type:"string",value:n},{type:"array",value:r}])}(e.addFX,t);case ie:return function(e,t){var n=t.agent,r=t.fxList,a=[{type:"string",value:n}];r.length>0&&a.push({type:"array",value:r});return gt(e,a)}(e.rmFX,t);case oe:return function(e,t){var n=t.agent,r=t.amplitude;return gt(e,[{type:"string",value:n},{type:"float",value:r}])}(e.agentAmplitude,t);case ue:return function(e,t){var n=t.tempo,r=t.glide,a=[{type:"float",value:n}];r&&a.push({type:"float",value:r});return gt(e,a)}(e.tempo,t);case se:return function(e,t){var n=t.time,r=t.timeType,a=t.repeats,i=t.callbackID;return gt(e,[{type:"float",value:n},{type:"string",value:r},{type:"integer",value:a},{type:"string",value:i}])}(e.callback,t);case ce:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"percussive"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"array",value:t.instruments},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"float",value:t.offset},n];return gt(e,r)}(e.playPattern,t);case fe:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=t.notes.map(function(e){return"number"==typeof e?{type:"integer",value:e}:{type:"array",value:e}}),a=[{type:"string",value:"melodic"},{type:"string",value:t.agent},{type:"array",value:r},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"float",value:t.offset},n];return gt(e,a)}(e.playPattern,t);case pe:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"concrete"},{type:"string",value:t.agent},{type:"integer",value:t.pitch},{type:"array",value:t.amplitudes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.panning},{type:"float",value:t.offset},n];return gt(e,r)}(e.playPattern,t)}var n,r,a,i}var mt={agentFinished:"/finished",callback:"/callback",agentState:"/agent/state"};function dt(e,t){switch(t.address){case e.agentFinished:return function(e){return t=yt(e,0),{type:ee,actionType:st,name:t};var t}(t);case e.callback:return function(e){var t=yt(e,0),n=function(e,t){var n=e.args[t];if("float"!==n.type&&"integer"!==n.type)throw new Fe("Expected Float or Integer but got ".concat(n.type));return n.value}(e,1);return function(e,t){return{type:ee,actionType:ct,callbackId:e,remaining:t}}(t,n)}(t);case e.agentState:return function(e){var t=yt(e,0),n=yt(e,1),r="";switch(n){case"playing":r=ze.PLAYING;break;case"sleeping":r=ze.SLEEPING;break;case"stopped":r=ze.STOPPED;break;default:throw new Fe("".concat(n," is not a valid agent state"))}return function(e,t){return{type:ee,actionType:ft,agentName:e,agentState:t}}(t,r)}(t);default:throw new Fe("".concat(t.address," is not a valid incoming address"))}}function gt(e,t){return{oscType:"message",address:e,args:t}}function yt(e,t){var n=e.args[t];if("string"!==n.type)throw new Fe("Expected String but got ".concat(n.type));return n.value}var vt={editorActions:r,agentStates:ze};function bt(e){var t={audio:[],editor:[]};return e.forEach(function(e){e.type===$?t.audio.push(e):e.type===W&&t.editor.push(e)}),t}function wt(e,t){switch(t.name){case J:case Q:e.logger.error(t.formattedMessage())}return{audio:[],editor:[]}}t.default={editorActions:r,init:function(e,t){var n=e||{info:console.log,warn:console.log,error:console.log},r=t||"english";return{scale:V.names.major,tonic:60,bpm:120,stdlib:Je,agents:{},groups:{},chords:{},callbacks:{},lastCallbackID:0,logger:n,language:r,translation:s[r].interpreter}},evaluate:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;try{return bt(rt(e,Z.parse(t),n))}catch(t){return wt(e,t)}},free:function(e,t){try{return bt(tt(e,Z.parse(t)))}catch(t){return wt(e,t)}},handleAction:pt,incomingAction:function(e,t){try{return bt(pt(e,t))}catch(t){return wt(e,t)}},actionToOSC:function(e){return e.map(function(e){return ht(lt,e)})},actionsToOSCBundle:function(e){return function(e){return{oscType:"bundle",timetag:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,elements:e}}(e.map(function(e){return ht(lt,e)}))},oscToAction:function(e){return dt(mt,e)},constants:vt}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.atomiix=t():e.atomiix=t()}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){var r,a,i;a=[t],void 0===(i="function"==typeof(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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}function a(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)}var i={lang:{isNullOrUndefined:function(e){return null==e}},extend:function(){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])arguments[e].hasOwnProperty(t)&&(arguments[0][t]=arguments[e][t]);return arguments[0]}},o=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),u=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),s=function(e){function t(e){return n(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return a(t,e),t}(Error),c=function(){function e(t){n(this,e),this.options=i.extend({},{languageName:"unnamedlanguage"},t),this.tokenTypes=[]}return t(e,[{key:"addTokenType",value:function(e){if(!e.name)throw new o("Token types must have a 'name' property");if(!e.regexp&&!e.consume)throw new o("Token types must have a 'regexp' property or a 'consume' function");if(e.regexp&&!(e.regexp instanceof RegExp))throw new o("Token types 'regexp' property must be an instance of RegExp");if(e.consume&&"function"!=typeof e.consume)throw new o("Token types 'consume' property must be a function");if(e.interpret&&"function"!=typeof e.interpret)throw new o("Token types 'interpret' property must be a function");this.tokenTypes.push(e)}},{key:"tokenize",value:function(e){if(void 0===e)throw new u("No content provided");if(0===this.tokenTypes.length)throw new u("No token types defined");for(var t,n,r=[],a=e,o=new l,s=this.tokenTypes.length;a.length>0;){for(var c=!1,f=0;f<s;f++){var p=this.tokenTypes[f];if(n=void 0,p.consume){if(!(n=p.consume(a)).success)continue;if(0!==a.indexOf(n.consumed))throw new u("The consume function for "+p.name+" failed to return the start of the remaining content at "+o.line+"."+o.character+" and instead returned "+n.consumed);c=!0,t=n.consumed}else{var h=p.regexp.exec(a);if(!h)continue;if(0!==h.index)continue;c=!0,t=h[0]}var m={content:e=p.interpret?p.interpret(t):n&&!i.lang.isNullOrUndefined(n.content)?n.content:t,type:p.name,line:o.line,character:o.character};p.ignore||r.push(m),a=a.substring(t.length),o.consume(t)}if(!c){var d=a.substring(0,15),g=d.replace("\r","\\r").replace("\t","\\t").replace("\n","\\n");throw new u("No viable alternative at "+o.line+"."+o.character+": '"+g+"...'")}}return r}}]),e}(),f=function(){function e(){n(this,e)}return t(e,null,[{key:"constant",value:function(e,t,n){return n=n||["keyword"],{name:t,regexp:new RegExp("^"+(r=e,r.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"))),role:n};var r}},{key:"floatingPoint",value:function(){return{name:"floating point",regexp:/(^-?\d*\.\d+)/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}}},{key:"integer",value:function(){return{name:"integer",regexp:/^-?\d+/,role:["constant","numeric"],interpret:function(e){return parseInt(e)}}}},{key:"whitespace",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t]+/}}},{key:"whitespaceWithNewlines",value:function(){return{name:"whitespace",ignore:!0,regexp:/^[ \t\r\n]+/}}},{key:"real",value:function(){return{name:"real number",regexp:/^X/,role:["constant","numeric"]}}},{key:"comma",value:function(){return this.constant(",","comma",["punctuation"])}},{key:"period",value:function(){return this.constant(".","period",["punctuation"])}},{key:"star",value:function(){return this.constant("*","star",["punctuation"])}},{key:"colon",value:function(){return this.constant(":","colon",["punctuation"])}},{key:"openParen",value:function(){return this.constant("(","open paren",["punctuation"])}},{key:"closeParen",value:function(){return this.constant(")","close paren",["punctuation"])}},{key:"openBracket",value:function(){return this.constant("{","open bracket",["punctuation"])}},{key:"closeBracket",value:function(){return this.constant("}","close bracket",["punctuation"])}},{key:"openSquareBracket",value:function(){return this.constant("[","open square bracket",["punctuation"])}},{key:"closeSquareBracket",value:function(){return this.constant("]","close square bracket",["punctuation"])}},{key:"JsonString",value:function(){return{name:"string",regexp:/"(?:[^"\\]|\\.)*"/,consume:function(e){var t={success:!1};if(0!==e.indexOf('"'))return t;var n,r="",a=1,i=!1;do{switch(n=e[a],a+=1,n){case'"':i=!0;break;case"\\":var o=e[a];switch(a+=1,o){case'"':return t;case"t":r+="\t";break;case"r":r+="\r";break;case"n":r+="\n";break;case"u":var u=e.substr(a,4);if(4==u.length&&/\d{4}/.test(u)){a+=4;var s=parseInt(u,10),c=String.fromCharCode(s);r+=c}else r+="\\u";break;default:return t}break;default:r+=n}}while(!i);var f=e.substring(0,a),p={success:!0,consumed:f,content:r};return p}}}}]),e}(),p=function(){function e(){n(this,e)}return t(e,[{key:"initialize",value:function(e){if(!e)throw new s("No tokens provided to the parser");if(!(e instanceof Array))throw new s("A non-array was provided to the parser instead of a token array");this.tokens=e}},{key:"la1",value:function(e){if(this.eof())throw new s("No tokens available");return this.tokens[0].type==e}},{key:"match",value:function(e){if(this.eof())throw new s("Expected "+e+" but found EOF");if(!this.la1(e))throw new s("Expected "+e+" but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character);return this.tokens.shift()}},{key:"eof",value:function(){return 0===this.tokens.length}},{key:"expectEof",value:function(){if(!this.eof())throw new s("Expected EOF but found "+this.tokens[0].type+" at l"+this.tokens[0].line+"."+this.tokens[0].character)}}]),e}(),l=function(){function e(){n(this,e),this.line=1,this.character=1,this.justSeenSlashR=!1}return t(e,[{key:"consume",value:function(e){for(var t=0,n=e.length;t<n;t++)"\r"==e[t]?(this.line+=1,this.character=1,this.justSeenSlashR=!0):"\n"==e[t]?(this.justSeenSlashR||(this.line+=1),this.character=1,this.justSeenSlashR=!1):(this.character+=1,this.justSeenSlashR=!1)}}]),e}();e.PatternDefinitionException=o,e.LexerException=u,e.ParserException=s,e.Lexer=c,e.StandardTokenTypes=f,e.Parser=p,e.LineTracker=l})?r.apply(t,a):r)||(e.exports=i)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MARKTEXT",function(){return ve}),n.d(r,"UNMARKTEXT",function(){return be}),n.d(r,"REPLACETEXT",function(){return we}),n.d(r,"REPLACELINE",function(){return Te}),n.d(r,"DISPLAYINFO",function(){return ke}),n.d(r,"DISPLAYAGENTSTATE",function(){return Ee}),n.d(r,"FLASHMARKEDTEXT",function(){return Se});var a=n(0),i=a.StandardTokenTypes,o=new a.Lexer({languageName:"atomiix"});o.addTokenType(i.whitespace()),o.addTokenType({name:"newline",regexp:/^\n[ \n]*/}),o.addTokenType({name:"comment",ignore:!0,regexp:/^\/\/[^\n]*/}),o.addTokenType(i.constant("->","play arrow")),o.addTokenType(i.constant(">>","double right arrow")),o.addTokenType(i.constant("<<","double left arrow")),o.addTokenType(i.constant("))","increase amplitude")),o.addTokenType(i.constant("((","decrease amplitude")),o.addTokenType(i.constant(":","colon")),o.addTokenType({name:"sustain multiplier",regexp:/^[_~]/}),o.addTokenType(i.openParen()),o.addTokenType(i.closeParen()),o.addTokenType({name:"operator",regexp:/^[*\/+\-!@]+/}),o.addTokenType({name:"beat",regexp:/^\d+(\.\d+)?b/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"number",regexp:/^\d+(\.\d+)?/,role:["constant","numeric"],interpret:function(e){return parseFloat(e)}}),o.addTokenType({name:"identifier",regexp:/^[a-zA-Z][a-zA-Z0-9]*/}),o.addTokenType({name:"score",regexp:/^[{[\\|][a-zA-Z0-9 ]*[}\]\\|]/}),o.addTokenType({name:"score modifier",regexp:/^[<\\^][0-9]*[>\\^]/});var u=o,s={english:{parser:{commands:{sequence:"future",future:"future",group:"group"},errors:{sequenceUnsupported:"No support for sequence command yet",expectingOpOrModifier:"Unexpected token: Expecting operator or score modifier",expectingNumberOrString:"Unexpected token: Expecting number or string",expectingAgentName:"Unexpected token: Expecting agent name",nonMatchedScoreDelims:function(e,t){return"Score delimiters don't match. Starts with ".concat(e," but ends with ").concat(t)},noPercInstrument:function(e){return"Percussive score shouldn't have instrument: ".concat(e)},missingMelodicInstrument:"Melodic score should have an instrument",missingConcreteInstrument:"Concrete score should have an instrument",invalidScoreDelimiter:function(e){return"".concat(e," is not a supported score delimiter")},nonMatchedScoreModDelims:function(e,t){return"Score modifier delimiters don't match. Starts with ".concat(e," but ends with ").concat(t)},invalidChordName:"Chord names must be single letters"}},interpreter:{commands:{doze:"doze",wake:"wake",nap:"nap",kill:"kill",scale:"scale",scalepush:"scalepush",tonic:"tonic",tempo:"tempo",shake:"shake",reverse:"reverse",shiftr:"shiftr",shiftl:"shiftl",up:"up",down:"down",yoyo:"yoyo",swap:"swap",order:"order",invert:"invert",replace:"replace",remove:"remove",insert:"insert",expand:"expand",grid:"grid",remind:"remind",dave:"dave"},errors:{noAgent:function(e){return"No agent called ".concat(e)},noGroup:function(e){return"No group called ".concat(e)},groupExists:function(e){return"".concat(e," is already the name of a group")},agentExists:function(e){return"".concat(e," is already the name of an agent")},unknownStatement:function(e){return"".concat(e," is not a supported statement type")},unknownCommand:function(e){return"".concat(e," is not an existing command")},unknownScore:function(e){return"".concat(e," is not a supported score type")},expectedMelodic:function(e){return"Expected MELODIC score, not ".concat(e)},unknownScale:function(e,t){return"".concat(e," -> ").concat(t," is not a known scale")},expectedArgs:function(e,t){return"".concat(e," expected at least ").concat(t," arguments")},expectedString:function(e,t){return"".concat(e," expected String but got ").concat(t)},expectedNum:function(e,t){return"".concat(e," expected Number but got ").concat(t)},chordDoesntExist:function(e){return"No chord named ".concat(e)}},misc:{upper:"upper",lower:"lower"}}}},c="PROGRAM",f="PLAY",p="ADDFXCHAIN",l="RMFXCHAIN",h="INCRAMP",m="DECRAMP",d="COMMAND",g="FUTURE",y="GROUP",v="SEQUENCE",b="CHORD",w="AGENT",T="NAME",k="SCORE",E="PERCUSSIVE",S="MELODIC",x="CONCRETE",A="SCOREOPERATOR",P="SCOREMODIFIER",M="PANNING",N="SUSTAIN",O="ATTACK",C="EFFECT",j="BEAT",I="NUMBER",R="STRING";function L(e){return{type:c,statements:e}}function D(e){return{type:h,name:e}}function _(e){return{type:m,name:e}}function F(e,t,n,r,a,i,o,u,s){return{type:k,scoreType:e,instrument:t,values:n,durations:r,offset:a,modifiers:i,scoreString:o,line:u,position:s}}function G(e){return{type:C,name:e}}function U(e,t){return{type:j,value:e,modifier:t}}function X(e,t){return{type:I,value:e,modifier:t}}function Y(e,t,n,r){var i=n.content,o=i.charAt(0),u=i.slice(-1),s=!1;switch(o){case"|":s="|"===u;break;case"[":s="]"===u;break;case"{":s="}"===u}if(!s)throw new a.ParserException(e.errors.nonMatchedScoreDelims(o,u));var c,f=i.slice(1,-1);switch(o){case"|":if(t)throw new a.ParserException(e.errors.noPercInstrument(t));return c=q(f),F(E,null,c.chars,c.durations,c.offset,r,i,n.line-1,n.character-1);case"[":if(!t)throw new a.ParserException(e.errors.missingMelodicInstrument);return c=q(f),F(S,t,c.chars.map(function(e){var t=parseInt(e,10);return isNaN(t)?e:t}),c.durations,c.offset,r,i,n.line-1,n.character-1);case"{":if(!t)throw new a.ParserException(e.errors.missingConcreteInstrument);return c=q(f),F(x,t,c.chars.map(function(e){return parseInt(e,10)}),c.durations,c.offset,r,i,n.line-1,n.character-1);default:throw new a.ParserException(e.errors.invalidScoreDelimiter(o))}}function q(e){for(var t=[],n=[],r=0,a="",i=0,o=0;o<e.length;o+=1){var u=e[o];" "!==u?(""===a?r=i:(t.push(a),n.push(i)),a=u,i=1):i+=1}return""!=a&&(t.push(a),n.push(i+r)),{chars:t,durations:n,offset:r}}function z(e,t){var n,r=t.charAt(0),i=t.slice(-1),o=!1;switch(r){case"<":n=M,o=">"===i;break;case"^":n=O,o="^"===i}if(!o)throw new a.ParserException(e.errors.nonMatchedScoreModDelims(r,i));return function(e,t){return{type:P,modifierType:e,values:t}}(n,t.slice(1,-1).split("").map(function(e){return parseInt(e,10)}))}var B=new a.Parser;function K(e){return t=e.content,n=e.line-1,r=e.character-1,{type:w,name:t,line:n,position:r};var t,n,r}function H(e){return t=e.content,n=e.line-1,r=e.character-1,{type:T,value:t,line:n,position:r};var t,n,r}B.setLanguage=function(e){this.translation=(s[e]||s.english).parser},B.parse=function(e){this.translation||this.setLanguage("english");var t=u.tokenize(e);return this.initialize(t),this.program()},B.program=function(){for(var e=[];!this.eof();)this.la1("newline")?this.match("newline"):e.push(this.statement());return L(e)},B.statement=function(){var e=this.match("identifier");if(!this.eof()&&this.la1("play arrow")){if(this.match("play arrow"),!this.eof()&&this.la1("open paren"))return this.chord(e);var t=this.score();return function(e,t){return{type:f,agent:e,score:t}}(K(e),t)}if(!this.eof()&&this.la1("double right arrow"))return this.addEffectsChain(H(e));if(!this.eof()&&this.la1("double left arrow"))return this.removeEffectsChain(H(e));if(!this.eof()&&this.la1("increase amplitude"))return this.match("increase amplitude"),D(H(e));if(!this.eof()&&this.la1("decrease amplitude"))return this.match("decrease amplitude"),_(H(e));switch(e.content){case this.translation.commands.group:return this.group(e);case this.translation.commands.future:return this.future(e);case this.translation.commands.sequence:return this.sequence(e);default:return this.command(e)}},B.score=function(){var e="";this.la1("identifier")&&(e=this.match("identifier").content);var t=this.match("score"),n=this.scoreModifiers();return Y(this.translation,e,t,n)},B.scoreModifiers=function(){for(var e=[];!this.eof()&&!this.la1("newline");)if(this.la1("operator")){var t=this.scoreOperator();e.push(t)}else if(this.la1("score modifier")){var n=z(this.translation,this.match("score modifier").content);e.push(n)}else{if(!this.la1("open paren"))throw new a.ParserException(this.translation.errors.expectingOpOrModifier);var r=this.sustainModifier();e.push(r)}return e},B.sustainModifier=function(){var e=null;this.match("open paren");var t=this.match("number").content;return this.la1("sustain multiplier")&&(this.match("sustain multiplier"),e=this.match("number").content),this.match("close paren"),function(e,t){return{type:P,modifierType:N,noteLength:e,multiplier:t}}(t,e)},B.scoreOperator=function(){return function(e,t){return{type:A,operator:e,value:t}}(this.match("operator").content,this.match("number").content)},B.addEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double right arrow");){this.match("double right arrow");var n=this.match("identifier").content;t.push(G(n))}return function(e,t){return{type:p,name:e,effects:t}}(e,t)},B.removeEffectsChain=function(e){for(var t=[];!this.eof()&&this.la1("double left arrow")&&(this.match("double left arrow"),!this.eof()&&this.la1("identifier")||0!==t.length);){var n=this.match("identifier").content;t.push(G(n))}return function(e,t){return{type:l,name:e,effects:t}}(e,t)},B.future=function(e){var t,n;if(this.la1("number")){var r,a=this.match("number").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t=X(a,r)}else if(this.la1("beat")){var i,o=this.match("beat").content;!this.eof()&&this.la1("colon")&&(this.match("colon"),i=this.match("number").content),t=U(o,i)}if(this.match("double right arrow"),this.la1("increase amplitude"))this.match("increase amplitude"),n=D(H(this.match("identifier")));else if(this.la1("decrease amplitude")){this.match("decrease amplitude"),n=_(H(this.match("identifier")))}else if(this.la1("identifier")){var u=this.match("identifier");n=this.command(u)}return function(e,t,n){return{type:g,timing:e,command:t,token:n}}(t,n,{line:e.line-1,character:e.character-1})},B.sequence=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException(this.translation.errors.expectingAgentName);t.push(this.match("identifier").content)}return function(e,t){return{type:v,name:e,agents:t}}(e,t)},B.chord=function(e){var t=e.content;if(1!==t.length)throw new a.ParserException(this.translation.errors.invalidChordName);this.match("open paren");var n=this.match("number").content;return this.match("close paren"),function(e,t){return{type:b,name:e,notes:t}}(t,"".concat(Math.floor(n)).split("").map(function(e){return parseInt(e,10)}))},B.command=function(e){for(var t=[];!this.eof()&&!this.la1("newline");)if(this.la1("number")){var n=this.match("number").content,r=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),r=this.match("number").content),t.push(X(n,r))}else if(this.la1("beat")){var i=this.match("beat").content,o=void 0;!this.eof()&&this.la1("colon")&&(this.match("colon"),o=this.match("number").content),t.push(U(i,o))}else{if(!this.la1("identifier"))throw new a.ParserException(this.translation.errors.expectingNumberOrString);var u=this.match("identifier").content;t.push({type:R,value:u})}return function(e,t,n,r){return{type:d,name:e,args:t,line:n,position:r}}(e.content,t,e.line-1,e.character-1)},B.group=function(){var e=this.match("identifier").content;this.match("play arrow");for(var t=[];!this.eof()&&!this.la1("newline");){if(!this.la1("identifier"))throw new a.ParserException(this.translation.errors.expectingAgentName);t.push(this.match("identifier").content)}return function(e,t){return{type:y,name:e,agents:t}}(e,t)};var Z=B,V={names:{major:"major",minor:"minor",melodicMinor:"melMi",harmonicMinor:"harMi",diminished:"dimin",wholeTone:"whlTn",blues:"blues",minorPentatonic:"minPn",majorPentatonic:"majPn",hungarianMinor:"hngMi",persian:"persn",hirojoshi:"hiroj",arabian:"arabn"},notes:{major:[0,0,2,4,5,7,9,11,12,14],minor:[0,0,2,3,5,7,8,10,12,14],melMi:[0,0,2,3,5,7,9,11,13,14],harMi:[0,0,2,3,5,7,8,11,12,14],dimin:[0,0,2,3,5,6,8,9,11,12],whlTn:[0,0,2,4,6,8,10,12,14,16],blues:[0,0,3,5,6,7,10,12,15,17],minPn:[0,0,3,5,7,10,12,15,17,19],majPn:[0,0,2,4,7,9,12,14,16,19],hngMi:[0,0,2,3,6,7,8,11,12,14],persn:[0,0,1,4,5,6,8,11,12,13],hiroj:[0,0,2,3,7,8,12,14,15,19],arabn:[0,0,2,4,5,6,8,10,12,14]}},J="AtomiixRuntimeError",Q="AtomiixOSCError",W="EDITORACTION",$="AUDIOACTION",ee="INBOUNDACTION",te="AGENTMETHOD",ne="FREEAGENT",re="NAPAGENT",ae="ADDAGENTFX",ie="RMAGENTFX",oe="SETAGENTAMP",ue="SETTEMPO",se="FUTURECALLBACK",ce="PLAYPERCUSSIVE",fe="PLAYMELODIC",pe="PLAYCONCRETE";function le(e,t){return{type:$,actionType:te,agent:e,method:t}}function he(e){return{type:$,actionType:ne,agent:e}}function me(e,t,n,r){return{type:$,actionType:se,time:e,timeType:t,repeats:n,callbackID:r}}function de(e,t){return{type:$,actionType:ce,agent:e,notes:t.notes,durations:t.durations,instruments:t.instruments,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function ge(e,t){return{type:$,actionType:fe,agent:e,notes:t.notes,durations:t.durations,instrument:t.instrument,sustain:t.sustain,attack:t.attack,panning:t.panning,offset:t.offset,repeats:t.repeats}}function ye(e,t){return{type:$,actionType:pe,agent:e,pitch:t.pitch,amplitudes:t.amplitudes,durations:t.durations,instrument:t.instrument,panning:t.panning,offset:t.offset,repeats:t.repeats}}var ve="MARKTEXT",be="UNMARKTEXT",we="REPLACETEXT",Te="REPLACELINE",ke="DISPLAYINFO",Ee="DISPLAYAGENTSTATE",Se="FLASHMARKEDTEXT";function xe(e,t){return{type:W,actionType:Ee,group:e,agentState:t}}function Ae(e){return(Ae="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})(e)}function Pe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ne(e,t,n){return t&&Me(e.prototype,t),n&&Me(e,n),e}function Oe(e,t){return!t||"object"!==Ae(t)&&"function"!=typeof t?Ce(e):t}function Ce(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Le(e,t)}function Ie(e){var t="function"==typeof Map?new Map:void 0;return(Ie=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Re(e,arguments,De(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Le(r,e)})(e)}function Re(e,t,n){return(Re=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&Le(a,n.prototype),a}).apply(null,arguments)}function Le(e,t){return(Le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function De(e){return(De=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _e=function(e){function t(e,n,r){var a;return Pe(this,t),(a=Oe(this,De(t).call(this,e))).name=J,a.lineNumber=n,a.inCallback=r,a.setLineNumber=a.setLineNumber.bind(Ce(a)),a.setCallbackStatus=a.setCallbackStatus.bind(Ce(a)),a.formattedMessage=a.formattedMessage.bind(Ce(a)),a}return je(t,Ie(Error)),Ne(t,[{key:"setLineNumber",value:function(e){this.lineNumber=e}},{key:"setCallbackStatus",value:function(e){this.inCallback=e}},{key:"formattedMessage",value:function(){var e="";void 0!==this.lineNumber&&(e=" on line ".concat(this.lineNumber));var t="";return this.inCallback&&(t=" in callback"),"Error".concat(t).concat(e,": ").concat(this.message)}}]),t}(),Fe=function(e){function t(e){var n;return Pe(this,t),(n=Oe(this,De(t).call(this,e))).name=Q,n.formattedMessage=n.formattedMessage.bind(Ce(n)),n}return je(t,Ie(Error)),Ne(t,[{key:"formattedMessage",value:function(){return"OSCError: ".concat(this.message)}}]),t}();function Ge(e,t,n,r){if(n.length<r)throw new _e(e.translation.errors.expectedArgs(t,r))}function Ue(e,t,n){if(n.type!==R)throw new _e(e.translation.errors.expectedString(t,n.type));return n.value}function Xe(e,t,n){if(n.type!==I)throw new _e(e.translation.errors.expectedNum(t,n.type));return n.value}function Ye(e,t,n,r){return void 0===n?r:Xe(e,t,n)}function qe(e,t,n){var r=[];return e.groups[t]?(e.groups[t].forEach(function(t){r=r.concat(n(e,t))}),r):n(e,t)}var ze={PLAYING:"AGENTSTATEPLAYING",STOPPED:"AGENTSTATESTOPPED",SLEEPING:"AGENTSTATESLEEPING"};function Be(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=V.names[a];if(!i)throw new _e(e.translation.errors.unknownScale(n,a));e.scale=i}function Ke(e,t,n){var r=[],a=Qe(e,t),i=a.score,o=n(i);r.push(function(e,t){return{type:W,actionType:we,group:e,sections:{score:t}}}(t,o));var u={content:o,line:i.line,character:i.position},s=Y(e,i.instrument,u,i.modifiers);return a.score=s,a.playing&&(r=r.concat(nt(e,t))),r}var He=/^[A-Z]/,Ze=/^[a-z]/;var Ve="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");var Je={doze:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),qe(e,Ue(e,n,r[0]),function(e,t){var r=[],a=Qe(e,t);return a&&(a.playing=!1,r.push(le(t,n))),r})},wake:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),qe(e,Ue(e,n,r[0]),function(e,t){var r=[],a=Qe(e,t);return a&&(a.playing=!1,r.push(le(t,n))),r})},nap:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,2);var a=Ue(e,n,r[0]),i=r[1],o=i.value,u=i.type===j?"beats":"seconds",s=i.modifier||1;return qe(e,a,function(e,t){var n=[],r=Qe(e,t);return r&&(r.playing=!1,n.push(function(e,t,n,r){return{type:$,actionType:re,agent:e,time:t,timeType:n,repeats:r}}(t,o,u,s))),n})},kill:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,0),Object.keys(e.agents).map(function(t){return e.agents[t].playing=!1,he(t)})},scale:Be,scalepush:function(e,t){Be(e,t);var n=[];return Object.keys(e.agents).forEach(function(t){Qe(e,t).playing&&(n=n.concat(nt(e,t)))}),n},tonic:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Xe(e,n,r[0]);e.tonic=Math.floor(a)},tempo:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),function(e,t){return{type:$,actionType:ue,tempo:e,glide:t}}(Xe(e,n,r[0]),r[0].modifier)},shake:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").sort(function(){return.5-Math.random()}).join("")+r})},reverse:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").reverse().join("")+r})},shiftr:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=Ye(e,n,r[1],1);return Ke(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.slice(0,-i);return n+a.substr(a.length-i)+o+r})},shiftl:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=Ye(e,n,r[1],1);return Ke(e,a,function(e){var t=e.scoreString;if(t.length<4)return t;var n=t[0],r=t[t.length-1],a=t.slice(1,-1),o=a.substr(0,i);return n+a.slice(i)+o+r})},up:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){return e.scoreType!=E?e.scoreString:e.scoreString.toUpperCase()})},down:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){return e.scoreType!=E?e.scoreString:e.scoreString.toLowerCase()})},yoyo:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return He.test(e)?e.toLowerCase():Ze.test(e)?e.toUpperCase():e}).join("")+r})},swap:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1],a=t.slice(1,-1).split(""),i=a.filter(function(e){return" "!==e}).sort(function(){return.5-Math.random()});return n+a.map(function(e){return" "===e?e:i.pop()}).join("")+r})},order:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1],a=t.slice(1,-1).split(""),i=a.filter(function(e){return" "!==e}).sort().reverse();return n+a.map(function(e){return" "===e?e:i.pop()}).join("")+r})},invert:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]);return Ke(e,a,function(t){if(t.scoreType!==S)throw new _e(e.translation.errors.expectedMelodic(t.scoreType));var n=t.scoreString,r=n[0],a=n[n.length-1];return r+n.slice(1,-1).split("").map(function(e){if(" "===e)return e;var t=parseInt(e,10);return"".concat(Math.abs(t-8))}).join("")+a})},replace:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=function(e,t,n,r){return void 0===n?r:Ue(e,t,n)}(e,n,r[1]);return Ke(e,a,function(t){var n,r=t.scoreString,a=r[0],o=r[r.length-1],u=r.slice(1,-1).split("");switch(t.scoreType){case E:n=i===e.translation.misc.upper?u.map(function(e){return e.charCodeAt(0)<64||e.charCodeAt(0)>90?e:String.fromCharCode(Math.ceil(26*Math.random())+64)}).join(""):i===e.translation.misc.lower?u.map(function(e){return e.charCodeAt(0)<90||e.charCodeAt(0)>116?e:String.fromCharCode(Math.ceil(26*Math.random())+90)}).join(""):u.map(function(e){return" "===e?e:Ve[Math.ceil(52*Math.random())]}).join("");break;case S:case x:n=u.map(function(e){return" "===e?e:Math.ceil(9*Math.random())}).join("")}return a+n+o})},insert:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t,n=e.scoreString,r=n[0],a=n[n.length-1],i=n.slice(1,-1).split("");switch(e.scoreType){case E:t=i.map(function(e){return" "===e&&Math.random()>.5?Ve[Math.ceil(52*Math.random())]:e}).join("");break;case S:case x:t=i.map(function(e){return" "===e&&Math.random()>.5?Math.ceil(9*Math.random()):e}).join("")}return r+t+a})},remove:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return" "!==e&&Math.random()>.5?" ":e}).join("")+r})},expand:function(e,t){var n=t.name,r=t.args;Ge(e,n,r,1);var a=Ue(e,n,r[0]),i=Ye(e,n,r[1],1);return Ke(e,a,function(e){var t=e.scoreString,n=t[0],r=t[t.length-1];return n+t.slice(1,-1).split("").map(function(e){return" "===e?e:e+" ".repeat(i)}).join("")+r})},grid:function(e,t,n){var r=t.name,a=t.args,i=t.line,o=[];Ge(e,r,a,1);var u=Math.floor(Xe(e,r,a[0])),s=Math.floor(70/u),c=" |"+(" ".repeat(u-1)+"|").repeat(s);return o.push({type:W,actionType:Te,line:i+n,text:c}),o},remind:function(){var e,t=Object.keys(Je).join("\n");return[(e=t,{type:W,actionType:ke,info:e})]},dave:function(e,t){var n=t.name,r=t.args;return Ge(e,n,r,1),Ke(e,Ue(e,n,r[0]),function(e){var t=e.scoreString,n=t[0],r=t[t.length-1],a=t.slice(1,-1).split(""),i=a.filter(function(e){return" "!==e}).sort().reverse();return n+a.map(function(e){return" "===e?e:i.pop()}).join("")+r})}};function Qe(e,t){var n=e.agents[t];if(!n)throw new _e(e.translation.errors.noAgent(t));return n}function We(e,t,n,r){if(e.groups[t.name])throw new _e(e.translation.errors.groupExists(t.name));var a,i,o,u,s,c,f,p,l,h,m,d=[];return t.line+=r,n.line+=r,e.agents[t.name]=(a=t,i=n,o=!0,u=.5,s=ze.PLAYING,{agent:a,score:i,playing:o,amplitude:u,state:s}),d.push((c=t.name,f=t.line,p=t.position,l=t.position+t.name.length,h=n.position,m=n.position+n.scoreString.length,{type:W,actionType:ve,group:c,sections:{agent:{line:f,start:p,finish:l},score:{line:f,start:h,finish:m}}})),d}function $e(e,t){return e.tonic+V.notes[e.scale][t]}function et(e,t){switch(t.type){case f:return t.agent;default:return null}}function tt(e,t){var n=function(e,t){for(var n=[],r=0;r<t.statements.length;r+=1){var a=et(0,t.statements[r]);a&&n.push(a.name)}return{agentNames:n}}(0,t).agentNames,r=[];return n.forEach(function(t){r.push(he(t)),r=r.concat(function(e,t){var n=e.agents[t];return n&&(n.playing=!1,n.state=ze.STOPPED),[]}(e,t))}),r}function nt(e,t){var n=e.agents[t];if(!n)throw new _e(e.translation.errors.noAgent(t));return ot(e,n.agent,n.score)}function rt(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],a=0;a<t.statements.length;a+=1){var i=t.statements[a],o=void 0;try{o=at(e,i,n)}catch(e){throw e.name===J&&e.setLineNumber(n+a),e}o&&(r=r.concat(o))}return r}function at(e,t,n){switch(t.type){case f:return function(e,t,n){var r=t.agent,a=t.score,i=[];return i=(i=i.concat(ot(e,r,a))).concat(We(e,r,a,n))}(e,t,n);case p:return function(e,t){var n=t.name,r=t.effects,a=n.value;return qe(e,a,function(e,t){var n,a,i=Qe(e,t);return[(n=i.agent.name,a=r.map(function(e){return e.name}),{type:$,actionType:ae,agent:n,fxList:a})]})}(e,t);case l:return function(e,t){var n=t.name,r=t.effects,a=n.value;return qe(e,a,function(e,t){var n,a,i=Qe(e,t);return[(n=i.agent.name,a=r.map(function(e){return e.name}),{type:$,actionType:ie,agent:n,fxList:a})]})}(e,t);case h:return it(e,t,.1);case m:return it(e,t,-.1);case d:return function(e,t,n){var r=t.name,a=e.translation.commands[r];a&&(r=a);var i=e.stdlib[r];if(!i)throw new _e(e.translation.errors.unknownCommand(name));return i(e,t,n)}(e,t,n);case g:return function(e,t,n){var r=t.token;r.line+=n;var a=Math.random().toString(36).substring(7)+e.lastCallbackID;e.lastCallbackID+=1,e.callbacks[a]={command:L([t.command]),line:r.line};var i="seconds";t.timing.type===j&&(i="beats");var o=1;t.timing.modifier&&(o=t.timing.modifier);return[me(t.timing.value,i,o,a),(u=a,s=r.line,c=r.character,f=r.character+6,{type:W,actionType:ve,group:u,sections:{future:{line:s,start:c,finish:f}}})];var u,s,c,f}(e,t,n);case y:return function(e,t){var n=t.name,r=t.agents;if(e.agents[n])throw new _e(e.translation.errors.agentExists(n));if(e.groups[n])throw new _e(e.translation.errors.groupExists(n));var a=r.map(function(t){return Qe(e,t),t});return e.groups[n]=a,[]}(e,t);case v:return function(e){throw new _e(e.translation.errors.sequenceUnsupported())}(e);case b:return function(e,t){var n=t.name,r=t.notes;return function(e,t,n){e.chords[t]=n}(e,n,r),[]}(e,t);default:throw new _e(e.translation.errors.unknownStatement(t.type))}}function it(e,t,n){return qe(e,t.name.value,function(e,t){var r,a,i=Qe(e,t);return i.amplitude=Math.min(2,Math.max(0,i.amplitude+n)),[(r=i.agent.name,a=i.amplitude,{type:$,actionType:oe,agent:r,amplitude:a})]})}function ot(e,t,n){var r=n.scoreType;switch(r){case E:return function(e,t,n){var r=ut(e,[60],n.durations,n.modifiers),a=r.notes,i=r.durations,o=r.sustain,u=r.attack,s=r.panning,c=r.repeats,f=n.values,p=n.offset/4,l=function(e,t,n,r,a,i,o,u){return{type:k,scoreType:E,notes:e,durations:t,instruments:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(a,i,f,o,u,s,p,c);return[de(t.name,l)]}(e,t,n);case S:return function(e,t,n){var r=n.values.map(function(t){if("number"==typeof t)return $e(e,t);var n=function(e,t){if(e.chords[t])return e.chords[t];throw new _e(e.translation.errors.chordDoesntExist(t))}(e,t);return n.map(function(t){return $e(e,t)})}),a=ut(e,r,n.durations,n.modifiers),i=a.notes,o=a.durations,u=a.sustain,s=a.attack,c=a.panning,f=a.repeats,p=n.instrument,l=n.offset/4,h=function(e,t,n,r,a,i,o,u){return{type:k,scoreType:S,notes:e,durations:t,instrument:n,sustain:r,attack:a,panning:i,offset:o,repeats:u}}(i,o,p,u,s,c,l,f);return[ge(t.name,h)]}(e,t,n);case x:return function(e,t,n){var r=ut(e,[],n.durations,n.modifiers),a=r.durations,i=r.panning,o=r.repeats,u=n.values.map(function(e){return e/10}),s=n.instrument,c=n.offset/4,f=function(e,t,n,r,a,i,o){return{type:k,scoreType:x,pitch:e,amplitudes:t,durations:n,instrument:r,panning:a,offset:i,repeats:o}}(60,u,a,s,i,c,o);return[ye(t.name,f)]}(e,t,n);default:throw new _e(e.translation.errors.unknownScore(r))}}function ut(e,t,n,r){for(var a=t,i=n,o=[.25],u=[5],s=[0],c=1,f=0,p="inf",l=function(e){var t=r[e];if(t.type===P)switch(t.modifierType){case M:s=t.values.map(function(e){return(e-1)/4-1});break;case N:o=[1/t.noteLength*(t.multiplier||1)];break;case O:u=t.values}else if(t.type===A)switch(t.operator){case"+":a=a.map(function(e){return"number"==typeof e?e+t.value:e.map(function(e){return e+t.value})});break;case"-":a=a.map(function(e){return"number"==typeof e?e-t.value:e.map(function(e){return e-t.value})});break;case"*":c=t.value;break;case"/":c=1/t.value;break;case"!":f=t.value;break;case"@":p=t.value}},h=0;h<r.length;h+=1)l(h);return i[i.length-1]+=f,i=i.map(function(e){return e/4}).map(function(e){return e*c}),u=u.map(function(e){return e/9}),{notes:a,durations:i,sustain:o,attack:u,panning:s,silences:f,timestretch:c,repeats:p}}var st="AGENTFINISHED",ct="CALLBACKTRIGGER",ft="AGENTSTATECHANGE";function pt(e,t){switch(t.actionType){case st:return function(e,t){var n=t.name,r=[];return e.logger.info("Marking agent ".concat(n," as finished")),function(e,t){var n=e.agents[t];n&&(n.playing=!1)}(e,n),r.push(xe(n,ze.STOPPED)),r}(e,t);case ft:return function(e,t){var n=t.agentName,r=t.agentState,a=Qe(e,n).agent;return a.state=r,[xe(a.name,a.state)]}(e,t);case ct:return function(e,t){var n=t.callbackId,r=t.remaining,a=[],i=e.callbacks[n];if(!i)return e.logger.error("Error: no callback with id ".concat(n)),a;try{a=rt(e,i.command,null)}catch(e){if(e.name===J)throw e.setCallbackStatus(!0),e.setLineNumber(void 0),e}r<1&&delete e.callbacks[n];return a.push(function(e){return{type:W,actionType:Se,group:e}}(n)),a}(e,t);default:e.logger.warning("".concat(t.actionType," is an unknown action type"))}return[]}var lt={playPattern:"/play/pattern",command:"/command",agentAmplitude:"/agent/amplitude",addFX:"/agent/effects/add",rmFX:"/agent/effects/remove",tempo:"/tempo",callback:"/callback"};function ht(e,t){switch(t.actionType){case te:return n=e.command,a=(r=t).agent,i=r.method,gt(n,[{type:"string",value:i},{type:"string",value:a}]);case ne:return function(e,t){var n=t.agent;return gt(e,[{type:"string",value:"free"},{type:"string",value:n}])}(e.command,t);case re:return function(e,t){var n=t.agent,r=t.time,a=t.timeType,i=t.repeats;return gt(e,[{type:"string",value:"nap"},{type:"string",value:n},{type:"float",value:r},{type:"string",value:a},{type:"integer",value:i}])}(e.command,t);case ae:return function(e,t){var n=t.agent,r=t.fxList;return gt(e,[{type:"string",value:n},{type:"array",value:r}])}(e.addFX,t);case ie:return function(e,t){var n=t.agent,r=t.fxList,a=[{type:"string",value:n}];r.length>0&&a.push({type:"array",value:r});return gt(e,a)}(e.rmFX,t);case oe:return function(e,t){var n=t.agent,r=t.amplitude;return gt(e,[{type:"string",value:n},{type:"float",value:r}])}(e.agentAmplitude,t);case ue:return function(e,t){var n=t.tempo,r=t.glide,a=[{type:"float",value:n}];r&&a.push({type:"float",value:r});return gt(e,a)}(e.tempo,t);case se:return function(e,t){var n=t.time,r=t.timeType,a=t.repeats,i=t.callbackID;return gt(e,[{type:"float",value:n},{type:"string",value:r},{type:"integer",value:a},{type:"string",value:i}])}(e.callback,t);case ce:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"percussive"},{type:"string",value:t.agent},{type:"array",value:t.notes},{type:"array",value:t.durations},{type:"array",value:t.instruments},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"float",value:t.offset},n];return gt(e,r)}(e.playPattern,t);case fe:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=t.notes.map(function(e){return"number"==typeof e?{type:"integer",value:e}:{type:"array",value:e}}),a=[{type:"string",value:"melodic"},{type:"string",value:t.agent},{type:"array",value:r},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.sustain},{type:"array",value:t.attack},{type:"array",value:t.panning},{type:"float",value:t.offset},n];return gt(e,a)}(e.playPattern,t);case pe:return function(e,t){var n="inf"===t.repeats?{type:"bang"}:{type:"integer",value:t.repeats},r=[{type:"string",value:"concrete"},{type:"string",value:t.agent},{type:"integer",value:t.pitch},{type:"array",value:t.amplitudes},{type:"array",value:t.durations},{type:"string",value:t.instrument},{type:"array",value:t.panning},{type:"float",value:t.offset},n];return gt(e,r)}(e.playPattern,t)}var n,r,a,i}var mt={agentFinished:"/finished",callback:"/callback",agentState:"/agent/state"};function dt(e,t){switch(t.address){case e.agentFinished:return function(e){return t=yt(e,0),{type:ee,actionType:st,name:t};var t}(t);case e.callback:return function(e){var t=yt(e,0),n=function(e,t){var n=e.args[t];if("float"!==n.type&&"integer"!==n.type)throw new Fe("Expected Float or Integer but got ".concat(n.type));return n.value}(e,1);return function(e,t){return{type:ee,actionType:ct,callbackId:e,remaining:t}}(t,n)}(t);case e.agentState:return function(e){var t=yt(e,0),n=yt(e,1),r="";switch(n){case"playing":r=ze.PLAYING;break;case"sleeping":r=ze.SLEEPING;break;case"stopped":r=ze.STOPPED;break;default:throw new Fe("".concat(n," is not a valid agent state"))}return function(e,t){return{type:ee,actionType:ft,agentName:e,agentState:t}}(t,r)}(t);default:throw new Fe("".concat(t.address," is not a valid incoming address"))}}function gt(e,t){return{oscType:"message",address:e,args:t}}function yt(e,t){var n=e.args[t];if("string"!==n.type)throw new Fe("Expected String but got ".concat(n.type));return n.value}var vt={editorActions:r,agentStates:ze};function bt(e){var t={audio:[],editor:[]};return e.forEach(function(e){e.type===$?t.audio.push(e):e.type===W&&t.editor.push(e)}),t}function wt(e,t){switch(t.name){case J:case Q:e.logger.error(t.formattedMessage())}return{audio:[],editor:[]}}t.default={editorActions:r,init:function(e,t){var n=e||{info:console.log,warn:console.log,error:console.log},r=t||"english";return{scale:V.names.major,tonic:60,bpm:120,stdlib:Je,agents:{},groups:{},chords:{},callbacks:{},lastCallbackID:0,logger:n,language:r,translation:s[r].interpreter}},evaluate:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;try{return bt(rt(e,Z.parse(t),n))}catch(t){return wt(e,t)}},free:function(e,t){try{return bt(tt(e,Z.parse(t)))}catch(t){return wt(e,t)}},handleAction:pt,incomingAction:function(e,t){try{return bt(pt(e,t))}catch(t){return wt(e,t)}},actionToOSC:function(e){return e.map(function(e){return ht(lt,e)})},actionsToOSCBundle:function(e){return function(e){return{oscType:"bundle",timetag:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,elements:e}}(e.map(function(e){return ht(lt,e)}))},oscToAction:function(e){return dt(mt,e)},constants:vt}}])});
//# sourceMappingURL=atomiix.min.js.map
{
"name": "@atomiix/atomiix",
"version": "1.6.1",
"version": "1.6.2",
"description": "A live coding language based on Ixilang",

@@ -32,3 +32,3 @@ "main": "lib/atomiix.min.js",

"jest": "24.1.0",
"osc-min": "1.1.1",
"osc-min": "rumblesan/node-osc-min#uint-timestamp",
"prettier": "1.16.4",

@@ -35,0 +35,0 @@ "webpack": "4.29.5",

import { EDITORACTION } from '../types';
import * as t from './types';
// keeps track of what line an agent is on - sends to atom to deal with
export function MarkAgent(

@@ -5,0 +6,0 @@ name,

@@ -0,1 +1,2 @@

// main file - loading everything when the plugin starts in atom and you load an ixi file
import parser from './language/parser';

@@ -2,0 +3,0 @@ import { interpret, freeAgents } from './language/interpreter';

@@ -0,1 +1,2 @@

// making it so you can refer to variable names instead of strings
export const PROGRAM = 'PROGRAM';

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

// function to create an agent state for the interpreter to keep track of
export function AgentState(

@@ -17,2 +18,3 @@ agentToken,

// states that an agent can be in - affects editor/index.js
export const agentStates = {

@@ -19,0 +21,0 @@ PLAYING: 'AGENTSTATEPLAYING',

@@ -159,8 +159,6 @@ import scales from '../../music/scales';

export function interpretCommand(state, command, lineOffset) {
const name = command.name;
const commandName = state.translation.commands[name];
if (!commandName) {
throw new AtomiixRuntimeError(
state.translation.errors.unknownCommand(name)
);
let commandName = command.name;
const translatedCommandName = state.translation.commands[commandName];
if (translatedCommandName) {
commandName = translatedCommandName;
}

@@ -167,0 +165,0 @@ const cmd = state.stdlib[commandName];

@@ -0,1 +1,2 @@

// agent control commands - sleeping, waking, dozing etc
import * as audioActions from '../../actions/audio';

@@ -2,0 +3,0 @@ import * as astTypes from '../ast/types';

@@ -0,1 +1,2 @@

// things that specifically change something visually in the editor
import { ReplaceLine, DisplayInfo } from '../../actions/editor';

@@ -2,0 +3,0 @@ import { expectArgs, expectNum } from './util';

@@ -0,1 +1,2 @@

// things that affect the entire session in ixi
import * as audioActions from '../../actions/audio';

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

// collects everything so it can be exported
import { doze, wake, nap } from './control';

@@ -18,2 +19,3 @@ import { kill, scale, scalepush, tonic, tempo } from './global';

expand,
dave,
} from './score';

@@ -47,2 +49,3 @@ import { grid, remind } from './editor';

remind,
dave,
};

@@ -9,2 +9,3 @@ import * as astTypes from '../ast/types';

// this function figures out what needs to change when a command modifies the score of an agent
export function modifyScoreString(state, agentName, modifyFunc) {

@@ -40,2 +41,3 @@ let msgs = [];

// not currently used - all below functions will allow real-time/live changes to post-score modifiers
export function writeScoreModifiers(modifiers) {

@@ -42,0 +44,0 @@ return modifiers

@@ -0,1 +1,2 @@

// basically all the score functions are in this file
import * as astTypes from '../ast/types';

@@ -12,2 +13,3 @@ import { AtomiixRuntimeError } from '../errors';

// this function is from rewriting.js!
return modifyScoreString(state, agentName, score => {

@@ -184,2 +186,26 @@ const oldScoreString = score.scoreString;

export function dave(state, { name, args }) {
expectArgs(state, name, args, 1);
const agentName = expectString(state, name, args[0]);
return modifyScoreString(state, agentName, score => {
const oldScoreString = score.scoreString;
const opener = oldScoreString[0];
const closer = oldScoreString[oldScoreString.length - 1];
const chars = oldScoreString.slice(1, -1).split('');
const choices = chars
.filter(c => c !== ' ')
.sort()
.reverse();
const newChars = chars
.map(c => {
if (c === ' ') return c;
return choices.pop();
})
.join('');
const newScoreString = opener + newChars + closer;
return newScoreString;
});
}
const alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');

@@ -186,0 +212,0 @@

@@ -0,1 +1,2 @@

// defines expected arguments for functions like shake or yoyo - avoids duplication within individual functions
import * as astTypes from '../ast/types';

@@ -2,0 +3,0 @@ import { AtomiixRuntimeError } from '../errors';

@@ -53,2 +53,3 @@ export default {

remind: 'remind',
dave: 'dave',
},

@@ -55,0 +56,0 @@ errors: {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc