UNPKG

@oletizi/audio-tools

Version:

Monorepo for hardware sampler utilities and format parsers

1 lines 18.4 kB
exports.id=459,exports.ids=[459],exports.modules={146:function(a){a.exports=function(){"use strict";var a="millisecond",b="second",c="minute",d="hour",e="week",f="month",g="quarter",h="year",i="date",j="Invalid Date",k=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,l=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,m=function(a,b,c){var d=String(a);return!d||d.length>=b?a:""+Array(b+1-d.length).join(c)+a},n="en",o={};o[n]={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(a){var b=["th","st","nd","rd"],c=a%100;return"["+a+(b[(c-20)%10]||b[c]||b[0])+"]"}};var p="$isDayjsObject",q=function(a){return a instanceof u||!(!a||!a[p])},r=function a(b,c,d){var e;if(!b)return n;if("string"==typeof b){var f=b.toLowerCase();o[f]&&(e=f),c&&(o[f]=c,e=f);var g=b.split("-");if(!e&&g.length>1)return a(g[0])}else{var h=b.name;o[h]=b,e=h}return!d&&e&&(n=e),e||!d&&n},s=function(a,b){if(q(a))return a.clone();var c="object"==typeof b?b:{};return c.date=a,c.args=arguments,new u(c)},t={s:m,z:function(a){var b=-a.utcOffset(),c=Math.abs(b);return(b<=0?"+":"-")+m(Math.floor(c/60),2,"0")+":"+m(c%60,2,"0")},m:function a(b,c){if(b.date()<c.date())return-a(c,b);var d=12*(c.year()-b.year())+(c.month()-b.month()),e=b.clone().add(d,f),g=c-e<0,h=b.clone().add(d+(g?-1:1),f);return+(-(d+(c-e)/(g?e-h:h-e))||0)},a:function(a){return a<0?Math.ceil(a)||0:Math.floor(a)},p:function(j){return({M:f,y:h,w:e,d:"day",D:i,h:d,m:c,s:b,ms:a,Q:g})[j]||String(j||"").toLowerCase().replace(/s$/,"")},u:function(a){return void 0===a}};t.l=r,t.i=q,t.w=function(a,b){return s(a,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var u=function(){function m(a){this.$L=r(a.locale,null,!0),this.parse(a),this.$x=this.$x||a.x||{},this[p]=!0}var n=m.prototype;return n.parse=function(a){this.$d=function(a){var b=a.date,c=a.utc;if(null===b)return new Date(NaN);if(t.u(b))return new Date;if(b instanceof Date)return new Date(b);if("string"==typeof b&&!/Z$/i.test(b)){var d=b.match(k);if(d){var e=d[2]-1||0,f=(d[7]||"0").substring(0,3);return c?new Date(Date.UTC(d[1],e,d[3]||1,d[4]||0,d[5]||0,d[6]||0,f)):new Date(d[1],e,d[3]||1,d[4]||0,d[5]||0,d[6]||0,f)}}return new Date(b)}(a),this.init()},n.init=function(){var a=this.$d;this.$y=a.getFullYear(),this.$M=a.getMonth(),this.$D=a.getDate(),this.$W=a.getDay(),this.$H=a.getHours(),this.$m=a.getMinutes(),this.$s=a.getSeconds(),this.$ms=a.getMilliseconds()},n.$utils=function(){return t},n.isValid=function(){return this.$d.toString()!==j},n.isSame=function(a,b){var c=s(a);return this.startOf(b)<=c&&c<=this.endOf(b)},n.isAfter=function(a,b){return s(a)<this.startOf(b)},n.isBefore=function(a,b){return this.endOf(b)<s(a)},n.$g=function(a,b,c){return t.u(a)?this[b]:this.set(c,a)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(a,g){var j=this,k=!!t.u(g)||g,l=t.p(a),m=function(a,b){var c=t.w(j.$u?Date.UTC(j.$y,b,a):new Date(j.$y,b,a),j);return k?c:c.endOf("day")},n=function(a,b){return t.w(j.toDate()[a].apply(j.toDate("s"),(k?[0,0,0,0]:[23,59,59,999]).slice(b)),j)},o=this.$W,p=this.$M,q=this.$D,r="set"+(this.$u?"UTC":"");switch(l){case h:return k?m(1,0):m(31,11);case f:return k?m(1,p):m(0,p+1);case e:var s=this.$locale().weekStart||0,u=(o<s?o+7:o)-s;return m(k?q-u:q+(6-u),p);case"day":case i:return n(r+"Hours",0);case d:return n(r+"Minutes",1);case c:return n(r+"Seconds",2);case b:return n(r+"Milliseconds",3);default:return this.clone()}},n.endOf=function(a){return this.startOf(a,!1)},n.$set=function(e,g){var j,k=t.p(e),l="set"+(this.$u?"UTC":""),m=((j={}).day=l+"Date",j[i]=l+"Date",j[f]=l+"Month",j[h]=l+"FullYear",j[d]=l+"Hours",j[c]=l+"Minutes",j[b]=l+"Seconds",j[a]=l+"Milliseconds",j)[k],n="day"===k?this.$D+(g-this.$W):g;if(k===f||k===h){var o=this.clone().set(i,1);o.$d[m](n),o.init(),this.$d=o.set(i,Math.min(this.$D,o.daysInMonth())).$d}else m&&this.$d[m](n);return this.init(),this},n.set=function(a,b){return this.clone().$set(a,b)},n.get=function(a){return this[t.p(a)]()},n.add=function(a,g){var i,j=this;a=Number(a);var k=t.p(g),l=function(b){var c=s(j);return t.w(c.date(c.date()+Math.round(b*a)),j)};if(k===f)return this.set(f,this.$M+a);if(k===h)return this.set(h,this.$y+a);if("day"===k)return l(1);if(k===e)return l(7);var m=((i={})[c]=6e4,i[d]=36e5,i[b]=1e3,i)[k]||1,n=this.$d.getTime()+a*m;return t.w(n,this)},n.subtract=function(a,b){return this.add(-1*a,b)},n.format=function(a){var b=this,c=this.$locale();if(!this.isValid())return c.invalidDate||j;var d=a||"YYYY-MM-DDTHH:mm:ssZ",e=t.z(this),f=this.$H,g=this.$m,h=this.$M,i=c.weekdays,k=c.months,m=c.meridiem,n=function(a,c,e,f){return a&&(a[c]||a(b,d))||e[c].slice(0,f)},o=function(a){return t.s(f%12||12,a,"0")},p=m||function(a,b,c){var d=a<12?"AM":"PM";return c?d.toLowerCase():d};return d.replace(l,function(a,d){return d||function(a){switch(a){case"YY":return String(b.$y).slice(-2);case"YYYY":return t.s(b.$y,4,"0");case"M":return h+1;case"MM":return t.s(h+1,2,"0");case"MMM":return n(c.monthsShort,h,k,3);case"MMMM":return n(k,h);case"D":return b.$D;case"DD":return t.s(b.$D,2,"0");case"d":return String(b.$W);case"dd":return n(c.weekdaysMin,b.$W,i,2);case"ddd":return n(c.weekdaysShort,b.$W,i,3);case"dddd":return i[b.$W];case"H":return String(f);case"HH":return t.s(f,2,"0");case"h":return o(1);case"hh":return o(2);case"a":return p(f,g,!0);case"A":return p(f,g,!1);case"m":return String(g);case"mm":return t.s(g,2,"0");case"s":return String(b.$s);case"ss":return t.s(b.$s,2,"0");case"SSS":return t.s(b.$ms,3,"0");case"Z":return e}return null}(a)||e.replace(":","")})},n.utcOffset=function(){return-(15*Math.round(this.$d.getTimezoneOffset()/15))},n.diff=function(a,i,j){var k,l=this,m=t.p(i),n=s(a),o=(n.utcOffset()-this.utcOffset())*6e4,p=this-n,q=function(){return t.m(l,n)};switch(m){case h:k=q()/12;break;case f:k=q();break;case g:k=q()/3;break;case e:k=(p-o)/6048e5;break;case"day":k=(p-o)/864e5;break;case d:k=p/36e5;break;case c:k=p/6e4;break;case b:k=p/1e3;break;default:k=p}return j?k:t.a(k)},n.daysInMonth=function(){return this.endOf(f).$D},n.$locale=function(){return o[this.$L]},n.locale=function(a,b){if(!a)return this.$L;var c=this.clone(),d=r(a,b,!0);return d&&(c.$L=d),c},n.clone=function(){return t.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},m}(),v=u.prototype;return s.prototype=v,[["$ms",a],["$s",b],["$m",c],["$H",d],["$W","day"],["$M",f],["$y",h],["$D",i]].forEach(function(a){v[a[1]]=function(b){return this.$g(b,a[0],a[1])}}),s.extend=function(a,b){return a.$i||(a(b,u,s),a.$i=!0),s},s.locale=r,s.isDayjs=q,s.unix=function(a){return s(1e3*a)},s.en=o[n],s.Ls=o,s.p={},s}()},6459:(a,b,c)=>{"use strict";let d;c.d(b,{tw:()=>G,IV:()=>F,UP:()=>Q,Zv:()=>J,Y7:()=>D,Mx:()=>O,GW:()=>H,wJ:()=>K,Hf:()=>P});var e=c(146),f=c(9748);let g=()=>{var a=(()=>{var a=Object.defineProperty,b=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,e={};((b,c)=>{for(var d in c)a(b,d,{get:c[d],enumerable:!0})})(e,{default:()=>ad});var f=a=>Array.isArray(a),g=(a,b)=>f(a)?h(a,b):"string"==typeof a?j(a,b):i(a,b),h=(a,b)=>{let c={};for(let b of a){if(1!==b.length)throw Error(`Invalid character: "${b}"`);c[b.charCodeAt(0)]=!0}return a=>{let d=a.index,e=a.input;for(;a.index<e.length&&e.charCodeAt(a.index)in c;)a.index+=1;let f=a.index;if(f>d){if(void 0!==b&&!a.options.silent){let c=a.input.slice(d,f),g="function"==typeof b?b(c,e,String(d)):b;void 0===g||a.output.push(g)}a.indexMax=Math.max(a.indexMax,a.index)}return!0}},i=(a,b)=>{let c=new RegExp(a.source,a.flags.replace(/y|$/,"y"));return q(a=>{c.lastIndex=a.index;let d=c.exec(a.input);if(!d)return!1;if(void 0!==b&&!a.options.silent){let c="function"==typeof b?b(...d,a.input,String(a.index)):b;void 0===c||a.output.push(c)}return a.index+=d[0].length,a.indexMax=Math.max(a.indexMax,a.index),!0})},j=(a,b)=>c=>{if(!c.input.startsWith(a,c.index))return!1;if(void 0!==b&&!c.options.silent){let d="function"==typeof b?b(a,c.input,String(c.index)):b;void 0===d||c.output.push(d)}return c.index+=a.length,c.indexMax=Math.max(c.indexMax,c.index),!0},k=(a,b,c,d)=>{let e=s(a);return q(p(o(a=>{let d=0;for(;d<c;){let b=a.index;if(!e(a)||(d+=1,a.index===b))break}return d>=b})))},l=(a,b)=>k(a,0,1/0),m=(a,b)=>{let c=a.map(s);return q(p(o(a=>{for(let b=0,d=c.length;b<d;b++)if(!c[b](a))return!1;return!0})))},n=(a,b)=>{let c=a.map(s);return q(p(a=>{for(let b=0,d=c.length;b<d;b++)if(c[b](a))return!0;return!1}))},o=(a,b=!1)=>{let c=s(a);return a=>{let d=a.index,e=a.output.length,f=c(a);return(!f||b)&&(a.index=d,a.output.length!==e&&(a.output.length=e)),f}},p=(a,b)=>s(a),q=(()=>{let a=0;return b=>{let c=s(b),d=a+=1;return a=>{var b;if(!1===a.options.memoization)return c(a);let e=a.index,f=(b=a.cache)[d]||(b[d]=new Map),g=f.get(e);if(!1===g)return!1;if("number"==typeof g)return a.index=g,!0;if(g)return a.index=g.index,g.output?.length&&a.output.push(...g.output),!0;{let b=a.output.length;if(!c(a))return f.set(e,!1),!1;{let c=a.index,d=a.output.length;if(d>b){let g=a.output.slice(b,d);f.set(e,{index:c,output:g})}else f.set(e,c);return!0}}}}})(),r=a=>{let b;return c=>(b||(b=s(a())),b(c))},s=(a=>{let b=new Map;return c=>{let d=b.get(c);if(d)return d;let e=a(c);return b.set(c,e),e}})(a=>{if("function"==typeof a)return 0===a.length?r(a):a;if("string"==typeof a||a instanceof RegExp)return g(a);if(f(a))return m(a);if((a=>"object"==typeof a&&null!==a)(a))return n(Object.values(a));throw Error("Invalid rule")}),t="abcdefghijklmnopqrstuvwxyz",u=a=>{let b="";for(;a>0;)b=t[(a-1)%26]+b,a=Math.floor((a-1)/26);return b},v=a=>{let b=0;for(let c=0,d=a.length;c<d;c++)b=26*b+t.indexOf(a[c])+1;return b},w=(a,b)=>{if(b<a)return w(b,a);let c=[];for(;a<=b;)c.push(a++);return c},x=(a,b)=>w(v(a),v(b)).map(u),y=a=>a,z=a=>A(b=>((a,b,c={})=>{let d={cache:{},input:a,index:0,indexMax:0,options:c,output:[]};if(s(b)(d)&&d.index===a.length)return d.output;throw Error(`Failed to parse at index ${d.indexMax}`)})(b,a,{memoization:!1}).join("")),A=a=>{let b={};return c=>b[c]??(b[c]=a(c))},B=g(/^\*\*\/\*$/,".*"),C=g(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/,(a,b,c)=>`.*${b?"":"(?:^|/)"}${c.replaceAll(".","\\.")}`),D=g(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/,(a,b,c,d)=>`.*${b?"":"(?:^|/)"}${c.replaceAll(".","\\.")}(?:${d.replaceAll(",","|").replaceAll(".","\\.")})`),E=g(/\\./,y),F=g(/[$.*+?^(){}[\]\|]/,a=>`\\${a}`),G=g(/./,y),H=n([g(/^(?:!!)*!(.*)$/,(a,b)=>`(?!^${$(b)}$).*?`),g(/^(!!)+/,"")]),I=n([g(/\/(\*\*\/)+/,"(?:/.+/|/)"),g(/^(\*\*\/)+/,"(?:^|.*/)"),g(/\/(\*\*)$/,"(?:/.*|$)"),g(/\*\*/,".*")]),J=n([g(/\*\/(?!\*\*\/)/,"[^/]*/"),g(/\*/,"[^/]*")]),K=g("?","[^/]"),L=g("[",y),M=g("]",y),N=g(/[!^]/,"^/"),O=g(/[a-z]-[a-z]|[0-9]-[0-9]/i,y),P=n([E,g(/[$.*+?^(){}[\|]/,a=>`\\${a}`),O,g(/[^\]]/,y)]),Q=m([L,k(N,0,1),l(P),M]),R=g("{","(?:"),S=g("}",")"),T=m([R,n([g(/(\d+)\.\.(\d+)/,(a,b,c)=>{let d,e,f;return(d=+b,e=+c,f=Math.min(b.length,c.length),w(d,e).map(a=>String(a).padStart(f,"0"))).join("|")}),g(/([a-z]+)\.\.([a-z]+)/,(a,b,c)=>x(b,c).join("|")),g(/([A-Z]+)\.\.([A-Z]+)/,(a,b,c)=>x(b.toLowerCase(),c.toLowerCase()).join("|").toUpperCase())]),S]),U=g("{","(?:"),V=g("}",")"),W=g(",","|"),X=g(/[$.*+?^(){[\]\|]/,a=>`\\${a}`),Y=g(/[^}]/,y),Z=m([U,l(n([I,J,K,Q,T,r(()=>Z),E,X,W,Y])),V]),$=z(l(n([B,C,D,H,I,J,K,Q,T,Z,E,F,G]))),_=g(/\\./,y),aa=g(/./,y),ab=z(l(n([_,g(/\*\*\*+/,"*"),g(/([^/{[(!])\*\*/,(a,b)=>`${b}*`),g(/(^|.)\*\*(?=[^*/)\]}])/,(a,b)=>`${b}*`),aa]))),ac=(a,b)=>{let c=Array.isArray(a)?a:[a];if(!c.length)return!1;let d=c.map(ac.compile),e=c.every(a=>/(\/(?:\*\*)?|\[\/\])$/.test(a)),f=b.replace(/[\\\/]+/g,"/").replace(/\/$/,e?"/":"");return d.some(a=>a.test(f))};ac.compile=a=>RegExp(`^${$(ab(a))}$`,"s");var ad=ac;return((e,f,g,h)=>{if(f&&"object"==typeof f||"function"==typeof f)for(let i of c(f))d.call(e,i)||i===g||a(e,i,{get:()=>f[i],enumerable:!(h=b(f,i))||h.enumerable});return e})(a({},"__esModule",{value:!0}),e)})();return a.default||a},h=/^[A-Za-z]:\//;function i(a=""){return a?a.replace(/\\/g,"/").replace(h,a=>a.toUpperCase()):a}let j=/^[/\\]{2}/,k=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,l=/^[A-Za-z]:$/,m=/^\/([A-Za-z]:)?$/,n=/.(\.[^./]+|\.)$/,o=/^[/\\]|^[a-zA-Z]:[/\\]/,p=function(a){if(0===a.length)return".";let b=(a=i(a)).match(j),c=s(a),d="/"===a[a.length-1];return 0===(a=r(a,!c)).length?c?"/":d?"./":".":(d&&(a+="/"),l.test(a)&&(a+="/"),b)?c?`//${a}`:`//./${a}`:c&&!s(a)?`/${a}`:a},q=function(...a){a=a.map(a=>i(a));let b="",c=!1;for(let d=a.length-1;d>=-1&&!c;d--){let e=d>=0?a[d]:"undefined"!=typeof process&&"function"==typeof process.cwd?process.cwd().replace(/\\/g,"/"):"/";e&&0!==e.length&&(b=`${e}/${b}`,c=s(e))}return(b=r(b,!c),c&&!s(b))?`/${b}`:b.length>0?b:"."};function r(a,b){let c="",d=0,e=-1,f=0,g=null;for(let h=0;h<=a.length;++h){if(h<a.length)g=a[h];else if("/"===g)break;else g="/";if("/"===g){if(e===h-1||1===f);else if(2===f){if(c.length<2||2!==d||"."!==c[c.length-1]||"."!==c[c.length-2]){if(c.length>2){let a=c.lastIndexOf("/");-1===a?(c="",d=0):d=(c=c.slice(0,a)).length-1-c.lastIndexOf("/"),e=h,f=0;continue}else if(c.length>0){c="",d=0,e=h,f=0;continue}}b&&(c+=c.length>0?"/..":"..",d=2)}else c.length>0?c+=`/${a.slice(e+1,h)}`:c=a.slice(e+1,h),d=h-e-1;e=h,f=0}else"."===g&&-1!==f?++f:f=-1}return c}let s=function(a){return k.test(a)},t=function(a){if(".."===a)return"";let b=n.exec(i(a));return b&&b[1]||""},u=function(a){let b=i(a).replace(/\/$/,"").split("/").slice(0,-1);return 1===b.length&&l.test(b[0])&&(b[0]+="/"),b.join("/")||(s(a)?"/":".")},v=function(a,b){let c=i(a).split("/"),d="";for(let a=c.length-1;a>=0;a--){let b=c[a];if(b){d=b;break}}return b&&d.endsWith(b)?d.slice(0,-b.length):d},w={__proto__:null,basename:v,dirname:u,extname:t,format:function(a){let b=a.ext?a.ext.startsWith(".")?a.ext:`.${a.ext}`:"",c=[a.root,a.dir,a.base??(a.name??"")+b].filter(Boolean);return i(a.root?q(...c):c.join("/"))},isAbsolute:s,join:function(...a){let b="";for(let c of a)if(c)if(b.length>0){let a="/"===b[b.length-1],d="/"===c[0];a&&d?b+=c.slice(1):b+=a||d?c:`/${c}`}else b+=c;return p(b)},matchesGlob:(a,b)=>{var c;return c=p(a),d||(d=g(),g=null),d(b,c)},normalize:p,normalizeString:r,parse:function(a){let b=o.exec(a)?.[0]?.replace(/\\/g,"/")||"",c=v(a),d=t(c);return{root:b,dir:u(a),base:c,ext:d,name:c.slice(0,c.length-d.length)}},relative:function(a,b){let c=q(a).replace(m,"$1").split("/"),d=q(b).replace(m,"$1").split("/");if(":"===d[0][1]&&":"===c[0][1]&&c[0]!==d[0])return d.join("/");for(let a of[...c]){if(d[0]!==a)break;c.shift(),d.shift()}return[...c.map(()=>".."),...d].join("/")},resolve:q,sep:"/",toNamespacedPath:function(a){return i(a)}},x=globalThis.process?.platform==="win32"?";":":",y={posix:void 0,win32:void 0},z=(a=x)=>new Proxy(w,{get:(b,c)=>"delimiter"===c?a:"posix"===c?A:"win32"===c?B:y[c]||w[c]}),A=z(":"),B=z(";");var C=(a,b,c)=>new Promise((d,e)=>{var f=a=>{try{h(c.next(a))}catch(a){e(a)}},g=a=>{try{h(c.throw(a))}catch(a){e(a)}},h=a=>a.done?d(a.value):Promise.resolve(a.value).then(f,g);h((c=c.apply(a,b)).next())});function D(a="seq"){let b=0;return a+="-"+Date.now(),()=>a+"-"+b++}function E(a,b){let c=""+a;for(;c.length<b;)c="0"+c;return c}function F(a){var b=Array.from(a).reverse();let c=0;for(let a=0;a<b.length;a++)c=c<<8|b[a];return c}function G(a){if(a<0||a>255)throw Error("Input must be a valid byte (0-255).");return[15&a,a>>4&15]}function H(a,b){if(b<0||b>15||a<0||a>15)throw Error("Both nibbles must be between 0 and 15.");return b<<4|a}var I=class{constructor(a,b,c="\n",d=!0,e){this.newline=c,this.writeFunction=a,this.errorFunction=b,this.debug=d,this.prefix=e}write(a){this.writeFunction(a)}error(a){this.errorFunction(a)}log(a){this.debug&&this.writeFunction(function(a=new Date){let b=e(a);return`${b.year()}-${E(b.month(),2)}-${E(b.date(),2)}:${E(b.hour(),2)}:${E(b.minute(),2)}:${E(b.second(),2)}.${b.millisecond()}`}()+": "+this.prefix+": "+a+this.newline)}};function J(a=!0,b=""){return new I(console.info,console.error,"",a,b)}function K(a){return C(this,null,function*(){let b={errors:[],data:null};try{b.data=JSON.parse((yield f.readFile(a)).toString())}catch(a){b.errors.push(a)}return b})}function L(a){return C(this,null,function*(){if(!a)return!1;try{return(yield f.stat(a)).isDirectory()}catch(b){try{return yield f.mkdir(a),!0}catch(a){return!1}}})}var M=A.join(process.env.HOME?process.env.HOME:"/",".audiotools"),N=function(a=!0,b=""){return new I(a=>process.stdout.write(String(a)),a=>console.error(String(a)),"\n",a,b)}(!1);function O(){return C(this,arguments,function*(a=M){let b=A.join(a,"target"),c={piscsiHost:"pi-scsi2.local",s3kScsiId:4,getS3kDefaultProgramPath:a=>A.join("data","s3000xl","defaults",`kg_${E(a,2)}.a3p`),sourceRoot:A.join(a,"source"),targetRoot:b,jobsRoot:A.join(a,"jobs"),sessionRoot:A.join(a,"sessions"),logfile:A.join(a,"log.txt"),s3k:A.join(b,"s3k"),akaiDisk:A.join(b,"s3k","HD4.hds"),akaiTools:A.join(a,"akaitools-1.5")},d=A.join(a,"server-config.json");try{let a=(yield K(d)).data;c.piscsiHost=a.piscsiHost,c.s3kScsiId=a.s3kScsiId,c.sourceRoot=a.sourceRoot,c.targetRoot=a.targetRoot}catch(a){}return yield function(a){return C(this,null,function*(){if(!a)throw Error("Config is undefined");if(void 0===a.s3kScsiId)throw Error("S3000XL disk SCSI ID is undefined.");if(!a.piscsiHost)throw Error("piscsi hostis undefined.");yield L(a.sourceRoot),yield L(a.targetRoot),yield L(a.sessionRoot),yield L(a.s3k)})}(c),c})}function P(a,b=M){let c=A.join(b,"config.json");return N.log(`Saving config to : ${c}`),new Promise((d,e)=>{(function(a=M){return f.stat(a).then(b=>{if(!b.isDirectory())throw Error(`${a} is not a directory`)}).catch(()=>f.mkdir(a))})(b).then(()=>f.writeFile(c,JSON.stringify(a)).then(()=>d(c))).catch(a=>e(a)).catch(a=>e(a))})}function Q(){return C(this,arguments,function*(a=M){let b={midiOutput:"",midiInput:""},c=A.join(a,"config.json"),d=null;try{N.log(`Reading config from: ${c}`),b.midiOutput=(d=JSON.parse((yield f.readFile(c)).toString())).midiOutput,b.midiInput=d.midiInput}catch(a){N.log(`Error reading config from: ${c}: ${a.message}`)}return b})}}};