mcp-music-studio 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,6 +43,7 @@ Write code → hear it play → edit in a live REPL.
43
43
  - **72 drum machine banks** + **128 GM instruments** + built-in synths
44
44
  - **Full effects chain** — filters, reverb, delay, FM synthesis
45
45
  - **Editable REPL** — users can tweak the code and hear changes instantly
46
+ - **Live visuals** — add `.pianoroll()` / `.scope()` / `.spectrum()` to animate behind the code (native strudel.cc overlay)
46
47
  - **Record & download** — capture live audio and export as WAV
47
48
  - **`get-strudel-guide`** — 7 reference topics (mini-notation, sounds, effects, patterns, genres, tips, advanced)
48
49
 
package/dist/index.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
@@ -3400,7 +3418,7 @@ var require_dbcs_codec = __commonJS((exports) => {
3400
3418
  if (resCode !== undefined) {
3401
3419
  dbcsCode = resCode;
3402
3420
  nextChar = uCode;
3403
- } else {}
3421
+ }
3404
3422
  }
3405
3423
  seqObj = undefined;
3406
3424
  } else if (uCode >= 0) {
@@ -3465,7 +3483,7 @@ var require_dbcs_codec = __commonJS((exports) => {
3465
3483
  newBuf[j++] = dbcsCode >> 8;
3466
3484
  newBuf[j++] = dbcsCode & 255;
3467
3485
  }
3468
- } else {}
3486
+ }
3469
3487
  this.seqObj = undefined;
3470
3488
  }
3471
3489
  if (this.leadSurrogate !== -1) {
@@ -5098,14 +5116,14 @@ var require_lib = __commonJS((exports, module) => {
5098
5116
  exports.encodings = null;
5099
5117
  exports.defaultCharUnicode = "�";
5100
5118
  exports.defaultCharSingleByte = "?";
5101
- exports.encode = function encode(str, encoding, options) {
5119
+ exports.encode = function encode2(str, encoding, options) {
5102
5120
  str = "" + (str || "");
5103
5121
  var encoder = exports.getEncoder(encoding, options);
5104
5122
  var res = encoder.write(str);
5105
5123
  var trail = encoder.end();
5106
5124
  return trail && trail.length > 0 ? Buffer2.concat([res, trail]) : res;
5107
5125
  };
5108
- exports.decode = function decode(buf, encoding, options) {
5126
+ exports.decode = function decode2(buf, encoding, options) {
5109
5127
  if (typeof buf === "string") {
5110
5128
  if (!exports.skipDecodeWarning) {
5111
5129
  console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding");
@@ -15077,17 +15095,6 @@ var require_db = __commonJS((exports, module) => {
15077
15095
  };
15078
15096
  });
15079
15097
 
15080
- // node_modules/mime-db/index.js
15081
- var require_mime_db = __commonJS((exports, module) => {
15082
- /*!
15083
- * mime-db
15084
- * Copyright(c) 2014 Jonathan Ong
15085
- * Copyright(c) 2015-2022 Douglas Christopher Wilson
15086
- * MIT Licensed
15087
- */
15088
- module.exports = require_db();
15089
- });
15090
-
15091
15098
  // node_modules/mime-types/mimeScore.js
15092
15099
  var require_mimeScore = __commonJS((exports, module) => {
15093
15100
  var FACET_SCORES = {
@@ -15132,7 +15139,7 @@ var require_mime_types = __commonJS((exports) => {
15132
15139
  * Copyright(c) 2015 Douglas Christopher Wilson
15133
15140
  * MIT Licensed
15134
15141
  */
15135
- var db = require_mime_db();
15142
+ var db = require_db();
15136
15143
  var extname = __require("path").extname;
15137
15144
  var mimeScore = require_mimeScore();
15138
15145
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
@@ -16419,7 +16426,7 @@ var require_round = __commonJS((exports, module) => {
16419
16426
 
16420
16427
  // node_modules/math-intrinsics/isNaN.js
16421
16428
  var require_isNaN = __commonJS((exports, module) => {
16422
- module.exports = Number.isNaN || function isNaN(a) {
16429
+ module.exports = Number.isNaN || function isNaN2(a) {
16423
16430
  return a !== a;
16424
16431
  };
16425
16432
  });
@@ -16553,7 +16560,7 @@ var require_implementation = __commonJS((exports, module) => {
16553
16560
  var toStr = Object.prototype.toString;
16554
16561
  var max = Math.max;
16555
16562
  var funcType = "[object Function]";
16556
- var concatty = function concatty(a, b) {
16563
+ var concatty = function concatty2(a, b) {
16557
16564
  var arr = [];
16558
16565
  for (var i = 0;i < a.length; i += 1) {
16559
16566
  arr[i] = a[i];
@@ -16563,7 +16570,7 @@ var require_implementation = __commonJS((exports, module) => {
16563
16570
  }
16564
16571
  return arr;
16565
16572
  };
16566
- var slicy = function slicy(arrLike, offset) {
16573
+ var slicy = function slicy2(arrLike, offset) {
16567
16574
  var arr = [];
16568
16575
  for (var i = offset || 0, j = 0;i < arrLike.length; i += 1, j += 1) {
16569
16576
  arr[j] = arrLike[i];
@@ -16604,7 +16611,7 @@ var require_implementation = __commonJS((exports, module) => {
16604
16611
  }
16605
16612
  bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
16606
16613
  if (target.prototype) {
16607
- var Empty = function Empty() {};
16614
+ var Empty = function Empty2() {};
16608
16615
  Empty.prototype = target.prototype;
16609
16616
  bound.prototype = new Empty;
16610
16617
  Empty.prototype = null;
@@ -16843,7 +16850,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16843
16850
  }
16844
16851
  }
16845
16852
  var errorProto;
16846
- var doEval = function doEval(name) {
16853
+ var doEval = function doEval2(name) {
16847
16854
  var value;
16848
16855
  if (name === "%AsyncFunction%") {
16849
16856
  value = getEvalledConstructor("async function () {}");
@@ -16852,12 +16859,12 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16852
16859
  } else if (name === "%AsyncGeneratorFunction%") {
16853
16860
  value = getEvalledConstructor("async function* () {}");
16854
16861
  } else if (name === "%AsyncGenerator%") {
16855
- var fn = doEval("%AsyncGeneratorFunction%");
16862
+ var fn = doEval2("%AsyncGeneratorFunction%");
16856
16863
  if (fn) {
16857
16864
  value = fn.prototype;
16858
16865
  }
16859
16866
  } else if (name === "%AsyncIteratorPrototype%") {
16860
- var gen = doEval("%AsyncGenerator%");
16867
+ var gen = doEval2("%AsyncGenerator%");
16861
16868
  if (gen && getProto) {
16862
16869
  value = getProto(gen.prototype);
16863
16870
  }
@@ -16928,7 +16935,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16928
16935
  var $exec = bind.call($call, RegExp.prototype.exec);
16929
16936
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
16930
16937
  var reEscapeChar = /\\(\\)?/g;
16931
- var stringToPath = function stringToPath(string3) {
16938
+ var stringToPath = function stringToPath2(string3) {
16932
16939
  var first = $strSlice(string3, 0, 1);
16933
16940
  var last = $strSlice(string3, -1);
16934
16941
  if (first === "%" && last !== "%") {
@@ -16942,7 +16949,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
16942
16949
  });
16943
16950
  return result;
16944
16951
  };
16945
- var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
16952
+ var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
16946
16953
  var intrinsicName = name;
16947
16954
  var alias;
16948
16955
  if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
@@ -17227,17 +17234,17 @@ var require_utils2 = __commonJS((exports, module) => {
17227
17234
  var has = Object.prototype.hasOwnProperty;
17228
17235
  var isArray = Array.isArray;
17229
17236
  var overflowChannel = getSideChannel();
17230
- var markOverflow = function markOverflow(obj, maxIndex) {
17237
+ var markOverflow = function markOverflow2(obj, maxIndex) {
17231
17238
  overflowChannel.set(obj, maxIndex);
17232
17239
  return obj;
17233
17240
  };
17234
- var isOverflow = function isOverflow(obj) {
17241
+ var isOverflow = function isOverflow2(obj) {
17235
17242
  return overflowChannel.has(obj);
17236
17243
  };
17237
- var getMaxIndex = function getMaxIndex(obj) {
17244
+ var getMaxIndex = function getMaxIndex2(obj) {
17238
17245
  return overflowChannel.get(obj);
17239
17246
  };
17240
- var setMaxIndex = function setMaxIndex(obj, maxIndex) {
17247
+ var setMaxIndex = function setMaxIndex2(obj, maxIndex) {
17241
17248
  overflowChannel.set(obj, maxIndex);
17242
17249
  };
17243
17250
  var hexTable = function() {
@@ -17247,7 +17254,7 @@ var require_utils2 = __commonJS((exports, module) => {
17247
17254
  }
17248
17255
  return array2;
17249
17256
  }();
17250
- var compactQueue = function compactQueue(queue) {
17257
+ var compactQueue = function compactQueue2(queue) {
17251
17258
  while (queue.length > 1) {
17252
17259
  var item = queue.pop();
17253
17260
  var obj = item.obj[item.prop];
@@ -17262,7 +17269,7 @@ var require_utils2 = __commonJS((exports, module) => {
17262
17269
  }
17263
17270
  }
17264
17271
  };
17265
- var arrayToObject = function arrayToObject(source, options) {
17272
+ var arrayToObject = function arrayToObject2(source, options) {
17266
17273
  var obj = options && options.plainObjects ? { __proto__: null } : {};
17267
17274
  for (var i = 0;i < source.length; ++i) {
17268
17275
  if (typeof source[i] !== "undefined") {
@@ -17271,7 +17278,7 @@ var require_utils2 = __commonJS((exports, module) => {
17271
17278
  }
17272
17279
  return obj;
17273
17280
  };
17274
- var merge2 = function merge(target, source, options) {
17281
+ var merge2 = function merge3(target, source, options) {
17275
17282
  if (!source) {
17276
17283
  return target;
17277
17284
  }
@@ -17322,7 +17329,7 @@ var require_utils2 = __commonJS((exports, module) => {
17322
17329
  if (has.call(target, i)) {
17323
17330
  var targetItem = target[i];
17324
17331
  if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
17325
- target[i] = merge(targetItem, item, options);
17332
+ target[i] = merge3(targetItem, item, options);
17326
17333
  } else {
17327
17334
  target[target.length] = item;
17328
17335
  }
@@ -17335,7 +17342,7 @@ var require_utils2 = __commonJS((exports, module) => {
17335
17342
  return Object.keys(source).reduce(function(acc, key) {
17336
17343
  var value = source[key];
17337
17344
  if (has.call(acc, key)) {
17338
- acc[key] = merge(acc[key], value, options);
17345
+ acc[key] = merge3(acc[key], value, options);
17339
17346
  } else {
17340
17347
  acc[key] = value;
17341
17348
  }
@@ -17369,7 +17376,7 @@ var require_utils2 = __commonJS((exports, module) => {
17369
17376
  }
17370
17377
  };
17371
17378
  var limit = 1024;
17372
- var encode2 = function encode(str, defaultEncoder, charset, kind, format) {
17379
+ var encode2 = function encode3(str, defaultEncoder, charset, kind, format) {
17373
17380
  if (str.length === 0) {
17374
17381
  return str;
17375
17382
  }
@@ -17414,7 +17421,7 @@ var require_utils2 = __commonJS((exports, module) => {
17414
17421
  }
17415
17422
  return out;
17416
17423
  };
17417
- var compact = function compact(value) {
17424
+ var compact = function compact2(value) {
17418
17425
  var queue = [{ obj: { o: value }, prop: "o" }];
17419
17426
  var refs = [];
17420
17427
  for (var i = 0;i < queue.length; ++i) {
@@ -17433,16 +17440,16 @@ var require_utils2 = __commonJS((exports, module) => {
17433
17440
  compactQueue(queue);
17434
17441
  return value;
17435
17442
  };
17436
- var isRegExp = function isRegExp(obj) {
17443
+ var isRegExp = function isRegExp2(obj) {
17437
17444
  return Object.prototype.toString.call(obj) === "[object RegExp]";
17438
17445
  };
17439
- var isBuffer = function isBuffer(obj) {
17446
+ var isBuffer = function isBuffer2(obj) {
17440
17447
  if (!obj || typeof obj !== "object") {
17441
17448
  return false;
17442
17449
  }
17443
17450
  return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
17444
17451
  };
17445
- var combine = function combine(a, b, arrayLimit, plainObjects) {
17452
+ var combine = function combine2(a, b, arrayLimit, plainObjects) {
17446
17453
  if (isOverflow(a)) {
17447
17454
  var newIndex = getMaxIndex(a) + 1;
17448
17455
  a[newIndex] = b;
@@ -17455,7 +17462,7 @@ var require_utils2 = __commonJS((exports, module) => {
17455
17462
  }
17456
17463
  return result;
17457
17464
  };
17458
- var maybeMap = function maybeMap(val, fn) {
17465
+ var maybeMap = function maybeMap2(val, fn) {
17459
17466
  if (isArray(val)) {
17460
17467
  var mapped = [];
17461
17468
  for (var i = 0;i < val.length; i += 1) {
@@ -17529,11 +17536,11 @@ var require_stringify = __commonJS((exports, module) => {
17529
17536
  skipNulls: false,
17530
17537
  strictNullHandling: false
17531
17538
  };
17532
- var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
17539
+ var isNonNullishPrimitive = function isNonNullishPrimitive2(v) {
17533
17540
  return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
17534
17541
  };
17535
17542
  var sentinel = {};
17536
- var stringify = function stringify(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
17543
+ var stringify = function stringify2(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
17537
17544
  var obj = object2;
17538
17545
  var tmpSc = sideChannel;
17539
17546
  var step = 0;
@@ -17609,11 +17616,11 @@ var require_stringify = __commonJS((exports, module) => {
17609
17616
  sideChannel.set(object2, step);
17610
17617
  var valueSideChannel = getSideChannel();
17611
17618
  valueSideChannel.set(sentinel, sideChannel);
17612
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
17619
+ pushToArray(values, stringify2(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
17613
17620
  }
17614
17621
  return values;
17615
17622
  };
17616
- var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
17623
+ var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) {
17617
17624
  if (!opts) {
17618
17625
  return defaults;
17619
17626
  }
@@ -17875,7 +17882,7 @@ var require_parse = __commonJS((exports, module) => {
17875
17882
  }
17876
17883
  return leaf;
17877
17884
  };
17878
- var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
17885
+ var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) {
17879
17886
  var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
17880
17887
  if (options.depth <= 0) {
17881
17888
  if (!options.plainObjects && has.call(Object.prototype, key)) {
@@ -17927,7 +17934,7 @@ var require_parse = __commonJS((exports, module) => {
17927
17934
  }
17928
17935
  return parseObject(keys, val, options, valuesParsed);
17929
17936
  };
17930
- var normalizeParseOptions = function normalizeParseOptions(opts) {
17937
+ var normalizeParseOptions = function normalizeParseOptions2(opts) {
17931
17938
  if (!opts) {
17932
17939
  return defaults;
17933
17940
  }
@@ -18517,7 +18524,7 @@ var require_view = __commonJS((exports, module) => {
18517
18524
  });
18518
18525
  sync = false;
18519
18526
  };
18520
- View.prototype.resolve = function resolve(dir, file) {
18527
+ View.prototype.resolve = function resolve2(dir, file) {
18521
18528
  var ext = this.ext;
18522
18529
  var path2 = join(dir, file);
18523
18530
  var stat = tryStat(path2);
@@ -19772,12 +19779,12 @@ var require_dist = __commonJS((exports) => {
19772
19779
  const { encode: encode2 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
19773
19780
  const data = typeof path === "object" ? path : parse5(path, options);
19774
19781
  const fn = tokensToFunction(data.tokens, delimiter, encode2);
19775
- return function path(params = {}) {
19776
- const [path2, ...missing] = fn(params);
19782
+ return function path2(params = {}) {
19783
+ const [path3, ...missing] = fn(params);
19777
19784
  if (missing.length) {
19778
19785
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
19779
19786
  }
19780
- return path2;
19787
+ return path3;
19781
19788
  };
19782
19789
  }
19783
19790
  function tokensToFunction(tokens, delimiter, encode2) {
@@ -19843,7 +19850,7 @@ var require_dist = __commonJS((exports) => {
19843
19850
  return decode2;
19844
19851
  return (value) => value.split(delimiter).map(decode2);
19845
19852
  });
19846
- return function match(input) {
19853
+ return function match2(input) {
19847
19854
  const m = regexp.exec(input);
19848
19855
  if (!m)
19849
19856
  return false;
@@ -20088,7 +20095,7 @@ var require_layer = __commonJS((exports, module) => {
20088
20095
  }
20089
20096
  };
20090
20097
  Layer.prototype.match = function match(path) {
20091
- let match;
20098
+ let match2;
20092
20099
  if (path != null) {
20093
20100
  if (this.slash) {
20094
20101
  this.params = {};
@@ -20096,19 +20103,19 @@ var require_layer = __commonJS((exports, module) => {
20096
20103
  return true;
20097
20104
  }
20098
20105
  let i = 0;
20099
- while (!match && i < this.matchers.length) {
20100
- match = this.matchers[i](path);
20106
+ while (!match2 && i < this.matchers.length) {
20107
+ match2 = this.matchers[i](path);
20101
20108
  i++;
20102
20109
  }
20103
20110
  }
20104
- if (!match) {
20111
+ if (!match2) {
20105
20112
  this.params = undefined;
20106
20113
  this.path = undefined;
20107
20114
  return false;
20108
20115
  }
20109
- this.params = match.params;
20110
- this.path = match.path;
20111
- this.keys = Object.keys(match.params);
20116
+ this.params = match2.params;
20117
+ this.path = match2.path;
20118
+ this.keys = Object.keys(match2.params);
20112
20119
  return true;
20113
20120
  };
20114
20121
  function decodeParam(val) {
@@ -20476,18 +20483,18 @@ var require_router = __commonJS((exports, module) => {
20476
20483
  return this;
20477
20484
  };
20478
20485
  Router.prototype.route = function route(path) {
20479
- const route = new Route(path);
20486
+ const route2 = new Route(path);
20480
20487
  const layer = new Layer(path, {
20481
20488
  sensitive: this.caseSensitive,
20482
20489
  strict: this.strict,
20483
20490
  end: true
20484
20491
  }, handle);
20485
20492
  function handle(req, res, next) {
20486
- route.dispatch(req, res, next);
20493
+ route2.dispatch(req, res, next);
20487
20494
  }
20488
- layer.route = route;
20495
+ layer.route = route2;
20489
20496
  this.stack.push(layer);
20490
- return route;
20497
+ return route2;
20491
20498
  };
20492
20499
  methods.concat("all").forEach(function(method) {
20493
20500
  Router.prototype[method] = function(path) {
@@ -21086,7 +21093,7 @@ var require_encoding = __commonJS((exports, module) => {
21086
21093
  }
21087
21094
  function preferredEncodings(accept, provided, preferred) {
21088
21095
  var accepts = parseAcceptEncoding(accept || "");
21089
- var comparator = preferred ? function comparator(a, b) {
21096
+ var comparator = preferred ? function comparator2(a, b) {
21090
21097
  if (a.q !== b.q) {
21091
21098
  return b.q - a.q;
21092
21099
  }
@@ -21731,10 +21738,10 @@ var require_request = __commonJS((exports, module) => {
21731
21738
  return accepts(this).languages(...languages);
21732
21739
  };
21733
21740
  req.range = function range(size, options) {
21734
- var range = this.get("Range");
21735
- if (!range)
21741
+ var range2 = this.get("Range");
21742
+ if (!range2)
21736
21743
  return;
21737
- return parseRange(size, range, options);
21744
+ return parseRange(size, range2, options);
21738
21745
  };
21739
21746
  defineGetter(req, "query", function query() {
21740
21747
  var queryparse = this.app.get("query parser fn");
@@ -21782,8 +21789,8 @@ var require_request = __commonJS((exports, module) => {
21782
21789
  if (!hostname)
21783
21790
  return [];
21784
21791
  var offset = this.app.get("subdomain offset");
21785
- var subdomains = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
21786
- return subdomains.slice(offset);
21792
+ var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
21793
+ return subdomains2.slice(offset);
21787
21794
  });
21788
21795
  defineGetter(req, "path", function path() {
21789
21796
  return parse5(this).pathname;
@@ -22253,7 +22260,7 @@ var require_send = __commonJS((exports, module) => {
22253
22260
  this._root = opts.root ? resolve(opts.root) : null;
22254
22261
  }
22255
22262
  util.inherits(SendStream, Stream);
22256
- SendStream.prototype.error = function error(status, err) {
22263
+ SendStream.prototype.error = function error2(status, err) {
22257
22264
  if (hasListeners(this, "error")) {
22258
22265
  return this.emit("error", createHttpError(status, err));
22259
22266
  }
@@ -22368,7 +22375,7 @@ var require_send = __commonJS((exports, module) => {
22368
22375
  res.setHeader("Location", loc);
22369
22376
  res.end(doc2);
22370
22377
  };
22371
- SendStream.prototype.pipe = function pipe(res) {
22378
+ SendStream.prototype.pipe = function pipe2(res) {
22372
22379
  var root = this._root;
22373
22380
  this.res = res;
22374
22381
  var path2 = decode2(this.path);
@@ -22422,7 +22429,7 @@ var require_send = __commonJS((exports, module) => {
22422
22429
  this.sendFile(path2);
22423
22430
  return res;
22424
22431
  };
22425
- SendStream.prototype.send = function send(path2, stat) {
22432
+ SendStream.prototype.send = function send2(path2, stat) {
22426
22433
  var len = stat.size;
22427
22434
  var options = this.options;
22428
22435
  var opts = {};
@@ -22547,18 +22554,18 @@ var require_send = __commonJS((exports, module) => {
22547
22554
  SendStream.prototype.stream = function stream(path2, options) {
22548
22555
  var self = this;
22549
22556
  var res = this.res;
22550
- var stream = fs.createReadStream(path2, options);
22551
- this.emit("stream", stream);
22552
- stream.pipe(res);
22557
+ var stream2 = fs.createReadStream(path2, options);
22558
+ this.emit("stream", stream2);
22559
+ stream2.pipe(res);
22553
22560
  function cleanup() {
22554
- stream.destroy();
22561
+ stream2.destroy();
22555
22562
  }
22556
22563
  onFinished(res, cleanup);
22557
- stream.on("error", function onerror(err) {
22564
+ stream2.on("error", function onerror(err) {
22558
22565
  cleanup();
22559
22566
  self.onStatError(err);
22560
22567
  });
22561
- stream.on("end", function onend() {
22568
+ stream2.on("end", function onend() {
22562
22569
  self.emit("end");
22563
22570
  });
22564
22571
  };
@@ -22567,9 +22574,9 @@ var require_send = __commonJS((exports, module) => {
22567
22574
  if (res.getHeader("Content-Type"))
22568
22575
  return;
22569
22576
  var ext = extname(path2);
22570
- var type = mime.contentType(ext) || "application/octet-stream";
22571
- debug("content-type %s", type);
22572
- res.setHeader("Content-Type", type);
22577
+ var type2 = mime.contentType(ext) || "application/octet-stream";
22578
+ debug("content-type %s", type2);
22579
+ res.setHeader("Content-Type", type2);
22573
22580
  };
22574
22581
  SendStream.prototype.setHeader = function setHeader(path2, stat) {
22575
22582
  var res = this.res;
@@ -22831,7 +22838,7 @@ var require_response = __commonJS((exports, module) => {
22831
22838
  }
22832
22839
  }).join(", "));
22833
22840
  };
22834
- res.send = function send(body) {
22841
+ res.send = function send2(body) {
22835
22842
  var chunk = body;
22836
22843
  var encoding;
22837
22844
  var req = this.req;
@@ -23293,7 +23300,7 @@ var require_serve_static = __commonJS((exports, module) => {
23293
23300
  opts.maxage = opts.maxage || opts.maxAge || 0;
23294
23301
  opts.root = resolve(root);
23295
23302
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
23296
- return function serveStatic(req, res, next) {
23303
+ return function serveStatic2(req, res, next) {
23297
23304
  if (req.method !== "GET" && req.method !== "HEAD") {
23298
23305
  if (fallthrough) {
23299
23306
  return next();
@@ -23320,7 +23327,7 @@ var require_serve_static = __commonJS((exports, module) => {
23320
23327
  forwardError = true;
23321
23328
  });
23322
23329
  }
23323
- stream.on("error", function error(err) {
23330
+ stream.on("error", function error2(err) {
23324
23331
  if (forwardError || !(err.statusCode < 500)) {
23325
23332
  next(err);
23326
23333
  return;
@@ -23422,18 +23429,6 @@ var require_express = __commonJS((exports, module) => {
23422
23429
  exports.urlencoded = bodyParser.urlencoded;
23423
23430
  });
23424
23431
 
23425
- // node_modules/express/index.js
23426
- var require_express2 = __commonJS((exports, module) => {
23427
- /*!
23428
- * express
23429
- * Copyright(c) 2009-2013 TJ Holowaychuk
23430
- * Copyright(c) 2013 Roman Shtylman
23431
- * Copyright(c) 2014-2015 Douglas Christopher Wilson
23432
- * MIT Licensed
23433
- */
23434
- module.exports = require_express();
23435
- });
23436
-
23437
23432
  // node_modules/object-assign/index.js
23438
23433
  var require_object_assign = __commonJS((exports, module) => {
23439
23434
  var getOwnPropertySymbols = Object.getOwnPropertySymbols;
@@ -27339,7 +27334,7 @@ function finalize(ctx, schema) {
27339
27334
  result.$schema = "http://json-schema.org/draft-07/schema#";
27340
27335
  } else if (ctx.target === "draft-04") {
27341
27336
  result.$schema = "http://json-schema.org/draft-04/schema#";
27342
- } else if (ctx.target === "openapi-3.0") {} else {}
27337
+ } else if (ctx.target === "openapi-3.0") {}
27343
27338
  if (ctx.external?.uri) {
27344
27339
  const id = ctx.external.registry.get(schema)?.id;
27345
27340
  if (!id)
@@ -27561,7 +27556,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
27561
27556
  if (val === undefined) {
27562
27557
  if (ctx.unrepresentable === "throw") {
27563
27558
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
27564
- } else {}
27559
+ }
27565
27560
  } else if (typeof val === "bigint") {
27566
27561
  if (ctx.unrepresentable === "throw") {
27567
27562
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -29404,7 +29399,7 @@ class StdioServerTransport {
29404
29399
  }
29405
29400
 
29406
29401
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js
29407
- var import_express = __toESM(require_express2(), 1);
29402
+ var import_express = __toESM(require_express(), 1);
29408
29403
 
29409
29404
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js
29410
29405
  function hostHeaderValidation(allowedHostnames) {
package/dist/mcp-app.html CHANGED
@@ -228,7 +228,7 @@ X:`),l=o.length;return l===0&&(l=1),l};var r=a.TuneBook=function(s){var o=t(s);t
228
228
  `)}
229
229
  `):`${a.join(`
230
230
  `)}
231
- ${n}`}function _3(e){const t=y3(e),n={};return e.swing!==void 0&&(n.swing=e.swing),{...t,abcNotation:e.abcNotation?w3(e.abcNotation,e):void 0,synthOptions:n}}function k3(e){const t=e.numberOfChannels,n=e.sampleRate,a=e.length,r=2,s=a*t*r,o=44,l=new ArrayBuffer(o+s),h=new DataView(l);sr(h,0,"RIFF"),h.setUint32(4,36+s,!0),sr(h,8,"WAVE"),sr(h,12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,t,!0),h.setUint32(24,n,!0),h.setUint32(28,n*t*r,!0),h.setUint16(32,t*r,!0),h.setUint16(34,16,!0),sr(h,36,"data"),h.setUint32(40,s,!0);const g=Array.from({length:t},(u,i)=>e.getChannelData(i));let p=44;for(let u=0;u<a;u++)for(let i=0;i<t;i++){const v=Math.max(-1,Math.min(1,g[i][u]));h.setInt16(p,v<0?v*32768:v*32767,!0),p+=2}const d=new Uint8Array(l);let f="";const c=8192;for(let u=0;u<d.length;u+=c)f+=String.fromCharCode(...d.subarray(u,u+c));return btoa(f)}function sr(e,t,n){for(let a=0;a<n.length;a++)e.setUint8(t+a,n.charCodeAt(a))}const C3="0.4.1",he={visualObj:null,synthControl:null,currentInstrument:du,currentStyle:"",currentAbc:null,highlightedEls:[]},or=document.querySelector(".main"),zc=document.getElementById("status"),St=document.getElementById("sheet-music"),ya=document.getElementById("audio-controls"),gu=document.getElementById("instrument-selector"),vu=document.getElementById("style-selector"),Tr=document.getElementById("toolbar");"audioSession"in navigator&&(navigator.audioSession.type="playback");const x3={onEvent(e){if(he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[],!!e.elements){for(const t of e.elements)for(const n of t)n.classList.add("note-playing"),he.highlightedEls.push(n);he.highlightedEls.length>0&&he.highlightedEls[0].scrollIntoView({behavior:"smooth",block:"nearest"})}},onFinished(){he.highlightedEls.forEach(e=>e.classList.remove("note-playing")),he.highlightedEls=[]}},Tt=document.createElement("select");Tt.id="instrument-select";Tt.className="control-select";for(const e of Object.keys(jt)){const t=document.createElement("option");t.value=e,t.textContent=e,e===he.currentInstrument&&(t.selected=!0),Tt.appendChild(t)}Tt.addEventListener("change",()=>{he.currentInstrument=Tt.value,he.visualObj&&he.synthControl&&S3()});async function S3(){var e;if(!(!he.synthControl||!((e=he.visualObj)!=null&&e[0])))try{const n={program:jt[he.currentInstrument]??0};await he.synthControl.setTune(he.visualObj[0],!1,n)}catch(t){console.error("Failed to apply settings:",t)}}const Er=document.createElement("label");Er.className="control-label";Er.htmlFor="instrument-select";Er.textContent="Instrument";gu.appendChild(Er);gu.appendChild(Tt);const ht=document.createElement("select");ht.id="style-select";ht.className="control-select";const bi=document.createElement("option");bi.value="";bi.textContent="No style (melody only)";ht.appendChild(bi);for(const e of Object.keys(vi)){const t=document.createElement("option");t.value=e,t.textContent=e.charAt(0).toUpperCase()+e.slice(1),ht.appendChild(t)}ht.addEventListener("change",()=>{he.currentStyle=ht.value,he.currentAbc&&mu(he.currentAbc)});const Ar=document.createElement("label");Ar.className="control-label";Ar.htmlFor="style-select";Ar.textContent="Style";vu.appendChild(Ar);vu.appendChild(ht);let lr=null;const Ht=document.createElement("button");Ht.className="toolbar-btn";Ht.textContent="⛶";Ht.title="Toggle fullscreen";Ht.setAttribute("aria-label","Toggle fullscreen");Ht.addEventListener("click",()=>{lr==null||lr.requestDisplayMode({mode:"fullscreen"})});Tr.appendChild(Ht);const Ve=document.createElement("button");Ve.className="toolbar-btn";Ve.textContent="↓";Ve.title="Download audio (WAV)";Ve.setAttribute("aria-label","Download audio as WAV");Ve.disabled=!0;Tr.appendChild(Ve);let Sa=!1,Ta=!1;function T3(e){if(!e)return"music";const t=e.match(/T:\s*(.+)/);return t?t[1].trim().replace(/[^a-zA-Z0-9_-]/g,"_"):"music"}Ve.addEventListener("click",async()=>{var n;if(!he.synthControl)return;const e=he.synthControl.midiBuffer,t=(n=e==null?void 0:e.getAudioBuffer)==null?void 0:n.call(e);if(!t){st("Play first to generate audio",!0);return}Ve.disabled=!0,Ve.textContent="...";try{const a=k3(t),r=T3(he.currentAbc);await et.downloadFile({contents:[{type:"resource",resource:{uri:`file:///${r}.wav`,mimeType:"audio/wav",blob:a}}]})}catch(a){st(`Download failed: ${a.message}`,!0)}finally{Ve.disabled=!1,Ve.textContent="↓"}});const je=document.createElement("button");je.className="toolbar-btn";je.textContent="↗";je.title="Send this ABC to chat";je.setAttribute("aria-label","Send this ABC notation to the chat");je.disabled=!0;je.hidden=!0;Tr.appendChild(je);je.addEventListener("click",async()=>{if(he.currentAbc){je.disabled=!0,je.textContent="...";try{await et.sendMessage({role:"user",content:[{type:"text",text:"Here's my ABC notation:\n```\n"+he.currentAbc+"\n```"}]})}catch(e){st(`Send failed: ${e.message}`,!0)}finally{je.disabled=!1,je.textContent="↗"}}});function st(e,t=!1){zc.textContent=e,zc.classList.toggle("error",t)}function E3(e){if(st(e),!he.visualObj){const t=document.createElement("div");t.className="loading-skeleton",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");const n=document.createElement("span");n.className="spinner",n.setAttribute("aria-hidden","true");const a=document.createElement("span");a.textContent=e,t.append(n,a),St.replaceChildren(t)}}async function mu(e,t){var n;try{st("Rendering..."),he.synthControl&&he.synthControl.pause(),he.currentAbc=e,St.innerHTML="",ya.innerHTML="";const a=pu(e,he.currentStyle);if(he.visualObj=cr.renderAbc(St,a,{responsive:"resize",add_classes:!0}),!he.visualObj||he.visualObj.length===0)throw new Error("Failed to parse music notation");if(!cr.synth.supportsAudio())throw new Error("Audio not supported in this browser");he.synthControl=new cr.synth.SynthController,he.synthControl.load(ya,x3,{displayLoop:!0,displayPlay:!0,displayProgress:!0,displayWarp:!0});const s={program:jt[he.currentInstrument]??0,...t};await he.synthControl.setTune(he.visualObj[0],!1,s),Tr.classList.add("visible"),Ve.disabled=!Sa,je.disabled=!Ta,(n=he.synthControl.play())==null||n.then(()=>st("Playing...")).catch(o=>{console.debug("Autoplay blocked:",o),st("Click ▶ to play")})}catch(a){console.error("Render error:",a),st(`Error: ${a.message}`,!0),ya.innerHTML=""}}const et=new Ag({name:"Music Studio",version:C3});lr=et;et.ontoolinput=e=>{console.info("Received tool input:",e);const t=_3(e.arguments??{});he.currentInstrument=t.instrument,Tt.value=t.instrument,he.currentStyle=t.style,ht.value=t.style,t.abcNotation?mu(t.abcNotation,t.synthOptions).catch(console.error):st("No ABC notation provided",!0)};let zt=null,Ea="";et.ontoolinputpartial=e=>{var a,r;const t=(a=e.arguments)==null?void 0:a.abcNotation;if(!t)return;he.currentAbc=t;const n=(r=e.arguments)==null?void 0:r.style;if(n&&mi(n)&&he.currentStyle!==n&&(he.currentStyle=n,ht.value=n),!t.match(/K:[^\n]+/)){E3("Composing…");return}t!==Ea&&(Ea=t,zt&&clearTimeout(zt),zt=setTimeout(()=>{try{const s=pu(t,he.currentStyle);cr.renderAbc(St,s,{responsive:"resize",add_classes:!0}),St.scrollTop=St.scrollHeight;const o=St.closest(".sheet-section");o&&(o.scrollTop=o.scrollHeight),st("Composing...")}catch{}},150))};et.onerror=console.error;function bu(){var e;try{(e=he.synthControl)==null||e.pause()}catch{}he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[]}function yu(){zt&&(clearTimeout(zt),zt=null),Ea=""}et.ontoolcancelled=e=>{bu(),yu();const t=e!=null&&e.reason?` (${e.reason})`:"";st(`Composition cancelled${t}.`)};et.onteardown=()=>(bu(),yu(),{});function wu(e){var t;e.theme&&Tg(e.theme),(t=e.styles)!=null&&t.variables&&Eg(e.styles.variables),e.safeAreaInsets&&(or.style.paddingTop=`${e.safeAreaInsets.top}px`,or.style.paddingRight=`${e.safeAreaInsets.right}px`,or.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,or.style.paddingLeft=`${e.safeAreaInsets.left}px`)}et.onhostcontextchanged=wu;et.connect().then(()=>{var t,n;Sa=!!((t=et.getHostCapabilities())!=null&&t.downloadFile),Sa||(Ve.hidden=!0,Ve.disabled=!0,Ve.title="Audio download isn't supported by this host"),Ta=!!((n=et.getHostCapabilities())!=null&&n.message),Ta?je.hidden=!1:(je.disabled=!0,je.title="Sending to chat isn't supported by this host");const e=et.getHostContext();e&&wu(e)});</script>
231
+ ${n}`}function _3(e){const t=y3(e),n={};return e.swing!==void 0&&(n.swing=e.swing),{...t,abcNotation:e.abcNotation?w3(e.abcNotation,e):void 0,synthOptions:n}}function k3(e){const t=e.numberOfChannels,n=e.sampleRate,a=e.length,r=2,s=a*t*r,o=44,l=new ArrayBuffer(o+s),h=new DataView(l);sr(h,0,"RIFF"),h.setUint32(4,36+s,!0),sr(h,8,"WAVE"),sr(h,12,"fmt "),h.setUint32(16,16,!0),h.setUint16(20,1,!0),h.setUint16(22,t,!0),h.setUint32(24,n,!0),h.setUint32(28,n*t*r,!0),h.setUint16(32,t*r,!0),h.setUint16(34,16,!0),sr(h,36,"data"),h.setUint32(40,s,!0);const g=Array.from({length:t},(u,i)=>e.getChannelData(i));let p=44;for(let u=0;u<a;u++)for(let i=0;i<t;i++){const v=Math.max(-1,Math.min(1,g[i][u]));h.setInt16(p,v<0?v*32768:v*32767,!0),p+=2}const d=new Uint8Array(l);let f="";const c=8192;for(let u=0;u<d.length;u+=c)f+=String.fromCharCode(...d.subarray(u,u+c));return btoa(f)}function sr(e,t,n){for(let a=0;a<n.length;a++)e.setUint8(t+a,n.charCodeAt(a))}const C3="0.4.3",he={visualObj:null,synthControl:null,currentInstrument:du,currentStyle:"",currentAbc:null,highlightedEls:[]},or=document.querySelector(".main"),zc=document.getElementById("status"),St=document.getElementById("sheet-music"),ya=document.getElementById("audio-controls"),gu=document.getElementById("instrument-selector"),vu=document.getElementById("style-selector"),Tr=document.getElementById("toolbar");"audioSession"in navigator&&(navigator.audioSession.type="playback");const x3={onEvent(e){if(he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[],!!e.elements){for(const t of e.elements)for(const n of t)n.classList.add("note-playing"),he.highlightedEls.push(n);he.highlightedEls.length>0&&he.highlightedEls[0].scrollIntoView({behavior:"smooth",block:"nearest"})}},onFinished(){he.highlightedEls.forEach(e=>e.classList.remove("note-playing")),he.highlightedEls=[]}},Tt=document.createElement("select");Tt.id="instrument-select";Tt.className="control-select";for(const e of Object.keys(jt)){const t=document.createElement("option");t.value=e,t.textContent=e,e===he.currentInstrument&&(t.selected=!0),Tt.appendChild(t)}Tt.addEventListener("change",()=>{he.currentInstrument=Tt.value,he.visualObj&&he.synthControl&&S3()});async function S3(){var e;if(!(!he.synthControl||!((e=he.visualObj)!=null&&e[0])))try{const n={program:jt[he.currentInstrument]??0};await he.synthControl.setTune(he.visualObj[0],!1,n)}catch(t){console.error("Failed to apply settings:",t)}}const Er=document.createElement("label");Er.className="control-label";Er.htmlFor="instrument-select";Er.textContent="Instrument";gu.appendChild(Er);gu.appendChild(Tt);const ht=document.createElement("select");ht.id="style-select";ht.className="control-select";const bi=document.createElement("option");bi.value="";bi.textContent="No style (melody only)";ht.appendChild(bi);for(const e of Object.keys(vi)){const t=document.createElement("option");t.value=e,t.textContent=e.charAt(0).toUpperCase()+e.slice(1),ht.appendChild(t)}ht.addEventListener("change",()=>{he.currentStyle=ht.value,he.currentAbc&&mu(he.currentAbc)});const Ar=document.createElement("label");Ar.className="control-label";Ar.htmlFor="style-select";Ar.textContent="Style";vu.appendChild(Ar);vu.appendChild(ht);let lr=null;const Ht=document.createElement("button");Ht.className="toolbar-btn";Ht.textContent="⛶";Ht.title="Toggle fullscreen";Ht.setAttribute("aria-label","Toggle fullscreen");Ht.addEventListener("click",()=>{lr==null||lr.requestDisplayMode({mode:"fullscreen"})});Tr.appendChild(Ht);const Ve=document.createElement("button");Ve.className="toolbar-btn";Ve.textContent="↓";Ve.title="Download audio (WAV)";Ve.setAttribute("aria-label","Download audio as WAV");Ve.disabled=!0;Tr.appendChild(Ve);let Sa=!1,Ta=!1;function T3(e){if(!e)return"music";const t=e.match(/T:\s*(.+)/);return t?t[1].trim().replace(/[^a-zA-Z0-9_-]/g,"_"):"music"}Ve.addEventListener("click",async()=>{var n;if(!he.synthControl)return;const e=he.synthControl.midiBuffer,t=(n=e==null?void 0:e.getAudioBuffer)==null?void 0:n.call(e);if(!t){st("Play first to generate audio",!0);return}Ve.disabled=!0,Ve.textContent="...";try{const a=k3(t),r=T3(he.currentAbc);await et.downloadFile({contents:[{type:"resource",resource:{uri:`file:///${r}.wav`,mimeType:"audio/wav",blob:a}}]})}catch(a){st(`Download failed: ${a.message}`,!0)}finally{Ve.disabled=!1,Ve.textContent="↓"}});const je=document.createElement("button");je.className="toolbar-btn";je.textContent="↗";je.title="Send this ABC to chat";je.setAttribute("aria-label","Send this ABC notation to the chat");je.disabled=!0;je.hidden=!0;Tr.appendChild(je);je.addEventListener("click",async()=>{if(he.currentAbc){je.disabled=!0,je.textContent="...";try{await et.sendMessage({role:"user",content:[{type:"text",text:"Here's my ABC notation:\n```\n"+he.currentAbc+"\n```"}]})}catch(e){st(`Send failed: ${e.message}`,!0)}finally{je.disabled=!1,je.textContent="↗"}}});function st(e,t=!1){zc.textContent=e,zc.classList.toggle("error",t)}function E3(e){if(st(e),!he.visualObj){const t=document.createElement("div");t.className="loading-skeleton",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");const n=document.createElement("span");n.className="spinner",n.setAttribute("aria-hidden","true");const a=document.createElement("span");a.textContent=e,t.append(n,a),St.replaceChildren(t)}}async function mu(e,t){var n;try{st("Rendering..."),he.synthControl&&he.synthControl.pause(),he.currentAbc=e,St.innerHTML="",ya.innerHTML="";const a=pu(e,he.currentStyle);if(he.visualObj=cr.renderAbc(St,a,{responsive:"resize",add_classes:!0}),!he.visualObj||he.visualObj.length===0)throw new Error("Failed to parse music notation");if(!cr.synth.supportsAudio())throw new Error("Audio not supported in this browser");he.synthControl=new cr.synth.SynthController,he.synthControl.load(ya,x3,{displayLoop:!0,displayPlay:!0,displayProgress:!0,displayWarp:!0});const s={program:jt[he.currentInstrument]??0,...t};await he.synthControl.setTune(he.visualObj[0],!1,s),Tr.classList.add("visible"),Ve.disabled=!Sa,je.disabled=!Ta,(n=he.synthControl.play())==null||n.then(()=>st("Playing...")).catch(o=>{console.debug("Autoplay blocked:",o),st("Click ▶ to play")})}catch(a){console.error("Render error:",a),st(`Error: ${a.message}`,!0),ya.innerHTML=""}}const et=new Ag({name:"Music Studio",version:C3});lr=et;et.ontoolinput=e=>{console.info("Received tool input:",e);const t=_3(e.arguments??{});he.currentInstrument=t.instrument,Tt.value=t.instrument,he.currentStyle=t.style,ht.value=t.style,t.abcNotation?mu(t.abcNotation,t.synthOptions).catch(console.error):st("No ABC notation provided",!0)};let zt=null,Ea="";et.ontoolinputpartial=e=>{var a,r;const t=(a=e.arguments)==null?void 0:a.abcNotation;if(!t)return;he.currentAbc=t;const n=(r=e.arguments)==null?void 0:r.style;if(n&&mi(n)&&he.currentStyle!==n&&(he.currentStyle=n,ht.value=n),!t.match(/K:[^\n]+/)){E3("Composing…");return}t!==Ea&&(Ea=t,zt&&clearTimeout(zt),zt=setTimeout(()=>{try{const s=pu(t,he.currentStyle);cr.renderAbc(St,s,{responsive:"resize",add_classes:!0}),St.scrollTop=St.scrollHeight;const o=St.closest(".sheet-section");o&&(o.scrollTop=o.scrollHeight),st("Composing...")}catch{}},150))};et.onerror=console.error;function bu(){var e;try{(e=he.synthControl)==null||e.pause()}catch{}he.highlightedEls.forEach(t=>t.classList.remove("note-playing")),he.highlightedEls=[]}function yu(){zt&&(clearTimeout(zt),zt=null),Ea=""}et.ontoolcancelled=e=>{bu(),yu();const t=e!=null&&e.reason?` (${e.reason})`:"";st(`Composition cancelled${t}.`)};et.onteardown=()=>(bu(),yu(),{});function wu(e){var t;e.theme&&Tg(e.theme),(t=e.styles)!=null&&t.variables&&Eg(e.styles.variables),e.safeAreaInsets&&(or.style.paddingTop=`${e.safeAreaInsets.top}px`,or.style.paddingRight=`${e.safeAreaInsets.right}px`,or.style.paddingBottom=`${e.safeAreaInsets.bottom}px`,or.style.paddingLeft=`${e.safeAreaInsets.left}px`)}et.onhostcontextchanged=wu;et.connect().then(()=>{var t,n;Sa=!!((t=et.getHostCapabilities())!=null&&t.downloadFile),Sa||(Ve.hidden=!0,Ve.disabled=!0,Ve.title="Audio download isn't supported by this host"),Ta=!!((n=et.getHostCapabilities())!=null&&n.message),Ta?je.hidden=!1:(je.disabled=!0,je.title="Sending to chat isn't supported by this host");const e=et.getHostContext();e&&wu(e)});</script>
232
232
  <style rel="stylesheet" crossorigin>.abcjs-inline-audio{height:26px;padding:0 5px;border-radius:3px;background-color:#424242;display:flex;align-items:center;box-sizing:border-box}.abcjs-inline-audio.abcjs-disabled{opacity:.5}.abcjs-inline-audio .abcjs-btn{display:block;width:28px;height:34px;margin-right:2px;padding:7px 4px;background:none!important;border:1px solid transparent;box-sizing:border-box;line-height:1}.abcjs-btn g{fill:#f4f4f4;stroke:#f4f4f4}.abcjs-inline-audio .abcjs-btn:hover g{fill:#ccc;stroke:#ccc}.abcjs-inline-audio .abcjs-midi-selection.abcjs-pushed,.abcjs-inline-audio .abcjs-midi-loop.abcjs-pushed,.abcjs-inline-audio .abcjs-midi-reset.abcjs-pushed{border:1px solid #cccccc;background-color:#666;box-sizing:border-box}.abcjs-inline-audio .abcjs-midi-start .abcjs-pause-svg,.abcjs-inline-audio .abcjs-midi-start .abcjs-loading-svg,.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed .abcjs-play-svg,.abcjs-inline-audio .abcjs-midi-start.abcjs-loading .abcjs-play-svg{display:none}.abcjs-inline-audio .abcjs-midi-start.abcjs-pushed .abcjs-pause-svg{display:block}.abcjs-inline-audio .abcjs-midi-progress-background{background-color:#424242;height:10px;border-radius:5px;border:2px solid #cccccc;margin:0 8px 0 15px;position:relative;flex:1;padding:0;box-sizing:border-box}.abcjs-inline-audio .abcjs-midi-progress-indicator{width:20px;margin-left:-10px;height:14px;background-color:#f4f4f4;position:absolute;display:inline-block;border-radius:6px;top:-4px;left:0;box-sizing:border-box}.abcjs-inline-audio .abcjs-midi-clock{margin-left:4px;margin-top:1px;margin-right:2px;display:inline-block;font-family:sans-serif;font-size:16px;box-sizing:border-box;color:#f4f4f4}.abcjs-inline-audio .abcjs-tempo-wrapper{font-size:10px;color:#f4f4f4;box-sizing:border-box;display:flex;align-items:center}.abcjs-inline-audio .abcjs-midi-tempo{border-radius:2px;border:none;margin:0 2px 0 4px;width:42px;padding-left:2px;box-sizing:border-box}.abcjs-inline-audio .abcjs-loading .abcjs-loading-svg{display:inherit}.abcjs-inline-audio .abcjs-loading{outline:none;animation-name:abcjs-spin;animation-duration:1s;animation-iteration-count:infinite;animation-timing-function:linear}.abcjs-inline-audio .abcjs-loading-svg circle{stroke:#f4f4f4}@keyframes abcjs-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.abcjs-large .abcjs-inline-audio{height:52px}.abcjs-large .abcjs-btn{width:56px;height:52px;font-size:28px;padding:6px 8px}.abcjs-large .abcjs-midi-progress-background{height:20px;border:4px solid #cccccc}.abcjs-large .abcjs-midi-progress-indicator{height:28px;top:-8px;width:40px}.abcjs-large .abcjs-midi-clock{font-size:32px;margin-right:10px;margin-left:10px;margin-top:-1px}.abcjs-large .abcjs-midi-tempo{font-size:20px;width:50px}.abcjs-large .abcjs-tempo-wrapper{font-size:20px}.abcjs-css-warning{display:none}*{box-sizing:border-box}html,body{font-family:system-ui,-apple-system,sans-serif;font-size:1rem}code{font-size:1em}:root{--color-bg: #ffffff;--color-text: #1f2937;--color-text-muted: #6b7280;--color-primary: #2563eb;--color-success: #10b981;--color-danger: #ef4444;--color-card-bg: #f9fafb;--color-border: #e5e7eb}@media(prefers-color-scheme:dark){:root{--color-bg: #111827;--color-text: #f9fafb;--color-text-muted: #9ca3af;--color-primary: #3b82f6;--color-success: #34d399;--color-danger: #f87171;--color-card-bg: #1f2937;--color-border: #374151}}:root[data-theme=dark]{--color-bg: #111827;--color-text: #f9fafb;--color-text-muted: #9ca3af;--color-primary: #3b82f6;--color-success: #34d399;--color-danger: #f87171;--color-card-bg: #1f2937;--color-border: #374151}:root[data-theme=light]{--color-bg: #ffffff;--color-text: #1f2937;--color-text-muted: #6b7280;--color-primary: #2563eb;--color-success: #10b981;--color-danger: #ef4444;--color-card-bg: #f9fafb;--color-border: #e5e7eb}html,body{margin:0;padding:0;background:var(--color-bg);color:var(--color-text)}.main{width:100%;margin:0 auto;padding:8px;display:flex;flex-direction:column;gap:8px}.header{display:flex;flex-direction:column;gap:6px}#audio-controls:empty{display:none}#audio-controls:not(:empty)~#status{display:none}.audio-controls{width:100%}.audio-controls .abcjs-inline-audio{border-radius:8px}.audio-controls .abcjs-inline-audio .abcjs-midi-loop.abcjs-pushed{background-color:var(--color-success)!important;border-color:var(--color-success)!important}.status{font-size:.875rem;color:var(--color-text-muted)}.status.error{color:var(--color-danger)}.toolbar{display:none;flex-wrap:wrap;gap:8px}.toolbar.visible{display:flex}.toolbar-group{display:flex;align-items:center;gap:6px;flex:1;min-width:140px}.control-label{font-size:.75rem;color:var(--color-text-muted);white-space:nowrap;text-transform:uppercase;letter-spacing:.05em}.control-select{flex:1;padding:5px 8px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-card-bg);color:var(--color-text);font-size:.8125rem;cursor:pointer;min-width:0}.control-select:focus{outline:2px solid var(--color-primary);outline-offset:-1px}.toolbar-btn{padding:5px 10px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-card-bg);color:var(--color-text);font-size:1rem;cursor:pointer;line-height:1}.toolbar-btn:hover{background:var(--color-border)}.toolbar-btn:disabled{opacity:.4;cursor:default}.toolbar-btn:disabled:hover{background:var(--color-card-bg)}.loading-skeleton{display:flex;align-items:center;justify-content:center;gap:10px;min-height:160px;color:var(--color-text-muted);font-size:.875rem}.spinner{width:18px;height:18px;border:2px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:spinner-rotate .7s linear infinite}@keyframes spinner-rotate{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2s}}.note-playing path,.note-playing circle,.note-playing ellipse,.note-playing polygon{fill:var(--color-primary)!important;stroke:var(--color-primary)!important;stroke-width:1.5px;transition:fill .08s ease}.note-playing path[stroke]{stroke:var(--color-primary)!important}.sheet-section{background:var(--color-card-bg);border-radius:8px;padding:16px;border:1px solid var(--color-border);min-height:200px;max-height:80vh;overflow-y:auto;scroll-behavior:smooth}.sheet-section .sheet-music-container{width:100%;overflow-x:auto}</style>
233
233
  </head>
234
234
  <body>