diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.73313bf6.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.73313bf6.js new file mode 100644 index 00000000..b2f208f7 --- /dev/null +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.73313bf6.js @@ -0,0 +1,49 @@ +var tn=Object.defineProperty;var rn=(r,t,e)=>t in r?tn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var K=(r,t,e)=>(rn(r,typeof t!="symbol"?t+"":t,e),e);const strudel=Object.freeze(Object.defineProperty({__proto__:null,get Fraction(){return fraction},get controls(){return controls},get drawLine(){return drawLine},get gist(){return gist},get Hap(){return Hap},get setStringParser(){return setStringParser},get Pattern(){return Pattern$3},get polyrhythm(){return polyrhythm},get pr(){return pr},get silence(){return silence$1},get pure(){return pure$1},get isPattern(){return isPattern$1},get reify(){return reify$2},get stack(){return stack$1},get slowcat(){return slowcat$1},get slowcatPrime(){return slowcatPrime},get fastcat(){return fastcat},get cat(){return cat},get timeCat(){return timeCat$1},get sequence(){return sequence$1},get seq(){return seq},get polymeterSteps(){return polymeterSteps},get polymeter(){return polymeter},get pm(){return pm},get add(){return add},get chop(){return chop},get chunk(){return chunk},get chunkBack(){return chunkBack},get div(){return div},get early(){return early},get echo(){return echo},get every(){return every},get fast(){return fast},get inv(){return inv},get invert(){return invert},get iter(){return iter},get iterBack(){return iterBack},get jux(){return jux},get juxBy(){return juxBy},get late(){return late},get linger(){return linger},get mask(){return mask},get mul(){return mul},get off(){return off},get ply(){return ply},get range(){return range},get rangex(){return rangex},get range2(){return range2},get rev(){return rev},get slow(){return slow},get struct(){return struct},get sub(){return sub},get superimpose(){return superimpose},get set(){return set},get when(){return when},get makeComposable(){return makeComposable},get patternify2(){return patternify2},get patternify3(){return patternify3},get patternify4(){return patternify4},get steady(){return steady},get signal(){return signal},get isaw(){return isaw},get isaw2(){return isaw2},get saw(){return saw},get saw2(){return saw2},get sine2(){return sine2},get sine(){return sine},get cosine(){return cosine},get cosine2(){return cosine2},get square(){return square},get square2(){return square2},get tri(){return tri},get tri2(){return tri2},get time(){return time},get rand(){return rand},get rand2(){return rand2},get _brandBy(){return _brandBy},get brandBy(){return brandBy},get brand(){return brand},get _irand(){return _irand},get irand(){return irand},get __chooseWith(){return __chooseWith},get chooseWith(){return chooseWith},get chooseInWith(){return chooseInWith},get choose(){return choose},get chooseCycles(){return chooseCycles},get randcat(){return randcat},get wchoose(){return wchoose},get wchooseCycles(){return wchooseCycles},get perlinWith(){return perlinWith},get perlin(){return perlin},get State(){return State},get TimeSpan(){return TimeSpan},get isNote(){return isNote},get tokenizeNote(){return tokenizeNote},get toMidi(){return toMidi},get fromMidi(){return fromMidi},get getFreq(){return getFreq},get midi2note(){return midi2note},get mod(){return mod},get getPlayableNoteValue(){return getPlayableNoteValue},get getFrequency(){return getFrequency},get rotate(){return rotate},get pipe(){return pipe},get compose(){return compose},get removeUndefineds(){return removeUndefineds},get flatten(){return flatten},get id(){return id},get constant(){return constant},get listRange(){return listRange},get curry(){return curry},get parseNumeral(){return parseNumeral},get mapArgs(){return mapArgs},get numeralArgs(){return numeralArgs},get parseFractional(){return parseFractional},get fractionalArgs(){return fractionalArgs},get evalScope(){return evalScope},get evaluate(){return evaluate$1},get repl(){return repl}},Symbol.toStringTag,{value:"Module"}));(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function e(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerpolicy&&(i.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?i.credentials="include":s.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(s){if(s.ep)return;s.ep=!0;const i=e(s);fetch(s.href,i)}})();const scriptRel="modulepreload",assetsURL=function(r){return"/tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/"+r},seen={},__vitePreload=function(t,e,o){if(!e||e.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(e.map(i=>{if(i=assetsURL(i),i in seen)return;seen[i]=!0;const l=i.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(!!o)for(let y=s.length-1;y>=0;y--){const $=s[y];if($.href===i&&(!l||$.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${f}`))return;const w=document.createElement("link");if(w.rel=l?"stylesheet":scriptRel,l||(w.as="script",w.crossOrigin=""),w.href=i,document.head.appendChild(w),l)return new Promise((y,$)=>{w.addEventListener("load",y),w.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t())};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function getAugmentedNamespace(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(o){var s=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:function(){return r[o]}})}),e}var fraction$1={exports:{}};/** + * @license Fraction.js v4.2.0 05/03/2022 + * https://www.xarg.org/2014/03/rational-numbers-in-javascript/ + * + * Copyright (c) 2021, Robert Eisele (robert@xarg.org) + * Dual licensed under the MIT or GPL Version 2 licenses. + **/(function(r,t){(function(e){var o=2e3,s={s:1,n:0,d:1};function i(p,d){if(isNaN(p=parseInt(p,10)))throw C.InvalidParameter;return p*d}function l(p,d){if(d===0)throw C.DivisionByZero;var m=Object.create(C.prototype);m.s=p<0?-1:1,p=p<0?-p:p;var b=S(p,d);return m.n=p/b,m.d=d/b,m}function f(p){for(var d={},m=p,b=2,I=4;I<=m;){for(;m%b===0;)m/=b,d[b]=(d[b]||0)+1;I+=1+2*b++}return m!==p?m>1&&(d[m]=(d[m]||0)+1):d[p]=(d[p]||0)+1,d}var g=function(p,d){var m=0,b=1,I=1,T=0,G=0,Y=0,E=1,W=1,P=0,B=1,z=1,O=1,Z=1e7,L;if(p!=null)if(d!==void 0){if(m=p,b=d,I=m*b,m%1!==0||b%1!==0)throw C.NonIntegerParameter}else switch(typeof p){case"object":{if("d"in p&&"n"in p)m=p.n,b=p.d,"s"in p&&(m*=p.s);else if(0 in p)m=p[0],1 in p&&(b=p[1]);else throw C.InvalidParameter;I=m*b;break}case"number":{if(p<0&&(I=p,p=-p),p%1===0)m=p;else if(p>0){for(p>=1&&(W=Math.pow(10,Math.floor(1+Math.log(p)/Math.LN10)),p/=W);B<=Z&&O<=Z;)if(L=(P+z)/(B+O),p===L){B+O<=Z?(m=P+z,b=B+O):O>B?(m=z,b=O):(m=P,b=B);break}else p>L?(P+=z,B+=O):(z+=P,O+=B),B>Z?(m=z,b=O):(m=P,b=B);m*=W}else(isNaN(p)||isNaN(d))&&(b=m=NaN);break}case"string":{if(B=p.match(/\d+|./g),B===null)throw C.InvalidParameter;if(B[P]==="-"?(I=-1,P++):B[P]==="+"&&P++,B.length===P+1?G=i(B[P++],I):B[P+1]==="."||B[P]==="."?(B[P]!=="."&&(T=i(B[P++],I)),P++,(P+1===B.length||B[P+1]==="("&&B[P+3]===")"||B[P+1]==="'"&&B[P+3]==="'")&&(G=i(B[P],I),E=Math.pow(10,B[P].length),P++),(B[P]==="("&&B[P+2]===")"||B[P]==="'"&&B[P+2]==="'")&&(Y=i(B[P+1],I),W=Math.pow(10,B[P+1].length)-1,P+=3)):B[P+1]==="/"||B[P+1]===":"?(G=i(B[P],I),E=i(B[P+2],1),P+=3):B[P+3]==="/"&&B[P+1]===" "&&(T=i(B[P],I),G=i(B[P+2],I),E=i(B[P+4],1),P+=5),B.length<=P){b=E*W,I=m=Y+b*T+W*G;break}}default:throw C.InvalidParameter}if(b===0)throw C.DivisionByZero;s.s=I<0?-1:1,s.n=Math.abs(m),s.d=Math.abs(b)};function w(p,d,m){for(var b=1;d>0;p=p*p%m,d>>=1)d&1&&(b=b*p%m);return b}function y(p,d){for(;d%2===0;d/=2);for(;d%5===0;d/=5);if(d===1)return 0;for(var m=10%d,b=1;m!==1;b++)if(m=m*10%d,b>o)return 0;return b}function $(p,d,m){for(var b=1,I=w(10,m,d),T=0;T<300;T++){if(b===I)return T;b=b*10%d,I=I*10%d}return 0}function S(p,d){if(!p)return d;if(!d)return p;for(;;){if(p%=d,!p)return d;if(d%=p,!d)return p}}function C(p,d){if(g(p,d),this instanceof C)p=S(s.d,s.n),this.s=s.s,this.n=s.n/p,this.d=s.d/p;else return l(s.s*s.n,s.d)}C.DivisionByZero=new Error("Division by Zero"),C.InvalidParameter=new Error("Invalid argument"),C.NonIntegerParameter=new Error("Parameters must be integer"),C.prototype={s:1,n:0,d:1,abs:function(){return l(this.n,this.d)},neg:function(){return l(-this.s*this.n,this.d)},add:function(p,d){return g(p,d),l(this.s*this.n*s.d+s.s*this.d*s.n,this.d*s.d)},sub:function(p,d){return g(p,d),l(this.s*this.n*s.d-s.s*this.d*s.n,this.d*s.d)},mul:function(p,d){return g(p,d),l(this.s*s.s*this.n*s.n,this.d*s.d)},div:function(p,d){return g(p,d),l(this.s*s.s*this.n*s.d,this.d*s.n)},clone:function(){return l(this.s*this.n,this.d)},mod:function(p,d){if(isNaN(this.n)||isNaN(this.d))return new C(NaN);if(p===void 0)return l(this.s*this.n%this.d,1);if(g(p,d),s.n===0&&this.d===0)throw C.DivisionByZero;return l(this.s*(s.d*this.n)%(s.n*this.d),s.d*this.d)},gcd:function(p,d){return g(p,d),l(S(s.n,this.n)*S(s.d,this.d),s.d*this.d)},lcm:function(p,d){return g(p,d),s.n===0&&this.n===0?l(0,1):l(s.n*this.n,S(s.n,this.n)*S(s.d,this.d))},ceil:function(p){return p=Math.pow(10,p||0),isNaN(this.n)||isNaN(this.d)?new C(NaN):l(Math.ceil(p*this.s*this.n/this.d),p)},floor:function(p){return p=Math.pow(10,p||0),isNaN(this.n)||isNaN(this.d)?new C(NaN):l(Math.floor(p*this.s*this.n/this.d),p)},round:function(p){return p=Math.pow(10,p||0),isNaN(this.n)||isNaN(this.d)?new C(NaN):l(Math.round(p*this.s*this.n/this.d),p)},inverse:function(){return l(this.s*this.d,this.n)},pow:function(p,d){if(g(p,d),s.d===1)return s.s<0?l(Math.pow(this.s*this.d,s.n),Math.pow(this.n,s.n)):l(Math.pow(this.s*this.n,s.n),Math.pow(this.d,s.n));if(this.s<0)return null;var m=f(this.n),b=f(this.d),I=1,T=1;for(var G in m)if(G!=="1"){if(G==="0"){I=0;break}if(m[G]*=s.n,m[G]%s.d===0)m[G]/=s.d;else return null;I*=Math.pow(G,m[G])}for(var G in b)if(G!=="1"){if(b[G]*=s.n,b[G]%s.d===0)b[G]/=s.d;else return null;T*=Math.pow(G,b[G])}return s.s<0?l(T,I):l(I,T)},equals:function(p,d){return g(p,d),this.s*this.n*s.d===s.s*s.n*this.d},compare:function(p,d){g(p,d);var m=this.s*this.n*s.d-s.s*s.n*this.d;return(0=0;T--)I=I.inverse().add(m[T]);if(I.sub(d).abs().valueOf()0&&(m+=d,m+=" ",b%=I),m+=b,m+="/",m+=I),m},toLatex:function(p){var d,m="",b=this.n,I=this.d;return this.s<0&&(m+="-"),I===1?m+=b:(p&&(d=Math.floor(b/I))>0&&(m+=d,b%=I),m+="\\frac{",m+=b,m+="}{",m+=I,m+="}"),m},toContinued:function(){var p,d=this.n,m=this.d,b=[];if(isNaN(d)||isNaN(m))return b;do b.push(Math.floor(d/m)),p=d%m,d=m,m=p;while(d!==1);return b},toString:function(p){var d=this.n,m=this.d;if(isNaN(d)||isNaN(m))return"NaN";p=p||15;var b=y(d,m),I=$(d,m,b),T=this.s<0?"-":"";if(T+=d/m|0,d%=m,d*=10,d&&(T+="."),b){for(var G=I;G--;)T+=d/m|0,d%=m,d*=10;T+="(";for(var G=b;G--;)T+=d/m|0,d%=m,d*=10;T+=")"}else for(var G=p;d&&G--;)T+=d/m|0,d%=m,d*=10;return T}},Object.defineProperty(C,"__esModule",{value:!0}),C.default=C,C.Fraction=C,r.exports=C})()})(fraction$1);const Fraction$1=getDefaultExportFromCjs(fraction$1.exports);Fraction$1.prototype.sam=function(){return this.floor()};Fraction$1.prototype.nextSam=function(){return this.sam().add(1)};Fraction$1.prototype.wholeCycle=function(){return new TimeSpan(this.sam(),this.nextSam())};Fraction$1.prototype.cyclePos=function(){return this.sub(this.sam())};Fraction$1.prototype.lt=function(r){return this.compare(r)<0};Fraction$1.prototype.gt=function(r){return this.compare(r)>0};Fraction$1.prototype.lte=function(r){return this.compare(r)<=0};Fraction$1.prototype.gte=function(r){return this.compare(r)>=0};Fraction$1.prototype.eq=function(r){return this.compare(r)==0};Fraction$1.prototype.max=function(r){return this.gt(r)?this:r};Fraction$1.prototype.min=function(r){return this.lt(r)?this:r};Fraction$1.prototype.show=function(){return this.s*this.n+"/"+this.d};Fraction$1.prototype.or=function(r){return this.eq(0)?r:this};const fraction=r=>(typeof r=="number"&&(r=String(r)),Fraction$1(r)),gcd=(...r)=>r.reduce((t,e)=>t.gcd(e),fraction(1));fraction._original=Fraction$1;class TimeSpan{constructor(t,e){this.begin=fraction(t),this.end=fraction(e)}get spanCycles(){const t=[];var e=this.begin;const o=this.end,s=o.sam();if(e.equals(o))return[new TimeSpan(e,o)];for(;o.gt(e);){if(e.sam().equals(s)){t.push(new TimeSpan(e,this.end));break}const i=e.nextSam();t.push(new TimeSpan(e,i)),e=i}return t}get duration(){return this.end.sub(this.begin)}cycleArc(){const t=this.begin.cyclePos(),e=t.add(this.duration);return new TimeSpan(t,e)}withTime(t){return new TimeSpan(t(this.begin),t(this.end))}withEnd(t){return new TimeSpan(this.begin,t(this.end))}withCycle(t){const e=this.begin.sam(),o=e.add(t(this.begin.sub(e))),s=e.add(t(this.end.sub(e)));return new TimeSpan(o,s)}intersection(t){const e=this.begin.max(t.begin),o=this.end.min(t.end);if(!e.gt(o)&&!(e.equals(o)&&(e.equals(this.end)&&this.begin.lt(this.end)||e.equals(t.end)&&t.begin.lt(t.end))))return new TimeSpan(e,o)}intersection_e(t){const e=this.intersection(t);if(e==null)throw"TimeSpans do not intersect";return e}midpoint(){return this.begin.add(this.duration.div(fraction(2)))}equals(t){return this.begin.equals(t.begin)&&this.end.equals(t.end)}show(){return this.begin.show()+" -> "+this.end.show()}}class Hap{constructor(t,e,o,s={},i=!1){this.whole=t,this.part=e,this.value=o,this.context=s,this.stateful=i,i&&console.assert(typeof this.value=="function","Stateful values must be functions")}get duration(){return this.whole.end.sub(this.whole.begin)}wholeOrPart(){return this.whole?this.whole:this.part}withSpan(t){const e=this.whole?t(this.whole):void 0;return new Hap(e,t(this.part),this.value,this.context)}withValue(t){return new Hap(this.whole,this.part,t(this.value),this.context)}hasOnset(){return this.whole!=null&&this.whole.begin.equals(this.part.begin)}resolveState(t){if(this.stateful&&this.hasOnset()){console.log("stateful");const e=this.value,[o,s]=e(t);return[o,new Hap(this.whole,this.part,s,this.context,!1)]}return[t,this]}spanEquals(t){return this.whole==null&&t.whole==null||this.whole.equals(t.whole)}equals(t){return this.spanEquals(t)&&this.part.equals(t.part)&&this.value===t.value}show(){return"("+(this.whole==null?"~":this.whole.show())+", "+this.part.show()+", "+this.value+")"}showWhole(){return`${this.whole==null?"~":this.whole.show()}: ${typeof this.value=="object"?JSON.stringify(this.value):this.value}`}combineContext(t){const e=this;return{...e.context,...t.context,locations:(e.context.locations||[]).concat(t.context.locations||[])}}setContext(t){return new Hap(this.whole,this.part,this.value,t)}}class State{constructor(t,e={}){this.span=t,this.controls=e}setSpan(t){return new State(t,this.controls)}withSpan(t){return this.setSpan(t(this.span))}setControls(t){return new State(this.span,t)}}const isNote=r=>/^[a-gA-G][#b]*[0-9]$/.test(r),tokenizeNote=r=>{var s;if(typeof r!="string")return[];const[t,e="",o]=((s=r.match(/^([a-gA-G])([#bs]*)([0-9])?$/))==null?void 0:s.slice(1))||[];return t?[t,e,o?Number(o):void 0]:[]},toMidi=r=>{const[t,e,o]=tokenizeNote(r);if(!t)throw new Error('not a note: "'+r+'"');const s={c:0,d:2,e:4,f:5,g:7,a:9,b:11}[t.toLowerCase()],i=(e==null?void 0:e.split("").reduce((l,f)=>l+{"#":1,b:-1,s:1}[f],0))||0;return(Number(o)+1)*12+s+i},fromMidi=r=>Math.pow(2,(r-69)/12)*440,getFreq=r=>fromMidi(typeof r=="number"?r:toMidi(r)),midi2note=r=>{const t=Math.floor(r/12)-1;return["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"][r%12]+t},mod=(r,t)=>(r%t+t)%t,getPlayableNoteValue=r=>{let{value:t,context:e}=r;if(typeof t=="object"&&!Array.isArray(t)&&(t=t.note||t.n||t.value),typeof t=="number"&&e.type!=="frequency")t=fromMidi(r.value);else if(typeof t=="number"&&e.type==="frequency")t=r.value;else if(typeof t!="string"||!isNote(t))throw new Error("not a note: "+JSON.stringify(t));return t},getFrequency=r=>{let{value:t,context:e}=r;if(typeof t=="object")return t.freq?t.freq:getFreq(t.note||t.n||t.value);if(typeof t=="number"&&e.type!=="frequency")t=fromMidi(r.value);else if(typeof t=="string"&&isNote(t))t=fromMidi(toMidi(r.value));else if(typeof t!="number")throw new Error("not a note or frequency: "+t);return t},rotate=(r,t)=>r.slice(t).concat(r.slice(0,t)),pipe=(...r)=>r.reduce((t,e)=>(...o)=>t(e(...o)),t=>t),compose=(...r)=>pipe(...r.reverse()),removeUndefineds=r=>r.filter(t=>t!=null),flatten=r=>[].concat(...r),id=r=>r,constant=(r,t)=>r,listRange=(r,t)=>Array.from({length:t-r+1},(e,o)=>o+r);function curry(r,t){const e=function o(...s){if(s.length>=r.length)return r.apply(this,s);{const i=function(...l){return o.apply(this,s.concat(l))};return t&&t(i,s),i}};return t&&t(e,[]),e}function parseNumeral(r){const t=Number(r);if(!isNaN(t))return t;if(isNote(r))return toMidi(r);throw new Error(`cannot parse as numeral: "${r}"`)}function mapArgs(r,t){return(...e)=>r(...e.map(t))}function numeralArgs(r){return mapArgs(r,parseNumeral)}function parseFractional(r){const t=Number(r);if(!isNaN(t))return t;const e={pi:Math.PI,w:1,h:.5,q:.25,e:.125,s:.0625,t:1/3,f:.2,x:1/6}[r];if(typeof e<"u")return e;throw new Error(`cannot parse as fractional: "${r}"`)}const fractionalArgs=r=>mapArgs(r,parseFractional);function unionWithObj(r,t,e){const o=Object.keys(r).filter(s=>Object.keys(t).includes(s));return Object.assign({},r,t,Object.fromEntries(o.map(s=>[s,e(r[s],t[s])])))}curry((r,t)=>r*t);curry((r,t)=>t.map(r));function drawLine(r,t=60){let e=0,o=fraction(0),s=[""],i="";for(;s[0].lengthy.hasOnset()).map(y=>y.duration),g=gcd(...f),w=g.inverse();s=s.map(y=>y+"|"),i+="|";for(let y=0;yd.whole.begin.lte($)&&d.whole.end.gte(S)),p=C.length-s.length;p>0&&(s=s.concat(Array(p).fill(i))),s=s.map((d,m)=>{const b=C[m];if(b){const T=b.whole.begin.eq($)?""+b.value:"-";return d+T}return d+"."}),i+=".",o=o.add(g)}e++}return s.join(` +`)}let stringParser;const setStringParser=r=>stringParser=r;class Pattern$3{constructor(t){K(this,"_Pattern",!0);this.query=t}queryArc(t,e){return this.query(new State(new TimeSpan(t,e)))}_splitQueries(){const t=this,e=o=>flatten(o.span.spanCycles.map(s=>t.query(o.setSpan(s))));return new Pattern$3(e)}withQuerySpan(t){return new Pattern$3(e=>this.query(e.withSpan(t)))}withQuerySpanMaybe(t){const e=this;return new Pattern$3(o=>{const s=o.withSpan(t);return s.span?e.query(s):[]})}withQueryTime(t){return new Pattern$3(e=>this.query(e.withSpan(o=>o.withTime(t))))}withHapSpan(t){return new Pattern$3(e=>this.query(e).map(o=>o.withSpan(t)))}withHapTime(t){return this.withHapSpan(e=>e.withTime(t))}_withHaps(t){return new Pattern$3(e=>t(this.query(e)))}_withHap(t){return this._withHaps(e=>e.map(t))}_setContext(t){return this._withHap(e=>e.setContext(t))}_withContext(t){return this._withHap(e=>e.setContext(t(e.context)))}_stripContext(){return this._withHap(t=>t.setContext({}))}withLocation(t,e){const o={start:{line:t[0],column:t[1],offset:t[2]},end:{line:e[0],column:e[1],offset:e[2]}};return this._withContext(s=>{const i=(s.locations||[]).concat([o]);return{...s,locations:i}})}withMiniLocation(t,e){const o={start:{line:t[0],column:t[1],offset:t[2]},end:{line:e[0],column:e[1],offset:e[2]}};return this._withContext(s=>{let i=s.locations||[];return i=i.map(({start:l,end:f})=>{const g=l.line===1?o.start.column:0;return{start:{...l,line:l.line-1+(o.start.line-1)+1,column:l.column-1+g},end:{...f,line:f.line-1+(o.start.line-1)+1,column:f.column-1+g}}}),{...s,locations:i}})}withValue(t){return new Pattern$3(e=>this.query(e).map(o=>o.withValue(t)))}fmap(t){return this.withValue(t)}_filterHaps(t){return new Pattern$3(e=>this.query(e).filter(t))}_filterValues(t){return new Pattern$3(e=>this.query(e).filter(o=>t(o.value)))}_removeUndefineds(){return this._filterValues(t=>t!=null)}onsetsOnly(){return this._filterHaps(t=>t.hasOnset())}discreteOnly(){return this._filterHaps(t=>t.whole)}_appWhole(t,e){const o=this,s=function(i){const l=o.query(i),f=e.query(i),g=function(w,y){const $=w.part.intersection(y.part);if($!=null)return new Hap(t(w.whole,y.whole),$,w.value(y.value),y.combineContext(w))};return flatten(l.map(w=>removeUndefineds(f.map(y=>g(w,y)))))};return new Pattern$3(s)}appBoth(t){const e=function(o,s){if(!(o==null||s==null))return o.intersection_e(s)};return this._appWhole(e,t)}appLeft(t){const e=this,o=function(s){const i=[];for(const l of e.query(s)){const f=t.query(s.setSpan(l.wholeOrPart()));for(const g of f){const w=l.whole,y=l.part.intersection(g.part);if(y){const $=l.value(g.value),S=g.combineContext(l),C=new Hap(w,y,$,S);i.push(C)}}}return i};return new Pattern$3(o)}appRight(t){const e=this,o=function(s){const i=[];for(const l of t.query(s)){const f=e.query(s.setSpan(l.wholeOrPart()));for(const g of f){const w=l.whole,y=g.part.intersection(l.part);if(y){const $=g.value(l.value),S=l.combineContext(g),C=new Hap(w,y,$,S);i.push(C)}}}return i};return new Pattern$3(o)}firstCycle(t=!1){var e=this;return t||(e=e._stripContext()),e.query(new State(new TimeSpan(fraction(0),fraction(1))))}get _firstCycleValues(){return this.firstCycle().map(t=>t.value)}get _showFirstCycle(){return this.firstCycle().map(t=>`${t.value}: ${t.whole.begin.toFraction()} - ${t.whole.end.toFraction()}`)}_sortHapsByPart(){return this._withHaps(t=>t.sort((e,o)=>e.part.begin.sub(o.part.begin).or(e.part.end.sub(o.part.end)).or(e.whole.begin.sub(o.whole.begin).or(e.whole.end.sub(o.whole.end)))))}_opIn(t,e){return this.fmap(e).appLeft(reify$2(t))}_opOut(t,e){return this.fmap(e).appRight(reify$2(t))}_opMix(t,e){return this.fmap(e).appBoth(reify$2(t))}_opSqueeze(t,e){const o=reify$2(t);return this.fmap(s=>o.fmap(i=>e(s)(i)))._squeezeJoin()}_opSqueezeOut(t,e){const o=this;return reify$2(t).fmap(i=>o.fmap(l=>e(l)(i)))._squeezeJoin()}_opTrig(t,e){return reify$2(t).fmap(s=>this.fmap(i=>e(i)(s)))._trigJoin()}_opTrigzero(t,e){return reify$2(t).fmap(s=>this.fmap(i=>e(i)(s)))._TrigzeroJoin()}_asNumber(){return this.fmap(parseNumeral)}round(){return this._asNumber().fmap(t=>Math.round(t))}floor(){return this._asNumber().fmap(t=>Math.floor(t))}ceil(){return this._asNumber().fmap(t=>Math.ceil(t))}_toBipolar(){return this.fmap(t=>t*2-1)}_fromBipolar(){return this.fmap(t=>(t+1)/2)}_range(t,e){return this.mul(e-t).add(t)}_rangex(t,e){return this._range(Math.log(t),Math.log(e)).fmap(Math.exp)}_range2(t,e){return this._fromBipolar()._range(t,e)}_bindWhole(t,e){const o=this,s=function(i){const l=function(g,w){return new Hap(t(g.whole,w.whole),w.part,w.value,Object.assign({},g.context,w.context,{locations:(g.context.locations||[]).concat(w.context.locations||[])}))},f=function(g){return e(g.value).query(i.setSpan(g.part)).map(w=>l(g,w))};return flatten(o.query(i).map(g=>f(g)))};return new Pattern$3(s)}bind(t){const e=function(o,s){if(!(o==null||s==null))return o.intersection_e(s)};return this._bindWhole(e,t)}join(){return this.bind(id)}outerBind(t){return this._bindWhole((e,o)=>e,t)}outerJoin(){return this.outerBind(id)}innerBind(t){return this._bindWhole((e,o)=>o,t)}innerJoin(){return this.innerBind(id)}_trigJoin(t=!1){const e=this;return new Pattern$3(o=>e.discreteOnly().query(o).map(s=>s.value.late(t?s.whole.begin:s.whole.begin.cyclePos()).query(o).map(i=>new Hap(i.whole?i.whole.intersection(s.whole):void 0,i.part.intersection(s.part),i.value).setContext(s.combineContext(i))).filter(i=>i.part)).flat())}_TrigzeroJoin(){return this._trigJoin(!0)}_squeezeJoin(){const t=this;function e(o){const s=t.discreteOnly().query(o);function i(f){const w=f.value._focusSpan(f.wholeOrPart()).query(o.setSpan(f.part));function y($,S){let C;if(S.whole&&$.whole&&(C=S.whole.intersection($.whole),!C))return;const p=S.part.intersection($.part);if(!p)return;const d=S.combineContext($);return new Hap(C,p,S.value,d)}return w.map($=>y(f,$))}return flatten(s.map(i)).filter(f=>f)}return new Pattern$3(e)}_squeezeBind(t){return this.fmap(t)._squeezeJoin()}_apply(t){return t(this)}layer(...t){return stack$1(...t.map(e=>e(this)))}_patternify(t){const e=this;return function(...s){return s=s.map(l=>isPattern$1(l)?l.fmap(f=>f.value||f):l),sequence$1(...s).fmap(l=>t.call(e,l)).innerJoin()}}_fastGap(t){const e=function(s){const i=s.begin.sam(),l=s.begin.sub(i).mul(t).min(1),f=s.end.sub(i).mul(t).min(1);if(!(l>=1))return new TimeSpan(i.add(l),i.add(f))},o=function(s){const i=s.part.begin,l=s.part.end,f=i.sam(),g=i.sub(f).div(t).min(1),w=l.sub(f).div(t).min(1),y=new TimeSpan(f.add(g),f.add(w)),$=s.whole?new TimeSpan(y.begin.sub(i.sub(s.whole.begin).div(t)),y.end.add(s.whole.end.sub(l).div(t))):void 0;return new Hap($,y,s.value,s.context)};return this.withQuerySpanMaybe(e)._withHap(o)._splitQueries()}_compress(t,e){return t.gt(e)||t.gt(1)||e.gt(1)||t.lt(0)||e.lt(0)?silence$1:this._fastGap(fraction(1).div(e.sub(t)))._late(t)}_compressSpan(t){return this._compress(t.begin,t.end)}_focus(t,e){return this._fast(fraction(1).div(e.sub(t))).late(t.cyclePos())}_focusSpan(t){return this._focus(t.begin,t.end)}_fast(t){return this.withQueryTime(o=>o.mul(t)).withHapTime(o=>o.div(t))}_slow(t){return this._fast(fraction(1).div(t))}_inside(t,e){return e(this._slow(t))._fast(t)}_outside(t,e){return e(this._fast(t))._slow(t)}_ply(t){return this.fmap(e=>pure$1(e)._fast(t))._squeezeJoin()}_chop(t){const o=Array.from({length:t},(i,l)=>l).map(i=>({begin:i/t,end:(i+1)/t})),s=function(i){return sequence$1(o.map(l=>Object.assign({},i,l)))};return this._squeezeBind(s)}_striate(t){const o=Array.from({length:t},(i,l)=>l).map(i=>({begin:i/t,end:(i+1)/t})),s=slowcat$1(...o);return this.set(s)._fast(t)}_cpm(t){return this._fast(t/60)}_early(t){return t=fraction(t),this.withQueryTime(e=>e.add(t)).withHapTime(e=>e.sub(t))}_late(t){return t=fraction(t),this._early(fraction(0).sub(t))}_zoom(t,e){e=fraction(e),t=fraction(t);const o=e.sub(t);return this.withQuerySpan(s=>s.withCycle(i=>i.mul(o).add(t))).withHapSpan(s=>s.withCycle(i=>i.sub(t).div(o)))._splitQueries()}_zoomArc(t){return this.zoom(t.begin,t.end)}_linger(t){return t==0?silence$1:t<0?this._zoom(t.add(1),1)._slow(t):this._zoom(0,t)._slow(t)}_color(t){return this._withContext(e=>({...e,color:t}))}log(){return this._withHap(t=>{var e;return t.setContext({...t.context,logs:(((e=t.context)==null?void 0:e.logs)||[]).concat([t.show()])})})}drawLine(){return console.log(drawLine(this)),this}_segment(t){return this.struct(pure$1(!0)._fast(t))}invert(){return this.fmap(t=>!t)}inv(){return this.invert()}when(t,e){const o=t._filterValues(id),s=t._filterValues(f=>!f),i=o.fmap(f=>g=>g).appRight(e(this)),l=s.fmap(f=>g=>g).appRight(this);return stack$1(i,l)}off(t,e){return stack$1(this,e(this.late(t)))}every(t,e){const o=this,s=Array(t-1).fill(o);return s.push(e(o)),slowcatPrime(...s)}every(t,e){const o=this,s=Array(t-1).fill(o);return s.unshift(e(o)),slowcatPrime(...s)}each(t,e){const o=this,s=Array(t-1).fill(o);return s.push(e(o)),slowcatPrime(...s)}brak(){return this.when(slowcat$1(!1,!0),t=>fastcat(t,silence$1)._late(.25))}rev(){const t=this,e=function(o){const s=o.span,i=s.begin.sam(),l=s.begin.nextSam(),f=function(w){const y=w.withTime(S=>i.add(l.sub(S))),$=y.begin;return y.begin=y.end,y.end=$,y};return t.query(o.setSpan(f(s))).map(w=>w.withSpan(f))};return new Pattern$3(e)._splitQueries()}palindrome(){return this.every(2,rev)}juxBy(t,e){t/=2;const o=function(l,f,g){return f in l?l[f]:g},s=this.withValue(l=>Object.assign({},l,{pan:o(l,"pan",.5)-t})),i=this.withValue(l=>Object.assign({},l,{pan:o(l,"pan",.5)+t}));return stack$1(s,e(i))}_jux(t){return this.juxBy(1,t)}stack(...t){return stack$1(this,...t)}sequence(...t){return sequence$1(this,...t)}seq(...t){return sequence$1(this,...t)}cat(...t){return cat(this,...t)}fastcat(...t){return fastcat(this,...t)}slowcat(...t){return slowcat$1(this,...t)}superimpose(...t){return this.stack(...t.map(e=>e(this)))}stutWith(t,e,o){return stack$1(...listRange(0,t-1).map(s=>o(this.late(fraction(e).mul(s)),s)))}stut(t,e,o){return this.stutWith(t,o,(s,i)=>s.velocity(Math.pow(e,i)))}_echoWith(t,e,o){return stack$1(...listRange(0,t-1).map(s=>o(this.late(fraction(e).mul(s)),s)))}_echo(t,e,o){return this._echoWith(t,e,(s,i)=>s.velocity(Math.pow(o,i)))}iter(t,e=!1){return slowcat$1(...listRange(0,t-1).map(o=>e?this.late(o/t):this.early(o/t)))}iterBack(t){return this.iter(t,!0)}_chunk(t,e,o=!1){const s=Array(t-1).fill(!1);s.unshift(!0);const i=sequence$1(...s).iter(t,o);return this.when(i,e)}_chunkBack(t,e){return this._chunk(t,e,!0)}_bypass(t){return t=Boolean(parseInt(t)),t?silence$1:this}hush(){return silence$1}_duration(t){return this.withHapSpan(e=>new TimeSpan(e.begin,e.begin.add(t)))}_legato(t){return this.withHapSpan(e=>new TimeSpan(e.begin,e.begin.add(e.end.sub(e.begin).mul(t))))}_velocity(t){return this._withContext(e=>({...e,velocity:(e.velocity||1)*t}))}_loopAt(t,e=1){return this.speed(1/t*e).unit("c").slow(t)}onTrigger(t){return this._withHap(e=>e.setContext({...e.context,onTrigger:t}))}log(t=id){return this._withHap(e=>e.setContext({...e.context,onTrigger:(...o)=>{e.context.onTrigger&&e.context.onTrigger(...o),console.log(t(...o))}}))}logValues(t=id){return this.log((e,o)=>t(o.value))}}function _composeOp(r,t,e){function o(s){return s instanceof Object&&!(s instanceof Function)}return o(r)||o(t)?(o(r)||(r={value:r}),o(t)||(t={value:t}),unionWithObj(r,t,e)):e(r,t)}(function(){const r={set:[(t,e)=>e],keep:[(t,e)=>t],keepif:[(t,e)=>e?t:void 0],add:[numeralArgs((t,e)=>t+e)],sub:[numeralArgs((t,e)=>t-e)],mul:[numeralArgs((t,e)=>t*e)],div:[numeralArgs((t,e)=>t/e)],mod:[numeralArgs(mod)],pow:[numeralArgs(Math.pow)],_and:[numeralArgs((t,e)=>t&e)],_or:[numeralArgs((t,e)=>t|e)],_xor:[numeralArgs((t,e)=>t^e)],_lshift:[numeralArgs((t,e)=>t<t>>e)],lt:[(t,e)=>tt>e],lte:[(t,e)=>t<=e],gte:[(t,e)=>t>=e],eq:[(t,e)=>t==e],eqt:[(t,e)=>t===e],ne:[(t,e)=>t!=e],net:[(t,e)=>t!==e],and:[(t,e)=>t&&e],or:[(t,e)=>t||e],func:[(t,e)=>e(t)]};for(const[t,[e,o]]of Object.entries(r))for(const s of["In","Out","Mix","Squeeze","SqueezeOut","Trig","Trigzero"])Pattern$3.prototype[t+s]=function(...i){var l=this;i=sequence$1(i),o&&(l=o(l),i=o(i));var f;return t==="keepif"?(f=l["_op"+s](i,g=>w=>e(g,w)),f=f._removeUndefineds()):f=l["_op"+s](i,g=>w=>_composeOp(g,w,e)),f},s==="Squeeze"&&(Pattern$3.prototype[t+"SqueezeIn"]=Pattern$3.prototype[t+s]),s==="In"?Pattern$3.prototype[t]=Pattern$3.prototype[t+s]:t==="set"&&(Pattern$3.prototype[s.toLowerCase()]=Pattern$3.prototype[t+s]);Pattern$3.prototype.struct=Pattern$3.prototype.keepifOut,Pattern$3.prototype.structAll=Pattern$3.prototype.keepOut,Pattern$3.prototype.mask=Pattern$3.prototype.keepifIn,Pattern$3.prototype.maskAll=Pattern$3.prototype.keepIn,Pattern$3.prototype.reset=Pattern$3.prototype.keepifTrig,Pattern$3.prototype.resetAll=Pattern$3.prototype.keepTrig,Pattern$3.prototype.restart=Pattern$3.prototype.keepifTrigzero,Pattern$3.prototype.restartAll=Pattern$3.prototype.keepTrigzero})();Pattern$3.prototype.patternified=["apply","chop","color","cpm","duration","early","fast","jux","late","legato","linger","ply","segment","striate","slow","velocity"];const polyrhythm=stack$1,pr=stack$1;Pattern$3.prototype.factories={pure:pure$1,stack:stack$1,slowcat:slowcat$1,fastcat,cat,timeCat:timeCat$1,sequence:sequence$1,seq,polymeter,pm,polyrhythm,pr};const silence$1=new Pattern$3(r=>[]);function pure$1(r){function t(e){return e.span.spanCycles.map(o=>new Hap(fraction(o.begin).wholeCycle(),o,r))}return new Pattern$3(t)}function isPattern$1(r){const t=r instanceof Pattern$3||(r==null?void 0:r._Pattern);return!r instanceof Pattern$3&&console.warn(`Found Pattern that fails "instanceof Pattern" check. + This may happen if you are using multiple versions of @strudel.cycles/core. + Please check by running "npm ls @strudel.cycles/core".`),t}function reify$2(r){return isPattern$1(r)?r:stringParser&&typeof r=="string"?stringParser(r):pure$1(r)}function stack$1(...r){r=r.map(e=>Array.isArray(e)?sequence$1(...e):reify$2(e));const t=e=>flatten(r.map(o=>o.query(e)));return new Pattern$3(t)}function slowcat$1(...r){r=r.map(e=>Array.isArray(e)?sequence$1(...e):reify$2(e));const t=function(e){const o=e.span,s=mod(o.begin.sam(),r.length),i=r[s];if(!i)return[];const l=o.begin.floor().sub(o.begin.div(r.length).floor());return i.withHapTime(f=>f.add(l)).query(e.setSpan(o.withTime(f=>f.sub(l))))};return new Pattern$3(t)._splitQueries()}function slowcatPrime(...r){r=r.map(reify$2);const t=function(e){const o=Math.floor(e.span.begin)%r.length,s=r[o];return(s==null?void 0:s.query(e))||[]};return new Pattern$3(t)._splitQueries()}function fastcat(...r){return slowcat$1(...r)._fast(r.length)}function cat(...r){return slowcat$1(...r)}function timeCat$1(...r){const t=r.map(s=>s[0]).reduce((s,i)=>s.add(i),fraction(0));let e=fraction(0);const o=[];for(const[s,i]of r){const l=e.add(s);o.push(reify$2(i)._compress(e.div(t),l.div(t))),e=l}return stack$1(...o)}function sequence$1(...r){return fastcat(...r)}function seq(...r){return fastcat(...r)}function _sequenceCount(r){return Array.isArray(r)?r.length==0?[silence$1,0]:r.length==1?_sequenceCount(r[0]):[fastcat(...r.map(t=>_sequenceCount(t)[0])),r.length]:[reify$2(r),1]}function polymeterSteps(r,...t){const e=t.map(s=>_sequenceCount(s));if(e.length==0)return silence$1;r==0&&(r=e[0][1]);const o=[];for(const s of e)s[1]==0&&next,r==s[1]?o.push(s[0]):o.push(s[0]._fast(fraction(r).div(fraction(s[1]))));return stack$1(...o)}function polymeter(...r){return polymeterSteps(0,...r)}function pm(...r){polymeter(...r)}const add=curry((r,t)=>t.add(r)),chop=curry((r,t)=>t.chop(r)),chunk=curry((r,t)=>t.chunk(r)),chunkBack=curry((r,t)=>t.chunkBack(r)),div=curry((r,t)=>t.div(r)),early=curry((r,t)=>t.early(r)),echo=curry((r,t,e,o)=>o.echo(r,t,e)),every=curry((r,t,e)=>e.every(r,t)),fast=curry((r,t)=>t.fast(r)),inv=r=>r.inv(),invert=r=>r.invert(),iter=curry((r,t)=>t.iter(r)),iterBack=curry((r,t)=>t.iter(r)),jux=curry((r,t)=>t.jux(r)),juxBy=curry((r,t,e)=>e.juxBy(r,t)),late=curry((r,t)=>t.late(r)),linger=curry((r,t)=>t.linger(r)),mask=curry((r,t)=>t.mask(r)),mul=curry((r,t)=>t.mul(r)),off=curry((r,t,e)=>e.off(r,t)),ply=curry((r,t)=>t.ply(r)),range=curry((r,t,e)=>e.range(r,t)),rangex=curry((r,t,e)=>e.rangex(r,t)),range2=curry((r,t,e)=>e.range2(r,t)),rev=r=>r.rev(),slow=curry((r,t)=>t.slow(r)),struct=curry((r,t)=>t.struct(r)),sub=curry((r,t)=>t.sub(r)),superimpose=curry((r,t)=>t.superimpose(...r)),set=curry((r,t)=>t.set(r)),when=curry((r,t,e)=>e.when(r,t));Pattern$3.prototype.composable={fast,slow,early,late,superimpose};function makeComposable(r){return Object.entries(Pattern$3.prototype.composable).forEach(([t,e])=>{r[t]=(...o)=>{const s=compose(r,e(...o));return makeComposable(s)}}),r}const patternify2=r=>(t,e,o)=>t.fmap(s=>i=>r.call(o,s,i)).appLeft(e).innerJoin(),patternify3=r=>(t,e,o,s)=>t.fmap(i=>l=>f=>r.call(s,i,l,f)).appLeft(e).appLeft(o).innerJoin(),patternify4=r=>(t,e,o,s,i)=>t.fmap(l=>f=>g=>w=>r.call(i,l,f,g,w)).appLeft(e).appLeft(o).appLeft(s).innerJoin();Pattern$3.prototype.echo=function(...r){return r=r.map(reify$2),patternify3(Pattern$3.prototype._echo)(...r,this)};Pattern$3.prototype.echoWith=function(...r){return r=r.map(reify$2),patternify3(Pattern$3.prototype._echoWith)(...r,this)};Pattern$3.prototype.chunk=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._chunk)(...r,this)};Pattern$3.prototype.chunkBack=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._chunkBack)(...r,this)};Pattern$3.prototype.loopAt=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._loopAt)(...r,this)};Pattern$3.prototype.zoom=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._zoom)(...r,this)};Pattern$3.prototype.compress=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._compress)(...r,this)};Pattern$3.prototype.outside=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._outside)(...r,this)};Pattern$3.prototype.inside=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._inside)(...r,this)};Pattern$3.prototype.range=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._range)(...r,this)};Pattern$3.prototype.rangex=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._rangex)(...r,this)};Pattern$3.prototype.range2=function(...r){return r=r.map(reify$2),patternify2(Pattern$3.prototype._range2)(...r,this)};Pattern$3.prototype.bootstrap=function(){const r=Object.fromEntries(Object.entries(Pattern$3.prototype.composable).map(([t,e])=>(Pattern$3.prototype[t]&&(Pattern$3.prototype[t]=makeComposable(Pattern$3.prototype[t])),[t,curry(e,makeComposable)])));return this.patternified.forEach(t=>{Pattern$3.prototype[t]=function(...e){return this._patternify(Pattern$3.prototype["_"+t])(...e)}}),r};Pattern$3.prototype.define=(r,t,e={})=>{e.composable&&(Pattern$3.prototype.composable[r]=t),e.patternified&&(Pattern$3.prototype.patternified=Pattern$3.prototype.patternified.concat([r])),Pattern$3.prototype.bootstrap()};Pattern$3.prototype.define("hush",r=>r.hush(),{patternified:!1,composable:!0});Pattern$3.prototype.define("bypass",r=>r.bypass(on),{patternified:!0,composable:!0});const controls={},generic_params=[["s","s","sound"],["f","n","The note or sample number to choose for a synth or sampleset"],["f","note","The note or pitch to play a sound or synth with"],["f","accelerate","a pattern of numbers that speed up (or slow down) samples while they play."],["f","gain","a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@."],["f","amp","like @gain@, but linear."],["f","attack","a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample."],["f","bank","selects sound bank to use"],["f","decay",""],["f","sustain",""],["f","release","a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample."],["f","hold","a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified."],["f","bandf","A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter."],["f","bandq","a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter."],["f","begin","a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample."],["f","end","the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample."],["f","loop","loops the sample (from `begin` to `end`) the specified number of times."],["f","legato","controls the amount of overlap between two adjacent sounds"],["f","crush","bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction)."],["f","coarse","fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on."],["i","channel","choose the channel the pattern is sent to in superdirt"],["i","cut","In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open."],["f","cutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter."],["f","hcutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@"],["f","hresonance","a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@"],["f","resonance","a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter."],["f","djf","DJ filter, below 0.5 is low pass filter, above is high pass filter."],["f","delay","a pattern of numbers from 0 to 1. Sets the level of the delay signal."],["f","delayfeedback","a pattern of numbers from 0 to 1. Sets the amount of delay feedback."],["f","delaytime","a pattern of numbers from 0 to 1. Sets the length of the delay."],["f","lock","A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle."],["f","detune",""],["f","dry","when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb."],["f","fadeTime","Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope."],["f","fadeInTime","As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample."],["f","freq",""],["f","gate",""],["f","leslie",""],["f","lrate",""],["f","lsize",""],["f","degree",""],["f","mtranspose",""],["f","ctranspose",""],["f","harmonic",""],["f","stepsPerOctave",""],["f","octaveR",""],["f","nudge","Nudges events into the future by the specified number of seconds. Negative numbers work up to a point as well (due to internal latency)"],["i","octave",""],["f","offset",""],["i","orbit","a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around."],["f","overgain",""],["f","overshape",""],["f","pan","a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)"],["f","panspan","a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)"],["f","pansplay","a pattern of numbers between 0.0 and 1.0, which controls the multichannel spread range (multichannel only)"],["f","panwidth","a pattern of numbers between 0.0 and inf, which controls how much each channel is distributed over neighbours (multichannel only)"],["f","panorient","a pattern of numbers between -1.0 and 1.0, which controls the relative position of the centre pan in a pair of adjacent speakers (multichannel only)"],["f","rate","used in SuperDirt softsynths as a control rate or 'speed'"],["f","slide",""],["f","semitone",""],["f","velocity",""],["f","voice",""],["f","room","a pattern of numbers from 0 to 1. Sets the level of reverb."],["f","size","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","roomsize","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","shape","wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion."],["f","speed","a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!"],["s","unit",'used in conjunction with `speed`, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.'],["f","squiz",""],["f","stutterdepth",""],["f","stuttertime",""],["f","timescale",""],["f","timescalewin",""],["s","vowel","formant filter to make things sound like vowels, a pattern of either `a`, `e`, `i`, `o` or `u`. Use a rest (`~`) for no effect."],["f","waveloss",""],["f","dur",""],["f","expression",""],["f","sustainpedal",""],["f","tremolodepth","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","tremolorate","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","phaserdepth","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","phaserrate","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","fshift","frequency shifter"],["f","fshiftnote","frequency shifter"],["f","fshiftphase","frequency shifter"],["f","triode","tube distortion"],["f","krush","shape/bass enhancer"],["f","kcutoff",""],["f","octer","octaver effect"],["f","octersub","octaver effect"],["f","octersubsub","octaver effect"],["f","ring","ring modulation"],["f","ringf","ring modulation"],["f","ringdf","ring modulation"],["f","distort","noisy fuzzy distortion"],["f","freeze","Spectral freeze"],["f","xsdelay",""],["f","tsdelay",""],["f","real","Spectral conform"],["f","imag",""],["f","enhance","Spectral enhance"],["f","partials",""],["f","comb","Spectral comb"],["f","smear","Spectral smear"],["f","scram","Spectral scramble"],["f","binshift","Spectral binshift"],["f","hbrick","High pass sort of spectral filter"],["f","lbrick","Low pass sort of spectral filter"],["f","midichan",""],["f","control",""],["f","ccn",""],["f","ccv",""],["f","polyTouch",""],["f","midibend",""],["f","miditouch",""],["f","ctlNum",""],["f","frameRate",""],["f","frames",""],["f","hours",""],["s","midicmd",""],["f","minutes",""],["f","progNum",""],["f","seconds",""],["f","songPtr",""],["f","uid",""],["f","val",""],["f","cps",""],["f","clip",""]],_name=(r,...t)=>sequence$1(...t).withValue(e=>({[r]:e})),_setter=(r,t)=>function(...e){return e.length?this.set(r(...e)):this.fmap(o=>({[t]:o}))};generic_params.forEach(([r,t,e])=>{controls[t]=(...o)=>_name(t,...o),Pattern$3.prototype[t]=_setter(controls[t],t)});controls.createParam=r=>{const t=(...e)=>_name(r,...e);return Pattern$3.prototype[r]=_setter(t,r),(...e)=>_name(r,...e)};controls.createParams=(...r)=>r.reduce((t,e)=>Object.assign(t,{[e]:createParam(e)}),{});function bjorklund(r,t){for(var e=[],o=[],s=[t],i=r-t,l=0,f=function(g){if(g==-1)e.push(0);else if(g==-2)e.push(1);else{for(var w=0;w1;)o.push(Math.floor(i/s[l])),s.push(i%s[l]),i=s[l],l++;return o.push(i),f(l),e.reverse()}var bjork=function(r,t){return r>t?bjorklund(r,t):bjorklund(t,r)};const euclid=(r,t,e=0)=>{const o=bjork(t,r);return e?rotate(o,-e):o};Pattern$3.prototype.euclid=function(r,t,e=0){return this.struct(euclid(r,t,e))};Pattern$3.prototype.euclidLegato=function(r,t,e=0){const o=euclid(r,t,e),s=o.indexOf(1),i=rotate(o,s).join("").split("1").slice(1).map(l=>[l.length+1,!0]);return this.struct(timeCat$1(...i)).late(fraction(s).div(t))};function steady(r){return new Pattern$3(t=>[new Hap(void 0,t.span,r)])}const signal=r=>{const t=e=>[new Hap(void 0,e.span,r(e.span.midpoint()))];return new Pattern$3(t)},isaw=signal(r=>1-r%1),isaw2=isaw._toBipolar(),saw=signal(r=>r%1),saw2=saw._toBipolar(),sine2=signal(r=>Math.sin(Math.PI*2*r)),sine=sine2._fromBipolar(),cosine=sine._early(fraction(1).div(4)),cosine2=sine2._early(fraction(1).div(4)),square=signal(r=>Math.floor(r*2%2)),square2=square._toBipolar(),tri=fastcat(isaw,saw),tri2=fastcat(isaw2,saw2),time=signal(id),xorwise=r=>{const t=r<<13^r,e=t>>17^t;return e<<5^e},_frac=r=>r-Math.trunc(r),timeToIntSeed=r=>xorwise(Math.trunc(_frac(r/300)*536870912)),intSeedToRand=r=>r%536870912/536870912,timeToRand=r=>Math.abs(intSeedToRand(timeToIntSeed(r))),rand=signal(timeToRand),rand2=rand._toBipolar(),_brandBy=r=>rand.fmap(t=>treify$2(r).fmap(_brandBy).innerJoin(),brand=_brandBy(.5),_irand=r=>rand.fmap(t=>Math.trunc(t*r)),irand=r=>reify$2(r).fmap(_irand).innerJoin(),__chooseWith=(r,t)=>(t=t.map(reify$2),t.length==0?silence$1:r.range(0,t.length).fmap(e=>t[Math.floor(e)])),chooseWith=(r,t)=>__chooseWith(r,t).outerJoin(),chooseInWith=(r,t)=>__chooseWith(r,t).innerJoin(),choose=(...r)=>chooseWith(rand,r);Pattern$3.prototype.choose=function(...r){return chooseWith(this,r)};Pattern$3.prototype.choose2=function(...r){return chooseWith(this._fromBipolar(),r)};const chooseCycles=(...r)=>chooseInWith(rand.segment(1),r),randcat=chooseCycles,_wchooseWith=function(r,...t){const e=t.map(f=>reify$2(f[0])),o=[];let s=0;for(const f of t)s+=f[1],o.push(s);const i=s,l=function(f){const g=f*i;return e[o.findIndex(w=>w>g,o)]};return r.fmap(l)},wchooseWith=(...r)=>_wchooseWith(...r).outerJoin(),wchoose=(...r)=>wchooseWith(rand,...r),wchooseCycles=(...r)=>_wchooseWith(rand,...r).innerJoin(),perlinWith=r=>{const t=r.fmap(Math.floor),e=r.fmap(i=>Math.floor(i)+1),o=i=>6*i**5-15*i**4+10*i**3,s=i=>l=>f=>l+o(i)*(f-l);return r.sub(t).fmap(s).appBoth(t.fmap(timeToRand)).appBoth(e.fmap(timeToRand))},perlin=perlinWith(time.fmap(r=>Number(r)));Pattern$3.prototype._degradeByWith=function(r,t){return this.fmap(e=>o=>e).appLeft(r._filterValues(e=>e>t))};Pattern$3.prototype._degradeBy=function(r){return this._degradeByWith(rand,r)};Pattern$3.prototype.degrade=function(){return this._degradeBy(.5)};Pattern$3.prototype._undegradeBy=function(r){return this._degradeByWith(rand.fmap(t=>1-t),r)};Pattern$3.prototype.undegrade=function(){return this._undegradeBy(.5)};Pattern$3.prototype._sometimesBy=function(r,t){return stack$1(this._degradeBy(r),t(this._undegradeBy(1-r)))};Pattern$3.prototype.sometimesBy=function(r,t){const e=this;return reify$2(r).fmap(o=>e._sometimesBy(o,t)).innerJoin()};Pattern$3.prototype._sometimesByPre=function(r,t){return stack$1(this._degradeBy(r),t(this).undegradeBy(1-r))};Pattern$3.prototype.sometimesByPre=function(r,t){const e=this;return reify$2(r).fmap(o=>e._sometimesByPre(o,t)).innerJoin()};Pattern$3.prototype.sometimes=function(r){return this._sometimesBy(.5,r)};Pattern$3.prototype.sometimesPre=function(r){return this._sometimesByPre(.5,r)};Pattern$3.prototype._someCyclesBy=function(r,t){return stack$1(this._degradeByWith(rand._segment(1),r),t(this._degradeByWith(rand.fmap(e=>1-e)._segment(1),1-r)))};Pattern$3.prototype.someCyclesBy=function(r,t){const e=this;return reify$2(r).fmap(o=>e._someCyclesBy(o,t)).innerJoin()};Pattern$3.prototype.someCycles=function(r){return this._someCyclesBy(.5,r)};Pattern$3.prototype.often=function(r){return this.sometimesBy(.75,r)};Pattern$3.prototype.rarely=function(r){return this.sometimesBy(.25,r)};Pattern$3.prototype.almostNever=function(r){return this.sometimesBy(.1,r)};Pattern$3.prototype.almostAlways=function(r){return this.sometimesBy(.9,r)};Pattern$3.prototype.never=function(r){return this};Pattern$3.prototype.always=function(r){return r(this)};Pattern$3.prototype.patternified.push("degradeBy","undegradeBy");let synth;try{synth=window==null?void 0:window.speechSynthesis}catch{console.warn("cannot use window: not in browser?")}let allVoices=synth==null?void 0:synth.getVoices();function speak(r,t,e){synth.cancel();const o=new SpeechSynthesisUtterance(r);o.lang=t,allVoices=synth.getVoices();const s=allVoices.filter(i=>i.lang.includes(t));typeof e=="number"?o.voice=s[e%s.length]:typeof e=="string"&&(o.voice=s.find(i=>i.name===i)),speechSynthesis.speak(o)}Pattern$3.prototype._speak=function(r,t){return this._withHap(e=>{const o=(s,i)=>{speak(i.value,r,t)};return e.setContext({...e.context,onTrigger:o})})};Pattern$3.prototype.speak=function(r,t){return patternify2(Pattern$3.prototype._speak)(reify(r),reify(t),this)};const{isPattern,Pattern:Pattern$2}=strudel;let scoped=!1;const evalScope=async(...r)=>{scoped&&console.warn("evalScope was called more than once."),scoped=!0;const t=await Promise.allSettled(r),e=t.filter(o=>o.status==="fulfilled").map(o=>o.value);t.forEach((o,s)=>{o.status==="rejected"&&console.warn(`evalScope: module with index ${s} could not be loaded:`,o.reason)}),Object.assign(globalThis,...e,Pattern$2.prototype.bootstrap())};function safeEval(r,t={}){const{wrapExpression:e=!0,wrapAsync:o=!0}=t;e&&(r=`{${r}}`),o&&(r=`(async ()=>${r})()`);const s=`"use strict";return (${r})`;return Function(s)()}const evaluate$1=async(r,t)=>{scoped||await evalScope(),t&&(r=t(r));let o=await safeEval(r,{wrapExpression:!!t});if(!isPattern(o)){console.log("evaluated",o);const s=`got "${typeof o}" instead of pattern`;throw new Error(s+(typeof o=="function"?", did you forget to call a function?":"."))}return{mode:"javascript",pattern:o}};function createClock(r,t,e=.05,o=.1,s=.1){let i=0,l=0,f=10**4,g=.01;const w=b=>e=b(e);s=s||o/2;const y=()=>{const b=r(),I=b+o+s;for(l===0&&(l=b+g);l=b&&t(l,e,i),l{y(),$=setInterval(y,o*1e3)},C=()=>clearInterval($);return{setDuration:w,start:S,stop:()=>{i=0,l=0,C()},pause:()=>C(),duration:e,getPhase:()=>l}}class Cyclist{constructor({interval:t,onTrigger:e,onError:o,getTime:s,latency:i=.1}){K(this,"worker");K(this,"pattern");K(this,"started",!1);K(this,"cps",1);K(this,"getTime");K(this,"phase",0);this.getTime=s;const l=f=>Math.round(f*1e3)/1e3;this.clock=createClock(s,(f,g,w)=>{w===0&&(this.origin=f);const y=l(f-this.origin);this.phase=y-i;const $=l(y+g),S=s();try{this.pattern.queryArc(y,$).forEach(p=>{if(p.part.begin.equals(p.whole.begin)){const d=p.whole.begin+this.origin-S+i,m=p.duration*1;e==null||e(p,d,m)}})}catch(C){console.warn("scheduler error",C),o==null||o(C)}},t)}getPhase(){return this.phase}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.clock.start(),this.started=!0}pause(){this.clock.stop(),delete this.origin,this.started=!1}stop(){delete this.origin,this.clock.stop(),this.started=!1}setPattern(t,e=!1){this.pattern=t,e&&!this.started&&this.start()}setCps(t=1){this.cps=t}log(t,e,o){const s=o.filter(i=>i.hasOnset());console.log(`${t.toFixed(4)} - ${e.toFixed(4)} ${Array(s.length).fill("I").join("")}`)}}function repl({interval:r,defaultOutput:t,onSchedulerError:e,onEvalError:o,onEval:s,getTime:i,transpiler:l}){const f=new Cyclist({interval:r,onTrigger:t,onError:e,getTime:i});return{scheduler:f,evaluate:async w=>{if(!w)throw new Error("no code to evaluate");try{const{pattern:y}=await evaluate$1(w,l);f.setPattern(y,!0),s==null||s({pattern:y,code:w})}catch(y){console.warn(`eval error: ${y.message}`),o==null||o(y)}}}}const gist=(route,cache=!0)=>fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache?"":Date.now()}`).then(r=>r.text()).then(code=>eval(code));console.log("%c // \u{1F300} @strudel.cycles/core loaded \u{1F300}","background-color: black;color:white;padding:4px;border-radius:15px");globalThis._strudelLoaded&&console.warn(`@strudel.cycles/core was loaded more than once... +This might happen when you have multiple versions of strudel installed. +Please check with "npm ls @strudel.cycles/core".`);globalThis._strudelLoaded=!0;function peg$subclass(r,t){function e(){this.constructor=r}e.prototype=t.prototype,r.prototype=new e}function peg$SyntaxError(r,t,e,o){var s=Error.call(this,r);return Object.setPrototypeOf&&Object.setPrototypeOf(s,peg$SyntaxError.prototype),s.expected=t,s.found=e,s.location=o,s.name="SyntaxError",s}peg$subclass(peg$SyntaxError,Error);function peg$padEnd(r,t,e){return e=e||" ",r.length>t?r:(t-=r.length,e+=e.repeat(t),r+e.slice(0,t))}peg$SyntaxError.prototype.format=function(r){var t="Error: "+this.message;if(this.location){var e=null,o;for(o=0;o `+i+` +`+f+` | +`+s.line+" | "+g+` +`+f+" | "+peg$padEnd("",s.column-1," ")+peg$padEnd("",y,"^")}else t+=` + at `+i}return t};peg$SyntaxError.buildMessage=function(r,t){var e={literal:function(w){return'"'+s(w.text)+'"'},class:function(w){var y=w.parts.map(function($){return Array.isArray($)?i($[0])+"-"+i($[1]):i($)});return"["+(w.inverted?"^":"")+y.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(w){return w.description}};function o(w){return w.charCodeAt(0).toString(16).toUpperCase()}function s(w){return w.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(y){return"\\x0"+o(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+o(y)})}function i(w){return w.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(y){return"\\x0"+o(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+o(y)})}function l(w){return e[w.type](w)}function f(w){var y=w.map(l),$,S;if(y.sort(),y.length>0){for($=1,S=1;$",E="@",W="!",P="(",B=")",z="/",O="*",Z="%",L="?",le="struct",we="target",be="euclid",te="slow",fe="rotL",pe="rotR",he="fast",ve="scale",de="//",$e="cat",F="$",Q="setcps",ge="setbpm",me="hush",M=/^[1-9]/,U=/^[eE]/,ye=/^[0-9]/,J=/^[ \n\r\t]/,ee=/^[0-9a-zA-Z~]/,R=/^[^\n]/,X=He("number"),re=N(".",!1),Pe=ne([["1","9"]],!1,!1),Be=ne(["e","E"],!1,!1),Te=N("-",!1),Ze=N("+",!1),Le=N("0",!1),Je=ne([["0","9"]],!1,!1),Ke=He("whitespace"),Ge=ne([" ",` +`,"\r"," "],!1,!1),Ye=N(",",!1),Qe=N("|",!1),Ue=N('"',!1),et=N("'",!1),tt=ne([["0","9"],["a","z"],["A","Z"],"~"],!1,!1),rt=N("#",!1),nt=N("^",!1),st=N("_",!1),ot=N(":",!1),Re=N("[",!1),je=N("]",!1),it=N("<",!1),at=N(">",!1),ct=N("@",!1),ut=N("!",!1),lt=N("(",!1),ft=N(")",!1),pt=N("/",!1),ht=N("*",!1),dt=N("%",!1),gt=N("?",!1),mt=N("struct",!1),yt=N("target",!1),wt=N("euclid",!1),bt=N("slow",!1),vt=N("rotL",!1),$t=N("rotR",!1),_t=N("fast",!1),Ct=N("scale",!1),At=N("//",!1),Fe=ne([` +`],!0,!1),It=N("cat",!1),Pt=N("$",!1),Bt=N("setcps",!1),St=N("setbpm",!1),xt=N("hush",!1),kt=function(){return parseFloat(ur())},Nt=function(n){return n.join("")},qt=function(n){return n},Tt=function(n){return n.arguments_.alignment="t",n},Gt=function(n){return{weight:n}},Rt=function(n){return{replicate:n}},jt=function(n,c,u){return{operator:{type_:"bjorklund",arguments_:{pulse:n,step:c,rotation:u||0}}}},Ft=function(n){return{operator:{type_:"stretch",arguments_:{amount:n}}}},Mt=function(n){return{operator:{type_:"stretch",arguments_:{amount:"1/"+n}}}},Ht=function(n){return{operator:{type_:"fixed-step",arguments_:{amount:n}}}},Ot=function(n){return{operator:{type_:"degradeBy",arguments_:{amount:n||.5}}}},Wt=function(n,c){return new en(n,c)},Vt=function(n){return new Ne(n,"h")},zt=function(n){return{alignment:"v",list:n}},Xt=function(n){return{alignment:"r",list:n}},Dt=function(n,c){return c&&c.list.length>0?new Ne([n,...c.list],c.alignment):n},Et=function(n){return n},Zt=function(n){return{name:"struct",args:{sequence:n}}},Lt=function(n){return{name:"target",args:{name:n}}},Jt=function(n,c,u){return{name:"bjorklund",args:{pulse:parseInt(n),step:parseInt(c)}}},Kt=function(n){return{name:"stretch",args:{amount:n}}},Yt=function(n){return{name:"shift",args:{amount:"-"+n}}},Qt=function(n){return{name:"shift",args:{amount:n}}},Ut=function(n){return{name:"stretch",args:{amount:"1/"+n}}},er=function(n){return{name:"scale",args:{scale:n.join("")}}},Me=function(n,c){return c},tr=function(n,c){return c.unshift(n),new Ne(c,"t")},rr=function(n){return n},nr=function(n,c){return new Ur(n.name,n.args,c)},sr=function(n){return n},or=function(n){return n},ir=function(n){return new qe("setcps",{value:n})},ar=function(n){return new qe("setcps",{value:n/120/2})},cr=function(){return new qe("hush")},a=0,q=0,_e=[{line:1,column:1}],D=0,Se=[],_=0,Ce;if("startRule"in t){if(!(t.startRule in s))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');i=s[t.startRule]}function ur(){return r.substring(q,a)}function lr(){return xe(q,a)}function N(n,c){return{type:"literal",text:n,ignoreCase:c}}function ne(n,c,u){return{type:"class",parts:n,inverted:c,ignoreCase:u}}function fr(){return{type:"end"}}function He(n){return{type:"other",description:n}}function Oe(n){var c=_e[n],u;if(c)return c;for(u=n-1;!_e[u];)u--;for(c=_e[u],c={line:c.line,column:c.column};uD&&(D=a,Se=[]),Se.push(n))}function hr(n,c,u){return new peg$SyntaxError(peg$SyntaxError.buildMessage(n,c),n,c,u)}function We(){var n;return n=Qr(),n}function H(){var n,c;return _++,n=a,Ve(),c=Ae(),c!==e?(wr(),yr(),q=n,n=kt()):(a=n,n=e),_--,n===e&&_===0&&A(X),n}function dr(){var n;return r.charCodeAt(a)===46?(n=l,a++):(n=e,_===0&&A(re)),n}function gr(){var n;return M.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(Pe)),n}function mr(){var n;return U.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(Be)),n}function yr(){var n,c,u,v,x;if(n=a,c=mr(),c!==e){if(u=Ve(),u===e&&(u=br()),u===e&&(u=null),v=[],x=se(),x!==e)for(;x!==e;)v.push(x),x=se();else v=e;v!==e?(c=[c,u,v],n=c):(a=n,n=e)}else a=n,n=e;return n}function wr(){var n,c,u,v;if(n=a,c=dr(),c!==e){if(u=[],v=se(),v!==e)for(;v!==e;)u.push(v),v=se();else u=e;u!==e?(c=[c,u],n=c):(a=n,n=e)}else a=n,n=e;return n}function Ae(){var n,c,u,v;if(n=vr(),n===e)if(n=a,c=gr(),c!==e){for(u=[],v=se();v!==e;)u.push(v),v=se();c=[c,u],n=c}else a=n,n=e;return n}function Ve(){var n;return r.charCodeAt(a)===45?(n=f,a++):(n=e,_===0&&A(Te)),n}function br(){var n;return r.charCodeAt(a)===43?(n=g,a++):(n=e,_===0&&A(Ze)),n}function vr(){var n;return r.charCodeAt(a)===48?(n=w,a++):(n=e,_===0&&A(Le)),n}function se(){var n;return ye.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(Je)),n}function k(){var n,c;for(_++,n=[],J.test(r.charAt(a))?(c=r.charAt(a),a++):(c=e,_===0&&A(Ge));c!==e;)n.push(c),J.test(r.charAt(a))?(c=r.charAt(a),a++):(c=e,_===0&&A(Ge));return _--,c=e,_===0&&A(Ke),n}function oe(){var n,c,u,v;return n=a,c=k(),r.charCodeAt(a)===44?(u=y,a++):(u=e,_===0&&A(Ye)),u!==e?(v=k(),c=[c,u,v],n=c):(a=n,n=e),n}function ze(){var n,c,u,v;return n=a,c=k(),r.charCodeAt(a)===124?(u=$,a++):(u=e,_===0&&A(Qe)),u!==e?(v=k(),c=[c,u,v],n=c):(a=n,n=e),n}function ie(){var n;return r.charCodeAt(a)===34?(n=S,a++):(n=e,_===0&&A(Ue)),n===e&&(r.charCodeAt(a)===39?(n=C,a++):(n=e,_===0&&A(et))),n}function Ie(){var n;return ee.test(r.charAt(a))?(n=r.charAt(a),a++):(n=e,_===0&&A(tt)),n===e&&(r.charCodeAt(a)===45?(n=f,a++):(n=e,_===0&&A(Te)),n===e&&(r.charCodeAt(a)===35?(n=p,a++):(n=e,_===0&&A(rt)),n===e&&(r.charCodeAt(a)===46?(n=l,a++):(n=e,_===0&&A(re)),n===e&&(r.charCodeAt(a)===94?(n=d,a++):(n=e,_===0&&A(nt)),n===e&&(r.charCodeAt(a)===95?(n=m,a++):(n=e,_===0&&A(st)),n===e&&(r.charCodeAt(a)===58?(n=b,a++):(n=e,_===0&&A(ot)))))))),n}function Xe(){var n,c,u;if(n=a,k(),c=[],u=Ie(),u!==e)for(;u!==e;)c.push(u),u=Ie();else c=e;return c!==e?(u=k(),q=n,n=Nt(c)):(a=n,n=e),n}function $r(){var n,c,u,v;return n=a,k(),r.charCodeAt(a)===91?(c=I,a++):(c=e,_===0&&A(Re)),c!==e?(k(),u=Ee(),u!==e?(k(),r.charCodeAt(a)===93?(v=T,a++):(v=e,_===0&&A(je)),v!==e?(k(),q=n,n=qt(u)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function _r(){var n,c,u,v;return n=a,k(),r.charCodeAt(a)===60?(c=G,a++):(c=e,_===0&&A(it)),c!==e?(k(),u=ae(),u!==e?(k(),r.charCodeAt(a)===62?(v=Y,a++):(v=e,_===0&&A(at)),v!==e?(k(),q=n,n=Tt(u)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Cr(){var n;return n=Xe(),n===e&&(n=$r(),n===e&&(n=_r())),n}function Ar(){var n;return n=Ir(),n===e&&(n=Br(),n===e&&(n=Sr(),n===e&&(n=xr(),n===e&&(n=kr(),n===e&&(n=Pr(),n===e&&(n=Nr())))))),n}function Ir(){var n,c,u;return n=a,r.charCodeAt(a)===64?(c=E,a++):(c=e,_===0&&A(ct)),c!==e?(u=H(),u!==e?(q=n,n=Gt(u)):(a=n,n=e)):(a=n,n=e),n}function Pr(){var n,c,u;return n=a,r.charCodeAt(a)===33?(c=W,a++):(c=e,_===0&&A(ut)),c!==e?(u=H(),u!==e?(q=n,n=Rt(u)):(a=n,n=e)):(a=n,n=e),n}function Br(){var n,c,u,v,x,j,V;return n=a,r.charCodeAt(a)===40?(c=P,a++):(c=e,_===0&&A(lt)),c!==e?(k(),u=H(),u!==e?(k(),v=oe(),v!==e?(k(),x=H(),x!==e?(k(),oe(),k(),j=H(),j===e&&(j=null),k(),r.charCodeAt(a)===41?(V=B,a++):(V=e,_===0&&A(ft)),V!==e?(q=n,n=jt(u,x,j)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Sr(){var n,c,u;return n=a,r.charCodeAt(a)===47?(c=z,a++):(c=e,_===0&&A(pt)),c!==e?(u=H(),u!==e?(q=n,n=Ft(u)):(a=n,n=e)):(a=n,n=e),n}function xr(){var n,c,u;return n=a,r.charCodeAt(a)===42?(c=O,a++):(c=e,_===0&&A(ht)),c!==e?(u=H(),u!==e?(q=n,n=Mt(u)):(a=n,n=e)):(a=n,n=e),n}function kr(){var n,c,u;return n=a,r.charCodeAt(a)===37?(c=Z,a++):(c=e,_===0&&A(dt)),c!==e?(u=H(),u!==e?(q=n,n=Ht(u)):(a=n,n=e)):(a=n,n=e),n}function Nr(){var n,c,u;return n=a,r.charCodeAt(a)===63?(c=L,a++):(c=e,_===0&&A(gt)),c!==e?(u=H(),u===e&&(u=null),q=n,n=Ot(u)):(a=n,n=e),n}function De(){var n,c,u;return n=a,c=Cr(),c!==e?(u=Ar(),u===e&&(u=null),q=n,n=Wt(c,u)):(a=n,n=e),n}function ae(){var n,c,u;if(n=a,c=[],u=De(),u!==e)for(;u!==e;)c.push(u),u=De();else c=e;return c!==e&&(q=n,c=Vt(c)),n=c,n}function qr(){var n,c,u,v,x;if(n=a,c=[],u=a,v=oe(),v!==e?(x=ae(),x!==e?u=x:(a=u,u=e)):(a=u,u=e),u!==e)for(;u!==e;)c.push(u),u=a,v=oe(),v!==e?(x=ae(),x!==e?u=x:(a=u,u=e)):(a=u,u=e);else c=e;return c!==e&&(q=n,c=zt(c)),n=c,n}function Tr(){var n,c,u,v,x;if(n=a,c=[],u=a,v=ze(),v!==e?(x=ae(),x!==e?u=x:(a=u,u=e)):(a=u,u=e),u!==e)for(;u!==e;)c.push(u),u=a,v=ze(),v!==e?(x=ae(),x!==e?u=x:(a=u,u=e)):(a=u,u=e);else c=e;return c!==e&&(q=n,c=Xt(c)),n=c,n}function Ee(){var n,c,u;return n=a,c=ae(),c!==e?(u=qr(),u===e&&(u=Tr()),u===e&&(u=null),q=n,n=Dt(c,u)):(a=n,n=e),n}function Gr(){var n,c,u,v;return n=a,k(),c=ie(),c!==e?(u=Ee(),u!==e?(v=ie(),v!==e?(q=n,n=Et(u)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Rr(){var n;return n=zr(),n===e&&(n=Hr(),n===e&&(n=Vr(),n===e&&(n=Fr(),n===e&&(n=Mr(),n===e&&(n=jr(),n===e&&(n=Wr(),n===e&&(n=Or()))))))),n}function jr(){var n,c,u;return n=a,r.substr(a,6)===le?(c=le,a+=6):(c=e,_===0&&A(mt)),c!==e?(k(),u=ce(),u!==e?(q=n,n=Zt(u)):(a=n,n=e)):(a=n,n=e),n}function Fr(){var n,c,u,v,x;return n=a,r.substr(a,6)===we?(c=we,a+=6):(c=e,_===0&&A(yt)),c!==e?(k(),u=ie(),u!==e?(v=Xe(),v!==e?(x=ie(),x!==e?(q=n,n=Lt(v)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Mr(){var n,c,u,v;return n=a,r.substr(a,6)===be?(c=be,a+=6):(c=e,_===0&&A(wt)),c!==e?(k(),u=Ae(),u!==e?(k(),v=Ae(),v!==e?(k(),Ae(),q=n,n=Jt(u,v)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e),n}function Hr(){var n,c,u;return n=a,r.substr(a,4)===te?(c=te,a+=4):(c=e,_===0&&A(bt)),c!==e?(k(),u=H(),u!==e?(q=n,n=Kt(u)):(a=n,n=e)):(a=n,n=e),n}function Or(){var n,c,u;return n=a,r.substr(a,4)===fe?(c=fe,a+=4):(c=e,_===0&&A(vt)),c!==e?(k(),u=H(),u!==e?(q=n,n=Yt(u)):(a=n,n=e)):(a=n,n=e),n}function Wr(){var n,c,u;return n=a,r.substr(a,4)===pe?(c=pe,a+=4):(c=e,_===0&&A($t)),c!==e?(k(),u=H(),u!==e?(q=n,n=Qt(u)):(a=n,n=e)):(a=n,n=e),n}function Vr(){var n,c,u;return n=a,r.substr(a,4)===he?(c=he,a+=4):(c=e,_===0&&A(_t)),c!==e?(k(),u=H(),u!==e?(q=n,n=Ut(u)):(a=n,n=e)):(a=n,n=e),n}function zr(){var n,c,u,v,x;if(n=a,r.substr(a,5)===ve?(c=ve,a+=5):(c=e,_===0&&A(Ct)),c!==e)if(k(),u=ie(),u!==e){if(v=[],x=Ie(),x!==e)for(;x!==e;)v.push(x),x=Ie();else v=e;v!==e?(x=ie(),x!==e?(q=n,n=er(v)):(a=n,n=e)):(a=n,n=e)}else a=n,n=e;else a=n,n=e;return n}function ke(){var n,c,u,v;if(n=a,r.substr(a,2)===de?(c=de,a+=2):(c=e,_===0&&A(At)),c!==e){for(u=[],R.test(r.charAt(a))?(v=r.charAt(a),a++):(v=e,_===0&&A(Fe));v!==e;)u.push(v),R.test(r.charAt(a))?(v=r.charAt(a),a++):(v=e,_===0&&A(Fe));c=[c,u],n=c}else a=n,n=e;return n}function Xr(){var n,c,u,v,x,j,V,ue;if(n=a,r.substr(a,3)===$e?(c=$e,a+=3):(c=e,_===0&&A(It)),c!==e)if(k(),r.charCodeAt(a)===91?(u=I,a++):(u=e,_===0&&A(Re)),u!==e)if(k(),v=ce(),v!==e){for(x=[],j=a,V=oe(),V!==e?(ue=ce(),ue!==e?(q=j,j=Me(v,ue)):(a=j,j=e)):(a=j,j=e);j!==e;)x.push(j),j=a,V=oe(),V!==e?(ue=ce(),ue!==e?(q=j,j=Me(v,ue)):(a=j,j=e)):(a=j,j=e);j=k(),r.charCodeAt(a)===93?(V=T,a++):(V=e,_===0&&A(je)),V!==e?(q=n,n=tr(v,x)):(a=n,n=e)}else a=n,n=e;else a=n,n=e;else a=n,n=e;return n}function Dr(){var n;return n=Xr(),n===e&&(n=Gr()),n}function ce(){var n,c,u,v,x;if(n=a,c=Dr(),c!==e){for(k(),u=[],v=ke();v!==e;)u.push(v),v=ke();q=n,n=rr(c)}else a=n,n=e;return n===e&&(n=a,c=Rr(),c!==e?(k(),r.charCodeAt(a)===36?(u=F,a++):(u=e,_===0&&A(Pt)),u!==e?(v=k(),x=ce(),x!==e?(q=n,n=nr(c,x)):(a=n,n=e)):(a=n,n=e)):(a=n,n=e)),n}function Er(){var n,c;return n=a,c=ce(),c!==e&&(q=n,c=sr(c)),n=c,n===e&&(n=ke()),n}function Zr(){var n;return n=Er(),n}function Lr(){var n,c;return n=a,k(),c=Jr(),c===e&&(c=Kr(),c===e&&(c=Yr())),c!==e?(k(),q=n,n=or(c)):(a=n,n=e),n}function Jr(){var n,c,u;return n=a,r.substr(a,6)===Q?(c=Q,a+=6):(c=e,_===0&&A(Bt)),c!==e?(k(),u=H(),u!==e?(q=n,n=ir(u)):(a=n,n=e)):(a=n,n=e),n}function Kr(){var n,c,u;return n=a,r.substr(a,6)===ge?(c=ge,a+=6):(c=e,_===0&&A(St)),c!==e?(k(),u=H(),u!==e?(q=n,n=ar(u)):(a=n,n=e)):(a=n,n=e),n}function Yr(){var n,c;return n=a,r.substr(a,4)===me?(c=me,a+=4):(c=e,_===0&&A(xt)),c!==e&&(q=n,c=cr()),n=c,n}function Qr(){var n;return n=Zr(),n===e&&(n=Lr()),n}var Ne=function(n,c){this.type_="pattern",this.arguments_={alignment:c},this.source_=n},Ur=function(n,c,u){this.type_=n,this.arguments_=c,this.source_=u},en=function(n,c){this.type_="element",this.source_=n,this.options_=c,this.location_=lr()},qe=function(n,c){this.type_="command",this.name_=n,this.options_=c};if(Ce=i(),Ce!==e&&a===r.length)return Ce;throw Ce!==e&&a(t,e)=>{const s=r.source_[e].options_,i=s==null?void 0:s.operator;if(i){switch(i.type_){case"stretch":const f=Fraction(i.arguments_.amount).inverse();return reify$1(t).fast(f);case"bjorklund":return t.euclid(i.arguments_.pulse,i.arguments_.step,i.arguments_.rotation);case"degradeBy":return reify$1(t)._degradeByWith(rand.early(randOffset*_nextSeed()).segment(1),i.arguments_.amount)}console.warn(`operator "${i.type_}" not implemented`)}if(s!=null&&s.weight)return t;const l=Object.keys(s||{}).filter(f=>f!=="operator");return l.length&&console.warn(`option${l.length>1?"s":""} ${l.map(f=>`"${f}"`).join(", ")} not implemented`),t};function resolveReplications(r){r.source_=r.source_.map(t=>{const{replicate:e,...o}=t.options_||{};return e?{...t,options_:{...o,weight:e},source_:{type_:"pattern",arguments_:{alignment:"h"},source_:[{type_:"element",source_:t.source_,location_:t.location_,options_:{operator:{type_:"stretch",arguments_:{amount:Fraction(e).inverse().toString()}}}}]}}:t})}function patternifyAST(r){switch(r.type_){case"pattern":resolveReplications(r);const t=r.source_.map(patternifyAST).map(applyOptions(r)),e=r.arguments_.alignment;if(e==="v")return stack(...t);if(e==="r")return chooseInWith(rand.early(randOffset*_nextSeed()).segment(1),t);const o=r.source_.some(s=>{var i;return!!((i=s.options_)!=null&&i.weight)});if(!o&&e==="t")return slowcat(...t);if(o){const s=timeCat(...r.source_.map((i,l)=>{var f;return[((f=i.options_)==null?void 0:f.weight)||1,t[l]]}));if(e==="t"){const i=r.source_.reduce((l,f)=>{var g;return l+(((g=f.options_)==null?void 0:g.weight)||1)},0);return s._slow(i)}return s}return sequence(...t);case"element":if(r.source_==="~")return silence;if(typeof r.source_!="object"){if(!r.location_)return console.warn("no location for",r),r.source_;const{start:s,end:i}=r.location_,l=isNaN(Number(r.source_))?r.source_:Number(r.source_);return pure(l).withLocation([s.line,s.column,s.offset],[i.line,i.column,i.offset])}return patternifyAST(r.source_);case"stretch":return patternifyAST(r.source_).slow(r.arguments_.amount);default:return console.warn(`node type "${r.type_}" not implemented -> returning silence`),silence}}const mini=(...r)=>{const t=r.map(e=>{const o=peg$parse(`"${e}"`);return patternifyAST(o)});return sequence(...t)},h=r=>{const t=peg$parse(r);return patternifyAST(t)};Pattern$1.prototype.define("mini",mini,{composable:!0});Pattern$1.prototype.define("m",mini,{composable:!0});Pattern$1.prototype.define("h",h,{composable:!0});function minify(r){return typeof r=="string"?mini(r):reify$1(r)}if(typeof DelayNode<"u"){class r extends DelayNode{constructor(e,o,s,i){super(e),o=Math.abs(o),this.delayTime.value=s;const l=e.createGain();l.gain.value=Math.min(Math.abs(i),.995),this.feedback=l.gain;const f=e.createGain();return f.gain.value=o,this.delayGain=f,this.connect(l),this.connect(f),l.connect(this),this.connect=g=>f.connect(g),this}start(e){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,e+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(t,e,o){return new r(this,t,e,o)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(r,t=1){const e=this.sampleRate*r,o=this.createBuffer(t,e,this.sampleRate),s=o.getChannelData(0);for(let i=0;i(t.buffer=this.impulseResponse(e),t.duration=r,t),t.setDuration(r),t});const bufferCache={},loadCache={},getCachedBuffer=r=>bufferCache[r],loadBuffer=(r,t)=>(loadCache[r]||(loadCache[r]=fetch(r).then(e=>e.arrayBuffer()).then(async e=>{const o=await t.decodeAudioData(e);return bufferCache[r]=o,o})),loadCache[r]);function reverseBuffer(r){const t=getAudioContext(),e=t.createBuffer(r.numberOfChannels,r.length,t.sampleRate);for(let o=0;obufferCache[r],githubCache={};let sampleCache={current:void 0};const loadGithubSamples=async(r,t)=>{const e="loadGithubSamples "+r,o=localStorage.getItem(e);if(o&&(console.log("[sampler]: loaded sample list from localstorage",r),githubCache[r]=JSON.parse(o)),githubCache[r])return sampleCache.current=githubCache[r],githubCache[r];console.log("[sampler]: fetching sample list from github",r);try{const[s,i,...l]=r.split("/"),f=`https://api.github.com/repos/${s}/${i}/contents`,g=await fetch(`${f}/${l.join("/")}`).then(w=>w.json());githubCache[r]=(await Promise.all(g.map(async({name:w,path:y})=>({name:w,content:await fetch(`${f}/${y}`).then($=>$.json()).catch($=>{console.error("could not load path",$)})})))).filter(({content:w})=>!!w).reduce((w,{name:y,content:$})=>({...w,[(t==null?void 0:t(y))||y]:$.map(({download_url:S})=>S)}),{})}catch(s){console.error("[sampler]: failed to fetch sample list from github",s);return}return sampleCache.current=githubCache[r],localStorage.setItem(e,JSON.stringify(sampleCache.current)),console.log("[sampler]: loaded samples:",sampleCache.current),githubCache[r]},samples=async(r,t=r._base||"")=>{if(typeof r=="string"){if(r.startsWith("github:")){const[o,s]=r.split("github:");r=`https://raw.githubusercontent.com/${s}/strudel.json`}if(typeof fetch!="function")return;const e=r.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(r).then(o=>o.json()).then(o=>samples(o,t||o._base||e)).catch(o=>{throw console.error(o),new Error(`error loading "${r}"`)})}sampleCache.current={...sampleCache.current,...Object.fromEntries(Object.entries(r).map(([e,o])=>{if(typeof o=="string"&&(o=[o]),typeof o!="object")throw new Error("wrong sample map format for "+e);t=o._base||t;const s=i=>(t+i).replace("github:","https://raw.githubusercontent.com/");return Array.isArray(o)?[e,o.map(s)]:[e,Object.fromEntries(Object.entries(o).map(([i,l])=>[i,(typeof l=="string"?[l]:l).map(s)]))]}))}},resetLoadedSamples=()=>{sampleCache.current=void 0},getLoadedSamples$1=()=>sampleCache.current;var vowelFormant={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class r extends GainNode{constructor(e,o){if(super(e),!vowelFormant[o])throw new Error("vowel: unknown vowel "+o);const{gains:s,qs:i,freqs:l}=vowelFormant[o],f=e.createGain();for(let g=0;g<5;g++){const w=e.createGain();w.gain.value=s[g];const y=e.createBiquadFilter();y.type="bandpass",y.Q.value=i[g],y.frequency.value=l[g],this.connect(y),y.connect(w),w.connect(f)}return f.gain.value=8,this.connect=g=>f.connect(g),this}}AudioContext.prototype.createVowelFilter=function(t){return new r(this,t)}}const workletsUrl="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK",{Pattern}=strudel;let audioContext;const getAudioContext$1=()=>(audioContext||(audioContext=new AudioContext),audioContext);let destination;const getDestination=()=>{const r=getAudioContext$1();return destination||(destination=r.createGain(),destination.connect(r.destination)),destination},panic=()=>{getDestination().gain.linearRampToValueAtTime(0,getAudioContext$1().currentTime+.01),destination=null},getFilter=(r,t,e)=>{const o=getAudioContext$1().createBiquadFilter();return o.type=r,o.frequency.value=t,o.Q.value=e,o},getADSR=(r,t,e,o,s,i,l)=>{const f=getAudioContext$1().createGain();return f.gain.setValueAtTime(0,i),f.gain.linearRampToValueAtTime(s,i+r),f.gain.linearRampToValueAtTime(e*s,i+r+t),f.gain.setValueAtTime(e*s,l),f.gain.linearRampToValueAtTime(0,l+o),f},getOscillator=({s:r,freq:t,t:e,duration:o,release:s})=>{const i=getAudioContext$1().createOscillator();return i.type=r||"triangle",i.frequency.value=Number(t),i.start(e),i.stop(e+o+s),i},getSoundfontKey=r=>{var o,s,i,l;if(!globalThis.soundfontList)return!1;if((s=(o=globalThis.soundfontList)==null?void 0:o.instruments)!=null&&s.includes(r))return r;const t=(l=(i=globalThis.soundfontList)==null?void 0:i.instrumentNames)==null?void 0:l.indexOf(r),e=t<10?`00${t}`:t<100?`0${t}`:t;if(t!==-1)return globalThis.soundfontList.instruments.find(f=>f.startsWith(e))},getSampleBufferSource=async(r,t,e,o)=>{let s=0,i=typeof e=="string"?toMidi(e):e||36;s=i-36;const l=getAudioContext$1(),f=getLoadedSamples();if(!f)throw new Error("no samples loaded");const g=f==null?void 0:f[r];if(!g)throw new Error(`sample not found: "${r}", try one of ${Object.keys(f).map(C=>`"${C}"`).join(", ")}.`);if(typeof g!="object")throw new Error("wrong format for sample bank:",r);let w;if(Array.isArray(g))w=g[t%g.length];else{const C=d=>toMidi(d)-i,p=Object.keys(g).filter(d=>!d.startsWith("_")).reduce((d,m,b)=>!d||Math.abs(C(m)){if(!r.includes(":"))return[r,t];let[e,o]=r.split(":");return isNaN(Number(o))?[r,t]:[e,o]};let workletsLoading;function loadWorklets(){return workletsLoading||(workletsLoading=getAudioContext$1().audioWorklet.addModule(workletsUrl),workletsLoading)}function getWorklet(r,t,e){const o=new AudioWorkletNode(r,t);return Object.entries(e).forEach(([s,i])=>{o.parameters.get(s).value=i}),o}if(typeof window<"u")try{loadWorklets()}catch(r){console.warn("could not load AudioWorklet effects coarse, crush and shape",r)}function gainNode(r){const t=getAudioContext$1().createGain();return t.gain.value=r,t}const cutGroups=[];let delays={};function getDelay(r,t,e,o){if(!delays[r]){const i=getAudioContext$1().createFeedbackDelay(1,t,e);i.start(o),i.connect(getDestination()),delays[r]=i}return delays[r].delayTime.value!==t&&delays[r].delayTime.setValueAtTime(t,o),delays[r].feedback.value!==e&&delays[r].feedback.setValueAtTime(e,o),delays[r]}let reverbs={};function getReverb(r,t=2){if(!reverbs[r]){const o=getAudioContext$1().createReverb(t);o.connect(getDestination()),reverbs[r]=o}return reverbs[r].duration!==t&&(reverbs[r]=reverbs[r].setDuration(t),reverbs[r].duration=t),reverbs[r]}function effectSend(r,t,e){const o=gainNode(e);return r.connect(o),o.connect(t),o}const webaudioOutput=async(r,t,e)=>{var o;try{const s=getAudioContext$1();if(typeof r.value!="object")throw new Error(`hap.value ${r.value} is not supported by webaudio output. Hint: append .note() or .s() to the end`);let i=s.currentTime+t,{freq:l,s:f,bank:g,sf:w,clip:y=0,n:$=0,note:S,gain:C=.8,cutoff:p,resonance:d=1,hcutoff:m,hresonance:b=1,bandf:I,bandq:T=1,coarse:G,crush:Y,shape:E,pan:W,speed:P=1,begin:B=0,end:z=1,vowel:O,delay:Z=0,delayfeedback:L=.5,delaytime:le=.25,unit:we,nudge:be=0,cut:te,loop:fe,orbit:pe=1,room:he,size:ve=2,roomsize:de=ve}=r.value;const{velocity:$e=1}=r.context;C*=$e;const F=[];if(g&&f&&(f=`${g}_${f}`),typeof f=="string"&&([f,$]=splitSN(f,$)),typeof S=="string"&&([S,$]=splitSN(S,$)),!f||["sine","square","triangle","sawtooth"].includes(f)){const{attack:M=.001,decay:U=.05,sustain:ye=.6,release:J=.01}=r.value;$=S||$||36,typeof $=="string"&&($=toMidi($)),!l&&typeof $=="number"&&(l=fromMidi($));const ee=getOscillator({t:i,s:f,freq:l,duration:e,release:J});F.push(ee),F.push(gainNode(.3));const R=getADSR(M,U,ye,J,1,i,i+e);F.push(R)}else{const{attack:M=.001,decay:U=.001,sustain:ye=1,release:J=.001}=r.value;if(P===0)return;if(!f){console.warn("no sample specified");return}const ee=getSoundfontKey(f);let R;try{ee?R=await globalThis.getFontBufferSource(ee,S||$,s):R=await getSampleBufferSource(f,$,S,P)}catch(Be){console.warn(Be);return}if(s.currentTime>i){console.warn("sample still loading:",f,$);return}if(!R){console.warn("no buffer source");return}R.playbackRate.value=Math.abs(P)*R.playbackRate.value,we==="c"&&(R.playbackRate.value=R.playbackRate.value*R.buffer.duration);let X=ee||y?e:R.buffer.duration/R.playbackRate.value;const re=B*X*R.playbackRate.value;X=(z-B)*X,fe&&(R.loop=!0,R.loopStart=re,R.loopEnd=re+X,X=fe*X),i+=be,R.start(i,re),te!==void 0&&((o=cutGroups[te])==null||o.stop(i),cutGroups[te]=R),F.push(R),R.stop(i+X+J);const Pe=getADSR(M,U,ye,J,1,i,i+X);F.push(Pe)}if(F.push(gainNode(C)),p!==void 0&&F.push(getFilter("lowpass",p,d)),m!==void 0&&F.push(getFilter("highpass",m,b)),I!==void 0&&F.push(getFilter("bandpass",I,T)),O!==void 0&&F.push(s.createVowelFilter(O)),G!==void 0&&F.push(getWorklet(s,"coarse-processor",{coarse:G})),Y!==void 0&&F.push(getWorklet(s,"crush-processor",{crush:Y})),E!==void 0&&F.push(getWorklet(s,"shape-processor",{shape:E})),W!==void 0){const M=s.createStereoPanner();M.pan.value=2*W-1,F.push(M)}const Q=gainNode(1);F.push(Q),Q.connect(getDestination());let ge;if(Z>0&&le>0&&L>0){const M=getDelay(pe,le,L,i);ge=effectSend(Q,M,Z)}let me;if(he>0&&de>0){const M=getReverb(pe,de);me=effectSend(Q,M,he)}F.slice(1).reduce((M,U)=>M.connect(U),F[0]),F[0].onended=()=>F.concat([ge,me]).forEach(M=>M==null?void 0:M.disconnect())}catch(s){console.warn(".out error:",s)}},webaudioOutputTrigger=(r,t,e,o)=>webaudioOutput(t,r-e,t.duration/o);Pattern.prototype.out=function(){return this.onTrigger(webaudioOutputTrigger)};const tune=`await samples('github:tidalcycles/Dirt-Samples/master') + +stack( + // amen + n("0 1 2 3 4 5 6 7") + .sometimes(x=>x.ply(2)) + .rarely(x=>x.speed("2 | -2")) + .sometimesBy(.4, x=>x.delay(".5")) + .s("amencutup") + .slow(2) + .room(.5) + , + // bass + sine.add(saw.slow(4)).range(0,7).segment(8) + .superimpose(x=>x.add(.1)) + .scale('G0 minor').note() + .s("sawtooth").decay(.1).sustain(0) + .gain(.4).cutoff(perlin.range(300,3000).slow(8)).resonance(10) + .degradeBy("0 0.1 .5 .1") + .rarely(add(note("12"))) + , + // chord + note("Bb3,D4".superimpose(x=>x.add(.2))) + .s('sawtooth').cutoff(1000).struct("<~@3 [~ x]>") + .decay(.05).sustain(.0).delay(.8).delaytime(.125).room(.8) + , + // alien + s("breath").room(1).shape(.6).chop(16).rev().mask("") + , + n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5)) +).reset("")`,ctx=getAudioContext$1(),input=document.getElementById("text");input.innerHTML=tune;evalScope(controls,__vitePreload(()=>Promise.resolve().then(()=>strudel),void 0),__vitePreload(()=>import("./index.85aeb624.js"),[]),__vitePreload(()=>import("./index.b258159a.js"),[]),__vitePreload(()=>import("./index.8b8c94a0.js"),[]));setStringParser(mini);const{evaluate}=repl({defaultOutput:webaudioOutput,getTime:()=>ctx.currentTime});document.getElementById("start").addEventListener("click",()=>{ctx.resume(),evaluate(input.value)});export{Hap as H,Pattern$3 as P,minify as a,peg$SyntaxError as b,peg$parse as c,panic as d,webaudioOutputTrigger as e,getCachedBuffer as f,getAudioContext$1 as g,h,getLoadedBuffer as i,loadGithubSamples as j,resetLoadedSamples as k,loadBuffer as l,mini as m,getLoadedSamples$1 as n,mod as o,patternifyAST as p,getAugmentedNamespace as q,reverseBuffer as r,samples as s,commonjsGlobal as t,getDefaultExportFromCjs as u,reify$2 as v,webaudioOutput as w,stack$1 as x}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.85aeb624.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.85aeb624.js new file mode 100644 index 00000000..72bd56c8 --- /dev/null +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.85aeb624.js @@ -0,0 +1 @@ +import{b as s,h as i,m,a as n,c as p,p as t}from"./index.73313bf6.js";export{s as SyntaxError,i as h,m as mini,n as minify,p as parse,t as patternifyAST}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.1207dd8c.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.8b8c94a0.js similarity index 94% rename from packages/core/examples/vite-vanilla-repl/dist/assets/index.1207dd8c.js rename to packages/core/examples/vite-vanilla-repl/dist/assets/index.8b8c94a0.js index 9bbfa21c..91f92a1d 100644 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.1207dd8c.js +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.8b8c94a0.js @@ -1 +1 @@ -import{P as _,m as Lt,k as Ut,n as Y,o as Xt,q as Kt,H as Qt,t as Yt}from"./index.f17ed672.js";const C=(n,t)=>Array(Math.abs(t)+1).join(n);function g(n,t,e){return function(...o){return console.warn(`${n} is deprecated. Use ${t}.`),e.apply(this,o)}}function z(n){return n!==null&&typeof n=="object"&&typeof n.name=="string"}function q(n){return n!==null&&typeof n=="object"&&typeof n.step=="number"&&typeof n.alt=="number"}const Qn=[0,2,4,-1,1,3,5],Yn=Qn.map(n=>Math.floor(n*7/12));function en(n){const{step:t,alt:e,oct:o,dir:r=1}=n,i=Qn[t]+7*e;if(o===void 0)return[r*i];const a=o-Yn[t]-4*e;return[r*i,r*a]}const Zt=[3,0,4,1,5,2,6];function on(n){const[t,e,o]=n,r=Zt[Jt(t)],i=Math.floor((t+1)/7);if(e===void 0)return{step:r,alt:i,dir:o};const a=e+4*i+Yn[r];return{step:r,alt:i,oct:a,dir:o}}function Jt(n){const t=(n+1)%7;return t<0?7+t:t}const Zn={empty:!0,name:"",pc:"",acc:""},Dn=new Map,vn=n=>"CDEFGAB".charAt(n),E=n=>n<0?C("b",-n):C("#",n),G=n=>n[0]==="b"?-n.length:n.length;function m(n){const t=Dn.get(n);if(t)return t;const e=typeof n=="string"?te(n):q(n)?m(ee(n)):z(n)?m(n.name):Zn;return Dn.set(n,e),e}const Wt=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function rn(n){const t=Wt.exec(n);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}function F(n){return m(on(n))}const ne=(n,t)=>(n%t+t)%t,pn=[0,2,4,5,7,9,11];function te(n){const t=rn(n);if(t[0]===""||t[3]!=="")return Zn;const e=t[0],o=t[1],r=t[2],i=(e.charCodeAt(0)+3)%7,a=G(o),s=r.length?+r:void 0,c=en({step:i,alt:a,oct:s}),l=e+o+r,u=e+o,d=(pn[i]+a+120)%12,M=s===void 0?ne(pn[i]+a,12)-12*99:pn[i]+a+12*(s+1),h=M>=0&&M<=127?M:null,A=s===void 0?null:Math.pow(2,(M-69)/12)*440;return{empty:!1,acc:o,alt:a,chroma:d,coord:c,freq:A,height:M,letter:e,midi:h,name:l,oct:s,pc:u,step:i}}function ee(n){const{step:t,alt:e,oct:o}=n,r=vn(t);if(!r)return"";const i=r+E(e);return o||o===0?i+o:i}const yn={empty:!0,name:"",acc:""},oe="([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})",re="(AA|A|P|M|m|d|dd)([-+]?\\d+)",ie=new RegExp("^"+oe+"|"+re+"$");function $n(n){const t=ie.exec(`${n}`);return t===null?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}const kn={};function f(n){return typeof n=="string"?kn[n]||(kn[n]=ae(n)):q(n)?f(ce(n)):z(n)?f(n.name):yn}const Rn=[0,2,4,5,7,9,11],Jn="PMMPPMM";function ae(n){const t=$n(n);if(t[0]==="")return yn;const e=+t[0],o=t[1],r=(Math.abs(e)-1)%7,i=Jn[r];if(i==="M"&&o==="P")return yn;const a=i==="M"?"majorable":"perfectable",s=""+e+o,c=e<0?-1:1,l=e===8||e===-8?e:c*(r+1),u=se(a,o),d=Math.floor((Math.abs(e)-1)/7),M=c*(Rn[r]+u+12*d),h=(c*(Rn[r]+u)%12+12)%12,A=en({step:r,alt:u,oct:d,dir:c});return{empty:!1,name:s,num:e,q:o,step:r,alt:u,dir:c,type:a,simple:l,semitones:M,chroma:h,coord:A,oct:d}}function B(n,t){const[e,o=0]=n,r=e*7+o*12<0,i=t||r?[-e,-o,-1]:[e,o,1];return f(on(i))}function se(n,t){return t==="M"&&n==="majorable"||t==="P"&&n==="perfectable"?0:t==="m"&&n==="majorable"?-1:/^A+$/.test(t)?t.length:/^d+$/.test(t)?-1*(n==="perfectable"?t.length:t.length+1):0}function ce(n){const{step:t,alt:e,oct:o=0,dir:r}=n;if(!r)return"";const i=t+1+7*o,a=i===0?t+1:i,s=r<0?"-":"",c=Jn[t]==="M"?"majorable":"perfectable";return s+a+me(c,e)}function me(n,t){return t===0?n==="majorable"?"M":"P":t===-1&&n==="majorable"?"m":t>0?C("A",t):C("d",n==="perfectable"?t:t+1)}function P(n,t){const e=m(n),o=f(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=r.length===1?[r[0]+i[0]]:[r[0]+i[0],r[1]+i[1]];return F(a).name}function D(n,t){const e=m(n),o=m(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=i[0]-r[0],s=r.length===2&&i.length===2?i[1]-r[1]:-Math.floor(a*7/12),c=o.height===e.height&&o.midi!==null&&e.midi!==null&&e.step>o.step;return B([a,s],c).name}const Wn=Object.freeze(Object.defineProperty({__proto__:null,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"})),On=(n,t)=>Array(t+1).join(n),ue=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function nt(n){const t=ue.exec(n);return t?[t[1],t[2],t[3]]:["","",""]}function W(n){const[t,e,o]=nt(n);if(e==="")return"";let r=4;for(let a=0;a96?e.toUpperCase()+i+(r+1):e+i+r}function tt(n){const t=m(n);if(t.empty||!t.oct&&t.oct!==0)return"";const{letter:e,acc:o,oct:r}=t,i=o[0]==="b"?o.replace(/b/g,"_"):o.replace(/#/g,"^"),a=r>4?e.toLowerCase():e,s=r===5?"":r>4?On("'",r-5):On(",",4-r);return i+a+s}function le(n,t){return tt(P(W(n),t))}function de(n,t){return D(W(n),W(t))}var Me={abcToScientificNotation:W,scientificToAbcNotation:tt,tokenize:nt,transpose:le,distance:de};function fe(n,t){const e=[];for(;t--;e[t]=t+n);return e}function Pe(n,t){const e=[];for(;t--;e[t]=n-t);return e}function pe(n,t){return nt===0||t)}function et(n){return n.map(e=>m(e)).filter(e=>!e.empty).sort((e,o)=>e.height-o.height).map(e=>e.name)}function ge(n){return et(n).filter((t,e,o)=>e===0||t!==o[e-1])}function be(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function ot(n){return n.length===0?[[]]:ot(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}const Ae=Object.freeze(Object.defineProperty({__proto__:null,compact:ye,permutations:ot,range:pe,rotate:he,shuffle:be,sortedNoteNames:et,sortedUniqNoteNames:ge},Symbol.toStringTag,{value:"Module"}));function ve(n,t){const e=[];for(;t--;e[t]=t+n);return e}function $e(n,t){const e=[];for(;t--;e[t]=n-t);return e}function an(n,t){return nt===0||t)}function Ne(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function rt(n){return n.length===0?[[]]:rt(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}var Ie={compact:Nn,permutations:rt,range:an,rotate:H,shuffle:Ne};const T={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},In=n=>Number(n).toString(2),Fn=n=>parseInt(n,2),je=/^[01]{12}$/;function it(n){return je.test(n)}const Se=n=>typeof n=="number"&&n>=0&&n<=4095,Te=n=>n&&it(n.chroma),zn={[T.chroma]:T};function p(n){const t=it(n)?n:Se(n)?In(n):Array.isArray(n)?ze(n):Te(n)?n.chroma:T.chroma;return zn[t]=zn[t]||Fe(t)}const Ve=g("Pcset.pcset","Pcset.get",p),_e=n=>p(n).chroma,Ce=n=>p(n).intervals,we=n=>p(n).setNum,xe=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function Ee(n){const t=[];for(let e=0;e<12;e++)n.charAt(e)==="1"&&t.push(xe[e]);return t}function De(){return an(2048,4095).map(In)}function jn(n,t=!0){const o=p(n).chroma.split("");return Nn(o.map((r,i)=>{const a=H(i,o);return t&&a[0]==="0"?null:a.join("")}))}function ke(n,t){return p(n).setNum===p(t).setNum}function sn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o&t)===o}}function cn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o|t)===o}}function at(n){const t=p(n);return e=>{const o=m(e);return t&&!o.empty&&t.chroma.charAt(o.chroma)==="1"}}function Re(n){const t=at(n);return e=>e.filter(t)}var st={get:p,chroma:_e,num:we,intervals:Ce,chromas:De,isSupersetOf:cn,isSubsetOf:sn,isNoteIncludedIn:at,isEqual:ke,filter:Re,modes:jn,pcset:Ve};function Oe(n){const t=n.split("");return t.map((e,o)=>H(o,t).join(""))}function Fe(n){const t=Fn(n),e=Oe(n).map(Fn).filter(i=>i>=2048).sort()[0],o=In(e),r=Ee(n);return{empty:!1,name:"",setNum:t,chroma:n,normalized:o,intervals:r}}function ze(n){if(n.length===0)return T.chroma;let t;const e=[0,0,0,0,0,0,0,0,0,0,0,0];for(let o=0;on.name).filter(n=>n)}function Le(){return k.map(n=>n.aliases[0]).filter(n=>n)}function Ue(){return Object.keys(j)}function R(){return k.slice()}const Xe=g("ChordType.entries","ChordType.all",R);function Ke(){k=[],j={}}function ct(n,t,e){const o=Ye(n),r={...p(n),name:e||"",quality:o,intervals:n,aliases:t};k.push(r),r.name&&(j[r.name]=r),j[r.setNum]=r,j[r.chroma]=r,r.aliases.forEach(i=>Qe(r,i))}function Qe(n,t){j[t]=n}function Ye(n){const t=e=>n.indexOf(e)!==-1;return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}qe.forEach(([n,t,e])=>ct(n.split(" "),e.split(" "),t));k.sort((n,t)=>n.setNum-t.setNum);var mt={names:He,symbols:Le,get:Sn,all:R,add:ct,removeAll:Ke,keys:Ue,entries:Xe,chordType:Be};const Ze=n=>{const t=n.reduce((e,o)=>{const r=m(o).chroma;return r!==void 0&&(e[r]=e[r]||m(o).name),e},{});return e=>t[e]};function Je(n){const t=n.map(o=>m(o).pc).filter(o=>o);return m.length===0?[]:We(t,1).filter(o=>o.weight).sort((o,r)=>r.weight-o.weight).map(o=>o.name)}function We(n,t){const e=n[0],o=m(e).chroma,r=Ze(n),i=jn(n,!1),a=[];return i.forEach((s,c)=>{R().filter(u=>u.chroma===s).forEach(u=>{const d=u.aliases[0],M=r(c);c!==o?a.push({weight:.5*t,name:`${M}${d}/${e}`}):a.push({weight:1*t,name:`${M}${d}`})})}),a}const no=[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 2A 3M 4A 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 4A 5P 6M 7m","dorian #4","ukrainian dorian","romanian minor","altered dorian"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]],to={...T,intervals:[],aliases:[]};let mn=[],S={};function ut(){return mn.map(n=>n.name)}function un(n){return S[n]||to}const eo=g("ScaleDictionary.scaleType","ScaleType.get",un);function L(){return mn.slice()}const oo=g("ScaleDictionary.entries","ScaleType.all",L);function ro(){return Object.keys(S)}function io(){mn=[],S={}}function lt(n,t,e=[]){const o={...p(n),name:t,intervals:n,aliases:e};return mn.push(o),S[o.name]=o,S[o.setNum]=o,S[o.chroma]=o,o.aliases.forEach(r=>ao(o,r)),o}function ao(n,t){S[t]=n}no.forEach(([n,t,...e])=>lt(n.split(" "),t,e));var dt={names:ut,get:un,all:L,add:lt,removeAll:io,keys:ro,entries:oo,scaleType:eo};const gn={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},so=/^(6|64|7|9|11|13)$/;function ln(n){const[t,e,o,r]=rn(n);return t===""?["",n]:t==="A"&&r==="ug"?["","aug"]:!r&&(o==="4"||o==="5")?[t+e,o]:so.test(o)?[t+e,o+r]:[t+e+o,r]}function U(n){if(n==="")return gn;if(Array.isArray(n)&&n.length===2)return Z(n[1],n[0]);{const[t,e]=ln(n),o=Z(e,t);return o.empty?Z(n):o}}function Z(n,t,e){const o=Sn(n),r=m(t||""),i=m(e||"");if(o.empty||t&&r.empty||e&&i.empty)return gn;const a=D(r.pc,i.pc),s=o.intervals.indexOf(a)+1;if(!i.empty&&!s)return gn;const c=Array.from(o.intervals);for(let M=1;MP(r,M));n=o.aliases.indexOf(n)!==-1?n:o.aliases[0];const u=`${r.empty?"":r.pc}${n}${i.empty||s<=1?"":"/"+i.pc}`,d=`${t?r.pc+" ":""}${o.name}${s>1&&e?" over "+i.pc:""}`;return{...o,name:d,symbol:u,type:o.name,root:i.name,intervals:c,rootDegree:s,tonic:r.name,notes:l}}const co=g("Chord.chord","Chord.get",U);function mo(n,t){const[e,o]=ln(n);return e?P(e,t)+o:n}function uo(n){const t=U(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function lo(n){const t=U(n),e=cn(t.chroma);return R().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}function Mo(n){const t=U(n),e=sn(t.chroma);return R().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}var fo={getChord:Z,get:U,detect:Je,chordScales:uo,extended:lo,reduced:Mo,tokenize:ln,transpose:mo,chord:co};const Po=[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]],dn=[];Po.forEach(([n,t,e])=>$o(n,t,e));const po={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};function ho(){return dn.reduce((n,t)=>(t.names.forEach(e=>n.push(e)),n),[])}function yo(){return dn.map(n=>n.shorthand)}const go=/^([^.]+)(\.*)$/;function Tn(n){const[t,e,o]=go.exec(n)||[],r=dn.find(s=>s.shorthand===e||s.names.includes(e));if(!r)return po;const i=No(r.fraction,o.length),a=i[0]/i[1];return{...r,name:n,dots:o,value:a,fraction:i}}const bo=n=>Tn(n).value,Ao=n=>Tn(n).fraction;var vo={names:ho,shorthands:yo,get:Tn,value:bo,fraction:Ao};function $o(n,t,e){dn.push({empty:!1,dots:"",name:"",value:1/n,fraction:n<1?[1/n,1]:[1,n],shorthand:t,names:e})}function No(n,t){const e=Math.pow(2,t);let o=n[0]*e,r=n[1]*e;const i=o;for(let a=0;af(n).name,So=n=>f(n).semitones,To=n=>f(n).q,Vo=n=>f(n).num;function ft(n){const t=f(n);return t.empty?"":t.simple+t.q}function _o(n){const t=f(n);if(t.empty)return"";const e=(7-t.step)%7,o=t.type==="perfectable"?-t.alt:-(t.alt+1);return f({step:e,alt:o,oct:t.oct,dir:t.dir}).name}const Co=[1,2,2,3,3,4,5,5,6,6,7,7],wo="P m M m M P d P m M m M".split(" ");function xo(n){const t=n<0?-1:1,e=Math.abs(n),o=e%12,r=Math.floor(e/12);return t*(Co[o]+7*r)+wo[o]}const Eo=D,Pt=ht((n,t)=>[n[0]+t[0],n[1]+t[1]]),Do=n=>t=>Pt(n,t),ko=ht((n,t)=>[n[0]-t[0],n[1]-t[1]]);function pt(n,t){const e=Mt(n);if(e.empty)return"";const[o,r,i]=e.coord;return B([o+t,r,i]).name}var bn={names:Io,get:Mt,name:jo,num:Vo,semitones:So,quality:To,fromSemitones:xo,distance:Eo,invert:_o,simplify:ft,add:Pt,addTo:Do,substract:ko,transposeFifths:pt};function ht(n){return(t,e)=>{const o=f(t).coord,r=f(e).coord;if(o&&r){const i=n(o,r);return B(i).name}}}function yt(n){return+n>=0&&+n<=127}function gt(n){if(yt(n))return+n;const t=m(n);return t.empty?null:t.midi}function Ro(n,t=440){return Math.pow(2,(n-69)/12)*t}const Oo=Math.log(2),Fo=Math.log(440);function Vn(n){const t=12*(Math.log(n)-Fo)/Oo+69;return Math.round(t*100)/100}const zo="C C# D D# E F F# G G# A A# B".split(" "),qo="C Db D Eb E F Gb G Ab A Bb B".split(" ");function I(n,t={}){if(isNaN(n)||n===-1/0||n===1/0)return"";n=Math.round(n);const o=(t.sharps===!0?zo:qo)[n%12];if(t.pitchClass)return o;const r=Math.floor(n/12)-1;return o+r}var Go={isMidi:yt,toMidi:gt,midiToFreq:Ro,midiToNoteName:I,freqToMidi:Vn};const Bo=["C","D","E","F","G","A","B"],bt=n=>n.name,At=n=>n.map(m).filter(t=>!t.empty);function Ho(n){return n===void 0?Bo.slice():Array.isArray(n)?At(n).map(bt):[]}const y=m,Lo=n=>y(n).name,Uo=n=>y(n).pc,Xo=n=>y(n).acc,Ko=n=>y(n).oct,Qo=n=>y(n).midi,Yo=n=>y(n).freq,Zo=n=>y(n).chroma;function vt(n){return I(n)}function Jo(n){return I(Vn(n))}function Wo(n){return I(Vn(n),{sharps:!0})}function nr(n){return I(n,{sharps:!0})}const _n=P,tr=P,$t=n=>t=>_n(t,n),er=$t,Nt=n=>t=>_n(n,t),or=Nt;function nn(n,t){const e=y(n);if(e.empty)return"";const[o,r]=e.coord;return F(r===void 0?[o+t]:[o+t,r]).name}const rr=nn,Cn=(n,t)=>n.height-t.height,ir=(n,t)=>t.height-n.height;function It(n,t){return t=t||Cn,At(n).sort(t).map(bt)}function jt(n){return It(n,Cn).filter((t,e,o)=>e===0||t!==o[e-1])}const ar=n=>{const t=y(n);return t.empty?"":I(t.midi||t.chroma,{sharps:t.alt>0,pitchClass:t.midi===null})};function St(n,t){const e=y(n);if(e.empty)return"";const o=y(t||I(e.midi||e.chroma,{sharps:e.alt<0,pitchClass:!0}));if(o.empty||o.chroma!==e.chroma)return"";if(e.oct===void 0)return o.pc;const r=e.chroma-e.alt,i=o.chroma-o.alt,a=r>11||i<0?-1:r<0||i>11?1:0,s=e.oct+a;return o.pc+s}var w={names:Ho,get:y,name:Lo,pitchClass:Uo,accidentals:Xo,octave:Ko,midi:Qo,ascending:Cn,descending:ir,sortedNames:It,sortedUniqNames:jt,fromMidi:vt,fromMidiSharps:nr,freq:Yo,fromFreq:Jo,fromFreqSharps:Wo,chroma:Zo,transpose:_n,tr,transposeBy:$t,trBy:er,transposeFrom:Nt,trFrom:or,transposeFifths:nn,trFifths:rr,simplify:ar,enharmonic:St};const Tt={empty:!0,name:"",chordType:""},qn={};function $(n){return typeof n=="string"?qn[n]||(qn[n]=Mr(n)):typeof n=="number"?$(Mn[n]||""):q(n)?mr(n):z(n)?$(n.name):Tt}const sr=g("RomanNumeral.romanNumeral","RomanNumeral.get",$);function cr(n=!0){return(n?Mn:dr).slice()}function mr(n){return $(E(n.alt)+Mn[n.step])}const ur=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function lr(n){return ur.exec(n)||["","","",""]}const Vt="I II III IV V VI VII",Mn=Vt.split(" "),dr=Vt.toLowerCase().split(" ");function Mr(n){const[t,e,o,r]=lr(n);if(!o)return Tt;const i=o.toUpperCase(),a=Mn.indexOf(i),s=G(e),c=1;return{empty:!1,name:t,roman:o,interval:f({step:a,alt:s,dir:c}).name,acc:e,chordType:r,alt:s,step:a,major:o===i,oct:0,dir:c}}var fr={names:cr,get:$,romanNumeral:sr};const b=Object.freeze([]),_t={type:"major",tonic:"",alteration:0,keySignature:""},J={tonic:"",grades:b,intervals:b,scale:b,chords:b,chordsHarmonicFunction:b,chordScales:b},Pr={..._t,...J,type:"major",minorRelative:"",scale:b,secondaryDominants:b,secondaryDominantsMinorRelative:b,substituteDominants:b,substituteDominantsMinorRelative:b},pr={..._t,type:"minor",relativeMajor:"",natural:J,harmonic:J,melodic:J},Gn=(n,t,e="")=>t.map((o,r)=>`${n[r]}${e}${o}`);function fn(n,t,e,o){return r=>{const i=n.map(s=>$(s).interval||""),a=i.map(s=>P(r,s));return{tonic:r,grades:n,intervals:i,scale:a,chords:Gn(a,t),chordsHarmonicFunction:e.slice(),chordScales:Gn(a,o," ")}}}const Ct=(n,t)=>{const e=m(n),o=m(t);return e.empty||o.empty?0:o.coord[0]-e.coord[0]},hr=fn("I II III IV V VI VII".split(" "),"maj7 m7 m7 maj7 7 m7 m7b5".split(" "),"T SD T SD D T D".split(" "),"major,dorian,phrygian,lydian,mixolydian,minor,locrian".split(",")),yr=fn("I II bIII IV V bVI bVII".split(" "),"m7 m7b5 maj7 m7 m7 maj7 7".split(" "),"T SD T SD D SD SD".split(" "),"minor,locrian,major,dorian,phrygian,lydian,mixolydian".split(",")),gr=fn("I II bIII IV V bVI VII".split(" "),"mMaj7 m7b5 +maj7 m7 7 maj7 o7".split(" "),"T SD T SD D SD D".split(" "),"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian".split(",")),br=fn("I II bIII IV V VI VII".split(" "),"m6 m7 +maj7 7 7 m7b5 m7b5".split(" "),"T SD T SD D ".split(" "),"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered".split(","));function Ar(n){const t=m(n).pc;if(!t)return Pr;const e=hr(t),o=Ct("C",t),r=i=>{const a=$(i);return a.empty?"":P(n,a.interval)+a.chordType};return{...e,type:"major",minorRelative:P(t,"-3m"),alteration:o,keySignature:E(o),secondaryDominants:"- VI7 VII7 I7 II7 III7 -".split(" ").map(r),secondaryDominantsMinorRelative:"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -".split(" ").map(r),substituteDominants:"- bIII7 IV7 bV7 bVI7 bVII7 -".split(" ").map(r),substituteDominantsMinorRelative:"- IIIm7 Im7 IIbm7 VIm7 IVm7 -".split(" ").map(r)}}function vr(n){const t=m(n).pc;if(!t)return pr;const e=Ct("C",t)-3;return{type:"minor",tonic:t,relativeMajor:P(t,"3m"),alteration:e,keySignature:E(e),natural:yr(t),harmonic:gr(t),melodic:br(t)}}function $r(n){return typeof n=="number"?nn("C",n):typeof n=="string"&&/^b+|#+$/.test(n)?nn("C",G(n)):null}var Nr={majorKey:Ar,majorTonicFromKeySignature:$r,minorKey:vr};const wn=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]],Bn={...T,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},xn=wn.map(Tr),An={};xn.forEach(n=>{An[n.name]=n,n.aliases.forEach(t=>{An[t]=n})});function V(n){return typeof n=="string"?An[n.toLowerCase()]||Bn:n&&n.name?V(n.name):Bn}const Ir=g("Mode.mode","Mode.get",V);function wt(){return xn.slice()}const jr=g("Mode.mode","Mode.all",wt);function Sr(){return xn.map(n=>n.name)}function Tr(n){const[t,e,o,r,i,a,s]=n,c=s?[s]:[],l=Number(e).toString(2);return{empty:!1,intervals:un(r).intervals,modeNum:t,chroma:l,normalized:l,name:r,setNum:e,alt:o,triad:i,seventh:a,aliases:c}}function Vr(n,t){return V(n).intervals.map(e=>P(t,e))}function xt(n){return(t,e)=>{const o=V(t);if(o.empty)return[];const r=H(o.modeNum,n),i=o.intervals.map(a=>P(e,a));return r.map((a,s)=>i[s]+a)}}const _r=xt(wn.map(n=>n[4])),Cr=xt(wn.map(n=>n[5]));function Et(n,t){const e=V(t),o=V(n);return e.empty||o.empty?"":ft(pt("1P",o.alt-e.alt))}function wr(n,t,e){return P(e,Et(n,t))}var xr={get:V,names:Sr,all:wt,distance:Et,relativeTonic:wr,notes:Vr,triads:_r,seventhChords:Cr,entries:jr,mode:Ir};function Er(n,t){return t.map($).map(o=>P(n,f(o))+o.chordType)}function Dr(n,t){return t.map(e=>{const[o,r]=ln(e),i=D(n,o);return $(f(i)).name+r})}var kr={fromRomanNumerals:Er,toRomanNumerals:Dr};function Dt(n){const t=Nn(n.map(gt));return!n.length||t.length!==n.length?[]:t.reduce((e,o)=>{const r=e[e.length-1];return e.concat(an(r,o).slice(1))},[t[0]])}function Rr(n,t){return Dt(n).map(e=>I(e,t))}var Or={numeric:Dt,chromatic:Rr};const Fr={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function kt(n){if(typeof n!="string")return["",""];const t=n.indexOf(" "),e=m(n.substring(0,t));if(e.empty){const r=m(n);return r.empty?["",n]:[r.name,""]}const o=n.substring(e.name.length+1);return[e.name,o.length?o:""]}const zr=ut;function N(n){const t=Array.isArray(n)?n:kt(n),e=m(t[0]).name,o=un(t[1]);if(o.empty)return Fr;const r=o.name,i=e?o.intervals.map(s=>P(e,s)):[],a=e?e+" "+r:r;return{...o,name:a,type:r,tonic:e,notes:i}}const qr=g("Scale.scale","Scale.get",N);function Gr(n){const t=N(n),e=sn(t.chroma);return R().filter(o=>e(o.chroma)).map(o=>o.aliases[0])}function Br(n){const t=N(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function Hr(n){const t=sn(N(n).chroma);return L().filter(e=>t(e.chroma)).map(e=>e.name)}function Rt(n){const t=n.map(r=>m(r).pc).filter(r=>r),e=t[0],o=jt(t);return H(o.indexOf(e),o)}function Lr(n){const t=N(n);if(t.empty)return[];const e=t.tonic?t.notes:t.intervals;return jn(t.chroma).map((o,r)=>{const i=N(o).name;return i?[e[r],i]:["",""]}).filter(o=>o[0])}function Ur(n){const t=Array.isArray(n)?Rt(n):N(n).notes,e=t.map(o=>m(o).chroma);return o=>{const r=m(typeof o=="number"?vt(o):o),i=r.height;if(i===void 0)return;const a=i%12,s=e.indexOf(a);if(s!==-1)return St(r.name,t[s])}}function Xr(n){const t=Ur(n);return(e,o)=>{const r=m(e).height,i=m(o).height;return r===void 0||i===void 0?[]:an(r,i).map(t).filter(a=>a)}}var tn={get:N,names:zr,extended:Br,modeNames:Lr,reduced:Hr,scaleChords:Gr,scaleNotes:Rt,tokenize:kt,rangeOf:Xr,scale:qr};const Kr={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},Qr=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];function Yr(){return Qr.slice()}const Zr=/^(\d?\d(?:\+\d)*)\/(\d)$/,Hn=new Map;function Jr(n){const t=Hn.get(n);if(t)return t;const e=ni(En(n));return Hn.set(n,e),e}function En(n){if(typeof n=="string"){const[i,a,s]=Zr.exec(n)||[];return En([a,s])}const[t,e]=n,o=+e;if(typeof t=="number")return[t,o];const r=t.split("+").map(i=>+i);return r.length===1?[r[0],o]:[r,o]}var Wr={names:Yr,parse:En,get:Jr};function ni([n,t]){const e=Array.isArray(n)?n.reduce((s,c)=>s+c,0):n,o=t;if(e===0||o===0)return Kr;const r=Array.isArray(n)?`${n.join("+")}/${t}`:`${n}/${t}`,i=Array.isArray(n)?n:[],a=o===4||o===2?"simple":o===8&&e%3===0?"compound":"irregular";return{empty:!1,name:r,type:a,upper:e,lower:o,additive:i}}const ti=Wn,ei=st,oi=mt,ri=dt,ii=Object.freeze(Object.defineProperty({__proto__:null,Array:Ae,Core:Wn,ChordDictionary:oi,PcSet:ei,ScaleDictionary:ri,Tonal:ti,AbcNotation:Me,Chord:fo,ChordType:mt,Collection:Ie,DurationValue:vo,Interval:bn,Key:Nr,Midi:Go,Mode:xr,Note:w,Pcset:st,Progression:kr,Range:Or,RomanNumeral:fr,Scale:tn,ScaleType:dt,TimeSignature:Wr,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"}));function Ot(n,t,e){let[o,r]=tn.tokenize(n),{notes:i}=tn.get(`${o} ${r}`);if(i=i.map(h=>w.get(h).pc),t=Number(t),isNaN(t))throw new Error(`scale offset "${t}" not a number`);const{pc:a,oct:s=3}=w.get(e),c=i.indexOf(a);if(c===-1)throw new Error(`note "${e}" is not in scale "${n}"`);let l=c,u=s,d=a;const M=Math.sign(t);for(;Math.abs(l-c)0&&d[0]==="C"&&(u+=M)}return d+u}_.prototype._transpose=function(n){return this._withHap(t=>{const e=isNaN(Number(n))?String(n):bn.fromSemitones(n);if(typeof t.value=="number"){const o=typeof e=="string"?bn.semitones(e)||0:e;return t.withValue(()=>t.value+o)}return t.withValue(()=>w.simplify(w.transpose(t.value,e)))})};_.prototype._scaleTranspose=function(n){return this._withHap(t=>{if(!t.context.scale)throw new Error("can only use scaleTranspose after .scale");if(typeof t.value!="string")throw new Error("can only use scaleTranspose with notes");return t.withValue(()=>Ot(t.context.scale,Number(n),t.value))})};_.prototype._scale=function(n){return this._withHap(t=>{let e=t.value;const o=Number(e);if(!isNaN(o)){let[r,i]=tn.tokenize(n);const{pc:a,oct:s=3}=w.get(r);e=Ot(a+" "+i,o,a+s)}return t.withValue(()=>e).setContext({...t.context,scale:n})})};_.prototype.define("transpose",(n,t)=>t.transpose(n),{composable:!0,patternified:!0});_.prototype.define("scale",(n,t)=>t.scale(n),{composable:!0,patternified:!0});_.prototype.define("scaleTranspose",(n,t)=>t.scaleTranspose(n),{composable:!0,patternified:!0});var Ft={},hn={},X={};X.__esModule=!0;X.getBestVoicing=void 0;function ai(n){var t=n.chord,e=n.range,o=n.finder,r=n.picker,i=n.lastVoicing,a=o(t,e);return a.length?r(a,i):[]}X.getBestVoicing=ai;var O={};const zt=Ut(ii);var K={};K.__esModule=!0;K.tokenizeChord=void 0;function si(n){var t=(n||"").match(/^([A-G][b#]*)([^\/]*)[\/]?([A-G][b#]*)?$/);return t?t.slice(1):[]}K.tokenizeChord=si;var Ln;function ci(){if(Ln)return O;Ln=1,O.__esModule=!0,O.voicingsInRange=void 0;var n=zt,t=qt(),e=K;function o(r,i,a){i===void 0&&(i=t.lefthand),a===void 0&&(a=["D3","A4"]);var s=(0,e.tokenizeChord)(r),c=s[0],l=s[1];if(!i[l])return[];var u=i[l].map(function(M){return M.split(" ")}),d=n.Range.chromatic(a);return u.reduce(function(M,h){var A=h.map(function(v){return n.Interval.substract(v,h[0])}),Q=n.Note.transpose(c,h[0]),Gt=d.filter(function(v){return n.Note.chroma(v)===n.Note.chroma(Q)}).filter(function(v){return n.Note.midi(n.Note.transpose(v,A[A.length-1]))<=n.Note.midi(a[1])}).map(function(v){return n.Note.enharmonic(v,Q)}),Bt=Gt.map(function(v){return A.map(function(Ht){return n.Note.transpose(v,Ht)})});return M.concat(Bt)},[])}return O.voicingsInRange=o,O}var Un;function qt(){return Un||(Un=1,function(n){var t=Y&&Y.__assign||function(){return t=Object.assign||function(s){for(var c,l=1,u=arguments.length;lui({chord:n,dictionary:di,range:e,picker:li,lastVoicing:t}),x=_;x.prototype.fmapNested=function(n){return new x(t=>this.query(t).map(e=>Kt(n(e)).query(t).map(o=>new Qt(e.whole,e.part,o.value,o.context))).flat())};x.prototype.voicings=function(n){let t;return n!=null&&n.length||(n=["F3","A4"]),this.fmapNested(e=>(t=Mi(e.value,t,n),Yt(...t)._withContext(()=>({locations:e.context.locations||[]}))))};x.prototype._rootNotes=function(n=2){return this.fmap(t=>{const[e,o]=t.match(/^([a-gA-G][b#]?).*$/);return o+n})};x.prototype.define("voicings",(n,t)=>t.voicings(n),{composable:!0});x.prototype.define("rootNotes",(n,t)=>t.rootNotes(n),{composable:!0,patternified:!0}); +import{P as _,o as Lt,q as Ut,t as Y,u as Xt,v as Kt,H as Qt,x as Yt}from"./index.73313bf6.js";const C=(n,t)=>Array(Math.abs(t)+1).join(n);function g(n,t,e){return function(...o){return console.warn(`${n} is deprecated. Use ${t}.`),e.apply(this,o)}}function z(n){return n!==null&&typeof n=="object"&&typeof n.name=="string"}function q(n){return n!==null&&typeof n=="object"&&typeof n.step=="number"&&typeof n.alt=="number"}const Qn=[0,2,4,-1,1,3,5],Yn=Qn.map(n=>Math.floor(n*7/12));function en(n){const{step:t,alt:e,oct:o,dir:r=1}=n,i=Qn[t]+7*e;if(o===void 0)return[r*i];const a=o-Yn[t]-4*e;return[r*i,r*a]}const Zt=[3,0,4,1,5,2,6];function on(n){const[t,e,o]=n,r=Zt[Jt(t)],i=Math.floor((t+1)/7);if(e===void 0)return{step:r,alt:i,dir:o};const a=e+4*i+Yn[r];return{step:r,alt:i,oct:a,dir:o}}function Jt(n){const t=(n+1)%7;return t<0?7+t:t}const Zn={empty:!0,name:"",pc:"",acc:""},Dn=new Map,vn=n=>"CDEFGAB".charAt(n),E=n=>n<0?C("b",-n):C("#",n),G=n=>n[0]==="b"?-n.length:n.length;function m(n){const t=Dn.get(n);if(t)return t;const e=typeof n=="string"?te(n):q(n)?m(ee(n)):z(n)?m(n.name):Zn;return Dn.set(n,e),e}const Wt=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function rn(n){const t=Wt.exec(n);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}function F(n){return m(on(n))}const ne=(n,t)=>(n%t+t)%t,pn=[0,2,4,5,7,9,11];function te(n){const t=rn(n);if(t[0]===""||t[3]!=="")return Zn;const e=t[0],o=t[1],r=t[2],i=(e.charCodeAt(0)+3)%7,a=G(o),s=r.length?+r:void 0,c=en({step:i,alt:a,oct:s}),l=e+o+r,u=e+o,d=(pn[i]+a+120)%12,M=s===void 0?ne(pn[i]+a,12)-12*99:pn[i]+a+12*(s+1),h=M>=0&&M<=127?M:null,A=s===void 0?null:Math.pow(2,(M-69)/12)*440;return{empty:!1,acc:o,alt:a,chroma:d,coord:c,freq:A,height:M,letter:e,midi:h,name:l,oct:s,pc:u,step:i}}function ee(n){const{step:t,alt:e,oct:o}=n,r=vn(t);if(!r)return"";const i=r+E(e);return o||o===0?i+o:i}const yn={empty:!0,name:"",acc:""},oe="([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})",re="(AA|A|P|M|m|d|dd)([-+]?\\d+)",ie=new RegExp("^"+oe+"|"+re+"$");function $n(n){const t=ie.exec(`${n}`);return t===null?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}const Rn={};function f(n){return typeof n=="string"?Rn[n]||(Rn[n]=ae(n)):q(n)?f(ce(n)):z(n)?f(n.name):yn}const kn=[0,2,4,5,7,9,11],Jn="PMMPPMM";function ae(n){const t=$n(n);if(t[0]==="")return yn;const e=+t[0],o=t[1],r=(Math.abs(e)-1)%7,i=Jn[r];if(i==="M"&&o==="P")return yn;const a=i==="M"?"majorable":"perfectable",s=""+e+o,c=e<0?-1:1,l=e===8||e===-8?e:c*(r+1),u=se(a,o),d=Math.floor((Math.abs(e)-1)/7),M=c*(kn[r]+u+12*d),h=(c*(kn[r]+u)%12+12)%12,A=en({step:r,alt:u,oct:d,dir:c});return{empty:!1,name:s,num:e,q:o,step:r,alt:u,dir:c,type:a,simple:l,semitones:M,chroma:h,coord:A,oct:d}}function B(n,t){const[e,o=0]=n,r=e*7+o*12<0,i=t||r?[-e,-o,-1]:[e,o,1];return f(on(i))}function se(n,t){return t==="M"&&n==="majorable"||t==="P"&&n==="perfectable"?0:t==="m"&&n==="majorable"?-1:/^A+$/.test(t)?t.length:/^d+$/.test(t)?-1*(n==="perfectable"?t.length:t.length+1):0}function ce(n){const{step:t,alt:e,oct:o=0,dir:r}=n;if(!r)return"";const i=t+1+7*o,a=i===0?t+1:i,s=r<0?"-":"",c=Jn[t]==="M"?"majorable":"perfectable";return s+a+me(c,e)}function me(n,t){return t===0?n==="majorable"?"M":"P":t===-1&&n==="majorable"?"m":t>0?C("A",t):C("d",n==="perfectable"?t:t+1)}function P(n,t){const e=m(n),o=f(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=r.length===1?[r[0]+i[0]]:[r[0]+i[0],r[1]+i[1]];return F(a).name}function D(n,t){const e=m(n),o=m(t);if(e.empty||o.empty)return"";const r=e.coord,i=o.coord,a=i[0]-r[0],s=r.length===2&&i.length===2?i[1]-r[1]:-Math.floor(a*7/12),c=o.height===e.height&&o.midi!==null&&e.midi!==null&&e.step>o.step;return B([a,s],c).name}const Wn=Object.freeze(Object.defineProperty({__proto__:null,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"})),On=(n,t)=>Array(t+1).join(n),ue=/^(_{1,}|=|\^{1,}|)([abcdefgABCDEFG])([,']*)$/;function nt(n){const t=ue.exec(n);return t?[t[1],t[2],t[3]]:["","",""]}function W(n){const[t,e,o]=nt(n);if(e==="")return"";let r=4;for(let a=0;a96?e.toUpperCase()+i+(r+1):e+i+r}function tt(n){const t=m(n);if(t.empty||!t.oct&&t.oct!==0)return"";const{letter:e,acc:o,oct:r}=t,i=o[0]==="b"?o.replace(/b/g,"_"):o.replace(/#/g,"^"),a=r>4?e.toLowerCase():e,s=r===5?"":r>4?On("'",r-5):On(",",4-r);return i+a+s}function le(n,t){return tt(P(W(n),t))}function de(n,t){return D(W(n),W(t))}var Me={abcToScientificNotation:W,scientificToAbcNotation:tt,tokenize:nt,transpose:le,distance:de};function fe(n,t){const e=[];for(;t--;e[t]=t+n);return e}function Pe(n,t){const e=[];for(;t--;e[t]=n-t);return e}function pe(n,t){return nt===0||t)}function et(n){return n.map(e=>m(e)).filter(e=>!e.empty).sort((e,o)=>e.height-o.height).map(e=>e.name)}function ge(n){return et(n).filter((t,e,o)=>e===0||t!==o[e-1])}function be(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function ot(n){return n.length===0?[[]]:ot(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}const Ae=Object.freeze(Object.defineProperty({__proto__:null,compact:ye,permutations:ot,range:pe,rotate:he,shuffle:be,sortedNoteNames:et,sortedUniqNoteNames:ge},Symbol.toStringTag,{value:"Module"}));function ve(n,t){const e=[];for(;t--;e[t]=t+n);return e}function $e(n,t){const e=[];for(;t--;e[t]=n-t);return e}function an(n,t){return nt===0||t)}function Ne(n,t=Math.random){let e,o,r=n.length;for(;r;)e=Math.floor(t()*r--),o=n[r],n[r]=n[e],n[e]=o;return n}function rt(n){return n.length===0?[[]]:rt(n.slice(1)).reduce((t,e)=>t.concat(n.map((o,r)=>{const i=e.slice();return i.splice(r,0,n[0]),i})),[])}var Ie={compact:Nn,permutations:rt,range:an,rotate:H,shuffle:Ne};const T={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},In=n=>Number(n).toString(2),Fn=n=>parseInt(n,2),je=/^[01]{12}$/;function it(n){return je.test(n)}const Se=n=>typeof n=="number"&&n>=0&&n<=4095,Te=n=>n&&it(n.chroma),zn={[T.chroma]:T};function p(n){const t=it(n)?n:Se(n)?In(n):Array.isArray(n)?ze(n):Te(n)?n.chroma:T.chroma;return zn[t]=zn[t]||Fe(t)}const Ve=g("Pcset.pcset","Pcset.get",p),_e=n=>p(n).chroma,Ce=n=>p(n).intervals,we=n=>p(n).setNum,xe=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function Ee(n){const t=[];for(let e=0;e<12;e++)n.charAt(e)==="1"&&t.push(xe[e]);return t}function De(){return an(2048,4095).map(In)}function jn(n,t=!0){const o=p(n).chroma.split("");return Nn(o.map((r,i)=>{const a=H(i,o);return t&&a[0]==="0"?null:a.join("")}))}function Re(n,t){return p(n).setNum===p(t).setNum}function sn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o&t)===o}}function cn(n){const t=p(n).setNum;return e=>{const o=p(e).setNum;return t&&t!==o&&(o|t)===o}}function at(n){const t=p(n);return e=>{const o=m(e);return t&&!o.empty&&t.chroma.charAt(o.chroma)==="1"}}function ke(n){const t=at(n);return e=>e.filter(t)}var st={get:p,chroma:_e,num:we,intervals:Ce,chromas:De,isSupersetOf:cn,isSubsetOf:sn,isNoteIncludedIn:at,isEqual:Re,filter:ke,modes:jn,pcset:Ve};function Oe(n){const t=n.split("");return t.map((e,o)=>H(o,t).join(""))}function Fe(n){const t=Fn(n),e=Oe(n).map(Fn).filter(i=>i>=2048).sort()[0],o=In(e),r=Ee(n);return{empty:!1,name:"",setNum:t,chroma:n,normalized:o,intervals:r}}function ze(n){if(n.length===0)return T.chroma;let t;const e=[0,0,0,0,0,0,0,0,0,0,0,0];for(let o=0;on.name).filter(n=>n)}function Le(){return R.map(n=>n.aliases[0]).filter(n=>n)}function Ue(){return Object.keys(j)}function k(){return R.slice()}const Xe=g("ChordType.entries","ChordType.all",k);function Ke(){R=[],j={}}function ct(n,t,e){const o=Ye(n),r={...p(n),name:e||"",quality:o,intervals:n,aliases:t};R.push(r),r.name&&(j[r.name]=r),j[r.setNum]=r,j[r.chroma]=r,r.aliases.forEach(i=>Qe(r,i))}function Qe(n,t){j[t]=n}function Ye(n){const t=e=>n.indexOf(e)!==-1;return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}qe.forEach(([n,t,e])=>ct(n.split(" "),e.split(" "),t));R.sort((n,t)=>n.setNum-t.setNum);var mt={names:He,symbols:Le,get:Sn,all:k,add:ct,removeAll:Ke,keys:Ue,entries:Xe,chordType:Be};const Ze=n=>{const t=n.reduce((e,o)=>{const r=m(o).chroma;return r!==void 0&&(e[r]=e[r]||m(o).name),e},{});return e=>t[e]};function Je(n){const t=n.map(o=>m(o).pc).filter(o=>o);return m.length===0?[]:We(t,1).filter(o=>o.weight).sort((o,r)=>r.weight-o.weight).map(o=>o.name)}function We(n,t){const e=n[0],o=m(e).chroma,r=Ze(n),i=jn(n,!1),a=[];return i.forEach((s,c)=>{k().filter(u=>u.chroma===s).forEach(u=>{const d=u.aliases[0],M=r(c);c!==o?a.push({weight:.5*t,name:`${M}${d}/${e}`}):a.push({weight:1*t,name:`${M}${d}`})})}),a}const no=[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 2A 3M 4A 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 4A 5P 6M 7m","dorian #4","ukrainian dorian","romanian minor","altered dorian"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]],to={...T,intervals:[],aliases:[]};let mn=[],S={};function ut(){return mn.map(n=>n.name)}function un(n){return S[n]||to}const eo=g("ScaleDictionary.scaleType","ScaleType.get",un);function L(){return mn.slice()}const oo=g("ScaleDictionary.entries","ScaleType.all",L);function ro(){return Object.keys(S)}function io(){mn=[],S={}}function lt(n,t,e=[]){const o={...p(n),name:t,intervals:n,aliases:e};return mn.push(o),S[o.name]=o,S[o.setNum]=o,S[o.chroma]=o,o.aliases.forEach(r=>ao(o,r)),o}function ao(n,t){S[t]=n}no.forEach(([n,t,...e])=>lt(n.split(" "),t,e));var dt={names:ut,get:un,all:L,add:lt,removeAll:io,keys:ro,entries:oo,scaleType:eo};const gn={empty:!0,name:"",symbol:"",root:"",rootDegree:0,type:"",tonic:null,setNum:NaN,quality:"Unknown",chroma:"",normalized:"",aliases:[],notes:[],intervals:[]},so=/^(6|64|7|9|11|13)$/;function ln(n){const[t,e,o,r]=rn(n);return t===""?["",n]:t==="A"&&r==="ug"?["","aug"]:!r&&(o==="4"||o==="5")?[t+e,o]:so.test(o)?[t+e,o+r]:[t+e+o,r]}function U(n){if(n==="")return gn;if(Array.isArray(n)&&n.length===2)return Z(n[1],n[0]);{const[t,e]=ln(n),o=Z(e,t);return o.empty?Z(n):o}}function Z(n,t,e){const o=Sn(n),r=m(t||""),i=m(e||"");if(o.empty||t&&r.empty||e&&i.empty)return gn;const a=D(r.pc,i.pc),s=o.intervals.indexOf(a)+1;if(!i.empty&&!s)return gn;const c=Array.from(o.intervals);for(let M=1;MP(r,M));n=o.aliases.indexOf(n)!==-1?n:o.aliases[0];const u=`${r.empty?"":r.pc}${n}${i.empty||s<=1?"":"/"+i.pc}`,d=`${t?r.pc+" ":""}${o.name}${s>1&&e?" over "+i.pc:""}`;return{...o,name:d,symbol:u,type:o.name,root:i.name,intervals:c,rootDegree:s,tonic:r.name,notes:l}}const co=g("Chord.chord","Chord.get",U);function mo(n,t){const[e,o]=ln(n);return e?P(e,t)+o:n}function uo(n){const t=U(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function lo(n){const t=U(n),e=cn(t.chroma);return k().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}function Mo(n){const t=U(n),e=sn(t.chroma);return k().filter(o=>e(o.chroma)).map(o=>t.tonic+o.aliases[0])}var fo={getChord:Z,get:U,detect:Je,chordScales:uo,extended:lo,reduced:Mo,tokenize:ln,transpose:mo,chord:co};const Po=[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]],dn=[];Po.forEach(([n,t,e])=>$o(n,t,e));const po={empty:!0,name:"",value:0,fraction:[0,0],shorthand:"",dots:"",names:[]};function ho(){return dn.reduce((n,t)=>(t.names.forEach(e=>n.push(e)),n),[])}function yo(){return dn.map(n=>n.shorthand)}const go=/^([^.]+)(\.*)$/;function Tn(n){const[t,e,o]=go.exec(n)||[],r=dn.find(s=>s.shorthand===e||s.names.includes(e));if(!r)return po;const i=No(r.fraction,o.length),a=i[0]/i[1];return{...r,name:n,dots:o,value:a,fraction:i}}const bo=n=>Tn(n).value,Ao=n=>Tn(n).fraction;var vo={names:ho,shorthands:yo,get:Tn,value:bo,fraction:Ao};function $o(n,t,e){dn.push({empty:!1,dots:"",name:"",value:1/n,fraction:n<1?[1/n,1]:[1,n],shorthand:t,names:e})}function No(n,t){const e=Math.pow(2,t);let o=n[0]*e,r=n[1]*e;const i=o;for(let a=0;af(n).name,So=n=>f(n).semitones,To=n=>f(n).q,Vo=n=>f(n).num;function ft(n){const t=f(n);return t.empty?"":t.simple+t.q}function _o(n){const t=f(n);if(t.empty)return"";const e=(7-t.step)%7,o=t.type==="perfectable"?-t.alt:-(t.alt+1);return f({step:e,alt:o,oct:t.oct,dir:t.dir}).name}const Co=[1,2,2,3,3,4,5,5,6,6,7,7],wo="P m M m M P d P m M m M".split(" ");function xo(n){const t=n<0?-1:1,e=Math.abs(n),o=e%12,r=Math.floor(e/12);return t*(Co[o]+7*r)+wo[o]}const Eo=D,Pt=ht((n,t)=>[n[0]+t[0],n[1]+t[1]]),Do=n=>t=>Pt(n,t),Ro=ht((n,t)=>[n[0]-t[0],n[1]-t[1]]);function pt(n,t){const e=Mt(n);if(e.empty)return"";const[o,r,i]=e.coord;return B([o+t,r,i]).name}var bn={names:Io,get:Mt,name:jo,num:Vo,semitones:So,quality:To,fromSemitones:xo,distance:Eo,invert:_o,simplify:ft,add:Pt,addTo:Do,substract:Ro,transposeFifths:pt};function ht(n){return(t,e)=>{const o=f(t).coord,r=f(e).coord;if(o&&r){const i=n(o,r);return B(i).name}}}function yt(n){return+n>=0&&+n<=127}function gt(n){if(yt(n))return+n;const t=m(n);return t.empty?null:t.midi}function ko(n,t=440){return Math.pow(2,(n-69)/12)*t}const Oo=Math.log(2),Fo=Math.log(440);function Vn(n){const t=12*(Math.log(n)-Fo)/Oo+69;return Math.round(t*100)/100}const zo="C C# D D# E F F# G G# A A# B".split(" "),qo="C Db D Eb E F Gb G Ab A Bb B".split(" ");function I(n,t={}){if(isNaN(n)||n===-1/0||n===1/0)return"";n=Math.round(n);const o=(t.sharps===!0?zo:qo)[n%12];if(t.pitchClass)return o;const r=Math.floor(n/12)-1;return o+r}var Go={isMidi:yt,toMidi:gt,midiToFreq:ko,midiToNoteName:I,freqToMidi:Vn};const Bo=["C","D","E","F","G","A","B"],bt=n=>n.name,At=n=>n.map(m).filter(t=>!t.empty);function Ho(n){return n===void 0?Bo.slice():Array.isArray(n)?At(n).map(bt):[]}const y=m,Lo=n=>y(n).name,Uo=n=>y(n).pc,Xo=n=>y(n).acc,Ko=n=>y(n).oct,Qo=n=>y(n).midi,Yo=n=>y(n).freq,Zo=n=>y(n).chroma;function vt(n){return I(n)}function Jo(n){return I(Vn(n))}function Wo(n){return I(Vn(n),{sharps:!0})}function nr(n){return I(n,{sharps:!0})}const _n=P,tr=P,$t=n=>t=>_n(t,n),er=$t,Nt=n=>t=>_n(n,t),or=Nt;function nn(n,t){const e=y(n);if(e.empty)return"";const[o,r]=e.coord;return F(r===void 0?[o+t]:[o+t,r]).name}const rr=nn,Cn=(n,t)=>n.height-t.height,ir=(n,t)=>t.height-n.height;function It(n,t){return t=t||Cn,At(n).sort(t).map(bt)}function jt(n){return It(n,Cn).filter((t,e,o)=>e===0||t!==o[e-1])}const ar=n=>{const t=y(n);return t.empty?"":I(t.midi||t.chroma,{sharps:t.alt>0,pitchClass:t.midi===null})};function St(n,t){const e=y(n);if(e.empty)return"";const o=y(t||I(e.midi||e.chroma,{sharps:e.alt<0,pitchClass:!0}));if(o.empty||o.chroma!==e.chroma)return"";if(e.oct===void 0)return o.pc;const r=e.chroma-e.alt,i=o.chroma-o.alt,a=r>11||i<0?-1:r<0||i>11?1:0,s=e.oct+a;return o.pc+s}var w={names:Ho,get:y,name:Lo,pitchClass:Uo,accidentals:Xo,octave:Ko,midi:Qo,ascending:Cn,descending:ir,sortedNames:It,sortedUniqNames:jt,fromMidi:vt,fromMidiSharps:nr,freq:Yo,fromFreq:Jo,fromFreqSharps:Wo,chroma:Zo,transpose:_n,tr,transposeBy:$t,trBy:er,transposeFrom:Nt,trFrom:or,transposeFifths:nn,trFifths:rr,simplify:ar,enharmonic:St};const Tt={empty:!0,name:"",chordType:""},qn={};function $(n){return typeof n=="string"?qn[n]||(qn[n]=Mr(n)):typeof n=="number"?$(Mn[n]||""):q(n)?mr(n):z(n)?$(n.name):Tt}const sr=g("RomanNumeral.romanNumeral","RomanNumeral.get",$);function cr(n=!0){return(n?Mn:dr).slice()}function mr(n){return $(E(n.alt)+Mn[n.step])}const ur=/^(#{1,}|b{1,}|x{1,}|)(IV|I{1,3}|VI{0,2}|iv|i{1,3}|vi{0,2})([^IViv]*)$/;function lr(n){return ur.exec(n)||["","","",""]}const Vt="I II III IV V VI VII",Mn=Vt.split(" "),dr=Vt.toLowerCase().split(" ");function Mr(n){const[t,e,o,r]=lr(n);if(!o)return Tt;const i=o.toUpperCase(),a=Mn.indexOf(i),s=G(e),c=1;return{empty:!1,name:t,roman:o,interval:f({step:a,alt:s,dir:c}).name,acc:e,chordType:r,alt:s,step:a,major:o===i,oct:0,dir:c}}var fr={names:cr,get:$,romanNumeral:sr};const b=Object.freeze([]),_t={type:"major",tonic:"",alteration:0,keySignature:""},J={tonic:"",grades:b,intervals:b,scale:b,chords:b,chordsHarmonicFunction:b,chordScales:b},Pr={..._t,...J,type:"major",minorRelative:"",scale:b,secondaryDominants:b,secondaryDominantsMinorRelative:b,substituteDominants:b,substituteDominantsMinorRelative:b},pr={..._t,type:"minor",relativeMajor:"",natural:J,harmonic:J,melodic:J},Gn=(n,t,e="")=>t.map((o,r)=>`${n[r]}${e}${o}`);function fn(n,t,e,o){return r=>{const i=n.map(s=>$(s).interval||""),a=i.map(s=>P(r,s));return{tonic:r,grades:n,intervals:i,scale:a,chords:Gn(a,t),chordsHarmonicFunction:e.slice(),chordScales:Gn(a,o," ")}}}const Ct=(n,t)=>{const e=m(n),o=m(t);return e.empty||o.empty?0:o.coord[0]-e.coord[0]},hr=fn("I II III IV V VI VII".split(" "),"maj7 m7 m7 maj7 7 m7 m7b5".split(" "),"T SD T SD D T D".split(" "),"major,dorian,phrygian,lydian,mixolydian,minor,locrian".split(",")),yr=fn("I II bIII IV V bVI bVII".split(" "),"m7 m7b5 maj7 m7 m7 maj7 7".split(" "),"T SD T SD D SD SD".split(" "),"minor,locrian,major,dorian,phrygian,lydian,mixolydian".split(",")),gr=fn("I II bIII IV V bVI VII".split(" "),"mMaj7 m7b5 +maj7 m7 7 maj7 o7".split(" "),"T SD T SD D SD D".split(" "),"harmonic minor,locrian 6,major augmented,lydian diminished,phrygian dominant,lydian #9,ultralocrian".split(",")),br=fn("I II bIII IV V VI VII".split(" "),"m6 m7 +maj7 7 7 m7b5 m7b5".split(" "),"T SD T SD D ".split(" "),"melodic minor,dorian b2,lydian augmented,lydian dominant,mixolydian b6,locrian #2,altered".split(","));function Ar(n){const t=m(n).pc;if(!t)return Pr;const e=hr(t),o=Ct("C",t),r=i=>{const a=$(i);return a.empty?"":P(n,a.interval)+a.chordType};return{...e,type:"major",minorRelative:P(t,"-3m"),alteration:o,keySignature:E(o),secondaryDominants:"- VI7 VII7 I7 II7 III7 -".split(" ").map(r),secondaryDominantsMinorRelative:"- IIIm7b5 IV#m7 Vm7 VIm7 VIIm7b5 -".split(" ").map(r),substituteDominants:"- bIII7 IV7 bV7 bVI7 bVII7 -".split(" ").map(r),substituteDominantsMinorRelative:"- IIIm7 Im7 IIbm7 VIm7 IVm7 -".split(" ").map(r)}}function vr(n){const t=m(n).pc;if(!t)return pr;const e=Ct("C",t)-3;return{type:"minor",tonic:t,relativeMajor:P(t,"3m"),alteration:e,keySignature:E(e),natural:yr(t),harmonic:gr(t),melodic:br(t)}}function $r(n){return typeof n=="number"?nn("C",n):typeof n=="string"&&/^b+|#+$/.test(n)?nn("C",G(n)):null}var Nr={majorKey:Ar,majorTonicFromKeySignature:$r,minorKey:vr};const wn=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]],Bn={...T,name:"",alt:0,modeNum:NaN,triad:"",seventh:"",aliases:[]},xn=wn.map(Tr),An={};xn.forEach(n=>{An[n.name]=n,n.aliases.forEach(t=>{An[t]=n})});function V(n){return typeof n=="string"?An[n.toLowerCase()]||Bn:n&&n.name?V(n.name):Bn}const Ir=g("Mode.mode","Mode.get",V);function wt(){return xn.slice()}const jr=g("Mode.mode","Mode.all",wt);function Sr(){return xn.map(n=>n.name)}function Tr(n){const[t,e,o,r,i,a,s]=n,c=s?[s]:[],l=Number(e).toString(2);return{empty:!1,intervals:un(r).intervals,modeNum:t,chroma:l,normalized:l,name:r,setNum:e,alt:o,triad:i,seventh:a,aliases:c}}function Vr(n,t){return V(n).intervals.map(e=>P(t,e))}function xt(n){return(t,e)=>{const o=V(t);if(o.empty)return[];const r=H(o.modeNum,n),i=o.intervals.map(a=>P(e,a));return r.map((a,s)=>i[s]+a)}}const _r=xt(wn.map(n=>n[4])),Cr=xt(wn.map(n=>n[5]));function Et(n,t){const e=V(t),o=V(n);return e.empty||o.empty?"":ft(pt("1P",o.alt-e.alt))}function wr(n,t,e){return P(e,Et(n,t))}var xr={get:V,names:Sr,all:wt,distance:Et,relativeTonic:wr,notes:Vr,triads:_r,seventhChords:Cr,entries:jr,mode:Ir};function Er(n,t){return t.map($).map(o=>P(n,f(o))+o.chordType)}function Dr(n,t){return t.map(e=>{const[o,r]=ln(e),i=D(n,o);return $(f(i)).name+r})}var Rr={fromRomanNumerals:Er,toRomanNumerals:Dr};function Dt(n){const t=Nn(n.map(gt));return!n.length||t.length!==n.length?[]:t.reduce((e,o)=>{const r=e[e.length-1];return e.concat(an(r,o).slice(1))},[t[0]])}function kr(n,t){return Dt(n).map(e=>I(e,t))}var Or={numeric:Dt,chromatic:kr};const Fr={empty:!0,name:"",type:"",tonic:null,setNum:NaN,chroma:"",normalized:"",aliases:[],notes:[],intervals:[]};function Rt(n){if(typeof n!="string")return["",""];const t=n.indexOf(" "),e=m(n.substring(0,t));if(e.empty){const r=m(n);return r.empty?["",n]:[r.name,""]}const o=n.substring(e.name.length+1);return[e.name,o.length?o:""]}const zr=ut;function N(n){const t=Array.isArray(n)?n:Rt(n),e=m(t[0]).name,o=un(t[1]);if(o.empty)return Fr;const r=o.name,i=e?o.intervals.map(s=>P(e,s)):[],a=e?e+" "+r:r;return{...o,name:a,type:r,tonic:e,notes:i}}const qr=g("Scale.scale","Scale.get",N);function Gr(n){const t=N(n),e=sn(t.chroma);return k().filter(o=>e(o.chroma)).map(o=>o.aliases[0])}function Br(n){const t=N(n),e=cn(t.chroma);return L().filter(o=>e(o.chroma)).map(o=>o.name)}function Hr(n){const t=sn(N(n).chroma);return L().filter(e=>t(e.chroma)).map(e=>e.name)}function kt(n){const t=n.map(r=>m(r).pc).filter(r=>r),e=t[0],o=jt(t);return H(o.indexOf(e),o)}function Lr(n){const t=N(n);if(t.empty)return[];const e=t.tonic?t.notes:t.intervals;return jn(t.chroma).map((o,r)=>{const i=N(o).name;return i?[e[r],i]:["",""]}).filter(o=>o[0])}function Ur(n){const t=Array.isArray(n)?kt(n):N(n).notes,e=t.map(o=>m(o).chroma);return o=>{const r=m(typeof o=="number"?vt(o):o),i=r.height;if(i===void 0)return;const a=i%12,s=e.indexOf(a);if(s!==-1)return St(r.name,t[s])}}function Xr(n){const t=Ur(n);return(e,o)=>{const r=m(e).height,i=m(o).height;return r===void 0||i===void 0?[]:an(r,i).map(t).filter(a=>a)}}var tn={get:N,names:zr,extended:Br,modeNames:Lr,reduced:Hr,scaleChords:Gr,scaleNotes:kt,tokenize:Rt,rangeOf:Xr,scale:qr};const Kr={empty:!0,name:"",upper:void 0,lower:void 0,type:void 0,additive:[]},Qr=["4/4","3/4","2/4","2/2","12/8","9/8","6/8","3/8"];function Yr(){return Qr.slice()}const Zr=/^(\d?\d(?:\+\d)*)\/(\d)$/,Hn=new Map;function Jr(n){const t=Hn.get(n);if(t)return t;const e=ni(En(n));return Hn.set(n,e),e}function En(n){if(typeof n=="string"){const[i,a,s]=Zr.exec(n)||[];return En([a,s])}const[t,e]=n,o=+e;if(typeof t=="number")return[t,o];const r=t.split("+").map(i=>+i);return r.length===1?[r[0],o]:[r,o]}var Wr={names:Yr,parse:En,get:Jr};function ni([n,t]){const e=Array.isArray(n)?n.reduce((s,c)=>s+c,0):n,o=t;if(e===0||o===0)return Kr;const r=Array.isArray(n)?`${n.join("+")}/${t}`:`${n}/${t}`,i=Array.isArray(n)?n:[],a=o===4||o===2?"simple":o===8&&e%3===0?"compound":"irregular";return{empty:!1,name:r,type:a,upper:e,lower:o,additive:i}}const ti=Wn,ei=st,oi=mt,ri=dt,ii=Object.freeze(Object.defineProperty({__proto__:null,Array:Ae,Core:Wn,ChordDictionary:oi,PcSet:ei,ScaleDictionary:ri,Tonal:ti,AbcNotation:Me,Chord:fo,ChordType:mt,Collection:Ie,DurationValue:vo,Interval:bn,Key:Nr,Midi:Go,Mode:xr,Note:w,Pcset:st,Progression:Rr,Range:Or,RomanNumeral:fr,Scale:tn,ScaleType:dt,TimeSignature:Wr,accToAlt:G,altToAcc:E,coordToInterval:B,coordToNote:F,decode:on,deprecate:g,distance:D,encode:en,fillStr:C,interval:f,isNamed:z,isPitch:q,note:m,stepToLetter:vn,tokenizeInterval:$n,tokenizeNote:rn,transpose:P},Symbol.toStringTag,{value:"Module"}));function Ot(n,t,e){let[o,r]=tn.tokenize(n),{notes:i}=tn.get(`${o} ${r}`);if(i=i.map(h=>w.get(h).pc),t=Number(t),isNaN(t))throw new Error(`scale offset "${t}" not a number`);const{pc:a,oct:s=3}=w.get(e),c=i.indexOf(a);if(c===-1)throw new Error(`note "${e}" is not in scale "${n}"`);let l=c,u=s,d=a;const M=Math.sign(t);for(;Math.abs(l-c)0&&d[0]==="C"&&(u+=M)}return d+u}_.prototype._transpose=function(n){return this._withHap(t=>{const e=isNaN(Number(n))?String(n):bn.fromSemitones(n);if(typeof t.value=="number"){const o=typeof e=="string"?bn.semitones(e)||0:e;return t.withValue(()=>t.value+o)}return t.withValue(()=>w.simplify(w.transpose(t.value,e)))})};_.prototype._scaleTranspose=function(n){return this._withHap(t=>{if(!t.context.scale)throw new Error("can only use scaleTranspose after .scale");if(typeof t.value!="string")throw new Error("can only use scaleTranspose with notes");return t.withValue(()=>Ot(t.context.scale,Number(n),t.value))})};_.prototype._scale=function(n){return this._withHap(t=>{let e=t.value;const o=Number(e);if(!isNaN(o)){let[r,i]=tn.tokenize(n);const{pc:a,oct:s=3}=w.get(r);e=Ot(a+" "+i,o,a+s)}return t.withValue(()=>e).setContext({...t.context,scale:n})})};_.prototype.define("transpose",(n,t)=>t.transpose(n),{composable:!0,patternified:!0});_.prototype.define("scale",(n,t)=>t.scale(n),{composable:!0,patternified:!0});_.prototype.define("scaleTranspose",(n,t)=>t.scaleTranspose(n),{composable:!0,patternified:!0});var Ft={},hn={},X={};X.__esModule=!0;X.getBestVoicing=void 0;function ai(n){var t=n.chord,e=n.range,o=n.finder,r=n.picker,i=n.lastVoicing,a=o(t,e);return a.length?r(a,i):[]}X.getBestVoicing=ai;var O={};const zt=Ut(ii);var K={};K.__esModule=!0;K.tokenizeChord=void 0;function si(n){var t=(n||"").match(/^([A-G][b#]*)([^\/]*)[\/]?([A-G][b#]*)?$/);return t?t.slice(1):[]}K.tokenizeChord=si;var Ln;function ci(){if(Ln)return O;Ln=1,O.__esModule=!0,O.voicingsInRange=void 0;var n=zt,t=qt(),e=K;function o(r,i,a){i===void 0&&(i=t.lefthand),a===void 0&&(a=["D3","A4"]);var s=(0,e.tokenizeChord)(r),c=s[0],l=s[1];if(!i[l])return[];var u=i[l].map(function(M){return M.split(" ")}),d=n.Range.chromatic(a);return u.reduce(function(M,h){var A=h.map(function(v){return n.Interval.substract(v,h[0])}),Q=n.Note.transpose(c,h[0]),Gt=d.filter(function(v){return n.Note.chroma(v)===n.Note.chroma(Q)}).filter(function(v){return n.Note.midi(n.Note.transpose(v,A[A.length-1]))<=n.Note.midi(a[1])}).map(function(v){return n.Note.enharmonic(v,Q)}),Bt=Gt.map(function(v){return A.map(function(Ht){return n.Note.transpose(v,Ht)})});return M.concat(Bt)},[])}return O.voicingsInRange=o,O}var Un;function qt(){return Un||(Un=1,function(n){var t=Y&&Y.__assign||function(){return t=Object.assign||function(s){for(var c,l=1,u=arguments.length;lui({chord:n,dictionary:di,range:e,picker:li,lastVoicing:t}),x=_;x.prototype.fmapNested=function(n){return new x(t=>this.query(t).map(e=>Kt(n(e)).query(t).map(o=>new Qt(e.whole,e.part,o.value,o.context))).flat())};x.prototype.voicings=function(n){let t;return n!=null&&n.length||(n=["F3","A4"]),this.fmapNested(e=>(t=Mi(e.value,t,n),Yt(...t)._withContext(()=>({locations:e.context.locations||[]}))))};x.prototype._rootNotes=function(n=2){return this.fmap(t=>{const[e,o]=t.match(/^([a-gA-G][b#]?).*$/);return o+n})};x.prototype.define("voicings",(n,t)=>t.voicings(n),{composable:!0});x.prototype.define("rootNotes",(n,t)=>t.rootNotes(n),{composable:!0,patternified:!0}); diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.b12de8ae.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.b12de8ae.js deleted file mode 100644 index c001b094..00000000 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.b12de8ae.js +++ /dev/null @@ -1 +0,0 @@ -import{g as s,b as d,e as t,j as u,l as o,f as r,p as f,i as p,d as g,h as i,w as l,a as m}from"./index.f17ed672.js";export{s as getAudioContext,d as getCachedBuffer,t as getLoadedBuffer,u as getLoadedSamples,o as loadBuffer,r as loadGithubSamples,f as panic,p as resetLoadedSamples,g as reverseBuffer,i as samples,l as webaudioOutput,m as webaudioOutputTrigger}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.b258159a.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.b258159a.js new file mode 100644 index 00000000..5856669c --- /dev/null +++ b/packages/core/examples/vite-vanilla-repl/dist/assets/index.b258159a.js @@ -0,0 +1 @@ +import{g as s,f as d,i as t,n as r,l as u,j as o,d as f,k as p,r as g,s as i,w as l,e as m}from"./index.73313bf6.js";export{s as getAudioContext,d as getCachedBuffer,t as getLoadedBuffer,r as getLoadedSamples,u as loadBuffer,o as loadGithubSamples,f as panic,p as resetLoadedSamples,g as reverseBuffer,i as samples,l as webaudioOutput,m as webaudioOutputTrigger}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.f09cc89e.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.f09cc89e.js deleted file mode 100644 index e9a84427..00000000 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.f09cc89e.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as ut,r as Se,s as pt}from"./index.f17ed672.js";function gt(a,c){function r(){this.constructor=a}r.prototype=c.prototype,a.prototype=new r}function D(a,c,r,_){var p=Error.call(this,a);return Object.setPrototypeOf&&Object.setPrototypeOf(p,D.prototype),p.expected=c,p.found=r,p.location=_,p.name="SyntaxError",p}gt(D,Error);function U(a,c,r){return r=r||" ",a.length>c?a:(c-=a.length,r+=r.repeat(c),a+r.slice(0,c))}D.prototype.format=function(a){var c="Error: "+this.message;if(this.location){var r=null,_;for(_=0;_ `+$+` -`+A+` | -`+p.line+" | "+E+` -`+A+" | "+U("",p.column-1," ")+U("",h,"^")}else c+=` - at `+$}return c};D.buildMessage=function(a,c){var r={literal:function(m){return'"'+p(m.text)+'"'},class:function(m){var h=m.parts.map(function(b){return Array.isArray(b)?$(b[0])+"-"+$(b[1]):$(b)});return"["+(m.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(m){return m.description}};function _(m){return m.charCodeAt(0).toString(16).toUpperCase()}function p(m){return m.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+_(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+_(h)})}function $(m){return m.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(h){return"\\x0"+_(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+_(h)})}function w(m){return r[m.type](m)}function A(m){var h=m.map(w),b,F;if(h.sort(),h.length>0){for(b=1,F=1;b",Me="@",We="!",Ze="(",Ge=")",Ue="/",Xe="*",He="%",Je="?",V="struct",Y="target",ee="euclid",re="slow",se="rotL",te="rotR",ne="fast",ae="scale",ie="//",fe="cat",Ke="$",oe="setcps",ce="setbpm",le="hush",Qe=/^[1-9]/,Ve=/^[eE]/,Ye=/^[0-9]/,ue=/^[ \n\r\t]/,er=/^[0-9a-zA-Z~]/,pe=/^[^\n]/,rr=Ae("number"),ge=g(".",!1),sr=j([["1","9"]],!1,!1),tr=j(["e","E"],!1,!1),ve=g("-",!1),nr=g("+",!1),ar=g("0",!1),ir=j([["0","9"]],!1,!1),fr=Ae("whitespace"),$e=j([" ",` -`,"\r"," "],!1,!1),or=g(",",!1),cr=g("|",!1),lr=g('"',!1),ur=g("'",!1),pr=j([["0","9"],["a","z"],["A","Z"],"~"],!1,!1),gr=g("#",!1),vr=g("^",!1),$r=g("_",!1),hr=g(":",!1),he=g("[",!1),me=g("]",!1),mr=g("<",!1),_r=g(">",!1),dr=g("@",!1),Ar=g("!",!1),wr=g("(",!1),yr=g(")",!1),br=g("/",!1),Cr=g("*",!1),xr=g("%",!1),Er=g("?",!1),Fr=g("struct",!1),jr=g("target",!1),Sr=g("euclid",!1),Rr=g("slow",!1),Pr=g("rotL",!1),Or=g("rotR",!1),qr=g("fast",!1),Ir=g("scale",!1),Dr=g("//",!1),_e=j([` -`],!0,!1),kr=g("cat",!1),Nr=g("$",!1),Br=g("setcps",!1),Tr=g("setbpm",!1),zr=g("hush",!1),Lr=function(){return parseFloat(As())},Mr=function(e){return e.join("")},Wr=function(e){return e},Zr=function(e){return e.arguments_.alignment="t",e},Gr=function(e){return{weight:e}},Ur=function(e){return{replicate:e}},Xr=function(e,t,n){return{operator:{type_:"bjorklund",arguments_:{pulse:e,step:t,rotation:n||0}}}},Hr=function(e){return{operator:{type_:"stretch",arguments_:{amount:e}}}},Jr=function(e){return{operator:{type_:"stretch",arguments_:{amount:"1/"+e}}}},Kr=function(e){return{operator:{type_:"fixed-step",arguments_:{amount:e}}}},Qr=function(e){return{operator:{type_:"degradeBy",arguments_:{amount:e||.5}}}},Vr=function(e,t){return new lt(e,t)},Yr=function(e){return new Z(e,"h")},es=function(e){return{alignment:"v",list:e}},rs=function(e){return{alignment:"r",list:e}},ss=function(e,t){return t&&t.list.length>0?new Z([e,...t.list],t.alignment):e},ts=function(e){return e},ns=function(e){return{name:"struct",args:{sequence:e}}},as=function(e){return{name:"target",args:{name:e}}},is=function(e,t,n){return{name:"bjorklund",args:{pulse:parseInt(e),step:parseInt(t)}}},fs=function(e){return{name:"stretch",args:{amount:e}}},os=function(e){return{name:"shift",args:{amount:"-"+e}}},cs=function(e){return{name:"shift",args:{amount:e}}},ls=function(e){return{name:"stretch",args:{amount:"1/"+e}}},us=function(e){return{name:"scale",args:{scale:e.join("")}}},de=function(e,t){return t},ps=function(e,t){return t.unshift(e),new Z(t,"t")},gs=function(e){return e},vs=function(e,t){return new ct(e.name,e.args,t)},$s=function(e){return e},hs=function(e){return e},ms=function(e){return new G("setcps",{value:e})},_s=function(e){return new G("setcps",{value:e/120/2})},ds=function(){return new G("hush")},s=0,v=0,N=[{line:1,column:1}],x=0,L=[],f=0,B;if("startRule"in c){if(!(c.startRule in p))throw new Error(`Can't start parsing from rule "`+c.startRule+'".');$=p[c.startRule]}function As(){return a.substring(v,s)}function ws(){return M(v,s)}function g(e,t){return{type:"literal",text:e,ignoreCase:t}}function j(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function ys(){return{type:"end"}}function Ae(e){return{type:"other",description:e}}function we(e){var t=N[e],n;if(t)return t;for(n=e-1;!N[n];)n--;for(t=N[n],t={line:t.line,column:t.column};nx&&(x=s,L=[]),L.push(e))}function bs(e,t,n){return new D(D.buildMessage(e,t),e,t,n)}function ye(){var e;return e=ot(),e}function y(){var e,t;return f++,e=s,be(),t=T(),t!==r?(js(),Fs(),v=e,e=Lr()):(s=e,e=r),f--,e===r&&f===0&&o(rr),e}function Cs(){var e;return a.charCodeAt(s)===46?(e=w,s++):(e=r,f===0&&o(ge)),e}function xs(){var e;return Qe.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(sr)),e}function Es(){var e;return Ve.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(tr)),e}function Fs(){var e,t,n,i,l;if(e=s,t=Es(),t!==r){if(n=be(),n===r&&(n=Ss()),n===r&&(n=null),i=[],l=S(),l!==r)for(;l!==r;)i.push(l),l=S();else i=r;i!==r?(t=[t,n,i],e=t):(s=e,e=r)}else s=e,e=r;return e}function js(){var e,t,n,i;if(e=s,t=Cs(),t!==r){if(n=[],i=S(),i!==r)for(;i!==r;)n.push(i),i=S();else n=r;n!==r?(t=[t,n],e=t):(s=e,e=r)}else s=e,e=r;return e}function T(){var e,t,n,i;if(e=Rs(),e===r)if(e=s,t=xs(),t!==r){for(n=[],i=S();i!==r;)n.push(i),i=S();t=[t,n],e=t}else s=e,e=r;return e}function be(){var e;return a.charCodeAt(s)===45?(e=A,s++):(e=r,f===0&&o(ve)),e}function Ss(){var e;return a.charCodeAt(s)===43?(e=E,s++):(e=r,f===0&&o(nr)),e}function Rs(){var e;return a.charCodeAt(s)===48?(e=m,s++):(e=r,f===0&&o(ar)),e}function S(){var e;return Ye.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(ir)),e}function u(){var e,t;for(f++,e=[],ue.test(a.charAt(s))?(t=a.charAt(s),s++):(t=r,f===0&&o($e));t!==r;)e.push(t),ue.test(a.charAt(s))?(t=a.charAt(s),s++):(t=r,f===0&&o($e));return f--,t=r,f===0&&o(fr),e}function R(){var e,t,n,i;return e=s,t=u(),a.charCodeAt(s)===44?(n=h,s++):(n=r,f===0&&o(or)),n!==r?(i=u(),t=[t,n,i],e=t):(s=e,e=r),e}function Ce(){var e,t,n,i;return e=s,t=u(),a.charCodeAt(s)===124?(n=b,s++):(n=r,f===0&&o(cr)),n!==r?(i=u(),t=[t,n,i],e=t):(s=e,e=r),e}function P(){var e;return a.charCodeAt(s)===34?(e=F,s++):(e=r,f===0&&o(lr)),e===r&&(a.charCodeAt(s)===39?(e=De,s++):(e=r,f===0&&o(ur))),e}function z(){var e;return er.test(a.charAt(s))?(e=a.charAt(s),s++):(e=r,f===0&&o(pr)),e===r&&(a.charCodeAt(s)===45?(e=A,s++):(e=r,f===0&&o(ve)),e===r&&(a.charCodeAt(s)===35?(e=ke,s++):(e=r,f===0&&o(gr)),e===r&&(a.charCodeAt(s)===46?(e=w,s++):(e=r,f===0&&o(ge)),e===r&&(a.charCodeAt(s)===94?(e=Ne,s++):(e=r,f===0&&o(vr)),e===r&&(a.charCodeAt(s)===95?(e=Be,s++):(e=r,f===0&&o($r)),e===r&&(a.charCodeAt(s)===58?(e=Te,s++):(e=r,f===0&&o(hr)))))))),e}function xe(){var e,t,n;if(e=s,u(),t=[],n=z(),n!==r)for(;n!==r;)t.push(n),n=z();else t=r;return t!==r?(n=u(),v=e,e=Mr(t)):(s=e,e=r),e}function Ps(){var e,t,n,i;return e=s,u(),a.charCodeAt(s)===91?(t=K,s++):(t=r,f===0&&o(he)),t!==r?(u(),n=Fe(),n!==r?(u(),a.charCodeAt(s)===93?(i=Q,s++):(i=r,f===0&&o(me)),i!==r?(u(),v=e,e=Wr(n)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Os(){var e,t,n,i;return e=s,u(),a.charCodeAt(s)===60?(t=ze,s++):(t=r,f===0&&o(mr)),t!==r?(u(),n=O(),n!==r?(u(),a.charCodeAt(s)===62?(i=Le,s++):(i=r,f===0&&o(_r)),i!==r?(u(),v=e,e=Zr(n)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function qs(){var e;return e=xe(),e===r&&(e=Ps(),e===r&&(e=Os())),e}function Is(){var e;return e=Ds(),e===r&&(e=Ns(),e===r&&(e=Bs(),e===r&&(e=Ts(),e===r&&(e=zs(),e===r&&(e=ks(),e===r&&(e=Ls())))))),e}function Ds(){var e,t,n;return e=s,a.charCodeAt(s)===64?(t=Me,s++):(t=r,f===0&&o(dr)),t!==r?(n=y(),n!==r?(v=e,e=Gr(n)):(s=e,e=r)):(s=e,e=r),e}function ks(){var e,t,n;return e=s,a.charCodeAt(s)===33?(t=We,s++):(t=r,f===0&&o(Ar)),t!==r?(n=y(),n!==r?(v=e,e=Ur(n)):(s=e,e=r)):(s=e,e=r),e}function Ns(){var e,t,n,i,l,d,C;return e=s,a.charCodeAt(s)===40?(t=Ze,s++):(t=r,f===0&&o(wr)),t!==r?(u(),n=y(),n!==r?(u(),i=R(),i!==r?(u(),l=y(),l!==r?(u(),R(),u(),d=y(),d===r&&(d=null),u(),a.charCodeAt(s)===41?(C=Ge,s++):(C=r,f===0&&o(yr)),C!==r?(v=e,e=Xr(n,l,d)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Bs(){var e,t,n;return e=s,a.charCodeAt(s)===47?(t=Ue,s++):(t=r,f===0&&o(br)),t!==r?(n=y(),n!==r?(v=e,e=Hr(n)):(s=e,e=r)):(s=e,e=r),e}function Ts(){var e,t,n;return e=s,a.charCodeAt(s)===42?(t=Xe,s++):(t=r,f===0&&o(Cr)),t!==r?(n=y(),n!==r?(v=e,e=Jr(n)):(s=e,e=r)):(s=e,e=r),e}function zs(){var e,t,n;return e=s,a.charCodeAt(s)===37?(t=He,s++):(t=r,f===0&&o(xr)),t!==r?(n=y(),n!==r?(v=e,e=Kr(n)):(s=e,e=r)):(s=e,e=r),e}function Ls(){var e,t,n;return e=s,a.charCodeAt(s)===63?(t=Je,s++):(t=r,f===0&&o(Er)),t!==r?(n=y(),n===r&&(n=null),v=e,e=Qr(n)):(s=e,e=r),e}function Ee(){var e,t,n;return e=s,t=qs(),t!==r?(n=Is(),n===r&&(n=null),v=e,e=Vr(t,n)):(s=e,e=r),e}function O(){var e,t,n;if(e=s,t=[],n=Ee(),n!==r)for(;n!==r;)t.push(n),n=Ee();else t=r;return t!==r&&(v=e,t=Yr(t)),e=t,e}function Ms(){var e,t,n,i,l;if(e=s,t=[],n=s,i=R(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r),n!==r)for(;n!==r;)t.push(n),n=s,i=R(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r);else t=r;return t!==r&&(v=e,t=es(t)),e=t,e}function Ws(){var e,t,n,i,l;if(e=s,t=[],n=s,i=Ce(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r),n!==r)for(;n!==r;)t.push(n),n=s,i=Ce(),i!==r?(l=O(),l!==r?n=l:(s=n,n=r)):(s=n,n=r);else t=r;return t!==r&&(v=e,t=rs(t)),e=t,e}function Fe(){var e,t,n;return e=s,t=O(),t!==r?(n=Ms(),n===r&&(n=Ws()),n===r&&(n=null),v=e,e=ss(t,n)):(s=e,e=r),e}function Zs(){var e,t,n,i;return e=s,u(),t=P(),t!==r?(n=Fe(),n!==r?(i=P(),i!==r?(v=e,e=ts(n)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Gs(){var e;return e=Ys(),e===r&&(e=Js(),e===r&&(e=Vs(),e===r&&(e=Xs(),e===r&&(e=Hs(),e===r&&(e=Us(),e===r&&(e=Qs(),e===r&&(e=Ks()))))))),e}function Us(){var e,t,n;return e=s,a.substr(s,6)===V?(t=V,s+=6):(t=r,f===0&&o(Fr)),t!==r?(u(),n=q(),n!==r?(v=e,e=ns(n)):(s=e,e=r)):(s=e,e=r),e}function Xs(){var e,t,n,i,l;return e=s,a.substr(s,6)===Y?(t=Y,s+=6):(t=r,f===0&&o(jr)),t!==r?(u(),n=P(),n!==r?(i=xe(),i!==r?(l=P(),l!==r?(v=e,e=as(i)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Hs(){var e,t,n,i;return e=s,a.substr(s,6)===ee?(t=ee,s+=6):(t=r,f===0&&o(Sr)),t!==r?(u(),n=T(),n!==r?(u(),i=T(),i!==r?(u(),T(),v=e,e=is(n,i)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r),e}function Js(){var e,t,n;return e=s,a.substr(s,4)===re?(t=re,s+=4):(t=r,f===0&&o(Rr)),t!==r?(u(),n=y(),n!==r?(v=e,e=fs(n)):(s=e,e=r)):(s=e,e=r),e}function Ks(){var e,t,n;return e=s,a.substr(s,4)===se?(t=se,s+=4):(t=r,f===0&&o(Pr)),t!==r?(u(),n=y(),n!==r?(v=e,e=os(n)):(s=e,e=r)):(s=e,e=r),e}function Qs(){var e,t,n;return e=s,a.substr(s,4)===te?(t=te,s+=4):(t=r,f===0&&o(Or)),t!==r?(u(),n=y(),n!==r?(v=e,e=cs(n)):(s=e,e=r)):(s=e,e=r),e}function Vs(){var e,t,n;return e=s,a.substr(s,4)===ne?(t=ne,s+=4):(t=r,f===0&&o(qr)),t!==r?(u(),n=y(),n!==r?(v=e,e=ls(n)):(s=e,e=r)):(s=e,e=r),e}function Ys(){var e,t,n,i,l;if(e=s,a.substr(s,5)===ae?(t=ae,s+=5):(t=r,f===0&&o(Ir)),t!==r)if(u(),n=P(),n!==r){if(i=[],l=z(),l!==r)for(;l!==r;)i.push(l),l=z();else i=r;i!==r?(l=P(),l!==r?(v=e,e=us(i)):(s=e,e=r)):(s=e,e=r)}else s=e,e=r;else s=e,e=r;return e}function W(){var e,t,n,i;if(e=s,a.substr(s,2)===ie?(t=ie,s+=2):(t=r,f===0&&o(Dr)),t!==r){for(n=[],pe.test(a.charAt(s))?(i=a.charAt(s),s++):(i=r,f===0&&o(_e));i!==r;)n.push(i),pe.test(a.charAt(s))?(i=a.charAt(s),s++):(i=r,f===0&&o(_e));t=[t,n],e=t}else s=e,e=r;return e}function et(){var e,t,n,i,l,d,C,I;if(e=s,a.substr(s,3)===fe?(t=fe,s+=3):(t=r,f===0&&o(kr)),t!==r)if(u(),a.charCodeAt(s)===91?(n=K,s++):(n=r,f===0&&o(he)),n!==r)if(u(),i=q(),i!==r){for(l=[],d=s,C=R(),C!==r?(I=q(),I!==r?(v=d,d=de(i,I)):(s=d,d=r)):(s=d,d=r);d!==r;)l.push(d),d=s,C=R(),C!==r?(I=q(),I!==r?(v=d,d=de(i,I)):(s=d,d=r)):(s=d,d=r);d=u(),a.charCodeAt(s)===93?(C=Q,s++):(C=r,f===0&&o(me)),C!==r?(v=e,e=ps(i,l)):(s=e,e=r)}else s=e,e=r;else s=e,e=r;else s=e,e=r;return e}function rt(){var e;return e=et(),e===r&&(e=Zs()),e}function q(){var e,t,n,i,l;if(e=s,t=rt(),t!==r){for(u(),n=[],i=W();i!==r;)n.push(i),i=W();v=e,e=gs(t)}else s=e,e=r;return e===r&&(e=s,t=Gs(),t!==r?(u(),a.charCodeAt(s)===36?(n=Ke,s++):(n=r,f===0&&o(Nr)),n!==r?(i=u(),l=q(),l!==r?(v=e,e=vs(t,l)):(s=e,e=r)):(s=e,e=r)):(s=e,e=r)),e}function st(){var e,t;return e=s,t=q(),t!==r&&(v=e,t=$s(t)),e=t,e===r&&(e=W()),e}function tt(){var e;return e=st(),e}function nt(){var e,t;return e=s,u(),t=at(),t===r&&(t=it(),t===r&&(t=ft())),t!==r?(u(),v=e,e=hs(t)):(s=e,e=r),e}function at(){var e,t,n;return e=s,a.substr(s,6)===oe?(t=oe,s+=6):(t=r,f===0&&o(Br)),t!==r?(u(),n=y(),n!==r?(v=e,e=ms(n)):(s=e,e=r)):(s=e,e=r),e}function it(){var e,t,n;return e=s,a.substr(s,6)===ce?(t=ce,s+=6):(t=r,f===0&&o(Tr)),t!==r?(u(),n=y(),n!==r?(v=e,e=_s(n)):(s=e,e=r)):(s=e,e=r),e}function ft(){var e,t;return e=s,a.substr(s,4)===le?(t=le,s+=4):(t=r,f===0&&o(zr)),t!==r&&(v=e,t=ds()),e=t,e}function ot(){var e;return e=tt(),e===r&&(e=nt()),e}var Z=function(e,t){this.type_="pattern",this.arguments_={alignment:t},this.source_=e},ct=function(e,t,n){this.type_=e,this.arguments_=t,this.source_=n},lt=function(e,t){this.type_="element",this.source_=e,this.options_=t,this.location_=ws()},G=function(e,t){this.type_="command",this.name_=e,this.options_=t};if(B=$(),B!==r&&s===a.length)return B;throw B!==r&&s(c,r)=>{const p=a.source_[r].options_,$=p==null?void 0:p.operator;if($){switch($.type_){case"stretch":const A=Pe($.arguments_.amount).inverse();return X(c).fast(A);case"bjorklund":return c.euclid($.arguments_.pulse,$.arguments_.step,$.arguments_.rotation);case"degradeBy":return X(c)._degradeByWith(Se.early(qe*Ie()).segment(1),$.arguments_.amount)}console.warn(`operator "${$.type_}" not implemented`)}if(p!=null&&p.weight)return c;const w=Object.keys(p||{}).filter(A=>A!=="operator");return w.length&&console.warn(`option${w.length>1?"s":""} ${w.map(A=>`"${A}"`).join(", ")} not implemented`),c};function At(a){a.source_=a.source_.map(c=>{const{replicate:r,..._}=c.options_||{};return r?{...c,options_:{..._,weight:r},source_:{type_:"pattern",arguments_:{alignment:"h"},source_:[{type_:"element",source_:c.source_,location_:c.location_,options_:{operator:{type_:"stretch",arguments_:{amount:Pe(r).inverse().toString()}}}}]}}:c})}function k(a){switch(a.type_){case"pattern":At(a);const c=a.source_.map(k).map(dt(a)),r=a.arguments_.alignment;if(r==="v")return $t(...c);if(r==="r")return ut(Se.early(qe*Ie()).segment(1),c);const _=a.source_.some(p=>{var $;return!!(($=p.options_)!=null&&$.weight)});if(!_&&r==="t")return ht(...c);if(_){const p=mt(...a.source_.map(($,w)=>{var A;return[((A=$.options_)==null?void 0:A.weight)||1,c[w]]}));if(r==="t"){const $=a.source_.reduce((w,A)=>{var E;return w+(((E=A.options_)==null?void 0:E.weight)||1)},0);return p._slow($)}return p}return Oe(...c);case"element":if(a.source_==="~")return je;if(typeof a.source_!="object"){if(!a.location_)return console.warn("no location for",a),a.source_;const{start:p,end:$}=a.location_,w=isNaN(Number(a.source_))?a.source_:Number(a.source_);return vt(w).withLocation([p.line,p.column,p.offset],[$.line,$.column,$.offset])}return k(a.source_);case"stretch":return k(a.source_).slow(a.arguments_.amount);default:return console.warn(`node type "${a.type_}" not implemented -> returning silence`),je}}const J=(...a)=>{const c=a.map(r=>{const _=Re(`"${r}"`);return k(_)});return Oe(...c)},wt=a=>{const c=Re(a);return k(c)};H.prototype.define("mini",J,{composable:!0});H.prototype.define("m",J,{composable:!0});H.prototype.define("h",wt,{composable:!0});function bt(a){return typeof a=="string"?J(a):X(a)}export{D as SyntaxError,wt as h,J as mini,bt as minify,Re as parse,k as patternifyAST}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/assets/index.f17ed672.js b/packages/core/examples/vite-vanilla-repl/dist/assets/index.f17ed672.js deleted file mode 100644 index 72891292..00000000 --- a/packages/core/examples/vite-vanilla-repl/dist/assets/index.f17ed672.js +++ /dev/null @@ -1,64 +0,0 @@ -var je=Object.defineProperty;var Ue=(e,t,r)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ge=(e,t,r)=>(Ue(e,typeof t!="symbol"?t+"":t,r),r);const strudel=Object.freeze(Object.defineProperty({__proto__:null,get Fraction(){return fraction},get controls(){return controls},get drawLine(){return drawLine},get gist(){return gist},get Hap(){return Hap},get Pattern(){return Pattern$2},get polyrhythm(){return polyrhythm},get pr(){return pr},get silence(){return silence},get pure(){return pure},get isPattern(){return isPattern$1},get reify(){return reify$1},get stack(){return stack},get slowcat(){return slowcat},get slowcatPrime(){return slowcatPrime},get fastcat(){return fastcat},get cat(){return cat},get timeCat(){return timeCat},get sequence(){return sequence},get seq(){return seq},get polymeterSteps(){return polymeterSteps},get polymeter(){return polymeter},get pm(){return pm},get add(){return add},get chop(){return chop},get chunk(){return chunk},get chunkBack(){return chunkBack},get div(){return div},get early(){return early},get echo(){return echo},get every(){return every},get fast(){return fast},get inv(){return inv},get invert(){return invert},get iter(){return iter},get iterBack(){return iterBack},get jux(){return jux},get juxBy(){return juxBy},get late(){return late},get linger(){return linger},get mask(){return mask},get mul(){return mul},get off(){return off},get ply(){return ply},get range(){return range},get rangex(){return rangex},get range2(){return range2},get rev(){return rev},get slow(){return slow},get struct(){return struct},get sub(){return sub},get superimpose(){return superimpose},get set(){return set},get when(){return when},get makeComposable(){return makeComposable},get patternify2(){return patternify2},get patternify3(){return patternify3},get patternify4(){return patternify4},get steady(){return steady},get signal(){return signal},get isaw(){return isaw},get isaw2(){return isaw2},get saw(){return saw},get saw2(){return saw2},get sine2(){return sine2},get sine(){return sine},get cosine(){return cosine},get cosine2(){return cosine2},get square(){return square},get square2(){return square2},get tri(){return tri},get tri2(){return tri2},get time(){return time},get rand(){return rand},get rand2(){return rand2},get _brandBy(){return _brandBy},get brandBy(){return brandBy},get brand(){return brand},get _irand(){return _irand},get irand(){return irand},get __chooseWith(){return __chooseWith},get chooseWith(){return chooseWith},get chooseInWith(){return chooseInWith},get choose(){return choose},get chooseCycles(){return chooseCycles},get randcat(){return randcat},get wchoose(){return wchoose},get wchooseCycles(){return wchooseCycles},get perlinWith(){return perlinWith},get perlin(){return perlin},get State(){return State},get TimeSpan(){return TimeSpan},get isNote(){return isNote},get tokenizeNote(){return tokenizeNote},get toMidi(){return toMidi},get fromMidi(){return fromMidi},get getFreq(){return getFreq},get midi2note(){return midi2note},get mod(){return mod},get getPlayableNoteValue(){return getPlayableNoteValue},get getFrequency(){return getFrequency},get rotate(){return rotate},get pipe(){return pipe},get compose(){return compose},get removeUndefineds(){return removeUndefineds},get flatten(){return flatten},get id(){return id},get constant(){return constant},get listRange(){return listRange},get curry(){return curry},get parseNumeral(){return parseNumeral},get mapArgs(){return mapArgs},get numeralArgs(){return numeralArgs},get parseFractional(){return parseFractional},get fractionalArgs(){return fractionalArgs},get evalScope(){return evalScope},get evaluate(){return evaluate$1},get repl(){return repl}},Symbol.toStringTag,{value:"Module"}));(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerpolicy&&(a.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?a.credentials="include":s.crossorigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();const scriptRel="modulepreload",assetsURL=function(e){return"/tidalcycles/strudel/general-purpose-scheduler/packages/core/examples/vite-vanilla-repl/dist/"+e},seen={},__vitePreload=function(t,r,n){if(!r||r.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(r.map(a=>{if(a=assetsURL(a),a in seen)return;seen[a]=!0;const o=a.endsWith(".css"),l=o?'[rel="stylesheet"]':"";if(!!n)for(let m=s.length-1;m>=0;m--){const v=s[m];if(v.href===a&&(!o||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${l}`))return;const y=document.createElement("link");if(y.rel=o?"stylesheet":scriptRel,o||(y.as="script",y.crossOrigin=""),y.href=a,document.head.appendChild(y),o)return new Promise((m,v)=>{y.addEventListener("load",m),y.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>t())};var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}),r}var fraction$1={exports:{}};/** - * @license Fraction.js v4.2.0 05/03/2022 - * https://www.xarg.org/2014/03/rational-numbers-in-javascript/ - * - * Copyright (c) 2021, Robert Eisele (robert@xarg.org) - * Dual licensed under the MIT or GPL Version 2 licenses. - **/(function(e,t){(function(r){var n=2e3,s={s:1,n:0,d:1};function a(g,d){if(isNaN(g=parseInt(g,10)))throw E.InvalidParameter;return g*d}function o(g,d){if(d===0)throw E.DivisionByZero;var D=Object.create(E.prototype);D.s=g<0?-1:1,g=g<0?-g:g;var S=A(g,d);return D.n=g/S,D.d=d/S,D}function l(g){for(var d={},D=g,S=2,k=4;k<=D;){for(;D%S===0;)D/=S,d[S]=(d[S]||0)+1;k+=1+2*S++}return D!==g?D>1&&(d[D]=(d[D]||0)+1):d[g]=(d[g]||0)+1,d}var f=function(g,d){var D=0,S=1,k=1,N=0,b=0,F=0,B=1,_=1,x=0,$=1,T=1,V=1,M=1e7,L;if(g!=null)if(d!==void 0){if(D=g,S=d,k=D*S,D%1!==0||S%1!==0)throw E.NonIntegerParameter}else switch(typeof g){case"object":{if("d"in g&&"n"in g)D=g.n,S=g.d,"s"in g&&(D*=g.s);else if(0 in g)D=g[0],1 in g&&(S=g[1]);else throw E.InvalidParameter;k=D*S;break}case"number":{if(g<0&&(k=g,g=-g),g%1===0)D=g;else if(g>0){for(g>=1&&(_=Math.pow(10,Math.floor(1+Math.log(g)/Math.LN10)),g/=_);$<=M&&V<=M;)if(L=(x+T)/($+V),g===L){$+V<=M?(D=x+T,S=$+V):V>$?(D=T,S=V):(D=x,S=$);break}else g>L?(x+=T,$+=V):(T+=x,V+=$),$>M?(D=T,S=V):(D=x,S=$);D*=_}else(isNaN(g)||isNaN(d))&&(S=D=NaN);break}case"string":{if($=g.match(/\d+|./g),$===null)throw E.InvalidParameter;if($[x]==="-"?(k=-1,x++):$[x]==="+"&&x++,$.length===x+1?b=a($[x++],k):$[x+1]==="."||$[x]==="."?($[x]!=="."&&(N=a($[x++],k)),x++,(x+1===$.length||$[x+1]==="("&&$[x+3]===")"||$[x+1]==="'"&&$[x+3]==="'")&&(b=a($[x],k),B=Math.pow(10,$[x].length),x++),($[x]==="("&&$[x+2]===")"||$[x]==="'"&&$[x+2]==="'")&&(F=a($[x+1],k),_=Math.pow(10,$[x+1].length)-1,x+=3)):$[x+1]==="/"||$[x+1]===":"?(b=a($[x],k),B=a($[x+2],1),x+=3):$[x+3]==="/"&&$[x+1]===" "&&(N=a($[x],k),b=a($[x+2],k),B=a($[x+4],1),x+=5),$.length<=x){S=B*_,k=D=F+S*N+_*b;break}}default:throw E.InvalidParameter}if(S===0)throw E.DivisionByZero;s.s=k<0?-1:1,s.n=Math.abs(D),s.d=Math.abs(S)};function y(g,d,D){for(var S=1;d>0;g=g*g%D,d>>=1)d&1&&(S=S*g%D);return S}function m(g,d){for(;d%2===0;d/=2);for(;d%5===0;d/=5);if(d===1)return 0;for(var D=10%d,S=1;D!==1;S++)if(D=D*10%d,S>n)return 0;return S}function v(g,d,D){for(var S=1,k=y(10,D,d),N=0;N<300;N++){if(S===k)return N;S=S*10%d,k=k*10%d}return 0}function A(g,d){if(!g)return d;if(!d)return g;for(;;){if(g%=d,!g)return d;if(d%=g,!d)return g}}function E(g,d){if(f(g,d),this instanceof E)g=A(s.d,s.n),this.s=s.s,this.n=s.n/g,this.d=s.d/g;else return o(s.s*s.n,s.d)}E.DivisionByZero=new Error("Division by Zero"),E.InvalidParameter=new Error("Invalid argument"),E.NonIntegerParameter=new Error("Parameters must be integer"),E.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(g,d){return f(g,d),o(this.s*this.n*s.d+s.s*this.d*s.n,this.d*s.d)},sub:function(g,d){return f(g,d),o(this.s*this.n*s.d-s.s*this.d*s.n,this.d*s.d)},mul:function(g,d){return f(g,d),o(this.s*s.s*this.n*s.n,this.d*s.d)},div:function(g,d){return f(g,d),o(this.s*s.s*this.n*s.d,this.d*s.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(g,d){if(isNaN(this.n)||isNaN(this.d))return new E(NaN);if(g===void 0)return o(this.s*this.n%this.d,1);if(f(g,d),s.n===0&&this.d===0)throw E.DivisionByZero;return o(this.s*(s.d*this.n)%(s.n*this.d),s.d*this.d)},gcd:function(g,d){return f(g,d),o(A(s.n,this.n)*A(s.d,this.d),s.d*this.d)},lcm:function(g,d){return f(g,d),s.n===0&&this.n===0?o(0,1):o(s.n*this.n,A(s.n,this.n)*A(s.d,this.d))},ceil:function(g){return g=Math.pow(10,g||0),isNaN(this.n)||isNaN(this.d)?new E(NaN):o(Math.ceil(g*this.s*this.n/this.d),g)},floor:function(g){return g=Math.pow(10,g||0),isNaN(this.n)||isNaN(this.d)?new E(NaN):o(Math.floor(g*this.s*this.n/this.d),g)},round:function(g){return g=Math.pow(10,g||0),isNaN(this.n)||isNaN(this.d)?new E(NaN):o(Math.round(g*this.s*this.n/this.d),g)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(g,d){if(f(g,d),s.d===1)return s.s<0?o(Math.pow(this.s*this.d,s.n),Math.pow(this.n,s.n)):o(Math.pow(this.s*this.n,s.n),Math.pow(this.d,s.n));if(this.s<0)return null;var D=l(this.n),S=l(this.d),k=1,N=1;for(var b in D)if(b!=="1"){if(b==="0"){k=0;break}if(D[b]*=s.n,D[b]%s.d===0)D[b]/=s.d;else return null;k*=Math.pow(b,D[b])}for(var b in S)if(b!=="1"){if(S[b]*=s.n,S[b]%s.d===0)S[b]/=s.d;else return null;N*=Math.pow(b,S[b])}return s.s<0?o(N,k):o(k,N)},equals:function(g,d){return f(g,d),this.s*this.n*s.d===s.s*s.n*this.d},compare:function(g,d){f(g,d);var D=this.s*this.n*s.d-s.s*s.n*this.d;return(0=0;N--)k=k.inverse().add(D[N]);if(k.sub(d).abs().valueOf()0&&(D+=d,D+=" ",S%=k),D+=S,D+="/",D+=k),D},toLatex:function(g){var d,D="",S=this.n,k=this.d;return this.s<0&&(D+="-"),k===1?D+=S:(g&&(d=Math.floor(S/k))>0&&(D+=d,S%=k),D+="\\frac{",D+=S,D+="}{",D+=k,D+="}"),D},toContinued:function(){var g,d=this.n,D=this.d,S=[];if(isNaN(d)||isNaN(D))return S;do S.push(Math.floor(d/D)),g=d%D,d=D,D=g;while(d!==1);return S},toString:function(g){var d=this.n,D=this.d;if(isNaN(d)||isNaN(D))return"NaN";g=g||15;var S=m(d,D),k=v(d,D,S),N=this.s<0?"-":"";if(N+=d/D|0,d%=D,d*=10,d&&(N+="."),S){for(var b=k;b--;)N+=d/D|0,d%=D,d*=10;N+="(";for(var b=S;b--;)N+=d/D|0,d%=D,d*=10;N+=")"}else for(var b=g;d&&b--;)N+=d/D|0,d%=D,d*=10;return N}},Object.defineProperty(E,"__esModule",{value:!0}),E.default=E,E.Fraction=E,e.exports=E})()})(fraction$1);const Fraction=getDefaultExportFromCjs(fraction$1.exports);Fraction.prototype.sam=function(){return this.floor()};Fraction.prototype.nextSam=function(){return this.sam().add(1)};Fraction.prototype.wholeCycle=function(){return new TimeSpan(this.sam(),this.nextSam())};Fraction.prototype.cyclePos=function(){return this.sub(this.sam())};Fraction.prototype.lt=function(e){return this.compare(e)<0};Fraction.prototype.gt=function(e){return this.compare(e)>0};Fraction.prototype.lte=function(e){return this.compare(e)<=0};Fraction.prototype.gte=function(e){return this.compare(e)>=0};Fraction.prototype.eq=function(e){return this.compare(e)==0};Fraction.prototype.max=function(e){return this.gt(e)?this:e};Fraction.prototype.min=function(e){return this.lt(e)?this:e};Fraction.prototype.show=function(){return this.s*this.n+"/"+this.d};Fraction.prototype.or=function(e){return this.eq(0)?e:this};const fraction=e=>(typeof e=="number"&&(e=String(e)),Fraction(e)),gcd=(...e)=>e.reduce((t,r)=>t.gcd(r),fraction(1));fraction._original=Fraction;class TimeSpan{constructor(t,r){this.begin=fraction(t),this.end=fraction(r)}get spanCycles(){const t=[];var r=this.begin;const n=this.end,s=n.sam();if(r.equals(n))return[new TimeSpan(r,n)];for(;n.gt(r);){if(r.sam().equals(s)){t.push(new TimeSpan(r,this.end));break}const a=r.nextSam();t.push(new TimeSpan(r,a)),r=a}return t}get duration(){return this.end.sub(this.begin)}cycleArc(){const t=this.begin.cyclePos(),r=t.add(this.duration);return new TimeSpan(t,r)}withTime(t){return new TimeSpan(t(this.begin),t(this.end))}withEnd(t){return new TimeSpan(this.begin,t(this.end))}withCycle(t){const r=this.begin.sam(),n=r.add(t(this.begin.sub(r))),s=r.add(t(this.end.sub(r)));return new TimeSpan(n,s)}intersection(t){const r=this.begin.max(t.begin),n=this.end.min(t.end);if(!r.gt(n)&&!(r.equals(n)&&(r.equals(this.end)&&this.begin.lt(this.end)||r.equals(t.end)&&t.begin.lt(t.end))))return new TimeSpan(r,n)}intersection_e(t){const r=this.intersection(t);if(r==null)throw"TimeSpans do not intersect";return r}midpoint(){return this.begin.add(this.duration.div(fraction(2)))}equals(t){return this.begin.equals(t.begin)&&this.end.equals(t.end)}show(){return this.begin.show()+" -> "+this.end.show()}}class Hap{constructor(t,r,n,s={},a=!1){this.whole=t,this.part=r,this.value=n,this.context=s,this.stateful=a,a&&console.assert(typeof this.value=="function","Stateful values must be functions")}get duration(){return this.whole.end.sub(this.whole.begin)}wholeOrPart(){return this.whole?this.whole:this.part}withSpan(t){const r=this.whole?t(this.whole):void 0;return new Hap(r,t(this.part),this.value,this.context)}withValue(t){return new Hap(this.whole,this.part,t(this.value),this.context)}hasOnset(){return this.whole!=null&&this.whole.begin.equals(this.part.begin)}resolveState(t){if(this.stateful&&this.hasOnset()){console.log("stateful");const r=this.value,[n,s]=r(t);return[n,new Hap(this.whole,this.part,s,this.context,!1)]}return[t,this]}spanEquals(t){return this.whole==null&&t.whole==null||this.whole.equals(t.whole)}equals(t){return this.spanEquals(t)&&this.part.equals(t.part)&&this.value===t.value}show(){return"("+(this.whole==null?"~":this.whole.show())+", "+this.part.show()+", "+this.value+")"}showWhole(){return`${this.whole==null?"~":this.whole.show()}: ${typeof this.value=="object"?JSON.stringify(this.value):this.value}`}combineContext(t){const r=this;return{...r.context,...t.context,locations:(r.context.locations||[]).concat(t.context.locations||[])}}setContext(t){return new Hap(this.whole,this.part,this.value,t)}}class State{constructor(t,r={}){this.span=t,this.controls=r}setSpan(t){return new State(t,this.controls)}withSpan(t){return this.setSpan(t(this.span))}setControls(t){return new State(this.span,t)}}const isNote=e=>/^[a-gA-G][#b]*[0-9]$/.test(e),tokenizeNote=e=>{var s;if(typeof e!="string")return[];const[t,r="",n]=((s=e.match(/^([a-gA-G])([#bs]*)([0-9])?$/))==null?void 0:s.slice(1))||[];return t?[t,r,n?Number(n):void 0]:[]},toMidi=e=>{const[t,r,n]=tokenizeNote(e);if(!t)throw new Error('not a note: "'+e+'"');const s={c:0,d:2,e:4,f:5,g:7,a:9,b:11}[t.toLowerCase()],a=(r==null?void 0:r.split("").reduce((o,l)=>o+{"#":1,b:-1,s:1}[l],0))||0;return(Number(n)+1)*12+s+a},fromMidi=e=>Math.pow(2,(e-69)/12)*440,getFreq=e=>fromMidi(typeof e=="number"?e:toMidi(e)),midi2note=e=>{const t=Math.floor(e/12)-1;return["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"][e%12]+t},mod=(e,t)=>(e%t+t)%t,getPlayableNoteValue=e=>{let{value:t,context:r}=e;if(typeof t=="object"&&!Array.isArray(t)&&(t=t.note||t.n||t.value),typeof t=="number"&&r.type!=="frequency")t=fromMidi(e.value);else if(typeof t=="number"&&r.type==="frequency")t=e.value;else if(typeof t!="string"||!isNote(t))throw new Error("not a note: "+JSON.stringify(t));return t},getFrequency=e=>{let{value:t,context:r}=e;if(typeof t=="object")return t.freq?t.freq:getFreq(t.note||t.n||t.value);if(typeof t=="number"&&r.type!=="frequency")t=fromMidi(e.value);else if(typeof t=="string"&&isNote(t))t=fromMidi(toMidi(e.value));else if(typeof t!="number")throw new Error("not a note or frequency: "+t);return t},rotate=(e,t)=>e.slice(t).concat(e.slice(0,t)),pipe=(...e)=>e.reduce((t,r)=>(...n)=>t(r(...n)),t=>t),compose=(...e)=>pipe(...e.reverse()),removeUndefineds=e=>e.filter(t=>t!=null),flatten=e=>[].concat(...e),id=e=>e,constant=(e,t)=>e,listRange=(e,t)=>Array.from({length:t-e+1},(r,n)=>n+e);function curry(e,t){const r=function n(...s){if(s.length>=e.length)return e.apply(this,s);{const a=function(...o){return n.apply(this,s.concat(o))};return t&&t(a,s),a}};return t&&t(r,[]),r}function parseNumeral(e){const t=Number(e);if(!isNaN(t))return t;if(isNote(e))return toMidi(e);throw new Error(`cannot parse as numeral: "${e}"`)}function mapArgs(e,t){return(...r)=>e(...r.map(t))}function numeralArgs(e){return mapArgs(e,parseNumeral)}function parseFractional(e){const t=Number(e);if(!isNaN(t))return t;const r={pi:Math.PI,w:1,h:.5,q:.25,e:.125,s:.0625,t:1/3,f:.2,x:1/6}[e];if(typeof r<"u")return r;throw new Error(`cannot parse as fractional: "${e}"`)}const fractionalArgs=e=>mapArgs(e,parseFractional);function unionWithObj(e,t,r){const n=Object.keys(e).filter(s=>Object.keys(t).includes(s));return Object.assign({},e,t,Object.fromEntries(n.map(s=>[s,r(e[s],t[s])])))}curry((e,t)=>e*t);curry((e,t)=>t.map(e));function drawLine(e,t=60){let r=0,n=fraction(0),s=[""],a="";for(;s[0].lengthm.hasOnset()).map(m=>m.duration),f=gcd(...l),y=f.inverse();s=s.map(m=>m+"|"),a+="|";for(let m=0;md.whole.begin.lte(v)&&d.whole.end.gte(A)),g=E.length-s.length;g>0&&(s=s.concat(Array(g).fill(a))),s=s.map((d,D)=>{const S=E[D];if(S){const N=S.whole.begin.eq(v)?""+S.value:"-";return d+N}return d+"."}),a+=".",n=n.add(f)}r++}return s.join(` -`)}class Pattern$2{constructor(t){ge(this,"_Pattern",!0);this.query=t}queryArc(t,r){return this.query(new State(new TimeSpan(t,r)))}_splitQueries(){const t=this,r=n=>flatten(n.span.spanCycles.map(s=>t.query(n.setSpan(s))));return new Pattern$2(r)}withQuerySpan(t){return new Pattern$2(r=>this.query(r.withSpan(t)))}withQuerySpanMaybe(t){const r=this;return new Pattern$2(n=>{const s=n.withSpan(t);return s.span?r.query(s):[]})}withQueryTime(t){return new Pattern$2(r=>this.query(r.withSpan(n=>n.withTime(t))))}withHapSpan(t){return new Pattern$2(r=>this.query(r).map(n=>n.withSpan(t)))}withHapTime(t){return this.withHapSpan(r=>r.withTime(t))}_withHaps(t){return new Pattern$2(r=>t(this.query(r)))}_withHap(t){return this._withHaps(r=>r.map(t))}_setContext(t){return this._withHap(r=>r.setContext(t))}_withContext(t){return this._withHap(r=>r.setContext(t(r.context)))}_stripContext(){return this._withHap(t=>t.setContext({}))}withLocation(t,r){const n={start:{line:t[0],column:t[1],offset:t[2]},end:{line:r[0],column:r[1],offset:r[2]}};return this._withContext(s=>{const a=(s.locations||[]).concat([n]);return{...s,locations:a}})}withMiniLocation(t,r){const n={start:{line:t[0],column:t[1],offset:t[2]},end:{line:r[0],column:r[1],offset:r[2]}};return this._withContext(s=>{let a=s.locations||[];return a=a.map(({start:o,end:l})=>{const f=o.line===1?n.start.column:0;return{start:{...o,line:o.line-1+(n.start.line-1)+1,column:o.column-1+f},end:{...l,line:l.line-1+(n.start.line-1)+1,column:l.column-1+f}}}),{...s,locations:a}})}withValue(t){return new Pattern$2(r=>this.query(r).map(n=>n.withValue(t)))}fmap(t){return this.withValue(t)}_filterHaps(t){return new Pattern$2(r=>this.query(r).filter(t))}_filterValues(t){return new Pattern$2(r=>this.query(r).filter(n=>t(n.value)))}_removeUndefineds(){return this._filterValues(t=>t!=null)}onsetsOnly(){return this._filterHaps(t=>t.hasOnset())}discreteOnly(){return this._filterHaps(t=>t.whole)}_appWhole(t,r){const n=this,s=function(a){const o=n.query(a),l=r.query(a),f=function(y,m){const v=y.part.intersection(m.part);if(v!=null)return new Hap(t(y.whole,m.whole),v,y.value(m.value),m.combineContext(y))};return flatten(o.map(y=>removeUndefineds(l.map(m=>f(y,m)))))};return new Pattern$2(s)}appBoth(t){const r=function(n,s){if(!(n==null||s==null))return n.intersection_e(s)};return this._appWhole(r,t)}appLeft(t){const r=this,n=function(s){const a=[];for(const o of r.query(s)){const l=t.query(s.setSpan(o.wholeOrPart()));for(const f of l){const y=o.whole,m=o.part.intersection(f.part);if(m){const v=o.value(f.value),A=f.combineContext(o),E=new Hap(y,m,v,A);a.push(E)}}}return a};return new Pattern$2(n)}appRight(t){const r=this,n=function(s){const a=[];for(const o of t.query(s)){const l=r.query(s.setSpan(o.wholeOrPart()));for(const f of l){const y=o.whole,m=f.part.intersection(o.part);if(m){const v=f.value(o.value),A=o.combineContext(f),E=new Hap(y,m,v,A);a.push(E)}}}return a};return new Pattern$2(n)}firstCycle(t=!1){var r=this;return t||(r=r._stripContext()),r.query(new State(new TimeSpan(fraction(0),fraction(1))))}get _firstCycleValues(){return this.firstCycle().map(t=>t.value)}get _showFirstCycle(){return this.firstCycle().map(t=>`${t.value}: ${t.whole.begin.toFraction()} - ${t.whole.end.toFraction()}`)}_sortHapsByPart(){return this._withHaps(t=>t.sort((r,n)=>r.part.begin.sub(n.part.begin).or(r.part.end.sub(n.part.end)).or(r.whole.begin.sub(n.whole.begin).or(r.whole.end.sub(n.whole.end)))))}_opIn(t,r){return this.fmap(r).appLeft(reify$1(t))}_opOut(t,r){return this.fmap(r).appRight(reify$1(t))}_opMix(t,r){return this.fmap(r).appBoth(reify$1(t))}_opSqueeze(t,r){const n=reify$1(t);return this.fmap(s=>n.fmap(a=>r(s)(a)))._squeezeJoin()}_opSqueezeOut(t,r){const n=this;return reify$1(t).fmap(a=>n.fmap(o=>r(o)(a)))._squeezeJoin()}_opTrig(t,r){return reify$1(t).fmap(s=>this.fmap(a=>r(a)(s)))._trigJoin()}_opTrigzero(t,r){return reify$1(t).fmap(s=>this.fmap(a=>r(a)(s)))._TrigzeroJoin()}_asNumber(){return this.fmap(parseNumeral)}round(){return this._asNumber().fmap(t=>Math.round(t))}floor(){return this._asNumber().fmap(t=>Math.floor(t))}ceil(){return this._asNumber().fmap(t=>Math.ceil(t))}_toBipolar(){return this.fmap(t=>t*2-1)}_fromBipolar(){return this.fmap(t=>(t+1)/2)}_range(t,r){return this.mul(r-t).add(t)}_rangex(t,r){return this._range(Math.log(t),Math.log(r)).fmap(Math.exp)}_range2(t,r){return this._fromBipolar()._range(t,r)}_bindWhole(t,r){const n=this,s=function(a){const o=function(f,y){return new Hap(t(f.whole,y.whole),y.part,y.value,Object.assign({},f.context,y.context,{locations:(f.context.locations||[]).concat(y.context.locations||[])}))},l=function(f){return r(f.value).query(a.setSpan(f.part)).map(y=>o(f,y))};return flatten(n.query(a).map(f=>l(f)))};return new Pattern$2(s)}bind(t){const r=function(n,s){if(!(n==null||s==null))return n.intersection_e(s)};return this._bindWhole(r,t)}join(){return this.bind(id)}outerBind(t){return this._bindWhole((r,n)=>r,t)}outerJoin(){return this.outerBind(id)}innerBind(t){return this._bindWhole((r,n)=>n,t)}innerJoin(){return this.innerBind(id)}_trigJoin(t=!1){const r=this;return new Pattern$2(n=>r.discreteOnly().query(n).map(s=>s.value.late(t?s.whole.begin:s.whole.begin.cyclePos()).query(n).map(a=>new Hap(a.whole?a.whole.intersection(s.whole):void 0,a.part.intersection(s.part),a.value).setContext(s.combineContext(a))).filter(a=>a.part)).flat())}_TrigzeroJoin(){return this._trigJoin(!0)}_squeezeJoin(){const t=this;function r(n){const s=t.discreteOnly().query(n);function a(l){const y=l.value._focusSpan(l.wholeOrPart()).query(n.setSpan(l.part));function m(v,A){let E;if(A.whole&&v.whole&&(E=A.whole.intersection(v.whole),!E))return;const g=A.part.intersection(v.part);if(!g)return;const d=A.combineContext(v);return new Hap(E,g,A.value,d)}return y.map(v=>m(l,v))}return flatten(s.map(a)).filter(l=>l)}return new Pattern$2(r)}_squeezeBind(t){return this.fmap(t)._squeezeJoin()}_apply(t){return t(this)}layer(...t){return stack(...t.map(r=>r(this)))}_patternify(t){const r=this;return function(...s){return s=s.map(o=>isPattern$1(o)?o.fmap(l=>l.value||l):o),sequence(...s).fmap(o=>t.call(r,o)).innerJoin()}}_fastGap(t){const r=function(s){const a=s.begin.sam(),o=s.begin.sub(a).mul(t).min(1),l=s.end.sub(a).mul(t).min(1);if(!(o>=1))return new TimeSpan(a.add(o),a.add(l))},n=function(s){const a=s.part.begin,o=s.part.end,l=a.sam(),f=a.sub(l).div(t).min(1),y=o.sub(l).div(t).min(1),m=new TimeSpan(l.add(f),l.add(y)),v=s.whole?new TimeSpan(m.begin.sub(a.sub(s.whole.begin).div(t)),m.end.add(s.whole.end.sub(o).div(t))):void 0;return new Hap(v,m,s.value,s.context)};return this.withQuerySpanMaybe(r)._withHap(n)._splitQueries()}_compress(t,r){return t.gt(r)||t.gt(1)||r.gt(1)||t.lt(0)||r.lt(0)?silence:this._fastGap(fraction(1).div(r.sub(t)))._late(t)}_compressSpan(t){return this._compress(t.begin,t.end)}_focus(t,r){return this._fast(fraction(1).div(r.sub(t))).late(t.cyclePos())}_focusSpan(t){return this._focus(t.begin,t.end)}_fast(t){return this.withQueryTime(n=>n.mul(t)).withHapTime(n=>n.div(t))}_slow(t){return this._fast(fraction(1).div(t))}_inside(t,r){return r(this._slow(t))._fast(t)}_outside(t,r){return r(this._fast(t))._slow(t)}_ply(t){return this.fmap(r=>pure(r)._fast(t))._squeezeJoin()}_chop(t){const n=Array.from({length:t},(a,o)=>o).map(a=>({begin:a/t,end:(a+1)/t})),s=function(a){return sequence(n.map(o=>Object.assign({},a,o)))};return this._squeezeBind(s)}_striate(t){const n=Array.from({length:t},(a,o)=>o).map(a=>({begin:a/t,end:(a+1)/t})),s=slowcat(...n);return this.set(s)._fast(t)}_cpm(t){return this._fast(t/60)}_early(t){return t=fraction(t),this.withQueryTime(r=>r.add(t)).withHapTime(r=>r.sub(t))}_late(t){return t=fraction(t),this._early(fraction(0).sub(t))}_zoom(t,r){r=fraction(r),t=fraction(t);const n=r.sub(t);return this.withQuerySpan(s=>s.withCycle(a=>a.mul(n).add(t))).withHapSpan(s=>s.withCycle(a=>a.sub(t).div(n)))._splitQueries()}_zoomArc(t){return this.zoom(t.begin,t.end)}_linger(t){return t==0?silence:t<0?this._zoom(t.add(1),1)._slow(t):this._zoom(0,t)._slow(t)}_color(t){return this._withContext(r=>({...r,color:t}))}log(){return this._withHap(t=>{var r;return t.setContext({...t.context,logs:(((r=t.context)==null?void 0:r.logs)||[]).concat([t.show()])})})}drawLine(){return console.log(drawLine(this)),this}_segment(t){return this.struct(pure(!0)._fast(t))}invert(){return this.fmap(t=>!t)}inv(){return this.invert()}when(t,r){const n=t._filterValues(id),s=t._filterValues(l=>!l),a=n.fmap(l=>f=>f).appRight(r(this)),o=s.fmap(l=>f=>f).appRight(this);return stack(a,o)}off(t,r){return stack(this,r(this.late(t)))}every(t,r){const n=this,s=Array(t-1).fill(n);return s.push(r(n)),slowcatPrime(...s)}every(t,r){const n=this,s=Array(t-1).fill(n);return s.unshift(r(n)),slowcatPrime(...s)}each(t,r){const n=this,s=Array(t-1).fill(n);return s.push(r(n)),slowcatPrime(...s)}brak(){return this.when(slowcat(!1,!0),t=>fastcat(t,silence)._late(.25))}rev(){const t=this,r=function(n){const s=n.span,a=s.begin.sam(),o=s.begin.nextSam(),l=function(y){const m=y.withTime(A=>a.add(o.sub(A))),v=m.begin;return m.begin=m.end,m.end=v,m};return t.query(n.setSpan(l(s))).map(y=>y.withSpan(l))};return new Pattern$2(r)._splitQueries()}palindrome(){return this.every(2,rev)}juxBy(t,r){t/=2;const n=function(o,l,f){return l in o?o[l]:f},s=this.withValue(o=>Object.assign({},o,{pan:n(o,"pan",.5)-t})),a=this.withValue(o=>Object.assign({},o,{pan:n(o,"pan",.5)+t}));return stack(s,r(a))}_jux(t){return this.juxBy(1,t)}stack(...t){return stack(this,...t)}sequence(...t){return sequence(this,...t)}seq(...t){return sequence(this,...t)}cat(...t){return cat(this,...t)}fastcat(...t){return fastcat(this,...t)}slowcat(...t){return slowcat(this,...t)}superimpose(...t){return this.stack(...t.map(r=>r(this)))}stutWith(t,r,n){return stack(...listRange(0,t-1).map(s=>n(this.late(fraction(r).mul(s)),s)))}stut(t,r,n){return this.stutWith(t,n,(s,a)=>s.velocity(Math.pow(r,a)))}_echoWith(t,r,n){return stack(...listRange(0,t-1).map(s=>n(this.late(fraction(r).mul(s)),s)))}_echo(t,r,n){return this._echoWith(t,r,(s,a)=>s.velocity(Math.pow(n,a)))}iter(t,r=!1){return slowcat(...listRange(0,t-1).map(n=>r?this.late(n/t):this.early(n/t)))}iterBack(t){return this.iter(t,!0)}_chunk(t,r,n=!1){const s=Array(t-1).fill(!1);s.unshift(!0);const a=sequence(...s).iter(t,n);return this.when(a,r)}_chunkBack(t,r){return this._chunk(t,r,!0)}_bypass(t){return t=Boolean(parseInt(t)),t?silence:this}hush(){return silence}_duration(t){return this.withHapSpan(r=>new TimeSpan(r.begin,r.begin.add(t)))}_legato(t){return this.withHapSpan(r=>new TimeSpan(r.begin,r.begin.add(r.end.sub(r.begin).mul(t))))}_velocity(t){return this._withContext(r=>({...r,velocity:(r.velocity||1)*t}))}_loopAt(t,r=1){return this.speed(1/t*r).unit("c").slow(t)}onTrigger(t){return this._withHap(r=>r.setContext({...r.context,onTrigger:t}))}log(t=id){return this._withHap(r=>r.setContext({...r.context,onTrigger:(...n)=>{r.context.onTrigger&&r.context.onTrigger(...n),console.log(t(...n))}}))}logValues(t=id){return this.log((r,n)=>t(n.value))}}function _composeOp(e,t,r){function n(s){return s instanceof Object&&!(s instanceof Function)}return n(e)||n(t)?(n(e)||(e={value:e}),n(t)||(t={value:t}),unionWithObj(e,t,r)):r(e,t)}(function(){const e={set:[(t,r)=>r],keep:[(t,r)=>t],keepif:[(t,r)=>r?t:void 0],add:[numeralArgs((t,r)=>t+r)],sub:[numeralArgs((t,r)=>t-r)],mul:[numeralArgs((t,r)=>t*r)],div:[numeralArgs((t,r)=>t/r)],mod:[numeralArgs(mod)],pow:[numeralArgs(Math.pow)],_and:[numeralArgs((t,r)=>t&r)],_or:[numeralArgs((t,r)=>t|r)],_xor:[numeralArgs((t,r)=>t^r)],_lshift:[numeralArgs((t,r)=>t<t>>r)],lt:[(t,r)=>tt>r],lte:[(t,r)=>t<=r],gte:[(t,r)=>t>=r],eq:[(t,r)=>t==r],eqt:[(t,r)=>t===r],ne:[(t,r)=>t!=r],net:[(t,r)=>t!==r],and:[(t,r)=>t&&r],or:[(t,r)=>t||r],func:[(t,r)=>r(t)]};for(const[t,[r,n]]of Object.entries(e))for(const s of["In","Out","Mix","Squeeze","SqueezeOut","Trig","Trigzero"])Pattern$2.prototype[t+s]=function(...a){var o=this;a=sequence(a),n&&(o=n(o),a=n(a));var l;return t==="keepif"?(l=o["_op"+s](a,f=>y=>r(f,y)),l=l._removeUndefineds()):l=o["_op"+s](a,f=>y=>_composeOp(f,y,r)),l},s==="Squeeze"&&(Pattern$2.prototype[t+"SqueezeIn"]=Pattern$2.prototype[t+s]),s==="In"?Pattern$2.prototype[t]=Pattern$2.prototype[t+s]:t==="set"&&(Pattern$2.prototype[s.toLowerCase()]=Pattern$2.prototype[t+s]);Pattern$2.prototype.struct=Pattern$2.prototype.keepifOut,Pattern$2.prototype.structAll=Pattern$2.prototype.keepOut,Pattern$2.prototype.mask=Pattern$2.prototype.keepifIn,Pattern$2.prototype.maskAll=Pattern$2.prototype.keepIn,Pattern$2.prototype.reset=Pattern$2.prototype.keepifTrig,Pattern$2.prototype.resetAll=Pattern$2.prototype.keepTrig,Pattern$2.prototype.restart=Pattern$2.prototype.keepifTrigzero,Pattern$2.prototype.restartAll=Pattern$2.prototype.keepTrigzero})();Pattern$2.prototype.patternified=["apply","chop","color","cpm","duration","early","fast","jux","late","legato","linger","ply","segment","striate","slow","velocity"];const polyrhythm=stack,pr=stack;Pattern$2.prototype.factories={pure,stack,slowcat,fastcat,cat,timeCat,sequence,seq,polymeter,pm,polyrhythm,pr};const silence=new Pattern$2(e=>[]);function pure(e){function t(r){return r.span.spanCycles.map(n=>new Hap(fraction(n.begin).wholeCycle(),n,e))}return new Pattern$2(t)}function isPattern$1(e){const t=e instanceof Pattern$2||(e==null?void 0:e._Pattern);return!e instanceof Pattern$2&&console.warn(`Found Pattern that fails "instanceof Pattern" check. - This may happen if you are using multiple versions of @strudel.cycles/core. - Please check by running "npm ls @strudel.cycles/core".`),t}function reify$1(e){return isPattern$1(e)?e:pure(e)}function stack(...e){e=e.map(r=>Array.isArray(r)?sequence(...r):reify$1(r));const t=r=>flatten(e.map(n=>n.query(r)));return new Pattern$2(t)}function slowcat(...e){e=e.map(r=>Array.isArray(r)?sequence(...r):reify$1(r));const t=function(r){const n=r.span,s=mod(n.begin.sam(),e.length),a=e[s];if(!a)return[];const o=n.begin.floor().sub(n.begin.div(e.length).floor());return a.withHapTime(l=>l.add(o)).query(r.setSpan(n.withTime(l=>l.sub(o))))};return new Pattern$2(t)._splitQueries()}function slowcatPrime(...e){e=e.map(reify$1);const t=function(r){const n=Math.floor(r.span.begin)%e.length,s=e[n];return(s==null?void 0:s.query(r))||[]};return new Pattern$2(t)._splitQueries()}function fastcat(...e){return slowcat(...e)._fast(e.length)}function cat(...e){return slowcat(...e)}function timeCat(...e){const t=e.map(s=>s[0]).reduce((s,a)=>s.add(a),fraction(0));let r=fraction(0);const n=[];for(const[s,a]of e){const o=r.add(s);n.push(reify$1(a)._compress(r.div(t),o.div(t))),r=o}return stack(...n)}function sequence(...e){return fastcat(...e)}function seq(...e){return fastcat(...e)}function _sequenceCount(e){return Array.isArray(e)?e.length==0?[silence,0]:e.length==1?_sequenceCount(e[0]):[fastcat(...e.map(t=>_sequenceCount(t)[0])),e.length]:[reify$1(e),1]}function polymeterSteps(e,...t){const r=t.map(s=>_sequenceCount(s));if(r.length==0)return silence;e==0&&(e=r[0][1]);const n=[];for(const s of r)s[1]==0&&next,e==s[1]?n.push(s[0]):n.push(s[0]._fast(fraction(e).div(fraction(s[1]))));return stack(...n)}function polymeter(...e){return polymeterSteps(0,...e)}function pm(...e){polymeter(...e)}const add=curry((e,t)=>t.add(e)),chop=curry((e,t)=>t.chop(e)),chunk=curry((e,t)=>t.chunk(e)),chunkBack=curry((e,t)=>t.chunkBack(e)),div=curry((e,t)=>t.div(e)),early=curry((e,t)=>t.early(e)),echo=curry((e,t,r,n)=>n.echo(e,t,r)),every=curry((e,t,r)=>r.every(e,t)),fast=curry((e,t)=>t.fast(e)),inv=e=>e.inv(),invert=e=>e.invert(),iter=curry((e,t)=>t.iter(e)),iterBack=curry((e,t)=>t.iter(e)),jux=curry((e,t)=>t.jux(e)),juxBy=curry((e,t,r)=>r.juxBy(e,t)),late=curry((e,t)=>t.late(e)),linger=curry((e,t)=>t.linger(e)),mask=curry((e,t)=>t.mask(e)),mul=curry((e,t)=>t.mul(e)),off=curry((e,t,r)=>r.off(e,t)),ply=curry((e,t)=>t.ply(e)),range=curry((e,t,r)=>r.range(e,t)),rangex=curry((e,t,r)=>r.rangex(e,t)),range2=curry((e,t,r)=>r.range2(e,t)),rev=e=>e.rev(),slow=curry((e,t)=>t.slow(e)),struct=curry((e,t)=>t.struct(e)),sub=curry((e,t)=>t.sub(e)),superimpose=curry((e,t)=>t.superimpose(...e)),set=curry((e,t)=>t.set(e)),when=curry((e,t,r)=>r.when(e,t));Pattern$2.prototype.composable={fast,slow,early,late,superimpose};function makeComposable(e){return Object.entries(Pattern$2.prototype.composable).forEach(([t,r])=>{e[t]=(...n)=>{const s=compose(e,r(...n));return makeComposable(s)}}),e}const patternify2=e=>(t,r,n)=>t.fmap(s=>a=>e.call(n,s,a)).appLeft(r).innerJoin(),patternify3=e=>(t,r,n,s)=>t.fmap(a=>o=>l=>e.call(s,a,o,l)).appLeft(r).appLeft(n).innerJoin(),patternify4=e=>(t,r,n,s,a)=>t.fmap(o=>l=>f=>y=>e.call(a,o,l,f,y)).appLeft(r).appLeft(n).appLeft(s).innerJoin();Pattern$2.prototype.echo=function(...e){return e=e.map(reify$1),patternify3(Pattern$2.prototype._echo)(...e,this)};Pattern$2.prototype.echoWith=function(...e){return e=e.map(reify$1),patternify3(Pattern$2.prototype._echoWith)(...e,this)};Pattern$2.prototype.chunk=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._chunk)(...e,this)};Pattern$2.prototype.chunkBack=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._chunkBack)(...e,this)};Pattern$2.prototype.loopAt=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._loopAt)(...e,this)};Pattern$2.prototype.zoom=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._zoom)(...e,this)};Pattern$2.prototype.compress=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._compress)(...e,this)};Pattern$2.prototype.outside=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._outside)(...e,this)};Pattern$2.prototype.inside=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._inside)(...e,this)};Pattern$2.prototype.range=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._range)(...e,this)};Pattern$2.prototype.rangex=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._rangex)(...e,this)};Pattern$2.prototype.range2=function(...e){return e=e.map(reify$1),patternify2(Pattern$2.prototype._range2)(...e,this)};Pattern$2.prototype.bootstrap=function(){const e=Object.fromEntries(Object.entries(Pattern$2.prototype.composable).map(([t,r])=>(Pattern$2.prototype[t]&&(Pattern$2.prototype[t]=makeComposable(Pattern$2.prototype[t])),[t,curry(r,makeComposable)])));return this.patternified.forEach(t=>{Pattern$2.prototype[t]=function(...r){return this._patternify(Pattern$2.prototype["_"+t])(...r)}}),e};Pattern$2.prototype.define=(e,t,r={})=>{r.composable&&(Pattern$2.prototype.composable[e]=t),r.patternified&&(Pattern$2.prototype.patternified=Pattern$2.prototype.patternified.concat([e])),Pattern$2.prototype.bootstrap()};Pattern$2.prototype.define("hush",e=>e.hush(),{patternified:!1,composable:!0});Pattern$2.prototype.define("bypass",e=>e.bypass(on),{patternified:!0,composable:!0});const controls={},generic_params=[["s","s","sound"],["f","n","The note or sample number to choose for a synth or sampleset"],["f","note","The note or pitch to play a sound or synth with"],["f","accelerate","a pattern of numbers that speed up (or slow down) samples while they play."],["f","gain","a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@."],["f","amp","like @gain@, but linear."],["f","attack","a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample."],["f","bank","selects sound bank to use"],["f","decay",""],["f","sustain",""],["f","release","a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample."],["f","hold","a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified."],["f","bandf","A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter."],["f","bandq","a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter."],["f","begin","a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample."],["f","end","the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample."],["f","loop","loops the sample (from `begin` to `end`) the specified number of times."],["f","legato","controls the amount of overlap between two adjacent sounds"],["f","crush","bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction)."],["f","coarse","fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on."],["i","channel","choose the channel the pattern is sent to in superdirt"],["i","cut","In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open."],["f","cutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter."],["f","hcutoff","a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@"],["f","hresonance","a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@"],["f","resonance","a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter."],["f","djf","DJ filter, below 0.5 is low pass filter, above is high pass filter."],["f","delay","a pattern of numbers from 0 to 1. Sets the level of the delay signal."],["f","delayfeedback","a pattern of numbers from 0 to 1. Sets the amount of delay feedback."],["f","delaytime","a pattern of numbers from 0 to 1. Sets the length of the delay."],["f","lock","A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle."],["f","detune",""],["f","dry","when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb."],["f","fadeTime","Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope."],["f","fadeInTime","As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample."],["f","freq",""],["f","gate",""],["f","leslie",""],["f","lrate",""],["f","lsize",""],["f","degree",""],["f","mtranspose",""],["f","ctranspose",""],["f","harmonic",""],["f","stepsPerOctave",""],["f","octaveR",""],["f","nudge","Nudges events into the future by the specified number of seconds. Negative numbers work up to a point as well (due to internal latency)"],["i","octave",""],["f","offset",""],["i","orbit","a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around."],["f","overgain",""],["f","overshape",""],["f","pan","a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)"],["f","panspan","a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)"],["f","pansplay","a pattern of numbers between 0.0 and 1.0, which controls the multichannel spread range (multichannel only)"],["f","panwidth","a pattern of numbers between 0.0 and inf, which controls how much each channel is distributed over neighbours (multichannel only)"],["f","panorient","a pattern of numbers between -1.0 and 1.0, which controls the relative position of the centre pan in a pair of adjacent speakers (multichannel only)"],["f","rate","used in SuperDirt softsynths as a control rate or 'speed'"],["f","slide",""],["f","semitone",""],["f","velocity",""],["f","voice",""],["f","room","a pattern of numbers from 0 to 1. Sets the level of reverb."],["f","size","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","roomsize","a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb."],["f","shape","wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion."],["f","speed","a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!"],["s","unit",'used in conjunction with `speed`, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.'],["f","squiz",""],["f","stutterdepth",""],["f","stuttertime",""],["f","timescale",""],["f","timescalewin",""],["s","vowel","formant filter to make things sound like vowels, a pattern of either `a`, `e`, `i`, `o` or `u`. Use a rest (`~`) for no effect."],["f","waveloss",""],["f","dur",""],["f","expression",""],["f","sustainpedal",""],["f","tremolodepth","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","tremolorate","Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],["f","phaserdepth","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","phaserrate","Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],["f","fshift","frequency shifter"],["f","fshiftnote","frequency shifter"],["f","fshiftphase","frequency shifter"],["f","triode","tube distortion"],["f","krush","shape/bass enhancer"],["f","kcutoff",""],["f","octer","octaver effect"],["f","octersub","octaver effect"],["f","octersubsub","octaver effect"],["f","ring","ring modulation"],["f","ringf","ring modulation"],["f","ringdf","ring modulation"],["f","distort","noisy fuzzy distortion"],["f","freeze","Spectral freeze"],["f","xsdelay",""],["f","tsdelay",""],["f","real","Spectral conform"],["f","imag",""],["f","enhance","Spectral enhance"],["f","partials",""],["f","comb","Spectral comb"],["f","smear","Spectral smear"],["f","scram","Spectral scramble"],["f","binshift","Spectral binshift"],["f","hbrick","High pass sort of spectral filter"],["f","lbrick","Low pass sort of spectral filter"],["f","midichan",""],["f","control",""],["f","ccn",""],["f","ccv",""],["f","polyTouch",""],["f","midibend",""],["f","miditouch",""],["f","ctlNum",""],["f","frameRate",""],["f","frames",""],["f","hours",""],["s","midicmd",""],["f","minutes",""],["f","progNum",""],["f","seconds",""],["f","songPtr",""],["f","uid",""],["f","val",""],["f","cps",""],["f","clip",""]],_name=(e,...t)=>sequence(...t).withValue(r=>({[e]:r})),_setter=(e,t)=>function(...r){return r.length?this.set(e(...r)):this.fmap(n=>({[t]:n}))};generic_params.forEach(([e,t,r])=>{controls[t]=(...n)=>_name(t,...n),Pattern$2.prototype[t]=_setter(controls[t],t)});controls.createParam=e=>{const t=(...r)=>_name(e,...r);return Pattern$2.prototype[e]=_setter(t,e),(...r)=>_name(e,...r)};controls.createParams=(...e)=>e.reduce((t,r)=>Object.assign(t,{[r]:createParam(r)}),{});function bjorklund(e,t){for(var r=[],n=[],s=[t],a=e-t,o=0,l=function(f){if(f==-1)r.push(0);else if(f==-2)r.push(1);else{for(var y=0;y1;)n.push(Math.floor(a/s[o])),s.push(a%s[o]),a=s[o],o++;return n.push(a),l(o),r.reverse()}var bjork=function(e,t){return e>t?bjorklund(e,t):bjorklund(t,e)};const euclid=(e,t,r=0)=>{const n=bjork(t,e);return r?rotate(n,-r):n};Pattern$2.prototype.euclid=function(e,t,r=0){return this.struct(euclid(e,t,r))};Pattern$2.prototype.euclidLegato=function(e,t,r=0){const n=euclid(e,t,r),s=n.indexOf(1),a=rotate(n,s).join("").split("1").slice(1).map(o=>[o.length+1,!0]);return this.struct(timeCat(...a)).late(fraction(s).div(t))};function steady(e){return new Pattern$2(t=>[new Hap(void 0,t.span,e)])}const signal=e=>{const t=r=>[new Hap(void 0,r.span,e(r.span.midpoint()))];return new Pattern$2(t)},isaw=signal(e=>1-e%1),isaw2=isaw._toBipolar(),saw=signal(e=>e%1),saw2=saw._toBipolar(),sine2=signal(e=>Math.sin(Math.PI*2*e)),sine=sine2._fromBipolar(),cosine=sine._early(fraction(1).div(4)),cosine2=sine2._early(fraction(1).div(4)),square=signal(e=>Math.floor(e*2%2)),square2=square._toBipolar(),tri=fastcat(isaw,saw),tri2=fastcat(isaw2,saw2),time=signal(id),xorwise=e=>{const t=e<<13^e,r=t>>17^t;return r<<5^r},_frac=e=>e-Math.trunc(e),timeToIntSeed=e=>xorwise(Math.trunc(_frac(e/300)*536870912)),intSeedToRand=e=>e%536870912/536870912,timeToRand=e=>Math.abs(intSeedToRand(timeToIntSeed(e))),rand=signal(timeToRand),rand2=rand._toBipolar(),_brandBy=e=>rand.fmap(t=>treify$1(e).fmap(_brandBy).innerJoin(),brand=_brandBy(.5),_irand=e=>rand.fmap(t=>Math.trunc(t*e)),irand=e=>reify$1(e).fmap(_irand).innerJoin(),__chooseWith=(e,t)=>(t=t.map(reify$1),t.length==0?silence:e.range(0,t.length).fmap(r=>t[Math.floor(r)])),chooseWith=(e,t)=>__chooseWith(e,t).outerJoin(),chooseInWith=(e,t)=>__chooseWith(e,t).innerJoin(),choose=(...e)=>chooseWith(rand,e);Pattern$2.prototype.choose=function(...e){return chooseWith(this,e)};Pattern$2.prototype.choose2=function(...e){return chooseWith(this._fromBipolar(),e)};const chooseCycles=(...e)=>chooseInWith(rand.segment(1),e),randcat=chooseCycles,_wchooseWith=function(e,...t){const r=t.map(l=>reify$1(l[0])),n=[];let s=0;for(const l of t)s+=l[1],n.push(s);const a=s,o=function(l){const f=l*a;return r[n.findIndex(y=>y>f,n)]};return e.fmap(o)},wchooseWith=(...e)=>_wchooseWith(...e).outerJoin(),wchoose=(...e)=>wchooseWith(rand,...e),wchooseCycles=(...e)=>_wchooseWith(rand,...e).innerJoin(),perlinWith=e=>{const t=e.fmap(Math.floor),r=e.fmap(a=>Math.floor(a)+1),n=a=>6*a**5-15*a**4+10*a**3,s=a=>o=>l=>o+n(a)*(l-o);return e.sub(t).fmap(s).appBoth(t.fmap(timeToRand)).appBoth(r.fmap(timeToRand))},perlin=perlinWith(time.fmap(e=>Number(e)));Pattern$2.prototype._degradeByWith=function(e,t){return this.fmap(r=>n=>r).appLeft(e._filterValues(r=>r>t))};Pattern$2.prototype._degradeBy=function(e){return this._degradeByWith(rand,e)};Pattern$2.prototype.degrade=function(){return this._degradeBy(.5)};Pattern$2.prototype._undegradeBy=function(e){return this._degradeByWith(rand.fmap(t=>1-t),e)};Pattern$2.prototype.undegrade=function(){return this._undegradeBy(.5)};Pattern$2.prototype._sometimesBy=function(e,t){return stack(this._degradeBy(e),t(this._undegradeBy(1-e)))};Pattern$2.prototype.sometimesBy=function(e,t){const r=this;return reify$1(e).fmap(n=>r._sometimesBy(n,t)).innerJoin()};Pattern$2.prototype._sometimesByPre=function(e,t){return stack(this._degradeBy(e),t(this).undegradeBy(1-e))};Pattern$2.prototype.sometimesByPre=function(e,t){const r=this;return reify$1(e).fmap(n=>r._sometimesByPre(n,t)).innerJoin()};Pattern$2.prototype.sometimes=function(e){return this._sometimesBy(.5,e)};Pattern$2.prototype.sometimesPre=function(e){return this._sometimesByPre(.5,e)};Pattern$2.prototype._someCyclesBy=function(e,t){return stack(this._degradeByWith(rand._segment(1),e),t(this._degradeByWith(rand.fmap(r=>1-r)._segment(1),1-e)))};Pattern$2.prototype.someCyclesBy=function(e,t){const r=this;return reify$1(e).fmap(n=>r._someCyclesBy(n,t)).innerJoin()};Pattern$2.prototype.someCycles=function(e){return this._someCyclesBy(.5,e)};Pattern$2.prototype.often=function(e){return this.sometimesBy(.75,e)};Pattern$2.prototype.rarely=function(e){return this.sometimesBy(.25,e)};Pattern$2.prototype.almostNever=function(e){return this.sometimesBy(.1,e)};Pattern$2.prototype.almostAlways=function(e){return this.sometimesBy(.9,e)};Pattern$2.prototype.never=function(e){return this};Pattern$2.prototype.always=function(e){return e(this)};Pattern$2.prototype.patternified.push("degradeBy","undegradeBy");let synth;try{synth=window==null?void 0:window.speechSynthesis}catch{console.warn("cannot use window: not in browser?")}let allVoices=synth==null?void 0:synth.getVoices();function speak(e,t,r){synth.cancel();const n=new SpeechSynthesisUtterance(e);n.lang=t,allVoices=synth.getVoices();const s=allVoices.filter(a=>a.lang.includes(t));typeof r=="number"?n.voice=s[r%s.length]:typeof r=="string"&&(n.voice=s.find(a=>a.name===a)),speechSynthesis.speak(n)}Pattern$2.prototype._speak=function(e,t){return this._withHap(r=>{const n=(s,a)=>{speak(a.value,e,t)};return r.setContext({...r.context,onTrigger:n})})};Pattern$2.prototype.speak=function(e,t){return patternify2(Pattern$2.prototype._speak)(reify(e),reify(t),this)};const{isPattern,Pattern:Pattern$1}=strudel;let scoped=!1;const evalScope=async(...e)=>{scoped&&console.warn("evalScope was called more than once."),scoped=!0;const t=await Promise.allSettled(e),r=t.filter(n=>n.status==="fulfilled").map(n=>n.value);t.forEach((n,s)=>{n.status==="rejected"&&console.warn(`evalScope: module with index ${s} could not be loaded:`,n.reason)}),Object.assign(globalThis,...r,Pattern$1.prototype.bootstrap())};function safeEval(e){return Function('"use strict";return ('+e+")")()}const evaluate$1=async(e,t)=>{scoped||await evalScope(),t&&(e=t(e));let r=await safeEval(e);if(!isPattern(r)){console.log("evaluated",r);const n=`got "${typeof r}" instead of pattern`;throw new Error(n+(typeof r=="function"?", did you forget to call a function?":"."))}return{mode:"javascript",pattern:r}};function createClock(e,t,r=.05,n=.1,s=.1){let a=0,o=0,l=10**4,f=.01;const y=S=>r=S(r);s=s||n/2;const m=()=>{const S=e(),k=S+n+s;for(o===0&&(o=S+f);o=S&&t(o,r,a),o{m(),v=setInterval(m,n*1e3)},E=()=>clearInterval(v);return{setDuration:y,start:A,stop:()=>{a=0,o=0,E()},pause:()=>E(),duration:r,getPhase:()=>o}}class Cyclist{constructor({interval:t,onTrigger:r,onError:n,getTime:s,latency:a=.1}){ge(this,"worker");ge(this,"pattern");ge(this,"started",!1);ge(this,"cps",1);ge(this,"getTime");ge(this,"phase",0);this.getTime=s;const o=l=>Math.round(l*1e3)/1e3;this.clock=createClock(s,(l,f,y)=>{y===0&&(this.origin=l);const m=o(l-this.origin);this.phase=m-a;const v=o(m+f),A=s();try{this.pattern.queryArc(m,v).forEach(g=>{if(g.part.begin.equals(g.whole.begin)){const d=g.whole.begin+this.origin-A+a,D=g.duration*1;r==null||r(g,d,D)}})}catch(E){console.warn("scheduler error",E),n==null||n(E)}},t)}getPhase(){return this.phase}start(){if(!this.pattern)throw new Error("Scheduler: no pattern set! call .setPattern first.");this.clock.start(),this.started=!0}pause(){this.clock.stop(),delete this.origin,this.started=!1}stop(){delete this.origin,this.clock.stop(),this.started=!1}setPattern(t,r=!1){this.pattern=t,r&&!this.started&&this.start()}setCps(t=1){this.cps=t}log(t,r,n){const s=n.filter(a=>a.hasOnset());console.log(`${t.toFixed(4)} - ${r.toFixed(4)} ${Array(s.length).fill("I").join("")}`)}}function repl({interval:e,defaultOutput:t,onSchedulerError:r,onEvalError:n,onEval:s,getTime:a,transpiler:o}){const l=new Cyclist({interval:e,onTrigger:t,onError:r,getTime:a});return{scheduler:l,evaluate:async y=>{if(!y)throw new Error("no code to evaluate");try{const{pattern:m}=await evaluate$1(y,o);l.setPattern(m,!0),s==null||s({pattern:m,code:y})}catch(m){console.warn(`eval error: ${m.message}`),n==null||n(m)}}}}const gist=(route,cache=!0)=>fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache?"":Date.now()}`).then(e=>e.text()).then(code=>eval(code));console.log("%c // \u{1F300} @strudel.cycles/core loaded \u{1F300}","background-color: black;color:white;padding:4px;border-radius:15px");globalThis._strudelLoaded&&console.warn(`@strudel.cycles/core was loaded more than once... -This might happen when you have multiple versions of strudel installed. -Please check with "npm ls @strudel.cycles/core".`);globalThis._strudelLoaded=!0;if(typeof DelayNode<"u"){class e extends DelayNode{constructor(r,n,s,a){super(r),n=Math.abs(n),this.delayTime.value=s;const o=r.createGain();o.gain.value=Math.min(Math.abs(a),.995),this.feedback=o.gain;const l=r.createGain();return l.gain.value=n,this.delayGain=l,this.connect(o),this.connect(l),o.connect(this),this.connect=f=>l.connect(f),this}start(r){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,r+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(t,r,n){return new e(this,t,r,n)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(e,t=1){const r=this.sampleRate*e,n=this.createBuffer(t,r,this.sampleRate),s=n.getChannelData(0);for(let a=0;a(t.buffer=this.impulseResponse(r),t.duration=e,t),t.setDuration(e),t});const bufferCache={},loadCache={},getCachedBuffer=e=>bufferCache[e],loadBuffer=(e,t)=>(loadCache[e]||(loadCache[e]=fetch(e).then(r=>r.arrayBuffer()).then(async r=>{const n=await t.decodeAudioData(r);return bufferCache[e]=n,n})),loadCache[e]);function reverseBuffer(e){const t=getAudioContext(),r=t.createBuffer(e.numberOfChannels,e.length,t.sampleRate);for(let n=0;nbufferCache[e],githubCache={};let sampleCache={current:void 0};const loadGithubSamples=async(e,t)=>{const r="loadGithubSamples "+e,n=localStorage.getItem(r);if(n&&(console.log("[sampler]: loaded sample list from localstorage",e),githubCache[e]=JSON.parse(n)),githubCache[e])return sampleCache.current=githubCache[e],githubCache[e];console.log("[sampler]: fetching sample list from github",e);try{const[s,a,...o]=e.split("/"),l=`https://api.github.com/repos/${s}/${a}/contents`,f=await fetch(`${l}/${o.join("/")}`).then(y=>y.json());githubCache[e]=(await Promise.all(f.map(async({name:y,path:m})=>({name:y,content:await fetch(`${l}/${m}`).then(v=>v.json()).catch(v=>{console.error("could not load path",v)})})))).filter(({content:y})=>!!y).reduce((y,{name:m,content:v})=>({...y,[(t==null?void 0:t(m))||m]:v.map(({download_url:A})=>A)}),{})}catch(s){console.error("[sampler]: failed to fetch sample list from github",s);return}return sampleCache.current=githubCache[e],localStorage.setItem(r,JSON.stringify(sampleCache.current)),console.log("[sampler]: loaded samples:",sampleCache.current),githubCache[e]},samples=async(e,t=e._base||"")=>{if(typeof e=="string"){if(e.startsWith("github:")){const[n,s]=e.split("github:");e=`https://raw.githubusercontent.com/${s}/strudel.json`}if(typeof fetch!="function")return;const r=e.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(e).then(n=>n.json()).then(n=>samples(n,t||n._base||r)).catch(n=>{throw console.error(n),new Error(`error loading "${e}"`)})}sampleCache.current={...sampleCache.current,...Object.fromEntries(Object.entries(e).map(([r,n])=>{if(typeof n=="string"&&(n=[n]),typeof n!="object")throw new Error("wrong sample map format for "+r);t=n._base||t;const s=a=>(t+a).replace("github:","https://raw.githubusercontent.com/");return Array.isArray(n)?[r,n.map(s)]:[r,Object.fromEntries(Object.entries(n).map(([a,o])=>[a,(typeof o=="string"?[o]:o).map(s)]))]}))}},resetLoadedSamples=()=>{sampleCache.current=void 0},getLoadedSamples$1=()=>sampleCache.current;var vowelFormant={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class e extends GainNode{constructor(r,n){if(super(r),!vowelFormant[n])throw new Error("vowel: unknown vowel "+n);const{gains:s,qs:a,freqs:o}=vowelFormant[n],l=r.createGain();for(let f=0;f<5;f++){const y=r.createGain();y.gain.value=s[f];const m=r.createBiquadFilter();m.type="bandpass",m.Q.value=a[f],m.frequency.value=o[f],this.connect(m),m.connect(y),y.connect(l)}return l.gain.value=8,this.connect=f=>l.connect(f),this}}AudioContext.prototype.createVowelFilter=function(t){return new e(this,t)}}const workletsUrl="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK",{Pattern}=strudel;let audioContext;const getAudioContext$1=()=>(audioContext||(audioContext=new AudioContext),audioContext);let destination;const getDestination=()=>{const e=getAudioContext$1();return destination||(destination=e.createGain(),destination.connect(e.destination)),destination},panic=()=>{getDestination().gain.linearRampToValueAtTime(0,getAudioContext$1().currentTime+.01),destination=null},getFilter=(e,t,r)=>{const n=getAudioContext$1().createBiquadFilter();return n.type=e,n.frequency.value=t,n.Q.value=r,n},getADSR=(e,t,r,n,s,a,o)=>{const l=getAudioContext$1().createGain();return l.gain.setValueAtTime(0,a),l.gain.linearRampToValueAtTime(s,a+e),l.gain.linearRampToValueAtTime(r*s,a+e+t),l.gain.setValueAtTime(r*s,o),l.gain.linearRampToValueAtTime(0,o+n),l},getOscillator=({s:e,freq:t,t:r,duration:n,release:s})=>{const a=getAudioContext$1().createOscillator();return a.type=e||"triangle",a.frequency.value=Number(t),a.start(r),a.stop(r+n+s),a},getSoundfontKey=e=>{var n,s,a,o;if(!globalThis.soundfontList)return!1;if((s=(n=globalThis.soundfontList)==null?void 0:n.instruments)!=null&&s.includes(e))return e;const t=(o=(a=globalThis.soundfontList)==null?void 0:a.instrumentNames)==null?void 0:o.indexOf(e),r=t<10?`00${t}`:t<100?`0${t}`:t;if(t!==-1)return globalThis.soundfontList.instruments.find(l=>l.startsWith(r))},getSampleBufferSource=async(e,t,r,n)=>{let s=0,a=typeof r=="string"?toMidi(r):r||36;s=a-36;const o=getAudioContext$1(),l=getLoadedSamples();if(!l)throw new Error("no samples loaded");const f=l==null?void 0:l[e];if(!f)throw new Error(`sample not found: "${e}", try one of ${Object.keys(l).map(E=>`"${E}"`).join(", ")}.`);if(typeof f!="object")throw new Error("wrong format for sample bank:",e);let y;if(Array.isArray(f))y=f[t%f.length];else{const E=d=>toMidi(d)-a,g=Object.keys(f).filter(d=>!d.startsWith("_")).reduce((d,D,S)=>!d||Math.abs(E(D)){if(!e.includes(":"))return[e,t];let[r,n]=e.split(":");return isNaN(Number(n))?[e,t]:[r,n]};let workletsLoading;function loadWorklets(){return workletsLoading||(workletsLoading=getAudioContext$1().audioWorklet.addModule(workletsUrl),workletsLoading)}function getWorklet(e,t,r){const n=new AudioWorkletNode(e,t);return Object.entries(r).forEach(([s,a])=>{n.parameters.get(s).value=a}),n}if(typeof window<"u")try{loadWorklets()}catch(e){console.warn("could not load AudioWorklet effects coarse, crush and shape",e)}function gainNode(e){const t=getAudioContext$1().createGain();return t.gain.value=e,t}const cutGroups=[];let delays={};function getDelay(e,t,r,n){if(!delays[e]){const a=getAudioContext$1().createFeedbackDelay(1,t,r);a.start(n),a.connect(getDestination()),delays[e]=a}return delays[e].delayTime.value!==t&&delays[e].delayTime.setValueAtTime(t,n),delays[e].feedback.value!==r&&delays[e].feedback.setValueAtTime(r,n),delays[e]}let reverbs={};function getReverb(e,t=2){if(!reverbs[e]){const n=getAudioContext$1().createReverb(t);n.connect(getDestination()),reverbs[e]=n}return reverbs[e].duration!==t&&(reverbs[e]=reverbs[e].setDuration(t),reverbs[e].duration=t),reverbs[e]}function effectSend(e,t,r){const n=gainNode(r);return e.connect(n),n.connect(t),n}const webaudioOutput=async(e,t,r)=>{var n;try{const s=getAudioContext$1();if(typeof e.value!="object")throw new Error(`hap.value ${e.value} is not supported by webaudio output. Hint: append .note() or .s() to the end`);let a=s.currentTime+t,{freq:o,s:l,bank:f,sf:y,clip:m=0,n:v=0,note:A,gain:E=.8,cutoff:g,resonance:d=1,hcutoff:D,hresonance:S=1,bandf:k,bandq:N=1,coarse:b,crush:F,shape:B,pan:_,speed:x=1,begin:$=0,end:T=1,vowel:V,delay:M=0,delayfeedback:L=.5,delaytime:W=.25,unit:Q,nudge:Z=0,cut:X,loop:j,orbit:ue=1,room:ae,size:R=2,roomsize:pe=R}=e.value;const{velocity:me=1}=e.context;E*=me;const K=[];if(f&&l&&(l=`${f}_${l}`),typeof l=="string"&&([l,v]=splitSN(l,v)),typeof A=="string"&&([A,v]=splitSN(A,v)),!l||["sine","square","triangle","sawtooth"].includes(l)){const{attack:re=.001,decay:Ce=.05,sustain:Ee=.6,release:oe=.01}=e.value;v=A||v||36,typeof v=="string"&&(v=toMidi(v)),!o&&typeof v=="number"&&(o=fromMidi(v));const De=getOscillator({t:a,s:l,freq:o,duration:r,release:oe});K.push(De),K.push(gainNode(.3));const G=getADSR(re,Ce,Ee,oe,1,a,a+r);K.push(G)}else{const{attack:re=.001,decay:Ce=.001,sustain:Ee=1,release:oe=.001}=e.value;if(x===0)return;if(!l){console.warn("no sample specified");return}const De=getSoundfontKey(l);let G;try{De?G=await globalThis.getFontBufferSource(De,A||v,s):G=await getSampleBufferSource(l,v,A,x)}catch(xe){console.warn(xe);return}if(s.currentTime>a){console.warn("sample still loading:",l,v);return}if(!G){console.warn("no buffer source");return}G.playbackRate.value=Math.abs(x)*G.playbackRate.value,Q==="c"&&(G.playbackRate.value=G.playbackRate.value*G.buffer.duration);let le=De||m?r:G.buffer.duration/G.playbackRate.value;const de=$*le*G.playbackRate.value;le=(T-$)*le,j&&(G.loop=!0,G.loopStart=de,G.loopEnd=de+le,le=j*le),a+=Z,G.start(a,de),X!==void 0&&((n=cutGroups[X])==null||n.stop(a),cutGroups[X]=G),K.push(G),G.stop(a+le+oe);const we=getADSR(re,Ce,Ee,oe,1,a,a+le);K.push(we)}if(K.push(gainNode(E)),g!==void 0&&K.push(getFilter("lowpass",g,d)),D!==void 0&&K.push(getFilter("highpass",D,S)),k!==void 0&&K.push(getFilter("bandpass",k,N)),V!==void 0&&K.push(s.createVowelFilter(V)),b!==void 0&&K.push(getWorklet(s,"coarse-processor",{coarse:b})),F!==void 0&&K.push(getWorklet(s,"crush-processor",{crush:F})),B!==void 0&&K.push(getWorklet(s,"shape-processor",{shape:B})),_!==void 0){const re=s.createStereoPanner();re.pan.value=2*_-1,K.push(re)}const U=gainNode(1);K.push(U),U.connect(getDestination());let ne;if(M>0&&W>0&&L>0){const re=getDelay(ue,W,L,a);ne=effectSend(U,re,M)}let ye;if(ae>0&&pe>0){const re=getReverb(ue,pe);ye=effectSend(U,re,ae)}K.slice(1).reduce((re,Ce)=>re.connect(Ce),K[0]),K[0].onended=()=>K.concat([ne,ye]).forEach(re=>re==null?void 0:re.disconnect())}catch(s){console.warn(".out error:",s)}},webaudioOutputTrigger=(e,t,r,n)=>webaudioOutput(t,e-r,t.duration/n);Pattern.prototype.out=function(){return this.onTrigger(webaudioOutputTrigger)};var escodegen={},estraverse={};(function(e){(function t(r){var n,s,a,o,l,f;function y(F){var B={},_,x;for(_ in F)F.hasOwnProperty(_)&&(x=F[_],typeof x=="object"&&x!==null?B[_]=y(x):B[_]=x);return B}function m(F,B){var _,x,$,T;for(x=F.length,$=0;x;)_=x>>>1,T=$+_,B(F[T])?x=_:($=T+1,x-=_+1);return $}n={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportExpression:"ImportExpression",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"},a={AssignmentExpression:["left","right"],AssignmentPattern:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","body"],AwaitExpression:["argument"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ChainExpression:["expression"],ClassBody:["body"],ClassDeclaration:["id","superClass","body"],ClassExpression:["id","superClass","body"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportAllDeclaration:["source"],ExportDefaultDeclaration:["declaration"],ExportNamedDeclaration:["declaration","specifiers","source"],ExportSpecifier:["exported","local"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","body"],FunctionExpression:["id","params","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportExpression:["source"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportSpecifier:["imported","local"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MetaProperty:["meta","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],PrivateIdentifier:[],Program:["body"],Property:["key","value"],PropertyDefinition:["key","value"],RestElement:["argument"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],Super:[],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handler","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]},o={},l={},f={},s={Break:o,Skip:l,Remove:f};function v(F,B){this.parent=F,this.key=B}v.prototype.replace=function(B){this.parent[this.key]=B},v.prototype.remove=function(){return Array.isArray(this.parent)?(this.parent.splice(this.key,1),!0):(this.replace(null),!1)};function A(F,B,_,x){this.node=F,this.path=B,this.wrap=_,this.ref=x}function E(){}E.prototype.path=function(){var B,_,x,$,T,V;function M(L,W){if(Array.isArray(W))for(x=0,$=W.length;x<$;++x)L.push(W[x]);else L.push(W)}if(!this.__current.path)return null;for(T=[],B=2,_=this.__leavelist.length;B<_;++B)V=this.__leavelist[B],M(T,V.path);return M(T,this.__current.path),T},E.prototype.type=function(){var F=this.current();return F.type||this.__current.wrap},E.prototype.parents=function(){var B,_,x;for(x=[],B=1,_=this.__leavelist.length;B<_;++B)x.push(this.__leavelist[B].node);return x},E.prototype.current=function(){return this.__current.node},E.prototype.__execute=function(B,_){var x,$;return $=void 0,x=this.__current,this.__current=_,this.__state=null,B&&($=B.call(this,_.node,this.__leavelist[this.__leavelist.length-1].node)),this.__current=x,$},E.prototype.notify=function(B){this.__state=B},E.prototype.skip=function(){this.notify(l)},E.prototype.break=function(){this.notify(o)},E.prototype.remove=function(){this.notify(f)},E.prototype.__initialize=function(F,B){this.visitor=B,this.root=F,this.__worklist=[],this.__leavelist=[],this.__current=null,this.__state=null,this.__fallback=null,B.fallback==="iteration"?this.__fallback=Object.keys:typeof B.fallback=="function"&&(this.__fallback=B.fallback),this.__keys=a,B.keys&&(this.__keys=Object.assign(Object.create(this.__keys),B.keys))};function g(F){return F==null?!1:typeof F=="object"&&typeof F.type=="string"}function d(F,B){return(F===n.ObjectExpression||F===n.ObjectPattern)&&B==="properties"}function D(F,B){for(var _=F.length-1;_>=0;--_)if(F[_].node===B)return!0;return!1}E.prototype.traverse=function(B,_){var x,$,T,V,M,L,W,Q,Z,X,j,ue;for(this.__initialize(B,_),ue={},x=this.__worklist,$=this.__leavelist,x.push(new A(B,null,null,null)),$.push(new A(null,null,null,null));x.length;){if(T=x.pop(),T===ue){if(T=$.pop(),L=this.__execute(_.leave,T),this.__state===o||L===o)return;continue}if(T.node){if(L=this.__execute(_.enter,T),this.__state===o||L===o)return;if(x.push(ue),$.push(T),this.__state===l||L===l)continue;if(V=T.node,M=V.type||T.wrap,X=this.__keys[M],!X)if(this.__fallback)X=this.__fallback(V);else throw new Error("Unknown node type "+M+".");for(Q=X.length;(Q-=1)>=0;)if(W=X[Q],j=V[W],!!j){if(Array.isArray(j)){for(Z=j.length;(Z-=1)>=0;)if(!!j[Z]&&!D($,j[Z])){if(d(M,X[Q]))T=new A(j[Z],[W,Z],"Property",null);else if(g(j[Z]))T=new A(j[Z],[W,Z],null,null);else continue;x.push(T)}}else if(g(j)){if(D($,j))continue;x.push(new A(j,W,null,null))}}}}},E.prototype.replace=function(B,_){var x,$,T,V,M,L,W,Q,Z,X,j,ue,ae;function R(pe){var me,K,U,ne;if(pe.ref.remove()){for(K=pe.ref.key,ne=pe.ref.parent,me=x.length;me--;)if(U=x[me],U.ref&&U.ref.parent===ne){if(U.ref.key=0;)if(ae=Z[W],X=T[ae],!!X)if(Array.isArray(X)){for(Q=X.length;(Q-=1)>=0;)if(!!X[Q]){if(d(V,Z[W]))L=new A(X[Q],[ae,Q],"Property",new v(X,Q));else if(g(X[Q]))L=new A(X[Q],[ae,Q],null,new v(X,Q));else continue;x.push(L)}}else g(X)&&x.push(new A(X,ae,null,new v(T,ae)))}}return ue.root};function S(F,B){var _=new E;return _.traverse(F,B)}function k(F,B){var _=new E;return _.replace(F,B)}function N(F,B){var _;return _=m(B,function($){return $.range[0]>F.range[0]}),F.extendedRange=[F.range[0],F.range[1]],_!==B.length&&(F.extendedRange[1]=B[_].range[0]),_-=1,_>=0&&(F.extendedRange[0]=B[_].range[1]),F}function b(F,B,_){var x=[],$,T,V,M;if(!F.range)throw new Error("attachComments needs range information");if(!_.length){if(B.length){for(V=0,T=B.length;VL.range[0]));)W.extendedRange[1]===L.range[0]?(L.leadingComments||(L.leadingComments=[]),L.leadingComments.push(W),x.splice(M,1)):M+=1;if(M===x.length)return s.Break;if(x[M].extendedRange[0]>L.range[1])return s.Skip}}),M=0,S(F,{leave:function(L){for(var W;ML.range[1])return s.Skip}}),F}return r.Syntax=n,r.traverse=S,r.replace=k,r.attachComments=b,r.VisitorKeys=a,r.VisitorOption=s,r.Controller=E,r.cloneEnvironment=function(){return t({})},r})(e)})(estraverse);var utils={},ast={exports:{}};(function(){function e(o){if(o==null)return!1;switch(o.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function t(o){if(o==null)return!1;switch(o.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function r(o){if(o==null)return!1;switch(o.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function n(o){return r(o)||o!=null&&o.type==="FunctionDeclaration"}function s(o){switch(o.type){case"IfStatement":return o.alternate!=null?o.alternate:o.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return o.body}return null}function a(o){var l;if(o.type!=="IfStatement"||o.alternate==null)return!1;l=o.consequent;do{if(l.type==="IfStatement"&&l.alternate==null)return!0;l=s(l)}while(l);return!1}ast.exports={isExpression:e,isStatement:r,isIterationStatement:t,isSourceElement:n,isProblematicIfStatement:a,trailingStatement:s}})();var code={exports:{}};(function(){var e,t,r,n,s,a;t={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},e={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};function o(D){return 48<=D&&D<=57}function l(D){return 48<=D&&D<=57||97<=D&&D<=102||65<=D&&D<=70}function f(D){return D>=48&&D<=55}r=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];function y(D){return D===32||D===9||D===11||D===12||D===160||D>=5760&&r.indexOf(D)>=0}function m(D){return D===10||D===13||D===8232||D===8233}function v(D){if(D<=65535)return String.fromCharCode(D);var S=String.fromCharCode(Math.floor((D-65536)/1024)+55296),k=String.fromCharCode((D-65536)%1024+56320);return S+k}for(n=new Array(128),a=0;a<128;++a)n[a]=a>=97&&a<=122||a>=65&&a<=90||a===36||a===95;for(s=new Array(128),a=0;a<128;++a)s[a]=a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57||a===36||a===95;function A(D){return D<128?n[D]:t.NonAsciiIdentifierStart.test(v(D))}function E(D){return D<128?s[D]:t.NonAsciiIdentifierPart.test(v(D))}function g(D){return D<128?n[D]:e.NonAsciiIdentifierStart.test(v(D))}function d(D){return D<128?s[D]:e.NonAsciiIdentifierPart.test(v(D))}code.exports={isDecimalDigit:o,isHexDigit:l,isOctalDigit:f,isWhiteSpace:y,isLineTerminator:m,isIdentifierStartES5:A,isIdentifierPartES5:E,isIdentifierStartES6:g,isIdentifierPartES6:d}})();var keyword={exports:{}};(function(){var e=code.exports;function t(A){switch(A){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function r(A,E){return!E&&A==="yield"?!1:n(A,E)}function n(A,E){if(E&&t(A))return!0;switch(A.length){case 2:return A==="if"||A==="in"||A==="do";case 3:return A==="var"||A==="for"||A==="new"||A==="try";case 4:return A==="this"||A==="else"||A==="case"||A==="void"||A==="with"||A==="enum";case 5:return A==="while"||A==="break"||A==="catch"||A==="throw"||A==="const"||A==="yield"||A==="class"||A==="super";case 6:return A==="return"||A==="typeof"||A==="delete"||A==="switch"||A==="export"||A==="import";case 7:return A==="default"||A==="finally"||A==="extends";case 8:return A==="function"||A==="continue"||A==="debugger";case 10:return A==="instanceof";default:return!1}}function s(A,E){return A==="null"||A==="true"||A==="false"||r(A,E)}function a(A,E){return A==="null"||A==="true"||A==="false"||n(A,E)}function o(A){return A==="eval"||A==="arguments"}function l(A){var E,g,d;if(A.length===0||(d=A.charCodeAt(0),!e.isIdentifierStartES5(d)))return!1;for(E=1,g=A.length;E=g||(D=A.charCodeAt(E),!(56320<=D&&D<=57343)))return!1;d=f(d,D)}if(!S(d))return!1;S=e.isIdentifierPartES6}return!0}function m(A,E){return l(A)&&!s(A,E)}function v(A,E){return y(A)&&!a(A,E)}keyword.exports={isKeywordES5:r,isKeywordES6:n,isReservedWordES5:s,isReservedWordES6:a,isRestrictedWord:o,isIdentifierNameES5:l,isIdentifierNameES6:y,isIdentifierES5:m,isIdentifierES6:v}})();(function(){utils.ast=ast.exports,utils.code=code.exports,utils.keyword=keyword.exports})();var sourceMap={},sourceMapGenerator={},base64Vlq={},base64={},hasRequiredBase64;function requireBase64(){if(hasRequiredBase64)return base64;hasRequiredBase64=1;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");return base64.encode=function(t){if(0<=t&&t>1;return f?-y:y}return base64Vlq.encode=function(f){var y="",m,v=a(f);do m=v&n,v>>>=t,v>0&&(m|=s),y+=e.encode(m);while(v>0);return y},base64Vlq.decode=function(f,y,m){var v=f.length,A=0,E=0,g,d;do{if(y>=v)throw new Error("Expected more digits in base 64 VLQ value.");if(d=e.decode(f.charCodeAt(y++)),d===-1)throw new Error("Invalid base64 digit: "+f.charAt(y-1));g=!!(d&s),d&=n,A=A+(d<=0;V--)$=x[V],$==="."?x.splice(V,1):$===".."?T++:T>0&&($===""?(x.splice(V+1,T),T=0):(x.splice(V,2),T--));return F=x.join("/"),F===""&&(F=_?"/":"."),B?(B.path=F,a(B)):F}e.normalize=o;function l(b,F){b===""&&(b="."),F===""&&(F=".");var B=s(F),_=s(b);if(_&&(b=_.path||"/"),B&&!B.scheme)return _&&(B.scheme=_.scheme),a(B);if(B||F.match(n))return F;if(_&&!_.host&&!_.path)return _.host=F,a(_);var x=F.charAt(0)==="/"?F:o(b.replace(/\/+$/,"")+"/"+F);return _?(_.path=x,a(_)):x}e.join=l,e.isAbsolute=function(b){return b.charAt(0)==="/"||r.test(b)};function f(b,F){b===""&&(b="."),b=b.replace(/\/$/,"");for(var B=0;F.indexOf(b+"/")!==0;){var _=b.lastIndexOf("/");if(_<0||(b=b.slice(0,_),b.match(/^([^\/]+:\/)?\/*$/)))return F;++B}return Array(B+1).join("../")+F.substr(b.length+1)}e.relative=f;var y=function(){var b=Object.create(null);return!("__proto__"in b)}();function m(b){return b}function v(b){return E(b)?"$"+b:b}e.toSetString=y?m:v;function A(b){return E(b)?b.slice(1):b}e.fromSetString=y?m:A;function E(b){if(!b)return!1;var F=b.length;if(F<9||b.charCodeAt(F-1)!==95||b.charCodeAt(F-2)!==95||b.charCodeAt(F-3)!==111||b.charCodeAt(F-4)!==116||b.charCodeAt(F-5)!==111||b.charCodeAt(F-6)!==114||b.charCodeAt(F-7)!==112||b.charCodeAt(F-8)!==95||b.charCodeAt(F-9)!==95)return!1;for(var B=F-10;B>=0;B--)if(b.charCodeAt(B)!==36)return!1;return!0}function g(b,F,B){var _=D(b.source,F.source);return _!==0||(_=b.originalLine-F.originalLine,_!==0)||(_=b.originalColumn-F.originalColumn,_!==0||B)||(_=b.generatedColumn-F.generatedColumn,_!==0)||(_=b.generatedLine-F.generatedLine,_!==0)?_:D(b.name,F.name)}e.compareByOriginalPositions=g;function d(b,F,B){var _=b.generatedLine-F.generatedLine;return _!==0||(_=b.generatedColumn-F.generatedColumn,_!==0||B)||(_=D(b.source,F.source),_!==0)||(_=b.originalLine-F.originalLine,_!==0)||(_=b.originalColumn-F.originalColumn,_!==0)?_:D(b.name,F.name)}e.compareByGeneratedPositionsDeflated=d;function D(b,F){return b===F?0:b===null?1:F===null?-1:b>F?1:-1}function S(b,F){var B=b.generatedLine-F.generatedLine;return B!==0||(B=b.generatedColumn-F.generatedColumn,B!==0)||(B=D(b.source,F.source),B!==0)||(B=b.originalLine-F.originalLine,B!==0)||(B=b.originalColumn-F.originalColumn,B!==0)?B:D(b.name,F.name)}e.compareByGeneratedPositionsInflated=S;function k(b){return JSON.parse(b.replace(/^\)]}'[^\n]*\n/,""))}e.parseSourceMapInput=k;function N(b,F,B){if(F=F||"",b&&(b[b.length-1]!=="/"&&F[0]!=="/"&&(b+="/"),F=b+F),B){var _=s(B);if(!_)throw new Error("sourceMapURL could not be parsed");if(_.path){var x=_.path.lastIndexOf("/");x>=0&&(_.path=_.path.substring(0,x+1))}F=l(a(_),F)}return o(F)}e.computeSourceURL=N}(util)),util}var arraySet={},hasRequiredArraySet;function requireArraySet(){if(hasRequiredArraySet)return arraySet;hasRequiredArraySet=1;var e=requireUtil(),t=Object.prototype.hasOwnProperty,r=typeof Map<"u";function n(){this._array=[],this._set=r?new Map:Object.create(null)}return n.fromArray=function(a,o){for(var l=new n,f=0,y=a.length;f=0)return o}else{var l=e.toSetString(a);if(t.call(this._set,l))return this._set[l]}throw new Error('"'+a+'" is not in the set.')},n.prototype.at=function(a){if(a>=0&&aa||o==a&&f>=l||e.compareByGeneratedPositionsInflated(n,s)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}return r.prototype.unsortedForEach=function(s,a){this._array.forEach(s,a)},r.prototype.add=function(s){t(this._last,s)?(this._last=s,this._array.push(s)):(this._sorted=!1,this._array.push(s))},r.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},mappingList.MappingList=r,mappingList}var hasRequiredSourceMapGenerator;function requireSourceMapGenerator(){if(hasRequiredSourceMapGenerator)return sourceMapGenerator;hasRequiredSourceMapGenerator=1;var e=requireBase64Vlq(),t=requireUtil(),r=requireArraySet().ArraySet,n=requireMappingList().MappingList;function s(a){a||(a={}),this._file=t.getArg(a,"file",null),this._sourceRoot=t.getArg(a,"sourceRoot",null),this._skipValidation=t.getArg(a,"skipValidation",!1),this._sources=new r,this._names=new r,this._mappings=new n,this._sourcesContents=null}return s.prototype._version=3,s.fromSourceMap=function(o){var l=o.sourceRoot,f=new s({file:o.file,sourceRoot:l});return o.eachMapping(function(y){var m={generated:{line:y.generatedLine,column:y.generatedColumn}};y.source!=null&&(m.source=y.source,l!=null&&(m.source=t.relative(l,m.source)),m.original={line:y.originalLine,column:y.originalColumn},y.name!=null&&(m.name=y.name)),f.addMapping(m)}),o.sources.forEach(function(y){var m=y;l!==null&&(m=t.relative(l,y)),f._sources.has(m)||f._sources.add(m);var v=o.sourceContentFor(y);v!=null&&f.setSourceContent(y,v)}),f},s.prototype.addMapping=function(o){var l=t.getArg(o,"generated"),f=t.getArg(o,"original",null),y=t.getArg(o,"source",null),m=t.getArg(o,"name",null);this._skipValidation||this._validateMapping(l,f,y,m),y!=null&&(y=String(y),this._sources.has(y)||this._sources.add(y)),m!=null&&(m=String(m),this._names.has(m)||this._names.add(m)),this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:f!=null&&f.line,originalColumn:f!=null&&f.column,source:y,name:m})},s.prototype.setSourceContent=function(o,l){var f=o;this._sourceRoot!=null&&(f=t.relative(this._sourceRoot,f)),l!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(f)]=l):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(f)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},s.prototype.applySourceMap=function(o,l,f){var y=l;if(l==null){if(o.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);y=o.file}var m=this._sourceRoot;m!=null&&(y=t.relative(m,y));var v=new r,A=new r;this._mappings.unsortedForEach(function(E){if(E.source===y&&E.originalLine!=null){var g=o.originalPositionFor({line:E.originalLine,column:E.originalColumn});g.source!=null&&(E.source=g.source,f!=null&&(E.source=t.join(f,E.source)),m!=null&&(E.source=t.relative(m,E.source)),E.originalLine=g.line,E.originalColumn=g.column,g.name!=null&&(E.name=g.name))}var d=E.source;d!=null&&!v.has(d)&&v.add(d);var D=E.name;D!=null&&!A.has(D)&&A.add(D)},this),this._sources=v,this._names=A,o.sources.forEach(function(E){var g=o.sourceContentFor(E);g!=null&&(f!=null&&(E=t.join(f,E)),m!=null&&(E=t.relative(m,E)),this.setSourceContent(E,g))},this)},s.prototype._validateMapping=function(o,l,f,y){if(l&&typeof l.line!="number"&&typeof l.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(o&&"line"in o&&"column"in o&&o.line>0&&o.column>=0&&!l&&!f&&!y)){if(o&&"line"in o&&"column"in o&&l&&"line"in l&&"column"in l&&o.line>0&&o.column>=0&&l.line>0&&l.column>=0&&f)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:o,source:f,original:l,name:y}))}},s.prototype._serializeMappings=function(){for(var o=0,l=1,f=0,y=0,m=0,v=0,A="",E,g,d,D,S=this._mappings.toArray(),k=0,N=S.length;k0){if(!t.compareByGeneratedPositionsInflated(g,S[k-1]))continue;E+=","}E+=e.encode(g.generatedColumn-o),o=g.generatedColumn,g.source!=null&&(D=this._sources.indexOf(g.source),E+=e.encode(D-v),v=D,E+=e.encode(g.originalLine-1-y),y=g.originalLine-1,E+=e.encode(g.originalColumn-f),f=g.originalColumn,g.name!=null&&(d=this._names.indexOf(g.name),E+=e.encode(d-m),m=d)),A+=E}return A},s.prototype._generateSourcesContent=function(o,l){return o.map(function(f){if(!this._sourcesContents)return null;l!=null&&(f=t.relative(l,f));var y=t.toSetString(f);return Object.prototype.hasOwnProperty.call(this._sourcesContents,y)?this._sourcesContents[y]:null},this)},s.prototype.toJSON=function(){var o={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(o.file=this._file),this._sourceRoot!=null&&(o.sourceRoot=this._sourceRoot),this._sourcesContents&&(o.sourcesContent=this._generateSourcesContent(o.sources,o.sourceRoot)),o},s.prototype.toString=function(){return JSON.stringify(this.toJSON())},sourceMapGenerator.SourceMapGenerator=s,sourceMapGenerator}var sourceMapConsumer={},binarySearch={},hasRequiredBinarySearch;function requireBinarySearch(){return hasRequiredBinarySearch||(hasRequiredBinarySearch=1,function(e){e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2;function t(r,n,s,a,o,l){var f=Math.floor((n-r)/2)+r,y=o(s,a[f],!0);return y===0?f:y>0?n-f>1?t(f,n,s,a,o,l):l==e.LEAST_UPPER_BOUND?n1?t(r,f,s,a,o,l):l==e.LEAST_UPPER_BOUND?f:r<0?-1:r}e.search=function(n,s,a,o){if(s.length===0)return-1;var l=t(-1,s.length,n,s,a,o||e.GREATEST_LOWER_BOUND);if(l<0)return-1;for(;l-1>=0&&a(s[l],s[l-1],!0)===0;)--l;return l}}(binarySearch)),binarySearch}var quickSort={},hasRequiredQuickSort;function requireQuickSort(){if(hasRequiredQuickSort)return quickSort;hasRequiredQuickSort=1;function e(n,s,a){var o=n[s];n[s]=n[a],n[a]=o}function t(n,s){return Math.round(n+Math.random()*(s-n))}function r(n,s,a,o){if(a=0){var d=this._originalMappings[g];if(m.column===void 0)for(var D=d.originalLine;d&&d.originalLine===D;)E.push({line:e.getArg(d,"generatedLine",null),column:e.getArg(d,"generatedColumn",null),lastColumn:e.getArg(d,"lastGeneratedColumn",null)}),d=this._originalMappings[++g];else for(var S=d.originalColumn;d&&d.originalLine===v&&d.originalColumn==S;)E.push({line:e.getArg(d,"generatedLine",null),column:e.getArg(d,"generatedColumn",null),lastColumn:e.getArg(d,"lastGeneratedColumn",null)}),d=this._originalMappings[++g]}return E},sourceMapConsumer.SourceMapConsumer=a;function o(y,m){var v=y;typeof y=="string"&&(v=e.parseSourceMapInput(y));var A=e.getArg(v,"version"),E=e.getArg(v,"sources"),g=e.getArg(v,"names",[]),d=e.getArg(v,"sourceRoot",null),D=e.getArg(v,"sourcesContent",null),S=e.getArg(v,"mappings"),k=e.getArg(v,"file",null);if(A!=this._version)throw new Error("Unsupported version: "+A);d&&(d=e.normalize(d)),E=E.map(String).map(e.normalize).map(function(N){return d&&e.isAbsolute(d)&&e.isAbsolute(N)?e.relative(d,N):N}),this._names=r.fromArray(g.map(String),!0),this._sources=r.fromArray(E,!0),this._absoluteSources=this._sources.toArray().map(function(N){return e.computeSourceURL(d,N,m)}),this.sourceRoot=d,this.sourcesContent=D,this._mappings=S,this._sourceMapURL=m,this.file=k}o.prototype=Object.create(a.prototype),o.prototype.consumer=a,o.prototype._findSourceIndex=function(y){var m=y;if(this.sourceRoot!=null&&(m=e.relative(this.sourceRoot,m)),this._sources.has(m))return this._sources.indexOf(m);var v;for(v=0;v1&&(x.source=D+T[1],D+=T[1],x.originalLine=g+T[2],g=x.originalLine,x.originalLine+=1,x.originalColumn=d+T[3],d=x.originalColumn,T.length>4&&(x.name=S+T[4],S+=T[4])),_.push(x),typeof x.originalLine=="number"&&B.push(x)}s(_,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=_,s(B,e.compareByOriginalPositions),this.__originalMappings=B},o.prototype._findMapping=function(m,v,A,E,g,d){if(m[A]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+m[A]);if(m[E]<0)throw new TypeError("Column must be greater than or equal to 0, got "+m[E]);return t.search(m,v,g,d)},o.prototype.computeColumnSpans=function(){for(var m=0;m=0){var E=this._generatedMappings[A];if(E.generatedLine===v.generatedLine){var g=e.getArg(E,"source",null);g!==null&&(g=this._sources.at(g),g=e.computeSourceURL(this.sourceRoot,g,this._sourceMapURL));var d=e.getArg(E,"name",null);return d!==null&&(d=this._names.at(d)),{source:g,line:e.getArg(E,"originalLine",null),column:e.getArg(E,"originalColumn",null),name:d}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(m){return m==null}):!1},o.prototype.sourceContentFor=function(m,v){if(!this.sourcesContent)return null;var A=this._findSourceIndex(m);if(A>=0)return this.sourcesContent[A];var E=m;this.sourceRoot!=null&&(E=e.relative(this.sourceRoot,E));var g;if(this.sourceRoot!=null&&(g=e.urlParse(this.sourceRoot))){var d=E.replace(/^file:\/\//,"");if(g.scheme=="file"&&this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];if((!g.path||g.path=="/")&&this._sources.has("/"+E))return this.sourcesContent[this._sources.indexOf("/"+E)]}if(v)return null;throw new Error('"'+E+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(m){var v=e.getArg(m,"source");if(v=this._findSourceIndex(v),v<0)return{line:null,column:null,lastColumn:null};var A={source:v,originalLine:e.getArg(m,"line"),originalColumn:e.getArg(m,"column")},E=this._findMapping(A,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(m,"bias",a.GREATEST_LOWER_BOUND));if(E>=0){var g=this._originalMappings[E];if(g.source===A.source)return{line:e.getArg(g,"generatedLine",null),column:e.getArg(g,"generatedColumn",null),lastColumn:e.getArg(g,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},sourceMapConsumer.BasicSourceMapConsumer=o;function f(y,m){var v=y;typeof y=="string"&&(v=e.parseSourceMapInput(y));var A=e.getArg(v,"version"),E=e.getArg(v,"sections");if(A!=this._version)throw new Error("Unsupported version: "+A);this._sources=new r,this._names=new r;var g={line:-1,column:0};this._sections=E.map(function(d){if(d.url)throw new Error("Support for url field in sections not implemented.");var D=e.getArg(d,"offset"),S=e.getArg(D,"line"),k=e.getArg(D,"column");if(S=0;f--)this.prepend(l[f]);else if(l[s]||typeof l=="string")this.children.unshift(l);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+l);return this},a.prototype.walk=function(l){for(var f,y=0,m=this.children.length;y0){for(f=[],y=0;y=6.0"},maintainers=[{name:"Yusuke Suzuki",email:"utatane.tea@gmail.com",web:"http://github.com/Constellation"}],repository={type:"git",url:"http://github.com/estools/escodegen.git"},dependencies={estraverse:"^5.2.0",esutils:"^2.0.2",esprima:"^4.0.1",optionator:"^0.8.1"},optionalDependencies={"source-map":"~0.6.1"},devDependencies={acorn:"^7.3.1",bluebird:"^3.4.7","bower-registry-client":"^1.0.0",chai:"^4.2.0","chai-exclude":"^2.0.2","commonjs-everywhere":"^0.9.7",gulp:"^3.8.10","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1",semver:"^5.1.0"},license="BSD-2-Clause",scripts={test:"gulp travis","unit-test":"gulp test",lint:"gulp lint",release:"node tools/release.js","build-min":"./node_modules/.bin/cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js",build:"./node_modules/.bin/cjsify -a path: tools/entry-point.js > escodegen.browser.js"},require$$3={name,description,homepage,main,bin,files,version:version$1,engines,maintainers,repository,dependencies,optionalDependencies,devDependencies,license,scripts};(function(e){(function(){var t,r,n,s,a,o,l,f,y,m,v,A,E,g,d,D,S,k,N,b,F,B,_,x,$,T;a=estraverse,o=utils,t=a.Syntax;function V(u){return J.Expression.hasOwnProperty(u.type)}function M(u){return J.Statement.hasOwnProperty(u.type)}r={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,LogicalOR:3,LogicalAND:4,BitwiseOR:5,BitwiseXOR:6,BitwiseAND:7,Equality:8,Relational:9,BitwiseSHIFT:10,Additive:11,Multiplicative:12,Exponentiation:13,Await:14,Unary:14,Postfix:15,OptionalChaining:16,Call:17,New:18,TaggedTemplate:19,Member:20,Primary:21},n={"||":r.LogicalOR,"&&":r.LogicalAND,"|":r.BitwiseOR,"^":r.BitwiseXOR,"&":r.BitwiseAND,"==":r.Equality,"!=":r.Equality,"===":r.Equality,"!==":r.Equality,is:r.Equality,isnt:r.Equality,"<":r.Relational,">":r.Relational,"<=":r.Relational,">=":r.Relational,in:r.Relational,instanceof:r.Relational,"<<":r.BitwiseSHIFT,">>":r.BitwiseSHIFT,">>>":r.BitwiseSHIFT,"+":r.Additive,"-":r.Additive,"*":r.Multiplicative,"%":r.Multiplicative,"/":r.Multiplicative,"**":r.Exponentiation};var L=1,W=1<<1,Q=1<<2,Z=1<<3,X=1<<4,j=1<<5,ue=W|Q,ae=L|W,R=L|W|Q,pe=L,me=Q,K=L|Q,U=L,ne=L|j,ye=0,re=L|X,Ce=L|Z;function Ee(){return{indent:null,base:null,parse:null,comment:!1,format:{indent:{style:" ",base:0,adjustMultilineComment:!1},newline:` -`,space:" ",json:!1,renumber:!1,hexadecimal:!1,quotes:"single",escapeless:!1,compact:!1,parentheses:!0,semicolons:!0,safeConcatenation:!1,preserveBlankLines:!1},moz:{comprehensionExpressionStartsWithAssignment:!1,starlessGenerator:!1},sourceMap:null,sourceMapRoot:null,sourceMapWithCode:!1,directive:!1,raw:!0,verbatim:null,sourceCode:null}}function oe(u,p){var c="";for(p|=0;p>0;p>>>=1,u+=u)p&1&&(c+=u);return c}function De(u){return/[\r\n]/g.test(u)}function G(u){var p=u.length;return p&&o.code.isLineTerminator(u.charCodeAt(p-1))}function le(u,p){var c;for(c in p)p.hasOwnProperty(c)&&(u[c]=p[c]);return u}function de(u,p){var c,h;function C(w){return typeof w=="object"&&w instanceof Object&&!(w instanceof RegExp)}for(c in p)p.hasOwnProperty(c)&&(h=p[c],C(h)?C(u[c])?de(u[c],h):u[c]=de({},h):u[c]=h);return u}function we(u){var p,c,h,C,w;if(u!==u)throw new Error("Numeric literal whose value is NaN");if(u<0||u===0&&1/u<0)throw new Error("Numeric literal whose value is negative");if(u===1/0)return y?"null":m?"1e400":"1e+400";if(p=""+u,!m||p.length<3)return p;for(c=p.indexOf("."),!y&&p.charCodeAt(0)===48&&c===1&&(c=0,p=p.slice(1)),h=p,p=p.replace("e+","e"),C=0,(w=h.indexOf("e"))>0&&(C=+h.slice(w+1),h=h.slice(0,w)),c>=0&&(C-=h.length-c-1,h=+(h.slice(0,c)+h.slice(c+1))+""),w=0;h.charCodeAt(h.length+w-1)===48;)--w;return w!==0&&(C-=w,h=h.slice(0,w)),C!==0&&(h+="e"+C),(h.length1e12&&Math.floor(u)===u&&(h="0x"+u.toString(16)).length255?"\\u"+"0000".slice(c.length)+c:u===0&&!o.code.isDecimalDigit(p)?"\\0":u===11?"\\x0B":"\\x"+"00".slice(c.length)+c)}function Le(u){if(u===92)return"\\\\";if(u===10)return"\\n";if(u===13)return"\\r";if(u===8232)return"\\u2028";if(u===8233)return"\\u2029";throw new Error("Incorrectly classified character")}function Re(u){var p,c,h,C;for(C=A==="double"?'"':"'",p=0,c=u.length;p126))){p+=Te(C,u.charCodeAt(c+1));continue}p+=String.fromCharCode(C)}if(P=!(A==="double"||A==="auto"&&I=0&&!o.code.isLineTerminator(u.charCodeAt(p));--p);return u.length-1-p}function Ve(u,p){var c,h,C,w,I,P,O,z;for(c=u.split(/\r\n|[\r\n]/),P=Number.MAX_VALUE,h=1,C=c.length;hI&&(P=I)}for(typeof p<"u"?(O=l,c[1][P]==="*"&&(p+=" "),l=p):(P&1&&--P,O=l),h=1,C=c.length;h0){if(w=p,x){for(C=u.leadingComments[0],p=[],z=C.extendedRange,te=C.range,be=_.substring(z[0],te[0]),he=(be.match(/\n/g)||[]).length,he>0?(p.push(oe(` -`,he)),p.push(se(fe(C)))):(p.push(be),p.push(fe(C))),Ae=te,c=1,h=u.leadingComments.length;c0?(p.push(oe(` -`,he)),p.push(se(fe(C)))):(p.push(be),p.push(fe(C)));else for(I=!G(H(p).toString()),P=oe(" ",Me(H([l,p,f]).toString())),c=0,h=u.trailingComments.length;c")),u.expression?(p.push(d),c=this.generateExpression(u.body,r.Assignment,R),c.toString().charAt(0)==="{"&&(c=["(",c,")"]),p.push(c)):p.push(this.maybeBlock(u.body,Ce)),p},J.prototype.generateIterationForStatement=function(u,p,c){var h=["for"+(p.await?ie()+"await":"")+d+"("],C=this;return Y(function(){p.left.type===t.VariableDeclaration?Y(function(){h.push(p.left.kind+ie()),h.push(C.generateStatement(p.left.declarations[0],ye))}):h.push(C.generateExpression(p.left,r.Call,R)),h=q(h,u),h=[q(h,C.generateExpression(p.right,r.Assignment,R)),")"]}),h.push(this.maybeBlock(p.body,c)),h},J.prototype.generatePropertyKey=function(u,p){var c=[];return p&&c.push("["),c.push(this.generateExpression(u,r.Assignment,R)),p&&c.push("]"),c},J.prototype.generateAssignment=function(u,p,c,h,C){return r.Assignment2&&(h=_.substring(c[0]+1,c[1]-1),h[0]===` -`&&(C=["{"]),C.push(h)));var I,P,O,z;for(z=U,p&Z&&(z|=X),I=0,P=u.body.length;I0&&!u.body[I-1].trailingComments&&!u.body[I].leadingComments&&ve(u.body[I-1].range[1],u.body[I].range[0],C)),I===P-1&&(z|=j),u.body[I].leadingComments&&x?O=w.generateStatement(u.body[I],z):O=se(w.generateStatement(u.body[I],z)),C.push(O),G(H(O).toString())||x&&I1?Y(O):O(),c.push(this.semicolon(p)),c},ThrowStatement:function(u,p){return[q("throw",this.generateExpression(u.argument,r.Sequence,R)),this.semicolon(p)]},TryStatement:function(u,p){var c,h,C,w;if(c=["try",this.maybeBlock(u.block,U)],c=this.maybeBlockSuffix(u.block,c),u.handlers)for(h=0,C=u.handlers.length;h0?` -`:""],I=re,C=0;C0&&!u.body[C-1].trailingComments&&!u.body[C].leadingComments&&ve(u.body[C-1].range[1],u.body[C].range[0],c)),h=se(this.generateStatement(u.body[C],I)),c.push(h),C+10){for(h.push("("),w=0,I=C;w=2&&C.charCodeAt(0)===48)&&h.push(" ")),h.push(u.optional?"?.":"."),h.push(ce(u.property))),ee(h,r.Member,p)},MetaProperty:function(u,p,c){var h;return h=[],h.push(typeof u.meta=="string"?u.meta:ce(u.meta)),h.push("."),h.push(typeof u.property=="string"?u.property:ce(u.property)),ee(h,r.Member,p)},UnaryExpression:function(u,p,c){var h,C,w,I,P;return C=this.generateExpression(u.argument,r.Unary,R),d===""?h=q(u.operator,C):(h=[u.operator],u.operator.length>2?h=q(h,C):(I=H(h).toString(),P=I.charCodeAt(I.length-1),w=C.toString().charCodeAt(0),((P===43||P===45)&&P===w||o.code.isIdentifierPartES5(P)&&o.code.isIdentifierPartES5(w))&&h.push(ie()),h.push(C))),ee(h,r.Unary,p)},YieldExpression:function(u,p,c){var h;return u.delegate?h="yield*":h="yield",u.argument&&(h=q(h,this.generateExpression(u.argument,r.Yield,R))),ee(h,r.Yield,p)},AwaitExpression:function(u,p,c){var h=q(u.all?"await*":"await",this.generateExpression(u.argument,r.Await,R));return ee(h,r.Await,p)},UpdateExpression:function(u,p,c){return u.prefix?ee([u.operator,this.generateExpression(u.argument,r.Unary,R)],r.Unary,p):ee([this.generateExpression(u.argument,r.Postfix,R),u.operator],r.Postfix,p)},FunctionExpression:function(u,p,c){var h=[Fe(u,!0),"function"];return u.id?(h.push(Se(u)||ie()),h.push(ce(u.id))):h.push(Se(u)||d),h.push(this.generateFunctionBody(u)),h},ArrayPattern:function(u,p,c){return this.ArrayExpression(u,p,c,!0)},ArrayExpression:function(u,p,c,h){var C,w,I=this;return u.elements.length?(w=h?!1:u.elements.length>1,C=["[",w?g:""],Y(function(P){var O,z;for(O=0,z=u.elements.length;O1,Y(function(){w=I.generateExpression(u.properties[0],r.Sequence,R)}),!h&&!De(H(w).toString())?["{",d,w,d,"}"]:(Y(function(P){var O,z;if(C=["{",g,P,w],h)for(C.push(","+g),O=1,z=u.properties.length;O0||b.moz.comprehensionExpressionStartsWithAssignment?h=q(h,I):h.push(I)}),u.filter&&(h=q(h,"if"+d),I=this.generateExpression(u.filter,r.Sequence,R),h=q(h,["(",I,")"])),b.moz.comprehensionExpressionStartsWithAssignment||(I=this.generateExpression(u.body,r.Assignment,R),h=q(h,I)),h.push(u.type===t.GeneratorExpression?")":"]"),h},ComprehensionBlock:function(u,p,c){var h;return u.left.type===t.VariableDeclaration?h=[u.left.kind,ie(),this.generateStatement(u.left.declarations[0],ye)]:h=this.generateExpression(u.left,r.Call,R),h=q(h,u.of?"of":"in"),h=q(h,this.generateExpression(u.right,r.Sequence,R)),["for"+d+"(",h,")"]},SpreadElement:function(u,p,c){return["...",this.generateExpression(u.argument,r.Assignment,R)]},TaggedTemplateExpression:function(u,p,c){var h=ae;c&W||(h=pe);var C=[this.generateExpression(u.tag,r.Call,h),this.generateExpression(u.quasi,r.Primary,me)];return ee(C,r.TaggedTemplate,p)},TemplateElement:function(u,p,c){return u.value.raw},TemplateLiteral:function(u,p,c){var h,C,w;for(h=["`"],C=0,w=u.quasis.length;Ce)return!1;if(r+=t[n+1],r>=e)return!0}}function isIdentifierStart(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&nonASCIIidentifierStart.test(String.fromCharCode(e)):t===!1?!1:isInAstralSet(e,astralIdentifierStartCodes)}function isIdentifierChar(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&nonASCIIidentifier.test(String.fromCharCode(e)):t===!1?!1:isInAstralSet(e,astralIdentifierStartCodes)||isInAstralSet(e,astralIdentifierCodes)}var TokenType=function e(t,r){r===void 0&&(r={}),this.label=t,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop||null,this.updateContext=null};function binop(e,t){return new TokenType(e,{beforeExpr:!0,binop:t})}var beforeExpr={beforeExpr:!0},startsExpr={startsExpr:!0},keywords={};function kw(e,t){return t===void 0&&(t={}),t.keyword=e,keywords[e]=new TokenType(e,t)}var types$1={num:new TokenType("num",startsExpr),regexp:new TokenType("regexp",startsExpr),string:new TokenType("string",startsExpr),name:new TokenType("name",startsExpr),privateId:new TokenType("privateId",startsExpr),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:!0,startsExpr:!0}),braceR:new TokenType("}"),parenL:new TokenType("(",{beforeExpr:!0,startsExpr:!0}),parenR:new TokenType(")"),comma:new TokenType(",",beforeExpr),semi:new TokenType(";",beforeExpr),colon:new TokenType(":",beforeExpr),dot:new TokenType("."),question:new TokenType("?",beforeExpr),questionDot:new TokenType("?."),arrow:new TokenType("=>",beforeExpr),template:new TokenType("template"),invalidTemplate:new TokenType("invalidTemplate"),ellipsis:new TokenType("...",beforeExpr),backQuote:new TokenType("`",startsExpr),dollarBraceL:new TokenType("${",{beforeExpr:!0,startsExpr:!0}),eq:new TokenType("=",{beforeExpr:!0,isAssign:!0}),assign:new TokenType("_=",{beforeExpr:!0,isAssign:!0}),incDec:new TokenType("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new TokenType("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop("||",1),logicalAND:binop("&&",2),bitwiseOR:binop("|",3),bitwiseXOR:binop("^",4),bitwiseAND:binop("&",5),equality:binop("==/!=/===/!==",6),relational:binop("/<=/>=",7),bitShift:binop("<>/>>>",8),plusMin:new TokenType("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop("%",10),star:binop("*",10),slash:binop("/",10),starstar:new TokenType("**",{beforeExpr:!0}),coalesce:binop("??",1),_break:kw("break"),_case:kw("case",beforeExpr),_catch:kw("catch"),_continue:kw("continue"),_debugger:kw("debugger"),_default:kw("default",beforeExpr),_do:kw("do",{isLoop:!0,beforeExpr:!0}),_else:kw("else",beforeExpr),_finally:kw("finally"),_for:kw("for",{isLoop:!0}),_function:kw("function",startsExpr),_if:kw("if"),_return:kw("return",beforeExpr),_switch:kw("switch"),_throw:kw("throw",beforeExpr),_try:kw("try"),_var:kw("var"),_const:kw("const"),_while:kw("while",{isLoop:!0}),_with:kw("with"),_new:kw("new",{beforeExpr:!0,startsExpr:!0}),_this:kw("this",startsExpr),_super:kw("super",startsExpr),_class:kw("class",startsExpr),_extends:kw("extends",beforeExpr),_export:kw("export"),_import:kw("import",startsExpr),_null:kw("null",startsExpr),_true:kw("true",startsExpr),_false:kw("false",startsExpr),_in:kw("in",{beforeExpr:!0,binop:7}),_instanceof:kw("instanceof",{beforeExpr:!0,binop:7}),_typeof:kw("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},lineBreak=/\r\n?|\n|\u2028|\u2029/,lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(e){return e===10||e===13||e===8232||e===8233}function nextLineBreak(e,t,r){r===void 0&&(r=e.length);for(var n=t;n>10)+55296,(e&1023)+56320))}var loneSurrogate=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Position=function e(t,r){this.line=t,this.column=r};Position.prototype.offset=function e(t){return new Position(this.line,this.column+t)};var SourceLocation=function e(t,r,n){this.start=r,this.end=n,t.sourceFile!==null&&(this.source=t.sourceFile)};function getLineInfo(e,t){for(var r=1,n=0;;){var s=nextLineBreak(e,n,t);if(s<0)return new Position(r,t-n);++r,n=s}}var defaultOptions={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},warnedAboutEcmaVersion=!1;function getOptions(e){var t={};for(var r in defaultOptions)t[r]=e&&hasOwn(e,r)?e[r]:defaultOptions[r];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!warnedAboutEcmaVersion&&typeof console=="object"&&console.warn&&(warnedAboutEcmaVersion=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required. -Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),e.allowHashBang==null&&(t.allowHashBang=t.ecmaVersion>=14),isArray(t.onToken)){var n=t.onToken;t.onToken=function(s){return n.push(s)}}return isArray(t.onComment)&&(t.onComment=pushComment(t,t.onComment)),t}function pushComment(e,t){return function(r,n,s,a,o,l){var f={type:r?"Block":"Line",value:n,start:s,end:a};e.locations&&(f.loc=new SourceLocation(this,o,l)),e.ranges&&(f.range=[s,a]),t.push(f)}}var SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_ASYNC=4,SCOPE_GENERATOR=8,SCOPE_ARROW=16,SCOPE_SIMPLE_CATCH=32,SCOPE_SUPER=64,SCOPE_DIRECT_SUPER=128,SCOPE_CLASS_STATIC_BLOCK=256,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK;function functionFlags(e,t){return SCOPE_FUNCTION|(e?SCOPE_ASYNC:0)|(t?SCOPE_GENERATOR:0)}var BIND_NONE=0,BIND_VAR=1,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,BIND_OUTSIDE=5,Parser=function e(t,r,n){this.options=t=getOptions(t),this.sourceFile=t.sourceFile,this.keywords=wordsRegexp(keywords$1[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=reservedWords[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=wordsRegexp(s);var a=(s?s+" ":"")+reservedWords.strict;this.reservedWordsStrict=wordsRegexp(a),this.reservedWordsStrictBind=wordsRegexp(a+" "+reservedWords.strictBind),this.input=String(r),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(` -`,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(lineBreak).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=types$1.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(SCOPE_TOP),this.regexpState=null,this.privateNameStack=[]},prototypeAccessors={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Parser.prototype.parse=function e(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};prototypeAccessors.inFunction.get=function(){return(this.currentVarScope().flags&SCOPE_FUNCTION)>0};prototypeAccessors.inGenerator.get=function(){return(this.currentVarScope().flags&SCOPE_GENERATOR)>0&&!this.currentVarScope().inClassFieldInit};prototypeAccessors.inAsync.get=function(){return(this.currentVarScope().flags&SCOPE_ASYNC)>0&&!this.currentVarScope().inClassFieldInit};prototypeAccessors.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&SCOPE_CLASS_STATIC_BLOCK)return!1;if(t.flags&SCOPE_FUNCTION)return(t.flags&SCOPE_ASYNC)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};prototypeAccessors.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(t&SCOPE_SUPER)>0||r||this.options.allowSuperOutsideMethod};prototypeAccessors.allowDirectSuper.get=function(){return(this.currentThisScope().flags&SCOPE_DIRECT_SUPER)>0};prototypeAccessors.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};prototypeAccessors.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,r=e.inClassFieldInit;return(t&(SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK))>0||r};prototypeAccessors.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&SCOPE_CLASS_STATIC_BLOCK)>0};Parser.extend=function e(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];for(var n=this,s=0;s=,?^&]/.test(s)||s==="!"&&this.input.charAt(n+1)==="=")}e+=t[0].length,skipWhiteSpace.lastIndex=e,e+=skipWhiteSpace.exec(this.input)[0].length,this.input[e]===";"&&e++}};pp$9.eat=function(e){return this.type===e?(this.next(),!0):!1};pp$9.isContextual=function(e){return this.type===types$1.name&&this.value===e&&!this.containsEsc};pp$9.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};pp$9.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};pp$9.canInsertSemicolon=function(){return this.type===types$1.eof||this.type===types$1.braceR||lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};pp$9.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};pp$9.semicolon=function(){!this.eat(types$1.semi)&&!this.insertSemicolon()&&this.unexpected()};pp$9.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};pp$9.expect=function(e){this.eat(e)||this.unexpected()};pp$9.unexpected=function(e){this.raise(e!=null?e:this.start,"Unexpected token")};var DestructuringErrors=function e(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};pp$9.checkPatternErrors=function(e,t){if(!!e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}};pp$9.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,n=e.doubleProto;if(!t)return r>=0||n>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")};pp$9.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos55295&&n<56320)return!0;if(e)return!1;if(n===123)return!0;if(isIdentifierStart(n,!0)){for(var s=r+1;isIdentifierChar(n=this.input.charCodeAt(s),!0);)++s;if(n===92||n>55295&&n<56320)return!0;var a=this.input.slice(r,s);if(!keywordRelationalOperator.test(a))return!0}return!1};pp$8.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;skipWhiteSpace.lastIndex=this.pos;var e=skipWhiteSpace.exec(this.input),t=this.pos+e[0].length,r;return!lineBreak.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(isIdentifierChar(r=this.input.charCodeAt(t+8))||r>55295&&r<56320))};pp$8.parseStatement=function(e,t,r){var n=this.type,s=this.startNode(),a;switch(this.isLet(e)&&(n=types$1._var,a="let"),n){case types$1._break:case types$1._continue:return this.parseBreakContinueStatement(s,n.keyword);case types$1._debugger:return this.parseDebuggerStatement(s);case types$1._do:return this.parseDoStatement(s);case types$1._for:return this.parseForStatement(s);case types$1._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case types$1._class:return e&&this.unexpected(),this.parseClass(s,!0);case types$1._if:return this.parseIfStatement(s);case types$1._return:return this.parseReturnStatement(s);case types$1._switch:return this.parseSwitchStatement(s);case types$1._throw:return this.parseThrowStatement(s);case types$1._try:return this.parseTryStatement(s);case types$1._const:case types$1._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(s,a);case types$1._while:return this.parseWhileStatement(s);case types$1._with:return this.parseWithStatement(s);case types$1.braceL:return this.parseBlock(!0,s);case types$1.semi:return this.parseEmptyStatement(s);case types$1._export:case types$1._import:if(this.options.ecmaVersion>10&&n===types$1._import){skipWhiteSpace.lastIndex=this.pos;var o=skipWhiteSpace.exec(this.input),l=this.pos+o[0].length,f=this.input.charCodeAt(l);if(f===40||f===46)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===types$1._import?this.parseImport(s):this.parseExport(s,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var y=this.value,m=this.parseExpression();return n===types$1.name&&m.type==="Identifier"&&this.eat(types$1.colon)?this.parseLabeledStatement(s,y,m,e):this.parseExpressionStatement(s,m)}};pp$8.parseBreakContinueStatement=function(e,t){var r=t==="break";this.next(),this.eat(types$1.semi)||this.insertSemicolon()?e.label=null:this.type!==types$1.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n=6?this.eat(types$1.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};pp$8.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(loopLabel),this.enterScope(0),this.expect(types$1.parenL),this.type===types$1.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===types$1._var||this.type===types$1._const||r){var n=this.startNode(),s=r?"let":this.value;return this.next(),this.parseVar(n,!0,s),this.finishNode(n,"VariableDeclaration"),(this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&n.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===types$1._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,n)):(t>-1&&this.unexpected(t),this.parseFor(e,n))}var a=this.isContextual("let"),o=!1,l=new DestructuringErrors,f=this.parseExpression(t>-1?"await":!0,l);return this.type===types$1._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(this.options.ecmaVersion>=9&&(this.type===types$1._in?t>-1&&this.unexpected(t):e.await=t>-1),a&&o&&this.raise(f.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(f,!1,l),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(l,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))};pp$8.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,FUNC_STATEMENT|(r?0:FUNC_HANGING_STATEMENT),!1,t)};pp$8.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(types$1._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};pp$8.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(types$1.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};pp$8.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(types$1.braceL),this.labels.push(switchLabel),this.enterScope(0);for(var t,r=!1;this.type!==types$1.braceR;)if(this.type===types$1._case||this.type===types$1._default){var n=this.type===types$1._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(types$1.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};pp$8.parseThrowStatement=function(e){return this.next(),lineBreak.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var empty$1=[];pp$8.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===types$1._catch){var t=this.startNode();if(this.next(),this.eat(types$1.parenL)){t.param=this.parseBindingAtom();var r=t.param.type==="Identifier";this.enterScope(r?SCOPE_SIMPLE_CATCH:0),this.checkLValPattern(t.param,r?BIND_SIMPLE_CATCH:BIND_LEXICAL),this.expect(types$1.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0);t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(types$1._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};pp$8.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")};pp$8.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(loopLabel),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};pp$8.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};pp$8.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};pp$8.parseLabeledStatement=function(e,t,r,n){for(var s=0,a=this.labels;s=0;f--){var y=this.labels[f];if(y.statementStart===e.start)y.statementStart=this.start,y.kind=l;else break}return this.labels.push({name:t,kind:l,statementStart:this.start}),e.body=this.parseStatement(n?n.indexOf("label")===-1?n+"label":n:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")};pp$8.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};pp$8.parseBlock=function(e,t,r){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(types$1.braceL),e&&this.enterScope(0);this.type!==types$1.braceR;){var n=this.parseStatement(null);t.body.push(n)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};pp$8.parseFor=function(e,t){return e.init=t,this.expect(types$1.semi),e.test=this.type===types$1.semi?null:this.parseExpression(),this.expect(types$1.semi),e.update=this.type===types$1.parenR?null:this.parseExpression(),this.expect(types$1.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};pp$8.parseForIn=function(e,t){var r=this.type===types$1._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!r||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(types$1.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")};pp$8.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r;;){var n=this.startNode();if(this.parseVarId(n,r),this.eat(types$1.eq)?n.init=this.parseMaybeAssign(t):r==="const"&&!(this.type===types$1._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():n.id.type!=="Identifier"&&!(t&&(this.type===types$1._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):n.init=null,e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(types$1.comma))break}return e};pp$8.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?BIND_VAR:BIND_LEXICAL,!1)};var FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4;pp$8.parseFunction=function(e,t,r,n,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===types$1.star&&t&FUNC_HANGING_STATEMENT&&this.unexpected(),e.generator=this.eat(types$1.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&FUNC_STATEMENT&&(e.id=t&FUNC_NULLABLE_ID&&this.type!==types$1.name?null:this.parseIdent(),e.id&&!(t&FUNC_HANGING_STATEMENT)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?BIND_VAR:BIND_LEXICAL:BIND_FUNCTION));var a=this.yieldPos,o=this.awaitPos,l=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(e.async,e.generator)),t&FUNC_STATEMENT||(e.id=this.type===types$1.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,s),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=l,this.finishNode(e,t&FUNC_STATEMENT?"FunctionDeclaration":"FunctionExpression")};pp$8.parseFunctionParams=function(e){this.expect(types$1.parenL),e.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};pp$8.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),s=this.startNode(),a=!1;for(s.body=[],this.expect(types$1.braceL);this.type!==types$1.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(s.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(a&&this.raise(o.start,"Duplicate constructor in the same class"),a=!0):o.key&&o.key.type==="PrivateIdentifier"&&isPrivateNameConflicted(n,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};pp$8.parseClassElement=function(e){if(this.eat(types$1.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),n="",s=!1,a=!1,o="method",l=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(types$1.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===types$1.star?l=!0:n="static"}if(r.static=l,!n&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===types$1.star)&&!this.canInsertSemicolon()?a=!0:n="async"),!n&&(t>=9||!a)&&this.eat(types$1.star)&&(s=!0),!n&&!a&&!s){var f=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=f:n=f)}if(n?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=n,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===types$1.parenL||o!=="method"||s||a){var y=!r.static&&checkKeyName(r,"constructor"),m=y&&e;y&&o!=="method"&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=y?"constructor":o,this.parseClassMethod(r,s,a,m)}else this.parseClassField(r);return r};pp$8.isClassElementNameStart=function(){return this.type===types$1.name||this.type===types$1.privateId||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword};pp$8.parseClassElementName=function(e){this.type===types$1.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};pp$8.parseClassMethod=function(e,t,r,n){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),r&&this.raise(s.start,"Constructor can't be an async method")):e.static&&checkKeyName(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,r,n);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};pp$8.parseClassField=function(e){if(checkKeyName(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&checkKeyName(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(types$1.eq)){var t=this.currentThisScope(),r=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=r}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")};pp$8.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(SCOPE_CLASS_STATIC_BLOCK|SCOPE_SUPER);this.type!==types$1.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};pp$8.parseClassId=function(e,t){this.type===types$1.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,BIND_LEXICAL,!1)):(t===!0&&this.unexpected(),e.id=null)};pp$8.parseClassSuper=function(e){e.superClass=this.eat(types$1._extends)?this.parseExprSubscripts(!1):null};pp$8.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};pp$8.exitClassBody=function(){for(var e=this.privateNameStack.pop(),t=e.declared,r=e.used,n=this.privateNameStack.length,s=n===0?null:this.privateNameStack[n-1],a=0;a=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==types$1.string&&this.unexpected(),e.source=this.parseExprAtom(),this.semicolon(),this.finishNode(e,"ExportAllDeclaration");if(this.eat(types$1._default)){this.checkExport(t,"default",this.lastTokStart);var r;if(this.type===types$1._function||(r=this.isAsyncFunction())){var n=this.startNode();this.next(),r&&this.next(),e.declaration=this.parseFunction(n,FUNC_STATEMENT|FUNC_NULLABLE_ID,!1,r)}else if(this.type===types$1._class){var s=this.startNode();e.declaration=this.parseClass(s,"nullableID")}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(null),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==types$1.string&&this.unexpected(),e.source=this.parseExprAtom();else{for(var a=0,o=e.specifiers;a=13&&this.type===types$1.string){var e=this.parseLiteral(this.value);return loneSurrogate.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};pp$8.adaptDirectivePrologue=function(e){for(var t=0;t=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var pp$7=Parser.prototype;pp$7.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var n=0,s=e.properties;n=8&&!o&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(types$1._function))return this.overrideContext(types.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(types$1.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[l],!1,t);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===types$1.name&&!o&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(types$1.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[l],!0,t)}return l;case types$1.regexp:var f=this.value;return r=this.parseLiteral(f.value),r.regex={pattern:f.pattern,flags:f.flags},r;case types$1.num:case types$1.string:return this.parseLiteral(this.value);case types$1._null:case types$1._true:case types$1._false:return r=this.startNode(),r.value=this.type===types$1._null?null:this.type===types$1._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case types$1.parenL:var y=this.start,m=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(m)&&(e.parenthesizedAssign=y),e.parenthesizedBind<0&&(e.parenthesizedBind=y)),m;case types$1.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(types$1.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case types$1.braceL:return this.overrideContext(types.b_expr),this.parseObj(!1,e);case types$1._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case types$1._class:return this.parseClass(this.startNode(),!1);case types$1._new:return this.parseNew();case types$1.backQuote:return this.parseTemplate();case types$1._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}};pp$5.parseExprImport=function(){var e=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var t=this.parseIdent(!0);switch(this.type){case types$1.parenL:return this.parseDynamicImport(e);case types$1.dot:return e.meta=t,this.parseImportMeta(e);default:this.unexpected()}};pp$5.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),!this.eat(types$1.parenR)){var t=this.start;this.eat(types$1.comma)&&this.eat(types$1.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};pp$5.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};pp$5.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};pp$5.parseParenExpression=function(){this.expect(types$1.parenL);var e=this.parseExpression();return this.expect(types$1.parenR),e};pp$5.parseParenAndDistinguishExpression=function(e,t){var r=this.start,n=this.startLoc,s,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,l=this.startLoc,f=[],y=!0,m=!1,v=new DestructuringErrors,A=this.yieldPos,E=this.awaitPos,g;for(this.yieldPos=0,this.awaitPos=0;this.type!==types$1.parenR;)if(y?y=!1:this.expect(types$1.comma),a&&this.afterTrailingComma(types$1.parenR,!0)){m=!0;break}else if(this.type===types$1.ellipsis){g=this.start,f.push(this.parseParenItem(this.parseRestBinding())),this.type===types$1.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}else f.push(this.parseMaybeAssign(!1,v,this.parseParenItem));var d=this.lastTokEnd,D=this.lastTokEndLoc;if(this.expect(types$1.parenR),e&&!this.canInsertSemicolon()&&this.eat(types$1.arrow))return this.checkPatternErrors(v,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=A,this.awaitPos=E,this.parseParenArrowList(r,n,f,t);(!f.length||m)&&this.unexpected(this.lastTokStart),g&&this.unexpected(g),this.checkExpressionErrors(v,!0),this.yieldPos=A||this.yieldPos,this.awaitPos=E||this.awaitPos,f.length>1?(s=this.startNodeAt(o,l),s.expressions=f,this.finishNodeAt(s,"SequenceExpression",d,D)):s=f[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var S=this.startNodeAt(r,n);return S.expression=s,this.finishNode(S,"ParenthesizedExpression")}else return s};pp$5.parseParenItem=function(e){return e};pp$5.parseParenArrowList=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,n)};var empty=[];pp$5.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode(),t=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat(types$1.dot)){e.meta=t;var r=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,s=this.startLoc,a=this.type===types$1._import;return e.callee=this.parseSubscripts(this.parseExprAtom(),n,s,!0,!1),a&&e.callee.type==="ImportExpression"&&this.raise(n,"Cannot use new with import()"),this.eat(types$1.parenL)?e.arguments=this.parseExprList(types$1.parenR,this.options.ecmaVersion>=8,!1):e.arguments=empty,this.finishNode(e,"NewExpression")};pp$5.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===types$1.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value,cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,` -`),cooked:this.value},this.next(),r.tail=this.type===types$1.backQuote,this.finishNode(r,"TemplateElement")};pp$5.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(r.quasis=[n];!n.tail;)this.type===types$1.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(types$1.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(types$1.braceR),r.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")};pp$5.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===types$1.name||this.type===types$1.num||this.type===types$1.string||this.type===types$1.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===types$1.star)&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};pp$5.parseObj=function(e,t){var r=this.startNode(),n=!0,s={};for(r.properties=[],this.next();!this.eat(types$1.braceR);){if(n)n=!1;else if(this.expect(types$1.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(types$1.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,s,t),r.properties.push(a)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")};pp$5.parseProperty=function(e,t){var r=this.startNode(),n,s,a,o;if(this.options.ecmaVersion>=9&&this.eat(types$1.ellipsis))return e?(r.argument=this.parseIdent(!1),this.type===types$1.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.finishNode(r,"RestElement")):(r.argument=this.parseMaybeAssign(!1,t),this.type===types$1.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(r,"SpreadElement"));this.options.ecmaVersion>=6&&(r.method=!1,r.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(n=this.eat(types$1.star)));var l=this.containsEsc;return this.parsePropertyName(r),!e&&!l&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(r)?(s=!0,n=this.options.ecmaVersion>=9&&this.eat(types$1.star),this.parsePropertyName(r,t)):s=!1,this.parsePropertyValue(r,e,n,s,a,o,t,l),this.finishNode(r,"Property")};pp$5.parsePropertyValue=function(e,t,r,n,s,a,o,l){if((r||n)&&this.type===types$1.colon&&this.unexpected(),this.eat(types$1.colon))e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init";else if(this.options.ecmaVersion>=6&&this.type===types$1.parenL)t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(r,n);else if(!t&&!l&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==types$1.comma&&this.type!==types$1.braceR&&this.type!==types$1.eq){(r||n)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var f=e.kind==="get"?0:1;if(e.value.params.length!==f){var y=e.value.start;e.kind==="get"?this.raiseRecoverable(y,"getter should have no params"):this.raiseRecoverable(y,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")}else this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((r||n)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),e.kind="init",t?e.value=this.parseMaybeDefault(s,a,this.copyNode(e.key)):this.type===types$1.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected()};pp$5.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(types$1.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(types$1.bracketR),e.key;e.computed=!1}return e.key=this.type===types$1.num||this.type===types$1.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};pp$5.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};pp$5.parseMethod=function(e,t,r){var n=this.startNode(),s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(functionFlags(t,n.generator)|SCOPE_SUPER|(r?SCOPE_DIRECT_SUPER:0)),this.expect(types$1.parenL),n.params=this.parseBindingList(types$1.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(n,"FunctionExpression")};pp$5.parseArrowExpression=function(e,t,r,n){var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(functionFlags(r,!1)|SCOPE_ARROW),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};pp$5.parseFunctionBody=function(e,t,r,n){var s=t&&this.type!==types$1.braceL,a=this.strict,o=!1;if(s)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var l=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||l)&&(o=this.strictDirective(this.end),o&&l&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var f=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,BIND_OUTSIDE),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=f}this.exitScope()};pp$5.isSimpleParamList=function(e){for(var t=0,r=e;t-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&SCOPE_TOP&&delete this.undefinedExports[e]}else if(t===BIND_SIMPLE_CATCH){var a=this.currentScope();a.lexical.push(e)}else if(t===BIND_FUNCTION){var o=this.currentScope();this.treatFunctionsAsVar?n=o.lexical.indexOf(e)>-1:n=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var l=this.scopeStack.length-1;l>=0;--l){var f=this.scopeStack[l];if(f.lexical.indexOf(e)>-1&&!(f.flags&SCOPE_SIMPLE_CATCH&&f.lexical[0]===e)||!this.treatFunctionsAsVarInScope(f)&&f.functions.indexOf(e)>-1){n=!0;break}if(f.var.push(e),this.inModule&&f.flags&SCOPE_TOP&&delete this.undefinedExports[e],f.flags&SCOPE_VAR)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")};pp$3.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};pp$3.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};pp$3.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&SCOPE_VAR)return t}};pp$3.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&SCOPE_VAR&&!(t.flags&SCOPE_ARROW))return t}};var Node=function e(t,r,n){this.type="",this.start=r,this.end=0,t.options.locations&&(this.loc=new SourceLocation(t,n)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[r,0])},pp$2=Parser.prototype;pp$2.startNode=function(){return new Node(this,this.start,this.startLoc)};pp$2.startNodeAt=function(e,t){return new Node(this,e,t)};function finishNodeAt(e,t,r,n){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=r),e}pp$2.finishNode=function(e,t){return finishNodeAt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};pp$2.finishNodeAt=function(e,t,r,n){return finishNodeAt.call(this,e,t,r,n)};pp$2.copyNode=function(e){var t=new Node(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var ecma9BinaryProperties="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",ecma10BinaryProperties=ecma9BinaryProperties+" Extended_Pictographic",ecma11BinaryProperties=ecma10BinaryProperties,ecma12BinaryProperties=ecma11BinaryProperties+" EBase EComp EMod EPres ExtPict",ecma13BinaryProperties=ecma12BinaryProperties,unicodeBinaryProperties={9:ecma9BinaryProperties,10:ecma10BinaryProperties,11:ecma11BinaryProperties,12:ecma12BinaryProperties,13:ecma13BinaryProperties},unicodeGeneralCategoryValues="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",ecma9ScriptValues="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",ecma10ScriptValues=ecma9ScriptValues+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",ecma11ScriptValues=ecma10ScriptValues+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",ecma12ScriptValues=ecma11ScriptValues+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",ecma13ScriptValues=ecma12ScriptValues+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",unicodeScriptValues={9:ecma9ScriptValues,10:ecma10ScriptValues,11:ecma11ScriptValues,12:ecma12ScriptValues,13:ecma13ScriptValues},data={};function buildUnicodeData(e){var t=data[e]={binary:wordsRegexp(unicodeBinaryProperties[e]+" "+unicodeGeneralCategoryValues),nonBinary:{General_Category:wordsRegexp(unicodeGeneralCategoryValues),Script:wordsRegexp(unicodeScriptValues[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var i=0,list=[9,10,11,12,13];i=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":""),this.unicodeProperties=data[t.options.ecmaVersion>=13?13:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};RegExpValidationState.prototype.reset=function e(t,r,n){var s=n.indexOf("u")!==-1;this.start=t|0,this.source=r+"",this.flags=n,this.switchU=s&&this.parser.options.ecmaVersion>=6,this.switchN=s&&this.parser.options.ecmaVersion>=9};RegExpValidationState.prototype.raise=function e(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};RegExpValidationState.prototype.at=function e(t,r){r===void 0&&(r=!1);var n=this.source,s=n.length;if(t>=s)return-1;var a=n.charCodeAt(t);if(!(r||this.switchU)||a<=55295||a>=57344||t+1>=s)return a;var o=n.charCodeAt(t+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};RegExpValidationState.prototype.nextIndex=function e(t,r){r===void 0&&(r=!1);var n=this.source,s=n.length;if(t>=s)return s;var a=n.charCodeAt(t),o;return!(r||this.switchU)||a<=55295||a>=57344||t+1>=s||(o=n.charCodeAt(t+1))<56320||o>57343?t+1:t+2};RegExpValidationState.prototype.current=function e(t){return t===void 0&&(t=!1),this.at(this.pos,t)};RegExpValidationState.prototype.lookahead=function e(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};RegExpValidationState.prototype.advance=function e(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};RegExpValidationState.prototype.eat=function e(t,r){return r===void 0&&(r=!1),this.current(r)===t?(this.advance(r),!0):!1};pp$1.validateRegExpFlags=function(e){for(var t=e.validFlags,r=e.flags,n=0;n-1&&this.raise(e.start,"Duplicate regular expression flag")}};pp$1.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&e.groupNames.length>0&&(e.switchN=!0,this.regexp_pattern(e))};pp$1.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames.length=0,e.backReferenceNames.length=0,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1};pp$1.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};pp$1.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};pp$1.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var n=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1};pp$1.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};pp$1.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};pp$1.regexp_eatSyntaxCharacter=function(e){var t=e.current();return isSyntaxCharacter(t)?(e.lastIntValue=t,e.advance(),!0):!1};function isSyntaxCharacter(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}pp$1.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;(r=e.current())!==-1&&!isSyntaxCharacter(r);)e.advance();return e.pos!==t};pp$1.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),!0):!1};pp$1.regexp_groupSpecifier=function(e){if(e.eat(63)){if(this.regexp_eatGroupName(e)){e.groupNames.indexOf(e.lastStringValue)!==-1&&e.raise("Duplicate capture group name"),e.groupNames.push(e.lastStringValue);return}e.raise("Invalid group")}};pp$1.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};pp$1.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=codePointToString(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=codePointToString(e.lastIntValue);return!0}return!1};pp$1.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),isRegExpIdentifierStart(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function isRegExpIdentifierStart(e){return isIdentifierStart(e,!0)||e===36||e===95}pp$1.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),n===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),isRegExpIdentifierPart(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)};function isRegExpIdentifierPart(e){return isIdentifierChar(e,!0)||e===36||e===95||e===8204||e===8205}pp$1.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};pp$1.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1};pp$1.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};pp$1.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};pp$1.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};pp$1.regexp_eatZero=function(e){return e.current()===48&&!isDecimalDigit(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};pp$1.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};pp$1.regexp_eatControlLetter=function(e){var t=e.current();return isControlLetter(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function isControlLetter(e){return e>=65&&e<=90||e>=97&&e<=122}pp$1.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var r=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(n&&s>=55296&&s<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(s-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=s}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&isValidUnicode(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1};function isValidUnicode(e){return e>=0&&e<=1114111}pp$1.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};pp$1.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};pp$1.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(isCharacterClassEscape(t))return e.lastIntValue=-1,e.advance(),!0;if(e.switchU&&this.options.ecmaVersion>=9&&(t===80||t===112)){if(e.lastIntValue=-1,e.advance(),e.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(e)&&e.eat(125))return!0;e.raise("Invalid property name")}return!1};function isCharacterClassEscape(e){return e===100||e===68||e===115||e===83||e===119||e===87}pp$1.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,n),!0}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s),!0}return!1};pp$1.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){hasOwn(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")};pp$1.regexp_validateUnicodePropertyNameOrValue=function(e,t){e.unicodeProperties.binary.test(t)||e.raise("Invalid property name")};pp$1.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";isUnicodePropertyNameCharacter(t=e.current());)e.lastStringValue+=codePointToString(t),e.advance();return e.lastStringValue!==""};function isUnicodePropertyNameCharacter(e){return isControlLetter(e)||e===95}pp$1.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";isUnicodePropertyValueCharacter(t=e.current());)e.lastStringValue+=codePointToString(t),e.advance();return e.lastStringValue!==""};function isUnicodePropertyValueCharacter(e){return isUnicodePropertyNameCharacter(e)||isDecimalDigit(e)}pp$1.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};pp$1.regexp_eatCharacterClass=function(e){if(e.eat(91)){if(e.eat(94),this.regexp_classRanges(e),e.eat(93))return!0;e.raise("Unterminated character class")}return!1};pp$1.regexp_classRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;e.switchU&&(t===-1||r===-1)&&e.raise("Invalid character class"),t!==-1&&r!==-1&&t>r&&e.raise("Range out of order in character class")}}};pp$1.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(r===99||isOctalDigit(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return n!==93?(e.lastIntValue=n,e.advance(),!0):!1};pp$1.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};pp$1.regexp_eatClassControlLetter=function(e){var t=e.current();return isDecimalDigit(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};pp$1.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};pp$1.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;isDecimalDigit(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t};function isDecimalDigit(e){return e>=48&&e<=57}pp$1.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;isHexDigit(r=e.current());)e.lastIntValue=16*e.lastIntValue+hexToInt(r),e.advance();return e.pos!==t};function isHexDigit(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function hexToInt(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}pp$1.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+r*8+e.lastIntValue:e.lastIntValue=t*8+r}else e.lastIntValue=t;return!0}return!1};pp$1.regexp_eatOctalDigit=function(e){var t=e.current();return isOctalDigit(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function isOctalDigit(e){return e>=48&&e<=55}pp$1.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var n=0;n=this.input.length)return this.finishToken(types$1.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};pp.readToken=function(e){return isIdentifierStart(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};pp.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};pp.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(r===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var n=void 0,s=t;(n=nextLineBreak(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())};pp.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos8&&e<14||e>=5760&&nonASCIIwhitespace.test(String.fromCharCode(e)))++this.pos;else break e}}};pp.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)};pp.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(types$1.ellipsis)):(++this.pos,this.finishToken(types$1.dot))};pp.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(types$1.assign,2):this.finishOp(types$1.slash,1)};pp.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,n=e===42?types$1.star:types$1.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++r,n=types$1.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(types$1.assign,r+1):this.finishOp(n,r)};pp.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(types$1.assign,3)}return this.finishOp(e===124?types$1.logicalOR:types$1.logicalAND,2)}return t===61?this.finishOp(types$1.assign,2):this.finishOp(e===124?types$1.bitwiseOR:types$1.bitwiseAND,1)};pp.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(types$1.assign,2):this.finishOp(types$1.bitwiseXOR,1)};pp.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||lineBreak.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(types$1.incDec,2):t===61?this.finishOp(types$1.assign,2):this.finishOp(types$1.plusMin,1)};pp.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+r)===61?this.finishOp(types$1.assign,r+1):this.finishOp(types$1.bitShift,r)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(r=2),this.finishOp(types$1.relational,r))};pp.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(types$1.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(types$1.arrow)):this.finishOp(e===61?types$1.eq:types$1.prefix,1)};pp.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(types$1.questionDot,2)}if(t===63){if(e>=12){var n=this.input.charCodeAt(this.pos+2);if(n===61)return this.finishOp(types$1.assign,3)}return this.finishOp(types$1.coalesce,2)}}return this.finishOp(types$1.question,1)};pp.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),isIdentifierStart(t,!0)||t===92))return this.finishToken(types$1.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+codePointToString(t)+"'")};pp.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(types$1.parenL);case 41:return++this.pos,this.finishToken(types$1.parenR);case 59:return++this.pos,this.finishToken(types$1.semi);case 44:return++this.pos,this.finishToken(types$1.comma);case 91:return++this.pos,this.finishToken(types$1.bracketL);case 93:return++this.pos,this.finishToken(types$1.bracketR);case 123:return++this.pos,this.finishToken(types$1.braceL);case 125:return++this.pos,this.finishToken(types$1.braceR);case 58:return++this.pos,this.finishToken(types$1.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(types$1.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(types$1.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+codePointToString(e)+"'")};pp.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)};pp.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(lineBreak.test(n)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if(n==="[")t=!0;else if(n==="]"&&t)t=!1;else if(n==="/"&&!t)break;e=n==="\\"}++this.pos}var s=this.input.slice(r,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var l=this.regexpState||(this.regexpState=new RegExpValidationState(this));l.reset(r,s,o),this.validateRegExpFlags(l),this.validateRegExpPattern(l);var f=null;try{f=new RegExp(s,o)}catch{}return this.finishToken(types$1.regexp,{pattern:s,flags:o,value:f})};pp.readInt=function(e,t,r){for(var n=this.options.ecmaVersion>=12&&t===void 0,s=r&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,l=0,f=0,y=t==null?1/0:t;f=97?v=m-97+10:m>=65?v=m-65+10:m>=48&&m<=57?v=m-48:v=1/0,v>=e)break;l=m,o=o*e+v}return n&&l===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:o};function stringToNumber(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function stringToBigInt(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}pp.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return r==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(r=stringToBigInt(this.input.slice(t,this.pos)),++this.pos):isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(types$1.num,r)};pp.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var r=this.pos-t>=2&&this.input.charCodeAt(t)===48;r&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&n===110){var s=stringToBigInt(this.input.slice(t,this.pos));return++this.pos,isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(types$1.num,s)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),n===46&&!r&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(n===69||n===101)&&!r&&(n=this.input.charCodeAt(++this.pos),(n===43||n===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=stringToNumber(this.input.slice(t,this.pos),r);return this.finishToken(types$1.num,a)};pp.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var r=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(r,"Code point out of bounds")}else t=this.readHexChar(4);return t};pp.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;n===92?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):n===8232||n===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(isNewLine(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(types$1.string,t)};var INVALID_TEMPLATE_ESCAPE_ERROR={};pp.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===INVALID_TEMPLATE_ESCAPE_ERROR)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};pp.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw INVALID_TEMPLATE_ESCAPE_ERROR;this.raise(e,t)};pp.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(r===96||r===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===types$1.template||this.type===types$1.invalidTemplate)?r===36?(this.pos+=2,this.finishToken(types$1.dollarBraceL)):(++this.pos,this.finishToken(types$1.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(types$1.template,e));if(r===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(isNewLine(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=` -`;break;default:e+=String.fromCharCode(r);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};pp.readInvalidTemplateToken=function(){for(;this.pos=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(n,8);return s>255&&(n=n.slice(0,-1),s=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),(n!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return isNewLine(t)?"":String.fromCharCode(t)}};pp.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return r===null&&this.invalidStringToken(t,"Bad character escape sequence"),r};pp.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,n=this.options.ecmaVersion>=6;this.posthis.should_skip=!0,remove:()=>this.should_remove=!0,replace:t=>this.replacement=t}}replace(t,r,n,s){t&&(n!==null?t[r][n]=s:t[r]=s)}remove(t,r,n){t&&(n!==null?t[r].splice(n,1):delete t[r])}}class SyncWalker extends WalkerBase{constructor(t,r){super(),this.enter=t,this.leave=r}visit(t,r,n,s){if(t){if(this.enter){const a=this.should_skip,o=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,r,n,s),this.replacement&&(t=this.replacement,this.replace(r,n,s,t)),this.should_remove&&this.remove(r,n,s);const f=this.should_skip,y=this.should_remove;if(this.should_skip=a,this.should_remove=o,this.replacement=l,f)return t;if(y)return null}for(const a in t){const o=t[a];if(typeof o=="object")if(Array.isArray(o))for(let l=0;l{${o}})()`:o}function isStringWithDoubleQuotes(e,t,r){const{raw:n,type:s}=e;return s!=="Literal"?!1:n[0]==='"'}function isBackTickString(e,t){return e.type==="TemplateLiteral"&&t.type!=="TaggedTemplateExpression"}function miniWithLocation(e,t,r){return{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"mini"},arguments:[{type:"Literal",value:e}],optional:!1},property:{type:"Identifier",name:"withMiniLocation"}},arguments:[{type:"Literal",value:t},{type:"Literal",value:r}],optional:!1}}const tune=`await samples('github:tidalcycles/Dirt-Samples/master') - -stack( - // amen - n("0 1 2 3 4 5 6 7") - .sometimes(x=>x.ply(2)) - .rarely(x=>x.speed("2 | -2")) - .sometimesBy(.4, x=>x.delay(".5")) - .s("amencutup") - .slow(2) - .room(.5) - , - // bass - sine.add(saw.slow(4)).range(0,7).segment(8) - .superimpose(x=>x.add(.1)) - .scale('G0 minor').note() - .s("sawtooth").decay(.1).sustain(0) - .gain(.4).cutoff(perlin.range(300,3000).slow(8)).resonance(10) - .degradeBy("0 0.1 .5 .1") - .rarely(add(note("12"))) - , - // chord - note("Bb3,D4".superimpose(x=>x.add(.2))) - .s('sawtooth').cutoff(1000).struct("<~@3 [~ x]>") - .decay(.05).sustain(.0).delay(.8).delaytime(.125).room(.8) - , - // alien - s("breath").room(1).shape(.6).chop(16).rev().mask("") - , - n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5)) -).reset("")`,ctx=getAudioContext$1(),input=document.getElementById("text");input.innerHTML=tune;evalScope(controls,__vitePreload(()=>Promise.resolve().then(()=>strudel),void 0),__vitePreload(()=>import("./index.f09cc89e.js"),[]),__vitePreload(()=>import("./index.b12de8ae.js"),[]),__vitePreload(()=>import("./index.1207dd8c.js"),[]));const{evaluate}=repl({defaultOutput:webaudioOutput,getTime:()=>ctx.currentTime,transpiler});document.getElementById("start").addEventListener("click",()=>{ctx.resume(),evaluate(input.value)});export{Hap as H,Pattern$2 as P,webaudioOutputTrigger as a,getCachedBuffer as b,chooseInWith as c,reverseBuffer as d,getLoadedBuffer as e,loadGithubSamples as f,getAudioContext$1 as g,samples as h,resetLoadedSamples as i,getLoadedSamples$1 as j,getAugmentedNamespace as k,loadBuffer as l,mod as m,commonjsGlobal as n,getDefaultExportFromCjs as o,panic as p,reify$1 as q,rand as r,strudel as s,stack as t,webaudioOutput as w}; diff --git a/packages/core/examples/vite-vanilla-repl/dist/index.html b/packages/core/examples/vite-vanilla-repl/dist/index.html index 216ca275..9544e82e 100644 --- a/packages/core/examples/vite-vanilla-repl/dist/index.html +++ b/packages/core/examples/vite-vanilla-repl/dist/index.html @@ -4,7 +4,7 @@ Vite Vanilla Strudel REPL - +
diff --git a/packages/core/examples/vite-vanilla-repl/main.js b/packages/core/examples/vite-vanilla-repl/main.js index 327e8f1f..72d80b92 100644 --- a/packages/core/examples/vite-vanilla-repl/main.js +++ b/packages/core/examples/vite-vanilla-repl/main.js @@ -1,7 +1,7 @@ -import { controls, repl, evalScope } from '@strudel.cycles/core'; +import { controls, repl, evalScope, setStringParser } from '@strudel.cycles/core'; +import { mini } from '@strudel.cycles/mini'; import { getAudioContext, webaudioOutput } from '@strudel.cycles/webaudio'; -import { transpiler } from '@strudel.cycles/transpiler'; -// import shapeshifter from '@strudel.cycles/eval/shapeshifter.mjs'; +// import { transpiler } from '@strudel.cycles/transpiler'; import tune from './tune.mjs'; const ctx = getAudioContext(); @@ -16,11 +16,12 @@ evalScope( import('@strudel.cycles/tonal'), ); +setStringParser(mini) + const { evaluate } = repl({ defaultOutput: webaudioOutput, getTime: () => ctx.currentTime, - transpiler, - // transpiler: shapeshifter, + // transpiler, }); document.getElementById('start').addEventListener('click', () => { ctx.resume(); diff --git a/packages/core/examples/vite-vanilla-repl/package.json b/packages/core/examples/vite-vanilla-repl/package.json index 9e01de4a..b1a5f0f6 100644 --- a/packages/core/examples/vite-vanilla-repl/package.json +++ b/packages/core/examples/vite-vanilla-repl/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build-githack": "vite build --base /tidalcycles/strudel/general-purpose-scheduler/packages/core/examples/vite-vanilla-repl/dist/", + "build-githack": "vite build --base /tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/", "build": "vite build", "preview": "vite preview" },