jpfun 0.5.0 → 0.6.0
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/dist/functions/ASTtypes.d.ts +4 -0
- package/dist/functions/ASTtypes.js +25 -14
- package/dist/functions/adjust/index.js +6 -2
- package/dist/functions/arpeggio/index.js +19 -12
- package/dist/functions/beam/auto.js +2 -11
- package/dist/functions/box/index.js +52 -1
- package/dist/functions/default.js +2 -1
- package/dist/functions/div/index.js +2 -3
- package/dist/functions/grace/index.d.ts +4 -2
- package/dist/functions/grace/index.js +16 -5
- package/dist/functions/head/index.js +11 -4
- package/dist/functions/meter/index.js +26 -6
- package/dist/functions/meter/shape.d.ts +3 -0
- package/dist/functions/meter/shape.js +43 -0
- package/dist/functions/note/index.js +25 -45
- package/dist/functions/rest/index.d.ts +2 -0
- package/dist/functions/rest/index.js +233 -0
- package/dist/functions/symbol/ornament.js +1 -1
- package/dist/functions/temporal.d.ts +21 -7
- package/dist/functions/temporal.js +14 -4
- package/dist/functions/tie/index.js +14 -10
- package/dist/functions/tuplet/index.js +1 -1
- package/dist/functions/up/index.js +47 -27
- package/dist/functions/voice/connections.d.ts +19 -0
- package/dist/functions/voice/connections.js +88 -0
- package/dist/functions/voice/index.js +244 -99
- package/dist/jpfun.core.min.js +56 -39
- package/dist/jpfun.min.js +65 -48
- package/dist/layout/engine.d.ts +3 -1
- package/dist/layout/engine.js +190 -64
- package/dist/layout/model.js +22 -66
- package/dist/layout/page.js +1 -1
- package/dist/layout/types.d.ts +30 -45
- package/dist/lowering/loweringContext.d.ts +1 -1
- package/dist/lowering/loweringContext.js +34 -4
- package/dist/parser/parserContext.js +4 -8
- package/dist/parser/preprocess.js +4 -6
- package/dist/playback/compile.js +1 -1
- package/dist/render/paint.js +1 -1
- package/grammar.md +200 -257
- package/package.json +1 -1
package/dist/jpfun.core.min.js
CHANGED
|
@@ -1,86 +1,84 @@
|
|
|
1
1
|
/*! jpfun | Apache-2.0 | github.com/madderscientist/jpFun */
|
|
2
|
-
"use strict";(()=>{var Li=Object.defineProperty;var Ti=(i,t)=>{for(var e in t)Li(i,e,{get:t[e],enumerable:!0})};var No={};Ti(No,{ANCHOR_KEY:()=>U,ASTBraceNode:()=>K,ASTFunctionNode:()=>v,ASTLabelNode:()=>lt,ASTNodeBase:()=>et,ASTTextNode:()=>Z,CanvasPainter:()=>Je,CanvasTextMeasurer:()=>Mn,DEFAULT_BPM:()=>yt,DEFAULT_FONT_SIZE:()=>Ss,DEFAULT_KEY:()=>ht,DEFAULT_OCTAVE:()=>pr,DEFAULT_PAGE_CONFIG:()=>ot,DEFAULT_PROGRAM:()=>be,DEFAULT_TEXT_FONT:()=>jt,DEFAULT_TONALITY:()=>oe,DEFAULT_VELOCITY:()=>Bt,DefaultTextMeasurer:()=>ve,Diagnostic:()=>N,ErrorDiagnostic:()=>S,Fraction:()=>I,JIANPU_NUMBER_FONT:()=>Rn,LoweringContext:()=>xe,PageLayoutError:()=>Wt,ParserContext:()=>ct,RecordingPainter:()=>vo,SvgPainter:()=>Qe,TemporalNodeBase:()=>W,Track:()=>_t,WarningDiagnostic:()=>O,analyzeScoreSyntax:()=>sc,canvasFont:()=>Ne,compilePlayback:()=>ac,compileScore:()=>oc,completeSpringConfig:()=>Se,createLayoutPrepareContext:()=>So,defaultFunctions:()=>Ze,defaultTextMeasurer:()=>On,functionAddonKey:()=>Lt,isLayoutAttachment:()=>Tt,isPlaybackRelation:()=>To,isVisualTemporalNode:()=>F,layoutDocument:()=>fn,layoutElement:()=>Ce,layoutHorizontal:()=>rn,layoutHorizontalRegion:()=>Ht,layoutLocalSequence:()=>Gt,layoutPageBounds:()=>Ft,normalizePageConfig:()=>se,paginateLayoutLines:()=>cn,paintLayout:()=>_o,paintLayoutPages:()=>Qt,performanceTimeToScoreTime:()=>bi,performanceTimeToSeconds:()=>qe,prepareHorizontalLine:()=>un,prepareLayoutHost:()=>re,preprocessSource:()=>Xt,primaryName:()=>ne,renderLayoutPagesToCanvas:()=>uc,renderLayoutPagesToSvg:()=>pc,resolveArgType:()=>$t,scoreTimeToPerformanceTime:()=>wi,scoreTimeToSeconds:()=>rc,secondsToPerformanceTime:()=>gi,secondsToScoreTime:()=>ic,skipSpaces:()=>ut,skipSpacesBack:()=>pe,transformNotes:()=>Bs,unionLayoutBoxes:()=>Ae});var N=class i{code;message;span;constructor(t,e,n){this.code=t,this.message=e,this.span=n}toLineCol(t){let e=i.offsetToLineCol(this.span.start,t),n=i.offsetToLineCol(this.span.end,t);return{startLine:e.line,startColumn:e.column,endLine:n.line,endColumn:n.column}}static offsetToLineCol(t,e){let n=e.length;if(n===0)return{line:1,column:Math.max(0,t)+1};let o=t;o<0&&(o=0);let s=0,r=n-1;for(;s<=r;){let l=s+r>>1;e[l]<=o?s=l+1:r=l-1}let c=Math.max(0,r),a=e[c]??0;return{line:c+1,column:o-a+1}}static error;static warning},S=class extends N{},O=class extends N{};N.error={Bug:(i,t)=>new S("E_BUG",`\u89E3\u6790\u5668\u9519\u8BEF: ${i}\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u4FEE\u590D\u8FD9\u4E2A\u95EE\u9898`,t),MissingArg:(i,t,e)=>{let n=typeof t=="number"?`[${t}]`:`"${t}"`;return new S("E_MISSING_REQUIRED_ARG",`\u51FD\u6570@${i} \u7F3A\u5C11\u5FC5\u9700\u7684\u53C2\u6570 ${n}`,e)},InvalidArgType:(i,t,e,n,o)=>{let s=typeof t=="number"?`[${t}]`:`"${t}"`;return new S("E_WRONG_ARG_TYPE",`\u51FD\u6570 @${i} \u7684\u53C2\u6570 ${s} \u7C7B\u578B\u9519\u8BEF: \u5F97\u5230\u4E86 ${n}\uFF0C\u4F46\u671F\u671B ${e}`,o)},PosAfterNamedArg:(i,t)=>new S("E_POSARG_AFTER_KWARG",`\u51FD\u6570 @${i} \u7684\u4F4D\u7F6E\u53C2\u6570\u51FA\u73B0\u5728\u547D\u540D\u53C2\u6570\u4E4B\u540E\uFF0C\u8FD9\u662F\u4E0D\u5141\u8BB8\u7684`,t),EmptyContent:(i,t,e)=>{let n=typeof t=="number"?`[${t}]`:`"${t}"`;return new S("E_EMPTY_CONTENT",`\u51FD\u6570 @${i} \u7684\u53C2\u6570 ${n} \u5185\u5BB9\u4E3A\u7A7A(\u6216\u65E0\u53EF\u7528\u5185\u5BB9)\uFF1B\u8BF7\u63D0\u4F9B\u6709\u6548\u5185\u5BB9`,e)},UnterminatedCall:(i,t)=>new S("E_UNTERMINATED_CALL",`\u51FD\u6570\u8C03\u7528\u672A\u95ED\u5408: @${i}(...)`,t),UnterminatedString:i=>new S("E_UNTERMINATED_String","\u5F15\u53F7\u672A\u95ED\u5408",i),UnknownFunction:(i,t)=>new S("E_UNKNOWN_FUNCTION",`\u672A\u77E5\u51FD\u6570: @${i}\uFF0C\u8BF7\u68C0\u67E5\u62FC\u5199`,t),UnknownLabel:(i,t)=>new S("E_UNKNOWN_LABEL",`\u672A\u77E5\u6807\u7B7E: "${i}"`,t),InvalidTonality:(i,t)=>new S("E_INVALID_TONALITY",`\u65E0\u6548\u7684\u8C03\u6027: "${i}"\uFF0C\u8BF7\u63D0\u4F9B\u6709\u6548\u7684\u8C03\u6027\u540D\u79F0\uFF0C\u5FC5\u987B [\u4E00\u4E2A\u5927\u5199\u5B57\u6BCD][\u53D8\u97F3\u8BB0\u53F7#bn\u53EA\u80FD\u4E00\u4E2A][\u7EDD\u5BF9\u516B\u5EA6\u6570\u5B57]\uFF0C\u540E\u4E8C\u8005\u53EF\u9009`,t),BreakInsideEvent:i=>new S("E_BREAK_INSIDE_EVENT","\u6362\u884C\u5207\u65AD\u4E86\u4E00\u4E2A\u4ECD\u5728\u6301\u7EED\u7684\u4E8B\u4EF6\uFF1B\u8BF7\u628A\u957F\u97F3\u5199\u6210\u591A\u4E2A\u4E8B\u4EF6\uFF0C\u6216\u8C03\u6574 @br \u7684\u4F4D\u7F6E",i),InvalidPageConfig:(i,t)=>new S("E_INVALID_PAGE_CONFIG",i,t),PageOverflow:(i,t,e)=>new S("E_PAGE_OVERFLOW",`\u8C31\u9762\u884C\u9700\u8981 ${i}px \u9AD8\u5EA6\uFF0C\u4F46\u9875\u9762\u5185\u5BB9\u533A\u53EA\u6709 ${t}px`,e)};N.warning={UnknownFunction:(i,t)=>new O("W_UNKNOWN_FUNCTION",`\u672A\u77E5\u51FD\u6570: @${i}\uFF0C\u5C06\u88AB\u5F53\u4F5C\u666E\u901A\u6587\u672C\u5904\u7406`,t),UnknownNamedArg:(i,t,e)=>new O("W_UNKNOWN_NAMED_ARG",`\u51FD\u6570 @${i} \u6536\u5230\u672A\u77E5\u7684\u547D\u540D\u53C2\u6570 "${t}"`,e),TooManyPosArgs:(i,t,e,n)=>new O("W_TOO_MANY_POS_ARGS",`\u51FD\u6570 @${i} \u63A5\u6536\u4E86\u8FC7\u591A\u7684\u4F4D\u7F6E\u53C2\u6570\uFF0C\u671F\u671B ${t} \u4E2A\u4F46\u5F97\u5230\u4E86 ${e} \u4E2A`,n),InvalidNumber:(i,t)=>new O("W_INVALID_NUMBER",`\u65E0\u6548\u7684\u6570\u5B57: "${i}"\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidBoolean:(i,t)=>new O("W_INVALID_BOOL",`\u65E0\u6548\u7684\u5E03\u5C14\u503C: "${i}": \u5E94\u4E3A 'true' \u6216 'false'\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidLength:(i,t)=>new O("W_INVALID_LENGTH",`\u65E0\u6548\u7684\u957F\u5EA6\u503C: "${i}"\uFF1B\u8BF7\u63D0\u4F9B\u6709\u6548\u7684\u957F\u5EA6\u503C\uFF0C\u4F8B\u5982 "10px" \u6216 "2em"\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidLengthUnit:(i,t)=>new O("W_INVALID_LENGTH_UNIT",`\u65E0\u6548\u7684\u957F\u5EA6\u5355\u4F4D: "${i}"\uFF1B\u4EC5\u652F\u6301 "px" \u548C "em"\uFF1B\u8BF7\u68C0\u67E5\u51FD\u6570\u53C2\u6570\u6216\u53D8\u91CF\u5B9A\u4E49\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidContent:i=>new O("W_INVALID_CONTENT","\u5185\u5BB9\u89E3\u6790\u5931\u8D25\uFF0C\u9519\u8BEF\u539F\u56E0\u89C1\u4E0A\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u4F46\u5F80\u5F80\u4E0D\u5B58\u5728\uFF0C\u6781\u6709\u53EF\u80FD\u5BFC\u81F4\u9519\u8BEF)",i),EmptyContent:(i,t,e)=>new O("W_EMPTY_CONTENT",`\u51FD\u6570 @${i} \u7684\u53C2\u6570 "${t}" \u5185\u5BB9\u4E3A\u7A7A(\u6216\u65E0\u53EF\u7528\u5185\u5BB9)`,e),UnmatchedBrace:i=>new O("W_UNMATCHED_BRACE","\u672A\u5339\u914D\u7684\u5927\u62EC\u53F7: \u7F3A\u5C11\u53F3\u5927\u62EC\u53F7'}'\uFF1B\u5C06\u5C1D\u8BD5\u81EA\u52A8\u4FEE\u590D",i),LabelWithoutTarget:(i,t)=>new O("W_LABEL_WITHOUT_TARGET",`\u6807\u7B7E "${i}" \u6CA1\u6709\u53EF\u7ED1\u5B9A\u7684\u76EE\u6807\uFF1B\u6807\u7B7E\u5C06\u88AB\u5FFD\u7565`,t),TargetAlreadyLabeled:(i,t,e)=>new O("W_TARGET_ALREADY_LABELED",`\u76EE\u6807\u5DF2\u6807\u6CE8\u4E3A "${t}"\uFF0C"${i}" \u5C06\u88AB\u5FFD\u7565`,e),UnresolvedEndpoint:(i,t)=>new O("W_UNRESOLVED_ENDPOINT",`@${i} \u6709\u7AEF\u70B9\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u8C31\u9762\u5BF9\u8C61\uFF1B\u8BE5\u5173\u7CFB\u5C06\u88AB\u5FFD\u7565`,t),ZeroTimeTrack:(i,t)=>new O("W_ZERO_TIME_TRACK",`\u7B2C${t}\u4E2A\u5B50\u8F68\u9053\u7684\u65F6\u957F\u4E3A0`,i)};function Lt(i){return`@${i}`}var et=class{sourceSpan;parent;get children(){return null}constructor(t,e=null){this.sourceSpan=t,this.parent=e}loweringEnter(t,e){return[]}timeFlowModel(t){return null}loweringExit(t,e,n){return[]}toString(t){return t.slice(this.sourceSpan.start,this.sourceSpan.end)}},Z=class extends et{},lt=class extends et{label;target;constructor(t,e,n,o=null){super(t,o),this.label=e,this.target=n}toString(t){return`@${this.label} `}},K=class i extends et{content;get children(){return this.content}constructor(t,e,n=null){super(t,n),this.content=e,this.content.forEach(o=>o.parent=this)}innerSpan(){return i.getContentSpan(this.content)}static getContentSpan(t){if(Array.isArray(t)){if(t.length===0)return{start:0,end:0};let e=i.getContentSpan(t[0]),n=i.getContentSpan(t[t.length-1]);return{start:e.start,end:n.end}}else return{start:t.sourceSpan.start,end:t.sourceSpan.end}}timeFlowModel(){return{children:this.content,mode:"sequence"}}toString(t){return`{${this.content.map(e=>e.toString(t)).join("")}}`}};function $t(i,t,e){return t?i.args.find(n=>n.name?.toLowerCase()===t)?.type:i.args[e]?.type??(i.allowExtraArgs?i.extraArgType:void 0)}function ne(i){return Array.isArray(i.name)?i.name[0]:i.name}var v=class i extends et{label;static def;get def(){return this.constructor.def}get callName(){return this.def?ne(this.def):""}static deSugarAtom=()=>null;get deSugarAtom(){return this.constructor.deSugarAtom}static deSugarRelation=()=>null;get deSugarRelation(){return this.constructor.deSugarRelation}getArgValue(t,e){let n=this.def;if(!n)return[];let o=n.args,s=ne(n);return o.map((r,c)=>{let a=r.name?r.name.toLowerCase():null,l=(a?t.get(a):null)??t.get(c)??(a?e.variables[`${s}.${a}`.toLowerCase()]:null)??r.default;if(l===null)throw N.error.MissingArg(s,r.name||c,this.sourceSpan);return l})}toString(t){let e=this.callName;return e?`@${e} `:super.toString(t)}static loweringAugment;static loweringFinalize;static layoutDecorationHandler;static findLabelable(t){let e=t;if(e.labelable)return e.labelable();for(let n of t.children??[]){let o=i.findLabelable(n);if(o)return o}return null}static findLastFuncContentIndex(t,e){for(;e>=0;e--)if(t[e]instanceof i||t[e]instanceof K)return e;return-1}};function Ei(i,t){for(;t!==0;){let e=i%t;i=t,t=e}return i}var I=class i{_numerator=0;_denominator=1;constructor(t=0,e=1){this.set(t,e)}get numerator(){return this._numerator}get denominator(){return this._denominator}set(t,e=1){if(!Number.isFinite(t)||!Number.isFinite(e))throw new RangeError("Fraction numerator and denominator must be finite");if(e===0)throw new RangeError("Denominator must not be zero");e<0&&(t=-t,e=-e);let n=Ei(Math.abs(t),e);return this._numerator=t/n,this._denominator=e/n,this}copyFrom(t){return this._numerator=t._numerator,this._denominator=t._denominator,this}clone(){return new i(this._numerator,this._denominator)}add(t,e=1){let n;return typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),this.set(this._numerator*e+n*this._denominator,this._denominator*e)}sub(t,e=1){let n;return typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),this.set(this._numerator*e-n*this._denominator,this._denominator*e)}mul(t,e=1){let n;return typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),this.set(this._numerator*n,this._denominator*e)}div(t,e=1){let n;if(typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),n===0)throw new RangeError("Cannot divide by zero");return this.set(this._numerator*e,this._denominator*n)}divPow2(t=1){if(this._numerator===0)return this;for(;t>0&&this._numerator%2===0;)this._numerator/=2,t--;let e=this._denominator*2**t;if(!Number.isFinite(e))throw new RangeError("Fraction denominator overflow");return this._denominator=e,this}compare(t,e=1){let n;typeof t=="number"?n=t:(n=t._numerator,e=t._denominator);let o=this._numerator*e-n*this._denominator;return o<0?-1:o>0?1:0}equals(t,e=1){return t instanceof i?this._numerator===t._numerator&&this._denominator===t._denominator:this._numerator*e===t*this._denominator}isZero(){return this._numerator===0}toNumber(){return this._numerator/this._denominator}toString(){return this._denominator===1?String(this._numerator):`${this._numerator}/${this._denominator}`}};var yt=120,Bt=80,oe="C4",be=0,U=-1/0,ht=1/0,W=class{t=new I;T=new I;track;ast;order;addon;mergeKey;foldedInto;breakBefore=0;layoutLine=0;box;springConfig;ports;decorations;initLayoutBox(){return this.box={x:0,y:0,w:0,h:0,anchor:0,visualAxis:0}}playbackState;prepareLayout(t){}paint(t){}};function F(i){return i.box!==void 0}function Tt(i){return typeof i.createGeometry=="function"}var zt=class{target;dx;dy;constructor(t,e,n){this.target=t,this.dx=e,this.dy=n}drawText(t,e,n,o){this.target.drawText(t,e+this.dx,n+this.dy,o)}drawLine(t,e,n,o,s){this.target.drawLine(t+this.dx,e+this.dy,n+this.dx,o+this.dy,s)}drawRect(t,e,n,o,s){this.target.drawRect(t+this.dx,e+this.dy,n,o,s)}drawCircle(t,e,n,o){this.target.drawCircle(t+this.dx,e+this.dy,n,o)}drawPath(t,e,n){if(n){let o={...n,x:n.x+this.dx,y:n.y+this.dy};this.target.drawPath(t,e,o);return}this.target.drawPath(t.map(o=>this.translateCommand(o)),e)}translateCommand(t){switch(t.op){case"Z":return t;case"Q":return{op:"Q",cx:t.cx+this.dx,cy:t.cy+this.dy,x:t.x+this.dx,y:t.y+this.dy};case"C":return{op:"C",cx1:t.cx1+this.dx,cy1:t.cy1+this.dy,cx2:t.cx2+this.dx,cy2:t.cy2+this.dy,x:t.x+this.dx,y:t.y+this.dy};default:return{op:t.op,x:t.x+this.dx,y:t.y+this.dy}}}};var on=class extends v{static def={name:["adjust","adj"],description:"\u5FAE\u8C03\u76EE\u6807\u7684\u7ED8\u5236\u4F4D\u7F6E\u4E0E\u6392\u7248\u5360\u4F4D",details:`~~~jpfun
|
|
2
|
+
"use strict";(()=>{var Yi=Object.defineProperty;var Ui=(r,t)=>{for(var e in t)Yi(r,e,{get:t[e],enumerable:!0})};var Yo={};Ui(Yo,{ANCHOR_KEY:()=>K,ASTBraceNode:()=>Y,ASTFunctionNode:()=>_,ASTLabelNode:()=>ft,ASTNodeBase:()=>q,ASTTextNode:()=>U,CanvasPainter:()=>ln,CanvasTextMeasurer:()=>Wn,DEFAULT_BPM:()=>St,DEFAULT_FONT_SIZE:()=>zs,DEFAULT_KEY:()=>ht,DEFAULT_OCTAVE:()=>Or,DEFAULT_PAGE_CONFIG:()=>st,DEFAULT_PROGRAM:()=>Le,DEFAULT_TEXT_FONT:()=>Zt,DEFAULT_TONALITY:()=>ce,DEFAULT_VELOCITY:()=>Wt,DefaultTextMeasurer:()=>Ie,Diagnostic:()=>k,ErrorDiagnostic:()=>C,Fraction:()=>O,JIANPU_NUMBER_FONT:()=>Gn,LoweringContext:()=>Ce,PageLayoutError:()=>Kt,ParserContext:()=>at,RecordingPainter:()=>Ko,SvgPainter:()=>an,TemporalNodeBase:()=>D,Track:()=>Rt,WarningDiagnostic:()=>P,analyzeScoreSyntax:()=>Ec,canvasFont:()=>Pe,compilePlayback:()=>kc,compileScore:()=>Tc,completeSpringConfig:()=>Ne,createLayoutPrepareContext:()=>Bo,defaultFunctions:()=>rn,defaultTextMeasurer:()=>Vn,functionAddonKey:()=>vt,getLayoutBounds:()=>Q,isLayoutAttachment:()=>ut,isPlaybackRelation:()=>Wo,isVisualTemporalNode:()=>F,layoutDocument:()=>An,layoutElement:()=>ke,layoutHorizontal:()=>xn,layoutHorizontalRegion:()=>Vt,layoutLocalSequence:()=>Yt,layoutPageBounds:()=>$t,normalizePageConfig:()=>ae,paginateLayoutLines:()=>mn,paintLayout:()=>Vo,paintLayoutPages:()=>ee,performanceTimeToScoreTime:()=>Hi,performanceTimeToSeconds:()=>cn,prepareHorizontalLine:()=>Tn,prepareLayoutHost:()=>pe,preprocessSource:()=>qt,primaryName:()=>re,renderLayoutPagesToCanvas:()=>Ic,renderLayoutPagesToSvg:()=>Rc,resolveArgDef:()=>jo,resolveArgType:()=>Ht,scoreTimeToPerformanceTime:()=>Wi,scoreTimeToSeconds:()=>_c,secondsToPerformanceTime:()=>zi,secondsToScoreTime:()=>Lc,skipSpaces:()=>mt,skipSpacesBack:()=>me,transformNotes:()=>si,unionLayoutBoxes:()=>ve});var k=class r{code;message;span;constructor(t,e,n){this.code=t,this.message=e,this.span=n}toLineCol(t){let e=r.offsetToLineCol(this.span.start,t),n=r.offsetToLineCol(this.span.end,t);return{startLine:e.line,startColumn:e.column,endLine:n.line,endColumn:n.column}}static offsetToLineCol(t,e){let n=e.length;if(n===0)return{line:1,column:Math.max(0,t)+1};let o=t;o<0&&(o=0);let s=0,i=n-1;for(;s<=i;){let l=s+i>>1;e[l]<=o?s=l+1:i=l-1}let c=Math.max(0,i),a=e[c]??0;return{line:c+1,column:o-a+1}}static error;static warning},C=class extends k{},P=class extends k{};k.error={Bug:(r,t)=>new C("E_BUG",`\u89E3\u6790\u5668\u9519\u8BEF: ${r}\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u4FEE\u590D\u8FD9\u4E2A\u95EE\u9898`,t),MissingArg:(r,t,e)=>{let n=typeof t=="number"?`[${t}]`:`"${t}"`;return new C("E_MISSING_REQUIRED_ARG",`\u51FD\u6570@${r} \u7F3A\u5C11\u5FC5\u9700\u7684\u53C2\u6570 ${n}`,e)},InvalidArgType:(r,t,e,n,o)=>{let s=typeof t=="number"?`[${t}]`:`"${t}"`;return new C("E_WRONG_ARG_TYPE",`\u51FD\u6570 @${r} \u7684\u53C2\u6570 ${s} \u7C7B\u578B\u9519\u8BEF: \u5F97\u5230\u4E86 ${n}\uFF0C\u4F46\u671F\u671B ${e}`,o)},PosAfterNamedArg:(r,t)=>new C("E_POSARG_AFTER_KWARG",`\u51FD\u6570 @${r} \u7684\u4F4D\u7F6E\u53C2\u6570\u51FA\u73B0\u5728\u547D\u540D\u53C2\u6570\u4E4B\u540E\uFF0C\u8FD9\u662F\u4E0D\u5141\u8BB8\u7684`,t),EmptyContent:(r,t,e)=>{let n=typeof t=="number"?`[${t}]`:`"${t}"`;return new C("E_EMPTY_CONTENT",`\u51FD\u6570 @${r} \u7684\u53C2\u6570 ${n} \u5185\u5BB9\u4E3A\u7A7A(\u6216\u65E0\u53EF\u7528\u5185\u5BB9)\uFF1B\u8BF7\u63D0\u4F9B\u6709\u6548\u5185\u5BB9`,e)},UnterminatedCall:(r,t)=>new C("E_UNTERMINATED_CALL",`\u51FD\u6570\u8C03\u7528\u672A\u95ED\u5408: @${r}(...)`,t),UnterminatedString:r=>new C("E_UNTERMINATED_String","\u5F15\u53F7\u672A\u95ED\u5408",r),UnknownFunction:(r,t)=>new C("E_UNKNOWN_FUNCTION",`\u672A\u77E5\u51FD\u6570: @${r}\uFF0C\u8BF7\u68C0\u67E5\u62FC\u5199`,t),UnknownLabel:(r,t)=>new C("E_UNKNOWN_LABEL",`\u672A\u77E5\u6807\u7B7E: "${r}"`,t),InvalidTonality:(r,t)=>new C("E_INVALID_TONALITY",`\u65E0\u6548\u7684\u8C03\u6027: "${r}"\uFF0C\u8BF7\u63D0\u4F9B\u6709\u6548\u7684\u8C03\u6027\u540D\u79F0\uFF0C\u5FC5\u987B [\u4E00\u4E2A\u5927\u5199\u5B57\u6BCD][\u53D8\u97F3\u8BB0\u53F7#bn\u53EA\u80FD\u4E00\u4E2A][\u7EDD\u5BF9\u516B\u5EA6\u6570\u5B57]\uFF0C\u540E\u4E8C\u8005\u53EF\u9009`,t),BreakInsideEvent:r=>new C("E_BREAK_INSIDE_EVENT","\u6362\u884C\u5207\u65AD\u4E86\u4E00\u4E2A\u4ECD\u5728\u6301\u7EED\u7684\u4E8B\u4EF6\uFF1B\u8BF7\u628A\u957F\u97F3\u5199\u6210\u591A\u4E2A\u4E8B\u4EF6\uFF0C\u6216\u8C03\u6574 @br \u7684\u4F4D\u7F6E",r),InvalidPageConfig:(r,t)=>new C("E_INVALID_PAGE_CONFIG",r,t),PageOverflow:(r,t,e)=>new C("E_PAGE_OVERFLOW",`\u8C31\u9762\u884C\u9700\u8981 ${r}px \u9AD8\u5EA6\uFF0C\u4F46\u9875\u9762\u5185\u5BB9\u533A\u53EA\u6709 ${t}px`,e)};k.warning={UnknownFunction:(r,t)=>new P("W_UNKNOWN_FUNCTION",`\u672A\u77E5\u51FD\u6570: @${r}\uFF0C\u5C06\u88AB\u5F53\u4F5C\u666E\u901A\u6587\u672C\u5904\u7406`,t),UnknownNamedArg:(r,t,e)=>new P("W_UNKNOWN_NAMED_ARG",`\u51FD\u6570 @${r} \u6536\u5230\u672A\u77E5\u7684\u547D\u540D\u53C2\u6570 "${t}"`,e),TooManyPosArgs:(r,t,e,n)=>new P("W_TOO_MANY_POS_ARGS",`\u51FD\u6570 @${r} \u63A5\u6536\u4E86\u8FC7\u591A\u7684\u4F4D\u7F6E\u53C2\u6570\uFF0C\u671F\u671B ${t} \u4E2A\u4F46\u5F97\u5230\u4E86 ${e} \u4E2A`,n),InvalidNumber:(r,t)=>new P("W_INVALID_NUMBER",`\u65E0\u6548\u7684\u6570\u5B57: "${r}"\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidBoolean:(r,t)=>new P("W_INVALID_BOOL",`\u65E0\u6548\u7684\u5E03\u5C14\u503C: "${r}": \u5E94\u4E3A 'true' \u6216 'false'\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidLength:(r,t)=>new P("W_INVALID_LENGTH",`\u65E0\u6548\u7684\u957F\u5EA6\u503C: "${r}"\uFF1B\u8BF7\u63D0\u4F9B\u6709\u6548\u7684\u957F\u5EA6\u503C\uFF0C\u4F8B\u5982 "10px" \u6216 "2em"\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidLengthUnit:(r,t)=>new P("W_INVALID_LENGTH_UNIT",`\u65E0\u6548\u7684\u957F\u5EA6\u5355\u4F4D: "${r}"\uFF1B\u4EC5\u652F\u6301 "px" \u548C "em"\uFF1B\u8BF7\u68C0\u67E5\u51FD\u6570\u53C2\u6570\u6216\u53D8\u91CF\u5B9A\u4E49\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u82E5\u5B58\u5728)`,t),InvalidContent:r=>new P("W_INVALID_CONTENT","\u5185\u5BB9\u89E3\u6790\u5931\u8D25\uFF0C\u9519\u8BEF\u539F\u56E0\u89C1\u4E0A\uFF1B\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C(\u4F46\u5F80\u5F80\u4E0D\u5B58\u5728\uFF0C\u6781\u6709\u53EF\u80FD\u5BFC\u81F4\u9519\u8BEF)",r),EmptyContent:(r,t,e)=>new P("W_EMPTY_CONTENT",`\u51FD\u6570 @${r} \u7684\u53C2\u6570 "${t}" \u5185\u5BB9\u4E3A\u7A7A(\u6216\u65E0\u53EF\u7528\u5185\u5BB9)`,e),UnmatchedBrace:r=>new P("W_UNMATCHED_BRACE","\u672A\u5339\u914D\u7684\u5927\u62EC\u53F7: \u7F3A\u5C11\u53F3\u5927\u62EC\u53F7'}'\uFF1B\u5C06\u5C1D\u8BD5\u81EA\u52A8\u4FEE\u590D",r),LabelWithoutTarget:(r,t)=>new P("W_LABEL_WITHOUT_TARGET",`\u6807\u7B7E "${r}" \u6CA1\u6709\u53EF\u7ED1\u5B9A\u7684\u76EE\u6807\uFF1B\u6807\u7B7E\u5C06\u88AB\u5FFD\u7565`,t),TargetAlreadyLabeled:(r,t,e)=>new P("W_TARGET_ALREADY_LABELED",`\u76EE\u6807\u5DF2\u6807\u6CE8\u4E3A "${t}"\uFF0C"${r}" \u5C06\u88AB\u5FFD\u7565`,e),UnresolvedEndpoint:(r,t)=>new P("W_UNRESOLVED_ENDPOINT",`@${r} \u6709\u7AEF\u70B9\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u8C31\u9762\u5BF9\u8C61\uFF1B\u8BE5\u5173\u7CFB\u5C06\u88AB\u5FFD\u7565`,t),ZeroTimeTrack:(r,t)=>new P("W_ZERO_TIME_TRACK",`\u7B2C${t}\u4E2A\u5B50\u8F68\u9053\u7684\u65F6\u957F\u4E3A0`,r)};function vt(r){return`@${r}`}var q=class{sourceSpan;parent;get children(){return null}constructor(t,e=null){this.sourceSpan=t,this.parent=e}loweringEnter(t,e){return[]}timeFlowModel(t){return null}loweringExit(t,e,n){return[]}toString(t){return t.slice(this.sourceSpan.start,this.sourceSpan.end)}},U=class extends q{},ft=class extends q{label;target;constructor(t,e,n,o=null){super(t,o),this.label=e,this.target=n}toString(t){return`@${this.label} `}},Y=class r extends q{content;get children(){return this.content}constructor(t,e,n=null){super(t,n),this.content=e,this.content.forEach(o=>o.parent=this)}innerSpan(){return r.getContentSpan(this.content)}static getContentSpan(t){if(Array.isArray(t)){if(t.length===0)return{start:0,end:0};let e=r.getContentSpan(t[0]),n=r.getContentSpan(t[t.length-1]);return{start:e.start,end:n.end}}else return{start:t.sourceSpan.start,end:t.sourceSpan.end}}timeFlowModel(){return{children:this.content,mode:"sequence"}}toString(t){return`{${this.content.map(e=>e.toString(t)).join("")}}`}};function jo(r,t,e){if(t){let n=t.toLowerCase();return r.args.find(o=>o.name?.toLowerCase()===n)}for(let n of r.args)if(!n.namedOnly&&e--===0)return n}function Ht(r,t,e){return jo(r,t,e)?.type??(!t&&r.allowExtraArgs?r.extraArgType:void 0)}function re(r){return Array.isArray(r.name)?r.name[0]:r.name}var _=class r extends q{label;static def;get def(){return this.constructor.def}get callName(){return this.def?re(this.def):""}static deSugarAtom=()=>null;get deSugarAtom(){return this.constructor.deSugarAtom}static deSugarRelation=()=>null;get deSugarRelation(){return this.constructor.deSugarRelation}getArgValue(t,e){let n=this.def;if(!n)return[];let o=re(n),s=0;return n.args.map((i,c)=>{let a=i.namedOnly?void 0:s++,l=i.name?.toLowerCase(),h=(l?t.get(l):void 0)??(a===void 0?void 0:t.get(a))??(l?e.variables[`${o}.${l}`.toLowerCase()]:void 0)??i.default;if(h===null)throw k.error.MissingArg(o,i.name||(a??c),this.sourceSpan);return h})}toString(t){let e=this.callName;return e?`@${e} `:super.toString(t)}static loweringAugment;static loweringFinalize;static layoutDecorationHandler;static findLabelable(t){let e=t;if(e.labelable)return e.labelable();for(let n of t.children??[]){let o=r.findLabelable(n);if(o)return o}return null}static findLastFuncContentIndex(t,e){for(;e>=0;e--)if(t[e]instanceof r||t[e]instanceof Y)return e;return-1}};function ji(r,t){for(;t!==0;){let e=r%t;r=t,t=e}return r}var O=class r{_numerator=0;_denominator=1;constructor(t=0,e=1){this.set(t,e)}get numerator(){return this._numerator}get denominator(){return this._denominator}set(t,e=1){if(!Number.isFinite(t)||!Number.isFinite(e))throw new RangeError("Fraction numerator and denominator must be finite");if(e===0)throw new RangeError("Denominator must not be zero");e<0&&(t=-t,e=-e);let n=ji(Math.abs(t),e);return this._numerator=t/n,this._denominator=e/n,this}copyFrom(t){return this._numerator=t._numerator,this._denominator=t._denominator,this}clone(){return new r(this._numerator,this._denominator)}add(t,e=1){let n;return typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),this.set(this._numerator*e+n*this._denominator,this._denominator*e)}sub(t,e=1){let n;return typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),this.set(this._numerator*e-n*this._denominator,this._denominator*e)}mul(t,e=1){let n;return typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),this.set(this._numerator*n,this._denominator*e)}div(t,e=1){let n;if(typeof t=="number"?n=t:(n=t._numerator,e=t._denominator),n===0)throw new RangeError("Cannot divide by zero");return this.set(this._numerator*e,this._denominator*n)}divPow2(t=1){if(this._numerator===0)return this;for(;t>0&&this._numerator%2===0;)this._numerator/=2,t--;let e=this._denominator*2**t;if(!Number.isFinite(e))throw new RangeError("Fraction denominator overflow");return this._denominator=e,this}compare(t,e=1){let n;typeof t=="number"?n=t:(n=t._numerator,e=t._denominator);let o=this._numerator*e-n*this._denominator;return o<0?-1:o>0?1:0}equals(t,e=1){return t instanceof r?this._numerator===t._numerator&&this._denominator===t._denominator:this._numerator*e===t*this._denominator}isZero(){return this._numerator===0}toNumber(){return this._numerator/this._denominator}toString(){return this._denominator===1?String(this._numerator):`${this._numerator}/${this._denominator}`}};var St=120,Wt=80,ce="C4",Le=0,K=-1/0,ht=1/0,D=class{t=new O;T=new O;track;ast;order;addon;mergeKey;foldedInto;breakBefore=0;layoutLine=0;box;springConfig;ports;decorations;initLayoutBox(){return this.box={x:0,y:0,w:0,h:0,anchor:0,visualAxis:0}}playbackState;prepareLayout(t){}paint(t){}};function F(r){return r.box!==void 0}function ut(r){return typeof r.createGeometry=="function"}var Gt=class{target;dx;dy;constructor(t,e,n){this.target=t,this.dx=e,this.dy=n}drawText(t,e,n,o){this.target.drawText(t,e+this.dx,n+this.dy,o)}drawLine(t,e,n,o,s){this.target.drawLine(t+this.dx,e+this.dy,n+this.dx,o+this.dy,s)}drawRect(t,e,n,o,s){this.target.drawRect(t+this.dx,e+this.dy,n,o,s)}drawCircle(t,e,n,o){this.target.drawCircle(t+this.dx,e+this.dy,n,o)}drawPath(t,e,n){if(n){let o={...n,x:n.x+this.dx,y:n.y+this.dy};this.target.drawPath(t,e,o);return}this.target.drawPath(t.map(o=>this.translateCommand(o)),e)}translateCommand(t){switch(t.op){case"Z":return t;case"Q":return{op:"Q",cx:t.cx+this.dx,cy:t.cy+this.dy,x:t.x+this.dx,y:t.y+this.dy};case"C":return{op:"C",cx1:t.cx1+this.dx,cy1:t.cy1+this.dy,cx2:t.cx2+this.dx,cy2:t.cy2+this.dy,x:t.x+this.dx,y:t.y+this.dy};default:return{op:t.op,x:t.x+this.dx,y:t.y+this.dy}}}};var un=class extends _{static def={name:["adjust","adj"],description:"\u5FAE\u8C03\u76EE\u6807\u7684\u7ED8\u5236\u4F4D\u7F6E\u4E0E\u6392\u7248\u5360\u4F4D",details:`~~~jpfun
|
|
3
3
|
@adjust(1, dx=2px, dy=-1px, dw=0.2em, dh=0px)
|
|
4
4
|
~~~
|
|
5
5
|
|
|
6
|
-
\u4F4D\u7F6E\u504F\u79FB\u5728\u6392\u7248\u540E\u5E94\u7528\uFF0C\u76F8\u90BB\u5BF9\u8C61\u4FDD\u6301\u539F\u4F4D\uFF1B\u5360\u4F4D\u8C03\u6574\u5728\u6392\u7248\u524D\u5E94\u7528\u3002\u53EA\u5305\u88F9\u5173\u7CFB\u5BF9\u8C61\u65F6\uFF0C\u5E73\u79FB\u4F5C\u7528\u4E8E\u8BE5\u5173\u7CFB\u5BF9\u8C61\u672C\u8EAB\u3002`,allowExtraArgs:!1,args:[{type:"content",description:"\u8981\u5FAE\u8C03\u7684\u5185\u5BB9\u6216\u5173\u7CFB\u5BF9\u8C61",default:null},{name:"dx",description:"\u6392\u7248\u540E\u7684\u6C34\u5E73\u504F\u79FB\uFF0C\u6B63\u503C\u5411\u53F3\uFF0C\u4E0D\u6539\u53D8\u5360\u4F4D",type:"length",default:{value:0,unit:"px"}},{name:"dy",description:"\u6392\u7248\u540E\u7684\u5782\u76F4\u504F\u79FB\uFF0C\u6B63\u503C\u5411\u4E0B\uFF0C\u4E0D\u6539\u53D8\u5360\u4F4D",type:"length",default:{value:0,unit:"px"}},{name:"dw",description:"\u589E\u51CF\u6C34\u5E73\u5360\u4F4D\uFF0C\u6309\u539F\u5DE6\u53F3\u6BD4\u4F8B\u5206\u914D\uFF0C\u6700\u7EC8\u5BBD\u5EA6\u4E0D\u5C0F\u4E8E 0",type:"length",default:{value:0,unit:"px"}},{name:"dh",description:"\u589E\u51CF\u4E0B\u65B9\u5360\u4F4D\uFF0C\u6700\u7EC8\u9AD8\u5EA6\u4E0D\u5C0F\u4E8E 0",type:"length",default:{value:0,unit:"px"}}]};target;dx;dy;dw;dh;get children(){return[this.target]}timeFlowModel(){return{children:[this.target],mode:"sequence"}}loweringEnter(t){let e={temporal:0,attachment:0},n={targets:e,onTemporal:o=>{F(o)&&(e.temporal++,_i(o,this))},onAttachment:o=>{Tt(o)&&(e.attachment++,vi(o,e,this.dx,this.dy))}};return t.beginLoweringGroup(this,n),[]}loweringExit(t){let e=t.endLoweringGroup(this);return e.targets.temporal===0&&e.targets.attachment===0&&t.diagnostics.push(new O("W_ADJUST_NO_TARGET","@adjust \u6CA1\u6709\u627E\u5230\u53EF\u8C03\u6574\u7684\u5BF9\u8C61",this.sourceSpan)),[]}constructor(t,e,n,o=null){super(t,o);let[s,r,c,a,l]=this.getArgValue(e,n);s.parent=this,this.target=s,this.dx=n.length2px(r),this.dy=n.length2px(c),this.dw=n.length2px(a),this.dh=n.length2px(l)}toString(t){return`@adjust(${this.target.toString(t)}, dx=${this.dx}px, dy=${this.dy}px, dw=${this.dw}px, dh=${this.dh}px)`}},Ro=on;function _i(i,t){let{dx:e,dy:n,dw:o,dh:s}=t;if(e===0&&n===0&&o===0&&s===0)return;let r,c,a=i.finalizeLayout,l=i.onPlaced;i.finalizeLayout=h=>{a?.call(i,h);let p=Math.max(0,i.box.w+o);i.box.anchor=i.box.w>0?i.box.anchor*p/i.box.w:0,i.box.w=p,i.box.h=Math.max(0,i.box.h+s)},i.onPlaced=()=>{i.box.x!==r&&(i.box.x+=e),i.box.y!==c&&(i.box.y+=n),l?.call(i),r=i.box.x,c=i.box.y}}function vi(i,t,e,n){if(e===0&&n===0)return;let o=i.createGeometry;i.createGeometry=s=>{let r=o.call(i,s);if(t.temporal>0)return r;let c=a=>a.line===void 0?{x:a.x+e,y:a.y+n,w:a.w,h:a.h}:{x:a.x+e,y:a.y+n,w:a.w,h:a.h,line:a.line,track:a.track};return{regions:r.regions.map(c),occupancy:r.occupancy?.map(c),paint(a){r.paint(new zt(a,e,n))}}}}var we=1,Ni=6,ki=16,sn=32,Oo=1e-6,Mi=.01;function Se(i,t=we){let e=i.alpha_L??i.alpha_R??Ni;i.alpha_L??=e,i.alpha_R??=e;let n=i.mu_L??i.mu_R??ki;i.mu_L??=n,i.mu_R??=n,i.beta_L??=t/Math.max(i.alpha_L,Oo),i.beta_R??=t/Math.max(i.alpha_R,Oo)}function Ce(i,t,e,n=we){Se(i,n);let o=Math.pow(Math.max(e.T.toNumber(),Mi),.5);return{config:i,box:t,time:e,duration_L:o,duration_R:o,WL:t.anchor,WR:t.w-t.anchor,margin_L:o*i.alpha_L,margin_R:o*i.alpha_R}}function Ri(i,t=we){let e=new Map,n=0;for(let s of i)for(let r of s)e.has(r.time.track)||e.set(r.time.track,n++);let o=[];for(let s of i){if(s.length===0)continue;let r=Array(s.length);o.push(r);let c=0,a=0,l=n;for(let p of s){p.WL>c&&(c=p.WL),p.WR>a&&(a=p.WR);let f=e.get(p.time.track);if(r[f]){let d=r[f];p.time.T.compare(d.time.T)>0?(r[f]=p,r[l++]=d):r[l++]=p}else r[f]=p}let h=s[0].time.t;for(let p of e){let f=p[1];if(!r[f]){let d=Ce({anchor:0,alpha_L:c,alpha_R:a},{x:0,w:0,anchor:0},{t:h,T:new I(1),track:p[0]},t);d.fake=!0,r[f]=d}}}return{mat:o,rows:n}}function Oi(i,t,e,n){let o=n-e-i.WR-t.WL,s=i.margin_R+t.margin_L;if(o>=s)return{force:0,stiffness:0};let r=i.config.beta_R/i.duration_R,c=t.config.beta_L/t.duration_L,a=r*c/(r+c),l,h;if(o<0){let p=i.config.mu_R*t.config.mu_L/(i.config.mu_R+t.config.mu_L);l=a*s-p*o,h=p}else{let p=s-o;l=a*p,h=a}return{force:l,stiffness:h}}function Ii(i,t,e=sn){let n=t-i.WL,o=i.margin_L;if(n>=o)return{force:0,stiffness:0};let s=i.config.beta_L/i.duration_L;if(n>=0)return{force:s*(o-n),stiffness:s};let r=i.config.mu_L*e;return{force:i.config.alpha_L*i.config.beta_L-r*n,stiffness:r}}function Pi(i,t,e,n=sn){let o=e-(t+i.WR),s=i.margin_R;if(o>=s)return{force:0,stiffness:0};let r=i.config.beta_R/i.duration_R;if(o>=0)return{force:r*(s-o),stiffness:r};let c=i.config.mu_R*n;return{force:i.config.alpha_R*i.config.beta_R-c*o,stiffness:c}}function Fi(i){return{damping:i.damping??.6,maxIter:i.maxIter??100,eps:i.eps??.01,crossPunish:i.crossPunish??sn,globalC:i.globalC??we}}function Di(i,t,e,n,o){let{damping:s,maxIter:r,eps:c,crossPunish:a}=o,l=i.length,h=new Float64Array(t);for(let T=0;T<l;T++){let E=0,C=i[T];for(let _=0;_<t;_++){let P=h[_]+C[_].WL+C[_].margin_L;P>E&&(E=P)}for(let _=0;_<t;_++)h[_]=E+C[_].WR+C[_].margin_R;e[T]=E}let p=h.reduce((T,E)=>Math.max(T,E),0);if(p<=n)return!0;p=n/p;for(let T=0;T<l;T++)e[T]*=p;let f=new Float64Array(l),d=new Float32Array(t*(l+1));function u(T){f.fill(0);for(let E=0;E<t;E++){let C=E*(l+1),_=i[0][E],P=Ii(_,T[0],a);f[0]+=P.force,d[C]=P.stiffness;for(let Y=1;Y<l;Y++){let D=i[Y-1][E],$=i[Y][E],q=Oi(D,$,T[Y-1],T[Y]);f[Y-1]-=q.force,f[Y]+=q.force,d[C+Y]=q.stiffness}let j=i[l-1][E],X=Pi(j,T[l-1],n,a);f[l-1]-=X.force,d[C+l]=X.stiffness}return f}let g=new Float64Array(l);function y(T){g.fill(0);for(let C=0,_=0;C<t;C++,_+=l+1){g[0]+=d[_]*T[0];for(let P=1;P<l;P++){let j=d[_+P]*(T[P]-T[P-1]);g[P-1]-=j,g[P]+=j}g[l-1]+=d[_+l]*T[l-1]}let E=1e-4;for(let C=0;C<T.length;C++)g[C]+=E*T[C];return g}function x(T,E){let C=0;for(let _=0;_<T.length;_++)C+=T[_]*E[_];return C}let m=new Float64Array(l),b=new Float64Array(l),w=new Float64Array(l);function A(T,E=8){m.fill(0),b.set(T),w.set(b);let C=x(b,b);if(C<1e-12)return m;for(let _=0;_<E;_++){let P=y(w),j=x(w,P);if(Math.abs(j)<1e-12)break;let X=C/j;for(let $=0;$<l;$++)m[$]+=X*w[$],b[$]-=X*P[$];let Y=x(b,b);if(Math.sqrt(Y)<1e-6)break;let D=Y/C;for(let $=0;$<l;$++)w[$]=b[$]+D*w[$];C=Y}return m}let k=0,M=0;for(;k<r;k++){let T=u(e);M=0;for(let C=0;C<T.length;C++){let _=Math.abs(T[C]);_>M&&(M=_)}if(M<c)break;let E=A(T);for(let C=0;C<l;C++)e[C]+=s*E[C]}return!1}function Ht(i,t,e,n,o,s,r){if(e.length!==i.length||n.length!==Math.max(0,e.length-1))throw new Error("Horizontal region state does not match its columns");if(e.length===0||t===0)return;let c=n.some(d=>d!==0),a,l,h=i,p=e;if(c){a=new Uint32Array(e.length),l=new Float64Array(e.length),h=[];for(let d=0;d<e.length;){let u=d;for(;u<n.length&&n[u];)u++;let g=h.length;for(let y=d;y<=u;y++)a[y]=g,l[y]=e[y]-e[d];if(d===u)h.push(i[d]);else{let y=e[u]-e[d];h.push(Array.from({length:t},(x,m)=>{let b=i[d][m],w=i[u][m];return{config:{alpha_L:b.config.alpha_L,alpha_R:w.config.alpha_R,mu_L:b.config.mu_L,mu_R:w.config.mu_R,beta_L:b.config.beta_L,beta_R:w.config.beta_R},box:b.box,time:b.time,duration_L:b.duration_L,duration_R:w.duration_R,WL:b.WL,WR:y+w.WR,margin_L:b.margin_L,margin_R:w.margin_R,fake:b.fake&&w.fake}}))}d=u+1}p=new Float64Array(h.length)}let f=Di(h,t,p,o,s);if(n.fill(1),r!==void 0){let d=0,u=0;for(let y=0;y<t;y++)d=Math.max(d,h[0][y].WL),u=Math.max(u,h[h.length-1][y].WR);let g=p[p.length-1]+u-p[0]+d;if(!f||g>=o*r){let y=d-p[0],x=o-g;for(let m=0;m<p.length;m++)p[m]+=y+(p.length>1?x*m/(p.length-1):0)}}if(c)for(let d=0;d<e.length;d++)e[d]=p[a[d]]+l[d]}function rn(i,t,e={},n=[],o){let s=Fi(e),{mat:r,rows:c}=Ri(i,s.globalC),a=new Float64Array(r.length),l=new Uint8Array(Math.max(0,r.length-1)),h=n.length>1?[...n].sort((p,f)=>p.end-p.start-(f.end-f.start)):n;for(let{start:p,end:f,hook:d}of h){if(p<0||f<p||f>=r.length)throw new Error("Horizontal layout registration references invalid columns");d({columns:r,rows:c,start:p,end:f,X:a,fixed:l,options:s})}Ht(r,c,a,l,t,s,o);for(let p=0;p<r.length;p++)for(let f of r[p])f.box.x=a[p]-f.box.anchor;return r}var Wt=class extends Error{line;requiredHeight;availableHeight;constructor(t,e,n){super(`Page cannot fit layout line ${t}: requires ${e}px, available ${n}px`),this.name="PageLayoutError",this.line=t,this.requiredHeight=e,this.availableHeight=n}},ot={width:794,height:1/0,marginTop:45,marginBottom:48,marginLeft:40,marginRight:40,lineGap:22,fillRatio:.5};function se(i={}){let t=i.height??ot.height,e={width:i.width??ot.width,height:t<=0?1/0:t,marginTop:Math.max(0,i.marginTop??ot.marginTop),marginBottom:Math.max(0,i.marginBottom??ot.marginBottom),marginLeft:Math.max(0,i.marginLeft??ot.marginLeft),marginRight:Math.max(0,i.marginRight??ot.marginRight),lineGap:Math.max(0,i.lineGap??ot.lineGap),fillRatio:i.fillRatio??ot.fillRatio};if(!Number.isFinite(e.width)||e.width<=0)throw new Error(`Page width must be a positive finite number, got ${e.width}`);if(e.height!==1/0&&(!Number.isFinite(e.height)||e.height<=0))throw new Error(`Page height must be positive or Infinity, got ${e.height}`);if([e.marginTop,e.marginBottom,e.marginLeft,e.marginRight,e.lineGap].some(r=>!Number.isFinite(r)||r<0))throw new Error("Page margins and line gap must be finite non-negative numbers");let o=e.width-e.marginLeft-e.marginRight;if(o<=0)throw new Error(`Page horizontal margins leave no content width: ${o}px`);let s=e.height-e.marginTop-e.marginBottom;if(Number.isFinite(e.height)&&s<=0)throw new Error(`Page vertical margins leave no content height: ${s}px`);return e}function cn(i,t){let e=t.height-t.marginTop-t.marginBottom,n=[],o=new Array(i.length).fill(0),s=0,r=0,c=0,a=0,l=(h,p)=>{let f=h-r,d=p?Math.max(0,e-a-t.lineGap*(f-1)):0,u=t.lineGap+d/f,g=s+t.marginTop;for(let x=r;x<h;x++)o[x]=g,g+=i[x]+(x+1<h?u:0);let y=Number.isFinite(t.height)?t.height:g-s+t.marginBottom;n.push({bounds:{x:0,y:s,w:t.width,h:y},lineStart:r,lineEnd:h}),s+=y,r=h,c=0,a=0};for(let h=0;h<i.length;h++){let p=i[h];if(Number.isFinite(t.height)&&p>e+1e-6)throw new Wt(h,p,e);Number.isFinite(t.height)&&h>r&&c+t.lineGap+p>e+1e-6&&l(h,!0),c+=(h>r?t.lineGap:0)+p,a+=p}return i.length>r&&l(i.length,!1),{pages:n,lineTops:o}}var Io={start:0,end:-1,wholeLine:!1};function an(i){let t=new Set,e=n=>{t.add(n);for(let o of n.groups)for(let s of o.members)e(s)};return e(i),n=>{for(let o=n;o;o=o.parent)if(t.has(o))return o;return n}}function Po(i,t){for(let e=t;e;){let n=i.columnOf(e);if(n>=0)return n;let o=e instanceof W?e.foldedInto:void 0;e=o&&F(o)?o:void 0}return-1}function ln(i,t,e,n){if(!t)return{start:0,end:i.columns.length-1,wholeLine:!0};if(typeof t[0]=="number")return{start:Math.max(0,t[0]),end:Math.min(i.columns.length-1,t[1]),wholeLine:!1};let[o,s]=t;if(o.layoutLine>s.layoutLine&&([o,s]=[s,o]),i.index<o.layoutLine||i.index>s.layoutLine)return Io;let r=e&&n(e);if(r&&(n(o.track)!==r||n(s.track)!==r))throw new Error("Range endpoints must belong to the selected track");let c=o.layoutLine<i.index?0:Po(i,o),a=s.layoutLine>i.index?i.columns.length-1:Po(i,s);return c<0||a<0?Io:{start:Math.min(c,a),end:Math.max(c,a),wholeLine:!1}}function hn(i,t,e,n){if(!i)return[];let{start:o,end:s}=ln(i,t,e,n),r=i.columns.slice(o,s+1);if(!e)return r;let c=n(e),a=l=>l.track===c;return r.every(l=>l.every(a))?r:r.map(l=>l.filter(a))}var Do=.75;function Ae(i,t){let e=1/0,n=1/0,o=-1/0,s=-1/0;for(let r of t)e=Math.min(e,r.x),n=Math.min(n,r.y),o=Math.max(o,r.x+r.w),s=Math.max(s,r.y+r.h);return Number.isFinite(e)?(i.x=e,i.y=n,i.w=o-e,i.h=s-n,!0):(i.x=i.y=i.w=i.h=0,!1)}function re(i,t){i.springConfig??={},i.decorations=[],i.ports={},i.box.x=i.box.y=0,i.prepareLayout(t);for(let[e,n]of Object.entries(i.addon??{})){let o=t.decorationHandlers.get(e);if(!o)continue;let s=o(i,n,t);s&&i.decorations.push(s)}$i(i),i.finalizeLayout?.(t)}function fn(i,t,e={}){let n=i.attachments.filter(Tt),o=se(i.page),s=o.width-o.marginLeft-o.marginRight,r=o.marginLeft,c=an(i.rootTrack),a=new Map(n.map((C,_)=>[C,_])),l=Hi(n),h=new Map,p=C=>{let _=h.get(C);return _&&Fo(_).box};t={...t,layoutSubdomain(C,_,P,j){let X=$o(_,t),Y=new Set(_.flat()),D=Q=>{for(let tt=Q;tt&&tt!==C;tt=tt.foldedInto)if(Y.has(tt))return!0;return!1},$=j.filter(Tt).filter(Q=>!Q.endPoints?.length);for(let Q of l.get(C)??[])!h.has(Q)&&Q.endPoints.every(D)&&$.push(Q);$.sort((Q,tt)=>a.get(Q)-a.get(tt));let q=zi(_,X,P,$,t,p);return $.forEach((Q,tt)=>h.set(Q,q.items[tt])),{width:X.width,height:q.height,positions:q.positions}}};let f=Bi(i),d=[];for(let C of f)for(let _ of C.columns)for(let P of _)d.push(P),re(P,t);let u=n.filter(C=>!h.has(C)),g=f.map((C,_)=>un(C.columns,_,e)),y=g.map(C=>C.view);for(let C of u)C.prepareHorizontal?.(y,t);for(let C of g){C.layout(s,o.fillRatio);for(let _ of C.view.columns)for(let P of _)P.box.x+=r}for(let C of d){let _=f[C.layoutLine],P=-C.box.visualAxis;Le(_.hostExtents,C.track,P,P+C.box.h)}let x=Gi(f.length,d,e.rowGap),m=()=>{let C=[],_=f.map((D,$)=>{let q=Bo(D,i.rootTrack,x[$]);return C.push(q.height),q.axes}),P,j;try{({pages:P,lineTops:j}=cn(C,o))}catch(D){if(!(D instanceof Wt))throw D;let $=f[D.line],q=1/0,Q=-1/0;for(let tt of $?.columns??[])for(let St of tt)q=Math.min(q,St.ast.sourceSpan.start),Q=Math.max(Q,St.ast.sourceSpan.end);throw Number.isFinite(q)?N.error.PageOverflow(D.requiredHeight,D.availableHeight,{start:q,end:Q}):D}let X=(D,$)=>(j[D]??0)+(_[D]?.get($)??0);for(let D of d)D.box.y=X(D.layoutLine,D.track)-D.box.visualAxis,D.onPlaced?.();let Y={...t,width:s,originX:r,pages:P.map(D=>D.bounds),lines:y,getVisualAxis:(D,$)=>X(D,c($)),getHostExtent:(D,$)=>f[D]?.hostExtents.get(c($)),getRangeColumns:(D,$,q)=>hn(y[D],$,q,c)};return{pages:P,attachmentContext:Y}},b=m(),w=pn(u,b.attachmentContext,f,c,p);w.needsRelayout&&(b=m(),w=pn(u,b.attachmentContext,f,c,p));let A=b.pages,k=0,M=n.map(C=>{let _=h.get(C),{geometry:P,box:j}=_?Fo(_):w.items[k++];return{box:j,regions:P.regions,layer:C.layer,sourceSpan:C.sourceSpan,paint(X){P.paint(X)}}}),T={x:0,y:0,w:0,h:0};function*E(){for(let C of A)yield C.bounds;for(let C of d)yield C.box;for(let C of M)yield C.box}return Ae(T,E()),{diagnostics:i.diagnostics,objects:d,attachments:M,bounds:T,lineCount:f.length,pages:A}}function $i(i){let t=i.decorations.map(n=>n.below).filter(n=>n!==void 0).sort((n,o)=>n.order-o.order);if(t.length===0)return;let e=i.box.h;for(let n of t)e+=n.gap??0,n.place?.(e),e+=Math.max(0,n.height??0);i.box.h=e}function Bi(i){let t=()=>({columns:[],hostExtents:new Map,attachmentExtents:new Map}),e=[],n=t();for(let o of i.columns){let s=[];for(;e.length<o[0].layoutLine;)e.push(n),n=t();for(let r of o)F(r)&&s.push(r);s.length&&n.columns.push(s)}return(n.columns.length>0||e.length===0)&&e.push(n),e}function ie(i,t,e){i.top=Math.min(i.top,t),i.bottom=Math.max(i.bottom,e)}function Le(i,t,e,n){let o=i.get(t);o?ie(o,e,n):i.set(t,{top:e,bottom:n})}function un(i,t,e={},n=!1){let o=[],s=new Map,r=new Map;for(let a=0;a<i.length;a++)for(let l of i[a]){s.set(l,a),Se(l.springConfig,e.globalC);let h=r.get(l.track);h?h.push(l):r.set(l.track,[l])}let c={index:t,columns:i,trackRuns:r,columnOf:a=>s.get(a)??-1,registerHorizontalLayoutHook(a,l,h){let p=s.get(a),f=s.get(l);p===void 0||f===void 0||o.push({start:Math.min(p,f),end:Math.max(p,f),hook:h})}};for(let a of i)for(let l of a)l.prepareHorizontal?.(c);return{view:c,layout(a,l){let h=i.map(p=>p.map(f=>{let d=Ce(f.springConfig,f.box,f,e.globalC);return n&&(d.margin_L=d.margin_R=0),d}));return rn(h,a,e,o,l),h}}}function Gt(i,t){return i.length===0?0:$o(i.map(e=>[e]),t).width}function $o(i,t){for(let s of i)for(let r of s)re(r,t);let e=un(i,i[0][0].layoutLine,{},!0),n=1/0,o=-1/0;for(let s of e.layout(1/0))for(let r of s){let c=r.box.x+r.box.anchor;n=Math.min(n,c-r.WL),o=Math.max(o,c+r.WR)}for(let s of i)for(let r of s)r.box.x-=n;return{width:o-n,view:e.view}}function zi(i,{width:t,view:e},n,o,s,r){let c=i.flat(),a={hostExtents:new Map,attachmentExtents:new Map},l=0;for(let w of c){let A=-w.box.visualAxis;Le(a.hostExtents,w.track,A,A+w.box.h),l=Math.max(l,w.ast.size*Do)}let h=c.map(w=>({x:w.box.x,y:0})),p=()=>{let w=Bo(a,n,l);return c.forEach((A,k)=>{A.box.y=h[k].y=w.axes.get(A.track)-A.box.visualAxis,A.onPlaced?.()}),w},f=p();if(o.length===0)return{height:f.height,positions:h,items:[]};let d=an(n),u=[],g=[];u[e.index]=a,g[e.index]=e;let y=()=>pn(o,{...s,width:t,originX:0,pages:[],lines:g,getVisualAxis:(w,A)=>f.axes.get(d(A))??0,getHostExtent:(w,A)=>u[w]?.hostExtents.get(d(A)),getRangeColumns:(w,A,k)=>hn(g[w],A,k,d)},u,d,r),x=y();x.needsRelayout&&(f=p(),x=y());let m=c[0],b=x.items.map(w=>({...w,reference:m,x:m.box.x,y:m.box.y}));return{height:f.height,positions:h,items:b}}function Hi(i){let t=new Map;for(let e of i){let[n,...o]=e.endPoints??[];for(let s=n?.foldedInto;s;s=s.foldedInto){let r=s;if(!o.every(a=>Wi(r,a)))continue;let c=t.get(s);c?c.push(e):t.set(s,[e])}}return t}function Wi(i,t){for(let e=t.foldedInto;e;e=e.foldedInto)if(e===i)return!0;return!1}function Fo(i){let t=i.reference.box.x-i.x,e=i.reference.box.y-i.y;if(t===0&&e===0)return i;let n=s=>({...s,x:s.x+t,y:s.y+e}),{geometry:o}=i;return{box:n(i.box),geometry:{regions:o.regions.map(n),paint:s=>o.paint(new zt(s,t,e))}}}function Gi(i,t,e){if(e!==void 0)return new Array(i).fill(e);let n=new Array(i).fill(0),o=0;for(let s of t){let r=s.ast.size*Do;r>n[s.layoutLine]&&(n[s.layoutLine]=r),r>o&&(o=r)}for(let s=0;s<i;s++)n[s]||=o;return n}function pn(i,t,e,n,o){let s=new Map,r=new Set(i),c=[],a=!1;function l(f,d,u){let g=t.lines[f],y=u===void 0?new Map:void 0,x;if(!g)return y;let m=(E,C,_)=>{y?Le(y,E,C,_):x?ie(x,C,_):x={top:C,bottom:_}},{start:b,end:w,wholeLine:A}=ln(g,d,u,n),k=u&&n(u),M=A?t.originX:1/0,T=A?t.originX+t.width:-1/0;for(let E=b;E<=w;E++)for(let C of g.columns[E]){if(k&&C.track!==k)continue;A||(C.box.x<M&&(M=C.box.x),C.box.x+C.box.w>T&&(T=C.box.x+C.box.w));let _=C.box.y-t.getVisualAxis(f,C.track);m(C.track,_,_+C.box.h)}for(let E of c[f]??[])k&&E.track!==k||E.right<=M||E.left>=T||m(E.track,E.top,E.bottom);return y??x}let h={...t,getRangeExtents:l,getAttachmentBox(f){let d=s.get(f)??o(f);if(!d)throw new Error("Layout attachment dependency has not been measured");return d},getContentBounds(f){let d=[];for(let g of f.nodes)F(g)&&(g.box.w>0||g.box.h>0)&&d.push(g.box);for(let g of f.attachments){if(!Tt(g)||!r.has(g)&&!o(g))continue;let y=h.getAttachmentBox(g);(y.w>0||y.h>0)&&d.push(y)}let u={x:0,y:0,w:0,h:0};return Ae(u,d)?u:void 0}};return{items:i.map(f=>{let d=f.createGeometry(h),u={x:0,y:0,w:0,h:0};Ae(u,d.regions);let g={geometry:d,box:u};s.set(f,u);for(let y of d.occupancy??d.regions){if(y.line===void 0)continue;let x=e[y.line],m=n(y.track),b=y.y-t.getVisualAxis(y.line,m),w=b+y.h,A=x.hostExtents.get(m),k=x.attachmentExtents.get(m);(b<Math.min(A?.top??1/0,k?.top??1/0)||w>Math.max(A?.bottom??-1/0,k?.bottom??-1/0))&&(a=!0),Le(x.attachmentExtents,m,b,w),(c[y.line]??=[]).push({track:m,left:y.x,right:y.x+y.w,top:b,bottom:w})}return g}),needsRelayout:a}}function Bo(i,t,e){let n=new Map,o=a=>{let l=i.hostExtents.get(a),h=i.attachmentExtents.get(a),p=l?{top:l.top,bottom:l.bottom}:null;h&&(p?ie(p,h.top,h.bottom):p={top:h.top,bottom:h.bottom});let f=[];for(let u of a.groups){let g=u.members.map(o);if(g.every(m=>m===null))continue;let y=u.measure(g,e),x=null;for(let m of y){if(!m)continue;let b=m.offset+m.extent.top,w=m.offset+m.extent.bottom;x?ie(x,b,w):x={top:b,bottom:w}}x&&f.push({group:u,placements:y,extent:x})}let d=(u,g)=>{p??={top:0,bottom:0};for(let y=0;y<u.group.members.length;y++){let x=u.placements[y];x&&n.set(u.group.members[y],g+x.offset)}ie(p,g+u.extent.top,g+u.extent.bottom)};for(let u of f)u.group.place||d(u,0);for(let u of f){let g=u.group.place;if(!g)continue;d(u,g(p??{top:0,bottom:0},u.extent,e))}return p},s=o(t),r=new Map;if(!s)return{axes:r,height:0};let c=(a,l)=>{r.set(a,l);for(let h of a.groups)for(let p of h.members){let f=n.get(p);f!==void 0&&c(p,l+f)}};return c(t,-s.top),{axes:r,height:s.bottom-s.top}}var Te=class{min=1/0;max=-1/0;add(t){t<this.min&&(this.min=t),t>this.max&&(this.max=t)}};function dn(i,t,e,n,o,s){if(!(i>0&&i<1))return;let r=1-i;s.add(r*r*r*t+3*r*r*i*e+3*r*i*i*n+i*i*i*o)}function zo(i,t,e,n,o){o.add(i),o.add(n);let s=-i+3*t-3*e+n,r=2*(i-2*t+e),c=t-i;if(Math.abs(s)<1e-12){Math.abs(r)>1e-12&&dn(-c/r,i,t,e,n,o);return}let a=r*r-4*s*c;if(a<0)return;let l=Math.sqrt(a);dn((-r+l)/(2*s),i,t,e,n,o),dn((-r-l)/(2*s),i,t,e,n,o)}function Ho(i,t,e,n){n.add(i),n.add(e);let o=i-2*t+e;if(Math.abs(o)<1e-12)return;let s=(i-t)/o;if(!(s>0&&s<1))return;let r=1-s;n.add(r*r*i+2*r*s*t+s*s*e)}function Vt(i){let t=new Te,e=new Te,n=0,o=0,s=0,r=0;for(let c of i){if(c.op==="Z"){n=s,o=r;continue}c.op==="C"?(zo(n,c.cx1,c.cx2,c.x,t),zo(o,c.cy1,c.cy2,c.y,e)):c.op==="Q"?(Ho(n,c.cx,c.x,t),Ho(o,c.cy,c.y,e)):(t.add(c.x),e.add(c.y),c.op==="M"&&(s=c.x,r=c.y)),n=c.x,o=c.y}return Number.isFinite(t.min)?{x:t.min,y:e.min,w:t.max-t.min,h:e.max-e.min}:{x:0,y:0,w:0,h:0}}var Vi=54.2813,Wo=87.37505,Ee=72.8125,Vo=93.6719,Yi=-27.4688,Yo=-7.9375,Ki=Yo+Vo,Ui=[{op:"M",x:28.1406,y:86.06255},{op:"C",cx1:28.1406,cy1:86.06255,cx2:30.4531,cy2:84.07815,x:32.7656,y:81.42185},{op:"C",cx1:33.7656,cy1:80.43755,cx2:34.0938,cy2:79.10935,x:34.0938,y:78.10935},{op:"C",cx1:34.0938,cy1:77.12505,cx2:33.7656,cy2:76.45315,x:33.0938,y:75.79685},{op:"L",x:29.4531,y:72.15625},{op:"C",cx1:28.7969,cy1:71.50005,cx2:28.4688,cy2:70.82815,x:28.4688,y:70.17185},{op:"C",cx1:28.4688,cy1:68.84375,cx2:29.4531,cy2:68.18755,x:29.4531,y:68.18755},{op:"C",cx1:29.4531,cy1:68.18755,cx2:47.6563,cy2:47.00005,x:50.6406,y:43.68755},{op:"C",cx1:53.2969,cy1:40.04685,cx2:54.2813,cy2:36.40625,x:54.2813,y:33.09375},{op:"C",cx1:54.2813,cy1:26.14065,cx2:50.3125,cy2:19.85935,x:47.3281,y:17.21875},{op:"L",x:31.4375,y:1.32812},{op:"C",cx1:30.4531,cy1:.32812,cx2:29.7969,cy2:0,x:28.7969,y:0},{op:"C",cx1:27.1406,cy1:0,cx2:25.8125,cy2:1.32812,x:25.8125,y:1.32812},{op:"C",cx1:25.8125,cy1:1.32812,cx2:23.5,cy2:3.3125,x:21.1875,y:5.95312},{op:"C",cx1:20.1875,cy1:6.95313,cx2:19.8594,cy2:7.9375,x:19.8594,y:8.9375},{op:"C",cx1:19.8594,cy1:9.92188,cx2:20.1875,cy2:10.59375,x:20.8594,y:11.25},{op:"L",x:24.5,y:14.89063},{op:"C",cx1:25.1563,cy1:15.5625,cx2:25.4844,cy2:16.21875,x:25.4844,y:16.875},{op:"C",cx1:25.4844,cy1:18.20315,cx2:24.5,cy2:19.20315,x:24.5,y:19.20315},{op:"C",cx1:24.5,cy1:19.20315,cx2:6.625,cy2:40.37505,x:3.64063,y:43.68755},{op:"C",cx1:1,cy1:47.32815,cx2:0,cy2:50.96875,x:0,y:54.28125},{op:"C",cx1:0,cy1:61.23435,cx2:3.96875,cy2:67.51565,x:6.95313,y:70.17185},{op:"L",x:22.8438,y:86.06255},{op:"C",cx1:23.8281,cy1:87.04685,cx2:24.8281,cy2:87.37505,x:25.4844,y:87.37505},{op:"C",cx1:27.1406,cy1:87.37505,cx2:28.1406,cy2:86.06255,x:28.1406,y:86.06255}],ji=[{op:"M",x:111.8751,y:21.5156},{op:"C",cx1:112.5313,cy1:20.1875,cx2:113.5313,cy2:18.2031,x:113.5313,y:16.875},{op:"C",cx1:113.5313,cy1:12.23438,cx2:109.8907,cy2:8.9375,x:105.2501,y:8.9375},{op:"C",cx1:103.9219,cy1:8.9375,cx2:101.6094,cy2:9.26563,x:100.2813,y:10.25},{op:"L",x:72.1563,y:31.7656},{op:"L",x:72.1563,y:28.4531},{op:"C",cx1:72.1563,cy1:16.54688,cx2:66.8594,cy2:8.26563,x:58.2501,y:.98437},{op:"C",cx1:57.2657,cy1:.32812,cx2:55.9376,cy2:0,x:55.2657,y:0},{op:"C",cx1:53.6251,cy1:0,cx2:52.9532,cy2:.98437,x:52.9532,y:.98437},{op:"C",cx1:51.6251,cy1:2.3125,cx2:49.3126,cy2:4.29687,x:48.3282,y:5.625},{op:"C",cx1:47.3282,cy1:6.9375,cx2:47.0001,cy2:7.9375,x:47.0001,y:8.9375},{op:"C",cx1:47.0001,cy1:9.92188,cx2:47.3282,cy2:10.57813,x:47.6563,y:11.25},{op:"C",cx1:49.9688,cy1:13.5625,cx2:50.9688,cy2:16.21875,x:50.9688,y:18.8594},{op:"C",cx1:50.9688,cy1:24.8125,cx2:46.3282,cy2:30.1094,x:41.0469,y:30.1094},{op:"C",cx1:39.3907,cy1:30.1094,cx2:37.7344,cy2:29.4531,x:36.4063,y:28.4531},{op:"L",x:12.9063,y:10.57813},{op:"C",cx1:11.5782,cy1:9.59375,cx2:9.5938,cy2:8.9375,x:7.9375,y:8.9375},{op:"C",cx1:3.6407,cy1:8.9375,cx2:0,cy2:12.57813,x:0,y:16.875},{op:"C",cx1:0,cy1:18.2031,cx2:.6563,cy2:20.1875,x:1.3125,y:21.5156},{op:"L",x:49.9688,y:90.3594},{op:"C",cx1:51.2969,cy1:92.3438,cx2:54.2813,cy2:93.6719,x:56.5938,y:93.6719},{op:"C",cx1:58.9063,cy1:93.6719,cx2:61.8907,cy2:92.3438,x:63.2188,y:90.3594},{op:"L",x:111.8751,y:21.5156}];function Go(i,t,e,n,o,s,r,c){let a=h=>o+(c?e-h:h)*r,l=h=>s+(c?n-h:h)*r;for(let h of t)h.op==="Z"?i.push(h):h.op==="C"?i.push({op:"C",cx1:a(h.cx1),cy1:l(h.cy1),cx2:a(h.cx2),cy2:l(h.cy2),x:a(h.x),y:l(h.y)}):h.op==="Q"?i.push({op:"Q",cx:a(h.cx),cy:l(h.cy),x:a(h.x),y:l(h.y)}):i.push({op:h.op,x:a(h.x),y:l(h.y)})}function Ko(i,t,e){let n=e==="up"||e==="down",o=Math.max(1,Math.round(i/(t*.3))),s=n?Math.max(0,o-1):o,r=n?Ki+Ee*s:Wo+Ee*(s-1),c=i/r,a=[];for(let p=0;p<s;p++)Go(a,Ui,Vi,Wo,0,p*Ee*c,c,e==="");n&&Go(a,ji,113.5313,Vo,Yi*c,(s*Ee+Yo)*c,c,!1);let l=Vt(a);return e!=="up"?{commands:a,bounds:l}:{commands:a.map(p=>p.op==="Z"?p:p.op==="C"?{op:"C",cx1:l.x+l.w-(p.cx1-l.x),cy1:i-p.cy1,cx2:l.x+l.w-(p.cx2-l.x),cy2:i-p.cy2,x:l.x+l.w-(p.x-l.x),y:i-p.y}:p.op==="Q"?{op:"Q",cx:l.x+l.w-(p.cx-l.x),cy:i-p.cy,x:l.x+l.w-(p.x-l.x),y:i-p.y}:{op:p.op,x:l.x+l.w-(p.x-l.x),y:i-p.y}),bounds:{x:l.x,y:i-l.y-l.h,w:l.w,h:l.h}}}function Xi(i){let t=i,e=i.ast;return(e.callName==="up"||e.callName==="down")&&Array.isArray(t.members)&&Array.isArray(e.contents)?t:null}var xn=class extends v{static def={name:["arp","arpeggio"],description:"\u7436\u97F3",details:`~~~jpfun
|
|
6
|
+
\u4F4D\u7F6E\u504F\u79FB\u5728\u6392\u7248\u540E\u5E94\u7528\uFF0C\u76F8\u90BB\u5BF9\u8C61\u4FDD\u6301\u539F\u4F4D\uFF1B\u5360\u4F4D\u8C03\u6574\u5728\u6392\u7248\u524D\u5E94\u7528\u3002\u53EA\u5305\u88F9\u5173\u7CFB\u5BF9\u8C61\u65F6\uFF0C\u5E73\u79FB\u4F5C\u7528\u4E8E\u8BE5\u5173\u7CFB\u5BF9\u8C61\u672C\u8EAB\u3002`,allowExtraArgs:!1,args:[{type:"content",description:"\u8981\u5FAE\u8C03\u7684\u5185\u5BB9\u6216\u5173\u7CFB\u5BF9\u8C61",default:null},{name:"dx",description:"\u6392\u7248\u540E\u7684\u6C34\u5E73\u504F\u79FB\uFF0C\u6B63\u503C\u5411\u53F3\uFF0C\u4E0D\u6539\u53D8\u5360\u4F4D",type:"length",default:{value:0,unit:"px"}},{name:"dy",description:"\u6392\u7248\u540E\u7684\u5782\u76F4\u504F\u79FB\uFF0C\u6B63\u503C\u5411\u4E0B\uFF0C\u4E0D\u6539\u53D8\u5360\u4F4D",type:"length",default:{value:0,unit:"px"}},{name:"dw",description:"\u589E\u51CF\u6C34\u5E73\u5360\u4F4D\uFF0C\u6309\u539F\u5DE6\u53F3\u6BD4\u4F8B\u5206\u914D\uFF0C\u6700\u7EC8\u5BBD\u5EA6\u4E0D\u5C0F\u4E8E 0",type:"length",default:{value:0,unit:"px"}},{name:"dh",description:"\u589E\u51CF\u4E0B\u65B9\u5360\u4F4D\uFF0C\u6700\u7EC8\u9AD8\u5EA6\u4E0D\u5C0F\u4E8E 0",type:"length",default:{value:0,unit:"px"}}]};target;dx;dy;dw;dh;get children(){return[this.target]}timeFlowModel(){return{children:[this.target],mode:"sequence"}}loweringEnter(t){let e={temporal:0,attachment:0},n={targets:e,onTemporal:o=>{F(o)&&(e.temporal++,Xi(o,this))},onAttachment:o=>{ut(o)&&(e.attachment++,Zi(o,e,this.dx,this.dy))}};return t.beginLoweringGroup(this,n),[]}loweringExit(t){let e=t.endLoweringGroup(this);return e.targets.temporal===0&&e.targets.attachment===0&&t.diagnostics.push(new P("W_ADJUST_NO_TARGET","@adjust \u6CA1\u6709\u627E\u5230\u53EF\u8C03\u6574\u7684\u5BF9\u8C61",this.sourceSpan)),[]}constructor(t,e,n,o=null){super(t,o);let[s,i,c,a,l]=this.getArgValue(e,n);s.parent=this,this.target=s,this.dx=n.length2px(i),this.dy=n.length2px(c),this.dw=n.length2px(a),this.dh=n.length2px(l)}toString(t){return`@adjust(${this.target.toString(t)}, dx=${this.dx}px, dy=${this.dy}px, dw=${this.dw}px, dh=${this.dh}px)`}},Xo=un;function Xi(r,t){let{dx:e,dy:n,dw:o,dh:s}=t;if(e===0&&n===0&&o===0&&s===0)return;(e!==0||n!==0)&&(r.placementOffset={x:(r.placementOffset?.x??0)+e,y:(r.placementOffset?.y??0)+n});let i,c,a=r.finalizeLayout,l=r.onPlaced;r.finalizeLayout=h=>{a?.call(r,h);let p=Math.max(0,r.box.w+o);r.box.anchor=r.box.w>0?r.box.anchor*p/r.box.w:0,r.box.w=p,r.box.h=Math.max(0,r.box.h+s)},r.onPlaced=()=>{r.box.x!==i&&(r.box.x+=e),r.box.y!==c&&(r.box.y+=n),l?.call(r),i=r.box.x,c=r.box.y}}function Zi(r,t,e,n){if(t.temporal>0||e===0&&n===0)return;r.placementOffset={x:(r.placementOffset?.x??0)+e,y:(r.placementOffset?.y??0)+n};let o=r.createGeometry;r.createGeometry=s=>{let i=o.call(r,s);if(t.temporal>0||s.layoutOnly)return i;let c=a=>a.line===void 0?{x:a.x+e,y:a.y+n,w:a.w,h:a.h}:{x:a.x+e,y:a.y+n,w:a.w,h:a.h,line:a.line,track:a.track};return{regions:i.regions.map(c),occupancy:i.occupancy?.map(c),paint(a){i.paint(new Gt(a,e,n))}}}}var _e=1,qi=6,Qi=16,dn=32,Zo=1e-6,Ji=.01;function Ne(r,t=_e){let e=r.alpha_L??r.alpha_R??qi;r.alpha_L??=e,r.alpha_R??=e;let n=r.mu_L??r.mu_R??Qi;r.mu_L??=n,r.mu_R??=n,r.beta_L??=t/Math.max(r.alpha_L,Zo),r.beta_R??=t/Math.max(r.alpha_R,Zo)}function ke(r,t,e,n=_e){Ne(r,n);let o=Math.pow(Math.max(e.T.toNumber(),Ji),.5);return{config:r,box:t,time:e,duration_L:o,duration_R:o,WL:t.anchor,WR:t.w-t.anchor,margin_L:o*r.alpha_L,margin_R:o*r.alpha_R}}function tr(r,t=_e){let e=new Map,n=0;for(let s of r)for(let i of s)e.has(i.time.track)||e.set(i.time.track,n++);let o=[];for(let s of r){if(s.length===0)continue;let i=Array(s.length);o.push(i);let c=0,a=0,l=n;for(let p of s){p.WL>c&&(c=p.WL),p.WR>a&&(a=p.WR);let f=e.get(p.time.track);if(i[f]){let d=i[f];p.time.T.compare(d.time.T)>0?(i[f]=p,i[l++]=d):i[l++]=p}else i[f]=p}let h=s[0].time.t;for(let p of e){let f=p[1];if(!i[f]){let d=ke({alpha_L:c,alpha_R:a},{x:0,w:0,anchor:0},{t:h,T:new O(1),track:p[0]},t);d.fake=!0,i[f]=d}}}return{mat:o,rows:n}}function er(r,t,e,n){let o=n-e-r.WR-t.WL,s=r.margin_R+t.margin_L;if(o>=s)return{force:0,stiffness:0};let i=r.config.beta_R/r.duration_R,c=t.config.beta_L/t.duration_L,a=i*c/(i+c),l,h;if(o<0){let p=r.config.mu_R*t.config.mu_L/(r.config.mu_R+t.config.mu_L);l=a*s-p*o,h=p}else{let p=s-o;l=a*p,h=a}return{force:l,stiffness:h}}function nr(r,t,e=dn){let n=t-r.WL,o=r.margin_L;if(n>=o)return{force:0,stiffness:0};let s=r.config.beta_L/r.duration_L;if(n>=0)return{force:s*(o-n),stiffness:s};let i=r.config.mu_L*e;return{force:r.config.alpha_L*r.config.beta_L-i*n,stiffness:i}}function or(r,t,e,n=dn){let o=e-(t+r.WR),s=r.margin_R;if(o>=s)return{force:0,stiffness:0};let i=r.config.beta_R/r.duration_R;if(o>=0)return{force:i*(s-o),stiffness:i};let c=r.config.mu_R*n;return{force:r.config.alpha_R*r.config.beta_R-c*o,stiffness:c}}function sr(r){return{damping:r.damping??.6,maxIter:r.maxIter??100,eps:r.eps??.01,crossPunish:r.crossPunish??dn,globalC:r.globalC??_e}}function ir(r,t,e,n,o){let{damping:s,maxIter:i,eps:c,crossPunish:a}=o,l=r.length,h=new Float64Array(t);for(let w=0;w<l;w++){let S=0,A=r[w];for(let T=0;T<t;T++){let v=h[T]+A[T].WL+A[T].margin_L;v>S&&(S=v)}for(let T=0;T<t;T++)h[T]=S+A[T].WR+A[T].margin_R;e[w]=S}let p=h.reduce((w,S)=>Math.max(w,S),0);if(p<=n)return!0;p=n/p;for(let w=0;w<l;w++)e[w]*=p;let f=new Float64Array(l),d=new Float64Array(l+1);function u(w){f.fill(0),d.fill(0);for(let S=0;S<t;S++){let A=r[0][S],T=nr(A,w[0],a);f[0]+=T.force,d[0]+=T.stiffness;for(let M=1;M<l;M++){let L=r[M-1][S],I=r[M][S],V=er(L,I,w[M-1],w[M]);f[M-1]-=V.force,f[M]+=V.force,d[M]+=V.stiffness}let v=r[l-1][S],N=or(v,w[l-1],n,a);f[l-1]-=N.force,d[l]+=N.stiffness}return f}let g=new Float64Array(l),x=new Float64Array(l);function m(){for(let S=0;S<l;S++){let A=S===0?0:d[S]/g[S-1],T=d[S]+d[S+1]+1e-4-A*d[S];if(!(T>0)||!Number.isFinite(T))throw new Error("Horizontal spring stiffness must produce a finite positive definite system");g[S]=T,x[S]=f[S]+(S===0?0:A*x[S-1])}x[l-1]/=g[l-1];for(let S=l-2;S>=0;S--)x[S]=(x[S]+d[S+1]*x[S+1])/g[S];return x}let y=0,b=0;for(;y<i;y++){let w=u(e);b=0;for(let A=0;A<w.length;A++){let T=Math.abs(w[A]);T>b&&(b=T)}if(b<c)break;let S=m();for(let A=0;A<l;A++)e[A]+=s*S[A]}return!1}function Vt(r,t,e,n,o,s,i){if(e.length!==r.length||n.length!==Math.max(0,e.length-1))throw new Error("Horizontal region state does not match its columns");if(e.length===0||t===0)return;let c=n.some(d=>d!==0),a,l,h=r,p=e;if(c){a=new Uint32Array(e.length),l=new Float64Array(e.length),h=[];for(let d=0;d<e.length;){let u=d;for(;u<n.length&&n[u];)u++;let g=h.length;for(let x=d;x<=u;x++)a[x]=g,l[x]=e[x]-e[d];if(d===u)h.push(r[d]);else{let x=e[u]-e[d];h.push(Array.from({length:t},(m,y)=>{let b=r[d][y],w=r[u][y];return{config:{alpha_L:b.config.alpha_L,alpha_R:w.config.alpha_R,mu_L:b.config.mu_L,mu_R:w.config.mu_R,beta_L:b.config.beta_L,beta_R:w.config.beta_R},box:b.box,time:b.time,duration_L:b.duration_L,duration_R:w.duration_R,WL:b.WL,WR:x+w.WR,margin_L:b.margin_L,margin_R:w.margin_R,fake:b.fake&&w.fake}}))}d=u+1}p=new Float64Array(h.length)}let f=ir(h,t,p,o,s);if(n.fill(1),i!==void 0){let d=0,u=0;for(let x=0;x<t;x++)d=Math.max(d,h[0][x].WL),u=Math.max(u,h[h.length-1][x].WR);let g=p[p.length-1]+u-p[0]+d;if(!f||g>=o*i){let x=d-p[0],m=o-g;for(let y=0;y<p.length;y++)p[y]+=x+(p.length>1?m*y/(p.length-1):0)}}if(c)for(let d=0;d<e.length;d++)e[d]=p[a[d]]+l[d]}function xn(r,t,e={},n=[],o){let s=sr(e),{mat:i,rows:c}=tr(r,s.globalC),a=new Float64Array(i.length),l=new Uint8Array(Math.max(0,i.length-1)),h=n.length>1?[...n].sort((p,f)=>p.end-p.start-(f.end-f.start)):n;for(let{start:p,end:f,hook:d}of h){if(p<0||f<p||f>=i.length)throw new Error("Horizontal layout registration references invalid columns");d({columns:i,rows:c,start:p,end:f,X:a,fixed:l,options:s})}Vt(i,c,a,l,t,s,o);for(let p=0;p<i.length;p++)for(let f of i[p])f.box.x=a[p]-f.box.anchor;return i}var Kt=class extends Error{line;requiredHeight;availableHeight;constructor(t,e,n){super(`Page cannot fit layout line ${t}: requires ${e}px, available ${n}px`),this.line=t,this.requiredHeight=e,this.availableHeight=n,this.name="PageLayoutError"}},st={width:794,height:1/0,marginTop:45,marginBottom:48,marginLeft:40,marginRight:40,lineGap:22,fillRatio:.5};function ae(r={}){let t=r.height??st.height,e={width:r.width??st.width,height:t<=0?1/0:t,marginTop:Math.max(0,r.marginTop??st.marginTop),marginBottom:Math.max(0,r.marginBottom??st.marginBottom),marginLeft:Math.max(0,r.marginLeft??st.marginLeft),marginRight:Math.max(0,r.marginRight??st.marginRight),lineGap:Math.max(0,r.lineGap??st.lineGap),fillRatio:r.fillRatio??st.fillRatio};if(!Number.isFinite(e.width)||e.width<=0)throw new Error(`Page width must be a positive finite number, got ${e.width}`);if(e.height!==1/0&&(!Number.isFinite(e.height)||e.height<=0))throw new Error(`Page height must be positive or Infinity, got ${e.height}`);if([e.marginTop,e.marginBottom,e.marginLeft,e.marginRight,e.lineGap].some(i=>!Number.isFinite(i)||i<0))throw new Error("Page margins and line gap must be finite non-negative numbers");let o=e.width-e.marginLeft-e.marginRight;if(o<=0)throw new Error(`Page horizontal margins leave no content width: ${o}px`);let s=e.height-e.marginTop-e.marginBottom;if(Number.isFinite(e.height)&&s<=0)throw new Error(`Page vertical margins leave no content height: ${s}px`);return e}function mn(r,t){let e=t.height-t.marginTop-t.marginBottom,n=[],o=new Array(r.length).fill(0),s=0,i=0,c=0,a=0,l=(h,p)=>{let f=h-i,d=p?Math.max(0,e-a-t.lineGap*(f-1)):0,u=t.lineGap+d/f,g=s+t.marginTop;for(let m=i;m<h;m++)o[m]=g,g+=r[m]+(m+1<h?u:0);let x=Number.isFinite(t.height)?t.height:g-s+t.marginBottom;n.push({bounds:{x:0,y:s,w:t.width,h:x},lineStart:i,lineEnd:h}),s+=x,i=h,c=0,a=0};for(let h=0;h<r.length;h++){let p=r[h];if(Number.isFinite(t.height)&&p>e+1e-6)throw new Kt(h,p,e);Number.isFinite(t.height)&&h>i&&c+t.lineGap+p>e+1e-6&&l(h,!0),c+=(h>i?t.lineGap:0)+p,a+=p}return r.length>i&&l(r.length,!1),{pages:n,lineTops:o}}var qo={start:0,end:-1,wholeLine:!1};function yn(r){let t=new Set,e=n=>{t.add(n);for(let o of n.groups)for(let s of o.members)e(s)};return e(r),n=>{for(let o=n;o;o=o.parent)if(t.has(o))return o;return n}}function Qo(r,t){for(let e=t;e;){let n=r.columnOf(e);if(n>=0)return n;let o=e instanceof D?e.foldedInto:void 0;e=o&&F(o)?o:void 0}return-1}function gn(r,t,e,n){if(!t)return{start:0,end:r.columns.length-1,wholeLine:!0};if(typeof t[0]=="number")return{start:Math.max(0,t[0]),end:Math.min(r.columns.length-1,t[1]),wholeLine:!1};let[o,s]=t;if(o.layoutLine>s.layoutLine&&([o,s]=[s,o]),r.index<o.layoutLine||r.index>s.layoutLine)return qo;let i=e&&n(e);if(i&&(n(o.track)!==i||n(s.track)!==i))throw new Error("Range endpoints must belong to the selected track");let c=o.layoutLine<r.index?0:Qo(r,o),a=s.layoutLine>r.index?r.columns.length-1:Qo(r,s);return c<0||a<0?qo:{start:Math.min(c,a),end:Math.max(c,a),wholeLine:!1}}function bn(r,t,e,n){if(!r)return[];let{start:o,end:s}=gn(r,t,e,n),i=r.columns.slice(o,s+1);if(!e)return i;let c=n(e),a=l=>l.track===c;return i.every(l=>l.every(a))?i:i.map(l=>l.filter(a))}var ts=.75,he=new WeakMap;function Q(r,t=!1){let{box:e}=r,n=he.get(r);if(!n)return e;let o=t?n.contentTop:n.top,s=t?0:n.bottom;return{x:e.x,y:e.y+o,w:e.w,h:e.h-o+s}}function ve(r,t){let e=1/0,n=1/0,o=-1/0,s=-1/0;for(let i of t)e=Math.min(e,i.x),n=Math.min(n,i.y),o=Math.max(o,i.x+i.w),s=Math.max(s,i.y+i.h);return Number.isFinite(e)?(r.x=e,r.y=n,r.w=o-e,r.h=s-n,!0):(r.x=r.y=r.w=r.h=0,!1)}function pe(r,t){if(r.springConfig??={},r.decorations&&he.delete(r),r.decorations=[],r.ports={},r.box.x=r.box.y=0,r.prepareLayout(t),r.addon)for(let[e,n]of Object.entries(r.addon)){let o=t.decorationHandlers.get(e);if(!o)continue;let s=o(r,n,t);s&&r.decorations.push(s)}rr(r),r.finalizeLayout?.(t)}function An(r,t,e={}){let n=r.attachments.filter(ut),o=ae(r.page),s=o.width-o.marginLeft-o.marginRight,i=o.marginLeft,c=yn(r.rootTrack),a=new Map(n.map((L,I)=>[L,I])),l=lr(n),h=[];if(n.length){for(let L of r.astToTemporal.values())if(L.some(I=>I.placementOffset?.x||I.placementOffset?.y)){h=[...new Set([...r.astToTemporal.values()].flat().filter(F))];break}}let p=new Map,f=(L,I=!1)=>{let V=p.get(L);return V&&Jo(V,I)};t={...t,layoutSubdomain(L,I,V,J){let tt=es(I,t),lt=new Set(I.flat()),z=j=>{for(let nt=j;nt&&nt!==L;nt=nt.foldedInto)if(lt.has(nt))return!0;return!1},X=J.filter(ut).filter(j=>!j.endPoints?.length);for(let j of l.get(L)??[])!p.has(j)&&j.endPoints.every(z)&&X.push(j);X.sort((j,nt)=>a.get(j)-a.get(nt));let Z=ar(I,tt,V,X,t,f,h.length?h.filter(z):h,L);return X.forEach((j,nt)=>p.set(j,Z.items[nt])),{width:tt.width,height:Z.height,positions:Z.positions}}};let d=cr(r),u=[];for(let L of d)for(let I of L.columns)for(let V of I)u.push(V),pe(V,t);let g=n.filter(L=>!p.has(L)),x=d.map((L,I)=>Tn(L.columns,I,e)),m=x.map(L=>L.view);for(let L of g)L.prepareHorizontal?.(m,t);for(let L of x){L.layout(s,o.fillRatio);for(let I of L.view.columns)for(let V of I)V.box.x+=i}for(let L of u){let I=d[L.layoutLine];os(I.hostExtents,L)}let y=pr(d.length,u,e.rowGap),b=()=>{let L=[],I=d.map((z,X)=>{let Z=ss(z,r.rootTrack,y[X]);return L.push(Z.height),Z.axes}),V,J;try{({pages:V,lineTops:J}=mn(L,o))}catch(z){if(!(z instanceof Kt))throw z;let X=d[z.line],Z=1/0,j=-1/0;for(let nt of X?.columns??[])for(let ne of nt)Z=Math.min(Z,ne.ast.sourceSpan.start),j=Math.max(j,ne.ast.sourceSpan.end);throw Number.isFinite(Z)?k.error.PageOverflow(z.requiredHeight,z.availableHeight,{start:Z,end:j}):z}let tt=(z,X)=>(J[z]??0)+(I[z]?.get(X)??0);for(let z of u)z.box.y=tt(z.layoutLine,z.track)-z.box.visualAxis,z.onPlaced?.();let lt={...t,width:s,originX:i,pages:V.map(z=>z.bounds),lines:m,getVisualAxis:(z,X)=>tt(z,c(X)),getHostExtent:(z,X)=>d[z]?.hostExtents.get(c(X)),getRangeColumns:(z,X,Z)=>bn(m[z],X,Z,c)};return{pages:V,attachmentContext:lt}},w=b(),S=Cn(g,w.attachmentContext,d,c,f,h);S.needsRelayout&&(w=b(),S=Cn(g,w.attachmentContext,d,c,f,h));let A=w.pages,T=0,v=n.map(L=>{let I=p.get(L),{geometry:V,box:J}=I?Jo(I):S.items[T++];return{box:J,regions:V.regions,layer:L.layer,sourceSpan:L.sourceSpan,paint(tt){V.paint(tt)}}}),N={x:0,y:0,w:0,h:0};function*M(){for(let L of A)yield L.bounds;for(let L of u)yield Q(L);for(let L of v)yield L.box}return ve(N,M()),{diagnostics:r.diagnostics,objects:u,attachments:v,bounds:N,lineCount:d.length,pages:A}}function rr(r){if(r.decorations.length===0)return;let t=0,e=-1/0,n=0,o=-1/0;for(let i of["above","below"]){let c=i==="above",a=r.decorations.length===1?r.decorations:r.decorations.filter(f=>f[i]);a.length>1&&a.sort((f,d)=>f[i].order-d[i].order);let l=c?0:r.ports["decoration.below"]?.y??r.box.h,h=c?-1/0:r.box.h,p=h;for(let f of a){let d=f[i];if(!d)continue;let u=Math.max(0,d.height??0);!c&&!f.paint&&(l=Math.max(l,p));let g=c?l-(d.gap??0)-u:l+(d.gap??0);d.place?.(g),l=c?g:g+u,n=Math.min(n,g),h=c?Math.max(h,g+u):l,f.paint&&(t=Math.min(t,g),p=c?Math.max(p,g+u):l)}o=Math.max(o,h),e=Math.max(e,p)}r.box.h=e;let s=Math.max(0,o-e);(n!==0||s!==0)&&he.set(r,{top:n,bottom:s,contentTop:t})}function cr(r){let t=()=>({columns:[],hostExtents:new Map,attachmentExtents:new Map}),e=[],n=t();for(let o of r.columns){let s=[];for(;e.length<o[0].layoutLine;)e.push(n),n=t();for(let i of o)F(i)&&s.push(i);s.length&&n.columns.push(s)}return(n.columns.length>0||e.length===0)&&e.push(n),e}function le(r,t,e){r.top=Math.min(r.top,t),r.bottom=Math.max(r.bottom,e)}function Sn(r,t,e,n){let o=r.get(t);o?le(o,e,n):r.set(t,{top:e,bottom:n})}function Tn(r,t,e={},n=!1){let o=[],s=new Map,i=new Map;for(let a=0;a<r.length;a++)for(let l of r[a]){s.set(l,a),Ne(l.springConfig,e.globalC);let h=i.get(l.track);h?h.push(l):i.set(l.track,[l])}let c={index:t,columns:r,trackRuns:i,columnOf:a=>s.get(a)??-1,registerHorizontalLayoutHook(a,l,h){let p=s.get(a),f=s.get(l);p===void 0||f===void 0||o.push({start:Math.min(p,f),end:Math.max(p,f),hook:h})}};for(let a of r)for(let l of a)l.prepareHorizontal?.(c);return{view:c,layout(a,l){let h=r.map(p=>p.map(f=>{let d=ke(f.springConfig,f.box,f,e.globalC);return n&&(d.margin_L=d.margin_R=0),d}));return xn(h,a,e,o,l),h}}}function Yt(r,t){return r.length===0?0:es(r.map(e=>[e]),t).width}function es(r,t){for(let s of r)for(let i of s)pe(i,t);let e=Tn(r,r[0][0].layoutLine,{},!0),n=1/0,o=-1/0;for(let s of e.layout(1/0))for(let i of s){let c=i.box.x+i.box.anchor;n=Math.min(n,c-i.WL),o=Math.max(o,c+i.WR)}for(let s of r)for(let i of s)i.box.x-=n;return{width:o-n,view:e.view}}function ar(r,{width:t,view:e},n,o,s,i,c,a){let l=r.flat(),h={hostExtents:new Map,attachmentExtents:new Map},p=0;for(let N of l)os(h.hostExtents,N),p=Math.max(p,N.ast.size*ts);let f=l.map(N=>({x:N.box.x,y:0})),d=()=>{let N=ss(h,n,p);return l.forEach((M,L)=>{M.box.y=f[L].y=N.axes.get(M.track)-M.box.visualAxis,M.onPlaced?.()}),N},u=d();if(o.length===0)return{height:u.height,positions:f,items:[]};let g=yn(n),x=[],m=[];x[e.index]=h,m[e.index]=e;let y=()=>Cn(o,{...s,width:t,originX:0,pages:[],lines:m,getVisualAxis:(N,M)=>u.axes.get(g(M))??0,getHostExtent:(N,M)=>x[N]?.hostExtents.get(g(M)),getRangeColumns:(N,M,L)=>bn(m[N],M,L,g)},x,g,i,c,a),b=y();b.needsRelayout&&(u=d(),b=y());let w=l[0],S={x:w.box.x,y:w.box.y},A=b.layoutItems&&ns(w,a),T=A&&(A.x!==0||A.y!==0)?{x:S.x-A.x,y:S.y-A.y}:S,v=b.items.map((N,M)=>({...N,reference:w,position:S,...b.layoutItems&&{layout:{...b.layoutItems[M],position:T}}}));return{height:u.height,positions:f,items:v}}function lr(r){let t=new Map;for(let e of r){let[n,...o]=e.endPoints??[];for(let s=n?.foldedInto;s;s=s.foldedInto){let i=s;if(!o.every(a=>hr(i,a)))continue;let c=t.get(s);c?c.push(e):t.set(s,[e])}}return t}function hr(r,t){for(let e=t.foldedInto;e;e=e.foldedInto)if(e===r)return!0;return!1}function Jo(r,t=!1){let e=t?r.layout??r:r,{position:n,geometry:o,box:s}=e,i=r.reference.box.x-n.x,c=r.reference.box.y-n.y;if(i===0&&c===0)return e;let a=l=>({...l,x:l.x+i,y:l.y+c});return{box:a(s),geometry:{regions:o.regions.map(a),occupancy:o.occupancy?.map(a),paint:l=>o.paint(new Gt(l,i,c))}}}function pr(r,t,e){if(e!==void 0)return new Array(r).fill(e);let n=new Array(r).fill(0),o=0;for(let s of t){let i=s.ast.size*ts;i>n[s.layoutLine]&&(n[s.layoutLine]=i),i>o&&(o=i)}for(let s=0;s<r;s++)n[s]||=o;return n}function ns(r,t){let e=0,n=0;for(let o=r;o&&o!==t;o=o.foldedInto)e+=o.placementOffset?.x??0,n+=o.placementOffset?.y??0;return{x:e,y:n}}function Cn(r,t,e,n,o,s,i){if(r.length===0)return{items:[],needsRelayout:!1};let c=[];for(let p of s){let{x:f,y:d}=ns(p,i);(f!==0||d!==0)&&c.push({node:p,x:f,y:d,boxX:p.box.x,boxY:p.box.y})}let a=c.length>0||r.some(p=>p.placementOffset?.x||p.placementOffset?.y),l;if(a){for(let{node:p,x:f,y:d}of c)p.box.x-=f,p.box.y-=d;try{l=wn(r,{...t,layoutOnly:!0},e,n,o,!0)}finally{for(let{node:p,boxX:f,boxY:d}of c)p.box.x=f,p.box.y=d}}else l=wn(r,t,e,n,o,!0);if(!a)return l;let h;return{needsRelayout:l.needsRelayout,layoutItems:l.items,get items(){return h??=wn(r,t,e,n,o,!1).items}}}function wn(r,t,e,n,o,s){let i=new Map,c=[],a=!1;function l(d){let u=i.get(d);return u||(u=o(d,t.layoutOnly),u&&i.set(d,u)),u}function h(d,u,g){let x=t.lines[d],m=g===void 0?new Map:void 0,y;if(!x)return m;let b=(M,L,I)=>{m?Sn(m,M,L,I):y?le(y,L,I):y={top:L,bottom:I}},{start:w,end:S,wholeLine:A}=gn(x,u,g,n),T=g&&n(g),v=A?t.originX:1/0,N=A?t.originX+t.width:-1/0;for(let M=w;M<=S;M++)for(let L of x.columns[M]){if(T&&L.track!==T)continue;A||(L.box.x<v&&(v=L.box.x),L.box.x+L.box.w>N&&(N=L.box.x+L.box.w));let I=he.get(L),V=I?.top??0,J=L.box.y+V-t.getVisualAxis(d,L.track);b(L.track,J,J+(L.box.h-V+(I?.bottom??0)))}for(let M of c[d]??[])T&&M.track!==T||M.right<=v||M.left>=N||b(M.track,M.top,M.bottom);return m??y}let p={...t,getRangeExtents:h,getAttachmentOccupancy(d){let u=l(d)?.geometry;return u&&(u.occupancy??u.regions)},getAttachmentBox(d){let u=l(d);if(!u)throw new Error("Layout attachment dependency has not been measured");return u.box},getContentBounds(d){let u=[];for(let x of d.nodes)F(x)&&(x.box.w>0||x.box.h>0)&&u.push(Q(x,!0));for(let x of d.attachments){if(!ut(x))continue;let m=l(x);if(!m&&!r.includes(x))continue;let y=m?.box??p.getAttachmentBox(x);(y.w>0||y.h>0)&&u.push(y)}let g={x:0,y:0,w:0,h:0};return ve(g,u)?g:void 0}};return{items:r.map(d=>{let u=d.createGeometry(p),g={x:0,y:0,w:0,h:0};ve(g,u.regions);let x={geometry:u,box:g};i.set(d,x);for(let m of u.occupancy??u.regions){if(m.line===void 0)continue;let y=e[m.line],b=n(m.track),w=m.y-t.getVisualAxis(m.line,b),S=w+m.h,A=y.hostExtents.get(b),T=y.attachmentExtents.get(b);s&&(w<Math.min(A?.top??1/0,T?.top??1/0)||S>Math.max(A?.bottom??-1/0,T?.bottom??-1/0))&&(a=!0),s&&Sn(y.attachmentExtents,b,w,S),(c[m.line]??=[]).push({track:b,left:m.x,right:m.x+m.w,top:w,bottom:S})}return x}),needsRelayout:a}}function os(r,t){let e=he.get(t),n=e?.top??0,o=t.box.h-n+(e?.bottom??0),s=n-t.box.visualAxis;Sn(r,t.track,s,s+o)}function ss(r,t,e){let n=new Map,o=a=>{let l=r.hostExtents.get(a),h=r.attachmentExtents.get(a),p=l?{top:l.top,bottom:l.bottom}:null;h&&(p?le(p,h.top,h.bottom):p={top:h.top,bottom:h.bottom});let f=[];for(let u of a.groups){let g=u.members.map(o);if(g.every(y=>y===null))continue;let x=u.measure(g,e),m=null;for(let y of x){if(!y)continue;let b=y.offset+y.extent.top,w=y.offset+y.extent.bottom;m?le(m,b,w):m={top:b,bottom:w}}m&&f.push({group:u,placements:x,extent:m})}let d=(u,g)=>{p??={top:0,bottom:0};for(let x=0;x<u.group.members.length;x++){let m=u.placements[x];m&&n.set(u.group.members[x],g+m.offset)}le(p,g+u.extent.top,g+u.extent.bottom)};for(let u of f)u.group.place||d(u,0);for(let u of f){let g=u.group.place;if(!g)continue;d(u,g(p??{top:0,bottom:0},u.extent,e))}return p},s=o(t),i=new Map;if(!s)return{axes:i,height:0};let c=(a,l)=>{i.set(a,l);for(let h of a.groups)for(let p of h.members){let f=n.get(p);f!==void 0&&c(p,l+f)}};return c(t,-s.top),{axes:i,height:s.bottom-s.top}}var Me=class{min=1/0;max=-1/0;add(t){t<this.min&&(this.min=t),t>this.max&&(this.max=t)}};function En(r,t,e,n,o,s){if(!(r>0&&r<1))return;let i=1-r;s.add(i*i*i*t+3*i*i*r*e+3*i*r*r*n+r*r*r*o)}function is(r,t,e,n,o){o.add(r),o.add(n);let s=-r+3*t-3*e+n,i=2*(r-2*t+e),c=t-r;if(Math.abs(s)<1e-12){Math.abs(i)>1e-12&&En(-c/i,r,t,e,n,o);return}let a=i*i-4*s*c;if(a<0)return;let l=Math.sqrt(a);En((-i+l)/(2*s),r,t,e,n,o),En((-i-l)/(2*s),r,t,e,n,o)}function rs(r,t,e,n){n.add(r),n.add(e);let o=r-2*t+e;if(Math.abs(o)<1e-12)return;let s=(r-t)/o;if(!(s>0&&s<1))return;let i=1-s;n.add(i*i*r+2*i*s*t+s*s*e)}function Ct(r){let t=new Me,e=new Me,n=0,o=0,s=0,i=0;for(let c of r){if(c.op==="Z"){n=s,o=i;continue}c.op==="C"?(is(n,c.cx1,c.cx2,c.x,t),is(o,c.cy1,c.cy2,c.y,e)):c.op==="Q"?(rs(n,c.cx,c.x,t),rs(o,c.cy,c.y,e)):(t.add(c.x),e.add(c.y),c.op==="M"&&(s=c.x,i=c.y)),n=c.x,o=c.y}return Number.isFinite(t.min)?{x:t.min,y:e.min,w:t.max-t.min,h:e.max-e.min}:{x:0,y:0,w:0,h:0}}var fr=54.2813,cs=87.37505,Re=72.8125,ls=93.6719,ur=-27.4688,hs=-7.9375,dr=hs+ls,xr=[{op:"M",x:28.1406,y:86.06255},{op:"C",cx1:28.1406,cy1:86.06255,cx2:30.4531,cy2:84.07815,x:32.7656,y:81.42185},{op:"C",cx1:33.7656,cy1:80.43755,cx2:34.0938,cy2:79.10935,x:34.0938,y:78.10935},{op:"C",cx1:34.0938,cy1:77.12505,cx2:33.7656,cy2:76.45315,x:33.0938,y:75.79685},{op:"L",x:29.4531,y:72.15625},{op:"C",cx1:28.7969,cy1:71.50005,cx2:28.4688,cy2:70.82815,x:28.4688,y:70.17185},{op:"C",cx1:28.4688,cy1:68.84375,cx2:29.4531,cy2:68.18755,x:29.4531,y:68.18755},{op:"C",cx1:29.4531,cy1:68.18755,cx2:47.6563,cy2:47.00005,x:50.6406,y:43.68755},{op:"C",cx1:53.2969,cy1:40.04685,cx2:54.2813,cy2:36.40625,x:54.2813,y:33.09375},{op:"C",cx1:54.2813,cy1:26.14065,cx2:50.3125,cy2:19.85935,x:47.3281,y:17.21875},{op:"L",x:31.4375,y:1.32812},{op:"C",cx1:30.4531,cy1:.32812,cx2:29.7969,cy2:0,x:28.7969,y:0},{op:"C",cx1:27.1406,cy1:0,cx2:25.8125,cy2:1.32812,x:25.8125,y:1.32812},{op:"C",cx1:25.8125,cy1:1.32812,cx2:23.5,cy2:3.3125,x:21.1875,y:5.95312},{op:"C",cx1:20.1875,cy1:6.95313,cx2:19.8594,cy2:7.9375,x:19.8594,y:8.9375},{op:"C",cx1:19.8594,cy1:9.92188,cx2:20.1875,cy2:10.59375,x:20.8594,y:11.25},{op:"L",x:24.5,y:14.89063},{op:"C",cx1:25.1563,cy1:15.5625,cx2:25.4844,cy2:16.21875,x:25.4844,y:16.875},{op:"C",cx1:25.4844,cy1:18.20315,cx2:24.5,cy2:19.20315,x:24.5,y:19.20315},{op:"C",cx1:24.5,cy1:19.20315,cx2:6.625,cy2:40.37505,x:3.64063,y:43.68755},{op:"C",cx1:1,cy1:47.32815,cx2:0,cy2:50.96875,x:0,y:54.28125},{op:"C",cx1:0,cy1:61.23435,cx2:3.96875,cy2:67.51565,x:6.95313,y:70.17185},{op:"L",x:22.8438,y:86.06255},{op:"C",cx1:23.8281,cy1:87.04685,cx2:24.8281,cy2:87.37505,x:25.4844,y:87.37505},{op:"C",cx1:27.1406,cy1:87.37505,cx2:28.1406,cy2:86.06255,x:28.1406,y:86.06255}],mr=[{op:"M",x:111.8751,y:21.5156},{op:"C",cx1:112.5313,cy1:20.1875,cx2:113.5313,cy2:18.2031,x:113.5313,y:16.875},{op:"C",cx1:113.5313,cy1:12.23438,cx2:109.8907,cy2:8.9375,x:105.2501,y:8.9375},{op:"C",cx1:103.9219,cy1:8.9375,cx2:101.6094,cy2:9.26563,x:100.2813,y:10.25},{op:"L",x:72.1563,y:31.7656},{op:"L",x:72.1563,y:28.4531},{op:"C",cx1:72.1563,cy1:16.54688,cx2:66.8594,cy2:8.26563,x:58.2501,y:.98437},{op:"C",cx1:57.2657,cy1:.32812,cx2:55.9376,cy2:0,x:55.2657,y:0},{op:"C",cx1:53.6251,cy1:0,cx2:52.9532,cy2:.98437,x:52.9532,y:.98437},{op:"C",cx1:51.6251,cy1:2.3125,cx2:49.3126,cy2:4.29687,x:48.3282,y:5.625},{op:"C",cx1:47.3282,cy1:6.9375,cx2:47.0001,cy2:7.9375,x:47.0001,y:8.9375},{op:"C",cx1:47.0001,cy1:9.92188,cx2:47.3282,cy2:10.57813,x:47.6563,y:11.25},{op:"C",cx1:49.9688,cy1:13.5625,cx2:50.9688,cy2:16.21875,x:50.9688,y:18.8594},{op:"C",cx1:50.9688,cy1:24.8125,cx2:46.3282,cy2:30.1094,x:41.0469,y:30.1094},{op:"C",cx1:39.3907,cy1:30.1094,cx2:37.7344,cy2:29.4531,x:36.4063,y:28.4531},{op:"L",x:12.9063,y:10.57813},{op:"C",cx1:11.5782,cy1:9.59375,cx2:9.5938,cy2:8.9375,x:7.9375,y:8.9375},{op:"C",cx1:3.6407,cy1:8.9375,cx2:0,cy2:12.57813,x:0,y:16.875},{op:"C",cx1:0,cy1:18.2031,cx2:.6563,cy2:20.1875,x:1.3125,y:21.5156},{op:"L",x:49.9688,y:90.3594},{op:"C",cx1:51.2969,cy1:92.3438,cx2:54.2813,cy2:93.6719,x:56.5938,y:93.6719},{op:"C",cx1:58.9063,cy1:93.6719,cx2:61.8907,cy2:92.3438,x:63.2188,y:90.3594},{op:"L",x:111.8751,y:21.5156}];function as(r,t,e,n,o,s,i,c){let a=h=>o+(c?e-h:h)*i,l=h=>s+(c?n-h:h)*i;for(let h of t)h.op==="Z"?r.push(h):h.op==="C"?r.push({op:"C",cx1:a(h.cx1),cy1:l(h.cy1),cx2:a(h.cx2),cy2:l(h.cy2),x:a(h.x),y:l(h.y)}):h.op==="Q"?r.push({op:"Q",cx:a(h.cx),cy:l(h.cy),x:a(h.x),y:l(h.y)}):r.push({op:h.op,x:a(h.x),y:l(h.y)})}function ps(r,t,e){let n=e==="up"||e==="down",o=Math.max(1,Math.round(r/(t*.3))),s=n?Math.max(0,o-1):o,i=n?dr+Re*s:cs+Re*(s-1),c=r/i,a=[];for(let p=0;p<s;p++)as(a,xr,fr,cs,0,p*Re*c,c,e==="");n&&as(a,mr,113.5313,ls,ur*c,(s*Re+hs)*c,c,!1);let l=Ct(a);return e!=="up"?{commands:a,bounds:l}:{commands:a.map(p=>p.op==="Z"?p:p.op==="C"?{op:"C",cx1:l.x+l.w-(p.cx1-l.x),cy1:r-p.cy1,cx2:l.x+l.w-(p.cx2-l.x),cy2:r-p.cy2,x:l.x+l.w-(p.x-l.x),y:r-p.y}:p.op==="Q"?{op:"Q",cx:l.x+l.w-(p.cx-l.x),cy:r-p.cy,x:l.x+l.w-(p.x-l.x),y:r-p.y}:{op:p.op,x:l.x+l.w-(p.x-l.x),y:r-p.y}),bounds:{x:l.x,y:r-l.y-l.h,w:l.w,h:l.h}}}function yr(r){let t=r,e=r.ast;return(e.callName==="up"||e.callName==="down")&&Array.isArray(t.members)&&Array.isArray(e.contents)?t:null}var Ln=class extends _{static def={name:["arp","arpeggio"],description:"\u7436\u97F3",details:`~~~jpfun
|
|
7
7
|
@arp({1 ^ 3 ^ 5}, direction=up)
|
|
8
8
|
~~~
|
|
9
|
-
\u7ED9\u548C\u5F26\u7ED8\u5236\u7436\u97F3\u8BB0\u53F7\uFF0C\u64AD\u653E\u65F6\u6309\u65B9\u5411\u9519\u5F00\u6210\u5458\u8D77\u70B9\u5E76\u4FDD\u6301\u5171\u540C\u7EC8\u70B9\u3002\u590D\u5408\u6210\u5458\u7684\u5185\u90E8\u97F3\u7B26\u6309\u6BD4\u4F8B\u538B\u7F29\u5230\u5269\u4F59\u65F6\u503C\uFF0C\u88C5\u9970\u97F3\u5728\u786E\u5B9A\u540E\u7684\u533A\u95F4\u5185\u5C55\u5F00\u3002`,allowExtraArgs:!1,args:[{name:"content",description:"\u7531 `up` / `down` \u5806\u53E0\u5F62\u6210\u7684\u548C\u5F26",type:"content",default:null},{name:"direction",description:"\u7A7A\u503C\u4ECE\u4F4E\u5230\u9AD8\u3001\u4E0D\u753B\u7BAD\u5934\uFF1B`up` \u4ECE\u4F4E\u5230\u9AD8\u3001\u9876\u7AEF\u5E26\u7BAD\u5934\uFF1B`down` \u4ECE\u9AD8\u5230\u4F4E\u3001\u5E95\u7AEF\u5E26\u7BAD\u5934",type:"string",default:""}]};content;direction;size;get children(){return[this.content]}constructor(t,e,n,o=null){super(t,o);let[s,
|
|
9
|
+
\u7ED9\u548C\u5F26\u7ED8\u5236\u7436\u97F3\u8BB0\u53F7\uFF0C\u64AD\u653E\u65F6\u6309\u65B9\u5411\u9519\u5F00\u6210\u5458\u8D77\u70B9\u5E76\u4FDD\u6301\u5171\u540C\u7EC8\u70B9\u3002\u590D\u5408\u6210\u5458\u7684\u5185\u90E8\u97F3\u7B26\u6309\u6BD4\u4F8B\u538B\u7F29\u5230\u5269\u4F59\u65F6\u503C\uFF0C\u88C5\u9970\u97F3\u5728\u786E\u5B9A\u540E\u7684\u533A\u95F4\u5185\u5C55\u5F00\u3002`,allowExtraArgs:!1,args:[{name:"content",description:"\u7531 `up` / `down` \u5806\u53E0\u5F62\u6210\u7684\u548C\u5F26",type:"content",default:null},{name:"direction",description:"\u7A7A\u503C\u4ECE\u4F4E\u5230\u9AD8\u3001\u4E0D\u753B\u7BAD\u5934\uFF1B`up` \u4ECE\u4F4E\u5230\u9AD8\u3001\u9876\u7AEF\u5E26\u7BAD\u5934\uFF1B`down` \u4ECE\u9AD8\u5230\u4F4E\u3001\u5E95\u7AEF\u5E26\u7BAD\u5934",type:"string",default:""}]};content;direction;size;get children(){return[this.content]}constructor(t,e,n,o=null){super(t,o);let[s,i]=this.getArgValue(e,n),c="";i!==""&&i!=="up"&&i!=="down"?n.diagnostics.push(new P("W_ARPEGGIO_INVALID_DIRECTION","@arp \u7684 direction \u53EA\u80FD\u662F up \u6216 down\uFF0C\u5DF2\u56DE\u9000\u5230\u65E0\u7BAD\u5934\u4E0A\u884C\u7436\u97F3",t)):c=i,this.content=s,this.direction=c,this.size=n.variables.fontsize,s.parent=this}loweringEnter(t,e){let n=t.isolateFromLoweringGroups(()=>{let s=t.trackedEvents(this.content,new O,e).flat();if(s.length!==1||!s[0].box)throw new C("E_ARPEGGIO_INVALID_CONTENT","@arp \u7684\u5185\u5BB9\u5FC5\u987B\u6070\u597D\u4EA7\u751F\u4E00\u4E2A\u540C\u8F68\u548C\u5F26",this.content.sourceSpan);return s[0]}),o=yr(n);if(!o||o.members.length<2||o.members.some(s=>s.track!==e))throw new C("E_ARPEGGIO_INVALID_CONTENT","@arp \u53EA\u63A5\u53D7\u81F3\u5C11\u5305\u542B\u4E24\u4E2A\u6210\u5458\u7684\u540C\u8F68 @up/@down \u6298\u53E0\u4F53",this.content.sourceSpan);return[new _n(this,o)]}toString(t){let e=this.direction?`, direction=${this.direction}`:"";return`@arp(${this.content.toString(t)}${e})`}},fs=Ln,_n=class extends D{host;playbackMembers;hostX=0;markX=0;markCommands=[];constructor(t,e){super(),this.ast=t,this.host=e;let n=e.ast.contents.length,o=[...e.members.slice(n).reverse(),e.members[0],...e.members.slice(1,n)];this.playbackMembers=t.direction==="down"?o.reverse():o,this.T.copyFrom(e.T),this.mergeKey=e.mergeKey,this.initLayoutBox(),e.addon&&(this.addon={...e.addon}),e.addon=void 0,e.foldedInto=this}onTimeState(t){this.host.t.copyFrom(this.t),this.host.T.copyFrom(this.T),this.host.track=this.track,this.host.layoutLine=this.layoutLine;let e=this.host.onTimeState?.(t);return this.T.copyFrom(this.host.T),e}prepareHorizontal(t){this.host.prepareHorizontal?.(t)}prepareLayout(t){this.addon&&(this.host.addon=this.addon,this.addon=void 0),pe(this.host,t),this.springConfig={...this.host.springConfig,...this.springConfig};let e=this.ast.size,n=e*.16,o=Q(this.host,!0),s=Q(this.host),{commands:i,bounds:c}=ps(o.h,e,this.ast.direction);this.markCommands=i,this.markX=-c.x,this.hostX=c.w+n,this.box.w=this.hostX+this.host.box.w,this.box.h=s.h,this.box.anchor=this.hostX+this.host.box.anchor,this.box.visualAxis=this.host.box.visualAxis-s.y;for(let a in this.host.ports){let l=this.host.ports[a];this.ports[a]={x:this.hostX+l.x,y:l.y-s.y}}}onPlaced(){this.host.box.x=this.box.x+this.hostX,this.host.box.y=this.box.y-(Q(this.host).y-this.host.box.y),this.host.onPlaced?.()}emitPlayback(t){t.play(this.host);let e=t.end.clone().sub(t.start),n=new O(1,8),o=e.clone().div(2).div(this.playbackMembers.length-1);n.compare(o)>0&&n.copyFrom(o);let s=new Map(this.playbackMembers.map((c,a)=>[c,a])),i=this;t.defer(c=>{let a;for(let l=c.spans.length-1;l>=0;l--){let h=c.spans[l];if(h.origins.some(p=>p.node===i)){a=h.origins[0];break}}if(a)for(let l of c.spans){if(l.origins[0]!==a)continue;let h=l.origins.find(u=>s.has(u.node))?.node,p=h?s.get(h):void 0;if(!p)continue;let f=n.clone().mul(p),d=e.clone().sub(f).div(e);l.start.sub(t.start).mul(d).add(t.start).add(f),l.end.sub(t.start).mul(d).add(t.start).add(f)}})}paint(t){let e=this.box.x,n=Q(this.host,!0).y;t.drawPath(this.markCommands,{fill:"#000"},{x:e+this.markX,y:n,scaleX:1,scaleY:1}),this.host.paint(t);for(let o of this.host.decorations)o.paint?.(t)}};var Nn=class extends _{static def={name:["bar","|"],description:"\u5C0F\u8282\u7EBF",details:`~~~jpfun
|
|
10
10
|
@bar(0, length=1.25em)
|
|
11
11
|
~~~
|
|
12
|
-
\u6709\u8BED\u6CD5\u7CD6\u7B80\u5199\uFF0C\u89C1 type \u53C2\u6570\u7684\u8BF4\u660E\u3002`,allowExtraArgs:!1,args:[{name:"type",description:"0\uFF1A\u666E\u901A\u7EBF `|`\uFF1B1\uFF1A\u7EC8\u6B62\u7EBF `||`\uFF08\u5DE6\u7EC6\u53F3\u7C97\uFF09\uFF1B2\uFF1A\u53CD\u590D\u8D77\u70B9 `|:`\uFF1B3\uFF1A\u53CD\u590D\u7EC8\u70B9 `:|`\uFF1B4\uFF1A\u5DE6\u53F3\u53CD\u590D `:|:`",type:"number",default:0},{name:"length",description:"\u5C0F\u8282\u7EBF\u9AD8\u5EA6",type:"length",default:{value:1.25,unit:"em"}}]};static deSugarAtom(t,e,n){let o=e,s=0,r=t.slice(o,o+2);if(r==="||")s=1,o+=2;else if(r==="|:")s=2,o+=2;else if(r===":|")t[o+2]===":"?(s=4,o+=3):(s=3,o+=2);else if(t[o]==="|")s=0,o+=1;else return null;let c=new Map;return c.set("type",s),{next:o,node:{kind:"call",typed:!0,name:"bar",args:c,span:{start:e,end:o},syntaxKind:"atom"}}}type;size;constructor(t,e,n,o=null){super(t,o);let[s,r]=this.getArgValue(e,n);this.type=s,this.size=n.length2px(r)}loweringEnter(){return[this.type>=2?new bn(this):new _e(this)]}toString(){return`@bar(${this.type}, ${this.size}px)`}},jo=yn,_e=class extends W{lines=[];repeatDots=[];constructor(t){super(),this.ast=t,this.mergeKey=U,this.initLayoutBox(),this.springConfig={alpha_L:128,alpha_R:128}}prepareHorizontal(t){let e=this;for(;e.foldedInto;)e=e.foldedInto;if(!F(e))return;let n=t.trackRuns.get(e.track),o=n?.indexOf(e)??-1;!n||o<0||t.registerHorizontalLayoutHook(e,e,({columns:s,start:r})=>{let c=s[r].find(f=>f.time===e);if(!c)return;let a=f=>{let d=t.columnOf(f);return d<0?void 0:s[d].find(u=>u.time===f)},l=o>0?a(n[o-1]):void 0;l&&(l.config.mu_R*=4,c.config.mu_L*=4);let h=n[o+1],p=h?a(h):void 0;p&&h.mergeKey!==U&&(c.config.mu_R*=4,p.config.mu_L*=4)})}prepareLayout(){let{type:t,size:e}=this.ast;this.lines.length=0;let n=[],o=e,s=Math.max(1,e*.065),r=s*2.6,c=s*1.8,a=s*.8,l=c+a,h=t===3||t===4,p=t===2||t===4,f=h?a*2+l:0;if(t===1||t===3||t===4?(this.lines.push({x:f,w:s}),f+=s+c,this.lines.push({x:f,w:r}),f+=r):t===2?(this.lines.push({x:f,w:r}),f+=r+c,this.lines.push({x:f,w:s}),f+=s):(this.lines.push({x:f,w:s}),f+=s),h){let u=a;n.push({x:u,y:o*.38}),n.push({x:u,y:o*.62})}if(p){let u=f+l;n.push({x:u,y:o*.38}),n.push({x:u,y:o*.62}),f=u+a}this.box.w=f,this.box.h=o;let d=t>=2?this.lines[0]:void 0;this.box.anchor=d?d.x+d.w/2:f/2,this.box.visualAxis=o/2;for(let u of this.lines)u.x-=this.box.anchor;this.repeatDots=n.map(u=>({x:u.x-this.box.anchor,y:u.y,r:a}))}paint(t){for(let e of this.lines)t.drawRect(this.box.x+this.box.anchor+e.x,this.box.y,e.w,this.box.h,{fill:"#000"});for(let e of this.repeatDots)t.drawCircle(this.box.x+this.box.anchor+e.x,this.box.y+e.y,e.r,{fill:"#000"})}},gn="repeat.start";function Xo(i,t){return i.visits(i.seek(gn,t+1,-1)??0)}var bn=class extends _e{playbackMarks(){return this.ast.type===3?[]:[gn]}playbackFlow(t){if(this.ast.type===2)return;let e=t(this);if(e!==void 0)return{range:[e,e],run:n=>n.visits(e)>1?void 0:{kind:"jump",column:n.seek(gn,e,-1)??0}}}};var Zo="div",Et=Lt(Zo);function ft(i,t){return`div.${i}.${t}`}function qo(i,t){let e=i.ports[ft(t,"left")];e&&(e.state.claimed=!0)}function Sn(i){return Math.max(1,i*.055)}function*Qo(i){for(let t=0;;t++){let e=!1,n=-1;for(let o=0;o<=i.length;o++){let s=i[o]?.ports,r=s?.[ft(t,"left")],c=s?.[ft(t,"right")];if((r||c)&&(e=!0),r&&c){n<0&&(n=o);continue}n>=0&&o-n>=2&&(yield{level:t,from:n,to:o-1}),n=-1}if(!e)return}}var wn=class i extends v{static def={name:[Zo,"/"],description:"\u51CF\u65F6\u7EBF",details:"~~~jpfun\n@div({1 2 -}, n=2, autobeam=true)\n~~~\n**\u7B80\u5199**\uFF1A\u5728\u76EE\u6807\u540E\u52A0 `/`\uFF0C\u53EF\u91CD\u590D\u6216\u4F5C\u7528\u4E8E\u5185\u5BB9\u5757\u3002`@div(1, 2)` \u7B49\u4EF7\u4E8E `1//`\uFF0C`@div({1 2/ -}, 2)` \u7B49\u4EF7\u4E8E `{1 2/ -}//`\u3002\u9ED8\u8BA4\u53C2\u6570\u4F7F\u7528 `div.n`\u3001`div.autobeam` \u8BBE\u7F6E\u3002",allowExtraArgs:!1,args:[{type:"content",description:"\u8981\u51CF\u65F6\u7684\u5185\u5BB9\uFF0C\u53EF\u5305\u542B\u591A\u4E2A\u97F3\u7B26\u6216\u589E\u65F6\u7EBF",default:null},{name:"n",description:"\u51CF\u65F6\u5C42\u6570\uFF0C\u6BCF\u7EA7\u5C06\u65F6\u503C\u51CF\u534A\uFF0C\u53D6\u975E\u8D1F\u6574\u6570",type:"number",default:1},{name:"autobeam",description:"\u662F\u5426\u53C2\u4E0E\u4E0D\u540C div \u4E4B\u95F4\u7684\u81EA\u52A8\u8FDE\u7EBF\uFF0C\u540C\u4E00 div \u5185\u90E8\u7684\u8FDE\u7EBF\u4E0D\u53D7\u5F71\u54CD",type:"boolean",default:!0}]};static deSugarAtom(t,e,n){let o=0,s=e;for(;s<n&&t[s]==="/";)o++,s++;return o===0?null:{next:s,node:{kind:"sugar",data:{class:i,n:o},span:{start:e,end:s}}}}static deSugarRelation(t,e,n){let o=e[n++];if(o.data?.class!==i)return null;let s=v.findLastFuncContentIndex(t.nodes,t.nodes.length-1);if(s<0)return n;let r=t.nodes[s];if(r instanceof i)return r.n+=o.data.n,n;let c=new Map;c.set(0,r),c.set("n",o.data.n);let a=r.sourceSpan,l=new i({start:Math.min(a.start,o.span.start),end:Math.max(a.end,o.span.end)},c,t,null);return t.nodes[s]=l,n}static layoutDecorationHandler=(t,e)=>{let n=Math.max(0,Math.floor(Number(e)||0));if(n===0)return null;let o=t.ast.size*.14,s=Sn(t.ast.size),r=(n-1)*o+s,c=0,a=0,l=0;return{below:{order:0,gap:-t.ast.size*.08,height:r,place(h){c=t.ports["body.left"]?.x??0,a=t.ports["body.right"]?.x??t.box.w,l=h+s/2;for(let p=0;p<n;p++){let f=l+p*o;t.ports[ft(p,"left")]={x:c,y:f,state:{claimed:!1}},t.ports[ft(p,"right")]={x:a,y:f}}}},paint(h){for(let p=0;p<n;p++){if(t.ports[ft(p,"left")].state.claimed)continue;let d=t.box.y+l+p*o;h.drawLine(t.box.x+c,d,t.box.x+a,d,{stroke:"#000",strokeWidth:s})}}}};loweringEnter(t){let e=this.n;return t.beginLoweringGroup(this,{onTemporal(n){if(e===0)return;let o=n.addon??={};o[Et]=(Number(o[Et])||0)+e,n.T.divPow2(e)}}),[]}loweringExit(t){return t.endLoweringGroup(this),[]}content;n;autoBeamEnabled;get children(){return[this.content]}timeFlowModel(){return{children:[this.content],mode:"sequence"}}constructor(t,e,n,o=null){super(t,o),[this.content,this.n,this.autoBeamEnabled]=this.getArgValue(e,n),this.content.parent=this;let s=Math.max(0,Math.trunc(this.n));s!==this.n&&(n.diagnostics.push(new O("W_DIV_INVALID_N",`@div \u7684\u6570\u91CF\u53C2\u6570 n \u5FC5\u987B\u4E3A\u975E\u8D1F\u6574\u6570\uFF0C\u5DF2\u88AB\u4FEE\u6B63\u4E3A ${s}`,this.sourceSpan)),this.n=s)}toString(t){return`@div(${this.content.toString(t)}, ${this.n})`}},Yt=wn;function Kt(i,t,e){return new ce(i,t,e)}function Jo(i){let t=new Map;for(let n of i.columns)for(let o of n){if(!F(o)||o.mergeKey===U&&o.T.isZero())continue;let s=t.get(o.layoutLine);s||(s=new Map,t.set(o.layoutLine,s));let r=s.get(o.track);r?r.push(o):s.set(o.track,[o])}let e=new Map;for(let[n,o]of t)for(let[s,r]of o)for(let c=0;c<r.length;c++)e.set(r[c],{line:n,track:s,index:c});for(let n of i.attachments)if(!(!(n instanceof ce)||!n.explicit))for(let o=1;o<n.endPoints.length;o++){let s=n.endPoints[o-1],r=n.endPoints[o];if(!F(s)||!F(r))continue;let c=e.get(s),a=e.get(r);if(!(s!==r&&c!==void 0&&a!==void 0&&c.line===a.line&&c.track===a.track&&a.index===c.index+1))throw new S("E_NON_ADJACENT_BEAM","@beam \u7684\u7AEF\u70B9\u5FC5\u987B\u6309\u65F6\u95F4\u987A\u5E8F\u8FDE\u63A5\u540C\u4E00\u8F68\u9053\u3001\u540C\u4E00\u8C31\u9762\u884C\u4E2D\u7684\u76F8\u90BB\u53EF\u89C1\u5143\u7D20\uFF08\u53EF\u8DE8\u5C0F\u8282\u7EBF\uFF09",n.sourceSpan)}}function ts(i){let t=new Set;for(let e of i)if(!(!(e instanceof ce)||!e.explicit))for(let n of e.endPoints)t.add(n);return t}var ce=class{layer="foreground";endPoints;explicit;sourceSpan;fontSize;strokeWidth;constructor(t,e,n){this.endPoints=t,this.explicit=e,this.sourceSpan=n,this.fontSize=t.reduce((o,s)=>F(s)?Math.max(o,s.ast.size):o,0),this.strokeWidth=Sn(this.fontSize)}prepareHorizontal(t){let e=new Set(this.endPoints);for(let n of t)for(let o of n.trackRuns.values())for(let s=1;s<o.length;s++){let r=o[s-1],c=o[s];!e.has(r)||!e.has(c)||(r.springConfig.alpha_R=r.springConfig.alpha_R*.8,c.springConfig.alpha_L=c.springConfig.alpha_L*.8)}}createGeometry(t){let e=this.collectLines(t),n=this.strokeWidth;return{regions:e.map(s=>({x:Math.min(s.start.x,s.end.x),y:s.start.y-n/2,w:Math.abs(s.end.x-s.start.x),h:n,line:s.line,track:s.track})),paint(s){for(let r of e)s.drawLine(r.start.x,r.start.y,r.end.x,r.end.y,{stroke:"#000",strokeWidth:n})}}}absolutePort(t,e){let n=t.ports[e];return{x:t.box.x+n.x,y:t.box.y+n.y}}collectLines(t){let e=[],n=this.endPoints.filter(F);if(n.length<2)return e;for(let{level:o,from:s,to:r}of Qo(n)){let c=[];for(let a=s;a<=r;a++){let l=n[a];c.push({left:this.absolutePort(l,ft(o,"left")),right:this.absolutePort(l,ft(o,"right")),line:l.layoutLine,track:l.track,node:l})}this.addSystemLines(c,t,o,e)}if(e.length===0&&this.explicit){let o=this.fontSize*.12,s=n.map(r=>{let c={x:r.box.x+r.box.anchor,y:r.box.y+r.box.h+o};return{left:c,right:c,line:r.layoutLine,track:r.track,node:r}});this.addSystemLines(s,t,null,e)}return e}addSystemLines(t,e,n,o){let s=Math.min(...t.map(h=>h.line)),r=Math.max(...t.map(h=>h.line)),c=t[0].track,a=e.getVisualAxis(t[0].line,c),l=t[0].left.y-a;for(let h=s;h<=r;h++){let p=t.filter(x=>x.line===h).sort((x,m)=>x.left.x-m.left.x);if(p.length===0){let m=e.getVisualAxis(h,c)+l;o.push({start:{x:e.originX,y:m},end:{x:e.originX+e.width,y:m},line:h,track:c});continue}let f=p[0],d=p[p.length-1],u=f.left.y,g={x:f.left.x,y:u},y={x:d.right.x,y:u};if(h>s&&(g.x=e.originX),h<r&&(y.x=e.originX+e.width),!(g.x===y.x&&s===r)){if(n!==null)for(let x of p)qo(x.node,n);o.push({start:g,end:y,line:h,track:f.track})}}}};function es(i){let t=[],e=Math.max(0,Math.floor(Number(i.addon?.[Et])||0)),n=r=>{t.push(r),e-=Math.max(0,r.n)},o=i.ast.parent;for(;o&&e>0;)o instanceof Yt&&n(o),o=o.parent;let s=r=>{for(let c of r.children??[]){if(e<=0)return;c instanceof Yt&&n(c),s(c)}};return s(i.ast),t}function Zi(i){let t=new Map,e=new Map;for(let n of i.columns)for(let o of n){if(!F(o))continue;let s=es(o);if(s.length===0)continue;let r=[];for(let c of s){let a=t.get(c);a||(a={owner:c,nodes:[]},t.set(c,a)),a.nodes.push(o),r.push(a)}e.set(o,r)}return{scopes:[...t.values()],nodeScopes:e}}function qi(i){let t=new Set(i.map(e=>e.owner));return i.filter(e=>{let n=e.owner.parent;for(;n;){if(n instanceof Yt&&t.has(n))return!1;n=n.parent}return!0})}function Qi(i){let t=1/0,e=-1/0;for(let n of i){t=Math.min(t,n.ast.sourceSpan.start),e=Math.max(e,n.ast.sourceSpan.end);for(let o of es(n))t=Math.min(t,o.sourceSpan.start),e=Math.max(e,o.sourceSpan.end)}return{start:t,end:e}}function ns(i){return Kt(i,!1,Qi(i))}function Ji(i,t){let e=[];for(let n of qi(i)){let o=new Map;for(let s of n.nodes){let r=o.get(s.track);r?r.push(s):o.set(s.track,[s])}for(let s of o.values()){let r=[],c=()=>{r.length>=2&&e.push(ns(r)),r=[]};for(let a of s){if(t.has(a)){c();continue}r.push(a)}c()}}return e}function tr(i){return Math.floor(i.numerator/i.denominator)}function er(i,t,e){let n=[],o=new Map,s=new Map,r=new I,c=new I;for(let h of i.columns)for(let p of h){let f=s.get(p.layoutLine);(f===void 0||p.t.compare(f)<0)&&s.set(p.layoutLine,p.t)}let a=h=>{let p=o.get(h);p&&(o.delete(h),p.nodes.length>=2&&n.push(ns(p.nodes)))},l=()=>{for(let h of[...o.keys()])a(h)};for(let h of i.columns){let p=h.find(f=>f.mergeKey===U);p&&(l(),r.copyFrom(p.t));for(let f of h){if(f.mergeKey===U)continue;let d=F(f)?t.get(f):void 0,u=d?.every(k=>k.nodes.length===1)??!1,g=d?.every(k=>k.owner.autoBeamEnabled)??!1;if(!(F(f)&&u&&g&&f.T.compare(1)<0&&!e.has(f))){(F(f)||!f.T.isZero())&&a(f.track);continue}let x=s.get(f.layoutLine)??f.t,m=r.compare(x)>=0?r:x,b=tr(c.copyFrom(f.t).sub(m)),w=o.get(f.track);if(!w){o.set(f.track,{nodes:[f],line:f.layoutLine,beat:b,endTime:f.t.clone().add(f.T)});continue}let A=f.t.equals(w.endTime);if(f.layoutLine!==w.line||b!==w.beat||!A){a(f.track),o.set(f.track,{nodes:[f],line:f.layoutLine,beat:b,endTime:f.t.clone().add(f.T)});continue}w.nodes.push(f),w.endTime.copyFrom(f.t).add(f.T)}}return l(),n}function os(i){let{scopes:t,nodeScopes:e}=Zi(i),n=ts(i.attachments);return[...Ji(t,n),...er(i,e,n)]}var Cn=class extends v{static loweringAugment=os;static loweringFinalize=Jo;static def={name:["beam"],description:"\u51CF\u65F6\u7EBF\u8FDE\u63A5",details:"\u4E8B\u540E\u5C06\u591A\u4E2A\u51CF\u65F6\u7EBF**\u5F3A\u884C**\u76F8\u8FDE\n~~~jpfun\n1/@a 2/@b | 3/@c @beam(a, b, c)\n~~~\n**\u4F4D\u7F6E\u53C2\u6570**\uFF1A\u5DF2\u6807\u8BB0\u97F3\u7B26\u7684\u6807\u7B7E\uFF0C\u6309\u4F20\u5165\u987A\u5E8F\u8FDE\u63A5\u51CF\u65F6\u7EBF\uFF0C\u663E\u5F0F\u6307\u5B9A\u4E00\u7EC4\u3002\u5148\u7528 `/` \u6216 `@div` \u4E3A\u76EE\u6807\u6DFB\u52A0\u51CF\u65F6\u7EBF\uFF0C\u518D\u7528 `@beam` \u63A7\u5236\u8FDE\u63A5\u3002\u7AEF\u70B9\u987B\u540C\u8F68\u3001\u540C\u8C31\u9762\u884C\u4E14\u76F8\u90BB\uFF0C\u53EF\u8DE8\u5C0F\u8282\u7EBF\uFF1B\u8FDE\u7EBF\u76F4\u63A5\u7A7F\u8FC7\u5C0F\u8282\u7EBF\uFF0C\u4FDD\u7559\u539F\u6709\u95F4\u8DDD\u3002",allowExtraArgs:!0,extraArgType:"label",args:[]};endPoints=[];constructor(t,e,n,o=null){super(t,o);for(let[,r]of e){let c=r instanceof v?r:n.parseArgWithType(r.valueSpan,"label",t.start);c instanceof v&&this.endPoints.push(c)}let s=n.labelableNodes.length-1;for(;this.endPoints.length<2&&s>=0;){let r=n.labelableNodes[s--];!r||this.endPoints.includes(r)||this.endPoints.unshift(r)}if(this.endPoints.length<2)throw new S("E_NOT_ENOUGH_ARGS","@beam \u81F3\u5C11\u9700\u8981\u4E24\u4E2A\u7AEF\u70B9",t)}loweringEnter(t){let e=[];for(let n of this.endPoints){let o=t.getTemporalNodes(n).at(-1);for(;o?.foldedInto;)o=o.foldedInto;o&&e.push(o)}return e.length<2?(t.diagnostics.push(N.warning.UnresolvedEndpoint("beam",this.sourceSpan)),[]):(t.addAttachment(Kt(e,!0,this.sourceSpan)),[])}},ss=Cn;var An=class extends v{static def={name:["box"],description:"\u7ED9\u76EE\u6807\u7ED3\u6784\u6216\u5BF9\u8C61\u52A0\u5916\u6846",details:`~~~jpfun
|
|
12
|
+
\u6709\u8BED\u6CD5\u7CD6\u7B80\u5199\uFF0C\u89C1 type \u53C2\u6570\u7684\u8BF4\u660E\u3002`,allowExtraArgs:!1,args:[{name:"type",description:"0\uFF1A\u666E\u901A\u7EBF `|`\uFF1B1\uFF1A\u7EC8\u6B62\u7EBF `||`\uFF08\u5DE6\u7EC6\u53F3\u7C97\uFF09\uFF1B2\uFF1A\u53CD\u590D\u8D77\u70B9 `|:`\uFF1B3\uFF1A\u53CD\u590D\u7EC8\u70B9 `:|`\uFF1B4\uFF1A\u5DE6\u53F3\u53CD\u590D `:|:`",type:"number",default:0},{name:"length",description:"\u5C0F\u8282\u7EBF\u9AD8\u5EA6",type:"length",default:{value:1.25,unit:"em"}}]};static deSugarAtom(t,e,n){let o=e,s=0,i=t.slice(o,o+2);if(i==="||")s=1,o+=2;else if(i==="|:")s=2,o+=2;else if(i===":|")t[o+2]===":"?(s=4,o+=3):(s=3,o+=2);else if(t[o]==="|")s=0,o+=1;else return null;let c=new Map;return c.set("type",s),{next:o,node:{kind:"call",typed:!0,name:"bar",args:c,span:{start:e,end:o},syntaxKind:"atom"}}}type;size;constructor(t,e,n,o=null){super(t,o);let[s,i]=this.getArgValue(e,n);this.type=s,this.size=n.length2px(i)}loweringEnter(){return[this.type>=2?new vn(this):new Oe(this)]}toString(){return`@bar(${this.type}, ${this.size}px)`}},us=Nn,Oe=class extends D{lines=[];repeatDots=[];constructor(t){super(),this.ast=t,this.mergeKey=K,this.initLayoutBox(),this.springConfig={alpha_L:128,alpha_R:128}}prepareHorizontal(t){let e=this;for(;e.foldedInto;)e=e.foldedInto;if(!F(e))return;let n=t.trackRuns.get(e.track),o=n?.indexOf(e)??-1;!n||o<0||t.registerHorizontalLayoutHook(e,e,({columns:s,start:i})=>{let c=s[i].find(f=>f.time===e);if(!c)return;let a=f=>{let d=t.columnOf(f);return d<0?void 0:s[d].find(u=>u.time===f)},l=o>0?a(n[o-1]):void 0;l&&(l.config.mu_R*=4,c.config.mu_L*=4);let h=n[o+1],p=h?a(h):void 0;p&&h.mergeKey!==K&&(c.config.mu_R*=4,p.config.mu_L*=4)})}prepareLayout(){let{type:t,size:e}=this.ast;this.lines.length=0;let n=[],o=e,s=Math.max(1,e*.065),i=s*2.6,c=s*1.8,a=s*.8,l=c+a,h=t===3||t===4,p=t===2||t===4,f=h?a*2+l:0;if(t===1||t===3||t===4?(this.lines.push({x:f,w:s}),f+=s+c,this.lines.push({x:f,w:i}),f+=i):t===2?(this.lines.push({x:f,w:i}),f+=i+c,this.lines.push({x:f,w:s}),f+=s):(this.lines.push({x:f,w:s}),f+=s),h){let u=a;n.push({x:u,y:o*.38}),n.push({x:u,y:o*.62})}if(p){let u=f+l;n.push({x:u,y:o*.38}),n.push({x:u,y:o*.62}),f=u+a}this.box.w=f,this.box.h=o;let d=t>=2?this.lines[0]:void 0;this.box.anchor=d?d.x+d.w/2:f/2,this.box.visualAxis=o/2;for(let u of this.lines)u.x-=this.box.anchor;this.repeatDots=n.map(u=>({x:u.x-this.box.anchor,y:u.y,r:a}))}paint(t){for(let e of this.lines)t.drawRect(this.box.x+this.box.anchor+e.x,this.box.y,e.w,this.box.h,{fill:"#000"});for(let e of this.repeatDots)t.drawCircle(this.box.x+this.box.anchor+e.x,this.box.y+e.y,e.r,{fill:"#000"})}},kn="repeat.start";function ds(r,t){return r.visits(r.seek(kn,t+1,-1)??0)}var vn=class extends Oe{playbackMarks(){return this.ast.type===3?[]:[kn]}playbackFlow(t){if(this.ast.type===2)return;let e=t(this);if(e!==void 0)return{range:[e,e],run:n=>n.visits(e)>1?void 0:{kind:"jump",column:n.seek(kn,e,-1)??0}}}};var xs="div",Mt=vt(xs);function xt(r,t){return`div.${r}.${t}`}function ms(r,t){let e=r.ports[xt(t,"left")];e&&(e.state.claimed=!0)}function Rn(r){return Math.max(1,r*.055)}function*ys(r){for(let t=0;;t++){let e=!1,n=-1;for(let o=0;o<=r.length;o++){let s=r[o]?.ports,i=s?.[xt(t,"left")],c=s?.[xt(t,"right")];if((i||c)&&(e=!0),i&&c){n<0&&(n=o);continue}n>=0&&o-n>=2&&(yield{level:t,from:n,to:o-1}),n=-1}if(!e)return}}var Mn=class r extends _{static def={name:[xs,"/"],description:"\u51CF\u65F6\u7EBF",details:"~~~jpfun\n@div({1 2 -}, n=2, autobeam=true)\n~~~\n**\u7B80\u5199**\uFF1A\u5728\u76EE\u6807\u540E\u52A0 `/`\uFF0C\u53EF\u91CD\u590D\u6216\u4F5C\u7528\u4E8E\u5185\u5BB9\u5757\u3002`@div(1, 2)` \u7B49\u4EF7\u4E8E `1//`\uFF0C`@div({1 2/ -}, 2)` \u7B49\u4EF7\u4E8E `{1 2/ -}//`\u3002\u9ED8\u8BA4\u53C2\u6570\u4F7F\u7528 `div.n`\u3001`div.autobeam` \u8BBE\u7F6E\u3002",allowExtraArgs:!1,args:[{type:"content",description:"\u8981\u51CF\u65F6\u7684\u5185\u5BB9\uFF0C\u53EF\u5305\u542B\u591A\u4E2A\u97F3\u7B26\u6216\u589E\u65F6\u7EBF",default:null},{name:"n",description:"\u51CF\u65F6\u5C42\u6570\uFF0C\u6BCF\u7EA7\u5C06\u65F6\u503C\u51CF\u534A\uFF0C\u53D6\u975E\u8D1F\u6574\u6570",type:"number",default:1},{name:"autobeam",description:"\u662F\u5426\u53C2\u4E0E\u4E0D\u540C div \u4E4B\u95F4\u7684\u81EA\u52A8\u8FDE\u7EBF\uFF0C\u540C\u4E00 div \u5185\u90E8\u7684\u8FDE\u7EBF\u4E0D\u53D7\u5F71\u54CD",type:"boolean",default:!0}]};static deSugarAtom(t,e,n){let o=0,s=e;for(;s<n&&t[s]==="/";)o++,s++;return o===0?null:{next:s,node:{kind:"sugar",data:{class:r,n:o},span:{start:e,end:s}}}}static deSugarRelation(t,e,n){let o=e[n++];if(o.data?.class!==r)return null;let s=_.findLastFuncContentIndex(t.nodes,t.nodes.length-1);if(s<0)return n;let i=t.nodes[s];if(i instanceof r)return i.n+=o.data.n,n;let c=new Map;c.set(0,i),c.set("n",o.data.n);let a=i.sourceSpan,l=new r({start:Math.min(a.start,o.span.start),end:Math.max(a.end,o.span.end)},c,t,null);return t.nodes[s]=l,n}static layoutDecorationHandler=(t,e)=>{let n=Math.max(0,Math.floor(Number(e)||0));if(n===0)return null;let o=t.ast.size*.14,s=Rn(t.ast.size),i=(n-1)*o+s,c=0,a=0,l=0;return{below:{order:0,gap:t.box.h-(t.ports["decoration.below"]?.y??t.box.h)-t.ast.size*.08,height:i,place(h){c=t.ports["body.left"]?.x??0,a=t.ports["body.right"]?.x??t.box.w,l=h+s/2;for(let p=0;p<n;p++){let f=l+p*o;t.ports[xt(p,"left")]={x:c,y:f,state:{claimed:!1}},t.ports[xt(p,"right")]={x:a,y:f}}}},paint(h){for(let p=0;p<n;p++){if(t.ports[xt(p,"left")].state.claimed)continue;let d=t.box.y+l+p*o;h.drawLine(t.box.x+c,d,t.box.x+a,d,{stroke:"#000",strokeWidth:s})}}}};loweringEnter(t){let e=this.n;return t.beginLoweringGroup(this,{onTemporal(n){if(e===0)return;let o=n.addon??={};o[Mt]=(Number(o[Mt])||0)+e,n.T.divPow2(e)}}),[]}loweringExit(t){return t.endLoweringGroup(this),[]}content;n;autoBeamEnabled;get children(){return[this.content]}timeFlowModel(){return{children:[this.content],mode:"sequence"}}constructor(t,e,n,o=null){super(t,o),[this.content,this.n,this.autoBeamEnabled]=this.getArgValue(e,n),this.content.parent=this;let s=Math.max(0,Math.trunc(this.n));s!==this.n&&(n.diagnostics.push(new P("W_DIV_INVALID_N",`@div \u7684\u6570\u91CF\u53C2\u6570 n \u5FC5\u987B\u4E3A\u975E\u8D1F\u6574\u6570\uFF0C\u5DF2\u88AB\u4FEE\u6B63\u4E3A ${s}`,this.sourceSpan)),this.n=s)}toString(t){return`@div(${this.content.toString(t)}, ${this.n})`}},Ut=Mn;function jt(r,t,e){return new fe(r,t,e)}function gs(r){let t=new Map;for(let n of r.columns)for(let o of n){if(!F(o)||o.mergeKey===K&&o.T.isZero())continue;let s=t.get(o.layoutLine);s||(s=new Map,t.set(o.layoutLine,s));let i=s.get(o.track);i?i.push(o):s.set(o.track,[o])}let e=new Map;for(let[n,o]of t)for(let[s,i]of o)for(let c=0;c<i.length;c++)e.set(i[c],{line:n,track:s,index:c});for(let n of r.attachments)if(!(!(n instanceof fe)||!n.explicit))for(let o=1;o<n.endPoints.length;o++){let s=n.endPoints[o-1],i=n.endPoints[o];if(!F(s)||!F(i))continue;let c=e.get(s),a=e.get(i);if(!(s!==i&&c!==void 0&&a!==void 0&&c.line===a.line&&c.track===a.track&&a.index===c.index+1))throw new C("E_NON_ADJACENT_BEAM","@beam \u7684\u7AEF\u70B9\u5FC5\u987B\u6309\u65F6\u95F4\u987A\u5E8F\u8FDE\u63A5\u540C\u4E00\u8F68\u9053\u3001\u540C\u4E00\u8C31\u9762\u884C\u4E2D\u7684\u76F8\u90BB\u53EF\u89C1\u5143\u7D20\uFF08\u53EF\u8DE8\u5C0F\u8282\u7EBF\uFF09",n.sourceSpan)}}function bs(r){let t=new Set;for(let e of r)if(!(!(e instanceof fe)||!e.explicit))for(let n of e.endPoints)t.add(n);return t}var fe=class{layer="foreground";endPoints;explicit;sourceSpan;fontSize;strokeWidth;constructor(t,e,n){this.endPoints=t,this.explicit=e,this.sourceSpan=n,this.fontSize=t.reduce((o,s)=>F(s)?Math.max(o,s.ast.size):o,0),this.strokeWidth=Rn(this.fontSize)}prepareHorizontal(t){let e=new Set(this.endPoints);for(let n of t)for(let o of n.trackRuns.values())for(let s=1;s<o.length;s++){let i=o[s-1],c=o[s];!e.has(i)||!e.has(c)||(i.springConfig.alpha_R=i.springConfig.alpha_R*.8,c.springConfig.alpha_L=c.springConfig.alpha_L*.8)}}createGeometry(t){let e=this.collectLines(t),n=this.strokeWidth;return{regions:e.map(s=>({x:Math.min(s.start.x,s.end.x),y:s.start.y-n/2,w:Math.abs(s.end.x-s.start.x),h:n,line:s.line,track:s.track})),paint(s){for(let i of e)s.drawLine(i.start.x,i.start.y,i.end.x,i.end.y,{stroke:"#000",strokeWidth:n})}}}absolutePort(t,e){let n=t.ports[e];return{x:t.box.x+n.x,y:t.box.y+n.y}}collectLines(t){let e=[],n=this.endPoints.filter(F);if(n.length<2)return e;for(let{level:o,from:s,to:i}of ys(n)){let c=[];for(let a=s;a<=i;a++){let l=n[a];c.push({left:this.absolutePort(l,xt(o,"left")),right:this.absolutePort(l,xt(o,"right")),line:l.layoutLine,track:l.track,node:l})}this.addSystemLines(c,t,o,e)}if(e.length===0&&this.explicit){let o=this.fontSize*.12,s=n.map(i=>{let c={x:i.box.x+i.box.anchor,y:i.box.y+i.box.h+o};return{left:c,right:c,line:i.layoutLine,track:i.track,node:i}});this.addSystemLines(s,t,null,e)}return e}addSystemLines(t,e,n,o){let s=Math.min(...t.map(h=>h.line)),i=Math.max(...t.map(h=>h.line)),c=t[0].track,a=e.getVisualAxis(t[0].line,c),l=t[0].left.y-a;for(let h=s;h<=i;h++){let p=t.filter(m=>m.line===h).sort((m,y)=>m.left.x-y.left.x);if(p.length===0){let y=e.getVisualAxis(h,c)+l;o.push({start:{x:e.originX,y},end:{x:e.originX+e.width,y},line:h,track:c});continue}let f=p[0],d=p[p.length-1],u=f.left.y,g={x:f.left.x,y:u},x={x:d.right.x,y:u};if(h>s&&(g.x=e.originX),h<i&&(x.x=e.originX+e.width),!(g.x===x.x&&s===i)){if(n!==null)for(let m of p)ms(m.node,n);o.push({start:g,end:x,line:h,track:f.track})}}}};function ws(r){let t=[],e=Math.max(0,Math.floor(Number(r.addon?.[Mt])||0)),n=i=>{t.push(i),e-=Math.max(0,i.n)},o=r.ast.parent;for(;o&&e>0;)o instanceof Ut&&n(o),o=o.parent;let s=i=>{for(let c of i.children??[]){if(e<=0)return;c instanceof Ut&&n(c),s(c)}};return s(r.ast),t}function gr(r){let t=new Map,e=new Map;for(let n of r.columns)for(let o of n){if(!F(o))continue;let s=ws(o);if(s.length===0)continue;let i=[];for(let c of s){let a=t.get(c);a||(a={owner:c,nodes:[]},t.set(c,a)),a.nodes.push(o),i.push(a)}e.set(o,i)}return{scopes:[...t.values()],nodeScopes:e}}function br(r){let t=new Set(r.map(e=>e.owner));return r.filter(e=>{let n=e.owner.parent;for(;n;){if(n instanceof Ut&&t.has(n))return!1;n=n.parent}return!0})}function wr(r){let t=1/0,e=-1/0;for(let n of r){t=Math.min(t,n.ast.sourceSpan.start),e=Math.max(e,n.ast.sourceSpan.end);for(let o of ws(n))t=Math.min(t,o.sourceSpan.start),e=Math.max(e,o.sourceSpan.end)}return{start:t,end:e}}function Ss(r){return jt(r,!1,wr(r))}function Sr(r,t){let e=[];for(let n of br(r)){let o=new Map;for(let s of n.nodes){let i=o.get(s.track);i?i.push(s):o.set(s.track,[s])}for(let s of o.values()){let i=[],c=()=>{i.length>=2&&e.push(Ss(i)),i=[]};for(let a of s){if(t.has(a)){c();continue}i.push(a)}c()}}return e}function Cr(r){return Math.floor(r.numerator/r.denominator)}function Ar(r,t,e){let n=[],o=new Map,s=new Map,i=new O,c=new O;for(let h of r.columns)for(let p of h){let f=s.get(p.layoutLine);(f===void 0||p.t.compare(f)<0)&&s.set(p.layoutLine,p.t)}let a=h=>{let p=o.get(h);p&&(o.delete(h),p.nodes.length>=2&&n.push(Ss(p.nodes)))},l=()=>{for(let h of[...o.keys()])a(h)};for(let h of r.columns){let p=h.find(f=>f.mergeKey===K);p&&(l(),i.copyFrom(p.t));for(let f of h){if(f.mergeKey===K)continue;let d=F(f)?t.get(f):void 0,u=d?.every(A=>A.nodes.length===1)??!1,g=d?.every(A=>A.owner.autoBeamEnabled)??!1;if(!(F(f)&&u&&g&&f.T.compare(1)<0&&!e.has(f))){(F(f)||!f.T.isZero())&&a(f.track);continue}let m=s.get(f.layoutLine)??f.t,y=i.compare(m)>=0?i:m,b=Cr(c.copyFrom(f.t).sub(y)),w=o.get(f.track),S=w&&f.t.equals(w.endTime);if(!w||f.layoutLine!==w.line||b!==w.beat||!S){a(f.track),o.set(f.track,{nodes:[f],line:f.layoutLine,beat:b,endTime:f.t.clone().add(f.T)});continue}w.nodes.push(f),w.endTime.copyFrom(f.t).add(f.T)}}return l(),n}function Cs(r){let{scopes:t,nodeScopes:e}=gr(r),n=bs(r.attachments);return[...Sr(t,n),...Ar(r,e,n)]}var On=class extends _{static loweringAugment=Cs;static loweringFinalize=gs;static def={name:["beam"],description:"\u51CF\u65F6\u7EBF\u8FDE\u63A5",details:"\u4E8B\u540E\u5C06\u591A\u4E2A\u51CF\u65F6\u7EBF**\u5F3A\u884C**\u76F8\u8FDE\n~~~jpfun\n1/@a 2/@b | 3/@c @beam(a, b, c)\n~~~\n**\u4F4D\u7F6E\u53C2\u6570**\uFF1A\u5DF2\u6807\u8BB0\u97F3\u7B26\u7684\u6807\u7B7E\uFF0C\u6309\u4F20\u5165\u987A\u5E8F\u8FDE\u63A5\u51CF\u65F6\u7EBF\uFF0C\u663E\u5F0F\u6307\u5B9A\u4E00\u7EC4\u3002\u5148\u7528 `/` \u6216 `@div` \u4E3A\u76EE\u6807\u6DFB\u52A0\u51CF\u65F6\u7EBF\uFF0C\u518D\u7528 `@beam` \u63A7\u5236\u8FDE\u63A5\u3002\u7AEF\u70B9\u987B\u540C\u8F68\u3001\u540C\u8C31\u9762\u884C\u4E14\u76F8\u90BB\uFF0C\u53EF\u8DE8\u5C0F\u8282\u7EBF\uFF1B\u8FDE\u7EBF\u76F4\u63A5\u7A7F\u8FC7\u5C0F\u8282\u7EBF\uFF0C\u4FDD\u7559\u539F\u6709\u95F4\u8DDD\u3002",allowExtraArgs:!0,extraArgType:"label",args:[]};endPoints=[];constructor(t,e,n,o=null){super(t,o);for(let[,i]of e){let c=i instanceof _?i:n.parseArgWithType(i.valueSpan,"label",t.start);c instanceof _&&this.endPoints.push(c)}let s=n.labelableNodes.length-1;for(;this.endPoints.length<2&&s>=0;){let i=n.labelableNodes[s--];!i||this.endPoints.includes(i)||this.endPoints.unshift(i)}if(this.endPoints.length<2)throw new C("E_NOT_ENOUGH_ARGS","@beam \u81F3\u5C11\u9700\u8981\u4E24\u4E2A\u7AEF\u70B9",t)}loweringEnter(t){let e=[];for(let n of this.endPoints){let o=t.getTemporalNodes(n).at(-1);for(;o?.foldedInto;)o=o.foldedInto;o&&e.push(o)}return e.length<2?(t.diagnostics.push(k.warning.UnresolvedEndpoint("beam",this.sourceSpan)),[]):(t.addAttachment(jt(e,!0,this.sourceSpan)),[])}},As=On;var In=class extends _{static def={name:["box"],description:"\u7ED9\u76EE\u6807\u7ED3\u6784\u6216\u5BF9\u8C61\u52A0\u5916\u6846",details:`~~~jpfun
|
|
13
13
|
@box({1 2 3}, padding=0.2em, stroke=0.08em)
|
|
14
|
-
~~~`,allowExtraArgs:!1,args:[{type:"content",description:"\u9700\u8981\u52A0\u6846\u7684\u5185\u5BB9\u6216\u7ED3\u6784",default:null},{name:"padding",description:"\u5185\u5BB9\u5230\u6846\u7EBF\u7684\u5185\u8FB9\u8DDD\uFF0C\u8D1F\u503C\u5411\u5185\u6536\u7F29",type:"length",default:{value:0,unit:"em"}},{name:"stroke",description:"\u6846\u7EBF\u5BBD\u5EA6",type:"length",default:{value:1,unit:"px"}},{name:"width",description:"\u7EA6\u675F\u5185\u90E8\u6392\u7248\u7684\u5BBD\u5EA6\uFF0C\u975E\u6B63\u503C\u8868\u793A\u968F\u5185\u5BB9\u81EA\u52A8\u786E\u5B9A",type:"length",default:{value:-1,unit:"px"}}]};target;padding;stroke;width;get children(){return[this.target]}timeFlowModel(){return{children:[this.target],mode:"sequence"}}loweringEnter(t){let e={nodes:[],attachments:[],onTemporal(n){F(n)&&e.nodes.push(n)},onAttachment(n){e.attachments.push(n)}};return t.beginLoweringGroup(this,e),[]}loweringExit(t){let e=t.endLoweringGroup(this),n=new
|
|
14
|
+
~~~`,allowExtraArgs:!1,args:[{type:"content",description:"\u9700\u8981\u52A0\u6846\u7684\u5185\u5BB9\u6216\u7ED3\u6784",default:null},{name:"padding",description:"\u5185\u5BB9\u5230\u6846\u7EBF\u7684\u5185\u8FB9\u8DDD\uFF0C\u8D1F\u503C\u5411\u5185\u6536\u7F29",type:"length",default:{value:0,unit:"em"}},{name:"stroke",description:"\u6846\u7EBF\u5BBD\u5EA6",type:"length",default:{value:1,unit:"px"}},{name:"width",description:"\u7EA6\u675F\u5185\u90E8\u6392\u7248\u7684\u5BBD\u5EA6\uFF0C\u975E\u6B63\u503C\u8868\u793A\u968F\u5185\u5BB9\u81EA\u52A8\u786E\u5B9A",type:"length",default:{value:-1,unit:"px"}}]};target;padding;stroke;width;get children(){return[this.target]}timeFlowModel(){return{children:[this.target],mode:"sequence"}}loweringEnter(t){let e={nodes:[],attachments:[],onTemporal(n){F(n)&&e.nodes.push(n)},onAttachment(n){e.attachments.push(n)}};return t.beginLoweringGroup(this,e),[]}loweringExit(t){let e=t.endLoweringGroup(this),n=new Pn(e,this);t.addAttachment(n);let o=e.nodes[0];if(o){if(n.reservedHost){let i=o.prepareLayout;o.prepareLayout=c=>{i.call(o,c);let a={order:1/0,height:Math.max(0,this.padding+this.stroke/2)};o.decorations.push({above:a,below:a})}}let s=o.prepareHorizontal;o.prepareHorizontal=i=>{s?.call(o,i),n.registerHorizontal(i)}}return[]}constructor(t,e,n,o=null){super(t,o);let[s,i,c,a]=this.getArgValue(e,n);s.parent=this,this.target=s,this.padding=n.length2px(i),this.stroke=Math.max(0,n.length2px(c)),this.width=n.length2px(a)}toString(t){return`@box(${this.target.toString(t)}, padding=${this.padding}px, stroke=${this.stroke}px, width=${this.width}px)`}},Ts=In,Pn=class r{content;owner;layer="background";reservedHost;fixedStart=null;wallOffset=0;get sourceSpan(){return this.owner.sourceSpan}constructor(t,e){this.content=t,this.owner=e;let[n]=t.nodes;t.nodes.length===1&&t.attachments.every(o=>o instanceof r&&o.reservedHost===n)&&(this.reservedHost=n)}registerHorizontal(t){let e=this.content.nodes,n=e[0];if(!n)return;if(e.some(a=>a.layoutLine!==n.layoutLine))throw new C("E_BOX_CROSS_LINE","@box \u7684\u5185\u5BB9\u4E0D\u80FD\u8DE8\u8D8A\u8C31\u9762\u884C",this.owner.sourceSpan);let o=n;for(let a of e){let l=t.columnOf(a);if(l<0)return;l<t.columnOf(n)&&(n=a),l>t.columnOf(o)&&(o=a)}let{width:s,padding:i,stroke:c}=this.owner;t.registerHorizontalLayoutHook(n,o,({columns:a,rows:l,start:h,end:p,X:f,fixed:d,options:u})=>{let g=b=>a[b].filter(w=>e.some(S=>S.box===w.box)),x=g(h),m=g(p);if(s>0){let b=Math.max(...x.map(A=>A.WL)),w=Math.max(...m.map(A=>A.WR));if(s<b+w-1e-6)throw new C("E_BOX_WIDTH_TOO_SMALL","@box \u7684\u5BBD\u5EA6\u5C0F\u4E8E\u9996\u672B\u5143\u7D20\u7684\u56FA\u6709\u5BBD\u5EA6",this.owner.sourceSpan);if(d[h-1]||d[p])throw new C("E_BOX_CONSTRAINT_CROSSING","\u5B9A\u5BBD @box \u53EF\u4EE5\u5D4C\u5957\uFF0C\u4F46\u4E0D\u80FD\u90E8\u5206\u4EA4\u53C9",this.owner.sourceSpan);let S=f.subarray(h,p+1);if(h===p){let A=(s-b-w)/2;for(let T of x)T.WL+=A;for(let T of m)T.WR+=A;S[0]=b+A}else{Vt(a.slice(h,p+1),l,S,d.subarray(h,p),s,u,0);let A=S[S.length-1]-S[0]+b+w;if(Math.abs(A-s)>1e-6)throw new C("E_BOX_CONSTRAINT_CONFLICT","\u591A\u4E2A @box \u4E3A\u76F8\u540C\u5185\u5BB9\u6307\u5B9A\u4E86\u4E0D\u540C\u5BBD\u5EA6",this.owner.sourceSpan)}this.fixedStart=n,this.wallOffset=-S[0]}let y=i+c/2;for(let b of x)b.WL+=y;for(let b of m)b.WR+=y})}createGeometry(t){let{padding:e,stroke:n}=this.owner,o=t.getContentBounds(this.content);if(!o)return{regions:[],paint(){}};let s=e+n/2,c={x:(this.fixedStart?this.fixedStart.box.x+this.fixedStart.box.anchor+this.wallOffset:o.x)-s,y:o.y-s,w:(this.fixedStart?this.owner.width:o.w)+s*2,h:o.h+s*2};if(c.w<n||c.h<n)throw new C("E_BOX_PADDING_TOO_SMALL","@box \u7684\u8D1F\u5185\u8FB9\u8DDD\u4F7F\u8FB9\u6846\u5BBD\u5EA6\u6216\u9AD8\u5EA6\u5C0F\u4E8E\u96F6",this.owner.sourceSpan);return{regions:[c],occupancy:this.reservedHost?[]:this.occupancy(t,c),paint(a){let l=n/2;a.drawRect(c.x+l,c.y+l,Math.max(0,c.w-n),Math.max(0,c.h-n),{stroke:"#000",strokeWidth:n})}}}occupancy(t,e){let n=new Set,o,s=(a,l)=>{if(o!==void 0&&o!==a)throw new C("E_BOX_CROSS_LINE","@box \u7684\u5185\u5BB9\u4E0D\u80FD\u8DE8\u8D8A\u8C31\u9762\u884C",this.owner.sourceSpan);o=a,n.add(l)};for(let a of this.content.nodes)s(a.layoutLine,a.track);for(let a of this.content.attachments){if(!ut(a))continue;let l=t.getAttachmentOccupancy(a);if(l){for(let h of a.endPoints??[])s(h.layoutLine,h.track);for(let h of l)h.line!==void 0&&s(h.line,h.track)}}if(o===void 0)return[];let i=o,c=[...n].sort((a,l)=>t.getVisualAxis(i,a)-t.getVisualAxis(i,l));return[{...e,h:0,line:i,track:c[0]},{...e,y:e.y+e.h,h:0,line:i,track:c.at(-1)}]}};var Fn=class extends _{static def={name:["dash","-"],description:"\u589E\u65F6\u7EBF",details:"~~~jpfun\n1 @dash()\n~~~\n\u65E0\u53C2\u6570\u3002\u6DFB\u52A0\u4E00\u6839\u589E\u65F6\u7EBF\uFF0C\u6269\u5C55\u524D\u65B9\u97F3\u7B26\u6216\u4F11\u6B62\u7B26\u7684\u5B8C\u6574\u65F6\u503C\uFF1B\u4E5F\u53EF\u7B80\u5199\u4E3A `1 -`\u3002\u6BCF\u6839\u7EBF\u7684\u57FA\u7840\u65F6\u503C\u4E3A\u4E00\u4E2A\u56DB\u5206\u97F3\u7B26\uFF0C\u53EF\u7528\u51CF\u65F6\u7EBF\u6216\u9644\u70B9\u8C03\u6574\u3002\u88C5\u9970\u97F3\u8986\u76D6\u5EF6\u957F\u540E\u7684\u5B8C\u6574\u97F3\u7B26\uFF0C\u4F8B\u5982 `1 ^ $tr -` \u5728\u4E24\u62CD\u5185\u6301\u7EED\u98A4\u97F3\u3002",allowExtraArgs:!1,args:[]};static deSugarAtom(t,e,n){if(t[e]!=="-")return null;let o={kind:"call",typed:!0,name:"-",args:new Map,span:{start:e,end:e+1},syntaxKind:"atom"};return{next:e+1,node:o}}size;constructor(t,e,n,o=null){super(t,o),this.size=n.variables.fontsize}loweringEnter(){return[new Dn(this)]}labelable(){return this}toString(){return"-"}},Es=Fn,Dn=class extends D{lineWidth=0;lineY=0;constructor(t){super(),this.ast=t,this.T.set(1),this.mergeKey=ht,this.initLayoutBox()}onTimeState(t){this.playbackState={bpm:t.bpm}}prepareLayout(){let t=this.ast.size;this.lineWidth=t*.42,this.box.w=this.lineWidth,this.box.h=t,this.box.anchor=this.lineWidth/2,this.lineY=t*.5,this.box.visualAxis=this.lineY}emitPlayback(t){let e=t.start.clone(),n=t.track,o=this.ast.sourceSpan;t.defer(s=>{let i;for(let c=s.spans.length-1;c>=0;c--){let a=s.spans[c];if(a.track===n){if(i===void 0){if(!a.end.equals(e))continue;i=a.origins[0]}else if(a.origins[0]!==i)break;a.end.equals(e)&&t.extend(a)}}i===void 0&&s.diagnostics.push(new P("W_PLAYBACK_SUSTAIN_WITHOUT_TARGET","\u589E\u65F6\u7EBF\u524D\u6CA1\u6709\u53EF\u5EF6\u7EED\u7684\u97F3\u6BB5",o))})}paint(t){t.drawLine(this.box.x,this.box.y+this.lineY,this.box.x+this.lineWidth,this.box.y+this.lineY,{stroke:"#000",strokeWidth:Math.max(1,this.ast.size*.1)})}};var Ns="dot",Ls=vt(Ns);function _s(r){let t=2**r;return[2*t-1,t]}var Bn=class r extends _{static def={name:[Ns,"."],description:"\u9644\u70B9",details:"~~~jpfun\n@dot(1, n=2)\n~~~\n**\u7B80\u5199**\uFF1A\u76EE\u6807\u540E\u52A0 `.`\uFF0C\u53EF\u91CD\u590D\u3002`@dot(1, 2)` \u7B49\u4EF7\u4E8E `1..`\uFF1B`{1^2}.` \u7B49\u4EF7\u4E8E `{1.^2}`\u3002\n\n`@dot({1 2/ -}, 2)` \u5305\u542B\u591A\u4E2A\u65F6\u95F4\u5143\u7D20\uFF0C\u4F1A\u62A5\u9519\uFF1B\u9700\u8981\u5206\u522B\u4E3A\u5404\u5143\u7D20\u6DFB\u52A0\u9644\u70B9\u3002",allowExtraArgs:!1,args:[{type:"content",description:"\u5355\u4E2A\u53EF\u89C1\u65F6\u95F4\u5143\u7D20\uFF0C\u5982\u97F3\u7B26\u3001\u589E\u65F6\u7EBF\u6216\u6298\u53E0\u548C\u5F26",default:null},{name:"n",description:"\u9644\u70B9\u6570\uFF0C\u7B2C\u4E00\u70B9\u589E\u52A0\u539F\u65F6\u503C\u7684\u4E00\u534A\uFF0C\u540E\u7EED\u5404\u70B9\u589E\u52A0\u91CF\u518D\u51CF\u534A",type:"number",default:1}]};static deSugarAtom(t,e,n){let o=0,s=e;for(;s<n&&t[s]===".";)o++,s++;return o===0?null:{next:s,node:{kind:"sugar",data:{class:r,n:o},span:{start:e,end:s}}}}static deSugarRelation(t,e,n){let o=e[n++];if(o.data?.class!==r)return null;let s=_.findLastFuncContentIndex(t.nodes,t.nodes.length-1);if(s<0)return n;let i=t.nodes[s];if(i instanceof r)return i.n+=o.data.n,n;let c=new Map;c.set(0,i),c.set("n",o.data.n);let a=i.sourceSpan,l=new r({start:Math.min(a.start,o.span.start),end:Math.max(a.end,o.span.end)},c,t,null);return t.nodes[s]=l,n}static layoutDecorationHandler=(t,e)=>{let n=Math.max(0,Math.floor(Number(e)||0));if(n===0)return null;let o=t.ast.size*.075,s=t.ast.size*.12,i=t.ports.dot??{x:t.box.w,y:t.box.visualAxis},c=i.x+s+o,a=o*2+s,l=c+(n-1)*a+o;return t.box.w=Math.max(t.box.w,l),{paint(h){let p=t.box.y+i.y;for(let f=0;f<n;f++)h.drawCircle(t.box.x+c+f*a,p,o,{fill:"#000"})}}};loweringEnter(t){let e=this.n,n={temporalCount:0,onTemporal(o){if(n.temporalCount++,e===0)return;let s=o.addon??={},i=Number(s[Ls])||0,c=i+e,[a,l]=_s(c),[h,p]=_s(i);o.T.mul(a*p,l*h),s[Ls]=c}};return t.beginLoweringGroup(this,n),[]}loweringExit(t){let e=t.endLoweringGroup(this);if(e.temporalCount!==1)throw new C("E_DOT_INVALID_CONTENT",`\u51FD\u6570 @dot \u53EA\u80FD\u63A5\u6536 1\u4E2A\u5143\u7D20\uFF0C\u4F46\u627E\u5230\u4E86 ${e.temporalCount} \u4E2A`,this.sourceSpan);return[]}timeFlowModel(){return{children:[this.content],mode:"sequence"}}content;n;get children(){return[this.content]}constructor(t,e,n,o=null){super(t,o),[this.content,this.n]=this.getArgValue(e,n),this.content.parent=this;let s=Math.max(0,Math.trunc(this.n));s!==this.n&&(n.diagnostics.push(new P("W_DOT_INVALID_N",`@dot \u7684\u6570\u91CF\u53C2\u6570 n \u5FC5\u987B\u4E3A\u975E\u8D1F\u6574\u6570\uFF0C\u5DF2\u88AB\u4FEE\u6B63\u4E3A ${s}`,this.sourceSpan)),this.n=s)}toString(t){return`@dot(${this.content.toString(t)}, ${this.n})`}},ks=Bn;var $n=class extends _{static def={name:["dyn"],description:"\u6E10\u5F3A\u6E10\u5F31",details:`~~~jpfun
|
|
15
15
|
1 ^ $p 2@a 3 4@b
|
|
16
16
|
@dyn(a, b, 24)
|
|
17
17
|
~~~
|
|
18
18
|
\u7AEF\u70B9\u987B\u4F4D\u4E8E\u540C\u4E00\u97F3\u8F68\u3001\u4E0D\u540C\u65F6\u95F4\uFF1B\u53D8\u5316\u91CF\u6CBF\u533A\u95F4\u7EBF\u6027\u589E\u52A0\uFF0C\u53E0\u52A0\u5728\u6BCF\u4E2A\u97F3\u7B26\u539F\u6709\u529B\u5EA6\u4E0A\u3002\u672C\u4F8B\u4ECE \`a\` \u5230 \`b\` \u6E10\u5F3A\uFF0C\u7EC8\u70B9\u589E\u52A0 24 \u7684\u529B\u5EA6\u3002
|
|
19
19
|
|
|
20
|
-
\u7AEF\u70B9\u4E5F\u53EF\u6807\u5728\u589E\u65F6\u7EBF\u4E0A\u3002\u7EC8\u70B9\u6CA1\u6709\u529B\u5EA6\u65F6\uFF0C\u53D6\u540C\u8F68\u3001\u4E0D\u665A\u4E8E\u7EC8\u70B9\u7684\u6700\u540E\u4E00\u4E2A\u539F\u59CB\u529B\u5EA6\u4F5C\u4E3A\u4FDD\u6301\u57FA\u51C6\uFF1B\u627E\u4E0D\u5230\u65F6\u7ED9\u51FA\u8B66\u544A\u5E76\u4EC5\u7ED8\u5236\u3002\u589E\u65F6\u7EBF\u5EF6\u7EED\u7684\u97F3\u7B26\u4FDD\u6301\u8D77\u97F3\u65F6\u7684\u529B\u5EA6\u3002`,allowExtraArgs:!1,args:[{name:"from",description:"\u6E10\u53D8\u8D77\u70B9\u7684\u6807\u7B7E",type:"label",default:null},{name:"to",description:"\u6E10\u53D8\u7EC8\u70B9\u7684\u6807\u7B7E",type:"label",default:null},{name:"dv",description:"\u529B\u5EA6\u53D8\u5316\u91CF\uFF0C\u6B63\u6570\u6E10\u5F3A\uFF0C\u8D1F\u6570\u6E10\u5F31",type:"number",default:null}]};static loweringFinalize=t=>{let e=t.attachments.filter(o=>o instanceof ae);if(e.length===0)return;let n=[];for(let o of t.astToTemporal.values())for(let s of o){let r=s.playbackState?.velocity;if(r===void 0)continue;let c=s;for(;c.foldedInto;)c=c.foldedInto;n.push({node:s,host:c,velocity:r,increment:0})}n.sort((o,s)=>o.host.t.compare(s.host.t)||o.node.order-s.node.order);for(let o of e){let s=o.end.playbackState?.velocity??n.find(a=>a.host===o.toHost)?.velocity;for(let a=n.length-1;s===void 0&&a>=0;a--){let l=n[a];l.host.track===o.track&&l.host.t.compare(o.toHost.t)<=0&&(s=l.velocity)}if(s===void 0){t.diagnostics.push(new O("W_DYN_NO_VELOCITY","@dyn \u7EC8\u70B9\u53CA\u6B64\u524D\u540C\u8F68\u6CA1\u6709\u53EF\u7528\u7684\u529B\u5EA6\u57FA\u51C6\uFF0C\u4EC5\u7ED8\u5236\u6E10\u53D8\u7EBF",o.sourceSpan));continue}let r=n.find(a=>a.host.track===o.track&&a.host.t.compare(o.toHost.t)>0&&a.velocity!==s)?.host.t,c=o.toHost.t.clone().sub(o.fromHost.t);for(let a of n){if(a.host.track!==o.track||a.host.t.compare(o.fromHost.t)<0||r&&a.host.t.compare(r)>=0)continue;let h=a.host.t.compare(o.toHost.t)>=0?1:a.host.t.clone().sub(o.fromHost.t).div(c).toNumber();a.increment+=o.dv*h}}for(let o of n){if(o.increment===0)continue;let s=Math.max(1,Math.min(127,o.velocity+o.increment));o.node.playbackState={...o.node.playbackState,velocity:s}}};from;to;dv;size;loweringEnter(t){let e=t.getTemporalNodes(this.from).at(0),n=t.getTemporalNodes(this.to).at(-1);if(!e||!n)return t.diagnostics.push(N.warning.UnresolvedEndpoint("dyn",this.sourceSpan)),[];let o=e,s=n;for(;o.foldedInto;)o=o.foldedInto;for(;s.foldedInto;)s=s.foldedInto;if(!F(o)||!F(s))return t.diagnostics.push(N.warning.UnresolvedEndpoint("dyn",this.sourceSpan)),[];if(o.track!==s.track)throw new S("E_DYN_CROSS_TRACK","@dyn \u7684\u4E24\u4E2A\u7AEF\u70B9\u5FC5\u987B\u4F4D\u4E8E\u540C\u4E00\u97F3\u8F68",this.sourceSpan);if(o.t.equals(s.t))throw new S("E_DYN_ZERO_SPAN","@dyn \u7684\u4E24\u4E2A\u7AEF\u70B9\u5FC5\u987B\u4F4D\u4E8E\u4E0D\u540C\u65F6\u95F4",this.sourceSpan);return o.t.compare(s.t)<0?t.addAttachment(new ae(this,n,o,s)):t.addAttachment(new ae(this,e,s,o)),[]}constructor(t,e,n,o=null){super(t,o);let[s,r,c]=this.getArgValue(e,n),a=c;if(!Number.isFinite(a)||a===0)throw new S("E_DYN_INVALID_DELTA","@dyn \u7684 dv \u5FC5\u987B\u662F\u975E\u96F6\u6709\u9650\u6570",t);a=Math.max(-127,Math.min(127,a)),a!==c&&n.diagnostics.push(new O("W_DYN_DELTA_CLAMPED",`@dyn \u7684 dv \u5FC5\u987B\u5728 -127 \u5230 127 \u4E4B\u95F4\uFF0C\u5DF2\u88AB\u9650\u5236\u4E3A ${a}`,t)),this.from=s,this.to=r,this.dv=a,this.size=n.variables.fontsize}toString(t){let e=n=>n.label??n.toString(t);return`@dyn(${e(this.from)}, ${e(this.to)}, ${this.dv})`}},ps=vn,ae=class{ast;end;fromHost;toHost;layer="foreground";constructor(t,e,n,o){this.ast=t,this.end=e,this.fromHost=n,this.toHost=o}get sourceSpan(){return this.ast.sourceSpan}get endPoints(){return[this.fromHost,this.toHost]}get dv(){return this.ast.dv}get track(){return this.fromHost.track}createGeometry(t){let e=this.fromHost.layoutLine,n=this.toHost.layoutLine,o=[this.fromHost,this.toHost],s=[],r=this.ast.size;for(let u=e;u<=n;u++){let g=t.getRangeColumns(u,o,this.track);if(g.some(y=>y.length>0)){for(let y of g)for(let x of y)r=Math.max(r,x.ast.size);s.push({line:u,startX:u===e?this.fromHost.box.x:this.lineEntryX(t,u),endX:u===n?this.toHost.box.x+this.toHost.box.w:this.lineRightX(t,u)})}}for(let u of s)u.line>e&&(u.startX-=r/4);let c=Math.max(.75,r*.035),a=s.filter(u=>u.startX!==u.endX),l=a.reduce((u,g)=>u+Math.abs(g.endX-g.startX),0);if(l===0)return{regions:[],paint(){}};let h=r*.4,p=c/2,f=0,d=a.map(u=>{let g=Math.abs(u.endX-u.startX),y=f/l,x=(f+g)/l;f+=g;let m=t.getRangeExtents(u.line,o,this.track),b=t.getVisualAxis(u.line,this.track),w=m?b+m.top:b;return{line:u.line,startX:u.startX,endX:u.endX,lineY:w-r*.62,startOpen:h*(this.dv>0?y:1-y),endOpen:h*(this.dv>0?x:1-x)}});return{regions:d.map(u=>({x:Math.min(u.startX,u.endX)-p,y:u.lineY-Math.max(u.startOpen,u.endOpen)/2-p,w:Math.abs(u.endX-u.startX)+c,h:Math.max(u.startOpen,u.endOpen)+c,line:u.line,track:this.track})),paint(u){let g={stroke:"#000",strokeWidth:c};for(let y of d)u.drawLine(y.startX,y.lineY-y.startOpen/2,y.endX,y.lineY-y.endOpen/2,g),u.drawLine(y.startX,y.lineY+y.startOpen/2,y.endX,y.lineY+y.endOpen/2,g)}}}lineEntryX(t,e){return t.lines[e].trackRuns.get(this.track)?.find(o=>!o.T.isZero())?.box.x??t.originX}lineRightX(t,e){let n=t.lines[e].trackRuns;if(n.size===0)return t.originX+t.width;let o=t.originX;for(let s of n.values())for(let r of s)o=Math.max(o,r.box.x+r.box.w);return o}};var _t=class i{parent;groups=[];constructor(t=null){this.parent=t}group(t,e){let n=this.groups.find(o=>o.laneKey===t.laneKey);for(n||(n={laneKey:t.laneKey,members:[],measure:t.measure,place:t.place},this.groups.push(n));n.members.length<e;)n.members.push(new i(this));return n}};var Ut=.7,fs="shoulder";function ds(i,t){let e=i;typeof e.size=="number"&&(e.size*=t);for(let n of i.children??[])ds(n,t)}var Nn=class i extends v{static def={name:["grace"],description:"\u501A\u97F3",details:"~~~jpfun\n@grace(1, {3 2}, side=pre)\n~~~\n**\u7B80\u5199**\uFF1A\u7BAD\u5934\u59CB\u7EC8\u6307\u5411\u5BBF\u4E3B\n- `2>1`\uFF1A`2` \u662F `1` \u7684\u524D\u501A\u97F3\uFF0C\u4F4D\u4E8E\u5DE6\u4E0A\u65B9\n- `1<2`\uFF1A`2` \u662F `1` \u7684\u540E\u501A\u97F3\uFF0C\u4F4D\u4E8E\u53F3\u4E0A\u65B9\n- `{3 2}>1`\uFF1A\u4E00\u7EC4\u524D\u501A\u97F3\uFF0C\u7B49\u4EF7\u4E8E\u4E0A\u4F8B\n- `1>2>3`\uFF1A\u5141\u8BB8\u5D4C\u5957\uFF0C`1` \u4FEE\u9970 `2`\uFF0C`2` \u4FEE\u9970 `3`\n\n\u501A\u97F3\u9ED8\u8BA4\u5E26\u4E00\u6761\u51CF\u65F6\u7EBF\uFF0C\u6309\u516B\u5206\u97F3\u7B26\u4E66\u5199\uFF1B\u518D\u52A0 `/` \u53D8\u4E3A\u5341\u516D\u5206\u97F3\u7B26\n\n\u501A\u97F3\u5185\u5BB9\u53EF\u4EE5\u662F\u6362\u884C\u4EE5\u5916\u7684\u4EFB\u610F\u7ED3\u6784\uFF0C\u4F8B\u5982 `{1 & 3}>2` \u7684\u4E24\u4E2A\u58F0\u90E8\u540C\u65F6\u594F\u51FA",allowExtraArgs:!1,args:[{name:"host",description:"\u88AB\u501A\u97F3\u4FEE\u9970\u7684\u5BBF\u4E3B\u5185\u5BB9",type:"content",default:null},{name:"grace",description:"\u501A\u97F3\u5185\u5BB9\uFF0C\u591A\u4E2A\u97F3\u7B26\u53EF\u7528\u5927\u62EC\u53F7\u7EC4\u5408\uFF0C\u4E5F\u53EF\u4EE5\u542B\u591A\u4E2A\u58F0\u90E8",type:"content",default:null},{name:"side",description:"`pre` \u4E3A\u524D\u501A\u97F3\uFF0C`post` \u4E3A\u540E\u501A\u97F3",type:"string",default:"pre"}]};labelable(){return v.findLabelable(this.host)}static deSugarAtom(t,e,n){let o=t[e];switch(o){case">":o="pre";break;case"<":o="post";break;default:return null}return{next:e+1,node:{kind:"sugar",data:{class:i,side:o},span:{start:e,end:e+1}}}}static deSugarRelation(t,e,n){let o=e[n++];if(o.kind!=="sugar"||o.data?.class!==i)return null;let s=o.data.side,r=t.nodes.length-1;for(;r>=0&&t.nodes[r]instanceof Z;)r--;if(r<0)throw new S("E_GRACE_NO_TARGET","@grace\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u5DE6\u8FB9\u6CA1\u6709\u627E\u5230\u76EE\u6807",o.span);let c=t.nodes[r],a=r;if(c instanceof lt){let h=c.target;for(;h&&!t.nodes.includes(h);)h=h.parent;for(let p=r-1;p>=0;p--)if(t.nodes[p]===h){c=new K({start:h.sourceSpan.start,end:c.sourceSpan.end},t.nodes.slice(p,r+1),null),a=p;break}}let l=t.nodes;t.nodes=[],t.makeNodes(e,n);for(let h=0;h<t.nodes.length;h++){let p=t.nodes[h];if(p instanceof Z)continue;let f=s==="pre"?i.attachPre(c,p,o.span,t):i.create(t,o.span,"post",c,p);for(l.length=a,l.push(f);++h<t.nodes.length;)l.push(t.nodes[h]);return t.nodes=l,e.length}throw new S("E_GRACE_NO_TARGET","@grace\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u53F3\u8FB9\u6CA1\u6709\u627E\u5230\u76EE\u6807",o.span)}host;grace;side="pre";size;static attachPre(t,e,n,o){if(e instanceof i&&e.side==="pre"){let s=e,r=1;for(;s.grace instanceof i&&s.grace.side==="pre";)s=s.grace,r++;let c=new Map;c.set(0,s.grace),c.set(1,t);let a=Ut**r,l=new i(n,c,o,null,Ut*a);return l.size*=a,s.setGrace(l,1),e}return i.create(o,n,"pre",e,t)}static create(t,e,n,o,s){let r=new Map;return r.set(0,o),r.set(1,s),r.set("side",n),new i(e,r,t)}get children(){let t=[];return this.host&&t.push(this.host),this.grace&&t.push(this.grace),t}constructor(t,e,n,o=null,s=Ut){if(super(t,o),this.size=n.variables.fontsize,[this.host,this.grace,this.side]=this.getArgValue(e,n),this.side!=="pre"&&this.side!=="post")throw new S("E_GRACE_INVALID_SIDE","@grace \u7684 side \u53C2\u6570\u5FC5\u987B\u662F 'pre' \u6216 'post'",t);this.adopt(this.host),this.setGrace(this.grace,s)}setGrace(t,e=Ut){ds(t,e),this.grace=t,this.adopt(t)}adopt(t){t.parent=this,this.sourceSpan.start=Math.min(this.sourceSpan.start,t.sourceSpan.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,t.sourceSpan.end)}loweringEnter(t,e){let n=this.host,o=this.grace;if(!n||!o)throw new S("E_GRACE_MISSING_ARGS","@grace \u9700\u8981\u540C\u65F6\u7ED9\u51FA\u5BBF\u4E3B\u548C\u501A\u97F3",this.sourceSpan);let s=new _t(e),r=[],c=[],a=[],l=(d,u)=>t.trackedEvents(d,new I,u);t.isolateFromLoweringGroups(()=>{this.side==="post"&&(r=l(n,e).flat()),t.beginLoweringGroup(this,{onAttachment(d){a.push(d)}}),c=l(o,s),t.endLoweringGroup(this),this.side==="pre"&&(r=l(n,e).flat())});let[h]=r;if(r.length!==1||!F(h))throw new S("E_GRACE_INVALID_HOST","@grace \u7684\u5BBF\u4E3B\u5FC5\u987B\u6070\u597D\u4EA7\u751F\u4E00\u4E2A\u53EF\u89C1 Temporal",n.sourceSpan);let p=c.flat();if(!p.some(F)||p.some(d=>d.breakBefore>0))throw new S("E_GRACE_INVALID_CONTENT","@grace \u7684\u501A\u97F3\u81F3\u5C11\u4EA7\u751F\u4E00\u4E2A\u53EF\u89C1\u5BF9\u8C61\uFF0C\u4E14\u4E0D\u80FD\u6362\u884C",o.sourceSpan);let f=new kn(this,h,c,s,a,this.side);for(let d of f.graceRuns)d.length<2||t.addAttachment(Kt([...d],!1,o.sourceSpan));return[f]}toString(t){let e=this.host?.toString(t)??"",n=this.grace?.toString(t)??"";return`@grace(${e}, ${n}, side=${this.side})`}},xs=Nn,nr=[{op:"M",x:0,y:0},{op:"C",cx1:-.01,cy1:.26,cx2:.14,cy2:.42,x:.29,y:.36}],or=.07,sr=.18,us=new I(3,4),kn=class extends W{host;graceColumns;graces;graceRuns;side;root;attachments;events;starts;hostOffset={x:0,y:0};graceOffsets=[];hookOrigin=null;constructor(t,e,n,o,s,r){super(),this.ast=t,this.host=e,this.root=o,this.attachments=s,this.side=r,this.T.copyFrom(e.T),this.mergeKey=e.mergeKey,this.initLayoutBox(),e.addon&&(this.addon={...e.addon}),e.addon=void 0,e.foldedInto=this;let c=[],a=[],l=[];for(let f of n){let d=f[0].t.clone().divPow2(),u=[];for(let g of f)g.foldedInto=this,a.push(g),l.push(d),F(g)&&u.push(g);u.length>0&&c.push(u)}this.graceColumns=c,this.graces=c.flat(),this.events=a,this.starts=l;let h=new Map,p=[];for(let f of this.graces){if(f.T.isZero()){h.delete(f.track);continue}let d=h.get(f.track);d||(h.set(f.track,d=[]),p.push(d)),d.push(f);let u=f.addon={...f.addon};u[Et]=(Number(u[Et])||0)+1,f.T.divPow2()}this.graceRuns=p}onTimeState(t){this.host.T.copyFrom(this.T);for(let e of this.side==="pre"?[...this.events,this.host]:[this.host,...this.events])e.t.copyFrom(this.t),e.layoutLine=this.layoutLine,e.onTimeState?.(t)}emitPlayback(t){let e=new I,n=new I;this.events.forEach((h,p)=>{n.copyFrom(this.starts[p]).add(h.T),n.compare(e)>0&&e.copyFrom(n)});let o=e.compare(us)>0?us:e,s=t.end.clone().sub(t.start),r=s.clone().mul(o),c=s.sub(r),a=e.isZero()?new I:r.clone().div(e),l=this.side==="pre"?t.start.clone():t.start.clone().add(c);this.side==="post"&&t.play(this.host,t.start.clone(),c),this.events.forEach((h,p)=>{t.play(h,this.starts[p].clone().mul(a).add(l),h.T.clone().mul(a))}),this.side==="pre"&&t.play(this.host,l.add(r),c)}prepareLayout(t){this.addon&&(this.host.addon=this.addon,this.addon=void 0);let e=t.layoutSubdomain(this,this.graceColumns,this.root,this.attachments),n=Gt([this.host],t),o=this.ast.size*Ut,s=o*.2,r=o*sr,a=(this.host.ports[fs]?.y??0)-r-e.height,l=Math.max(0,-a),h=this.side==="pre"?0:n+s;this.hostOffset={x:this.host.box.x+(this.side==="pre"?e.width+s:0),y:l},this.graceOffsets=e.positions.map(d=>({x:h+d.x,y:a+l+d.y})),this.box.w=n+s+e.width,this.box.h=l+this.host.box.h,this.box.anchor=this.hostOffset.x+this.host.box.anchor,this.box.visualAxis=l+this.host.box.visualAxis;for(let d in this.host.ports){let u=this.host.ports[d];this.ports[d]={...u,x:this.hostOffset.x+u.x,y:this.hostOffset.y+u.y}}this.ports[fs]??={x:this.box.anchor,y:this.hostOffset.y};let p=this.graces.filter(d=>!d.T.isZero()),f=this.side==="pre"?p.at(-1):p[0];this.hookOrigin=f?{x:this.graceOffsets[this.graces.indexOf(f)].x+f.box.anchor,y:Math.max(...this.graces.map((d,u)=>this.graceOffsets[u].y+d.box.h))}:null}onPlaced(){this.host.box.x=this.box.x+this.hostOffset.x,this.host.box.y=this.box.y+this.hostOffset.y,this.host.onPlaced?.(),this.graces.forEach((t,e)=>{t.box.x=this.box.x+this.graceOffsets[e].x,t.box.y=this.box.y+this.graceOffsets[e].y,t.onPlaced?.()})}paint(t){for(let s of[this.host,...this.graces]){s.paint(t);for(let r of s.decorations)r.paint(t)}if(!this.hookOrigin)return;let e=this.ast.size*Ut,n=this.hookOrigin,o=this.side==="pre"?1:-1;t.drawPath(nr,{stroke:"#000",strokeWidth:Math.max(.8,e*or)},{x:this.box.x+n.x,y:this.box.y+n.y,scaleX:e*o,scaleY:e})}};var jt="sans-serif",Rn="'Cascadia Mono', Consolas, 'Liberation Mono', 'Noto Sans Mono', monospace";function Ne(i){return`${i.fontWeight??"normal"} ${i.fontSize}px ${i.fontFamily??jt}`}var ve=class{measureText(t,e){let n=e.fontSize,o=e.fontFamily?.toLowerCase().includes("mono")??!1,s=0;for(let r of t)s+=r.charCodeAt(0)>127?1:o?.62:.58;return{w:Math.max(s*n,n*.25),h:n,baseline:n*.8}}},On=new ve,Mn=class{context;widths=new Map;constructor(t){this.context=t}clearCache(){this.widths.clear()}measureText(t,e){let n=Ne(e),o=`${n}\0${t}`,s=this.widths.get(o);return s===void 0&&(this.context.font=n,s=this.context.measureText(t).width,this.widths.set(o,s)),{w:Math.max(s,e.fontSize*.25),h:e.fontSize,baseline:e.fontSize*.8}}};var ir=/[A-Za-z0-9_./-]/;function he(i,t,e){let n=t+1;for(;n<e&&ir.test(i[n]);)n++;let o=i.slice(t+1,n);if(!o||n>=e||i[n]!=="(")return null;let s=n,r=1,c=0,a=null,l=!1,h=[],p=s+1,f=(u,g,y=!1)=>{let x=le(i,p,u);if(!y&&x.start>=x.end)return;let m=rr(i,x.start,x.end),b=m>x.start?le(i,x.start,m):void 0,w=m>x.start?le(i,m+1,x.end):x;h.push({span:x,valueSpan:w,nameSpan:b,equalsSpan:m>x.start?{start:m,end:m+1}:void 0,commaSpan:g===void 0?void 0:{start:g,end:g+1}})},d=(u,g)=>({name:o,span:{start:t,end:u},nameSpan:{start:t,end:s},openParenSpan:{start:s,end:s+1},closeParenSpan:g,args:h});for(n++;n<e;n++){let u=i[n];if(a){l?l=!1:u==="\\"?l=!0:u===a&&(a=null);continue}if(u==='"'){a=u;continue}if(u==="{")c++;else if(u==="}")c=Math.max(0,c-1);else if(u==="("&&c===0)r++;else if(u===")"&&c===0){if(--r)continue;return f(n),d(n+1,{start:n,end:n+1})}else u===","&&r===1&&c===0&&(f(n,n,!0),p=n+1)}return f(e),d(e)}var ms=/\s/;function le(i,t,e){let n=t,o=e;for(;n<o&&ms.test(i[n]);)n+=1;for(;o>n&&ms.test(i[o-1]);)o-=1;return{start:n,end:o}}function rr(i,t=0,e=i.length){let n=0,o=0,s=null,r=!1;for(let c=t;c<e;c++){let a=i[c];if(s){r?r=!1:a==="\\"?r=!0:a===s&&(s=null);continue}if(a==='"')s=a;else if(a==="("&&o===0)n++;else if(a===")"&&o===0)n=Math.max(0,n-1);else if(a==="{")o++;else if(a==="}")o=Math.max(0,o-1);else if(a==="="&&n===0&&o===0)return c}return-1}function ys(i,t,e){let n=1,o=null,s=!1;for(let r=t;r<e;r++){let c=i[r];if(o){s?s=!1:c==="\\"?s=!0:c===o&&(o=null);continue}if(c==='"')o=c;else if(c==="(")n++;else if(c===")"&&--n===0)return r}return-1}function gt(i,t,e){for(let n=t+1;n<e;n++)if(i[n]==="\\")n++;else if(i[n]==='"')return n;return-1}function vt(i){return i.length<2||!i.startsWith('"')||!i.endsWith('"')?i:i.slice(1,-1).replace(/\\(.)/gs,"$1")}function rt(i){return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function gs(i,t,e){let n=1,o=null,s=!1;for(let r=t+1;r<e;r++){let c=i[r];if(o){s?s=!1:c==="\\"?s=!0:c===o&&(o=null);continue}if(c==='"')o=c;else if(c==="{")n++;else if(c==="}"&&(n--,n===0))return r}return-1}var cr=/\s|\(|\)|\{|\}|,/;function bs(i,t,e){let n=t+1;for(;n<e&&!cr.test(i[n]);)n++;return n<=t+1?null:{label:i.slice(t+1,n),next:n}}var ar=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]+)?$/i,lr=["em","px"];function In(i){let t=i.match(ar);if(!t)return N.warning.InvalidLength(i,{start:0,end:i.length});let e=parseFloat(t[1]);if(!Number.isFinite(e))return N.warning.InvalidLength(i,{start:0,end:i.length});if(t[2]){let n=t[2].toLowerCase();return lr.includes(n)?{value:e,unit:n}:N.warning.InvalidLengthUnit(n,{start:t[1].length,end:i.length})}else return{value:e,unit:"px"}}var ws=/^(true|false)$/;function hr(i,t){if(i)return i==="content"?void 0:i;if(ws.test(t))return"boolean";if(t.startsWith('"'))return"string";if(!isNaN(Number(t)))return"number";if(!(In(t)instanceof N))return"length"}var Ss=22,pr=4,ct=class i{static systemVariables={fontsize:{type:"length",default:Ss},font:{type:"string",default:jt},numberfont:{type:"string",default:Rn},strict:{type:"boolean",default:!1}};scopeDepth;source;syntax;diagnostics;variables;documentDeclarations;functions;deSugarAtomFns;deSugarRelationFns;labelableNodes;nodes;constructor(t){t instanceof i?(this.scopeDepth=t.scopeDepth+1,this.documentDeclarations=t.documentDeclarations,this.source=t.source,this.diagnostics=t.diagnostics,this.syntax=t.syntax,this.variables={...t.variables},this.functions=t.functions,this.deSugarAtomFns=t.deSugarAtomFns,this.deSugarRelationFns=t.deSugarRelationFns,this.labelableNodes=t.labelableNodes,this.nodes=[]):(this.scopeDepth=0,this.documentDeclarations={},this.source=t.source,this.diagnostics=t.diagnostics??[],this.syntax={tokens:(t.commentSpans??[]).map(e=>({kind:"comment",span:e})),calls:[]},this.variables=Object.fromEntries(Object.entries(i.systemVariables).map(([e,n])=>[e,n.default])),Object.assign(this.variables,t.variables),this.functions=t.functions??new Map,this.labelableNodes=t.labelableNodes??[],this.nodes=t.toConsume??[],t.functions?[this.deSugarAtomFns,this.deSugarRelationFns]=i.getDeSugarFns(this.functions.values()):(this.deSugarAtomFns=[],this.deSugarRelationFns=[]))}static getDeSugarFns(t){let e=new Set(t),n=[],o=[];for(let s of e){let r=s.deSugarAtom;r&&r!==v.deSugarAtom&&n.push(r);let c=s.deSugarRelation;c&&c!==v.deSugarRelation&&o.push(c)}return[n,o]}pushNode(t){this.nodes.push(t);let e=t.labelable?.();e!==void 0&&this.labelableNodes.push(e)}setVariable(t,e){Object.hasOwn(i.systemVariables,t)&&(t==="fontsize"&&e&&(e=this.length2px(e)),(e===void 0||e===""||e===0)&&(e=i.systemVariables[t].default)),this.variables[t]=e}registerFunctions(t){let e=this.functions;for(let n of t){let o=n.def;if(!o)continue;let s=Array.isArray(o.name)?o.name:[o.name];for(let r of s){if(e.has(r.toLowerCase()))throw new Error(`Duplicate function name detected: ${r}`);e.set(r.toLowerCase(),n)}}[this.deSugarAtomFns,this.deSugarRelationFns]=i.getDeSugarFns(this.functions.values())}parse(t=0,e=this.source.length){return this.makeNodes(this.parseGrammar(t,e)),this.nodes}parseSyntax(t=0,e=this.source.length){if(this.parseGrammar(t,e,!0),this.scopeDepth===0){let n=(o,s)=>o.span.start-s.span.start||o.span.end-s.span.end;this.syntax.tokens.sort(n),this.syntax.calls.sort(n)}return this.syntax}addSyntax(t,e){e&&e.start<e.end&&this.syntax.tokens.push({kind:t,span:e})}recordSyntax(t){if(t.kind==="brace"){this.addSyntax("punctuation",{start:t.span.start,end:t.span.start+1});let c=Math.min(this.source.length,t.span.end-1);this.source[c]==="}"&&this.addSyntax("punctuation",{start:c,end:c+1}),new i(this).parseSyntax(t.span.start+1,c);return}if(t.kind==="label"){this.addSyntax("label",t.span);return}if(t.kind==="sugar"||t.typed){this.addSyntax(t.syntaxKind??"operator",t.span);return}let{kind:e,typed:n,syntaxKind:o,...s}=t;this.syntax.calls.push(s),this.addSyntax("function",s.nameSpan),this.addSyntax("punctuation",s.openParenSpan),this.addSyntax("punctuation",s.closeParenSpan);let r=this.functions.get(s.name.toLowerCase())?.def;for(let c=0;c<s.args.length;c++){let a=s.args[c];this.addSyntax("property",a.nameSpan),this.addSyntax("punctuation",a.equalsSpan),this.addSyntax("punctuation",a.commaSpan);let l=a.nameSpan?this.source.slice(a.nameSpan.start,a.nameSpan.end).toLowerCase():void 0,h=r&&$t(r,l,c);if(h==="content")new i(this).parseSyntax(a.valueSpan.start,a.valueSpan.end);else{let p=this.source.slice(a.valueSpan.start,a.valueSpan.end),f=hr(h,p);f&&this.addSyntax(f,a.valueSpan)}}}makeNodes(t,e=0,n=t.length){t:for(;e<n;e++){let o=t[e];if(typeof o=="number"){let s=this.nodes.at(-1);s instanceof Z&&s.sourceSpan.end===o?s.sourceSpan.end=o+1:this.nodes.push(new Z({start:o,end:o+1},null));continue}switch(o.kind){case"call":this.pushNode(this.parseCallNode(o));break;case"brace":let s=new i(this);this.nodes.push(new K(o.span,s.parse(o.span.start+1,o.span.end-1),null));break;case"label":let r=this.labelableNodes.at(-1);r?r.label!==void 0?this.diagnostics.push(N.warning.TargetAlreadyLabeled(o.label,r.label,o.span)):(r.label=o.label,this.nodes.push(new lt(o.span,o.label,r))):this.diagnostics.push(N.warning.LabelWithoutTarget(o.label,o.span));break;case"sugar":for(let a of this.deSugarRelationFns){let l=a(this,t,e);if(l!==null){e=l-1;continue t}}let c=this.nodes.at(-1);c instanceof Z&&c.sourceSpan.end===o.span.start?c.sourceSpan.end=o.span.end:this.nodes.push(new Z(o.span,null));break}}return e}parseGrammar(t,e,n=!1){let o=[],s=r=>{o.push(r),n&&this.recordSyntax(r)};t:for(;(t=ut(this.source,t,e))<e;){let r=this.source[t];if(r==="@"){let c=he(this.source,t,e);if(c){s(Object.assign(c,{kind:"call",typed:!1}));let l=!1;for(let h of c.args){let p=h.nameSpan!==void 0;if(p&&!l)l=!0;else if(!p&&l){let f=N.error.PosAfterNamedArg(c.name,h.span);if(!n)throw f;this.diagnostics.push(f)}}if(!c.closeParenSpan){let h=N.error.UnterminatedCall(c.name,c.span);if(!n)throw h;this.diagnostics.push(h)}t=c.span.end;continue}let a=bs(this.source,t,e);if(a){s({kind:"label",span:{start:t,end:a.next},label:a.label}),t=a.next;continue}}if(r==="{"){let c=gs(this.source,t,e);(c<0||c>=e||c<=t)&&(this.diagnostics.push(N.warning.UnmatchedBrace({start:t,end:e})),c=e),s({kind:"brace",span:{start:t,end:c+1}}),t=c+1;continue}for(let c of this.deSugarAtomFns)try{let a=c(this.source,t,e,this.scopeDepth);if(a){s(a.node),t=a.next;continue t}}catch(a){throw a instanceof N?this.diagnostics.push(a):this.diagnostics.push(N.error.Bug(a.toString(),{start:t,end:e})),a}o.push(t++)}return o}parseCallNode(t){let e=this.functions.get(t.name.toLowerCase()),n=e?.def;if(!e||!n){if(this.variables.strict)throw N.error.UnknownFunction(t.name,t.span);return this.diagnostics.push(N.warning.UnknownFunction(t.name,t.span)),new v(t.span,null)}let o=n.args;if(!t.typed){let s=new Map;for(let r=0;r<t.args.length;r++){let c=t.args[r],a=c.nameSpan?this.source.slice(c.nameSpan.start,c.nameSpan.end).toLowerCase():void 0,l=$t(n,a,r),h=a??r;if(l===void 0){n.allowExtraArgs?s.set(h,c):this.diagnostics.push(N.warning.TooManyPosArgs(t.name,o.length,r+1,c.valueSpan));continue}let p=this.parseArgWithType(c.valueSpan,l,t.span.start);p!==null&&s.set(h,p)}return new e(t.span,s,this,null)}return new e(t.span,t.args,this,null)}parseArgWithType(t,e,n){let o=le(this.source,t.start,t.end),s=o.start,r=o.end;if(s>=r)return null;let c=e==="content"?"":this.source.slice(s,r);switch(e){case"number":let a=Number(c);return Number.isFinite(a)?a:(this.diagnostics.push(N.warning.InvalidNumber(c,o)),null);case"boolean":let l=c;return ws.test(l)?l==="true":(this.diagnostics.push(N.warning.InvalidBoolean(c,o)),null);case"content":{let f=this.labelableNodes,d=f.length,u=f.at(-1),g=u?.label,y=u&&Object.hasOwn(u,"label");try{let m=new i(this).parse(s,r);return m.length===1?m[0]:new K(o,m,null)}catch(x){if(f.length=d,u&&(y?u.label=g:delete u.label),this.variables.strict||!(x instanceof N))throw x;return this.diagnostics.push(x,N.warning.InvalidContent(o)),null}}case"label":n??=t.start;for(let f=this.labelableNodes.length-1;f>=0;f--){let d=this.labelableNodes[f];if(d&&!(d.sourceSpan.start>=n)&&d.label==c)return d}throw N.error.UnknownLabel(c,o);case"length":let h=In(c);return h instanceof N?(h.span.start+=s,h.span.end+=s,this.diagnostics.push(h),null):h;default:return vt(c)}return null}length2px(t){return t.unit==="em"?t.value*this.variables.fontsize:t.value}};function ut(i,t,e){for(;t<e&&Cs(i[t]);)t++;return t}function pe(i,t,e=0){for(;t>=e&&Cs(i[t]);)t--;return t}function Cs(i){switch(i){case" ":case" ":case"\v":case"\f":case"\xA0":case"\uFEFF":case"\u3000":return!0;default:return!1}}var fr=/^[A-GXZ]/,ke=/^[0-9]/,Me=/^[#bn]+/,As=/^[+-]?\d+/,Ls=/^[,']+/;function Nt(i,t=0,e=i.length){if(e-t===0)return new S("E_WRONG_NOTE_NAME",'\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u4E0D\u80FD\u4E3A\u7A7A',{start:t,end:e});let n=0,o=null,s=null,r=null,c=!1,a;for(let l=t;l<e;l++){let h=i[l];switch(n){case 0:if(fr.test(h))o=h,c=!0,n=1;else if(ke.test(h))o=h,c=!1,n=3;else{let f=i.slice(l,e).match(Me);if(f)s=f[0],l+=s.length-1,c=!1,n=2;else return new S("E_WRONG_NOTE_NAME",`\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u9996\u5B57\u7B26 "${h}" \u4E0D\u5408\u6CD5\uFF0C\u671F\u671B A-G (a-g)\u30010-9\u3001X \u6216 Z \u5F00\u5934\uFF0C\u6216\u5728\u5F00\u5934\u76F4\u63A5\u4F7F\u7528\u5347\u964D\u53F7(#/b/n)`,{start:l,end:l+1})}break;case 1:let p=i.slice(l,e);if(a=p.match(As),a){r=parseInt(a[0],10),l+=a[0].length-1,n=4;break}if(a=p.match(Me),a){s=a[0],l+=s.length-1,n=5;break}return{name:o,next:l,acc:null,octave:null,absOctave:c};case 2:if(ke.test(h)){o=h,n=6;break}else return new S("E_WRONG_NOTE_NAME",`\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u5728\u5347\u964D\u53F7\u5F00\u5934\u65F6\uFF0C\u5E94\u8BE5\u63A5\u6570\u5B57\u97F3\u540D\uFF0C\u4F46\u53D1\u73B0\u5B57\u7B26 "${h}"`,{start:l,end:l+1});case 3:if(a=i.slice(l,e).match(Ls),a){let f=a[0];return r=Ts(f),{name:o,next:l+f.length,acc:s,octave:r,absOctave:c}}if(a=i.slice(l,e).match(Me),a&&!ke.test(i[l+a[0].length]??"")){let f=a[0];s=f,l+=f.length-1,n=6;break}return{name:o,next:l,acc:s,octave:r,absOctave:c};case 4:if(a=i.slice(l,e).match(Me),a&&!ke.test(i[l+a[0].length]??"")){let f=a[0];return s=f,{name:o,next:l+f.length,acc:s,octave:r,absOctave:c}}return{name:o,next:l,acc:null,octave:r,absOctave:c};case 5:return a=i.slice(l,e).match(As),a?(r=parseInt(a[0],10),{name:o,next:l+a[0].length,acc:s,octave:r,absOctave:c}):{name:o,next:l,acc:s,octave:null,absOctave:c};case 6:if(a=i.slice(l,e).match(Ls),a){let f=a[0];return r=Ts(f),{name:o,next:l+f.length,acc:s,octave:r,absOctave:c}}return{name:o,next:l,acc:s,octave:r,absOctave:c};default:return N.error.Bug("\u97F3\u7B26\u540D\u79F0\u89E3\u6790\u72B6\u6001\u673A\u8FDB\u5165\u4E86\u672A\u5B9A\u4E49\u7684\u72B6\u6001",{start:l,end:e})}}return o===null?new S("E_WRONG_NOTE_NAME",'\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u5728\u5347\u964D\u53F7\u5F00\u5934\u65F6\uFF0C\u5E94\u8BE5\u63A5\u6570\u5B57\u97F3\u540D\uFF0C\u4F46\u8F93\u5165\u5DF2\u7ED3\u675F',{start:t,end:e}):{name:o,next:e,acc:s,octave:r,absOctave:c}}function Ts(i){let t=0;for(let e=0;e<i.length;e++)i[e]===","?t--:i[e]==="'"&&t++;return t}var Oe=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Es=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],dt={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11,1:0,2:2,3:4,4:5,5:7,6:9,7:11},Re=["C","D","E","F","G","A","B"],Pn=[0,2,4,5,7,9,11];function kt(i,t){let e=i[0],n="",o=1;o<i.length&&(i[o]==="#"||i[o]==="b"||i[o]==="n")&&(n=i[o],o++);let s=dt[e+n];if(s===void 0)throw N.error.InvalidTonality(i,{start:0,end:o});if(o<i.length){let r=i.slice(o);if(t=Number(r),!/^-?\d+$/.test(r)||!Number.isSafeInteger(t))throw N.error.InvalidTonality(i,{start:o,end:i.length})}return(t+1)*12+s}function Dn(i,t=!0,e=0){for(let n of i)n==="#"?e++:n==="b"?e--:n==="n"&&!t&&(e=0);return e}function $n(i,t,e,n){let o=dt[i];if(o===void 0)return null;let s=Dn(t);return i>="1"&&i<="7"?kt(n,4)+o+s+e*12:(e+1)*12+o+s}function _s(i,t,e,n){let o,s;if(i>="1"&&i<="7")o=Number(i)-1,s=e;else{let a=fe(i,t,e,n);if(!a)return;o=Number(a.renderName)-1,s=a.renderOctave}let r=kt(n,4),c=s*7+o;return a=>{let l=c+a,h=Math.floor(l/7);return r+Pn[(l%7+7)%7]+h*12}}function Fn(i){return(i%12+12)%12}function ur(i){let t=Fn(i);return t>6?t-12:t}function dr(i){return i===0?"":i>0?"#".repeat(i):"b".repeat(-i)}function fe(i,t,e,n){let o=Re.indexOf(n[0]),s=Re.indexOf(i),r=$n(i,t,e,n);if(o<0||s<0||r===null)return null;let c=kt(n,4),a=(s-o+Re.length)%Re.length,l=Fn(c+Pn[a]),h=ur(Fn(r)-l),p=(r-c-Pn[a]-h)/12;return{renderName:String(a+1),renderAcc:dr(h),renderOctave:p}}var xr={"#":{w:.46,h:.78,baseline:.63,commands:[{op:"M",x:.34,y:.05},{op:"L",x:.27,y:.95},{op:"M",x:.72,y:.05},{op:"L",x:.65,y:.95},{op:"M",x:.08,y:.38},{op:"L",x:.9,y:.28},{op:"M",x:.05,y:.72},{op:"L",x:.87,y:.62}]},b:{w:.38,h:.82,baseline:.67,commands:[{op:"M",x:.3,y:.04},{op:"L",x:.3,y:.94},{op:"M",x:.3,y:.5},{op:"Q",cx:.92,cy:.36,x:.76,y:.68},{op:"Q",cx:.63,cy:.87,x:.3,y:.86}]},n:{w:.42,h:.82,baseline:.67,commands:[{op:"M",x:.28,y:.05},{op:"L",x:.28,y:.82},{op:"L",x:.72,y:.68},{op:"L",x:.72,y:.95},{op:"M",x:.72,y:.95},{op:"L",x:.72,y:.18},{op:"L",x:.28,y:.32}]}};function mr(i,t){let e=xr[i];if(!e)return null;let n=t*.72;return{w:e.w*n,h:e.h*n,baseline:e.baseline*n,strokeWidth:t*.06,commands:e.commands}}function Ie(i,t,e,n,o){let s=[],r=t*.42,c=e,a=0;for(let l of i){let h=mr(l,t);if(!h)continue;let p=n-h.baseline-r;s.push({shape:h,x:c,y:p}),p<a&&(a=p),c+=h.w+o}return{placed:s,right:c,top:a}}function Pe(i,{shape:t,x:e,y:n},o,s){i.drawPath(t.commands,{stroke:s,strokeWidth:t.strokeWidth},{x:o.x+e,y:o.y+n,scaleX:t.w,scaleY:t.h})}function yr(i){try{return kt(i,4),i}catch{}let t=Nt(i.replace(/^[a-g]/,c=>c.toUpperCase()));if(t instanceof N||t.next!==i.length)return null;let e=dt[t.name];if(e===void 0)return null;let n=Dn(t.acc??"",!1),s=((t.absOctave?t.octave??4:4+(t.octave??0))+1)*12+e+n,r=Object.keys(dt).filter(c=>dt[c]===(s%12+12)%12&&/^[A-G]/.test(c));return(n<0?r.at(-1):r[0])+(Math.floor(s/12)-1)}var zn=class extends v{static def={name:["key","1"],description:"\u8BBE\u7F6E\u65F6\u95F4\u7EBF\u4E0A\u7684 1= \u8C03\u6027\u57FA\u51C6",details:`~~~jpfun
|
|
20
|
+
\u7AEF\u70B9\u4E5F\u53EF\u6807\u5728\u589E\u65F6\u7EBF\u4E0A\u3002\u7EC8\u70B9\u6CA1\u6709\u529B\u5EA6\u65F6\uFF0C\u53D6\u540C\u8F68\u3001\u4E0D\u665A\u4E8E\u7EC8\u70B9\u7684\u6700\u540E\u4E00\u4E2A\u539F\u59CB\u529B\u5EA6\u4F5C\u4E3A\u4FDD\u6301\u57FA\u51C6\uFF1B\u627E\u4E0D\u5230\u65F6\u7ED9\u51FA\u8B66\u544A\u5E76\u4EC5\u7ED8\u5236\u3002\u589E\u65F6\u7EBF\u5EF6\u7EED\u7684\u97F3\u7B26\u4FDD\u6301\u8D77\u97F3\u65F6\u7684\u529B\u5EA6\u3002`,allowExtraArgs:!1,args:[{name:"from",description:"\u6E10\u53D8\u8D77\u70B9\u7684\u6807\u7B7E",type:"label",default:null},{name:"to",description:"\u6E10\u53D8\u7EC8\u70B9\u7684\u6807\u7B7E",type:"label",default:null},{name:"dv",description:"\u529B\u5EA6\u53D8\u5316\u91CF\uFF0C\u6B63\u6570\u6E10\u5F3A\uFF0C\u8D1F\u6570\u6E10\u5F31",type:"number",default:null}]};static loweringFinalize=t=>{let e=t.attachments.filter(o=>o instanceof ue);if(e.length===0)return;let n=[];for(let o of t.astToTemporal.values())for(let s of o){let i=s.playbackState?.velocity;if(i===void 0)continue;let c=s;for(;c.foldedInto;)c=c.foldedInto;n.push({node:s,host:c,velocity:i,increment:0})}n.sort((o,s)=>o.host.t.compare(s.host.t)||o.node.order-s.node.order);for(let o of e){let s=o.end.playbackState?.velocity??n.find(a=>a.host===o.toHost)?.velocity;for(let a=n.length-1;s===void 0&&a>=0;a--){let l=n[a];l.host.track===o.track&&l.host.t.compare(o.toHost.t)<=0&&(s=l.velocity)}if(s===void 0){t.diagnostics.push(new P("W_DYN_NO_VELOCITY","@dyn \u7EC8\u70B9\u53CA\u6B64\u524D\u540C\u8F68\u6CA1\u6709\u53EF\u7528\u7684\u529B\u5EA6\u57FA\u51C6\uFF0C\u4EC5\u7ED8\u5236\u6E10\u53D8\u7EBF",o.sourceSpan));continue}let i=n.find(a=>a.host.track===o.track&&a.host.t.compare(o.toHost.t)>0&&a.velocity!==s)?.host.t,c=o.toHost.t.clone().sub(o.fromHost.t);for(let a of n){if(a.host.track!==o.track||a.host.t.compare(o.fromHost.t)<0||i&&a.host.t.compare(i)>=0)continue;let h=a.host.t.compare(o.toHost.t)>=0?1:a.host.t.clone().sub(o.fromHost.t).div(c).toNumber();a.increment+=o.dv*h}}for(let o of n){if(o.increment===0)continue;let s=Math.max(1,Math.min(127,o.velocity+o.increment));o.node.playbackState={...o.node.playbackState,velocity:s}}};from;to;dv;size;loweringEnter(t){let e=t.getTemporalNodes(this.from).at(0),n=t.getTemporalNodes(this.to).at(-1);if(!e||!n)return t.diagnostics.push(k.warning.UnresolvedEndpoint("dyn",this.sourceSpan)),[];let o=e,s=n;for(;o.foldedInto;)o=o.foldedInto;for(;s.foldedInto;)s=s.foldedInto;if(!F(o)||!F(s))return t.diagnostics.push(k.warning.UnresolvedEndpoint("dyn",this.sourceSpan)),[];if(o.track!==s.track)throw new C("E_DYN_CROSS_TRACK","@dyn \u7684\u4E24\u4E2A\u7AEF\u70B9\u5FC5\u987B\u4F4D\u4E8E\u540C\u4E00\u97F3\u8F68",this.sourceSpan);if(o.t.equals(s.t))throw new C("E_DYN_ZERO_SPAN","@dyn \u7684\u4E24\u4E2A\u7AEF\u70B9\u5FC5\u987B\u4F4D\u4E8E\u4E0D\u540C\u65F6\u95F4",this.sourceSpan);return o.t.compare(s.t)<0?t.addAttachment(new ue(this,n,o,s)):t.addAttachment(new ue(this,e,s,o)),[]}constructor(t,e,n,o=null){super(t,o);let[s,i,c]=this.getArgValue(e,n),a=c;if(!Number.isFinite(a)||a===0)throw new C("E_DYN_INVALID_DELTA","@dyn \u7684 dv \u5FC5\u987B\u662F\u975E\u96F6\u6709\u9650\u6570",t);a=Math.max(-127,Math.min(127,a)),a!==c&&n.diagnostics.push(new P("W_DYN_DELTA_CLAMPED",`@dyn \u7684 dv \u5FC5\u987B\u5728 -127 \u5230 127 \u4E4B\u95F4\uFF0C\u5DF2\u88AB\u9650\u5236\u4E3A ${a}`,t)),this.from=s,this.to=i,this.dv=a,this.size=n.variables.fontsize}toString(t){let e=n=>n.label??n.toString(t);return`@dyn(${e(this.from)}, ${e(this.to)}, ${this.dv})`}},vs=$n,ue=class{ast;end;fromHost;toHost;layer="foreground";constructor(t,e,n,o){this.ast=t,this.end=e,this.fromHost=n,this.toHost=o}get sourceSpan(){return this.ast.sourceSpan}get endPoints(){return[this.fromHost,this.toHost]}get dv(){return this.ast.dv}get track(){return this.fromHost.track}createGeometry(t){let e=this.fromHost.layoutLine,n=this.toHost.layoutLine,o=[this.fromHost,this.toHost],s=[],i=this.ast.size;for(let u=e;u<=n;u++){let g=t.getRangeColumns(u,o,this.track);if(g.some(x=>x.length>0)){for(let x of g)for(let m of x)i=Math.max(i,m.ast.size);s.push({line:u,startX:u===e?this.fromHost.box.x:this.lineEntryX(t,u),endX:u===n?this.toHost.box.x+this.toHost.box.w:this.lineRightX(t,u)})}}for(let u of s)u.line>e&&(u.startX-=i/4);let c=Math.max(.75,i*.035),a=s.filter(u=>u.startX!==u.endX),l=a.reduce((u,g)=>u+Math.abs(g.endX-g.startX),0);if(l===0)return{regions:[],paint(){}};let h=i*.4,p=c/2,f=0,d=a.map(u=>{let g=Math.abs(u.endX-u.startX),x=f/l,m=(f+g)/l;f+=g;let y=t.getRangeExtents(u.line,o,this.track),b=t.getVisualAxis(u.line,this.track),w=y?b+y.top:b;return{line:u.line,startX:u.startX,endX:u.endX,lineY:w-i*.62,startOpen:h*(this.dv>0?x:1-x),endOpen:h*(this.dv>0?m:1-m)}});return{regions:d.map(u=>({x:Math.min(u.startX,u.endX)-p,y:u.lineY-Math.max(u.startOpen,u.endOpen)/2-p,w:Math.abs(u.endX-u.startX)+c,h:Math.max(u.startOpen,u.endOpen)+c,line:u.line,track:this.track})),paint(u){let g={stroke:"#000",strokeWidth:c};for(let x of d)u.drawLine(x.startX,x.lineY-x.startOpen/2,x.endX,x.lineY-x.endOpen/2,g),u.drawLine(x.startX,x.lineY+x.startOpen/2,x.endX,x.lineY+x.endOpen/2,g)}}}lineEntryX(t,e){return t.lines[e].trackRuns.get(this.track)?.find(o=>!o.T.isZero())?.box.x??t.originX}lineRightX(t,e){let n=t.lines[e].trackRuns;if(n.size===0)return t.originX+t.width;let o=t.originX;for(let s of n.values())for(let i of s)o=Math.max(o,i.box.x+i.box.w);return o}};var Rt=class r{parent;groups=[];constructor(t=null){this.parent=t}group(t,e){let n=this.groups.find(o=>o.laneKey===t.laneKey);for(n||(n={laneKey:t.laneKey,members:[],measure:t.measure,place:t.place},this.groups.push(n));n.members.length<e;)n.members.push(new r(this));return n}};var Xt=.7,Ms="shoulder";function Os(r,t){let e=r;typeof e.size=="number"&&(e.size*=t);for(let n of r.children??[])Os(n,t)}var zn=class r extends _{static def={name:["grace"],description:"\u501A\u97F3",details:"~~~jpfun\n@grace(1, {3 2}, side=pre)\n~~~\n**\u7B80\u5199**\uFF1A\u7BAD\u5934\u59CB\u7EC8\u6307\u5411\u5BBF\u4E3B\n- `2>1`\uFF1A`2` \u662F `1` \u7684\u524D\u501A\u97F3\uFF0C\u4F4D\u4E8E\u5DE6\u4E0A\u65B9\n- `1<2`\uFF1A`2` \u662F `1` \u7684\u540E\u501A\u97F3\uFF0C\u4F4D\u4E8E\u53F3\u4E0A\u65B9\n- `{3 2}>1`\uFF1A\u4E00\u7EC4\u524D\u501A\u97F3\uFF0C\u7B49\u4EF7\u4E8E\u4E0A\u4F8B\n- `1>2>3`\uFF1A\u5141\u8BB8\u5D4C\u5957\uFF0C`1` \u4FEE\u9970 `2`\uFF0C`2` \u4FEE\u9970 `3`\n\n\u501A\u97F3\u9ED8\u8BA4\u5E26\u4E00\u6761\u51CF\u65F6\u7EBF\uFF0C\u6309\u516B\u5206\u97F3\u7B26\u4E66\u5199\uFF1B\u518D\u52A0 `/` \u53D8\u4E3A\u5341\u516D\u5206\u97F3\u7B26\n\n\u501A\u97F3\u5185\u5BB9\u53EF\u4EE5\u662F\u6362\u884C\u4EE5\u5916\u7684\u4EFB\u610F\u7ED3\u6784\uFF0C\u4F8B\u5982 `{1 & 3}>2` \u7684\u4E24\u4E2A\u58F0\u90E8\u540C\u65F6\u594F\u51FA",allowExtraArgs:!1,args:[{name:"host",description:"\u88AB\u501A\u97F3\u4FEE\u9970\u7684\u5BBF\u4E3B\u5185\u5BB9",type:"content",default:null},{name:"grace",description:"\u501A\u97F3\u5185\u5BB9\uFF0C\u591A\u4E2A\u97F3\u7B26\u53EF\u7528\u5927\u62EC\u53F7\u7EC4\u5408\uFF0C\u4E5F\u53EF\u4EE5\u542B\u591A\u4E2A\u58F0\u90E8",type:"content",default:null},{name:"side",description:"`pre` \u4E3A\u524D\u501A\u97F3\uFF0C`post` \u4E3A\u540E\u501A\u97F3",type:"string",default:"pre"}]};labelable(){return _.findLabelable(this.host)}static deSugarAtom(t,e,n){let o=t[e];switch(o){case">":o="pre";break;case"<":o="post";break;default:return null}return{next:e+1,node:{kind:"sugar",data:{class:r,side:o},span:{start:e,end:e+1}}}}static deSugarRelation(t,e,n){let o=e[n++];if(o.kind!=="sugar"||o.data?.class!==r)return null;let s=o.data.side,i=t.nodes.length-1;for(;i>=0&&t.nodes[i]instanceof U;)i--;if(i<0)throw new C("E_GRACE_NO_TARGET","@grace\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u5DE6\u8FB9\u6CA1\u6709\u627E\u5230\u76EE\u6807",o.span);let c=t.nodes[i],a=i;if(c instanceof ft){let h=c.target;for(;h&&!t.nodes.includes(h);)h=h.parent;for(let p=i-1;p>=0;p--)if(t.nodes[p]===h){c=new Y({start:h.sourceSpan.start,end:c.sourceSpan.end},t.nodes.slice(p,i+1),null),a=p;break}}let l=t.nodes;t.nodes=[],t.makeNodes(e,n);for(let h=0;h<t.nodes.length;h++){let p=t.nodes[h];if(p instanceof U)continue;let f=s==="pre"?r.attachPre(c,p,o.span,t):r.create(t,o.span,"post",c,p);for(l.length=a,l.push(f);++h<t.nodes.length;)l.push(t.nodes[h]);return t.nodes=l,e.length}throw new C("E_GRACE_NO_TARGET","@grace\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u53F3\u8FB9\u6CA1\u6709\u627E\u5230\u76EE\u6807",o.span)}host;grace;side="pre";size;static attachPre(t,e,n,o){if(e instanceof r&&e.side==="pre"){let s=e,i=1;for(;s.grace instanceof r&&s.grace.side==="pre";)s=s.grace,i++;let c=new Map;c.set(0,s.grace),c.set(1,t);let a=Xt**i,l=new r(n,c,o,null,Xt*a);return l.size*=a,s.setGrace(l,1),e}return r.create(o,n,"pre",e,t)}static create(t,e,n,o,s){let i=new Map;return i.set(0,o),i.set(1,s),i.set("side",n),new r(e,i,t)}get children(){let t=[];return this.host&&t.push(this.host),this.grace&&t.push(this.grace),t}constructor(t,e,n,o=null,s=Xt){if(super(t,o),this.size=n.variables.fontsize,[this.host,this.grace,this.side]=this.getArgValue(e,n),this.side!=="pre"&&this.side!=="post")throw new C("E_GRACE_INVALID_SIDE","@grace \u7684 side \u53C2\u6570\u5FC5\u987B\u662F 'pre' \u6216 'post'",t);this.adopt(this.host),this.setGrace(this.grace,s)}setGrace(t,e=Xt){Os(t,e),this.grace=t,this.adopt(t)}adopt(t){t.parent=this,this.sourceSpan.start=Math.min(this.sourceSpan.start,t.sourceSpan.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,t.sourceSpan.end)}loweringEnter(t,e){let n=this.host,o=this.grace;if(!n||!o)throw new C("E_GRACE_MISSING_ARGS","@grace \u9700\u8981\u540C\u65F6\u7ED9\u51FA\u5BBF\u4E3B\u548C\u501A\u97F3",this.sourceSpan);let s=new Rt(e),i=[],c=[],a=[],l=(d,u)=>t.trackedEvents(d,new O,u);t.isolateFromLoweringGroups(()=>{this.side==="post"&&(i=l(n,e).flat()),t.beginLoweringGroup(this,{onAttachment(d){a.push(d)}}),c=l(o,s),t.endLoweringGroup(this),this.side==="pre"&&(i=l(n,e).flat())});let[h]=i;if(i.length!==1||!F(h))throw new C("E_GRACE_INVALID_HOST","@grace \u7684\u5BBF\u4E3B\u5FC5\u987B\u6070\u597D\u4EA7\u751F\u4E00\u4E2A\u53EF\u89C1 Temporal",n.sourceSpan);let p=c.flat();if(!p.some(F)||p.some(d=>d.breakBefore>0))throw new C("E_GRACE_INVALID_CONTENT","@grace \u7684\u501A\u97F3\u81F3\u5C11\u4EA7\u751F\u4E00\u4E2A\u53EF\u89C1\u5BF9\u8C61\uFF0C\u4E14\u4E0D\u80FD\u6362\u884C",o.sourceSpan);let f=new Hn(this,h,c,s,a,this.side);for(let d of f.graceRuns)d.length<2||t.addAttachment(jt([...d],!1,o.sourceSpan));return[f]}toString(t){let e=this.host?.toString(t)??"",n=this.grace?.toString(t)??"";return`@grace(${e}, ${n}, side=${this.side})`}},Is=zn,Tr=[{op:"M",x:0,y:0},{op:"C",cx1:-.01,cy1:.26,cx2:.14,cy2:.42,x:.29,y:.36}],Er=.07,Lr=.18,Rs=new O(3,4),Hn=class extends D{host;graceColumns;graces;graceRuns;side;root;attachments;events;starts;hostOffset={x:0,y:0};graceOffsets=[];hookOrigin=null;constructor(t,e,n,o,s,i){super(),this.ast=t,this.host=e,this.root=o,this.attachments=s,this.side=i,this.T.copyFrom(e.T),this.mergeKey=e.mergeKey,this.initLayoutBox(),e.addon&&(this.addon={...e.addon}),e.addon=void 0,e.foldedInto=this;let c=[],a=[],l=[];for(let f of n){let d=f[0].t.clone().divPow2(),u=[];for(let g of f)g.foldedInto=this,a.push(g),l.push(d),F(g)&&u.push(g);u.length>0&&c.push(u)}this.graceColumns=c,this.graces=c.flat(),this.events=a,this.starts=l;let h=new Map,p=[];for(let f of this.graces){if(f.T.isZero()){h.delete(f.track);continue}let d=h.get(f.track);d||(h.set(f.track,d=[]),p.push(d)),d.push(f);let u=f.addon={...f.addon};u[Mt]=(Number(u[Mt])||0)+1,f.T.divPow2()}this.graceRuns=p}onTimeState(t){this.host.T.copyFrom(this.T);let e;for(let n of this.side==="pre"?[...this.events,this.host]:[this.host,...this.events]){n.t.copyFrom(this.t),n.layoutLine=this.layoutLine;let o=n.onTimeState?.(t);n===this.host&&(this.T.copyFrom(n.T),e=o)}return e}prepareHorizontal(t){this.host.prepareHorizontal?.(t)}emitPlayback(t){let e=new O,n=new O;this.events.forEach((h,p)=>{n.copyFrom(this.starts[p]).add(h.T),n.compare(e)>0&&e.copyFrom(n)});let o=e.compare(Rs)>0?Rs:e,s=t.end.clone().sub(t.start),i=s.clone().mul(o),c=s.sub(i),a=e.isZero()?new O:i.clone().div(e),l=this.side==="pre"?t.start.clone():t.start.clone().add(c);this.side==="post"&&t.play(this.host,t.start.clone(),c),this.events.forEach((h,p)=>{t.play(h,this.starts[p].clone().mul(a).add(l),h.T.clone().mul(a))}),this.side==="pre"&&t.play(this.host,l.add(i),c)}prepareLayout(t){this.addon&&(this.host.addon=this.addon,this.addon=void 0);let e=t.layoutSubdomain(this,this.graceColumns,this.root,this.attachments),n=Yt([this.host],t);this.springConfig={...this.host.springConfig,...this.springConfig};let o=this.ast.size*Xt,s=o*.2,i=o*Lr,a=(this.host.ports[Ms]?.y??0)-i-e.height,l=Q(this.host),h=Math.max(0,-a,-l.y),p=this.side==="pre"?0:n+s;this.hostOffset={x:this.host.box.x+(this.side==="pre"?e.width+s:0),y:h},this.graceOffsets=e.positions.map(u=>({x:p+u.x,y:a+h+u.y})),this.box.w=n+s+e.width,this.box.h=h+l.y+l.h,this.box.anchor=this.hostOffset.x+this.host.box.anchor,this.box.visualAxis=h+this.host.box.visualAxis;for(let u in this.host.ports){let g=this.host.ports[u];this.ports[u]={...g,x:this.hostOffset.x+g.x,y:this.hostOffset.y+g.y}}this.ports[Ms]??={x:this.box.anchor,y:this.hostOffset.y};let f=this.graces.filter(u=>!u.T.isZero()),d=this.side==="pre"?f.at(-1):f[0];this.hookOrigin=d?{x:this.graceOffsets[this.graces.indexOf(d)].x+d.box.anchor,y:Math.max(...this.graces.map((u,g)=>this.graceOffsets[g].y+u.box.h))}:null}onPlaced(){this.host.box.x=this.box.x+this.hostOffset.x,this.host.box.y=this.box.y+this.hostOffset.y,this.host.onPlaced?.(),this.graces.forEach((t,e)=>{t.box.x=this.box.x+this.graceOffsets[e].x,t.box.y=this.box.y+this.graceOffsets[e].y,t.onPlaced?.()})}paint(t){for(let s of[this.host,...this.graces]){s.paint(t);for(let i of s.decorations)i.paint?.(t)}if(!this.hookOrigin)return;let e=this.ast.size*Xt,n=this.hookOrigin,o=this.side==="pre"?1:-1;t.drawPath(Tr,{stroke:"#000",strokeWidth:Math.max(.8,e*Er)},{x:this.box.x+n.x,y:this.box.y+n.y,scaleX:e*o,scaleY:e})}};var Zt="sans-serif",Gn="'Cascadia Mono', Consolas, 'Liberation Mono', 'Noto Sans Mono', monospace";function Pe(r){return`${r.fontWeight??"normal"} ${r.fontSize}px ${r.fontFamily??Zt}`}var Ie=class{measureText(t,e){let n=e.fontSize,o=e.fontFamily?.toLowerCase().includes("mono")??!1,s=0;for(let i of t)s+=i.charCodeAt(0)>127?1:o?.62:.58;return{w:Math.max(s*n,n*.25),h:n,baseline:n*.8}}},Vn=new Ie,Wn=class{context;widths=new Map;constructor(t){this.context=t}clearCache(){this.widths.clear()}measureText(t,e){let n=Pe(e),o=`${n}\0${t}`,s=this.widths.get(o);return s===void 0&&(this.context.font=n,s=this.context.measureText(t).width,this.widths.set(o,s)),{w:Math.max(s,e.fontSize*.25),h:e.fontSize,baseline:e.fontSize*.8}}};var _r=/[A-Za-z0-9_./-]/;function xe(r,t,e){let n=t+1;for(;n<e&&_r.test(r[n]);)n++;let o=r.slice(t+1,n);if(!o||n>=e||r[n]!=="(")return null;let s=n,i=1,c=0,a=null,l=!1,h=[],p=s+1,f=(u,g,x=!1)=>{let m=de(r,p,u);if(!x&&m.start>=m.end)return;let y=Nr(r,m.start,m.end),b=y>m.start?de(r,m.start,y):void 0,w=y>m.start?de(r,y+1,m.end):m;h.push({span:m,valueSpan:w,nameSpan:b,equalsSpan:y>m.start?{start:y,end:y+1}:void 0,commaSpan:g===void 0?void 0:{start:g,end:g+1}})},d=(u,g)=>({name:o,span:{start:t,end:u},nameSpan:{start:t,end:s},openParenSpan:{start:s,end:s+1},closeParenSpan:g,args:h});for(n++;n<e;n++){let u=r[n];if(a){l?l=!1:u==="\\"?l=!0:u===a&&(a=null);continue}if(u==='"'){a=u;continue}if(u==="{")c++;else if(u==="}")c=Math.max(0,c-1);else if(u==="("&&c===0)i++;else if(u===")"&&c===0){if(--i)continue;return f(n),d(n+1,{start:n,end:n+1})}else u===","&&i===1&&c===0&&(f(n,n,!0),p=n+1)}return f(e),d(e)}var Ps=/\s/;function de(r,t,e){let n=t,o=e;for(;n<o&&Ps.test(r[n]);)n+=1;for(;o>n&&Ps.test(r[o-1]);)o-=1;return{start:n,end:o}}function Nr(r,t=0,e=r.length){let n=0,o=0,s=null,i=!1;for(let c=t;c<e;c++){let a=r[c];if(s){i?i=!1:a==="\\"?i=!0:a===s&&(s=null);continue}if(a==='"')s=a;else if(a==="("&&o===0)n++;else if(a===")"&&o===0)n=Math.max(0,n-1);else if(a==="{")o++;else if(a==="}")o=Math.max(0,o-1);else if(a==="="&&n===0&&o===0)return c}return-1}function Fs(r,t,e){let n=1,o=null,s=!1;for(let i=t;i<e;i++){let c=r[i];if(o){s?s=!1:c==="\\"?s=!0:c===o&&(o=null);continue}if(c==='"')o=c;else if(c==="(")n++;else if(c===")"&&--n===0)return i}return-1}function At(r,t,e){for(let n=t+1;n<e;n++)if(r[n]==="\\")n++;else if(r[n]==='"')return n;return-1}function Ot(r){return r.length<2||!r.startsWith('"')||!r.endsWith('"')?r:r.slice(1,-1).replace(/\\(.)/gs,"$1")}function ct(r){return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ds(r,t,e){let n=1,o=null,s=!1;for(let i=t+1;i<e;i++){let c=r[i];if(o){s?s=!1:c==="\\"?s=!0:c===o&&(o=null);continue}if(c==='"')o=c;else if(c==="{")n++;else if(c==="}"&&(n--,n===0))return i}return-1}var kr=/\s|\(|\)|\{|\}|,/;function Bs(r,t,e){let n=t+1;for(;n<e&&!kr.test(r[n]);)n++;return n<=t+1?null:{label:r.slice(t+1,n),next:n}}var vr=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]+)?$/i,Mr=["em","px"];function Kn(r){let t=r.match(vr);if(!t)return k.warning.InvalidLength(r,{start:0,end:r.length});let e=parseFloat(t[1]);if(!Number.isFinite(e))return k.warning.InvalidLength(r,{start:0,end:r.length});if(t[2]){let n=t[2].toLowerCase();return Mr.includes(n)?{value:e,unit:n}:k.warning.InvalidLengthUnit(n,{start:t[1].length,end:r.length})}else return{value:e,unit:"px"}}var $s=/^(true|false)$/;function Rr(r,t){if(r)return r==="content"?void 0:r;if($s.test(t))return"boolean";if(t.startsWith('"'))return"string";if(!isNaN(Number(t)))return"number";if(!(Kn(t)instanceof k))return"length"}var zs=22,Or=4,at=class r{static systemVariables={fontsize:{type:"length",default:zs},font:{type:"string",default:Zt},numberfont:{type:"string",default:Gn},strict:{type:"boolean",default:!1}};scopeDepth;source;syntax;diagnostics;variables;documentDeclarations;functions;deSugarAtomFns;deSugarRelationFns;labelableNodes;nodes;constructor(t){t instanceof r?(this.scopeDepth=t.scopeDepth+1,this.documentDeclarations=t.documentDeclarations,this.source=t.source,this.diagnostics=t.diagnostics,this.syntax=t.syntax,this.variables={...t.variables},this.functions=t.functions,this.deSugarAtomFns=t.deSugarAtomFns,this.deSugarRelationFns=t.deSugarRelationFns,this.labelableNodes=t.labelableNodes,this.nodes=[]):(this.scopeDepth=0,this.documentDeclarations={},this.source=t.source,this.diagnostics=t.diagnostics??[],this.syntax={tokens:(t.commentSpans??[]).map(e=>({kind:"comment",span:e})),calls:[]},this.variables=Object.fromEntries(Object.entries(r.systemVariables).map(([e,n])=>[e,n.default])),Object.assign(this.variables,t.variables),this.functions=t.functions??new Map,this.labelableNodes=t.labelableNodes??[],this.nodes=t.toConsume??[],t.functions?[this.deSugarAtomFns,this.deSugarRelationFns]=r.getDeSugarFns(this.functions.values()):(this.deSugarAtomFns=[],this.deSugarRelationFns=[]))}static getDeSugarFns(t){let e=new Set(t),n=[],o=[];for(let s of e){let i=s.deSugarAtom;i&&i!==_.deSugarAtom&&n.push(i);let c=s.deSugarRelation;c&&c!==_.deSugarRelation&&o.push(c)}return[n,o]}pushNode(t){this.nodes.push(t);let e=t.labelable?.();e!==void 0&&this.labelableNodes.push(e)}setVariable(t,e){Object.hasOwn(r.systemVariables,t)&&(t==="fontsize"&&e&&(e=this.length2px(e)),(e===void 0||e===""||e===0)&&(e=r.systemVariables[t].default)),this.variables[t]=e}registerFunctions(t){let e=this.functions;for(let n of t){let o=n.def;if(!o)continue;let s=Array.isArray(o.name)?o.name:[o.name];for(let i of s){if(e.has(i.toLowerCase()))throw new Error(`Duplicate function name detected: ${i}`);e.set(i.toLowerCase(),n)}}[this.deSugarAtomFns,this.deSugarRelationFns]=r.getDeSugarFns(this.functions.values())}parse(t=0,e=this.source.length){return this.makeNodes(this.parseGrammar(t,e)),this.nodes}parseSyntax(t=0,e=this.source.length){if(this.parseGrammar(t,e,!0),this.scopeDepth===0){let n=(o,s)=>o.span.start-s.span.start||o.span.end-s.span.end;this.syntax.tokens.sort(n),this.syntax.calls.sort(n)}return this.syntax}addSyntax(t,e){e&&e.start<e.end&&this.syntax.tokens.push({kind:t,span:e})}recordSyntax(t){if(t.kind==="brace"){this.addSyntax("punctuation",{start:t.span.start,end:t.span.start+1});let c=Math.min(this.source.length,t.span.end-1);this.source[c]==="}"&&this.addSyntax("punctuation",{start:c,end:c+1}),new r(this).parseSyntax(t.span.start+1,c);return}if(t.kind==="label"){this.addSyntax("label",t.span);return}if(t.kind==="sugar"||t.typed){this.addSyntax(t.syntaxKind??"operator",t.span);return}let{kind:e,typed:n,syntaxKind:o,...s}=t;this.syntax.calls.push(s),this.addSyntax("function",s.nameSpan),this.addSyntax("punctuation",s.openParenSpan),this.addSyntax("punctuation",s.closeParenSpan);let i=this.functions.get(s.name.toLowerCase())?.def;for(let c=0;c<s.args.length;c++){let a=s.args[c];this.addSyntax("property",a.nameSpan),this.addSyntax("punctuation",a.equalsSpan),this.addSyntax("punctuation",a.commaSpan);let l=a.nameSpan?this.source.slice(a.nameSpan.start,a.nameSpan.end).toLowerCase():void 0,h=i&&Ht(i,l,c);if(h==="content")new r(this).parseSyntax(a.valueSpan.start,a.valueSpan.end);else{let p=this.source.slice(a.valueSpan.start,a.valueSpan.end),f=Rr(h,p);f&&this.addSyntax(f,a.valueSpan)}}}makeNodes(t,e=0,n=t.length){t:for(;e<n;e++){let o=t[e];if(typeof o=="number"){let s=this.nodes.at(-1);s instanceof U&&s.sourceSpan.end===o?s.sourceSpan.end=o+1:this.nodes.push(new U({start:o,end:o+1},null));continue}switch(o.kind){case"call":this.pushNode(this.parseCallNode(o));break;case"brace":let s=new r(this);this.nodes.push(new Y(o.span,s.parse(o.span.start+1,o.span.end-1),null));break;case"label":let i=this.labelableNodes.at(-1);i?i.label!==void 0?this.diagnostics.push(k.warning.TargetAlreadyLabeled(o.label,i.label,o.span)):(i.label=o.label,this.nodes.push(new ft(o.span,o.label,i))):this.diagnostics.push(k.warning.LabelWithoutTarget(o.label,o.span));break;case"sugar":for(let a of this.deSugarRelationFns){let l=a(this,t,e);if(l!==null){e=l-1;continue t}}let c=this.nodes.at(-1);c instanceof U&&c.sourceSpan.end===o.span.start?c.sourceSpan.end=o.span.end:this.nodes.push(new U(o.span,null));break}}return e}parseGrammar(t,e,n=!1){let o=[],s=i=>{o.push(i),n&&this.recordSyntax(i)};t:for(;(t=mt(this.source,t,e))<e;){let i=this.source[t];if(i==="@"){let c=xe(this.source,t,e);if(c){s(Object.assign(c,{kind:"call",typed:!1}));let l=!1;for(let h of c.args){let p=h.nameSpan!==void 0;if(p&&!l)l=!0;else if(!p&&l){let f=k.error.PosAfterNamedArg(c.name,h.span);if(!n)throw f;this.diagnostics.push(f)}}if(!c.closeParenSpan){let h=k.error.UnterminatedCall(c.name,c.span);if(!n)throw h;this.diagnostics.push(h)}t=c.span.end;continue}let a=Bs(this.source,t,e);if(a){s({kind:"label",span:{start:t,end:a.next},label:a.label}),t=a.next;continue}}if(i==="{"){let c=Ds(this.source,t,e);(c<0||c>=e||c<=t)&&(this.diagnostics.push(k.warning.UnmatchedBrace({start:t,end:e})),c=e),s({kind:"brace",span:{start:t,end:c+1}}),t=c+1;continue}for(let c of this.deSugarAtomFns)try{let a=c(this.source,t,e,this.scopeDepth);if(a){s(a.node),t=a.next;continue t}}catch(a){throw a instanceof k?this.diagnostics.push(a):this.diagnostics.push(k.error.Bug(a.toString(),{start:t,end:e})),a}o.push(t++)}return o}parseCallNode(t){let e=this.functions.get(t.name.toLowerCase()),n=e?.def;if(!e||!n){if(this.variables.strict)throw k.error.UnknownFunction(t.name,t.span);return this.diagnostics.push(k.warning.UnknownFunction(t.name,t.span)),new _(t.span,null)}let o=n.args;if(!t.typed){let s=new Map;for(let i=0;i<t.args.length;i++){let c=t.args[i],a=c.nameSpan?this.source.slice(c.nameSpan.start,c.nameSpan.end).toLowerCase():void 0,l=Ht(n,a,i),h=a??i;if(l===void 0){n.allowExtraArgs?s.set(h,c):this.diagnostics.push(k.warning.TooManyPosArgs(t.name,o.filter(f=>!f.namedOnly).length,i+1,c.valueSpan));continue}let p=this.parseArgWithType(c.valueSpan,l,t.span.start);p!==null&&s.set(h,p)}return new e(t.span,s,this,null)}return new e(t.span,t.args,this,null)}parseArgWithType(t,e,n){let o=de(this.source,t.start,t.end),s=o.start,i=o.end;if(s>=i)return null;let c=e==="content"?"":this.source.slice(s,i);switch(e){case"number":let a=Number(c);return Number.isFinite(a)?a:(this.diagnostics.push(k.warning.InvalidNumber(c,o)),null);case"boolean":return $s.test(c)?c==="true":(this.diagnostics.push(k.warning.InvalidBoolean(c,o)),null);case"content":{let h=this.labelableNodes,p=h.length,f=h.at(-1),d=f?.label,u=f&&Object.hasOwn(f,"label");try{let x=new r(this).parse(s,i);return x.length===1?x[0]:new Y(o,x,null)}catch(g){if(h.length=p,f&&(u?f.label=d:delete f.label),this.variables.strict||!(g instanceof k))throw g;return this.diagnostics.push(g,k.warning.InvalidContent(o)),null}}case"label":n??=t.start;for(let h=this.labelableNodes.length-1;h>=0;h--){let p=this.labelableNodes[h];if(p&&!(p.sourceSpan.start>=n)&&p.label==c)return p}throw k.error.UnknownLabel(c,o);case"length":let l=Kn(c);return l instanceof k?(l.span.start+=s,l.span.end+=s,this.diagnostics.push(l),null):l;default:return Ot(c)}}length2px(t){return t.unit==="em"?t.value*this.variables.fontsize:t.value}};function mt(r,t,e){for(;t<e&&Hs(r[t]);)t++;return t}function me(r,t,e=0){for(;t>=e&&Hs(r[t]);)t--;return t}function Hs(r){switch(r){case" ":case" ":case"\v":case"\f":case"\xA0":case"\uFEFF":case"\u3000":return!0;default:return!1}}var Ir=/^[A-GXZ]/,Fe=/^[0-9]/,De=/^[#bn]+/,Ws=/^[+-]?\d+/,Gs=/^[,']+/;function It(r,t=0,e=r.length){if(e-t===0)return new C("E_WRONG_NOTE_NAME",'\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u4E0D\u80FD\u4E3A\u7A7A',{start:t,end:e});let n=0,o=null,s=null,i=null,c=!1,a;for(let l=t;l<e;l++){let h=r[l];switch(n){case 0:if(Ir.test(h))o=h,c=!0,n=1;else if(Fe.test(h))o=h,c=!1,n=3;else{let f=r.slice(l,e).match(De);if(f)s=f[0],l+=s.length-1,c=!1,n=2;else return new C("E_WRONG_NOTE_NAME",`\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u9996\u5B57\u7B26 "${h}" \u4E0D\u5408\u6CD5\uFF0C\u671F\u671B A-G (a-g)\u30010-9\u3001X \u6216 Z \u5F00\u5934\uFF0C\u6216\u5728\u5F00\u5934\u76F4\u63A5\u4F7F\u7528\u5347\u964D\u53F7(#/b/n)`,{start:l,end:l+1})}break;case 1:let p=r.slice(l,e);if(a=p.match(Ws),a){i=parseInt(a[0],10),l+=a[0].length-1,n=4;break}if(a=p.match(De),a){s=a[0],l+=s.length-1,n=5;break}return{name:o,next:l,acc:null,octave:null,absOctave:c};case 2:if(Fe.test(h)){o=h,n=6;break}else return new C("E_WRONG_NOTE_NAME",`\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u5728\u5347\u964D\u53F7\u5F00\u5934\u65F6\uFF0C\u5E94\u8BE5\u63A5\u6570\u5B57\u97F3\u540D\uFF0C\u4F46\u53D1\u73B0\u5B57\u7B26 "${h}"`,{start:l,end:l+1});case 3:if(a=r.slice(l,e).match(Gs),a){let f=a[0];return i=Vs(f),{name:o,next:l+f.length,acc:s,octave:i,absOctave:c}}if(a=r.slice(l,e).match(De),a&&!Fe.test(r[l+a[0].length]??"")){let f=a[0];s=f,l+=f.length-1,n=6;break}return{name:o,next:l,acc:s,octave:i,absOctave:c};case 4:if(a=r.slice(l,e).match(De),a&&!Fe.test(r[l+a[0].length]??"")){let f=a[0];return s=f,{name:o,next:l+f.length,acc:s,octave:i,absOctave:c}}return{name:o,next:l,acc:null,octave:i,absOctave:c};case 5:return a=r.slice(l,e).match(Ws),a?(i=parseInt(a[0],10),{name:o,next:l+a[0].length,acc:s,octave:i,absOctave:c}):{name:o,next:l,acc:s,octave:null,absOctave:c};case 6:if(a=r.slice(l,e).match(Gs),a){let f=a[0];return i=Vs(f),{name:o,next:l+f.length,acc:s,octave:i,absOctave:c}}return{name:o,next:l,acc:s,octave:i,absOctave:c};default:return k.error.Bug("\u97F3\u7B26\u540D\u79F0\u89E3\u6790\u72B6\u6001\u673A\u8FDB\u5165\u4E86\u672A\u5B9A\u4E49\u7684\u72B6\u6001",{start:l,end:e})}}return o===null?new C("E_WRONG_NOTE_NAME",'\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u5728\u5347\u964D\u53F7\u5F00\u5934\u65F6\uFF0C\u5E94\u8BE5\u63A5\u6570\u5B57\u97F3\u540D\uFF0C\u4F46\u8F93\u5165\u5DF2\u7ED3\u675F',{start:t,end:e}):{name:o,next:e,acc:s,octave:i,absOctave:c}}function Vs(r){let t=0;for(let e=0;e<r.length;e++)r[e]===","?t--:r[e]==="'"&&t++;return t}var $e=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Ks=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"],yt={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11,1:0,2:2,3:4,4:5,5:7,6:9,7:11},Be=["C","D","E","F","G","A","B"],Yn=[0,2,4,5,7,9,11];function Pt(r,t){let e=r[0],n="",o=1;o<r.length&&(r[o]==="#"||r[o]==="b"||r[o]==="n")&&(n=r[o],o++);let s=yt[e+n];if(s===void 0)throw k.error.InvalidTonality(r,{start:0,end:o});if(o<r.length){let i=r.slice(o);if(t=Number(i),!/^-?\d+$/.test(i)||!Number.isSafeInteger(t))throw k.error.InvalidTonality(r,{start:o,end:r.length})}return(t+1)*12+s}function jn(r,t=!0,e=0){for(let n of r)n==="#"?e++:n==="b"?e--:n==="n"&&!t&&(e=0);return e}function Xn(r,t,e,n){let o=yt[r];if(o===void 0)return null;let s=jn(t);return r>="1"&&r<="7"?Pt(n,4)+o+s+e*12:(e+1)*12+o+s}function Ys(r,t,e,n){let o,s;if(r>="1"&&r<="7")o=Number(r)-1,s=e;else{let a=ye(r,t,e,n);if(!a)return;o=Number(a.renderName)-1,s=a.renderOctave}let i=Pt(n,4),c=s*7+o;return a=>{let l=c+a,h=Math.floor(l/7);return i+Yn[(l%7+7)%7]+h*12}}function Un(r){return(r%12+12)%12}function Pr(r){let t=Un(r);return t>6?t-12:t}function Fr(r){return r===0?"":r>0?"#".repeat(r):"b".repeat(-r)}function ye(r,t,e,n){let o=Be.indexOf(n[0]),s=Be.indexOf(r),i=Xn(r,t,e,n);if(o<0||s<0||i===null)return null;let c=Pt(n,4),a=(s-o+Be.length)%Be.length,l=Un(c+Yn[a]),h=Pr(Un(i)-l),p=(i-c-Yn[a]-h)/12;return{renderName:String(a+1),renderAcc:Fr(h),renderOctave:p}}var Dr={"#":{w:.46,h:.78,baseline:.63,commands:[{op:"M",x:.34,y:.05},{op:"L",x:.27,y:.95},{op:"M",x:.72,y:.05},{op:"L",x:.65,y:.95},{op:"M",x:.08,y:.38},{op:"L",x:.9,y:.28},{op:"M",x:.05,y:.72},{op:"L",x:.87,y:.62}]},b:{w:.38,h:.82,baseline:.67,commands:[{op:"M",x:.3,y:.04},{op:"L",x:.3,y:.94},{op:"M",x:.3,y:.5},{op:"Q",cx:.92,cy:.36,x:.76,y:.68},{op:"Q",cx:.63,cy:.87,x:.3,y:.86}]},n:{w:.42,h:.82,baseline:.67,commands:[{op:"M",x:.28,y:.05},{op:"L",x:.28,y:.82},{op:"L",x:.72,y:.68},{op:"L",x:.72,y:.95},{op:"M",x:.72,y:.95},{op:"L",x:.72,y:.18},{op:"L",x:.28,y:.32}]}};function Br(r,t){let e=Dr[r];if(!e)return null;let n=t*.72;return{w:e.w*n,h:e.h*n,baseline:e.baseline*n,strokeWidth:t*.06,commands:e.commands}}function ze(r,t,e,n,o){let s=[],i=t*.42,c=e,a=0;for(let l of r){let h=Br(l,t);if(!h)continue;let p=n-h.baseline-i;s.push({shape:h,x:c,y:p}),p<a&&(a=p),c+=h.w+o}return{placed:s,right:c,top:a}}function He(r,{shape:t,x:e,y:n},o,s){r.drawPath(t.commands,{stroke:s,strokeWidth:t.strokeWidth},{x:o.x+e,y:o.y+n,scaleX:t.w,scaleY:t.h})}function $r(r){try{return Pt(r,4),r}catch{}let t=It(r.replace(/^[a-g]/,c=>c.toUpperCase()));if(t instanceof k||t.next!==r.length)return null;let e=yt[t.name];if(e===void 0)return null;let n=jn(t.acc??"",!1),s=((t.absOctave?t.octave??4:4+(t.octave??0))+1)*12+e+n,i=Object.keys(yt).filter(c=>yt[c]===(s%12+12)%12&&/^[A-G]/.test(c));return(n<0?i.at(-1):i[0])+(Math.floor(s/12)-1)}var qn=class extends _{static def={name:["key","1"],description:"\u8BBE\u7F6E\u65F6\u95F4\u7EBF\u4E0A\u7684 1= \u8C03\u6027\u57FA\u51C6",details:`~~~jpfun
|
|
21
21
|
1 ^ @key(F#3)
|
|
22
22
|
~~~
|
|
23
|
-
\u8C03\u6027\u6CBF\u65F6\u95F4\u7EBF\u5F71\u54CD\u540E\u7EED\u6570\u5B57\u97F3\u540D\u3002\u8C31\u9762\u8BB0\u53F7\u663E\u793A\u97F3\u540D\u4E0E\u5347\u964D\u53F7\uFF0C\u7701\u7565\u516B\u5EA6\uFF1B\u901A\u5E38\u7528 \`^\` \u53E0\u5728\u97F3\u7B26\u4E0A\u65B9\u3002`,allowExtraArgs:!1,args:[{name:"tonality",description:"`1=` \u7684\u97F3\u9AD8\u57FA\u51C6\uFF0C\u5982 `C4`\u3001`F#3`",type:"string",default:null},{name:"size",description:"\u8C03\u6027\u8BB0\u53F7\u5B57\u53F7",type:"length",default:{value:1,unit:"em"}}]};tonality;size;font;displayName;displayAcc;constructor(t,e,n,o=null){super(t,o);let[s,
|
|
23
|
+
\u8C03\u6027\u6CBF\u65F6\u95F4\u7EBF\u5F71\u54CD\u540E\u7EED\u6570\u5B57\u97F3\u540D\u3002\u8C31\u9762\u8BB0\u53F7\u663E\u793A\u97F3\u540D\u4E0E\u5347\u964D\u53F7\uFF0C\u7701\u7565\u516B\u5EA6\uFF1B\u901A\u5E38\u7528 \`^\` \u53E0\u5728\u97F3\u7B26\u4E0A\u65B9\u3002`,allowExtraArgs:!1,args:[{name:"tonality",description:"`1=` \u7684\u97F3\u9AD8\u57FA\u51C6\uFF0C\u5982 `C4`\u3001`F#3`",type:"string",default:null},{name:"size",description:"\u8C03\u6027\u8BB0\u53F7\u5B57\u53F7",type:"length",default:{value:1,unit:"em"}}]};tonality;size;font;displayName;displayAcc;constructor(t,e,n,o=null){super(t,o);let[s,i]=this.getArgValue(e,n);this.font=n.variables.numberfont,this.tonality=s,this.size=n.length2px(i);let c=$r(s);if(c!==s){if(n.variables.strict)throw new C("E_KEY_TONALITY",`@key \u65E0\u6CD5\u89E3\u6790\u8C03\u6027 "${s}"`,t);this.tonality=c??ce,n.diagnostics.push(new P("W_KEY_TONALITY",`@key \u7684\u8C03\u6027 "${s}" \u4E0D\u662F\u89C4\u8303\u5199\u6CD5\uFF0C\u5DF2\u81EA\u52A8\u5207\u6362\u5230 ${this.tonality}`,t))}this.displayName=this.tonality[0],this.displayAcc=this.tonality[1]==="#"||this.tonality[1]==="b"?this.tonality[1]:""}loweringEnter(){return[new Qn(this)]}toString(){return`@1(${this.tonality})`}},We=qn,Zn="1=",Qn=class extends D{accidentals=[];nameX=0;textBaselineY=0;style;constructor(t){super(),this.ast=t,this.style={fontSize:t.size,fontFamily:t.font,fill:"#000"},this.initLayoutBox()}onTimeState(t){t.keySignature=this.ast.tonality}prepareLayout(t){let e=this.ast.size,n=this.style,o=t.textMeasurer.measureText(Zn,n),s=t.textMeasurer.measureText(this.ast.displayName,n),i=e*.02,{placed:c,right:a,top:l}=ze(this.ast.displayAcc,e,o.w,o.baseline,i);this.accidentals=c;let h=-l;for(let p of c)p.y+=h;this.nameX=a,this.textBaselineY=h+o.baseline,this.box.w=a+s.w,this.box.h=h+Math.max(o.h,s.h),this.box.anchor=t.textMeasurer.measureText(Zn[0],n).w/2,this.box.visualAxis=this.box.h/2}paint(t){let e=this.style;t.drawText(Zn,this.box.x,this.box.y+this.textBaselineY,e);for(let n of this.accidentals)He(t,n,this.box,"#000");t.drawText(this.ast.displayName,this.box.x+this.nameX,this.box.y+this.textBaselineY,e)}};function Ge(r){let t=1/0,e=1/0,n=-1/0,o=-1/0,s=(i,c,a,l)=>{t=Math.min(t,i),e=Math.min(e,c),n=Math.max(n,i+a),o=Math.max(o,c+l)};for(let i of r){let c=i.dx??0;if(i.circle){let{cx:a,cy:l,r:h}=i.circle;s(a+c-h,l-h,2*h,2*h)}if(i.path?.length){let a=Ct(i.path);s(a.x+c,a.y,a.w,a.h)}}return Number.isFinite(t)?{x:t,y:e,w:Math.max(1e-9,n-t),h:Math.max(1e-9,o-e)}:{x:0,y:0,w:1e-9,h:1e-9}}function Ve(r,t,e,n,o){let s=n.x-e.x*o,i=n.y-e.y*o;for(let c of t){let a=c.style,l=a.strokeWidth===void 0?a:{...a,strokeWidth:a.strokeWidth*o},h=s+(c.dx??0)*o;c.path&&r.drawPath(c.path,l,{x:h,y:i,scaleX:o,scaleY:o}),c.circle&&r.drawCircle(h+c.circle.cx*o,i+c.circle.cy*o,c.circle.r*o,l)}}var Jn=[{path:[{op:"M",x:1,y:34},{op:"C",cx1:23,cy1:36,cx2:57,cy2:28,x:82,y:23},{op:"C",cx1:91,cy1:21,cx2:98,cy2:24,x:102,y:29},{op:"Q",cx:106,cy:34,x:98,y:34},{op:"C",cx1:68,cy1:30,cx2:37,cy2:39,x:13,y:43},{op:"Q",cx:7,cy:44,x:1,y:39},{op:"Q",cx:-3,cy:35,x:1,y:34},{op:"Z"}],style:{fill:"#000"}},{path:[{op:"M",x:29,y:5},{op:"Q",cx:27,cy:3,x:31,y:4},{op:"Q",cx:44,cy:7,x:42,y:12},{op:"C",cx1:39,cy1:26,cx2:43,cy2:43,x:42,y:60},{op:"Q",cx:41,cy:69,x:38,y:62},{op:"C",cx1:34,cy1:47,cx2:35,cy2:20,x:29,y:5},{op:"Z"}],style:{fill:"#000"}},{path:[{op:"M",x:59,y:1},{op:"Q",cx:56,cy:-2,x:61,y:0},{op:"Q",cx:76,cy:4,x:74,y:9},{op:"C",cx1:71,cy1:17,cx2:74,cy2:32,x:69,y:48},{op:"C",cx1:64,cy1:66,cx2:55,cy2:77,x:40,y:84},{op:"Q",cx:37,cy:85,x:40,y:82},{op:"C",cx1:57,cy1:66,cx2:63,cy2:47,x:64,y:29},{op:"C",cx1:65,cy1:17,cx2:63,cy2:7,x:59,y:1},{op:"Z"}],style:{fill:"#000"}}],ge=Ge(Jn);var to=class extends _{static def={name:["meter"],description:"\u8BBE\u7F6E\u62CD\u53F7",details:`~~~jpfun
|
|
24
24
|
@meter(6, 8)
|
|
25
25
|
~~~
|
|
26
|
-
\u8BBE\u7F6E \`6/8\` \u62CD\u53F7\uFF1A\u6BCF\u5C0F\u8282\u542B\u516D\u4E2A\u516B\u5206\u97F3\u7B26\u7684\u65F6\u503C
|
|
26
|
+
\u8BBE\u7F6E \`6/8\` \u62CD\u53F7\uFF1A\u6BCF\u5C0F\u8282\u542B\u516D\u4E2A\u516B\u5206\u97F3\u7B26\u7684\u65F6\u503C\u3002
|
|
27
|
+
\u5206\u5B50\u6216\u5206\u6BCD\u4E3A 0 \u65F6\u8868\u793A\u6563\u677F\u3002`,allowExtraArgs:!1,args:[{name:"num",description:"\u62CD\u53F7\u5206\u5B50\uFF0C\u6BCF\u5C0F\u8282\u5305\u542B\u7684\u5355\u4F4D\u62CD\u6570",type:"number",default:null},{name:"den",description:"\u62CD\u53F7\u5206\u6BCD\uFF0C\u4EE5\u51E0\u5206\u97F3\u7B26\u4E3A\u5355\u4F4D\u62CD",type:"number",default:null},{name:"size",description:"\u62CD\u53F7\u5B57\u53F7",type:"length",default:{value:.7,unit:"em"}}]};numerator;denominator;measureDuration;size;strict;font;constructor(t,e,n,o=null){super(t,o);let[s,i,c]=this.getArgValue(e,n);if(this.font=n.variables.numberfont,!Number.isSafeInteger(s)||!Number.isSafeInteger(s*4)||s<0||!Number.isSafeInteger(i)||i<0){let a="@meter \u7684\u5206\u5B50\u548C\u5206\u6BCD\u5FC5\u987B\u662F\u975E\u8D1F\u6574\u6570";if(n.variables.strict)throw new C("E_METER_INVALID",a,t);n.diagnostics.push(new P("W_METER_INVALID",`${a}\uFF0C\u5DF2\u56DE\u843D\u4E3A 4/4`,t)),s=i=4}this.numerator=s,this.denominator=i,s!==0&&i!==0&&(this.measureDuration=new O(s*4,i)),this.size=n.length2px(c),this.strict=n.variables.strict}loweringEnter(){return[new Ke(this)]}static loweringFinalize=t=>{let e=new O,n=new O,o=null,s=!1,i=0,c=(l,h)=>{if(!(!o?.measureDuration||l.equals(e))){if(n.copyFrom(l).sub(e),!n.equals(o.measureDuration)&&(s||n.compare(o.measureDuration)>0)){let p=`\u5C0F\u8282\u65F6\u957F\u4E3A ${n} QN\uFF0C\u4E0D\u6EE1\u8DB3 ${o.numerator}/${o.denominator} \u62CD\u53F7`,f={start:i,end:h};if(o.strict)throw new C("E_METER_MISMATCH",p,f);t.diagnostics.push(new P("W_METER_MISMATCH",p,f))}e.copyFrom(l)}},a=new Map;for(let l of t.astToTemporal.values())for(let h of l){if(!(h instanceof Ke))continue;let p=h;for(;p.foldedInto;)p=p.foldedInto;a.has(p)||a.set(p,h)}for(let l of t.columns){let h=l[0].t,p=l.find(u=>a.has(u)),f=p&&a.get(p);f&&(c(h,f.ast.sourceSpan.start),o=f.ast,e.copyFrom(h),i=f.ast.sourceSpan.end);let d=l.find(u=>u.mergeKey===K);d&&(c(h,d.ast.sourceSpan.end),i=d.ast.sourceSpan.end,s=!0)}if(o){let l=t.columns.at(-1)?.at(-1)?.ast.sourceSpan??o.sourceSpan;c(t.duration,l.end)}};toString(){return`@meter(${this.numerator}, ${this.denominator})`}},Ye=to,Ke=class extends D{style;numeratorBaseline=0;denominatorBaseline=0;lineY=0;lineHeight=0;constructor(t){super(),this.ast=t,this.style={fontSize:t.size,fontFamily:t.font,textAlign:"center",fill:"#000"},this.initLayoutBox()}onTimeState(t){t.meter=this.ast.measureDuration}emitPlayback(t){this.ast.measureDuration&&t.emit({kind:"time-signature",at:t.start,numerator:this.ast.numerator,denominator:this.ast.denominator})}prepareLayout(t){if(!this.ast.measureDuration){this.box.w=this.ast.size*ge.w/ge.h,this.box.h=this.ast.size,this.box.anchor=this.box.w/2,this.box.visualAxis=this.box.h/2;return}let e=t.textMeasurer.measureText(String(this.ast.numerator),this.style),n=t.textMeasurer.measureText(String(this.ast.denominator),this.style),o=this.ast.size*.08,s=this.ast.size*.08;this.lineHeight=Math.max(1,this.ast.size*.06),this.numeratorBaseline=e.baseline,this.lineY=e.h+o,this.denominatorBaseline=this.lineY+this.lineHeight+o+n.baseline,this.box.w=Math.max(e.w,n.w)+s*2,this.box.h=this.lineY+this.lineHeight+o+n.h,this.box.anchor=this.box.w/2,this.box.visualAxis=this.lineY+this.lineHeight/2}paint(t){if(!this.ast.measureDuration){Ve(t,Jn,ge,this.box,this.ast.size/ge.h);return}let e=this.box.x+this.box.anchor;t.drawText(String(this.ast.numerator),e,this.box.y+this.numeratorBaseline,this.style),t.drawRect(this.box.x,this.box.y+this.lineY,this.box.w,this.lineHeight,{fill:"#000"}),t.drawText(String(this.ast.denominator),e,this.box.y+this.denominatorBaseline,this.style)}};var zr=[{op:"M",x:3.864,y:8.5},{op:"Q",cx:3.864,cy:9.228,x:3.5,y:9.76},{op:"Q",cx:3.136,cy:10.292,x:2.555,y:10.586},{op:"Q",cx:1.974,cy:10.88,x:1.302,y:10.88},{op:"Q",cx:.826,cy:10.88,x:.413,y:10.621},{op:"Q",cx:0,cy:10.362,x:0,y:9.844},{op:"Q",cx:0,cy:9.34,x:.364,y:8.899},{op:"Q",cx:.728,cy:8.458,x:1.288,y:8.185},{op:"Q",cx:1.848,cy:7.912,x:2.422,y:7.912},{op:"Q",cx:2.968,cy:7.912,x:3.304,y:8.094},{op:"L",x:3.304,y:0},{op:"L",x:3.864,y:0},{op:"Z"}];function Us(r){let t=r/11;return{w:3.864*t,h:10.88*t,stemCenterX:(3.304+3.864)/2*t,commands:zr,scale:t}}var eo=class extends _{static def={name:["tempo"],description:"\u8BBE\u7F6E\u65F6\u95F4\u7EBF\u4E0A\u7684\u901F\u5EA6",details:`~~~jpfun
|
|
27
28
|
@tempo(96)
|
|
28
29
|
~~~
|
|
29
|
-
\u901F\u5EA6\u4ECE\u5F53\u524D\u65F6\u95F4\u4F4D\u7F6E\u8D77\u751F\u6548\uFF1B\u7528 \`1 ^ @tempo(96)\` \u53EF\u5C06\u8BB0\u53F7\u53E0\u5728\u97F3\u7B26\u4E0A\u65B9`,allowExtraArgs:!1,args:[{name:"bpm",description:"\u6BCF\u5206\u949F\u56DB\u5206\u97F3\u7B26\u6570",type:"number",default:null},{name:"size",description:"\u901F\u5EA6\u8BB0\u53F7\u5B57\u53F7",type:"length",default:{value:1,unit:"em"}}]};bpm;size;font;constructor(t,e,n,o=null){super(t,o);let[s,
|
|
30
|
+
\u901F\u5EA6\u4ECE\u5F53\u524D\u65F6\u95F4\u4F4D\u7F6E\u8D77\u751F\u6548\uFF1B\u7528 \`1 ^ @tempo(96)\` \u53EF\u5C06\u8BB0\u53F7\u53E0\u5728\u97F3\u7B26\u4E0A\u65B9`,allowExtraArgs:!1,args:[{name:"bpm",description:"\u6BCF\u5206\u949F\u56DB\u5206\u97F3\u7B26\u6570",type:"number",default:null},{name:"size",description:"\u901F\u5EA6\u8BB0\u53F7\u5B57\u53F7",type:"length",default:{value:1,unit:"em"}}]};bpm;size;font;constructor(t,e,n,o=null){super(t,o);let[s,i]=this.getArgValue(e,n);this.bpm=s,this.size=n.length2px(i),this.font=n.variables.font}loweringEnter(){return[new no(this)]}toString(){return`@tempo(${this.bpm}, size=${this.size}px)`}},Ue=eo,no=class extends D{glyph;text;style;glyphY=0;textX=0;textBaselineY=0;constructor(t){super(),this.ast=t,this.glyph=Us(t.size),this.text=`= ${t.bpm}`,this.style={fontSize:t.size,fontFamily:t.font,fill:"#000"},Number.isFinite(t.bpm)&&t.bpm>0&&(this.playbackState={bpm:t.bpm}),this.initLayoutBox()}onTimeState(t){let e=this.playbackState?.bpm;e!==void 0&&(t.bpm=e)}prepareLayout(t){let e=this.glyph,n=t.textMeasurer.measureText(this.text,this.style),o=Math.max(0,e.h-n.baseline);this.textX=e.w+this.ast.size*.26,this.textBaselineY=o+n.baseline,this.glyphY=this.textBaselineY-e.h,this.box.w=this.textX+n.w,this.box.h=o+n.h,this.box.anchor=e.stemCenterX,this.box.visualAxis=o+n.h/2}paint(t){t.drawPath(this.glyph.commands,{fill:"#000"},{x:this.box.x,y:this.box.y+this.glyphY,scaleX:this.glyph.scale,scaleY:this.glyph.scale}),t.drawText(this.text,this.box.x+this.textX,this.box.y+this.textBaselineY,this.style)}};var oo=class extends _{static def={name:["text"],description:"\u6587\u672C\u6807\u8BB0",details:`~~~jpfun
|
|
30
31
|
@text(\u8FDB\u5165\u4E3B\u9898, size=0.8em, align=center)
|
|
31
32
|
~~~
|
|
32
|
-
**\u7B80\u5199**\uFF1A\u76F4\u63A5\u5199\u53CC\u5F15\u53F7\u6587\u672C\uFF0C\u5982 \`"\u8FDB\u5165\u4E3B\u9898"\`\uFF1B\u53EF\u8DE8\u884C\uFF0C\u53CC\u5F15\u53F7\u987B\u914D\u5BF9`,allowExtraArgs:!1,args:[{type:"string",description:"\u6587\u672C\u5185\u5BB9\uFF0C\u53EF\u76F4\u63A5\u6362\u884C\uFF1B\u542B\u9017\u53F7\u7B49\u6B67\u4E49\u5B57\u7B26\u65F6\u9700\u52A0\u5F15\u53F7",default:null},{name:"size",description:"\u6587\u672C\u5B57\u53F7",type:"length",default:{value:.8,unit:"em"}},{name:"lineheight",description:"\u76F8\u5BF9\u81EA\u8EAB\u5B57\u53F7\u7684\u884C\u9AD8\u500D\u6570",type:"number",default:1.25},{name:"align",description:"\u6587\u672C\u5BF9\u9F50\u65B9\u5F0F\uFF1A`left`\u3001`center` \u6216 `right`",type:"string",default:"left"},{name:"font",description:"\u6587\u672C\u5B57\u4F53\uFF0C\u7A7A\u503C\u6CBF\u7528\u5F53\u524D\u5B57\u4F53\u8BBE\u7F6E",type:"string",default:""}]};static deSugarAtom(t,e,n){if(t[e]!=='"')return null;let o=
|
|
33
|
-
`))}, size=${this.size}px, lineheight=${t}, align=${this.align}, font=${
|
|
34
|
-
`;)t++;return t}function
|
|
35
|
-
`)||typeof
|
|
36
|
-
`&&
|
|
33
|
+
**\u7B80\u5199**\uFF1A\u76F4\u63A5\u5199\u53CC\u5F15\u53F7\u6587\u672C\uFF0C\u5982 \`"\u8FDB\u5165\u4E3B\u9898"\`\uFF1B\u53EF\u8DE8\u884C\uFF0C\u53CC\u5F15\u53F7\u987B\u914D\u5BF9`,allowExtraArgs:!1,args:[{type:"string",description:"\u6587\u672C\u5185\u5BB9\uFF0C\u53EF\u76F4\u63A5\u6362\u884C\uFF1B\u542B\u9017\u53F7\u7B49\u6B67\u4E49\u5B57\u7B26\u65F6\u9700\u52A0\u5F15\u53F7",default:null},{name:"size",description:"\u6587\u672C\u5B57\u53F7",type:"length",default:{value:.8,unit:"em"}},{name:"lineheight",description:"\u76F8\u5BF9\u81EA\u8EAB\u5B57\u53F7\u7684\u884C\u9AD8\u500D\u6570",type:"number",default:1.25},{name:"align",description:"\u6587\u672C\u5BF9\u9F50\u65B9\u5F0F\uFF1A`left`\u3001`center` \u6216 `right`",type:"string",default:"left"},{name:"font",description:"\u6587\u672C\u5B57\u4F53\uFF0C\u7A7A\u503C\u6CBF\u7528\u5F53\u524D\u5B57\u4F53\u8BBE\u7F6E",type:"string",default:""}]};static deSugarAtom(t,e,n){if(t[e]!=='"')return null;let o=At(t,e,n);if(o<0)return null;let s={kind:"call",typed:!0,name:"text",args:new Map([[0,Ot(t.slice(e,o+1))]]),span:{start:e,end:o+1},syntaxKind:"string"};return{next:o+1,node:s}}lines;size;lineAdvance;align;font;constructor(t,e,n,o=null){super(t,o);let[s,i,c,a,l]=this.getArgValue(e,n);if(this.font=l||n.variables.font,a!=="left"&&a!=="center"&&a!=="right")throw new C("E_TEXT_INVALID_ALIGN","@text \u7684 align \u53C2\u6570\u5FC5\u987B\u662F 'left'\u3001'center' \u6216 'right'",t);this.lines=s.split(/\r?\n/),this.size=n.length2px(i),this.lineAdvance=c*this.size,this.align=a}loweringEnter(){return[new so(this)]}toString(){let t=this.size===0?1.25:this.lineAdvance/this.size;return`@text(${ct(this.lines.join(`
|
|
34
|
+
`))}, size=${this.size}px, lineheight=${t}, align=${this.align}, font=${ct(this.font)})`}},je=oo,so=class extends D{style;textBaselineY=0;constructor(t){super(),this.ast=t,this.mergeKey=ht,this.style={fontSize:t.size,fontFamily:t.font,fill:"#000",textAlign:t.align},this.initLayoutBox()}prepareLayout(t){let{lines:e,align:n,lineAdvance:o}=this.ast,s=a=>t.textMeasurer.measureText(a,this.style),i=s(e[0]),c=i.w;for(let a=1;a<e.length;a++)c=Math.max(c,s(e[a]).w);if(this.box.w=c,this.box.h=(e.length-1)*o+i.h,this.box.visualAxis=this.box.h/2,this.textBaselineY=i.baseline,n==="center")this.box.anchor=c/2;else if(n==="right"){let a=[...e[0]].at(-1);this.box.anchor=c-(a?s(a).w/2:0)}else{let a=[...e[0]][0];this.box.anchor=a?s(a).w/2:0}}paint(t){let{lines:e,align:n,lineAdvance:o}=this.ast,s=this.box.x+(n==="center"?this.box.w/2:n==="right"?this.box.w:0),i=this.box.y+this.textBaselineY;for(let c of e)t.drawText(c,s,i,this.style),i+=o}};var js={title:"center",subtitle:"center",author:"right",signature:"left",tempo:"left",left:"left",center:"center",right:"right"},Hr={title:[2,"center"],subtitle:[.85,"center"],author:[.8,"right"]},Wr=.25,Xs=5,Zs=1e4;function Xe(r,t){return t.length===1&&t[0]instanceof Y?t[0]:new Y(r,t)}function qs(r,t,e=r.length){for(;t<e&&r[t]!=="\r"&&r[t]!==`
|
|
35
|
+
`;)t++;return t}function Gr({columns:r,rows:t,start:e,end:n,X:o,fixed:s,options:i},c){Vt(r.slice(e,n+1),t,o.subarray(e,n+1),s.subarray(e,n),1/0,i);let a=1/0,l=-1/0;for(let h=e+1;h<n;h++)for(let p=0;p<t;p++)a=Math.min(a,o[h]-r[h][p].WL),l=Math.max(l,o[h]+r[h][p].WR);c&&a<=l?(o[e]=a,o[n]=l):o[n]=o[e]}function Qs(r,t,e){let n=[],o,s;for(let i of r){if(!i){n.push(null);continue}let c=s===void 0?0:s+t-i.top;n.push({offset:c,extent:i}),o??=c+i.top,s=c+i.bottom}return e?.(o===void 0||s===void 0?null:{top:o,bottom:s}),n}var Ze=class extends D{members=[];slots=[];titleBottom=0;leftExtent=null;rightExtent=null;constructor(t){super(),this.ast=t,this.initLayoutBox()}validateDuration(){for(let t of this.members)if(!t.T.isZero())throw new C("E_HEAD_NONZERO_DURATION","@head \u7684\u5185\u5BB9\u5FC5\u987B\u5168\u90E8\u4E3A\u96F6\u65F6\u957F",t.ast.sourceSpan)}prepareLayout(){this.box.w=this.box.h=this.box.anchor=this.box.visualAxis=0}prepareHorizontal(t){this.slots.length>0&&this.prepareHead(t)}onPlaced(){this.slots.length>0&&this.alignHead()}createTracks(t){let{name:e,owner:n}=t;return{laneKey:`head/rows/${n.sourceSpan.start}/${e}`,hostIndex:null,measure:o=>{if(e==="center"){let s=Qs(o,n.gap),i=s.find(c=>c!==null);return this.titleBottom=i?i.offset+i.extent.bottom:0,s}return Qs(o,n.gap,s=>{e==="left"?this.leftExtent=s:this.rightExtent=s})},place:e==="center"?void 0:()=>{let o=e==="left"?this.leftExtent:this.rightExtent;if(!o)return this.titleBottom;let s=this.leftExtent?this.leftExtent.bottom-this.leftExtent.top:0,i=this.rightExtent?this.rightExtent.bottom-this.rightExtent.top:0;return this.titleBottom+Math.max(s,i)-o.bottom}}}prepareHead(t){if(this.members.some(s=>F(s)&&s.layoutLine!==t.index))throw new C("E_HEAD_INTERNAL_BREAK","@head \u7684\u5185\u5BB9\u4E0D\u80FD\u8DE8\u8C31\u9762\u884C",this.ast.owner.sourceSpan);let[e,n,o]=this.slots;e.start.springConfig.alpha_L=0,o.end.springConfig.alpha_R=0,this.stretch(n.start,"L"),this.stretch(n.end,"R");for(let s of this.slots)t.registerHorizontalLayoutHook(s.start,s.end,i=>Gr(i,s===n))}alignHead(){let t=new Map;for(let o of this.members){if(!F(o))continue;let s=this.sideCellOf(o.ast);if(!s)continue;let i=t.get(s);i?i.push(o):t.set(s,[o])}let[e,,n]=this.slots;this.packRows(e.ast,e.start.box.x,"left",t),this.packRows(n.ast,n.end.box.x,"right",t)}stretch(t,e){let n=e==="L"?"alpha_L":"alpha_R",o=e==="L"?"beta_L":"beta_R";t.springConfig[n]=t.springConfig[n]*Zs,t.springConfig[o]=t.springConfig[o]*3/Zs}packRows(t,e,n,o){let s=this.ast.owner.size*Wr,i=n==="left",c=i?1:-1;for(let a of t.rows){let l=a instanceof Y?a.content:[a],h=e;for(let p=i?0:l.length-1;p>=0&&p<l.length;p+=c){let f=o.get(l[p]);if(!f)continue;let d=1/0,u=-1/0;for(let x of f)d=Math.min(d,x.box.x),u=Math.max(u,x.box.x+x.box.w);let g=h-(i?d:u);for(let x of f)x.box.x+=g;for(let x of f)x.onPlaced?.();h+=c*(u-d+s)}}}sideCellOf(t){let e=t;for(;e.parent;){let n=e.parent,o=n instanceof Ft?n:n instanceof Y&&n.parent instanceof Ft?n.parent:null;if(o?.owner===this.ast.owner)return o.name==="center"?null:e;e=n}return null}},Ft=class extends q{owner;name;rows;constructor(t,e,n,o){super(t,e),this.owner=e,this.name=n,this.rows=o;for(let s of this.rows)s.parent=this}get size(){return this.owner.size}get children(){return this.rows}timeFlowModel(t){if(this.rows.length===0)return null;let e=t.getTemporalNodes(this.owner.slots[0])[0];return{mode:"parallel",children:this.rows,tracks:e.createTracks(this)}}loweringEnter(){return[new Ze(this)]}loweringExit(){return[new Ze(this)]}addRow(t){t.parent=this,this.rows.push(t)}},io=class r extends _{static def={name:["head"],description:"\u5DE6\u3001\u4E2D\u3001\u53F3\u4E09\u533A\u5E03\u5C40",details:"\u5E38\u7528\u4E8E\u8C31\u5934\uFF1A\n~~~jpfun\n@head(left={{@key(C) @meter(4,4)}},\n center={@text(\u6807\u9898)}, right={@text(\u4F5C\u8005)})\n~~~\n**\u7B80\u5199**\uFF1A\u76F8\u90BB\u7684 `H.*:` \u884C\u5408\u5E76\u4E3A\u540C\u4E00\u4E2A\u8C31\u5934\uFF0C\u6BCF\u6761\u58F0\u660E\u751F\u6210\u6240\u5728\u533A\u7684\u4E00\u884C\uFF1B\u7A7A\u884C\u6216\u666E\u901A\u5185\u5BB9\u7ED3\u675F\u7EC4\u5408\n~~~jpfun\nH.title: \u6807\u9898\nH.subtitle: \u526F\u6807\u9898\nH.author: \u4F5C\u8005\nH.signature: 1=C 4/4\nH.tempo: 94\n~~~\n`title` / `subtitle` \u5C45\u4E2D\uFF0C\u5206\u522B\u9884\u8BBE\u5927\u3001\u5C0F\u5B57\u53F7\uFF1B`author` \u5C0F\u5B57\u53F7\u53F3\u5BF9\u9F50\uFF1B`signature` \u548C `tempo` \u653E\u5728\u5DE6\u533A\u3002`H.left:`\u3001`H.center:`\u3001`H.right:` \u53EF\u76F4\u63A5\u5199\u5BF9\u5E94\u533A\u7684\u96F6\u65F6\u957F\u5185\u5BB9\u3002\u4EE5 `@` \u6216 `{` \u5F00\u5934\u7684\u503C\u6309 jpFun \u89E3\u6790\uFF0C\u5176\u4F59\u6309\u5B57\u6BB5\u7684\u6587\u672C\u89C4\u5219\u5904\u7406\u3002",allowExtraArgs:!1,args:[{name:"left",description:"\u5DE6\u533A\u96F6\u65F6\u957F\u5185\u5BB9\uFF0C\u5982\u8C03\u6027\u3001\u62CD\u53F7\u4E0E\u901F\u5EA6\u8BB0\u53F7",type:"content",default:""},{name:"center",description:"\u4E2D\u533A\u96F6\u65F6\u957F\u5185\u5BB9\uFF0C\u5982\u6807\u9898\u4E0E\u526F\u6807\u9898",type:"content",default:""},{name:"right",description:"\u53F3\u533A\u96F6\u65F6\u957F\u5185\u5BB9\uFF0C\u5982\u4F5C\u8005\u4E0E\u7F72\u540D",type:"content",default:""},{name:"gap",description:"\u6BCF\u4E2A\u533A\u5185\u76F8\u90BB\u884C\u7684\u5782\u76F4\u95F4\u8DDD",type:"length",default:{value:Xs,unit:"px"}}]};slots;size;gap;createdBySugar=!1;get children(){return this.slots}timeFlowModel(){return{mode:"sequence",children:this.slots}}static deSugarAtom(t,e,n){if(t[e]!=="H"||t[e+1]!==".")return null;let o=e+2;for(;o<n&&t[o]>="a"&&t[o]<="z";)o++;let s=t.slice(e+2,o);if(!Object.hasOwn(js,s)||t[o]!==":")return null;o++;let i=qs(t,o,n),c=mt(t,o,i);return{next:t[c]==="@"||t[c]==="{"?o:i,node:{kind:"sugar",data:{class:r,field:s},span:{start:e,end:o}}}}static deSugarRelation(t,e,n){let o=e[n++];if(o.data?.class!==r)return null;let s=o.data.field,i=n;for(;i<e.length;i++){let m=e[i];if(typeof m=="number"&&(t.source[m]==="\r"||t.source[m]===`
|
|
36
|
+
`)||typeof m!="number"&&m.kind==="sugar"&&m.data?.class===r)break}let c=e[i],a;if(typeof c=="number")a=c;else if(c)a=c.span.start;else if(i>n){let m=e[i-1];a=typeof m=="number"?m+1:m.span.end}else a=qs(t.source,o.span.end);let l=mt(t.source,o.span.end,a),h=me(t.source,a-1,l),p={start:l,end:Math.max(l,h+1)};if(p.start>=p.end)throw new C("E_HEAD_EMPTY_DECLARATION",`H.${s}: \u540E\u5FC5\u987B\u6709\u5185\u5BB9`,o.span);let f=t.source.slice(p.start,p.end).trim(),d;if(f.startsWith("@")||f.startsWith("{")){let m=new at(t);m.makeNodes(e.slice(n,i)),d=m.nodes}let u=t.nodes.at(-1),g=u instanceof r&&u.createdBySugar?u:new r(o.span,new Map,t,null);if(g.createdBySugar=!0,g.addSugarRow(js[s],r.parseSugarRow(t,s,p,f,d)),g.sourceSpan.end=p.end,g!==u&&t.pushNode(g),typeof c!="number")return i;let x=i+1;if(t.source[c]==="\r"){let m=e[x];typeof m=="number"&&t.source[m]===`
|
|
37
|
+
`&&x++}return x}static parseSugarRow(t,e,n,o,s){if(s!==void 0)return Xe(n,s);if(e==="signature"){let a=/^(1\s*=\s*(\S+))\s+((\d+)\s*\/\s*(\d+))$/.exec(o);if(!a)throw new C("E_HEAD_INVALID_SIGNATURE","H.signature \u7684\u683C\u5F0F\u5E94\u4E3A 1=C 4/4",n);let l={start:n.start,end:n.start+a[1].length},h={start:n.end-a[3].length,end:n.end};return Xe(n,[new We(l,new Map([["tonality",a[2]]]),t,null),new Ye(h,new Map([["num",Number(a[4])],["den",Number(a[5])]]),t,null)])}if(e==="tempo"){let a=Number(o);if(!Number.isFinite(a)||a<=0)throw new C("E_HEAD_INVALID_TEMPO","H.tempo \u540E\u5FC5\u987B\u662F\u6B63\u6570",n);return Xe(n,[new Ue(n,new Map([["bpm",a]]),t,null)])}let i=new Map([[0,o]]),c=Hr[e];return c&&(i.set("size",{value:c[0],unit:"em"}),i.set("align",c[1])),Xe(n,[new je(n,i,t,null)])}constructor(t,e,n,o=null){super(t,o),this.size=n.variables.fontsize,this.gap=n.length2px(this.getArgValue(e,n)[3]);let s=(i,c)=>{let a=e.get(i)??e.get(c);return a instanceof q?a instanceof Y?a.content:[a]:[]};this.slots=[new Ft(t,this,"left",s("left",0)),new Ft(t,this,"center",s("center",1)),new Ft(t,this,"right",s("right",2))]}loweringEnter(t){let e={members:[],onTemporal(n){this.members.push(n)}};return t.beginLoweringGroup(this,e),[]}loweringExit(t){let{members:e}=t.endLoweringGroup(this),n=t.getTemporalNodes(this.slots[0])[0];n.members=e,n.slots=this.slots.map(o=>{let[s,i]=t.getTemporalNodes(o);return{ast:o,start:s,end:i}}),n.slots[2].end.onTimeState=()=>n.validateDuration();for(let o of e)if(o.breakBefore>0)throw new C("E_HEAD_INTERNAL_BREAK","@head \u7684\u5185\u90E8\u4E0D\u80FD\u4F7F\u7528 @br\uFF1B\u7B2C\u4E00\u5C42\u5185\u5BB9\u5DF2\u7ECF\u8868\u793A\u89C6\u89C9\u884C",o.ast.sourceSpan);return[]}addSugarRow(t,e){this.slots.find(n=>n.name===t).addRow(e)}toString(t){let e=this.slots.filter(n=>n.rows.length>0).map(n=>{let o=n.rows.map(s=>` ${s.toString(t).replaceAll(`
|
|
37
38
|
`,`
|
|
38
39
|
`)}`).join(`
|
|
39
40
|
`);return` ${n.name}={
|
|
40
41
|
${o}
|
|
41
|
-
}`});return this.gap!==
|
|
42
|
+
}`});return this.gap!==Xs&&e.push(` gap=${this.gap}px`),`@head(
|
|
42
43
|
${e.join(`,
|
|
43
44
|
`)}
|
|
44
|
-
)`}},
|
|
45
|
+
)`}},Js=io;var ro=class extends _{static def={name:["br"],description:"\u6362\u884C",details:`~~~jpfun
|
|
45
46
|
1 2 @br() 3 4
|
|
46
47
|
~~~
|
|
47
48
|
|
|
48
49
|
\`@br()\` \u6362\u5230\u4E0B\u4E00\u884C\uFF0C\`@br(2)\` \u7A7A\u51FA\u4E00\u884C\u518D\u7EE7\u7EED
|
|
49
50
|
|
|
50
51
|
**\u7B80\u5199**\uFF1A\u4EC5\u5728\u9876\u5C42\uFF0C\u8FDE\u7EED\u81F3\u5C11\u4E24\u4E2A\u6362\u884C\u8868\u793A\u6362\u884C`,allowExtraArgs:!1,args:[{name:"offset",description:"\u540E\u7EED\u5185\u5BB9\u504F\u79FB\u7684\u8C31\u9762\u884C\u6570\uFF0C2 \u8868\u793A\u7A7A\u51FA\u4E00\u884C\u518D\u7EE7\u7EED",type:"number",default:1}]};static deSugarAtom(t,e,n,o){if(o>0||t[e]!==`
|
|
51
|
-
`||t[
|
|
52
|
-
`)return null;let s=e+1,
|
|
53
|
-
`;)s=++r;return{next:s,node:{kind:"call",typed:!0,name:"br",args:new Map,span:{start:e,end:s}}}}offset;loweringEnter(){let t=new W;return t.ast=this,t.mergeKey=-1,t.breakBefore=this.offset,[t]}static loweringFinalize=t=>{let e=new I,n=new I,o=null;for(let s of t.columns){if(o&&e.compare(s[0].t)>0&&s.some(r=>r.breakBefore>0))throw N.error.BreakInsideEvent(o.ast.sourceSpan);for(let r of s)r.T.isZero()||(n.copyFrom(r.t).add(r.T),(!o||n.compare(e)>0)&&(e.copyFrom(n),o=r))}};constructor(t,e,n,o=null){super(t,o);let[s]=this.getArgValue(e,n);this.offset=Number.isFinite(s)?Math.max(1,Math.floor(s)):1,this.offset!==s&&n.diagnostics.push(new O("W_BR_OFFSET",`@br \u7684 offset \u5FC5\u987B\u662F\u5927\u4E8E\u7B49\u4E8E 1 \u7684\u6574\u6570\uFF0C\u5DF2\u88AB\u4FEE\u6B63\u4E3A ${this.offset}`,this.sourceSpan))}toString(){return`@br(${this.offset})`}},Ps=jn;var Xn=10,Zn=13,Cr=9,Ar=11,Lr=12,Tr=32,Er=160,_r=5760,vr=8239,Nr=8287,kr=12288,Mr=65279,Rr=34,Fs=92,Or=37,Ir=32,Pr=[];function Fr(i){return i>Ir?" ".repeat(i):Pr[i]??=" ".repeat(i)}function Ds(i){return i===Tr||i===Cr||i===Ar||i===Lr?!0:i<128?!1:i===Er||i===_r||i>=8192&&i<=8202||i===vr||i===Nr||i===kr||i===Mr}function Xt(i){let t=i.length,e=[0],n=[],o=[],s=(x,m)=>{if(x>=m)return;let b=o.length;if(b>=2&&x<=o[b-1]){m>o[b-1]&&(o[b-1]=m);return}o.push(x,m)},r=(x,m)=>{if(m<=0)return;let b=x+m;for(let w=x;w<b;w+=2)s(w,w+1)},c=0,a=!1,l=!1,h=-1,p=-1,f=-1,d=0,u=(x,m)=>{if(m===Fs){d>0&&p+1===x?d++:(f=x,d=1),p=x;return}f=-1,d=0,p=x};for(let x=0;x<t;){let m=i.charCodeAt(x);if(m===Zn||m===Xn){let b=m===Zn&&x+1<t&&i.charCodeAt(x+1)===Xn?2:1;e.push(x+b);let w=(d&1)===1;r(f,d),h>=0&&(s(h,x),n.push({start:h,end:x}),h=-1),w&&s(x,x+b),p=-1,f=-1,d=0,l=!1,x+=b;continue}if(c!==0){l?l=!1:m===Fs?l=!0:m===c&&(c=0),Ds(m)||u(x,m),x++;continue}if(m===Rr){a||(gt(i,x,t)<0?a=!0:c=m),u(x,m),x++;continue}if(m===Or){for(h=x,x++;x<t;){let b=i.charCodeAt(x);if(b===Zn||b===Xn)break;x++}continue}Ds(m)||u(x,m),x++}if(r(f,d),h>=0&&(s(h,t),n.push({start:h,end:t})),o.length===0)return{maskedSource:i,lineStarts:e,commentSpans:n};let g=[],y=0;for(let x=0;x<o.length;x+=2){let m=o[x],b=o[x+1];y<m&&g.push(i.slice(y,m)),g.push(Fr(b-m)),y=b}return y<t&&g.push(i.slice(y)),{maskedSource:g.join(""),lineStarts:e,commentSpans:n}}var bt="CDEFGAB",Ge=(i,t)=>(i%t+t)%t,Dr=i=>i<0?"b".repeat(-i):"#".repeat(i);function Ve(i){throw new S("E_NOTE_TRANSFORM","\u65E0\u6CD5\u5B89\u5168\u6539\u5199\u6B64\u97F3\u7B26\u7684\u97F3\u9AD8",i)}function $r(i,t){let e=t==="to-absolute"||t!=="to-relative"&&bt.includes(i.ast.name),n=i.resolvedMidi+(t==="semitone-up"?1:t==="semitone-down"?-1:0),o=kt(i.keySignature,4);[n,o,i.ast.octave,i.ast.jeOctaveOffset].every(Number.isSafeInteger)||Ve(i.ast.sourceSpan);let s=t==="semitone-down"?Es:Oe,r,c,a;if(t==="to-absolute"){let l=bt.indexOf(i.keySignature[0]),h=l<0?bt.indexOf(Oe[Ge(o,12)][0]):l,p=Number(i.ast.name)-1;r=bt[(h+p)%7];let f=Ge(o-dt[bt[h]]+6,12)-6;a=Math.floor((o-f)/12)-1+Math.floor((h+p)/7)+i.ast.octave+i.ast.jeOctaveOffset,c=Dr(n-((a+1)*12+dt[r]))}else if(t==="to-relative"){let l=i.ast,h=bt.includes(i.keySignature[0])?i.keySignature:Oe[Ge(o,12)]+(Math.floor(o/12)-1),p=fe(l.name,l.acc,l.octave+l.jeOctaveOffset,h);p||Ve(l.sourceSpan),{renderName:r,renderAcc:c,renderOctave:a}=p}else{let l=e?n:n-o,h=s[Ge(l,12)];r=e?h[0]:String(bt.indexOf(h[0])+1),c=h.slice(1),a=Math.floor(l/12)-(e?1:0)}return{name:r,acc:c,octave:a-i.ast.jeOctaveOffset,absolute:e}}function Br(i,t){for(let e=t.parent;e;e=e.parent){let n=he(i,e.sourceSpan.start,e.sourceSpan.end);if(!n)continue;let o=n.args.find(r=>r.valueSpan.start<=t.sourceSpan.start&&r.valueSpan.end>=t.sourceSpan.end);if(!o)continue;let s=0;for(let r=o.valueSpan.start;r<t.sourceSpan.start;r++)i[r]==='"'?r=gt(i,r,o.valueSpan.end):i[r]==="{"?s++:i[r]==="}"&&s--;return s===0}return!1}function $s(i,t,e,n){let{maskedSource:o}=Xt(i),s=[],r=[];function c(l,h){i.slice(l.start,l.end)!==h&&(i.slice(l.start,l.end)!==o.slice(l.start,l.end)&&Ve(l),s.push({span:l,text:h}))}for(let l of t){let M=function(T,E,C){let _=!C||C.includes(",")||T&&i[T.start]==='"'?rt(C):C;T?c(T,_):k.push(`${E}=${_}`)};var a=M;let{ast:h}=l,p=h.sourceSpan,f=he(o,p.start,p.end),d=f?.span.end===p.end&&f.closeParenSpan,u=e==="to-absolute"&&bt.includes(h.name)||e==="to-relative"&&/^[1-7]$/.test(h.name);if(d||r.push({span:p,text:i.slice(p.start,p.end)}),n&&!n.some(T=>T.start<=p.start&&T.end>=p.end)||l.resolvedMidi===null||u)continue;let g=$r(l,e),y=g.absolute?String(g.octave):g.octave<0?",".repeat(-g.octave):"'".repeat(g.octave),x=(T,E)=>g.absolute?g.name+T+E:T+g.name+E;if(!d){let T=x(g.acc,y);T.includes(",")&&Br(o,h)&&(T=`{${T}}`),r[r.length-1].text=T;continue}let m=new Map;f.args.forEach((T,E)=>{T.valueSpan.start!==T.valueSpan.end&&m.set(T.nameSpan?o.slice(T.nameSpan.start,T.nameSpan.end).toLowerCase():E,T.valueSpan)});let b=m.get("name")??m.get(0),w=m.get("acc")??m.get(1),A=m.get("octave")??m.get(2),k=[];if(M(b,"name",x(w?"":g.acc,A?"":y)),w?M(w,"acc",g.acc):h.hasDefaultAcc&&k.push('acc=""'),A&&c(A,String(g.octave)),k.length){let T=f.closeParenSpan.start,E=o.slice(f.openParenSpan.end,T).trimEnd();c({start:T,end:T},(E?E.endsWith(",")?" ":", ":"")+k.join(", "))}}r.sort((l,h)=>l.span.start-h.span.start);for(let l=0;l<r.length-1;l++){let h=r[l],p=r[l+1];if(h.span.end!==p.span.start||h.text.endsWith("}"))continue;let f=Nt(h.text+p.text);(f instanceof N||f.next!==h.text.length)&&(h.text!==i.slice(h.span.start,h.span.end)?h.text+=" ":p.text=" "+p.text)}for(let l of r)c(l.span,l.text);s.sort((l,h)=>l.span.start-h.span.start);for(let l=1;l<s.length;l++)s[l-1].span.end>s[l].span.start&&Ve(s[l].span);return s}function Bs(i,t,e,n){let o=t.diagnostics.find(c=>c instanceof S);if(o)throw o;let s=[...t.astToTemporal.values()].flat().filter(c=>c instanceof Ye),r=t.diagnostics.find(c=>s.some(a=>c.span.start<a.ast.sourceSpan.end&&c.span.end>a.ast.sourceSpan.start));if(r)throw r;return $s(i,s,e,n)}var qn="note.jeOctaveOffset",Qn=class extends v{static def={name:["note","n"],description:"\u521B\u5EFA\u97F3\u7B26",details:"~~~jpfun\n@note(A, acc=#, octave=3, color=#c33)\n~~~\n**\u7B80\u5199**\uFF1A\u6570\u5B57\u97F3\u540D\u6309\u201C\u5347\u964D\u53F7\u3001\u97F3\u540D\u3001\u76F8\u5BF9\u516B\u5EA6\u201D\u4E66\u5199\uFF1B\u5B57\u6BCD\u97F3\u540D\u6309\u201C\u97F3\u540D\u3001\u5347\u964D\u53F7\u3001\u7EDD\u5BF9\u516B\u5EA6\u201D\u4E66\u5199\u3002`1,,` \u6BD4\u5F53\u524D\u8C03\u6027\u57FA\u51C6\u4F4E\u4E24\u4E2A\u516B\u5EA6\uFF0C`1'` \u9AD8\u4E00\u4E2A\u516B\u5EA6\u3002\n- \u7B80\u5199\u7684\u5347\u964D\u53F7\u5B8C\u5168\u7531\u81EA\u8EAB\u51B3\u5B9A\uFF0C\u7701\u7565\u65F6\u4E3A\u7A7A\uFF0C\u4E0D\u7EE7\u627F `@set(note.acc=...)`\uFF1B\u663E\u5F0F\u8C03\u7528\u7701\u7565 `acc` \u65F6\u4ECD\u7EE7\u627F\u9ED8\u8BA4\u503C\n- `A#3` \u7B49\u4EF7\u4E8E `@note(A, #, 3)`\uFF0C\u9ED8\u8BA4 `acc` \u4E3A\u7A7A\u65F6\u4E5F\u7B49\u4EF7\u4E8E `@note(A#3)`\n- `#1'` \u7B49\u4EF7\u4E8E `@note(1, #, 1)`\uFF0C\u9ED8\u8BA4 `acc` \u4E3A\u7A7A\u65F6\u4E5F\u7B49\u4EF7\u4E8E `@note(\"#1'\")`\n- \u652F\u6301\u7EC4\u5408\u5347\u964D\u53F7\uFF0C\u5982 `A##bn99`\uFF1B\u65E0\u6B67\u4E49\u65F6\u4E5F\u63A5\u53D7\u540E\u7F6E\u5199\u6CD5\uFF0C\u5982 `A3#`\u3001`6#,,`\n- \u5347\u964D\u53F7\u540E\u7D27\u8DDF\u6570\u5B57\u65F6\u5F52\u5165\u4E0B\u4E00\u97F3\u7B26\uFF1A`6#3` \u89E3\u6790\u4E3A `6` \u548C `#3`",allowExtraArgs:!1,args:[{name:"name",description:"\u6570\u5B57\u97F3\u540D\u6216\u5927\u5199\u5B57\u6BCD\u97F3\u540D\uFF0C\u53EF\u81EA\u5E26\u5347\u964D\u53F7\u4E0E\u516B\u5EA6\uFF1B`0` / `Z` \u4E3A\u4F11\u6B62\u7B26\uFF0C`8` \u4E3A\u9690\u5F62\u5360\u4F4D\uFF0C`9` / `X` \u4E3A\u8282\u62CD\u8BB0\u53F7\uFF0C\u540E\u4E09\u7C7B\u4E0D\u663E\u793A\u5347\u964D\u53F7\u548C\u516B\u5EA6\u70B9",type:"string",default:null},{name:"acc",description:"\u989D\u5916\u5347\u964D\u53F7\uFF0C`##` \u518D\u5347\u4E24\u4E2A\u534A\u97F3\uFF0C`b` \u518D\u964D\u4E00\u4E2A\u534A\u97F3",type:"string",default:""},{name:"octave",description:"\u5B57\u6BCD\u97F3\u540D\u4F7F\u7528\u7EDD\u5BF9\u516B\u5EA6\uFF1B\u6570\u5B57\u97F3\u540D\u4F7F\u7528\u76F8\u5BF9\u516B\u5EA6\uFF0C\u7701\u7565\u65F6\u4E3A 0",type:"number",default:4},{name:"color",description:"\u97F3\u7B26\u989C\u8272\uFF0C\u4F7F\u7528 CSS \u989C\u8272\u503C",type:"string",default:"#000"}]};static deSugarAtom(t,e,n){let o=0;switch(t[e]){case"(":case"]":o=-1;break;case"[":case")":o=1;break}if(o)return{next:e+1,node:{kind:"sugar",data:{jeOffset:o},span:{start:e,end:e+1},syntaxKind:"punctuation"}};let s=Nt(t,e,n);if(s instanceof N)return null;let r=new Map;r.set("name",s.name),s.octave!==null&&r.set("octave",s.octave),r.set("acc",s.acc??"");let c={kind:"call",typed:!0,name:"note",args:r,span:{start:e,end:s.next},syntaxKind:"atom"};return{next:s.next,node:c}}static deSugarRelation(t,e,n){let o=e[n],s=o.data?.jeOffset;return typeof s!="number"?null:(t.variables[qn]=(t.variables[qn]??0)+s,t.nodes.push(new Z(o.span)),n+1)}labelable(){return this}loweringEnter(){return[new Ye(this)]}name;octave;acc;color;size;font;jeOctaveOffset;hasDefaultAcc;constructor(t,e,n,o=null){super(t,o),this.hasDefaultAcc=!!n.variables["note.acc"],[this.name,this.acc,this.octave,this.color]=this.getArgValue(e,n),this.font=n.variables.numberfont,this.size=n.variables.fontsize;let s=Nt(this.name);if(s instanceof N)throw s.span=t,s;if(s.next!==this.name.length)throw new S("E_WRONG_NOTE_NAME",`\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u65E0\u6CD5\u89E3\u6790\u5C3E\u90E8 "${this.name.slice(s.next)}"`,t);this.name=s.name==="X"?"9":s.name==="Z"?"0":s.name;let r=e.get("octave")??e.get(2);if(r!==void 0){if(s.octave!==null&&s.octave!=r)throw new S("E_NOTE_OCTAVE_CONFLICT",`\u51FD\u6570 @note \u7684\u53C2\u6570 "octave" \u4E0E\u97F3\u7B26\u540D\u79F0\u4E2D\u7684\u516B\u5EA6\u4FE1\u606F\u51B2\u7A81: ${r} != ${s.octave}`,t)}else s.octave!==null?this.octave=s.octave:s.absOctave||(this.octave=0);this.jeOctaveOffset=n.variables[qn]??0,s.acc!==null&&(this.acc=s.acc+this.acc)}toString(){return`@n(${this.name}, ${this.acc||'""'}, ${this.octave}, ${this.color})`}},zs=Qn,zr={8:"",9:"X"},Ye=class extends W{resolvedMidi=null;keySignature="C4";transposeDiatonic;name;acc;octave;accidentals=[];numberStyle;upperOctaveDotY=[];lowerOctaveDotY=[];octaveDotRadius=0;numberY=0;constructor(t){super(),this.ast=t,this.T.set(1),this.mergeKey=ht,this.name=t.name,this.acc=t.acc,this.octave=t.octave+t.jeOctaveOffset,this.numberStyle={fontSize:t.size,fontFamily:t.font,fontWeight:400,textAlign:"center",fill:t.color},this.initLayoutBox()}prepareLayout(t){this.upperOctaveDotY.length=0,this.lowerOctaveDotY.length=0;let{size:e,color:n}=this.ast,o=t.textMeasurer.measureText("0",this.numberStyle),s=Math.abs(this.octave);this.octaveDotRadius=e*.075;let r=e*.08,c=this.octaveDotRadius*2+r,a=s===0?0:s*this.octaveDotRadius*2+(s-1)*r+r,l=this.octave>0?a:0;this.numberY=l+o.baseline;let h=e*.01,{placed:p,right:f}=Ie(this.acc,e,0,this.numberY,h);if(this.accidentals=p,this.box.w=f+o.w,this.box.h=l+o.h,this.box.anchor=f+o.w/2,this.box.visualAxis=l+o.h/2,this.ports["body.left"]={x:this.box.anchor-o.w/2,y:this.box.visualAxis},this.ports["body.right"]={x:this.box.anchor+o.w/2,y:this.box.visualAxis},this.ports.shoulder={x:this.box.anchor,y:l},this.ports.dot={x:this.box.w,y:l+o.h*.64},this.octave>0){for(let g=0;g<s;g++)this.upperOctaveDotY.push(l-r-this.octaveDotRadius-g*c);return}if(this.octave>=0)return;let d=s*this.octaveDotRadius*2+(s-1)*r,u={below:{order:100,gap:r,height:d,place:g=>{for(let y=0;y<s;y++)this.lowerOctaveDotY.push(g+this.octaveDotRadius+y*c)}},paint:g=>{for(let y of this.lowerOctaveDotY)g.drawCircle(this.box.x+this.box.anchor,this.box.y+y,this.octaveDotRadius,{fill:n})}};this.decorations.push(u)}finalizeLayout(){this.ports.lyric={x:this.box.anchor,y:this.box.h}}paint(t){let e=this.ast.color;for(let o of this.accidentals)Pe(t,o,this.box,e);let n=zr[this.name]??this.name;n&&t.drawText(n,this.box.x+this.box.anchor,this.box.y+this.numberY,this.numberStyle);for(let o of this.upperOctaveDotY)t.drawCircle(this.box.x+this.box.anchor,this.box.y+o,this.octaveDotRadius,{fill:e})}onTimeState(t){let e=this.keySignature=t.keySignature;if(this.playbackState={bpm:t.bpm,velocity:t.velocity,program:t.program},this.resolvedMidi=$n(this.name,this.acc,this.octave,e),this.transposeDiatonic=_s(this.name,this.acc,this.octave,e),this.name>="0"&&this.name<="9")(this.name==="0"||this.name>="8")&&(this.octave=0,this.acc="");else{let n=fe(this.name,this.acc,this.octave,e);n&&(this.name=n.renderName,this.acc=n.renderAcc,this.octave=n.renderOctave)}}emitPlayback(t){let e=this.ast.name==="9",n=e?37:this.resolvedMidi;if(!(t.end.compare(t.start)<=0)){if(n===null){t.span({start:t.start,end:t.end});return}t.note({start:t.start,end:t.end,midi:n,velocity:this.playbackState?.velocity??Bt,...e?{percussion:!0}:{transpose:this.transposeDiatonic}})}}};var Ke=class i extends v{contents=[];belows=[];size;get side(){return this.constructor.side}get children(){return this.belows.length?[...this.contents,...this.belows]:this.contents}constructor(t,e,n,o=null){super(t,o),this.size=n.variables.fontsize;for(let[,s]of e){if(s instanceof et){this.addContent(s,this.side,n);continue}let r=n.parseArgWithType(s.valueSpan,"content",t.start);r!==null&&this.addContent(r,this.side,n)}}labelable(){return this.children.some(v.findLabelable)?this:null}addContent(t,e,n){return this.contents.length===0&&(e="above"),t instanceof i?this.flatten(t,e,n):((e==="above"?this.contents:this.belows).push(t),t.parent=this,this.growSpan(t.sourceSpan),this)}growSpan(t){this.sourceSpan.start=Math.min(this.sourceSpan.start,t.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,t.end)}loweringEnter(t,e){let n=[];return t.isolateFromLoweringGroups(()=>{for(let o of this.children){let[s,...r]=t.trackedEvents(o,new I,e).flat();if(!s||r.length>0||!F(s))throw new S("E_UP_INVALID_CHILD","@up \u7684\u6BCF\u4E2A\u53C2\u6570\u5FC5\u987B\u6070\u597D\u4EA7\u751F\u4E00\u4E2A\u53EF\u89C1 Temporal\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B\u591A\u58F0\u90E8\u7ED3\u6784",o.sourceSpan);n.push(s)}}),[new eo(this,n)]}toString(t){let e=this.contents.map(o=>o.toString(t));return this.belows.length===0?`@up(${e.join(", ")})`:`@down(${[e.length>1?`@up(${e.join(", ")})`:e[0],...this.belows.map(o=>o.toString(t))].join(", ")})`}flatten(t,e,n){let o=t.sourceSpan.start<this.sourceSpan.start?t:this,s=o===t?this:t,[r,...c]=s.contents,a=r?[r]:[],l=[...o.contents,...e==="above"?a:[],...c],h=[...o.belows,...e==="below"?a:[],...s.belows];this.contents=l,this.belows=h;for(let f of this.children)f.parent=this;this.growSpan(t.sourceSpan),t.contents=[],t.belows=[];let p=n.labelableNodes.indexOf(t);return p>=0&&n.labelableNodes.splice(p,1),this}static desugar(t,e,n){let o=e[n++];if(!(o.kind==="sugar"&&o.data===this))return null;let s=this.side==="above"?"@up":"@down",r=t.nodes.length-1;for(;r>=0&&t.nodes[r]instanceof Z;)r--;if(r<0)throw new S("E_FOLD_NO_TARGET",`${s}\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u5DE6\u8FB9\u6CA1\u6709\u627E\u5230\u53EF\u53E0\u52A0\u7684\u76EE\u6807`,o.span);let c=t.nodes[r],a=r;if(c instanceof lt){let p=c,f=p.target;for(;f&&!t.nodes.includes(f);)f=f.parent;for(let d=r-1;d>=0;d--)if(t.nodes[d]===f){c=new K({start:f.sourceSpan.start,end:p.sourceSpan.end},t.nodes.slice(d,r+1),null),a=d;break}}let l=c instanceof i?c:new this(o.span,new Map,t).addContent(c,"above",t),h=t.nodes;t.nodes=[],t.makeNodes(e,n);for(let p=0;p<t.nodes.length;p++){let f=t.nodes[p];if(f instanceof Z)continue;let d=f instanceof i?f.flatten(l,this.side,t):l.addContent(f,this.side,t);for(h.length=a,h.push(d);++p<t.nodes.length;)h.push(t.nodes[p]);return t.nodes=h,t.labelableNodes.push(d.labelable()),e.length}throw new S("E_FOLD_NO_TARGET",`${s}\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u53F3\u8FB9\u6CA1\u6709\u627E\u5230\u53EF\u53E0\u52A0\u7684\u76EE\u6807`,o.span)}},Jn=class i extends Ke{static side="above";static def={name:["up"],description:"\u628A\u540C\u4E00\u65F6\u95F4\u4F4D\u7F6E\u7684\u53EF\u89C1\u5BF9\u8C61\u5411\u4E0A\u5806\u53E0",details:"~~~jpfun\n@up(1, 3, 5)\n~~~\n\n\u7B2C\u4E00\u4E2A\u5185\u5BB9\u53C2\u6570\u4E3A\u5BBF\u4E3B\uFF0C\u5176\u4F59\u4F9D\u6B21\u53E0\u5728\u4E0A\u65B9\uFF1B\u6240\u6709\u6210\u5458\u5171\u4EAB\u5BBF\u4E3B\u65F6\u503C\u3002\u5E38\u7528\u4E8E\u548C\u5F26\u3001\u901F\u5EA6\u8BB0\u53F7\u548C\u97F3\u7B26\u6CE8\u91CA\u3002\n\n**\u7B80\u5199**\uFF1A`1 ^ 3 ^ 5`\u3002\u590D\u6742\u5185\u5BB9\u53EF\u7528 `{...}` \u5305\u88F9\uFF1B\u9700\u8981\u72EC\u7ACB\u8282\u594F\u7684\u5E76\u884C\u5206\u652F\u65F6\uFF0C\u4F7F\u7528 `&` / `@stack`\u3002",allowExtraArgs:!0,extraArgType:"content",args:[]};static deSugarAtom(t,e,n){if(t[e]!=="^")return null;let o={kind:"sugar",data:i,span:{start:e,end:e+1}};return{next:e+1,node:o}}static deSugarRelation(t,e,n){return i.desugar(t,e,n)}},to=class i extends Ke{static side="below";static def={name:["down"],description:"\u628A\u540C\u4E00\u65F6\u95F4\u4F4D\u7F6E\u7684\u53EF\u89C1\u5BF9\u8C61\u5411\u4E0B\u5806\u53E0",details:"~~~jpfun\n@down(1, $p)\n~~~\n\u7B2C\u4E00\u4E2A\u5185\u5BB9\u53C2\u6570\u4E3A\u5BBF\u4E3B\uFF0C\u5176\u4F59\u4F9D\u6B21\u53E0\u5728\u4E0B\u65B9\u5E76\u5171\u4EAB\u5176\u65F6\u503C\uFF0C\u5E38\u7528\u4E8E\u529B\u5EA6\u7B49\u4E0B\u65B9\u6807\u8BB0\u3002\n\n**\u7B80\u5199**\uFF1A`1 _ $p`\u3002\u4E0E `^` \u6DF7\u5199\u65F6\u5171\u7528\u540C\u4E00\u5BBF\u4E3B\uFF1A`1^2_3` \u5C06 `2` \u653E\u5728 `1` \u4E0A\u65B9\u3001`3` \u653E\u5728\u4E0B\u65B9\u3002",allowExtraArgs:!0,extraArgType:"content",args:[]};static deSugarAtom(t,e,n){if(t[e]!=="_")return null;let o={kind:"sugar",data:i,span:{start:e,end:e+1}};return{next:e+1,node:o}}static deSugarRelation(t,e,n){return i.desugar(t,e,n)}},Hs=Jn,Ws=to,eo=class extends W{members;aboveCount;verticalOffsets=[];constructor(t,e){super(),this.ast=t,this.members=e,this.aboveCount=t.contents.length;let n=e.find(s=>!s.T.isZero());n&&this.T.copyFrom(n.T),this.mergeKey=ht,this.initLayoutBox();let o=e[0]?.addon;o&&(this.addon={...o});for(let s of e)s.mergeKey===U&&(this.mergeKey=U),s.addon=void 0,s.foldedInto=this}onTimeState(t){for(let e=this.members.length-1;e>=0;e--){let n=this.members[e];n.T.isZero()||n.T.copyFrom(this.T),n.t.copyFrom(this.t),n.track=this.track,n.layoutLine=this.layoutLine,n.onTimeState?.(t)}}emitPlayback(t){for(let e=this.members.length-1;e>=0;e--)t.play(this.members[e])}prepareHorizontal(t){this.members[0]?.prepareHorizontal?.(t)}prepareLayout(t){this.addon&&this.members[0]&&(this.members[0].addon=this.addon,this.addon=void 0);let e=this.members[0];if(!e){this.box.w=this.box.h=0,this.box.anchor=this.box.visualAxis=0;return}this.box.w=Gt([e],t);for(let h=1;h<this.members.length;h++)Gt([this.members[h]],t);this.springConfig={...e.springConfig,...this.springConfig};let n=e.box.x+e.box.anchor,o=this.ast.size*.12;this.verticalOffsets.length=this.members.length,this.verticalOffsets.fill(0);let s=0;for(let h=1;h<this.aboveCount;h++)s-=o+this.members[h].box.h,this.verticalOffsets[h]=s;let r=e.box.h;for(let h=this.aboveCount;h<this.members.length;h++)r+=o,this.verticalOffsets[h]=r,r+=this.members[h].box.h;for(let h=0;h<this.verticalOffsets.length;h++)this.verticalOffsets[h]-=s;this.box.h=r-s,this.box.anchor=n,this.box.visualAxis=e.box.visualAxis-s;let c=this.verticalOffsets[0];for(let h in e.ports){let p=e.ports[h];this.ports[h]={...p,x:e.box.x+p.x,y:c+p.y}}this.ports["body.left"]??={x:e.box.x,y:this.box.visualAxis},this.ports["body.right"]??={x:e.box.x+e.box.w,y:this.box.visualAxis};let a=this.aboveCount-1,l=this.verticalOffsets[a];this.ports["tie.top"]={x:n,y:l+(this.members[a].ports["tie.top"]?.y??0)}}onPlaced(){for(let t=0;t<this.members.length;t++){let e=this.members[t];e.box.x=this.box.x+this.box.anchor-e.box.anchor,e.box.y=this.box.y+this.verticalOffsets[t],e.onPlaced?.()}}paint(t){for(let e of this.members){e.paint(t);for(let n of e.decorations)n.paint(t)}}};var Zt=i=>({value:i,unit:"px"}),no=16,Hr={fontSize:no,textAlign:"center",fill:"#606060"};function Wr(i,t,e){let n=i.lastIndexOf("1"),o=i.indexOf("1")!==n;return i.replace(/1/g,(s,r)=>String(o&&r===n?e:t))}var oo=class{sourceSpan;pattern;marginBottom;style;layer="foreground";constructor(t,e,n,o){this.sourceSpan=t,this.pattern=e,this.marginBottom=n,this.style=o}createGeometry(t){let e=this.style,n=t.pages.map((o,s)=>{let r=Wr(this.pattern,s+1,t.pages.length),{w:c,h:a,baseline:l}=t.textMeasurer.measureText(r,e),h=o.y+o.h-this.marginBottom/2;return{text:r,x:o.x+o.w/2,y:h-a/2+l,w:c,h:a,baseline:l}});return{regions:n.map(({x:o,y:s,w:r,h:c,baseline:a})=>({x:o-r/2,y:s-a,w:r,h:c})),paint(o){for(let s of n)o.drawText(s.text,s.x,s.y,e)}}}},so=class extends v{static def={name:["page"],description:"\u8BBE\u7F6E\u6587\u6863\u9875\u9762",details:`~~~jpfun
|
|
52
|
+
`||t[me(t,e-1)]!==`
|
|
53
|
+
`)return null;let s=e+1,i=s;for(;(i=mt(t,i,n))<n&&t[i]===`
|
|
54
|
+
`;)s=++i;return{next:s,node:{kind:"call",typed:!0,name:"br",args:new Map,span:{start:e,end:s}}}}offset;loweringEnter(){let t=new D;return t.ast=this,t.mergeKey=-1,t.breakBefore=this.offset,[t]}static loweringFinalize=t=>{let e=new O,n=new O,o=null;for(let s of t.columns){if(o&&e.compare(s[0].t)>0&&s.some(i=>i.breakBefore>0))throw k.error.BreakInsideEvent(o.ast.sourceSpan);for(let i of s)i.T.isZero()||(n.copyFrom(i.t).add(i.T),(!o||n.compare(e)>0)&&(e.copyFrom(n),o=i))}};constructor(t,e,n,o=null){super(t,o);let[s]=this.getArgValue(e,n);this.offset=Number.isFinite(s)?Math.max(1,Math.floor(s)):1,this.offset!==s&&n.diagnostics.push(new P("W_BR_OFFSET",`@br \u7684 offset \u5FC5\u987B\u662F\u5927\u4E8E\u7B49\u4E8E 1 \u7684\u6574\u6570\uFF0C\u5DF2\u88AB\u4FEE\u6B63\u4E3A ${this.offset}`,this.sourceSpan))}toString(){return`@br(${this.offset})`}},ti=ro;var co=10,ao=13,Vr=9,Kr=11,Yr=12,Ur=32,jr=160,Xr=5760,Zr=8239,qr=8287,Qr=12288,Jr=65279,tc=34,ei=92,ec=37,nc=32,oc=[];function sc(r){return r>nc?" ".repeat(r):oc[r]??=" ".repeat(r)}function ni(r){return r===Ur||r===Vr||r===Kr||r===Yr?!0:r<128?!1:r===jr||r===Xr||r>=8192&&r<=8202||r===Zr||r===qr||r===Qr||r===Jr}function qt(r){let t=r.length,e=[0],n=[],o=[],s=(x,m)=>{if(x>=m)return;let y=o.length;if(y>=2&&x<=o[y-1]){m>o[y-1]&&(o[y-1]=m);return}o.push(x,m)},i=(x,m)=>{if(m<=0)return;let y=x+m;for(let b=x;b<y;b+=2)s(b,b+1)},c=0,a=!1,l=!1,h=-1,p=-1,f=0,d=(x,m)=>{if(m===ei){f>0&&p+f===x?f++:(p=x,f=1);return}p=-1,f=0};for(let x=0;x<t;){let m=r.charCodeAt(x);if(m===ao||m===co){let y=m===ao&&x+1<t&&r.charCodeAt(x+1)===co?2:1;e.push(x+y);let b=(f&1)===1;i(p,f),h>=0&&(s(h,x),n.push({start:h,end:x}),h=-1),b?s(x,x+y):c===0&&y===2&&s(x,x+1),p=-1,f=0,l=!1,x+=y;continue}if(c!==0){l?l=!1:m===ei?l=!0:m===c&&(c=0),ni(m)||d(x,m),x++;continue}if(m===tc){a||(At(r,x,t)<0?a=!0:c=m),d(x,m),x++;continue}if(m===ec){for(h=x,x++;x<t;){let y=r.charCodeAt(x);if(y===ao||y===co)break;x++}continue}ni(m)||d(x,m),x++}if(i(p,f),h>=0&&(s(h,t),n.push({start:h,end:t})),o.length===0)return{maskedSource:r,lineStarts:e,commentSpans:n};let u=[],g=0;for(let x=0;x<o.length;x+=2){let m=o[x],y=o[x+1];g<m&&u.push(r.slice(g,m)),u.push(sc(y-m)),g=y}return g<t&&u.push(r.slice(g)),{maskedSource:u.join(""),lineStarts:e,commentSpans:n}}var Tt="CDEFGAB",qe=(r,t)=>(r%t+t)%t,ic=r=>r<0?"b".repeat(-r):"#".repeat(r);function Qe(r){throw new C("E_NOTE_TRANSFORM","\u65E0\u6CD5\u5B89\u5168\u6539\u5199\u6B64\u97F3\u7B26\u7684\u97F3\u9AD8",r)}function rc(r,t){let e=t==="to-absolute"||t!=="to-relative"&&Tt.includes(r.ast.name),n=r.resolvedMidi+(t==="semitone-up"?1:t==="semitone-down"?-1:0),o=Pt(r.keySignature,4);[n,o,r.ast.octave,r.ast.jeOctaveOffset].every(Number.isSafeInteger)||Qe(r.ast.sourceSpan);let s=t==="semitone-down"?Ks:$e,i,c,a;if(t==="to-absolute"){let l=Tt.indexOf(r.keySignature[0]),h=l<0?Tt.indexOf($e[qe(o,12)][0]):l,p=Number(r.ast.name)-1;i=Tt[(h+p)%7];let f=qe(o-yt[Tt[h]]+6,12)-6;a=Math.floor((o-f)/12)-1+Math.floor((h+p)/7)+r.ast.octave+r.ast.jeOctaveOffset,c=ic(n-((a+1)*12+yt[i]))}else if(t==="to-relative"){let l=r.ast,h=Tt.includes(r.keySignature[0])?r.keySignature:$e[qe(o,12)]+(Math.floor(o/12)-1),p=ye(l.name,l.acc,l.octave+l.jeOctaveOffset,h);p||Qe(l.sourceSpan),{renderName:i,renderAcc:c,renderOctave:a}=p}else{let l=e?n:n-o,h=s[qe(l,12)];i=e?h[0]:String(Tt.indexOf(h[0])+1),c=h.slice(1),a=Math.floor(l/12)-(e?1:0)}return{name:i,acc:c,octave:a-r.ast.jeOctaveOffset,absolute:e}}function cc(r,t){for(let e=t.parent;e;e=e.parent){let n=xe(r,e.sourceSpan.start,e.sourceSpan.end);if(!n)continue;let o=n.args.find(i=>i.valueSpan.start<=t.sourceSpan.start&&i.valueSpan.end>=t.sourceSpan.end);if(!o)continue;let s=0;for(let i=o.valueSpan.start;i<t.sourceSpan.start;i++)r[i]==='"'?i=At(r,i,o.valueSpan.end):r[i]==="{"?s++:r[i]==="}"&&s--;return s===0}return!1}function oi(r,t,e,n){let{maskedSource:o}=qt(r),s=[],i=[];function c(l,h){r.slice(l.start,l.end)!==h&&(r.slice(l.start,l.end)!==o.slice(l.start,l.end)&&Qe(l),s.push({span:l,text:h}))}for(let l of t){let T=function(v,N,M){let L=!M||M.includes(",")||v&&r[v.start]==='"'?ct(M):M;v?c(v,L):A.push(`${N}=${L}`)};var a=T;let{ast:h}=l,p=h.sourceSpan,f=xe(o,p.start,p.end),d=f?.span.end===p.end&&f.closeParenSpan,u=e==="to-absolute"&&Tt.includes(h.name)||e==="to-relative"&&/^[1-7]$/.test(h.name);if(d||i.push({span:p,text:r.slice(p.start,p.end)}),n&&!n.some(v=>v.start<=p.start&&v.end>=p.end)||l.resolvedMidi===null||u)continue;let g=rc(l,e),x=g.absolute?String(g.octave):g.octave<0?",".repeat(-g.octave):"'".repeat(g.octave),m=(v,N)=>g.absolute?g.name+v+N:v+g.name+N;if(!d){let v=m(g.acc,x);v.includes(",")&&cc(o,h)&&(v=`{${v}}`),i[i.length-1].text=v;continue}let y=new Map;f.args.forEach((v,N)=>{v.valueSpan.start!==v.valueSpan.end&&y.set(v.nameSpan?o.slice(v.nameSpan.start,v.nameSpan.end).toLowerCase():N,v.valueSpan)});let b=y.get("name")??y.get(0),w=y.get("acc")??y.get(1),S=y.get("octave")??y.get(2),A=[];if(T(b,"name",m(w?"":g.acc,S?"":x)),w?T(w,"acc",g.acc):h.hasDefaultAcc&&A.push('acc=""'),S&&c(S,String(g.octave)),A.length){let v=f.closeParenSpan.start,N=o.slice(f.openParenSpan.end,v).trimEnd();c({start:v,end:v},(N?N.endsWith(",")?" ":", ":"")+A.join(", "))}}i.sort((l,h)=>l.span.start-h.span.start);for(let l=0;l<i.length-1;l++){let h=i[l],p=i[l+1];if(h.span.end!==p.span.start||h.text.endsWith("}"))continue;let f=It(h.text+p.text);(f instanceof k||f.next!==h.text.length)&&(h.text!==r.slice(h.span.start,h.span.end)?h.text+=" ":p.text=" "+p.text)}for(let l of i)c(l.span,l.text);s.sort((l,h)=>l.span.start-h.span.start);for(let l=1;l<s.length;l++)s[l-1].span.end>s[l].span.start&&Qe(s[l].span);return s}function si(r,t,e,n){let o=t.diagnostics.find(c=>c instanceof C);if(o)throw o;let s=[...t.astToTemporal.values()].flat().filter(c=>c instanceof Je),i=t.diagnostics.find(c=>s.some(a=>c.span.start<a.ast.sourceSpan.end&&c.span.end>a.ast.sourceSpan.start));if(i)throw i;return oi(r,s,e,n)}var lo="note.jeOctaveOffset",ho=class extends _{static def={name:["note","n"],description:"\u521B\u5EFA\u97F3\u7B26",details:"~~~jpfun\n@note(A, acc=#, octave=3, color=#c33)\n~~~\n**\u7B80\u5199**\uFF1A\u6570\u5B57\u97F3\u540D\u6309\u201C\u5347\u964D\u53F7\u3001\u97F3\u540D\u3001\u76F8\u5BF9\u516B\u5EA6\u201D\u4E66\u5199\uFF1B\u5B57\u6BCD\u97F3\u540D\u6309\u201C\u97F3\u540D\u3001\u5347\u964D\u53F7\u3001\u7EDD\u5BF9\u516B\u5EA6\u201D\u4E66\u5199\u3002`1,,` \u6BD4\u5F53\u524D\u8C03\u6027\u57FA\u51C6\u4F4E\u4E24\u4E2A\u516B\u5EA6\uFF0C`1'` \u9AD8\u4E00\u4E2A\u516B\u5EA6\u3002\n- \u7B80\u5199\u7684\u5347\u964D\u53F7\u5B8C\u5168\u7531\u81EA\u8EAB\u51B3\u5B9A\uFF0C\u7701\u7565\u65F6\u4E3A\u7A7A\uFF0C\u4E0D\u7EE7\u627F `@set(note.acc=...)`\uFF1B\u663E\u5F0F\u8C03\u7528\u7701\u7565 `acc` \u65F6\u4ECD\u7EE7\u627F\u9ED8\u8BA4\u503C\n- `A#3` \u7B49\u4EF7\u4E8E `@note(A, #, 3)`\uFF0C\u9ED8\u8BA4 `acc` \u4E3A\u7A7A\u65F6\u4E5F\u7B49\u4EF7\u4E8E `@note(A#3)`\n- `#1'` \u7B49\u4EF7\u4E8E `@note(1, #, 1)`\uFF0C\u9ED8\u8BA4 `acc` \u4E3A\u7A7A\u65F6\u4E5F\u7B49\u4EF7\u4E8E `@note(\"#1'\")`\n- \u652F\u6301\u7EC4\u5408\u5347\u964D\u53F7\uFF0C\u5982 `A##bn99`\uFF1B\u65E0\u6B67\u4E49\u65F6\u4E5F\u63A5\u53D7\u540E\u7F6E\u5199\u6CD5\uFF0C\u5982 `A3#`\u3001`6#,,`\n- \u5347\u964D\u53F7\u540E\u7D27\u8DDF\u6570\u5B57\u65F6\u5F52\u5165\u4E0B\u4E00\u97F3\u7B26\uFF1A`6#3` \u89E3\u6790\u4E3A `6` \u548C `#3`",allowExtraArgs:!1,args:[{name:"name",description:"\u6570\u5B57\u97F3\u540D\u6216\u5927\u5199\u5B57\u6BCD\u97F3\u540D\uFF0C\u53EF\u81EA\u5E26\u5347\u964D\u53F7\u4E0E\u516B\u5EA6\uFF1B`0` / `Z` \u4E3A\u4F11\u6B62\u7B26\uFF0C`8` \u4E3A\u9690\u5F62\u5360\u4F4D\uFF0C`9` / `X` \u4E3A\u8282\u62CD\u8BB0\u53F7\uFF0C\u540E\u4E09\u7C7B\u4E0D\u663E\u793A\u5347\u964D\u53F7\u548C\u516B\u5EA6\u70B9",type:"string",default:null},{name:"acc",description:"\u989D\u5916\u5347\u964D\u53F7\uFF0C`##` \u518D\u5347\u4E24\u4E2A\u534A\u97F3\uFF0C`b` \u518D\u964D\u4E00\u4E2A\u534A\u97F3",type:"string",default:""},{name:"octave",description:"\u5B57\u6BCD\u97F3\u540D\u4F7F\u7528\u7EDD\u5BF9\u516B\u5EA6\uFF1B\u6570\u5B57\u97F3\u540D\u4F7F\u7528\u76F8\u5BF9\u516B\u5EA6\uFF0C\u7701\u7565\u65F6\u4E3A 0",type:"number",default:4},{name:"color",description:"\u97F3\u7B26\u989C\u8272\uFF0C\u4F7F\u7528 CSS \u989C\u8272\u503C",type:"string",default:"#000"}]};static deSugarAtom(t,e,n){let o=0;switch(t[e]){case"(":case"]":o=-1;break;case"[":case")":o=1;break}if(o)return{next:e+1,node:{kind:"sugar",data:{jeOffset:o},span:{start:e,end:e+1},syntaxKind:"punctuation"}};let s=It(t,e,n);if(s instanceof k)return null;let i=new Map;i.set("name",s.name),s.octave!==null&&i.set("octave",s.octave),i.set("acc",s.acc??"");let c={kind:"call",typed:!0,name:"note",args:i,span:{start:e,end:s.next},syntaxKind:"atom"};return{next:s.next,node:c}}static deSugarRelation(t,e,n){let o=e[n],s=o.data?.jeOffset;return typeof s!="number"?null:(t.variables[lo]=(t.variables[lo]??0)+s,t.nodes.push(new U(o.span)),n+1)}labelable(){return this}loweringEnter(){return[new Je(this)]}name;octave;acc;color;size;font;jeOctaveOffset;hasDefaultAcc;constructor(t,e,n,o=null){super(t,o),this.hasDefaultAcc=!!n.variables["note.acc"],[this.name,this.acc,this.octave,this.color]=this.getArgValue(e,n),this.font=n.variables.numberfont,this.size=n.variables.fontsize;let s=It(this.name);if(s instanceof k)throw s.span=t,s;if(s.next!==this.name.length)throw new C("E_WRONG_NOTE_NAME",`\u51FD\u6570 @note \u7684\u53C2\u6570 [0]:"name" \u683C\u5F0F\u9519\u8BEF: \u65E0\u6CD5\u89E3\u6790\u5C3E\u90E8 "${this.name.slice(s.next)}"`,t);this.name=s.name==="X"?"9":s.name==="Z"?"0":s.name;let i=e.get("octave")??e.get(2);if(i!==void 0){if(s.octave!==null&&s.octave!=i)throw new C("E_NOTE_OCTAVE_CONFLICT",`\u51FD\u6570 @note \u7684\u53C2\u6570 "octave" \u4E0E\u97F3\u7B26\u540D\u79F0\u4E2D\u7684\u516B\u5EA6\u4FE1\u606F\u51B2\u7A81: ${i} != ${s.octave}`,t)}else s.octave!==null?this.octave=s.octave:s.absOctave||(this.octave=0);this.jeOctaveOffset=n.variables[lo]??0,s.acc!==null&&(this.acc=s.acc+this.acc)}toString(){return`@n(${this.name}, ${this.acc||'""'}, ${this.octave}, ${this.color})`}},ii=ho,ac={8:"",9:"X"},Je=class extends D{resolvedMidi=null;keySignature="C4";transposeDiatonic;name;acc;octave;accidentals=[];numberStyle;numberY=0;constructor(t){super(),this.ast=t,this.T.set(1),this.mergeKey=ht,this.name=t.name,this.acc=t.acc,this.octave=t.octave+t.jeOctaveOffset,this.numberStyle={fontSize:t.size,fontFamily:t.font,fontWeight:400,textAlign:"center",fill:t.color},this.initLayoutBox()}prepareLayout(t){let{size:e,color:n}=this.ast,o=t.textMeasurer.measureText("0",this.numberStyle);this.numberY=o.baseline;let s=e*.01,{placed:i,right:c}=ze(this.acc,e,0,this.numberY,s);this.accidentals=i,this.box.w=c+o.w,this.box.h=o.h,this.box.anchor=c+o.w/2,this.box.visualAxis=o.h/2,this.ports["body.left"]={x:this.box.anchor-o.w/2,y:this.box.visualAxis},this.ports["body.right"]={x:this.box.anchor+o.w/2,y:this.box.visualAxis},this.ports.shoulder={x:this.box.anchor,y:0},this.ports["decoration.below"]={x:this.box.anchor,y:this.numberY+e*.04},this.ports.dot={x:this.box.w,y:o.h*.64};let a=Math.abs(this.octave);if(a===0)return;let l=this.octave>0,h=e*.075,p=e*.08,f=h*2+p,d={fill:n},u=0,g=a*h*2+(a-1)*p,x={[l?"above":"below"]:{order:100,gap:p,height:g,place:m=>{u=m}},paint:m=>{for(let y=0;y<a;y++){let b=l?u+g-h-y*f:u+h+y*f;m.drawCircle(this.box.x+this.box.anchor,this.box.y+b,h,d)}}};this.decorations.push(x)}finalizeLayout(){this.ports.lyric={x:this.box.anchor,y:this.box.h}}paint(t){let e=this.ast.color;for(let o of this.accidentals)He(t,o,this.box,e);let n=ac[this.name]??this.name;n&&t.drawText(n,this.box.x+this.box.anchor,this.box.y+this.numberY,this.numberStyle)}onTimeState(t){let e=this.keySignature=t.keySignature;if(this.playbackState={bpm:t.bpm,velocity:t.velocity,program:t.program},this.resolvedMidi=Xn(this.name,this.acc,this.octave,e),this.transposeDiatonic=Ys(this.name,this.acc,this.octave,e),this.name>="0"&&this.name<="9")(this.name==="0"||this.name>="8")&&(this.octave=0,this.acc="");else{let n=ye(this.name,this.acc,this.octave,e);n&&(this.name=n.renderName,this.acc=n.renderAcc,this.octave=n.renderOctave)}}emitPlayback(t){let e=this.ast.name==="9",n=e?37:this.resolvedMidi;if(!(t.end.compare(t.start)<=0)){if(n===null){t.span({start:t.start,end:t.end});return}t.note({start:t.start,end:t.end,midi:n,velocity:this.playbackState?.velocity??Wt,...e?{percussion:!0}:{transpose:this.transposeDiatonic}})}}};var po=Number.MAX_VALUE,Qt=new WeakMap,fo=class extends _{static def={name:["rest"],description:"\u591A\u5C0F\u8282\u4F11\u6B62",details:`~~~jpfun
|
|
55
|
+
@meter(4,4) | @rest(19) |
|
|
56
|
+
~~~
|
|
57
|
+
\u4F7F\u7528\u5F53\u524D\u62CD\u53F7\u4EA7\u751F 19 \u4E2A\u6574\u5C0F\u8282\u7684\u9759\u97F3\uFF08\u5FC5\u987B\u5148\u58F0\u660E\u62CD\u53F7\uFF09`,allowExtraArgs:!1,args:[{name:"n",description:"\u4F11\u6B62\u7684\u5C0F\u8282\u6570",type:"number",default:1},{name:"width",description:"\u6A2A\u7EBF\u7684\u6700\u5C0F\u5BBD\u5EA6",type:"length",default:{value:3,unit:"em"}},{name:"size",description:"\u6570\u5B57\u5B57\u53F7\u4E0E\u7B14\u753B\u5C3A\u5BF8",type:"length",default:{value:1,unit:"em"}}]};count;width;size;font;constructor(t,e,n,o=null){super(t,o);let[s,i,c]=this.getArgValue(e,n);if(!Number.isSafeInteger(s)||s<=0||s>4294967295)throw new C("E_REST_COUNT","@rest \u7684 n \u5FC5\u987B\u662F\u6B63\u5B89\u5168\u6574\u6570\uFF0C\u4E14\u5C0F\u8282\u7EBF\u6570\u91CF\u53EF\u7531\u6570\u7EC4\u8868\u793A",t);if(this.count=s,this.width=n.length2px(i),this.size=n.length2px(c),!Number.isFinite(this.width)||this.width<0||!Number.isFinite(this.size)||this.size<=0)throw new C("E_REST_SIZE","@rest \u7684 width \u5FC5\u987B\u6709\u9650\u4E14\u975E\u8D1F\uFF0Csize \u5FC5\u987B\u6709\u9650\u4E14\u4E3A\u6B63",t);this.font=n.variables.numberfont}labelable(){return null}loweringEnter(){return[new be(this)]}static loweringFinalize(t){if(!t.columns.some(i=>i.some(c=>c.mergeKey===po)))return;let e=0,n=new Map;for(let i of t.astToTemporal.values())for(let c of i){if(e=Math.max(e,c.order+1),!(c instanceof be)&&(!(c.ast instanceof _)||c.ast.callName!=="note"&&c.ast.callName!=="dash"))continue;let a=c;for(;a.foldedInto;)a=a.foldedInto;if(c.track!==a.track)continue;if(c instanceof be){if(a.mergeKey!==po)continue;let h=Qt.get(a);(!h||c.order<h.order)&&Qt.set(a,c);continue}let l=n.get(a);(!l||c.order<l.order)&&n.set(a,c)}let o=[],s=new Map;for(let i of t.columns){o.push(i);let c;for(let l of i){if(l.T.compare(0)>0){let p=n.get(l),f=s.get(l.track);if(f&&Qt.has(f)&&p?.ast instanceof _&&p.ast.callName==="dash")throw new C("E_REST_SUSTAIN","\u589E\u65F6\u7EBF\u4E0D\u80FD\u5EF6\u7EED\u6574\u5C0F\u8282\u4F11\u6B62",p.ast.sourceSpan);s.set(l.track,l)}let h=Qt.get(l);h&&(!c||h.T.compare(c.T)>0)&&(c=h)}if(!c)continue;let a=c.t.clone();for(let l=1;l<c.ast.count;l++){a.add(c.measureDuration);let h=new D;h.ast=new q(c.ast.sourceSpan,c.ast),h.t.copyFrom(a),h.track=c.track,h.layoutLine=c.layoutLine,h.order=e++,h.mergeKey=K,t.astToTemporal.set(h.ast,[h]),o.push([h])}}t.columns=o}toString(){return`@rest(${this.count})`}},ri=fo,be=class extends D{measureDuration=new O;metrics;lineWidth=0;textStyle;constructor(t){super(),this.ast=t,this.mergeKey=po,Qt.set(this,this),this.initLayoutBox(),this.textStyle={fontSize:t.size,fontFamily:t.font,textAlign:"center"}}onTimeState(t){let e=t.meter;if(!(e instanceof O))throw new C("E_REST_METER","\u6574\u5C0F\u8282\u4F11\u6B62\u524D\u5FC5\u987B\u6709\u5B9E\u9645\u751F\u6548\u7684\u663E\u5F0F\u62CD\u53F7",this.ast.sourceSpan);if(!Number.isSafeInteger(e.numerator*this.ast.count))throw new C("E_REST_COUNT","@rest \u7684\u603B\u65F6\u503C\u8D85\u51FA\u7CBE\u786E\u6574\u6570\u8303\u56F4",this.ast.sourceSpan);return this.measureDuration.copyFrom(e),this.T.copyFrom(e).mul(this.ast.count),this.playbackState={bpm:t.bpm},this.T}emitPlayback(t){t.span({start:t.start,end:t.end})}prepareLayout(t){let e=this.ast.size,n=6/Math.sqrt(this.T.toNumber());this.springConfig={alpha_L:n,alpha_R:n},this.metrics=t.textMeasurer.measureText(String(this.ast.count),this.textStyle),this.lineWidth=Math.max(this.ast.width,this.metrics.w+e*.5),this.box.w=this.lineWidth+e*.25,this.box.h=this.metrics.h+e*.5,this.box.anchor=e*.4,this.box.visualAxis=this.box.h-e*.65/2}prepareHorizontal(t){let e=this;for(;t.columnOf(e)<0&&e.foldedInto&&F(e.foldedInto);)e=e.foldedInto;let n=t.columnOf(e);if(n<0)return;let o=c=>t.columns[c]?.find(a=>a.track===e.track&&a.mergeKey===K)??e,s=o(n-1),i=o(n+1);s!==i&&t.registerHorizontalLayoutHook(s,i,({columns:c,rows:a,start:l,end:h,X:p,fixed:f})=>{for(let d=l;d<h;d++){if(f[d])continue;let u=0;for(let x=0;x<a;x++){let m=c[d][x],y=c[d+1][x],b=Qt.get(y.time),w=b?b.ast.size*.25:0;u=Math.max(u,m.WR+y.WL+w)}let g=p[d]+u-p[d+1];for(let x=d+1;x<p.length&&(p[x]+=g,!!f[x]);x++);f[d]=1}})}paint(t){let{size:e,count:n}=this.ast,o=this.box.x,s=o+this.lineWidth,i=this.box.y+this.box.visualAxis,c=e*.12,a=c*2,l=(e*.65-c)/2;t.drawLine(o+a/2,i,s-a/2,i,{strokeWidth:a}),t.drawLine(o+c/2,i-l,o+c/2,i+l,{strokeWidth:c}),t.drawLine(s-c/2,i-l,s-c/2,i+l,{strokeWidth:c}),t.drawText(String(n),o+this.lineWidth/2,this.box.y+this.metrics.baseline,this.textStyle)}};var tn=class r extends _{contents=[];belows=[];size;get side(){return this.constructor.side}get children(){return this.belows.length?[...this.contents,...this.belows]:this.contents}constructor(t,e,n,o=null){super(t,o),this.size=n.variables.fontsize;for(let[,s]of e){if(s instanceof q){this.addContent(s,this.side,n);continue}let i=n.parseArgWithType(s.valueSpan,"content",t.start);i!==null&&this.addContent(i,this.side,n)}}labelable(){return this.children.some(_.findLabelable)?this:null}addContent(t,e,n){return this.contents.length===0&&(e="above"),t instanceof r?this.flatten(t,e,n):((e==="above"?this.contents:this.belows).push(t),t.parent=this,this.growSpan(t.sourceSpan),this)}growSpan(t){this.sourceSpan.start=Math.min(this.sourceSpan.start,t.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,t.end)}loweringEnter(t,e){let n=[];return t.isolateFromLoweringGroups(()=>{for(let o of this.children){let s=t.trackedEvents(o,new O,e),i=s.length===1&&s[0].length===1?s[0][0]:void 0;if(!i||!F(i))throw new C("E_UP_INVALID_CHILD","@up \u7684\u6BCF\u4E2A\u53C2\u6570\u5FC5\u987B\u6070\u597D\u4EA7\u751F\u4E00\u4E2A\u53EF\u89C1 Temporal\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B\u591A\u58F0\u90E8\u7ED3\u6784",o.sourceSpan);n.push(i)}}),[new mo(this,n)]}toString(t){let e=this.contents.map(o=>o.toString(t));return this.belows.length===0?`@up(${e.join(", ")})`:`@down(${[e.length>1?`@up(${e.join(", ")})`:e[0],...this.belows.map(o=>o.toString(t))].join(", ")})`}flatten(t,e,n){let o=t.sourceSpan.start<this.sourceSpan.start?t:this,s=o===t?this:t,[i,...c]=s.contents,a=i?[i]:[],l=[...o.contents,...e==="above"?a:[],...c],h=[...o.belows,...e==="below"?a:[],...s.belows];this.contents=l,this.belows=h;for(let f of this.children)f.parent=this;this.growSpan(t.sourceSpan),t.contents=[],t.belows=[];let p=n.labelableNodes.indexOf(t);return p>=0&&n.labelableNodes.splice(p,1),this}static desugar(t,e,n){let o=e[n++];if(!(o.kind==="sugar"&&o.data===this))return null;let s=this.side==="above"?"@up":"@down",i=t.nodes.length-1;for(;i>=0&&t.nodes[i]instanceof U;)i--;if(i<0)throw new C("E_FOLD_NO_TARGET",`${s}\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u5DE6\u8FB9\u6CA1\u6709\u627E\u5230\u53EF\u53E0\u52A0\u7684\u76EE\u6807`,o.span);let c=t.nodes[i],a=i;if(c instanceof ft){let p=c,f=p.target;for(;f&&!t.nodes.includes(f);)f=f.parent;for(let d=i-1;d>=0;d--)if(t.nodes[d]===f){c=new Y({start:f.sourceSpan.start,end:p.sourceSpan.end},t.nodes.slice(d,i+1),null),a=d;break}}let l=c instanceof r?c:new this(o.span,new Map,t).addContent(c,"above",t),h=t.nodes;t.nodes=[],t.makeNodes(e,n);for(let p=0;p<t.nodes.length;p++){let f=t.nodes[p];if(f instanceof U)continue;let d=f instanceof r?f.flatten(l,this.side,t):l.addContent(f,this.side,t);for(h.length=a,h.push(d);++p<t.nodes.length;)h.push(t.nodes[p]);return t.nodes=h,t.labelableNodes.push(d.labelable()),e.length}throw new C("E_FOLD_NO_TARGET",`${s}\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u53F3\u8FB9\u6CA1\u6709\u627E\u5230\u53EF\u53E0\u52A0\u7684\u76EE\u6807`,o.span)}},uo=class r extends tn{static side="above";static def={name:["up"],description:"\u628A\u540C\u4E00\u65F6\u95F4\u4F4D\u7F6E\u7684\u53EF\u89C1\u5BF9\u8C61\u5411\u4E0A\u5806\u53E0",details:"~~~jpfun\n@up(1, 3, 5)\n~~~\n\n\u7B2C\u4E00\u4E2A\u5185\u5BB9\u53C2\u6570\u4E3A\u5BBF\u4E3B\uFF0C\u5176\u4F59\u4F9D\u6B21\u53E0\u5728\u4E0A\u65B9\uFF1B\u6240\u6709\u6210\u5458\u5171\u4EAB\u5BBF\u4E3B\u65F6\u503C\u3002\u5E38\u7528\u4E8E\u548C\u5F26\u3001\u901F\u5EA6\u8BB0\u53F7\u548C\u97F3\u7B26\u6CE8\u91CA\u3002\n\n**\u7B80\u5199**\uFF1A`1 ^ 3 ^ 5`\u3002\u590D\u6742\u5185\u5BB9\u53EF\u7528 `{...}` \u5305\u88F9\uFF1B\u9700\u8981\u72EC\u7ACB\u8282\u594F\u7684\u5E76\u884C\u5206\u652F\u65F6\uFF0C\u4F7F\u7528 `&` / `@stack`\u3002",allowExtraArgs:!0,extraArgType:"content",args:[]};static deSugarAtom(t,e,n){if(t[e]!=="^")return null;let o={kind:"sugar",data:r,span:{start:e,end:e+1}};return{next:e+1,node:o}}static deSugarRelation(t,e,n){return r.desugar(t,e,n)}},xo=class r extends tn{static side="below";static def={name:["down"],description:"\u628A\u540C\u4E00\u65F6\u95F4\u4F4D\u7F6E\u7684\u53EF\u89C1\u5BF9\u8C61\u5411\u4E0B\u5806\u53E0",details:"~~~jpfun\n@down(1, $p)\n~~~\n\u7B2C\u4E00\u4E2A\u5185\u5BB9\u53C2\u6570\u4E3A\u5BBF\u4E3B\uFF0C\u5176\u4F59\u4F9D\u6B21\u53E0\u5728\u4E0B\u65B9\u5E76\u5171\u4EAB\u5176\u65F6\u503C\uFF0C\u5E38\u7528\u4E8E\u529B\u5EA6\u7B49\u4E0B\u65B9\u6807\u8BB0\u3002\n\n**\u7B80\u5199**\uFF1A`1 _ $p`\u3002\u4E0E `^` \u6DF7\u5199\u65F6\u5171\u7528\u540C\u4E00\u5BBF\u4E3B\uFF1A`1^2_3` \u5C06 `2` \u653E\u5728 `1` \u4E0A\u65B9\u3001`3` \u653E\u5728\u4E0B\u65B9\u3002",allowExtraArgs:!0,extraArgType:"content",args:[]};static deSugarAtom(t,e,n){if(t[e]!=="_")return null;let o={kind:"sugar",data:r,span:{start:e,end:e+1}};return{next:e+1,node:o}}static deSugarRelation(t,e,n){return r.desugar(t,e,n)}},ci=uo,ai=xo,mo=class extends D{members;aboveCount;verticalOffsets=[];constructor(t,e){super(),this.ast=t,this.members=e,this.aboveCount=t.contents.length;let n=e[0];this.mergeKey=n&&n.mergeKey!==n.order?n.mergeKey:ht;let o=this.mergeKey===ht||this.mergeKey===K;!o&&n&&this.T.copyFrom(n.T),this.initLayoutBox();let s=n?.addon;s&&(this.addon={...s});for(let i of e)o&&this.T.isZero()&&this.T.copyFrom(i.T),i.mergeKey===K&&(this.mergeKey=K),i.addon=void 0,i.foldedInto=this}onTimeState(t){let e=this.T.clone(),n,o=!1;for(let i=this.members.length-1;i>=0;i--){let c=this.members[i];!c.T.isZero()&&!this.T.isZero()&&c.T.copyFrom(this.T),c.t.copyFrom(this.t),c.track=this.track,c.layoutLine=this.layoutLine,n=c.onTimeState?.(t),o||=!c.T.isZero()&&!c.T.equals(e)}let s=this.members[0];if(s&&!s.T.isZero()&&(this.T.copyFrom(s.T),o))for(let i of this.members)i.T.isZero()||i.T.copyFrom(this.T);return n}emitPlayback(t){for(let e=this.members.length-1;e>=0;e--)t.play(this.members[e])}prepareHorizontal(t){this.members[0]?.prepareHorizontal?.(t)}prepareLayout(t){this.addon&&this.members[0]&&(this.members[0].addon=this.addon,this.addon=void 0);let e=this.members[0];if(!e){this.box.w=this.box.h=0,this.box.anchor=this.box.visualAxis=0;return}this.box.w=Yt([e],t);for(let p=1;p<this.members.length;p++)Yt([this.members[p]],t);this.springConfig={...e.springConfig,...this.springConfig};let n=e.box.x+e.box.anchor,o=this.ast.size*.12;this.verticalOffsets.length=this.members.length,this.verticalOffsets[0]=0;let s=Q(e),i=s.y;for(let p=1;p<this.aboveCount;p++){let f=Q(this.members[p]);this.verticalOffsets[p]=i-o-f.y-f.h,i-=o+f.h}let c=s.y+s.h;for(let p=this.aboveCount;p<this.members.length;p++){let f=Q(this.members[p]);this.verticalOffsets[p]=c+o-f.y,c+=o+f.h}for(let p=0;p<this.verticalOffsets.length;p++)this.verticalOffsets[p]-=i;this.box.h=c-i,this.box.anchor=n,this.box.visualAxis=e.box.visualAxis-i;let a=this.verticalOffsets[0];for(let p in e.ports){let f=e.ports[p];this.ports[p]={...f,x:e.box.x+f.x,y:a+f.y}}this.ports["body.left"]??={x:e.box.x,y:this.box.visualAxis},this.ports["body.right"]??={x:e.box.x+e.box.w,y:this.box.visualAxis};let l=this.aboveCount-1,h=this.verticalOffsets[l];this.ports["tie.top"]={x:n,y:h+(this.members[l].ports["tie.top"]?.y??Q(this.members[l],!0).y)}}onPlaced(){for(let t=0;t<this.members.length;t++){let e=this.members[t];e.box.x=this.box.x+this.box.anchor-e.box.anchor,e.box.y=this.box.y+this.verticalOffsets[t],e.onPlaced?.()}}paint(t){for(let e of this.members){e.paint(t);for(let n of e.decorations)n.paint?.(t)}}};var Jt=r=>({value:r,unit:"px"}),yo=16,lc={fontSize:yo,textAlign:"center",fill:"#606060"};function hc(r,t,e){let n=r.lastIndexOf("1"),o=r.indexOf("1")!==n;return r.replace(/1/g,(s,i)=>String(o&&i===n?e:t))}var go=class{sourceSpan;pattern;marginBottom;style;layer="foreground";constructor(t,e,n,o){this.sourceSpan=t,this.pattern=e,this.marginBottom=n,this.style=o}createGeometry(t){let e=this.style,n=t.pages.map((o,s)=>{let i=hc(this.pattern,s+1,t.pages.length),{w:c,h:a,baseline:l}=t.textMeasurer.measureText(i,e),h=o.y+o.h-this.marginBottom/2;return{text:i,x:o.x+o.w/2,y:h-a/2+l,w:c,h:a,baseline:l}});return{regions:n.map(({x:o,y:s,w:i,h:c,baseline:a})=>({x:o-i/2,y:s-a,w:i,h:c})),paint(o){for(let s of n)o.drawText(s.text,s.x,s.y,e)}}}},bo=class extends _{static def={name:["page"],description:"\u8BBE\u7F6E\u6587\u6863\u9875\u9762",details:`~~~jpfun
|
|
54
58
|
@page(
|
|
55
59
|
width=794px, height=1123px, top=48px, bottom=48px,
|
|
56
60
|
left=40px, right=40px, gap=1em, numbering="1/1", fillRatio=0.5
|
|
57
61
|
)
|
|
58
62
|
~~~
|
|
59
|
-
\u5C3A\u5BF8\u63A5\u53D7 \`px\` \u6216 \`em\`\u3002\u9875\u8FB9\u8DDD\u548C\u884C\u8DDD\u987B\u975E\u8D1F\uFF1B\u5DE6\u53F3\u8FB9\u8DDD\u4E4B\u548C\u987B\u5C0F\u4E8E\u9875\u5BBD\uFF0C\u56FA\u5B9A\u9875\u9AD8\u65F6\u4E0A\u4E0B\u8FB9\u8DDD\u4E4B\u548C\u987B\u5C0F\u4E8E\u9875\u9AD8\u3002`,allowExtraArgs:!1,args:[{name:"width",description:"\u9875\u9762\u5BBD\u5EA6\uFF0C\u987B\u5927\u4E8E\u5DE6\u53F3\u9875\u8FB9\u8DDD\u4E4B\u548C",type:"length",default:
|
|
63
|
+
\u5C3A\u5BF8\u63A5\u53D7 \`px\` \u6216 \`em\`\u3002\u9875\u8FB9\u8DDD\u548C\u884C\u8DDD\u987B\u975E\u8D1F\uFF1B\u5DE6\u53F3\u8FB9\u8DDD\u4E4B\u548C\u987B\u5C0F\u4E8E\u9875\u5BBD\uFF0C\u56FA\u5B9A\u9875\u9AD8\u65F6\u4E0A\u4E0B\u8FB9\u8DDD\u4E4B\u548C\u987B\u5C0F\u4E8E\u9875\u9AD8\u3002`,allowExtraArgs:!1,args:[{name:"width",description:"\u9875\u9762\u5BBD\u5EA6\uFF0C\u987B\u5927\u4E8E\u5DE6\u53F3\u9875\u8FB9\u8DDD\u4E4B\u548C",type:"length",default:Jt(st.width)},{name:"height",description:"\u9875\u9762\u9AD8\u5EA6\uFF0C0 \u8868\u793A\u4E0D\u5206\u9875\u3001\u9AD8\u5EA6\u968F\u5185\u5BB9\u589E\u957F\uFF1B\u5BBD\u5EA6\u4E3A `794px` \u65F6\uFF0CA4 \u5BF9\u5E94\u9AD8\u5EA6\u7EA6\u4E3A `1123px`",type:"length",default:Jt(0)},{name:"top",description:"\u9875\u9762\u4E0A\u8FB9\u8DDD",type:"length",default:Jt(st.marginTop)},{name:"bottom",description:"\u9875\u9762\u4E0B\u8FB9\u8DDD\uFF0C\u542F\u7528\u9875\u7801\u65F6\u81F3\u5C11\u4E3A `16px`",type:"length",default:Jt(st.marginBottom)},{name:"left",description:"\u9875\u9762\u5DE6\u8FB9\u8DDD",type:"length",default:Jt(st.marginLeft)},{name:"right",description:"\u9875\u9762\u53F3\u8FB9\u8DDD",type:"length",default:Jt(st.marginRight)},{name:"gap",description:"\u8C31\u9762\u884C\u4E4B\u95F4\u7684\u6700\u5C0F\u95F4\u8DDD",type:"length",default:{value:1,unit:"em"}},{name:"numbering",description:"\u9875\u7801\u683C\u5F0F\uFF0C\u7A7A\u503C\u9690\u85CF\uFF1B`1` \u663E\u793A\u5F53\u524D\u9875\uFF0C`1/1` \u663E\u793A\u5F53\u524D\u9875/\u603B\u9875\u6570",type:"string",default:""},{name:"font",description:"\u9875\u7801\u5B57\u4F53\uFF0C\u7A7A\u503C\u6CBF\u7528\u5F53\u524D\u5B57\u4F53\u8BBE\u7F6E",type:"string",default:""},{name:"fillRatio",description:"\u81EA\u7136\u5BBD\u5EA6\u8FBE\u5230\u8BE5\u6BD4\u4F8B\u540E\u6491\u6EE1",type:"number",default:st.fillRatio}]};config;numbering="";font;constructor(t,e,n,o=null){if(super(t,o),this.font=n.variables.font,n.scopeDepth!==0){n.diagnostics.push(new P("W_PAGE_NOT_TOP_LEVEL","@page \u53EA\u80FD\u5728\u6587\u6863\u9876\u5C42\u58F0\u660E\uFF1B\u5F53\u524D\u58F0\u660E\u5DF2\u5FFD\u7565",t)),this.config=null;return}if(n.documentDeclarations.page){n.diagnostics.push(new P("W_DUPLICATE_PAGE","\u6587\u6863\u53EA\u80FD\u58F0\u660E\u4E00\u4E2A @page\uFF1B\u540E\u7EED\u58F0\u660E\u5DF2\u5FFD\u7565",t)),this.config=null;return}n.documentDeclarations.page=!0;let s=this.getArgValue(e,n),i=s.pop();this.font=s.pop()||n.variables.font;let c=s.pop(),[a,l,h,p,f,d,u]=s.map(g=>n.length2px(g));if(!Number.isFinite(a)||a<=0)throw k.error.InvalidPageConfig("@page \u7684 width \u5FC5\u987B\u662F\u6B63\u6709\u9650\u957F\u5EA6",t);if(!Number.isFinite(l)||l<0)throw k.error.InvalidPageConfig("@page \u7684 height \u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u957F\u5EA6\uFF1B0 \u8868\u793A\u4E0D\u5206\u9875",t);if([h,p,f,d,u].some(g=>!Number.isFinite(g)||g<0))throw k.error.InvalidPageConfig("@page \u7684\u8FB9\u8DDD\u548C gap \u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u957F\u5EA6",t);if(f+d>=a)throw k.error.InvalidPageConfig("@page \u7684\u5DE6\u53F3\u8FB9\u8DDD\u6CA1\u6709\u7559\u4E0B\u53EF\u7528\u5185\u5BB9\u5BBD\u5EA6",t);if(l>0&&h+p>=l)throw k.error.InvalidPageConfig("@page \u7684\u4E0A\u4E0B\u8FB9\u8DDD\u6CA1\u6709\u7559\u4E0B\u53EF\u7528\u5185\u5BB9\u9AD8\u5EA6",t);if(c&&p<yo)throw k.error.InvalidPageConfig(`@page \u7684 bottom \u81F3\u5C11\u9700\u8981 ${yo}px \u624D\u80FD\u653E\u4E0B\u9875\u7801`,t);this.config=ae({width:a,height:l,marginTop:h,marginBottom:p,marginLeft:f,marginRight:d,lineGap:u,fillRatio:i}),this.numbering=c}loweringEnter(t){return!t||!this.config?[]:(t.setPageConfig(this.config),this.numbering&&t.addAttachment(new go(this.sourceSpan,this.numbering,this.config.marginBottom,{...lc,fontFamily:this.font})),[])}toString(){if(!this.config)return"@page()";let{width:t,height:e,marginTop:n,marginBottom:o,marginLeft:s,marginRight:i,lineGap:c,fillRatio:a}=this.config;return`@page(width=${t}px, height=${Number.isFinite(e)?e:0}px, top=${n}px, bottom=${o}px, left=${s}px, right=${i}px, gap=${c}px, numbering=${ct(this.numbering)}, font=${ct(this.font)}, fillRatio=${a})`}},li=bo;var wo=class extends _{static def={name:["program","instrument"],description:"\u8BBE\u7F6E\u5F53\u524D\u97F3\u8F68\u7684 MIDI \u97F3\u8272",details:`~~~jpfun
|
|
60
64
|
@program(40) 1 2 3
|
|
61
65
|
~~~
|
|
62
|
-
\u5207\u6362\u4E3A\u5C0F\u63D0\u7434\u97F3\u8272\u3002\u8BBE\u7F6E\u5C06\u4F5C\u7528\u4E8E\u5F53\u524D\u97F3\u8F68\u7684\u540E\u7EED\u97F3\u7B26\u3002`,allowExtraArgs:!1,args:[{name:"program",description:"\u4ECE 0 \u5F00\u59CB\u7F16\u53F7\u7684 MIDI \u97F3\u8272\uFF0C\u987B\u4E3A `0..127` \u7684\u6574\u6570",type:"number",default:null}]};program;constructor(t,e,n,o=null){super(t,o);let[s]=this.getArgValue(e,n);if(!Number.isSafeInteger(s)||s<0||s>127)throw new
|
|
66
|
+
\u5207\u6362\u4E3A\u5C0F\u63D0\u7434\u97F3\u8272\u3002\u8BBE\u7F6E\u5C06\u4F5C\u7528\u4E8E\u5F53\u524D\u97F3\u8F68\u7684\u540E\u7EED\u97F3\u7B26\u3002`,allowExtraArgs:!1,args:[{name:"program",description:"\u4ECE 0 \u5F00\u59CB\u7F16\u53F7\u7684 MIDI \u97F3\u8272\uFF0C\u987B\u4E3A `0..127` \u7684\u6574\u6570",type:"number",default:null}]};program;constructor(t,e,n,o=null){super(t,o);let[s]=this.getArgValue(e,n);if(!Number.isSafeInteger(s)||s<0||s>127)throw new C("E_PROGRAM_INVALID","@program \u5FC5\u987B\u662F 0..127 \u7684\u6574\u6570",t);this.program=s}loweringEnter(){let t=new D;return t.ast=this,t.playbackState={program:this.program},t.onTimeState=e=>{e.program=this.program},[t]}toString(){return`@program(${this.program})`}},hi=wo;var pi=.4,pc=(r,t,e)=>r.top-e*pi-t.bottom,fc=(r,t)=>{let e=t*pi,n=[],o=0;for(let s of r){if(!s){n.push(null);continue}let i=o-s.bottom;n.push({offset:i,extent:s}),o=i+s.top-e}return n},uc={laneKey:"stack",measure:fc,place:pc},So=class r extends _{static def={name:["stack"],description:"\u4E34\u65F6\u591A\u58F0\u90E8",details:"~~~jpfun\n@stack({1 2}, {3/ 4/ 5})\n~~~\n\u63A5\u53D7\u81F3\u5C11\u4E24\u4E2A\u5185\u5BB9\u53C2\u6570\uFF0C\u5404\u5206\u652F\u540C\u65F6\u5F00\u59CB\u3001\u4FDD\u7559\u5404\u81EA\u65F6\u503C\uFF0C\u6574\u4F53\u65F6\u957F\u53D6\u6700\u957F\u5206\u652F\u3002\u9002\u5408\u8282\u594F\u4E0D\u540C\u7684\u4E34\u65F6\u591A\u58F0\u90E8\u3002\n\n**\u7B80\u5199**\uFF1A`{1 2} & {3/ 4/ 5}`\u3002\u53EF\u7EE7\u7EED\u7528 `&` \u8FDE\u63A5\u66F4\u591A\u5206\u652F\uFF1B\u82E5\u8981\u5199\u548C\u5F26\uFF0C\u8BF7\u4F7F\u7528 `up` / `down`\u3002",allowExtraArgs:!0,extraArgType:"content",args:[]};static deSugarAtom(t,e,n){if(t[e]==="&"){let o={kind:"sugar",data:r,span:{start:e,end:e+1}};return{next:e+1,node:o}}return null}static deSugarRelation(t,e,n){let o=e[n++];if(!(o.kind==="sugar"&&o.data===r))return null;let s=t.nodes.length-1;for(;s>=0&&t.nodes[s]instanceof U;s--);let i=s>=0?t.nodes[s]:null;if(i===null)throw new C("E_STACK_NO_TARGET","@stack\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u5DE6\u8FB9\u6CA1\u6709\u627E\u5230\u53EF\u53E0\u52A0\u7684\u76EE\u6807",o.span);let c=s;if(i instanceof ft){let h=i,p=h.target;for(;p&&!t.nodes.includes(p);)p=p.parent;for(let f=s-1;f>=0;f--)if(t.nodes[f]===p){i=new Y({start:p.sourceSpan.start,end:h.sourceSpan.end},t.nodes.slice(f,s+1),null),c=f;break}}let a=i instanceof r?i:new r(o.span,new Map,t).addContent(i),l=t.nodes;t.nodes=[],t.makeNodes(e,n);for(let h=0;h<t.nodes.length;h++){let p=t.nodes[h];if(!(p instanceof U)){for(a.addContent(p),l.length=c,l.push(a);++h<t.nodes.length;)l.push(t.nodes[h]);return t.nodes=l,e.length}}throw new C("E_STACK_NO_TARGET","@stack\u8BED\u6CD5\u7CD6\u9519\u8BEF: \u53F3\u8FB9\u6CA1\u6709\u627E\u5230\u53EF\u53E0\u52A0\u7684\u76EE\u6807",o.span)}contents=[];get children(){return this.contents}timeFlowModel(){return{children:this.contents,mode:"parallel",tracks:uc}}constructor(t,e,n,o=null){super(t,o);for(let[,s]of e){if(s instanceof q){this.addContent(s);continue}let i=n.parseArgWithType(s.valueSpan,"content",t.start);i!==null&&this.addContent(i)}}addContent(t){if(t instanceof r)return this.combine(t);this.contents.push(t),t.parent=this;let e=t.sourceSpan;return this.sourceSpan.start=Math.min(this.sourceSpan.start,e.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,e.end),this}toString(t){return`@stack(
|
|
63
67
|
${this.contents.map(n=>n.toString(t)).join(`,
|
|
64
68
|
`).split(`
|
|
65
69
|
`).join(`
|
|
66
70
|
`)}
|
|
67
|
-
)`}combine(t){this.sourceSpan.start=Math.min(this.sourceSpan.start,t.sourceSpan.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,t.sourceSpan.end);for(let e of t.contents)e.parent=this;return this.contents.push(...t.contents),t.contents.length=0,this}},Ks=ro;function Us(i){let t=1/0,e=1/0,n=-1/0,o=-1/0,s=(r,c,a,l)=>{t=Math.min(t,r),e=Math.min(e,c),n=Math.max(n,r+a),o=Math.max(o,c+l)};for(let r of i){let c=r.dx??0;if(r.circle){let{cx:a,cy:l,r:h}=r.circle;s(a+c-h,l-h,2*h,2*h)}if(r.path?.length){let a=Vt(r.path);s(a.x+c,a.y,a.w,a.h)}}return Number.isFinite(t)?{x:t,y:e,w:Math.max(1e-9,n-t),h:Math.max(1e-9,o-e)}:{x:0,y:0,w:1e-9,h:1e-9}}function js(i,t,e,n,o){let s=n.x-e.x*o,r=n.y-e.y*o;for(let c of t){let a=c.style,l=a.strokeWidth===void 0?a:{...a,strokeWidth:a.strokeWidth*o},h=s+(c.dx??0)*o;c.path&&i.drawPath(c.path,l,{x:h,y:r,scaleX:o,scaleY:o}),c.circle&&i.drawCircle(h+c.circle.cx*o,r+c.circle.cy*o,c.circle.r*o,l)}}var Xs={name:"accent",description:"\u91CD\u97F3",weight:.5,shapes:[{path:[{op:"M",x:.21413,y:.4818},{op:"L",x:8.21413,y:3.72071},{op:"L",x:.29494,y:6.92724}],style:{stroke:"#000",strokeWidth:1}}],emitPlayback:i=>i.affectFollowing((t,e)=>{for(let n of e)n.velocity=Math.min(127,n.velocity+20)})};var ue="repeat.jump",Zs={name:"dc",description:"\u4ECE\u5934\u53CD\u590D\uFF1A\u8DF3\u56DE\u66F2\u9996\u518D\u6F14\u4E00\u904D",weight:.9,shapes:[{path:[{op:"M",x:1.06974,y:7.0752},{op:"L",x:2.69184,y:1.21499},{op:"C",cx1:2.69184,cy1:1.1221,cx2:2.73825,cy2:.93022,x:2.73825,y:.86039},{op:"C",cx1:2.73825,cy1:.48248,cx2:2.4825,cy2:.33152,x:1.7614,y:.23838},{op:"L",x:1.7614,y:.04641},{op:"L",x:4.88344,y:.04641},{op:"C",cx1:7.64477,cy1:.04641,cx2:9.02278,cy2:1.18018,x:9.02278,y:3.45323},{op:"C",cx1:9.02278,cy1:4.47649,cx2:8.74941,cy2:5.36592,x:8.20888,y:6.11596},{op:"C",cx1:7.6681,cy1:6.86578,cx2:6.95303,cy2:7.4297,x:6.05765,y:7.81334},{op:"C",cx1:5.16823,cy1:8.19125,cx2:4.22074,cy2:8.38316,x:3.21493,y:8.38316},{op:"L",x:0,y:8.38316},{op:"L",x:0,y:8.19119},{op:"C",cx1:.64542,cy1:8.19126,cx2:.91275,cy2:7.81343,x:1.06974,y:7.07521},{op:"L",x:1.06974,y:7.0752},{op:"Z"},{op:"M",x:4.09864,y:.66867},{op:"L",x:2.2848,y:7.35998},{op:"C",cx1:2.2848,cy1:7.42409,cx2:2.26718,cy2:7.48786,x:2.23815,y:7.55197},{op:"C",cx1:2.29051,cy1:7.84841,cx2:2.58133,cy2:7.99961,x:3.12179,y:7.99961},{op:"C",cx1:3.97639,cy1:7.99961,cx2:4.74389,cy2:7.79034,x:5.42397,y:7.37165},{op:"C",cx1:6.10429,cy1:6.94733,cx2:6.62746,cy2:6.37751,x:7.00538,y:5.65666},{op:"C",cx1:7.3833,cy1:4.92994,cx2:7.5752,cy2:4.1334,x:7.5752,y:3.26134},{op:"C",cx1:7.5752,cy1:1.372,cx2:6.69156,cy2:.43029,x:4.92984,y:.43029},{op:"C",cx1:4.53471,cy1:.43029,cx2:4.25555,cy2:.51151,x:4.09864,y:.66869},{op:"L",x:4.09864,y:.66867},{op:"Z"},{op:"M",x:18.35961,y:.04641},{op:"L",x:17.90593,y:2.62204},{op:"L",x:17.66755,y:2.62204},{op:"C",cx1:17.563,cy1:1.19183,cx2:16.91187,cy2:.47678,x:15.71418,y:.47678},{op:"C",cx1:14.96437,cy1:.47678,cx2:14.29564,cy2:.73848,x:13.70274,y:1.26165},{op:"C",cx1:13.11556,cy1:1.77911,cx2:12.65617,cy2:2.43578,x:12.33664,y:3.22668},{op:"C",cx1:12.01679,cy1:4.01155,cx2:11.85988,cy2:4.77302,x:11.85988,y:5.49984},{op:"C",cx1:11.85988,cy1:6.26131,cx2:12.03424,cy2:6.90076,x:12.37734,y:7.41814},{op:"C",cx1:12.72598,cy1:7.9356,cx2:13.24931,cy2:8.19126,x:13.95279,y:8.19126},{op:"C",cx1:15.08622,cy1:8.19126,cx2:16.11543,cy2:7.68548,x:17.02818,y:6.66825},{op:"L",x:17.21412,y:6.86023},{op:"C",cx1:16.26663,cy1:8.16232,cx2:15.08051,cy2:8.81352,x:13.66775,y:8.81352},{op:"C",cx1:13.034,cy1:8.81352,cx2:12.47014,cy2:8.65637,x:11.97608,y:8.34254},{op:"C",cx1:11.48195,cy1:8.02864,cx2:11.10411,cy2:7.60432,x:10.83074,y:7.06925},{op:"C",cx1:10.56333,cy1:6.53442,cx2:10.42974,cy2:5.94748,x:10.42974,y:5.31357},{op:"C",cx1:10.42974,cy1:4.43581,cx2:10.67383,cy2:3.58692,x:11.15655,y:2.7616},{op:"C",cx1:11.63894,cy1:1.93602,cx2:12.28427,cy2:1.26738,x:13.09223,y:.76158},{op:"C",cx1:13.90042,cy1:.25578,cx2:14.74336,cy2:3e-5,x:15.62137,y:3e-5},{op:"C",cx1:15.88283,cy1:3e-5,cx2:16.12121,cy2:.0174,x:16.33651,y:.0581},{op:"C",cx1:16.55157,cy1:.09886,cx2:16.79557,cy2:.15122,x:17.05729,y:.21501},{op:"C",cx1:17.31875,cy1:.2791,cx2:17.51072,cy2:.31979,x:17.62123,y:.33717},{op:"C",cx1:17.85961,cy1:.2557,cx2:18.03389,cy2:.15694,x:18.14432,y:.04643},{op:"L",x:18.35962,y:.04643},{op:"L",x:18.35961,y:.04644},{op:"Z"},{op:"M",x:8.19134,y:7.69151},{op:"C",cx1:8.19134,cy1:7.5169,cx2:8.25544,cy2:7.36596,x:8.38894,y:7.2322},{op:"C",cx1:8.52277,cy1:7.09838,cx2:8.69134,cy2:7.0288,x:8.88332,y:7.0288},{op:"C",cx1:9.0519,cy1:7.0288,cx2:9.19722,cy2:7.09838,x:9.3251,y:7.2322},{op:"C",cx1:9.45893,cy1:7.36603,cx2:9.5227,cy2:7.52294,x:9.5227,y:7.69151},{op:"C",cx1:9.5227,cy1:8.0925,cx2:9.23221,cy2:8.38324,x:8.88332,y:8.38324},{op:"C",cx1:8.48803,cy1:8.38324,cx2:8.19134,cy2:8.10416,x:8.19134,y:7.69151},{op:"Z"},{op:"M",x:18.00469,y:7.79028},{op:"C",cx1:18.00469,cy1:7.40068,cx2:18.27814,cy2:7.12162,x:18.64432,y:7.12162},{op:"C",cx1:19.03969,cy1:7.12162,cx2:19.31298,cy2:7.39507,x:19.31298,y:7.79028},{op:"C",cx1:19.31298,cy1:8.15653,cx2:19.0339,cy2:8.42965,x:18.64432,y:8.42965},{op:"C",cx1:18.28972,cy1:8.42965,cx2:18.00469,cy2:8.14486,x:18.00469,y:7.79028},{op:"Z"}],style:{fill:"#000"}}],playbackMarks:()=>[ue],onVisit:(i,t)=>i.visits(t)>1?void 0:{kind:"jump",column:0}};var co="repeat.segno",qs={name:"segno",description:"\u53CD\u590D\u8BB0\u53F7\uFF1AD.S. \u7684\u56DE\u8DF3\u76EE\u6807",weight:1.15,playbackMarks:()=>[co],shapes:[{path:[{op:"M",x:3.75502,y:7.52938},{op:"C",cx1:1.3411,cy1:6.32492,cx2:.10249,cy2:4.89115,x:.03897,y:3.23307},{op:"C",cx1:.06833,cy1:2.69176,cx2:.20975,cy2:2.17002,x:.45843,y:1.67267},{op:"C",cx1:.71191,cy1:1.1751,cx2:1.05826,cy2:.77042,x:1.49231,y:.46321},{op:"C",cx1:1.93115,cy1:.156,cx2:2.41873,cy2:0,x:2.95524,y:0},{op:"C",cx1:3.6136,cy1:0,cx2:4.17428,cy2:.17538,x:4.64747,y:.52174},{op:"C",cx1:5.12047,cy1:.8679,cx2:5.35457,cy2:1.36047,x:5.35457,y:1.99925},{op:"C",cx1:5.33499,cy1:2.26751,cx2:5.21315,cy2:2.49182,x:4.98384,y:2.66739},{op:"C",cx1:4.75473,cy1:2.83817,cx2:4.50106,cy2:2.93565,x:4.21343,y:2.95502},{op:"C",cx1:3.67691,cy1:2.90629,cx2:3.35013,cy2:2.68696,x:3.23807,y:2.29686},{op:"L",x:3.06249,y:1.73119},{op:"C",cx1:2.93086,cy1:1.31652,cx2:2.71134,cy2:1.0191,x:2.29687,y:1.0191},{op:"C",cx1:1.99446,cy1:1.0191,cx2:1.74578,cy2:1.16551,x:1.55561,y:1.46293},{op:"C",cx1:1.36544,cy1:1.76035,cx2:1.26798,cy2:2.06276,x:1.25819,y:2.37476},{op:"C",cx1:1.28735,cy1:2.79902,cx2:1.42398,cy2:3.17954,x:1.66287,y:3.50612},{op:"C",cx1:1.90677,cy1:3.8329,cx2:2.20418,cy2:4.11094,x:2.56012,y:4.34984},{op:"C",cx1:2.91627,cy1:4.58394,cx2:3.31116,cy2:4.79846,x:3.73542,y:4.99841},{op:"C",cx1:4.15967,cy1:5.19835,cx2:4.57914,cy2:5.38851,x:4.99361,y:5.57387},{op:"L",x:8.62659,y:.12183},{op:"L",x:9.70919,y:.12183},{op:"L",x:5.85194,y:5.97376},{op:"C",cx1:6.5005,cy1:6.29076,cx2:7.09535,cy2:6.65649,x:7.62705,y:7.06117},{op:"C",cx1:8.15855,cy1:7.47085,cx2:8.60221,cy2:7.95363,x:8.95835,y:8.50473},{op:"C",cx1:9.3143,cy1:9.05562,cx2:9.48985,cy2:9.65546,x:9.48985,y:10.30403},{op:"C",cx1:9.48985,cy1:10.86491,cx2:9.35822,cy2:11.39164,x:9.08996,y:11.88421},{op:"C",cx1:8.82652,cy1:12.37658,cx2:8.44618,cy2:12.77167,x:7.9488,y:13.0643},{op:"C",cx1:7.45147,cy1:13.35691,cx2:6.871,cy2:13.50314,x:6.21285,y:13.50314},{op:"C",cx1:5.62259,cy1:13.44461,cx2:5.1448,cy2:13.23009,x:4.78386,y:12.85457},{op:"C",cx1:4.42791,cy1:12.47906,cx2:4.23776,cy2:12.06938,x:4.21338,y:11.62572},{op:"C",cx1:4.23275,cy1:11.35746,cx2:4.33043,cy2:11.12338,x:4.5108,y:10.92821},{op:"C",cx1:4.69118,cy1:10.73326,cx2:4.94485,cy2:10.626,x:5.27163,y:10.60644},{op:"C",cx1:5.63239,cy1:10.60644,cx2:5.88605,cy2:10.68931,x:6.03726,y:10.85033},{op:"C",cx1:6.18828,cy1:11.01611,cx2:6.31031,cy2:11.26001,x:6.3932,y:11.58656},{op:"C",cx1:6.48092,cy1:11.91335,cx2:6.56377,cy2:12.14745,x:6.64186,y:12.2791},{op:"C",cx1:6.72476,cy1:12.41573,cx2:6.88578,cy2:12.48404,x:7.12944,y:12.48404},{op:"C",cx1:7.50019,cy1:12.48404,cx2:7.78783,cy2:12.35718,x:7.99756,y:12.10353},{op:"C",cx1:8.20729,cy1:11.85485,cx2:8.30974,cy2:11.52805,x:8.30974,y:11.12338},{op:"C",cx1:8.30974,cy1:10.57728,cx2:8.11459,cy2:10.11887,x:7.72451,y:9.74812},{op:"C",cx1:7.33918,cy1:9.38239,cx2:6.75395,cy2:9.00689,x:5.97375,y:8.62657},{op:"C",cx1:5.19353,cy1:8.25105,cx2:4.73513,cy2:8.01693,x:4.59371,y:7.92926},{op:"L",x:1.05823,y:13.42024},{op:"L",x:0,y:13.42024},{op:"L",x:3.755,y:7.52937},{op:"L",x:3.75502,y:7.52938},{op:"Z"},{op:"M",x:.07812,y:8.54848},{op:"C",cx1:.07812,cy1:8.20711,cx2:.18039,cy2:7.95364,x:.38033,y:7.78285},{op:"C",cx1:.58028,cy1:7.61227,cx2:.81937,cy2:7.5294,x:1.09721,y:7.5294},{op:"C",cx1:1.36068,cy1:7.55377,cx2:1.58499,cy2:7.65124,x:1.76535,y:7.822},{op:"C",cx1:1.94572,cy1:7.99259,cx2:2.03841,cy2:8.25105,x:2.03841,y:8.58763},{op:"C",cx1:2.03841,cy1:8.79736,cx2:1.93594,cy2:8.99731,x:1.736,y:9.19226},{op:"C",cx1:1.53606,cy1:9.39222,cx2:1.32153,cy2:9.48971,x:1.09721,y:9.48971},{op:"C",cx1:.81936,cy1:9.48971,cx2:.57548,cy2:9.41181,x:.37553,y:9.25081},{op:"C",cx1:.17558,cy1:9.08978,cx2:.07811,cy2:8.85588,x:.07811,y:8.54849},{op:"L",x:.07812,y:8.54848},{op:"Z"},{op:"M",x:8.3098,y:5.11547},{op:"C",cx1:8.3098,cy1:4.7789,cx2:8.4023,cy2:4.51564,x:8.58285,y:4.33027},{op:"C",cx1:8.76803,cy1:4.14508,cx2:9.00212,cy2:4.05242,x:9.28995,y:4.05242},{op:"C",cx1:9.57758,cy1:4.05242,cx2:9.82145,cy2:4.14011,x:10.01644,y:4.31568},{op:"C",cx1:10.21158,cy1:4.48627,cx2:10.30902,cy2:4.73994,x:10.30902,y:5.07152},{op:"C",cx1:10.30902,cy1:5.30083,cx2:10.20677,cy2:5.51036,x:10.00184,y:5.69572},{op:"C",cx1:9.7971,cy1:5.88108,cx2:9.57279,cy2:5.97376,x:9.32892,y:5.97376},{op:"C",cx1:9.07043,cy1:5.97376,cx2:8.83156,cy2:5.88587,x:8.62182,y:5.71529},{op:"C",cx1:8.41209,cy1:5.53971,cx2:8.3098,cy2:5.33977,x:8.3098,y:5.11546},{op:"L",x:8.3098,y:5.11547},{op:"Z"}],style:{fill:"#000"}}]};var Qs={name:"ds",description:"\u4ECE\u8BB0\u53F7\u5904\u53CD\u590D\uFF1A\u8DF3\u56DE\u6700\u8FD1\u7684 $segno",weight:.9,shapes:[{path:[{op:"M",x:3.30971,y:8.58253},{op:"L",x:0,y:8.58253},{op:"L",x:0,y:8.38492},{op:"C",cx1:.66434,cy1:8.38492,cx2:.93964,cy2:7.9959,x:1.10119,y:7.23595},{op:"L",x:2.77112,y:1.20293},{op:"C",cx1:2.77112,cy1:1.10732,cx2:2.81892,cy2:.90973,x:2.81892,y:.83791},{op:"C",cx1:2.81892,cy1:.44886,cx2:2.55564,cy2:.29345,x:1.81333,y:.19758},{op:"L",x:1.81333,y:0},{op:"L",x:5.02743,y:0},{op:"C",cx1:7.87013,cy1:0,cx2:9.28879,cy2:1.16713,x:9.28879,y:3.50729},{op:"C",cx1:9.28879,cy1:4.56066,cx2:9.00736,cy2:5.47632,x:8.45088,y:6.24853},{op:"C",cx1:7.89416,cy1:7.02049,cx2:7.15799,cy2:7.60099,x:6.23624,y:7.9959},{op:"C",cx1:5.32063,cy1:8.38492,cx2:4.34519,cy2:8.58253,x:3.3097,y:8.58253},{op:"L",x:3.30971,y:8.58253},{op:"Z"},{op:"M",x:4.21944,y:.64057},{op:"L",x:2.35218,y:7.52917},{op:"C",cx1:2.35218,cy1:7.59509,cx2:2.33403,cy2:7.66079,x:2.30413,y:7.72673},{op:"C",cx1:2.35806,cy1:8.03196,cx2:2.65738,cy2:8.18763,x:3.21387,y:8.18763},{op:"C",cx1:4.71023,cy1:8.18763,cx2:5.84745,cy2:7.75053,x:6.6253,y:6.88271},{op:"C",cx1:7.40952,cy1:6.00899,cx2:7.79857,cy2:4.81807,x:7.79857,y:3.30973},{op:"C",cx1:7.79857,cy1:1.36475,cx2:6.88883,cy2:.39519,x:5.07525,y:.39519},{op:"C",cx1:4.66831,cy1:.39517,cx2:4.38101,cy2:.47876,x:4.21945,y:.64056},{op:"L",x:4.21944,y:.64056},{op:"Z"},{op:"M",x:17.3325,y:1e-5},{op:"L",x:16.81794,y:2.54976},{op:"L",x:16.57254,y:2.54976},{op:"C",cx1:16.57254,cy1:1.14312,cx2:16.03984,cy2:.44299,x:14.98033,y:.44299},{op:"C",cx1:14.57337,cy1:.44299,cx2:14.24416,cy2:.56262,x:13.98698,y:.80212},{op:"C",cx1:13.72958,cy1:1.04139,cx2:13.60383,cy2:1.35272,x:13.60383,y:1.74176},{op:"C",cx1:13.60383,cy1:2.10677,cx2:13.70556,cy2:2.424,x:13.91516,y:2.70518},{op:"C",cx1:14.12452,cy1:2.98048,cx2:14.45375,cy2:3.34575,x:14.91464,y:3.7946},{op:"C",cx1:15.37551,cy1:4.24346,cx2:15.72261,cy2:4.65626,x:15.9619,y:5.03332},{op:"C",cx1:16.20729,cy1:5.40444,cx2:16.32715,cy2:5.83541,x:16.32715,y:6.32621},{op:"C",cx1:16.35708,cy1:7.82844,cx2:15.01635,cy2:8.89386,x:13.70558,y:8.87572},{op:"C",cx1:13.47219,cy1:8.87572,cx2:13.12508,cy2:8.79188,x:12.65219,y:8.63033},{op:"C",cx1:12.17955,cy1:8.46874,cx2:11.86231,cy2:8.38489,x:11.69463,y:8.38489},{op:"C",cx1:11.45538,cy1:8.38489,cx2:11.25778,cy2:8.60652,x:11.20385,y:8.82787},{op:"L",x:10.95848,y:8.82787},{op:"L",x:11.40145,y:6.00895},{op:"L",x:11.69464,y:6.00895},{op:"C",cx1:11.69464,cy1:6.12272,cx2:11.67678,cy2:6.24847,x:11.64684,y:6.374},{op:"C",cx1:11.67065,cy1:6.93075,cx2:11.85619,cy2:7.40948,x:12.20332,y:7.82232},{op:"C",cx1:12.55657,cy1:8.22948,cx2:13.00544,cy2:8.43297,x:13.55603,y:8.43297},{op:"C",cx1:14.02891,cy1:8.43297,cx2:14.42384,cy2:8.26529,x:14.74108,y:7.92405},{op:"C",cx1:15.06418,cy1:7.58305,cx2:15.22573,cy2:7.18198,x:15.22573,y:6.72112},{op:"C",cx1:15.22573,cy1:6.34406,cx2:15.11223,cy2:6.00313,x:14.89062,y:5.69764},{op:"C",cx1:14.66925,cy1:5.39246,cx2:14.32802,cy2:5.00951,x:13.85538,y:4.54279},{op:"C",cx1:13.38247,cy1:4.07579,cx2:13.03535,cy2:3.67473,x:12.80197,y:3.33374},{op:"C",cx1:12.56858,cy1:2.99248,cx2:12.45484,cy2:2.59756,x:12.45484,y:2.16072},{op:"C",cx1:12.45484,cy1:1.53216,cx2:12.67621,cy2:1.01761,x:13.12509,y:.61042},{op:"C",cx1:13.57395,cy1:.20348,cx2:14.11864,cy2:2e-5,x:14.75896,y:2e-5},{op:"C",cx1:15.18993,cy1:2e-5,cx2:15.55495,cy2:.05983,x:15.86016,y:.17358},{op:"C",cx1:16.16536,cy1:.28733,cx2:16.38697,cy2:.34714,x:16.52452,y:.34714},{op:"C",cx1:16.6922,cy1:.34714,cx2:16.86576,cy2:.23339,x:17.03932,y:2e-5},{op:"L",x:17.33249,y:2e-5},{op:"L",x:17.3325,y:1e-5},{op:"Z"},{op:"M",x:8.43275,y:7.87042},{op:"C",cx1:8.43275,cy1:7.69072,cx2:8.4987,cy2:7.5353,x:8.63622,y:7.3975},{op:"C",cx1:8.774,cy1:7.25976,cx2:8.94755,cy2:7.18816,x:9.14514,y:7.18816},{op:"C",cx1:9.3187,cy1:7.18816,cx2:9.46824,cy2:7.25975,x:9.59988,y:7.3975},{op:"C",cx1:9.73766,cy1:7.53529,cx2:9.80338,cy2:7.69685,x:9.80338,y:7.87042},{op:"C",cx1:9.80338,cy1:8.28325,cx2:9.5043,cy2:8.58254,x:9.14514,y:8.58254},{op:"C",cx1:8.7382,cy1:8.58254,cx2:8.43275,cy2:8.29521,x:8.43275,y:7.87042},{op:"Z"},{op:"M",x:16.88952,y:7.9721},{op:"C",cx1:16.88952,cy1:7.57106,cx2:17.21875,cy2:7.28373,x:17.62569,y:7.28373},{op:"C",cx1:18.00297,cy1:7.28373,cx2:18.29003,cy2:7.56516,x:18.29003,y:7.9721},{op:"C",cx1:18.29003,cy1:8.34914,cx2:17.99096,cy2:8.63036,x:17.62569,y:8.63036},{op:"C",cx1:17.42219,cy1:8.63036,cx2:17.24863,cy2:8.56461,x:17.105,y:8.43887},{op:"C",cx1:16.96135,cy1:8.31309,cx2:16.88952,cy2:8.1577,x:16.88952,y:7.9721},{op:"Z"}],style:{fill:"#000"}}],playbackMarks:()=>[ue],onVisit:(i,t)=>i.visits(t)>1?void 0:{kind:"jump",column:i.seek(co,t,-1)??0}};var Kr={m:[{op:"M",x:1.13,y:10.3672},{op:"L",x:2.9911,y:5.3125},{op:"C",cx1:3.0585,cy1:5.0607,cx2:3.0955,cy2:4.8889,x:3.0955,y:4.8089},{op:"C",cx1:3.0955,cy1:4.6248,cx2:2.9972,cy2:4.5327,x:2.7944,y:4.5327},{op:"C",cx1:2.5489,cy1:4.5327,cx2:2.217,cy2:4.7782,x:1.7994,y:5.2758},{op:"C",cx1:1.3881,cy1:5.7671,cx2:.9766,cy2:6.4856,x:.5774,y:7.4254},{op:"L",x:0,y:7.4254},{op:"C",cx1:.4976,cy1:6.3628,cx2:1.0133,cy2:5.4783,x:1.5476,y:4.7782},{op:"C",cx1:2.0882,cy1:4.0781,cx2:2.7576,cy2:3.7279,x:3.5498,y:3.7279},{op:"C",cx1:4.1518,cy1:3.7279,cx2:4.4773,cy2:4.0534,x:4.5264,y:4.7045},{op:"C",cx1:5.2818,cy1:4.0167,cx2:5.9512,cy2:3.6728,x:6.5409,y:3.6728},{op:"C",cx1:7.1796,cy1:3.6728,cx2:7.5235,cy2:4.0167,x:7.5728,y:4.7045},{op:"C",cx1:7.8797,cy1:4.3976,cx2:8.2483,cy2:4.1518,x:8.6843,y:3.9614},{op:"C",cx1:9.1205,cy1:3.7709,cx2:9.5197,cy2:3.6728,x:9.8882,y:3.6728},{op:"C",cx1:10.5393,cy1:3.6728,cx2:10.8645,cy2:3.943,x:10.8645,y:4.4834},{op:"C",cx1:10.8645,cy1:4.6001,cx2:10.8339,cy2:4.7905,x:10.7664,y:5.0607},{op:"L",x:9.3846,y:9.0345},{op:"C",cx1:9.3109,cy1:9.3353,cx2:9.2616,cy2:9.4951,x:9.2309,y:9.6364},{op:"C",cx1:9.2309,cy1:9.7959,cx2:9.3169,cy2:9.9066,x:9.4827,y:9.9619},{op:"C",cx1:10.011,cy1:9.8943,cx2:10.6988,cy2:9.1512,x:11.5463,y:7.7263},{op:"L",x:12.0499,y:7.7263},{op:"C",cx1:11.7981,cy1:8.1502,cx2:11.5279,cy2:8.6045,x:11.227,y:9.0958},{op:"C",cx1:10.9322,cy1:9.5811,cx2:10.6006,cy2:9.9864,x:10.2381,y:10.2996},{op:"C",cx1:9.8759,cy1:10.613,cx2:9.4583,cy2:10.7725,x:8.9791,y:10.7725},{op:"C",cx1:8.1499,cy1:10.7725,cx2:7.6279,cy2:10.3919,x:7.4191,y:9.6365},{op:"C",cx1:7.4437,cy1:9.397,cx2:7.5235,cy2:9.0775,x:7.6649,y:8.6783},{op:"C",cx1:7.806,cy1:8.279,cx2:7.8797,cy2:8.0395,x:7.8981,y:7.9535},{op:"L",x:8.9054,y:5.3619},{op:"C",cx1:8.924,cy1:5.2572,cx2:8.9791,cy2:5.0117,x:8.9791,y:4.9073},{op:"C",cx1:8.9791,cy1:4.6922,cx2:8.887,cy2:4.5818,x:8.7028,y:4.5818},{op:"C",cx1:8.1992,cy1:4.5818,cx2:7.8246,cy2:4.9257,x:7.5728,y:5.6137},{op:"L",x:5.8838,y:10.3673},{op:"L",x:4.0781,y:10.3673},{op:"L",x:5.9389,y:5.2635},{op:"C",cx1:5.9696,cy1:5.1591,cx2:5.9882,cy2:5.0424,x:5.9882,y:4.9073},{op:"C",cx1:5.9882,cy1:4.6922,cx2:5.8592,cy2:4.5818,x:5.6073,y:4.5818},{op:"C",cx1:5.159,cy1:4.6002,cx2:4.8335,cy2:4.944,x:4.6308,y:5.6137},{op:"L",x:2.8927,y:10.3673},{op:"L",x:1.13,y:10.3673},{op:"L",x:1.13,y:10.3672},{op:"Z"}],f:[{op:"M",x:6.1601,y:4.0781},{op:"C",cx1:6.4302,cy1:3.3717,cx2:6.8234,cy2:2.7086,x:7.3391,y:2.0882},{op:"C",cx1:7.8551,cy1:1.4679,cx2:8.4754,cy2:.9642,x:9.2062,y:.5773},{op:"C",cx1:9.937,cy1:.1904,cx2:10.7355,cy2:0,x:11.5953,y:0},{op:"C",cx1:12.0559,cy1:.043,cx2:12.4061,cy2:.2088,x:12.6333,y:.4913},{op:"C",cx1:12.8607,cy1:.7678,cx2:12.9772,cy2:1.1117,x:12.9772,y:1.5109},{op:"C",cx1:12.9772,cy1:1.9345,cx2:12.8421,cy2:2.3154,x:12.5659,y:2.6472},{op:"C",cx1:12.2954,cy1:2.9788,cx2:11.9578,cy2:3.1446,x:11.5463,y:3.1446},{op:"C",cx1:11.0487,cy1:3.1446,cx2:10.7662,cy2:2.9174,x:10.7111,y:2.4691},{op:"C",cx1:10.7418,cy1:2.1743,cx2:10.8522,cy2:1.8918,x:11.0427,y:1.6276},{op:"C",cx1:11.2331,cy1:1.3635,cx2:11.4666,cy2:1.1793,x:11.7428,y:1.087},{op:"C",cx1:11.8472,cy1:1.087,cx2:11.8965,cy2:1.0379,x:11.8965,y:.9335},{op:"C",cx1:11.8965,cy1:.8108,cx2:11.614,cy2:.6327,x:11.2147,y:.6327},{op:"C",cx1:10.0908,cy1:.6327,cx2:9.237,cy2:1.7811,x:8.6535,y:4.0781},{op:"L",x:10.8646,y:4.0781},{op:"L",x:10.8646,y:4.9073},{op:"L",x:8.4508,y:4.9073},{op:"C",cx1:8.2483,cy1:5.7918,cx2:7.9902,cy2:6.6944,x:7.671,y:7.6156},{op:"C",cx1:7.3577,cy1:8.5308,cx2:7.026,cy2:9.3723,x:6.676,y:10.1401},{op:"C",cx1:6.3319,cy1:10.9076,cx2:6.0064,cy2:11.5156,x:5.7055,y:11.9762},{op:"C",cx1:5.2632,cy1:12.658,cx2:4.7966,cy2:13.2353,x:4.299,y:13.7145},{op:"C",cx1:3.8016,cy1:14.1995,cx2:3.206,cy2:14.5067,x:2.5119,y:14.6418},{op:"C",cx1:2.211,cy1:14.6788,cx2:2.0266,cy2:14.6972,x:1.9592,y:14.6972},{op:"C",cx1:1.3632,cy1:14.6972,cx2:.8905,cy2:14.5128,x:.5527,y:14.1382},{op:"C",cx1:.2149,cy1:13.7636,cx2:.0307,cy2:13.3276,x:0,y:12.83},{op:"C",cx1:.0428,cy1:12.3941,cx2:.1718,cy2:12.0623,x:.3869,y:11.8351},{op:"C",cx1:.6017,cy1:11.6079,cx2:.9149,cy2:11.4298,x:1.3326,y:11.3008},{op:"C",cx1:1.6458,cy1:11.3254,cx2:1.9039,cy2:11.4359,x:2.1066,y:11.6324},{op:"C",cx1:2.3091,cy1:11.8352,cx2:2.4135,cy2:12.0809,x:2.4135,y:12.3818},{op:"C",cx1:2.4135,cy1:12.9405,cx2:1.8548,cy2:13.4134,x:1.4309,y:13.8127},{op:"C",cx1:1.4309,cy1:13.9171,cx2:1.5476,cy2:13.9664,x:1.7811,y:13.9664},{op:"C",cx1:2.7453,cy1:13.9664,cx2:3.5129,cy2:12.9405,x:4.0718,y:10.8955},{op:"C",cx1:4.2683,cy1:10.3426,cx2:4.4404,cy2:9.8083,x:4.5938,y:9.2926},{op:"C",cx1:4.7475,cy1:8.7703,cx2:4.9624,cy2:8.0028,x:5.2449,y:6.9832},{op:"C",cx1:5.5337,cy1:5.9575,cx2:5.7362,cy2:5.2695,x:5.8592,y:4.9073},{op:"L",x:4.1702,y:4.9073},{op:"L",x:4.1702,y:4.0781},{op:"L",x:6.1601,y:4.0781},{op:"Z"}],p:[{op:"M",x:3.767,y:8.5573},{op:"L",x:5.0097,y:5.0738},{op:"C",cx1:5.0804,cy1:4.7969,cx2:5.1126,cy2:4.5909,x:5.1126,y:4.443},{op:"C",cx1:5.1126,cy1:4.2497,cx2:5.0224,cy2:4.1531,x:4.8486,y:4.1531},{op:"C",cx1:4.7262,cy1:4.1531,cx2:4.5653,cy2:4.2497,x:4.3786,y:4.443},{op:"C",cx1:3.9471,cy1:4.9001,cx2:3.6059,cy2:5.383,x:3.3484,y:5.8917},{op:"L",x:2.6851,y:5.8917},{op:"C",cx1:2.8138,cy1:5.5117,cx2:3.0264,cy2:5.1126,x:3.3163,y:4.7004},{op:"C",cx1:3.6059,cy1:4.2818,cx2:3.9471,cy2:3.9406,x:4.3335,y:3.6702},{op:"C",cx1:4.7262,cy1:3.3933,cx2:5.1192,cy2:3.258,x:5.5119,y:3.258},{op:"C",cx1:6.1623,cy1:3.258,cx2:6.613,cy2:3.5671,x:6.8575,y:4.179},{op:"C",cx1:7.1987,cy1:3.8891,cx2:7.6044,cy2:3.6444,x:8.0617,y:3.4447},{op:"C",cx1:8.5188,cy1:3.2454,cx2:8.9632,cy2:3.1486,x:9.388,y:3.1486},{op:"C",cx1:10.1286,cy1:3.1486,cx2:10.7017,cy2:3.4447,x:11.1008,y:4.0437},{op:"C",cx1:11.5064,cy1:4.636,cx2:11.706,cy2:5.3249,x:11.706,y:6.104},{op:"C",cx1:11.706,cy1:6.8187,cx2:11.5322,cy2:7.5464,x:11.178,y:8.274},{op:"C",cx1:10.8304,cy1:9.0017,cx2:10.3538,cy2:9.6004,x:9.7422,y:10.0704},{op:"C",cx1:9.1306,cy1:10.5406,cx2:8.4607,cy2:10.7724,x:7.7267,y:10.7724},{op:"C",cx1:7.0442,cy1:10.7724,cx2:6.4133,cy2:10.5148,x:5.8273,y:10.006},{op:"L",x:4.7972,y:12.9614},{op:"C",cx1:4.765,cy1:13.0453,cx2:4.7133,cy2:13.1998,x:4.6426,y:13.4122},{op:"C",cx1:4.6684,cy1:13.6377,cx2:4.7842,cy2:13.7922,x:4.9902,y:13.8695},{op:"C",cx1:5.2028,cy1:13.9531,cx2:5.5504,cy2:13.9919,x:6.0399,y:13.9919},{op:"L",x:6.0399,y:14.8095},{op:"L",x:0,y:14.8095},{op:"L",x:0,y:13.9919},{op:"C",cx1:.7469,cy1:13.9919,cx2:1.2815,cy2:13.8759,x:1.5969,y:13.6506},{op:"C",cx1:1.9124,cy1:13.4251,cx2:2.1379,cy2:13.1289,x:2.2666,y:12.7491},{op:"L",x:3.767,y:8.5573},{op:"Z"},{op:"M",x:7.0637,y:6.3166},{op:"C",cx1:6.7802,cy1:6.9604,cx2:6.6064,cy2:7.8104,x:6.5357,y:8.8727},{op:"C",cx1:6.6064,cy1:9.5619,cx2:6.7609,cy2:9.9031,x:7.012,y:9.9031},{op:"C",cx1:7.8879,cy1:9.7356,cx2:8.609,cy2:8.7248,x:9.1755,y:6.8704},{op:"C",cx1:9.3495,cy1:6.2071,cx2:9.4395,cy2:5.6084,x:9.4395,y:5.0738},{op:"C",cx1:9.4395,cy1:4.4108,cx2:9.2657,cy2:4.05,x:8.9115,y:3.9923},{op:"C",cx1:8.332,cy1:3.9923,cx2:7.7139,cy2:4.7647,x:7.0637,y:6.3166},{op:"Z"}]},Ur={mf:8.0028,mp:9.523,ff:6.67866,pp:8.8083},jr={fill:"#000"},Xr=.79341;function wt(i,t,e){let n=0,o=Array.from(i,(s,r)=>{let c={path:Kr[s],style:jr,dx:n};return n+=Ur[s+i[r+1]]??0,c});return{name:i,description:e,shapes:o,weight:i.includes("f")?1:Xr,onTimeState:s=>{s.velocity=t}}}var Js=[wt("ppp",16,"\u6781\u5F31"),wt("pp",32,"\u5F88\u5F31"),wt("p",48,"\u5F31"),wt("mp",64,"\u4E2D\u5F31"),wt("mf",80,"\u4E2D\u5F3A"),wt("f",96,"\u5F3A"),wt("ff",112,"\u5F88\u5F3A"),wt("fff",127,"\u6781\u5F3A")];var Zr={},ti={name:"fermata",description:"\u5EF6\u957F\u8BB0\u53F7\uFF1A\u8986\u76D6\u533A\u95F4\u901F\u5EA6\u51CF\u534A\uFF0C\u76EE\u6807\u97F3\u5B9E\u9645\u65F6\u957F\u7FFB\u500D",weight:.6,paddingBottom:3,shapes:[{path:[{op:"M",x:0,y:7.46666},{op:"C",cx1:3.65834,cy1:0,cx2:8.53611,cy2:0,x:12.19445,y:7.46666},{op:"M",x:12.19445,y:7.46666},{op:"C",cx1:8.53611,cy1:.74666,cx2:3.65833,cy2:.74666,x:0,y:7.46666}],style:{fill:"#000",stroke:"#000",strokeWidth:1}},{circle:{cx:6.09723,cy:6.26666,r:1.2},style:{fill:"#000"}}],emitPlayback:i=>i.scaleFollowingBpm(Zr,1,2,{followConnections:!0})};var ei={name:"fine",description:"\u7EC8\u6B62\u8BB0\u53F7\uFF1A\u56DE\u8DF3\u4E4B\u540E\u7ECF\u8FC7\u8FD9\u91CC\u5C31\u7ED3\u675F\u4E50\u66F2",weight:1.4,text:{content:"Fine.",fontFamily:'"Times New Roman", serif'},onVisit:(i,t)=>{let e=i.seek(ue,t,1);return e!==void 0&&i.visits(e)>0?{kind:"stop"}:void 0}};function qt(i){return(t,e)=>{let n=[];for(let o of e){if(!o.transpose){n.push(o);continue}let s=o.end.clone().sub(o.start),r=t.stateAt(o.start).effectiveBpm,c=i.repeat?qr(i.body,s.toNumber(),r):i.body,a=s.div(c.length);for(let l=0;l<c.length;l++){let h=c[l],p=o.start.clone().add(a.clone().mul(l));n.push({...o,start:p,end:p.clone().add(a),midi:h===0?o.midi:o.transpose(h),transpose:f=>o.transpose(h+f)})}}return n}}function qr(i,t,e){let n=Math.min(480,Math.max(60,e))/e,o=Math.floor(256/i.length),s=Math.min(o,Math.max(1,Math.round(t*8*n/i.length))),r=[];for(let c=0;c<s;c++)r.push(...i);return r}var ni={name:"mordent",description:"\u4E0B\u6CE2\u97F3\uFF1A\u672C\u97F3\u3001\u8C03\u5185\u4E0B\u65B9\u4E8C\u5EA6\u3001\u672C\u97F3",weight:.73423,shapes:[{path:[{op:"M",x:7.29541,y:.05944},{op:"C",cx1:7.56541,cy1:-.09056,cx2:7.92541,cy2:.05944,x:8.04541,y:.32944},{op:"C",cx1:8.10541,cy1:.44944,cx2:8.10541,cy2:.56944,x:8.10541,y:1.76943},{op:"L",x:8.10541,y:3.05943},{op:"L",x:8.67541,y:2.21943},{op:"C",cx1:9.18541,cy1:1.46943,cx2:9.24541,cy2:1.37943,x:9.36541,y:1.31943},{op:"C",cx1:9.42541,cy1:1.28943,cx2:9.54541,cy2:1.25943,x:9.60541,y:1.25943},{op:"C",cx1:9.90541,cy1:1.25943,cx2:9.87541,cy2:1.22943,x:11.49541,y:3.20943},{op:"L",x:13.02541,y:5.03943},{op:"L",x:13.50541,y:4.34943},{op:"C",cx1:14.01541,cy1:3.56943,cx2:14.04541,cy2:3.50943,x:14.19541,y:3.44943},{op:"C",cx1:14.61541,cy1:3.26943,cx2:15.06541,cy2:3.59943,x:15.00541,y:4.04943},{op:"C",cx1:14.97541,cy1:4.16943,cx2:14.70541,cy2:4.55943,x:13.50541,y:6.41943},{op:"C",cx1:12.12541,cy1:8.48943,cx2:12.00541,cy2:8.63943,x:11.88541,y:8.69943},{op:"C",cx1:11.82541,cy1:8.72943,cx2:11.70541,cy2:8.75943,x:11.64541,y:8.75943},{op:"C",cx1:11.34541,cy1:8.75943,cx2:11.37541,cy2:8.78943,x:9.81541,y:6.86943},{op:"C",cx1:9.00541,cy1:5.87943,cx2:8.31541,cy2:5.06943,x:8.28541,y:5.00943},{op:"C",cx1:8.22541,cy1:4.97943,cx2:8.22541,cy2:4.97943,x:8.16541,y:5.03943},{op:"C",cx1:8.10541,cy1:5.09943,cx2:8.10541,cy2:5.18943,x:8.10541,y:7.31943},{op:"C",cx1:8.10541,cy1:9.26943,cx2:8.10541,cy2:9.56943,x:8.04541,y:9.65943},{op:"C",cx1:7.86541,cy1:10.10943,cx2:7.23541,cy2:10.13943,x:6.99541,y:9.68943},{op:"C",cx1:6.96541,cy1:9.62943,cx2:6.93541,cy2:9.44943,x:6.93541,y:8.27943},{op:"L",x:6.93541,y:6.92943},{op:"L",x:6.36541,y:7.76943},{op:"C",cx1:5.82541,cy1:8.54943,cx2:5.76541,cy2:8.63943,x:5.64541,y:8.69943},{op:"C",cx1:5.58541,cy1:8.72943,cx2:5.46541,cy2:8.75943,x:5.40541,y:8.75943},{op:"C",cx1:5.10541,cy1:8.75943,cx2:5.13541,cy2:8.78943,x:3.51541,y:6.80943},{op:"L",x:1.98541,y:4.97943},{op:"L",x:1.50541,y:5.66943},{op:"C",cx1:.99541,cy1:6.44943,cx2:.96541,cy2:6.50943,x:.81541,y:6.56943},{op:"C",cx1:.39541,cy1:6.74943,cx2:-.05459,cy2:6.41943,x:.00541,y:5.96943},{op:"C",cx1:.03541,cy1:5.84943,cx2:.30541,cy2:5.45943,x:1.50541,y:3.59943},{op:"C",cx1:2.88541,cy1:1.52943,cx2:3.00541,cy2:1.37943,x:3.12541,y:1.31943},{op:"C",cx1:3.18541,cy1:1.28943,cx2:3.30541,cy2:1.25943,x:3.36541,y:1.25943},{op:"C",cx1:3.66541,cy1:1.25943,cx2:3.63541,cy2:1.22943,x:5.25541,y:3.20943},{op:"L",x:6.78541,y:5.03943},{op:"C",cx1:6.81541,cy1:5.03943,cx2:6.84541,cy2:4.97943,x:6.87541,y:4.94943},{op:"C",cx1:6.93541,cy1:4.82943,cx2:6.93541,cy2:4.79943,x:6.93541,y:2.66943},{op:"C",cx1:6.93541,cy1:.74943,cx2:6.93541,cy2:.44943,x:6.99541,y:.35943},{op:"C",cx1:7.05541,cy1:.20943,cx2:7.14541,cy2:.11943,x:7.29541,y:.05943},{op:"Z"}],style:{fill:"#000"}}],emitPlayback:i=>i.affectFollowing(qt({body:[0,-1,0]}))};var oi={name:"prall",description:"\u4E0A\u6CE2\u97F3\uFF1A\u672C\u97F3\u3001\u8C03\u5185\u4E0A\u65B9\u4E8C\u5EA6\u3001\u672C\u97F3",weight:.55,shapes:[{path:[{op:"M",x:3.12541,y:.06003},{op:"C",cx1:3.18541,cy1:.03003,cx2:3.30541,cy2:3e-5,x:3.36541,y:3e-5},{op:"C",cx1:3.66541,cy1:3e-5,cx2:3.63541,cy2:-.02997,x:5.25541,y:1.95003},{op:"L",x:6.78541,y:3.78003},{op:"C",cx1:6.81541,cy1:3.78003,cx2:7.35541,cy2:2.94003,x:8.01541,y:1.95003},{op:"C",cx1:9.15541,cy1:.27003,cx2:9.24541,cy2:.12003,x:9.36541,y:.06003},{op:"C",cx1:9.42541,cy1:.03003,cx2:9.54541,cy2:3e-5,x:9.60541,y:3e-5},{op:"C",cx1:9.90541,cy1:3e-5,cx2:9.87541,cy2:-.02997,x:11.49541,y:1.95003},{op:"L",x:13.02541,y:3.78003},{op:"L",x:13.50541,y:3.09003},{op:"C",cx1:14.01541,cy1:2.31003,cx2:14.04541,cy2:2.25003,x:14.19541,y:2.19003},{op:"C",cx1:14.61541,cy1:2.01003,cx2:15.06541,cy2:2.34003,x:15.00541,y:2.79003},{op:"C",cx1:14.97541,cy1:2.91003,cx2:14.70541,cy2:3.30003,x:13.50541,y:5.16003},{op:"C",cx1:12.12541,cy1:7.23003,cx2:12.00541,cy2:7.38003,x:11.88541,y:7.44003},{op:"C",cx1:11.82541,cy1:7.47003,cx2:11.70541,cy2:7.50003,x:11.64541,y:7.50003},{op:"C",cx1:11.34541,cy1:7.50003,cx2:11.37541,cy2:7.53003,x:9.75541,y:5.55003},{op:"L",x:8.22541,y:3.72003},{op:"C",cx1:8.19541,cy1:3.72003,cx2:7.65541,cy2:4.56003,x:6.99541,y:5.55003},{op:"C",cx1:5.85541,cy1:7.23003,cx2:5.76541,cy2:7.38003,x:5.64541,y:7.44003},{op:"C",cx1:5.58541,cy1:7.47003,cx2:5.46541,cy2:7.50003,x:5.40541,y:7.50003},{op:"C",cx1:5.10541,cy1:7.50003,cx2:5.13541,cy2:7.53003,x:3.51541,y:5.55003},{op:"L",x:1.98541,y:3.72003},{op:"L",x:1.50541,y:4.41003},{op:"C",cx1:.99541,cy1:5.19003,cx2:.96541,cy2:5.25003,x:.81541,y:5.31003},{op:"C",cx1:.39541,cy1:5.49003,cx2:-.05459,cy2:5.16003,x:.00541,y:4.71004},{op:"C",cx1:.03541,cy1:4.59004,cx2:.30541,cy2:4.20004,x:1.50541,y:2.34004},{op:"C",cx1:2.88541,cy1:.27004,cx2:3.00541,cy2:.12004,x:3.12541,y:.06004},{op:"Z"}],style:{fill:"#000"}}],emitPlayback:i=>i.affectFollowing(qt({body:[0,1,0]}))};var si={name:"tr",description:"\u98A4\u97F3\uFF1A\u672C\u97F3\u4E0E\u8C03\u5185\u4E0A\u65B9\u4E8C\u5EA6\u4EA4\u66FF",shapes:[{path:[{op:"M",x:3.17992,y:5.46383},{op:"L",x:3.61827,y:3.91711},{op:"C",cx1:3.10024,cy1:3.49862,cx2:2.52947,cy2:3.29304,x:1.90541,y:3.29304},{op:"C",cx1:1.50051,cy1:3.29304,cx2:1.18833,cy2:3.40589,x:.95611,y:3.63812},{op:"C",cx1:.72361,cy1:3.87061,cx2:.59743,cy2:4.14281,x:.57105,y:4.46152},{op:"C",cx1:.57105,cy1:4.91944,cx2:.71707,cy2:5.25147,x:1.00913,y:5.47036},{op:"C",cx1:1.30118,cy1:5.68954,cx2:1.61988,cy2:5.79586,x:1.95843,y:5.79586},{op:"C",cx1:1.9916,cy1:5.79586,cx2:2.03157,cy2:5.8157,x:2.06475,y:5.84888},{op:"C",cx1:2.24394,cy1:5.82904,cx2:2.61568,cy2:5.69632,x:3.17992,y:5.46383},{op:"Z"},{op:"M",x:6.579,y:9.87204},{op:"L",x:8.40472,y:3.75096},{op:"C",cx1:8.40472,cy1:3.59162,cx2:8.35167,cy2:3.51193,x:8.23884,y:3.51193},{op:"C",cx1:7.98647,cy1:3.51193,cx2:7.4554,cy2:3.77761,x:6.63883,y:4.3152},{op:"C",cx1:5.82223,cy1:4.84655,cx2:5.37735,cy2:5.15845,x:5.30448,y:5.25145},{op:"C",cx1:5.33764,cy1:5.21147,cx2:5.39068,cy2:5.15845,x:5.46383,y:5.0853},{op:"C",cx1:6.13441,cy1:6.06127,cx2:6.47294,cy2:6.98417,x:6.47294,y:7.86061},{op:"C",cx1:6.41313,cy1:8.53088,cx2:6.18062,cy2:9.12181,x:5.7692,y:9.61968},{op:"C",cx1:5.3643,cy1:10.11758,cx2:4.85308,cy2:10.3634,x:4.24233,y:10.3634},{op:"C",cx1:3.71778,cy1:10.3634,cx2:3.25306,cy2:10.23719,x:2.83483,y:9.99138},{op:"C",cx1:2.42314,cy1:9.74586,cx2:2.20396,cy2:9.39396,x:2.17759,y:8.92271},{op:"C",cx1:2.21077,cy1:8.80986,cx2:2.23061,cy2:8.66384,x:2.23061,y:8.48436},{op:"L",x:2.85469,y:6.0944},{op:"C",cx1:2.58903,cy1:6.2339,cx2:2.21729,cy2:6.30702,x:1.73924,y:6.30702},{op:"C",cx1:1.22829,cy1:6.2804,cx2:.81007,cy2:6.1012,x:.48458,y:5.76917},{op:"C",cx1:.15935,cy1:5.43065,cx2:0,cy2:4.97926,x:0,y:4.4082},{op:"C",cx1:.03318,cy1:3.89045,cx2:.20586,cy2:3.46543,x:.53107,y:3.13369},{op:"C",cx1:.8563,cy1:2.80166,cx2:1.32782,cy2:2.63579,x:1.95843,y:2.63579},{op:"C",cx1:2.55585,cy1:2.63579,cx2:3.17992,cy2:2.87481,x:3.83716,y:3.34606},{op:"L",x:4.89277,y:0},{op:"L",x:6.85119,y:0},{op:"L",x:5.41053,y:4.51453},{op:"C",cx1:6.28694,cy1:3.83064,cx2:7.02389,cy2:3.34606,x:7.62128,y:3.06054},{op:"C",cx1:8.21899,cy1:2.77502,cx2:8.86943,cy2:2.63579,x:9.57321,y:2.63579},{op:"C",cx1:10.05773,cy1:2.63579,cx2:10.30358,cy2:2.83484,x:10.30358,y:3.23974},{op:"C",cx1:10.30358,cy1:3.44559,cx2:10.17738,cy2:3.89046,x:10.09093,y:4.18931},{op:"C",cx1:10.7283,cy1:3.15354,cx2:11.45195,cy2:2.63579,x:12.26199,y:2.63579},{op:"C",cx1:12.6272,cy1:2.63579,cx2:12.91925,cy2:2.76849,x:13.14497,y:3.03417},{op:"C",cx1:13.37717,cy1:3.29957,cx2:13.49001,cy2:3.61175,x:13.49001,y:3.97014},{op:"C",cx1:13.49001,cy1:4.62739,cx2:13.09844,cy2:5.03228,x:12.53419,y:5.03228},{op:"C",cx1:12.16899,cy1:5.03228,cx2:11.85709,cy2:4.79327,x:11.80382,y:4.29536},{op:"C",cx1:11.89029,cy1:3.91031,cx2:11.98982,cy2:3.55191,x:11.98982,y:3.34606},{op:"C",cx1:11.98982,cy1:3.27291,cx2:11.94329,cy2:3.23973,x:11.85709,y:3.23973},{op:"C",cx1:11.74403,cy1:3.23973,cx2:11.53162,cy2:3.34606,x:11.20637,y:3.56522},{op:"C",cx1:10.90752,cy1:3.7708,cx2:10.61547,cy2:4.11615,x:10.31666,y:4.61405},{op:"C",cx1:10.01808,cy1:5.11195,cx2:9.77253,cy2:5.69632,x:9.57321,y:6.36662},{op:"L",x:8.45798,y:9.87203},{op:"L",x:6.57899,y:9.87203},{op:"L",x:6.579,y:9.87204},{op:"Z"},{op:"M",x:5.05893,y:5.62971},{op:"L",x:3.94348,y:8.92274},{op:"C",cx1:3.94348,cy1:9.0288,cx2:3.92364,cy2:9.12179,x:3.89045,y:9.19495},{op:"C",cx1:3.89045,cy1:9.48047,cx2:4.06285,cy2:9.65287,x:4.40821,y:9.70617},{op:"C",cx1:5.404,cy1:9.22134,cx2:5.9019,cy2:8.51787,x:5.9019,y:7.58841},{op:"C",cx1:5.9019,cy1:6.99751,cx2:5.62318,cy2:6.34681,x:5.05893,y:5.62972},{op:"L",x:5.05893,y:5.62971},{op:"Z"}],style:{fill:"#000"}}],emitPlayback:i=>i.affectFollowing(qt({body:[0,1],repeat:!0}))};var ii=new Map([si,ti,oi,ni,Xs,...Js,Zs,Qs,qs,ei].map(i=>[i.name.toLowerCase(),i])),ao=class extends v{static def={name:["symbol","$"],description:"\u521B\u5EFA\u4E00\u4E2A\u4E50\u8C31\u7B26\u53F7",details:`~~~jpfun
|
|
71
|
+
)`}combine(t){this.sourceSpan.start=Math.min(this.sourceSpan.start,t.sourceSpan.start),this.sourceSpan.end=Math.max(this.sourceSpan.end,t.sourceSpan.end);for(let e of t.contents)e.parent=this;return this.contents.push(...t.contents),t.contents.length=0,this}},fi=So;var ui={name:"accent",description:"\u91CD\u97F3",weight:.5,shapes:[{path:[{op:"M",x:.21413,y:.4818},{op:"L",x:8.21413,y:3.72071},{op:"L",x:.29494,y:6.92724}],style:{stroke:"#000",strokeWidth:1}}],emitPlayback:r=>r.affectFollowing((t,e)=>{for(let n of e)n.velocity=Math.min(127,n.velocity+20)})};var we="repeat.jump",di={name:"dc",description:"\u4ECE\u5934\u53CD\u590D\uFF1A\u8DF3\u56DE\u66F2\u9996\u518D\u6F14\u4E00\u904D",weight:.9,shapes:[{path:[{op:"M",x:1.06974,y:7.0752},{op:"L",x:2.69184,y:1.21499},{op:"C",cx1:2.69184,cy1:1.1221,cx2:2.73825,cy2:.93022,x:2.73825,y:.86039},{op:"C",cx1:2.73825,cy1:.48248,cx2:2.4825,cy2:.33152,x:1.7614,y:.23838},{op:"L",x:1.7614,y:.04641},{op:"L",x:4.88344,y:.04641},{op:"C",cx1:7.64477,cy1:.04641,cx2:9.02278,cy2:1.18018,x:9.02278,y:3.45323},{op:"C",cx1:9.02278,cy1:4.47649,cx2:8.74941,cy2:5.36592,x:8.20888,y:6.11596},{op:"C",cx1:7.6681,cy1:6.86578,cx2:6.95303,cy2:7.4297,x:6.05765,y:7.81334},{op:"C",cx1:5.16823,cy1:8.19125,cx2:4.22074,cy2:8.38316,x:3.21493,y:8.38316},{op:"L",x:0,y:8.38316},{op:"L",x:0,y:8.19119},{op:"C",cx1:.64542,cy1:8.19126,cx2:.91275,cy2:7.81343,x:1.06974,y:7.07521},{op:"L",x:1.06974,y:7.0752},{op:"Z"},{op:"M",x:4.09864,y:.66867},{op:"L",x:2.2848,y:7.35998},{op:"C",cx1:2.2848,cy1:7.42409,cx2:2.26718,cy2:7.48786,x:2.23815,y:7.55197},{op:"C",cx1:2.29051,cy1:7.84841,cx2:2.58133,cy2:7.99961,x:3.12179,y:7.99961},{op:"C",cx1:3.97639,cy1:7.99961,cx2:4.74389,cy2:7.79034,x:5.42397,y:7.37165},{op:"C",cx1:6.10429,cy1:6.94733,cx2:6.62746,cy2:6.37751,x:7.00538,y:5.65666},{op:"C",cx1:7.3833,cy1:4.92994,cx2:7.5752,cy2:4.1334,x:7.5752,y:3.26134},{op:"C",cx1:7.5752,cy1:1.372,cx2:6.69156,cy2:.43029,x:4.92984,y:.43029},{op:"C",cx1:4.53471,cy1:.43029,cx2:4.25555,cy2:.51151,x:4.09864,y:.66869},{op:"L",x:4.09864,y:.66867},{op:"Z"},{op:"M",x:18.35961,y:.04641},{op:"L",x:17.90593,y:2.62204},{op:"L",x:17.66755,y:2.62204},{op:"C",cx1:17.563,cy1:1.19183,cx2:16.91187,cy2:.47678,x:15.71418,y:.47678},{op:"C",cx1:14.96437,cy1:.47678,cx2:14.29564,cy2:.73848,x:13.70274,y:1.26165},{op:"C",cx1:13.11556,cy1:1.77911,cx2:12.65617,cy2:2.43578,x:12.33664,y:3.22668},{op:"C",cx1:12.01679,cy1:4.01155,cx2:11.85988,cy2:4.77302,x:11.85988,y:5.49984},{op:"C",cx1:11.85988,cy1:6.26131,cx2:12.03424,cy2:6.90076,x:12.37734,y:7.41814},{op:"C",cx1:12.72598,cy1:7.9356,cx2:13.24931,cy2:8.19126,x:13.95279,y:8.19126},{op:"C",cx1:15.08622,cy1:8.19126,cx2:16.11543,cy2:7.68548,x:17.02818,y:6.66825},{op:"L",x:17.21412,y:6.86023},{op:"C",cx1:16.26663,cy1:8.16232,cx2:15.08051,cy2:8.81352,x:13.66775,y:8.81352},{op:"C",cx1:13.034,cy1:8.81352,cx2:12.47014,cy2:8.65637,x:11.97608,y:8.34254},{op:"C",cx1:11.48195,cy1:8.02864,cx2:11.10411,cy2:7.60432,x:10.83074,y:7.06925},{op:"C",cx1:10.56333,cy1:6.53442,cx2:10.42974,cy2:5.94748,x:10.42974,y:5.31357},{op:"C",cx1:10.42974,cy1:4.43581,cx2:10.67383,cy2:3.58692,x:11.15655,y:2.7616},{op:"C",cx1:11.63894,cy1:1.93602,cx2:12.28427,cy2:1.26738,x:13.09223,y:.76158},{op:"C",cx1:13.90042,cy1:.25578,cx2:14.74336,cy2:3e-5,x:15.62137,y:3e-5},{op:"C",cx1:15.88283,cy1:3e-5,cx2:16.12121,cy2:.0174,x:16.33651,y:.0581},{op:"C",cx1:16.55157,cy1:.09886,cx2:16.79557,cy2:.15122,x:17.05729,y:.21501},{op:"C",cx1:17.31875,cy1:.2791,cx2:17.51072,cy2:.31979,x:17.62123,y:.33717},{op:"C",cx1:17.85961,cy1:.2557,cx2:18.03389,cy2:.15694,x:18.14432,y:.04643},{op:"L",x:18.35962,y:.04643},{op:"L",x:18.35961,y:.04644},{op:"Z"},{op:"M",x:8.19134,y:7.69151},{op:"C",cx1:8.19134,cy1:7.5169,cx2:8.25544,cy2:7.36596,x:8.38894,y:7.2322},{op:"C",cx1:8.52277,cy1:7.09838,cx2:8.69134,cy2:7.0288,x:8.88332,y:7.0288},{op:"C",cx1:9.0519,cy1:7.0288,cx2:9.19722,cy2:7.09838,x:9.3251,y:7.2322},{op:"C",cx1:9.45893,cy1:7.36603,cx2:9.5227,cy2:7.52294,x:9.5227,y:7.69151},{op:"C",cx1:9.5227,cy1:8.0925,cx2:9.23221,cy2:8.38324,x:8.88332,y:8.38324},{op:"C",cx1:8.48803,cy1:8.38324,cx2:8.19134,cy2:8.10416,x:8.19134,y:7.69151},{op:"Z"},{op:"M",x:18.00469,y:7.79028},{op:"C",cx1:18.00469,cy1:7.40068,cx2:18.27814,cy2:7.12162,x:18.64432,y:7.12162},{op:"C",cx1:19.03969,cy1:7.12162,cx2:19.31298,cy2:7.39507,x:19.31298,y:7.79028},{op:"C",cx1:19.31298,cy1:8.15653,cx2:19.0339,cy2:8.42965,x:18.64432,y:8.42965},{op:"C",cx1:18.28972,cy1:8.42965,cx2:18.00469,cy2:8.14486,x:18.00469,y:7.79028},{op:"Z"}],style:{fill:"#000"}}],playbackMarks:()=>[we],onVisit:(r,t)=>r.visits(t)>1?void 0:{kind:"jump",column:0}};var Co="repeat.segno",xi={name:"segno",description:"\u53CD\u590D\u8BB0\u53F7\uFF1AD.S. \u7684\u56DE\u8DF3\u76EE\u6807",weight:1.15,playbackMarks:()=>[Co],shapes:[{path:[{op:"M",x:3.75502,y:7.52938},{op:"C",cx1:1.3411,cy1:6.32492,cx2:.10249,cy2:4.89115,x:.03897,y:3.23307},{op:"C",cx1:.06833,cy1:2.69176,cx2:.20975,cy2:2.17002,x:.45843,y:1.67267},{op:"C",cx1:.71191,cy1:1.1751,cx2:1.05826,cy2:.77042,x:1.49231,y:.46321},{op:"C",cx1:1.93115,cy1:.156,cx2:2.41873,cy2:0,x:2.95524,y:0},{op:"C",cx1:3.6136,cy1:0,cx2:4.17428,cy2:.17538,x:4.64747,y:.52174},{op:"C",cx1:5.12047,cy1:.8679,cx2:5.35457,cy2:1.36047,x:5.35457,y:1.99925},{op:"C",cx1:5.33499,cy1:2.26751,cx2:5.21315,cy2:2.49182,x:4.98384,y:2.66739},{op:"C",cx1:4.75473,cy1:2.83817,cx2:4.50106,cy2:2.93565,x:4.21343,y:2.95502},{op:"C",cx1:3.67691,cy1:2.90629,cx2:3.35013,cy2:2.68696,x:3.23807,y:2.29686},{op:"L",x:3.06249,y:1.73119},{op:"C",cx1:2.93086,cy1:1.31652,cx2:2.71134,cy2:1.0191,x:2.29687,y:1.0191},{op:"C",cx1:1.99446,cy1:1.0191,cx2:1.74578,cy2:1.16551,x:1.55561,y:1.46293},{op:"C",cx1:1.36544,cy1:1.76035,cx2:1.26798,cy2:2.06276,x:1.25819,y:2.37476},{op:"C",cx1:1.28735,cy1:2.79902,cx2:1.42398,cy2:3.17954,x:1.66287,y:3.50612},{op:"C",cx1:1.90677,cy1:3.8329,cx2:2.20418,cy2:4.11094,x:2.56012,y:4.34984},{op:"C",cx1:2.91627,cy1:4.58394,cx2:3.31116,cy2:4.79846,x:3.73542,y:4.99841},{op:"C",cx1:4.15967,cy1:5.19835,cx2:4.57914,cy2:5.38851,x:4.99361,y:5.57387},{op:"L",x:8.62659,y:.12183},{op:"L",x:9.70919,y:.12183},{op:"L",x:5.85194,y:5.97376},{op:"C",cx1:6.5005,cy1:6.29076,cx2:7.09535,cy2:6.65649,x:7.62705,y:7.06117},{op:"C",cx1:8.15855,cy1:7.47085,cx2:8.60221,cy2:7.95363,x:8.95835,y:8.50473},{op:"C",cx1:9.3143,cy1:9.05562,cx2:9.48985,cy2:9.65546,x:9.48985,y:10.30403},{op:"C",cx1:9.48985,cy1:10.86491,cx2:9.35822,cy2:11.39164,x:9.08996,y:11.88421},{op:"C",cx1:8.82652,cy1:12.37658,cx2:8.44618,cy2:12.77167,x:7.9488,y:13.0643},{op:"C",cx1:7.45147,cy1:13.35691,cx2:6.871,cy2:13.50314,x:6.21285,y:13.50314},{op:"C",cx1:5.62259,cy1:13.44461,cx2:5.1448,cy2:13.23009,x:4.78386,y:12.85457},{op:"C",cx1:4.42791,cy1:12.47906,cx2:4.23776,cy2:12.06938,x:4.21338,y:11.62572},{op:"C",cx1:4.23275,cy1:11.35746,cx2:4.33043,cy2:11.12338,x:4.5108,y:10.92821},{op:"C",cx1:4.69118,cy1:10.73326,cx2:4.94485,cy2:10.626,x:5.27163,y:10.60644},{op:"C",cx1:5.63239,cy1:10.60644,cx2:5.88605,cy2:10.68931,x:6.03726,y:10.85033},{op:"C",cx1:6.18828,cy1:11.01611,cx2:6.31031,cy2:11.26001,x:6.3932,y:11.58656},{op:"C",cx1:6.48092,cy1:11.91335,cx2:6.56377,cy2:12.14745,x:6.64186,y:12.2791},{op:"C",cx1:6.72476,cy1:12.41573,cx2:6.88578,cy2:12.48404,x:7.12944,y:12.48404},{op:"C",cx1:7.50019,cy1:12.48404,cx2:7.78783,cy2:12.35718,x:7.99756,y:12.10353},{op:"C",cx1:8.20729,cy1:11.85485,cx2:8.30974,cy2:11.52805,x:8.30974,y:11.12338},{op:"C",cx1:8.30974,cy1:10.57728,cx2:8.11459,cy2:10.11887,x:7.72451,y:9.74812},{op:"C",cx1:7.33918,cy1:9.38239,cx2:6.75395,cy2:9.00689,x:5.97375,y:8.62657},{op:"C",cx1:5.19353,cy1:8.25105,cx2:4.73513,cy2:8.01693,x:4.59371,y:7.92926},{op:"L",x:1.05823,y:13.42024},{op:"L",x:0,y:13.42024},{op:"L",x:3.755,y:7.52937},{op:"L",x:3.75502,y:7.52938},{op:"Z"},{op:"M",x:.07812,y:8.54848},{op:"C",cx1:.07812,cy1:8.20711,cx2:.18039,cy2:7.95364,x:.38033,y:7.78285},{op:"C",cx1:.58028,cy1:7.61227,cx2:.81937,cy2:7.5294,x:1.09721,y:7.5294},{op:"C",cx1:1.36068,cy1:7.55377,cx2:1.58499,cy2:7.65124,x:1.76535,y:7.822},{op:"C",cx1:1.94572,cy1:7.99259,cx2:2.03841,cy2:8.25105,x:2.03841,y:8.58763},{op:"C",cx1:2.03841,cy1:8.79736,cx2:1.93594,cy2:8.99731,x:1.736,y:9.19226},{op:"C",cx1:1.53606,cy1:9.39222,cx2:1.32153,cy2:9.48971,x:1.09721,y:9.48971},{op:"C",cx1:.81936,cy1:9.48971,cx2:.57548,cy2:9.41181,x:.37553,y:9.25081},{op:"C",cx1:.17558,cy1:9.08978,cx2:.07811,cy2:8.85588,x:.07811,y:8.54849},{op:"L",x:.07812,y:8.54848},{op:"Z"},{op:"M",x:8.3098,y:5.11547},{op:"C",cx1:8.3098,cy1:4.7789,cx2:8.4023,cy2:4.51564,x:8.58285,y:4.33027},{op:"C",cx1:8.76803,cy1:4.14508,cx2:9.00212,cy2:4.05242,x:9.28995,y:4.05242},{op:"C",cx1:9.57758,cy1:4.05242,cx2:9.82145,cy2:4.14011,x:10.01644,y:4.31568},{op:"C",cx1:10.21158,cy1:4.48627,cx2:10.30902,cy2:4.73994,x:10.30902,y:5.07152},{op:"C",cx1:10.30902,cy1:5.30083,cx2:10.20677,cy2:5.51036,x:10.00184,y:5.69572},{op:"C",cx1:9.7971,cy1:5.88108,cx2:9.57279,cy2:5.97376,x:9.32892,y:5.97376},{op:"C",cx1:9.07043,cy1:5.97376,cx2:8.83156,cy2:5.88587,x:8.62182,y:5.71529},{op:"C",cx1:8.41209,cy1:5.53971,cx2:8.3098,cy2:5.33977,x:8.3098,y:5.11546},{op:"L",x:8.3098,y:5.11547},{op:"Z"}],style:{fill:"#000"}}]};var mi={name:"ds",description:"\u4ECE\u8BB0\u53F7\u5904\u53CD\u590D\uFF1A\u8DF3\u56DE\u6700\u8FD1\u7684 $segno",weight:.9,shapes:[{path:[{op:"M",x:3.30971,y:8.58253},{op:"L",x:0,y:8.58253},{op:"L",x:0,y:8.38492},{op:"C",cx1:.66434,cy1:8.38492,cx2:.93964,cy2:7.9959,x:1.10119,y:7.23595},{op:"L",x:2.77112,y:1.20293},{op:"C",cx1:2.77112,cy1:1.10732,cx2:2.81892,cy2:.90973,x:2.81892,y:.83791},{op:"C",cx1:2.81892,cy1:.44886,cx2:2.55564,cy2:.29345,x:1.81333,y:.19758},{op:"L",x:1.81333,y:0},{op:"L",x:5.02743,y:0},{op:"C",cx1:7.87013,cy1:0,cx2:9.28879,cy2:1.16713,x:9.28879,y:3.50729},{op:"C",cx1:9.28879,cy1:4.56066,cx2:9.00736,cy2:5.47632,x:8.45088,y:6.24853},{op:"C",cx1:7.89416,cy1:7.02049,cx2:7.15799,cy2:7.60099,x:6.23624,y:7.9959},{op:"C",cx1:5.32063,cy1:8.38492,cx2:4.34519,cy2:8.58253,x:3.3097,y:8.58253},{op:"L",x:3.30971,y:8.58253},{op:"Z"},{op:"M",x:4.21944,y:.64057},{op:"L",x:2.35218,y:7.52917},{op:"C",cx1:2.35218,cy1:7.59509,cx2:2.33403,cy2:7.66079,x:2.30413,y:7.72673},{op:"C",cx1:2.35806,cy1:8.03196,cx2:2.65738,cy2:8.18763,x:3.21387,y:8.18763},{op:"C",cx1:4.71023,cy1:8.18763,cx2:5.84745,cy2:7.75053,x:6.6253,y:6.88271},{op:"C",cx1:7.40952,cy1:6.00899,cx2:7.79857,cy2:4.81807,x:7.79857,y:3.30973},{op:"C",cx1:7.79857,cy1:1.36475,cx2:6.88883,cy2:.39519,x:5.07525,y:.39519},{op:"C",cx1:4.66831,cy1:.39517,cx2:4.38101,cy2:.47876,x:4.21945,y:.64056},{op:"L",x:4.21944,y:.64056},{op:"Z"},{op:"M",x:17.3325,y:1e-5},{op:"L",x:16.81794,y:2.54976},{op:"L",x:16.57254,y:2.54976},{op:"C",cx1:16.57254,cy1:1.14312,cx2:16.03984,cy2:.44299,x:14.98033,y:.44299},{op:"C",cx1:14.57337,cy1:.44299,cx2:14.24416,cy2:.56262,x:13.98698,y:.80212},{op:"C",cx1:13.72958,cy1:1.04139,cx2:13.60383,cy2:1.35272,x:13.60383,y:1.74176},{op:"C",cx1:13.60383,cy1:2.10677,cx2:13.70556,cy2:2.424,x:13.91516,y:2.70518},{op:"C",cx1:14.12452,cy1:2.98048,cx2:14.45375,cy2:3.34575,x:14.91464,y:3.7946},{op:"C",cx1:15.37551,cy1:4.24346,cx2:15.72261,cy2:4.65626,x:15.9619,y:5.03332},{op:"C",cx1:16.20729,cy1:5.40444,cx2:16.32715,cy2:5.83541,x:16.32715,y:6.32621},{op:"C",cx1:16.35708,cy1:7.82844,cx2:15.01635,cy2:8.89386,x:13.70558,y:8.87572},{op:"C",cx1:13.47219,cy1:8.87572,cx2:13.12508,cy2:8.79188,x:12.65219,y:8.63033},{op:"C",cx1:12.17955,cy1:8.46874,cx2:11.86231,cy2:8.38489,x:11.69463,y:8.38489},{op:"C",cx1:11.45538,cy1:8.38489,cx2:11.25778,cy2:8.60652,x:11.20385,y:8.82787},{op:"L",x:10.95848,y:8.82787},{op:"L",x:11.40145,y:6.00895},{op:"L",x:11.69464,y:6.00895},{op:"C",cx1:11.69464,cy1:6.12272,cx2:11.67678,cy2:6.24847,x:11.64684,y:6.374},{op:"C",cx1:11.67065,cy1:6.93075,cx2:11.85619,cy2:7.40948,x:12.20332,y:7.82232},{op:"C",cx1:12.55657,cy1:8.22948,cx2:13.00544,cy2:8.43297,x:13.55603,y:8.43297},{op:"C",cx1:14.02891,cy1:8.43297,cx2:14.42384,cy2:8.26529,x:14.74108,y:7.92405},{op:"C",cx1:15.06418,cy1:7.58305,cx2:15.22573,cy2:7.18198,x:15.22573,y:6.72112},{op:"C",cx1:15.22573,cy1:6.34406,cx2:15.11223,cy2:6.00313,x:14.89062,y:5.69764},{op:"C",cx1:14.66925,cy1:5.39246,cx2:14.32802,cy2:5.00951,x:13.85538,y:4.54279},{op:"C",cx1:13.38247,cy1:4.07579,cx2:13.03535,cy2:3.67473,x:12.80197,y:3.33374},{op:"C",cx1:12.56858,cy1:2.99248,cx2:12.45484,cy2:2.59756,x:12.45484,y:2.16072},{op:"C",cx1:12.45484,cy1:1.53216,cx2:12.67621,cy2:1.01761,x:13.12509,y:.61042},{op:"C",cx1:13.57395,cy1:.20348,cx2:14.11864,cy2:2e-5,x:14.75896,y:2e-5},{op:"C",cx1:15.18993,cy1:2e-5,cx2:15.55495,cy2:.05983,x:15.86016,y:.17358},{op:"C",cx1:16.16536,cy1:.28733,cx2:16.38697,cy2:.34714,x:16.52452,y:.34714},{op:"C",cx1:16.6922,cy1:.34714,cx2:16.86576,cy2:.23339,x:17.03932,y:2e-5},{op:"L",x:17.33249,y:2e-5},{op:"L",x:17.3325,y:1e-5},{op:"Z"},{op:"M",x:8.43275,y:7.87042},{op:"C",cx1:8.43275,cy1:7.69072,cx2:8.4987,cy2:7.5353,x:8.63622,y:7.3975},{op:"C",cx1:8.774,cy1:7.25976,cx2:8.94755,cy2:7.18816,x:9.14514,y:7.18816},{op:"C",cx1:9.3187,cy1:7.18816,cx2:9.46824,cy2:7.25975,x:9.59988,y:7.3975},{op:"C",cx1:9.73766,cy1:7.53529,cx2:9.80338,cy2:7.69685,x:9.80338,y:7.87042},{op:"C",cx1:9.80338,cy1:8.28325,cx2:9.5043,cy2:8.58254,x:9.14514,y:8.58254},{op:"C",cx1:8.7382,cy1:8.58254,cx2:8.43275,cy2:8.29521,x:8.43275,y:7.87042},{op:"Z"},{op:"M",x:16.88952,y:7.9721},{op:"C",cx1:16.88952,cy1:7.57106,cx2:17.21875,cy2:7.28373,x:17.62569,y:7.28373},{op:"C",cx1:18.00297,cy1:7.28373,cx2:18.29003,cy2:7.56516,x:18.29003,y:7.9721},{op:"C",cx1:18.29003,cy1:8.34914,cx2:17.99096,cy2:8.63036,x:17.62569,y:8.63036},{op:"C",cx1:17.42219,cy1:8.63036,cx2:17.24863,cy2:8.56461,x:17.105,y:8.43887},{op:"C",cx1:16.96135,cy1:8.31309,cx2:16.88952,cy2:8.1577,x:16.88952,y:7.9721},{op:"Z"}],style:{fill:"#000"}}],playbackMarks:()=>[we],onVisit:(r,t)=>r.visits(t)>1?void 0:{kind:"jump",column:r.seek(Co,t,-1)??0}};var dc={m:[{op:"M",x:1.13,y:10.3672},{op:"L",x:2.9911,y:5.3125},{op:"C",cx1:3.0585,cy1:5.0607,cx2:3.0955,cy2:4.8889,x:3.0955,y:4.8089},{op:"C",cx1:3.0955,cy1:4.6248,cx2:2.9972,cy2:4.5327,x:2.7944,y:4.5327},{op:"C",cx1:2.5489,cy1:4.5327,cx2:2.217,cy2:4.7782,x:1.7994,y:5.2758},{op:"C",cx1:1.3881,cy1:5.7671,cx2:.9766,cy2:6.4856,x:.5774,y:7.4254},{op:"L",x:0,y:7.4254},{op:"C",cx1:.4976,cy1:6.3628,cx2:1.0133,cy2:5.4783,x:1.5476,y:4.7782},{op:"C",cx1:2.0882,cy1:4.0781,cx2:2.7576,cy2:3.7279,x:3.5498,y:3.7279},{op:"C",cx1:4.1518,cy1:3.7279,cx2:4.4773,cy2:4.0534,x:4.5264,y:4.7045},{op:"C",cx1:5.2818,cy1:4.0167,cx2:5.9512,cy2:3.6728,x:6.5409,y:3.6728},{op:"C",cx1:7.1796,cy1:3.6728,cx2:7.5235,cy2:4.0167,x:7.5728,y:4.7045},{op:"C",cx1:7.8797,cy1:4.3976,cx2:8.2483,cy2:4.1518,x:8.6843,y:3.9614},{op:"C",cx1:9.1205,cy1:3.7709,cx2:9.5197,cy2:3.6728,x:9.8882,y:3.6728},{op:"C",cx1:10.5393,cy1:3.6728,cx2:10.8645,cy2:3.943,x:10.8645,y:4.4834},{op:"C",cx1:10.8645,cy1:4.6001,cx2:10.8339,cy2:4.7905,x:10.7664,y:5.0607},{op:"L",x:9.3846,y:9.0345},{op:"C",cx1:9.3109,cy1:9.3353,cx2:9.2616,cy2:9.4951,x:9.2309,y:9.6364},{op:"C",cx1:9.2309,cy1:9.7959,cx2:9.3169,cy2:9.9066,x:9.4827,y:9.9619},{op:"C",cx1:10.011,cy1:9.8943,cx2:10.6988,cy2:9.1512,x:11.5463,y:7.7263},{op:"L",x:12.0499,y:7.7263},{op:"C",cx1:11.7981,cy1:8.1502,cx2:11.5279,cy2:8.6045,x:11.227,y:9.0958},{op:"C",cx1:10.9322,cy1:9.5811,cx2:10.6006,cy2:9.9864,x:10.2381,y:10.2996},{op:"C",cx1:9.8759,cy1:10.613,cx2:9.4583,cy2:10.7725,x:8.9791,y:10.7725},{op:"C",cx1:8.1499,cy1:10.7725,cx2:7.6279,cy2:10.3919,x:7.4191,y:9.6365},{op:"C",cx1:7.4437,cy1:9.397,cx2:7.5235,cy2:9.0775,x:7.6649,y:8.6783},{op:"C",cx1:7.806,cy1:8.279,cx2:7.8797,cy2:8.0395,x:7.8981,y:7.9535},{op:"L",x:8.9054,y:5.3619},{op:"C",cx1:8.924,cy1:5.2572,cx2:8.9791,cy2:5.0117,x:8.9791,y:4.9073},{op:"C",cx1:8.9791,cy1:4.6922,cx2:8.887,cy2:4.5818,x:8.7028,y:4.5818},{op:"C",cx1:8.1992,cy1:4.5818,cx2:7.8246,cy2:4.9257,x:7.5728,y:5.6137},{op:"L",x:5.8838,y:10.3673},{op:"L",x:4.0781,y:10.3673},{op:"L",x:5.9389,y:5.2635},{op:"C",cx1:5.9696,cy1:5.1591,cx2:5.9882,cy2:5.0424,x:5.9882,y:4.9073},{op:"C",cx1:5.9882,cy1:4.6922,cx2:5.8592,cy2:4.5818,x:5.6073,y:4.5818},{op:"C",cx1:5.159,cy1:4.6002,cx2:4.8335,cy2:4.944,x:4.6308,y:5.6137},{op:"L",x:2.8927,y:10.3673},{op:"L",x:1.13,y:10.3673},{op:"L",x:1.13,y:10.3672},{op:"Z"}],f:[{op:"M",x:6.1601,y:4.0781},{op:"C",cx1:6.4302,cy1:3.3717,cx2:6.8234,cy2:2.7086,x:7.3391,y:2.0882},{op:"C",cx1:7.8551,cy1:1.4679,cx2:8.4754,cy2:.9642,x:9.2062,y:.5773},{op:"C",cx1:9.937,cy1:.1904,cx2:10.7355,cy2:0,x:11.5953,y:0},{op:"C",cx1:12.0559,cy1:.043,cx2:12.4061,cy2:.2088,x:12.6333,y:.4913},{op:"C",cx1:12.8607,cy1:.7678,cx2:12.9772,cy2:1.1117,x:12.9772,y:1.5109},{op:"C",cx1:12.9772,cy1:1.9345,cx2:12.8421,cy2:2.3154,x:12.5659,y:2.6472},{op:"C",cx1:12.2954,cy1:2.9788,cx2:11.9578,cy2:3.1446,x:11.5463,y:3.1446},{op:"C",cx1:11.0487,cy1:3.1446,cx2:10.7662,cy2:2.9174,x:10.7111,y:2.4691},{op:"C",cx1:10.7418,cy1:2.1743,cx2:10.8522,cy2:1.8918,x:11.0427,y:1.6276},{op:"C",cx1:11.2331,cy1:1.3635,cx2:11.4666,cy2:1.1793,x:11.7428,y:1.087},{op:"C",cx1:11.8472,cy1:1.087,cx2:11.8965,cy2:1.0379,x:11.8965,y:.9335},{op:"C",cx1:11.8965,cy1:.8108,cx2:11.614,cy2:.6327,x:11.2147,y:.6327},{op:"C",cx1:10.0908,cy1:.6327,cx2:9.237,cy2:1.7811,x:8.6535,y:4.0781},{op:"L",x:10.8646,y:4.0781},{op:"L",x:10.8646,y:4.9073},{op:"L",x:8.4508,y:4.9073},{op:"C",cx1:8.2483,cy1:5.7918,cx2:7.9902,cy2:6.6944,x:7.671,y:7.6156},{op:"C",cx1:7.3577,cy1:8.5308,cx2:7.026,cy2:9.3723,x:6.676,y:10.1401},{op:"C",cx1:6.3319,cy1:10.9076,cx2:6.0064,cy2:11.5156,x:5.7055,y:11.9762},{op:"C",cx1:5.2632,cy1:12.658,cx2:4.7966,cy2:13.2353,x:4.299,y:13.7145},{op:"C",cx1:3.8016,cy1:14.1995,cx2:3.206,cy2:14.5067,x:2.5119,y:14.6418},{op:"C",cx1:2.211,cy1:14.6788,cx2:2.0266,cy2:14.6972,x:1.9592,y:14.6972},{op:"C",cx1:1.3632,cy1:14.6972,cx2:.8905,cy2:14.5128,x:.5527,y:14.1382},{op:"C",cx1:.2149,cy1:13.7636,cx2:.0307,cy2:13.3276,x:0,y:12.83},{op:"C",cx1:.0428,cy1:12.3941,cx2:.1718,cy2:12.0623,x:.3869,y:11.8351},{op:"C",cx1:.6017,cy1:11.6079,cx2:.9149,cy2:11.4298,x:1.3326,y:11.3008},{op:"C",cx1:1.6458,cy1:11.3254,cx2:1.9039,cy2:11.4359,x:2.1066,y:11.6324},{op:"C",cx1:2.3091,cy1:11.8352,cx2:2.4135,cy2:12.0809,x:2.4135,y:12.3818},{op:"C",cx1:2.4135,cy1:12.9405,cx2:1.8548,cy2:13.4134,x:1.4309,y:13.8127},{op:"C",cx1:1.4309,cy1:13.9171,cx2:1.5476,cy2:13.9664,x:1.7811,y:13.9664},{op:"C",cx1:2.7453,cy1:13.9664,cx2:3.5129,cy2:12.9405,x:4.0718,y:10.8955},{op:"C",cx1:4.2683,cy1:10.3426,cx2:4.4404,cy2:9.8083,x:4.5938,y:9.2926},{op:"C",cx1:4.7475,cy1:8.7703,cx2:4.9624,cy2:8.0028,x:5.2449,y:6.9832},{op:"C",cx1:5.5337,cy1:5.9575,cx2:5.7362,cy2:5.2695,x:5.8592,y:4.9073},{op:"L",x:4.1702,y:4.9073},{op:"L",x:4.1702,y:4.0781},{op:"L",x:6.1601,y:4.0781},{op:"Z"}],p:[{op:"M",x:3.767,y:8.5573},{op:"L",x:5.0097,y:5.0738},{op:"C",cx1:5.0804,cy1:4.7969,cx2:5.1126,cy2:4.5909,x:5.1126,y:4.443},{op:"C",cx1:5.1126,cy1:4.2497,cx2:5.0224,cy2:4.1531,x:4.8486,y:4.1531},{op:"C",cx1:4.7262,cy1:4.1531,cx2:4.5653,cy2:4.2497,x:4.3786,y:4.443},{op:"C",cx1:3.9471,cy1:4.9001,cx2:3.6059,cy2:5.383,x:3.3484,y:5.8917},{op:"L",x:2.6851,y:5.8917},{op:"C",cx1:2.8138,cy1:5.5117,cx2:3.0264,cy2:5.1126,x:3.3163,y:4.7004},{op:"C",cx1:3.6059,cy1:4.2818,cx2:3.9471,cy2:3.9406,x:4.3335,y:3.6702},{op:"C",cx1:4.7262,cy1:3.3933,cx2:5.1192,cy2:3.258,x:5.5119,y:3.258},{op:"C",cx1:6.1623,cy1:3.258,cx2:6.613,cy2:3.5671,x:6.8575,y:4.179},{op:"C",cx1:7.1987,cy1:3.8891,cx2:7.6044,cy2:3.6444,x:8.0617,y:3.4447},{op:"C",cx1:8.5188,cy1:3.2454,cx2:8.9632,cy2:3.1486,x:9.388,y:3.1486},{op:"C",cx1:10.1286,cy1:3.1486,cx2:10.7017,cy2:3.4447,x:11.1008,y:4.0437},{op:"C",cx1:11.5064,cy1:4.636,cx2:11.706,cy2:5.3249,x:11.706,y:6.104},{op:"C",cx1:11.706,cy1:6.8187,cx2:11.5322,cy2:7.5464,x:11.178,y:8.274},{op:"C",cx1:10.8304,cy1:9.0017,cx2:10.3538,cy2:9.6004,x:9.7422,y:10.0704},{op:"C",cx1:9.1306,cy1:10.5406,cx2:8.4607,cy2:10.7724,x:7.7267,y:10.7724},{op:"C",cx1:7.0442,cy1:10.7724,cx2:6.4133,cy2:10.5148,x:5.8273,y:10.006},{op:"L",x:4.7972,y:12.9614},{op:"C",cx1:4.765,cy1:13.0453,cx2:4.7133,cy2:13.1998,x:4.6426,y:13.4122},{op:"C",cx1:4.6684,cy1:13.6377,cx2:4.7842,cy2:13.7922,x:4.9902,y:13.8695},{op:"C",cx1:5.2028,cy1:13.9531,cx2:5.5504,cy2:13.9919,x:6.0399,y:13.9919},{op:"L",x:6.0399,y:14.8095},{op:"L",x:0,y:14.8095},{op:"L",x:0,y:13.9919},{op:"C",cx1:.7469,cy1:13.9919,cx2:1.2815,cy2:13.8759,x:1.5969,y:13.6506},{op:"C",cx1:1.9124,cy1:13.4251,cx2:2.1379,cy2:13.1289,x:2.2666,y:12.7491},{op:"L",x:3.767,y:8.5573},{op:"Z"},{op:"M",x:7.0637,y:6.3166},{op:"C",cx1:6.7802,cy1:6.9604,cx2:6.6064,cy2:7.8104,x:6.5357,y:8.8727},{op:"C",cx1:6.6064,cy1:9.5619,cx2:6.7609,cy2:9.9031,x:7.012,y:9.9031},{op:"C",cx1:7.8879,cy1:9.7356,cx2:8.609,cy2:8.7248,x:9.1755,y:6.8704},{op:"C",cx1:9.3495,cy1:6.2071,cx2:9.4395,cy2:5.6084,x:9.4395,y:5.0738},{op:"C",cx1:9.4395,cy1:4.4108,cx2:9.2657,cy2:4.05,x:8.9115,y:3.9923},{op:"C",cx1:8.332,cy1:3.9923,cx2:7.7139,cy2:4.7647,x:7.0637,y:6.3166},{op:"Z"}]},xc={mf:8.0028,mp:9.523,ff:6.67866,pp:8.8083},mc={fill:"#000"},yc=.79341;function Et(r,t,e){let n=0,o=Array.from(r,(s,i)=>{let c={path:dc[s],style:mc,dx:n};return n+=xc[s+r[i+1]]??0,c});return{name:r,description:e,shapes:o,weight:r.includes("f")?1:yc,onTimeState:s=>{s.velocity=t}}}var yi=[Et("ppp",16,"\u6781\u5F31"),Et("pp",32,"\u5F88\u5F31"),Et("p",48,"\u5F31"),Et("mp",64,"\u4E2D\u5F31"),Et("mf",80,"\u4E2D\u5F3A"),Et("f",96,"\u5F3A"),Et("ff",112,"\u5F88\u5F3A"),Et("fff",127,"\u6781\u5F3A")];var gc={},gi={name:"fermata",description:"\u5EF6\u957F\u8BB0\u53F7\uFF1A\u8986\u76D6\u533A\u95F4\u901F\u5EA6\u51CF\u534A\uFF0C\u76EE\u6807\u97F3\u5B9E\u9645\u65F6\u957F\u7FFB\u500D",weight:.6,paddingBottom:3,shapes:[{path:[{op:"M",x:0,y:7.46666},{op:"C",cx1:3.65834,cy1:0,cx2:8.53611,cy2:0,x:12.19445,y:7.46666},{op:"M",x:12.19445,y:7.46666},{op:"C",cx1:8.53611,cy1:.74666,cx2:3.65833,cy2:.74666,x:0,y:7.46666}],style:{fill:"#000",stroke:"#000",strokeWidth:1}},{circle:{cx:6.09723,cy:6.26666,r:1.2},style:{fill:"#000"}}],emitPlayback:r=>r.scaleFollowingBpm(gc,1,2,{followConnections:!0})};var bi={name:"fine",description:"\u7EC8\u6B62\u8BB0\u53F7\uFF1A\u56DE\u8DF3\u4E4B\u540E\u7ECF\u8FC7\u8FD9\u91CC\u5C31\u7ED3\u675F\u4E50\u66F2",weight:1.4,text:{content:"Fine.",fontFamily:'"Times New Roman", serif'},onVisit:(r,t)=>{let e=r.seek(we,t,1);return e!==void 0&&r.visits(e)>0?{kind:"stop"}:void 0}};function te(r){return(t,e)=>{let n=[];for(let o of e){if(!o.transpose){n.push(o);continue}let s=o.end.clone().sub(o.start),i=t.stateAt(o.start).effectiveBpm,c=r.repeat?bc(r.body,s.toNumber(),i):r.body,a=s.div(c.length);for(let l=0;l<c.length;l++){let h=c[l],p=a.clone().mul(l).add(o.start);n.push({...o,start:p,end:p.clone().add(a),midi:h===0?o.midi:o.transpose(h),transpose:f=>o.transpose(h+f)})}}return n}}function bc(r,t,e){let n=Math.min(480,Math.max(60,e))/e,o=Math.floor(256/r.length),s=Math.min(o,Math.max(1,Math.round(t*8*n/r.length))),i=[];for(let c=0;c<s;c++)i.push(...r);return i}var wi={name:"mordent",description:"\u4E0B\u6CE2\u97F3\uFF1A\u672C\u97F3\u3001\u8C03\u5185\u4E0B\u65B9\u4E8C\u5EA6\u3001\u672C\u97F3",weight:.73423,shapes:[{path:[{op:"M",x:7.29541,y:.05944},{op:"C",cx1:7.56541,cy1:-.09056,cx2:7.92541,cy2:.05944,x:8.04541,y:.32944},{op:"C",cx1:8.10541,cy1:.44944,cx2:8.10541,cy2:.56944,x:8.10541,y:1.76943},{op:"L",x:8.10541,y:3.05943},{op:"L",x:8.67541,y:2.21943},{op:"C",cx1:9.18541,cy1:1.46943,cx2:9.24541,cy2:1.37943,x:9.36541,y:1.31943},{op:"C",cx1:9.42541,cy1:1.28943,cx2:9.54541,cy2:1.25943,x:9.60541,y:1.25943},{op:"C",cx1:9.90541,cy1:1.25943,cx2:9.87541,cy2:1.22943,x:11.49541,y:3.20943},{op:"L",x:13.02541,y:5.03943},{op:"L",x:13.50541,y:4.34943},{op:"C",cx1:14.01541,cy1:3.56943,cx2:14.04541,cy2:3.50943,x:14.19541,y:3.44943},{op:"C",cx1:14.61541,cy1:3.26943,cx2:15.06541,cy2:3.59943,x:15.00541,y:4.04943},{op:"C",cx1:14.97541,cy1:4.16943,cx2:14.70541,cy2:4.55943,x:13.50541,y:6.41943},{op:"C",cx1:12.12541,cy1:8.48943,cx2:12.00541,cy2:8.63943,x:11.88541,y:8.69943},{op:"C",cx1:11.82541,cy1:8.72943,cx2:11.70541,cy2:8.75943,x:11.64541,y:8.75943},{op:"C",cx1:11.34541,cy1:8.75943,cx2:11.37541,cy2:8.78943,x:9.81541,y:6.86943},{op:"C",cx1:9.00541,cy1:5.87943,cx2:8.31541,cy2:5.06943,x:8.28541,y:5.00943},{op:"C",cx1:8.22541,cy1:4.97943,cx2:8.22541,cy2:4.97943,x:8.16541,y:5.03943},{op:"C",cx1:8.10541,cy1:5.09943,cx2:8.10541,cy2:5.18943,x:8.10541,y:7.31943},{op:"C",cx1:8.10541,cy1:9.26943,cx2:8.10541,cy2:9.56943,x:8.04541,y:9.65943},{op:"C",cx1:7.86541,cy1:10.10943,cx2:7.23541,cy2:10.13943,x:6.99541,y:9.68943},{op:"C",cx1:6.96541,cy1:9.62943,cx2:6.93541,cy2:9.44943,x:6.93541,y:8.27943},{op:"L",x:6.93541,y:6.92943},{op:"L",x:6.36541,y:7.76943},{op:"C",cx1:5.82541,cy1:8.54943,cx2:5.76541,cy2:8.63943,x:5.64541,y:8.69943},{op:"C",cx1:5.58541,cy1:8.72943,cx2:5.46541,cy2:8.75943,x:5.40541,y:8.75943},{op:"C",cx1:5.10541,cy1:8.75943,cx2:5.13541,cy2:8.78943,x:3.51541,y:6.80943},{op:"L",x:1.98541,y:4.97943},{op:"L",x:1.50541,y:5.66943},{op:"C",cx1:.99541,cy1:6.44943,cx2:.96541,cy2:6.50943,x:.81541,y:6.56943},{op:"C",cx1:.39541,cy1:6.74943,cx2:-.05459,cy2:6.41943,x:.00541,y:5.96943},{op:"C",cx1:.03541,cy1:5.84943,cx2:.30541,cy2:5.45943,x:1.50541,y:3.59943},{op:"C",cx1:2.88541,cy1:1.52943,cx2:3.00541,cy2:1.37943,x:3.12541,y:1.31943},{op:"C",cx1:3.18541,cy1:1.28943,cx2:3.30541,cy2:1.25943,x:3.36541,y:1.25943},{op:"C",cx1:3.66541,cy1:1.25943,cx2:3.63541,cy2:1.22943,x:5.25541,y:3.20943},{op:"L",x:6.78541,y:5.03943},{op:"C",cx1:6.81541,cy1:5.03943,cx2:6.84541,cy2:4.97943,x:6.87541,y:4.94943},{op:"C",cx1:6.93541,cy1:4.82943,cx2:6.93541,cy2:4.79943,x:6.93541,y:2.66943},{op:"C",cx1:6.93541,cy1:.74943,cx2:6.93541,cy2:.44943,x:6.99541,y:.35943},{op:"C",cx1:7.05541,cy1:.20943,cx2:7.14541,cy2:.11943,x:7.29541,y:.05943},{op:"Z"}],style:{fill:"#000"}}],emitPlayback:r=>r.affectFollowing(te({body:[0,-1,0]}))};var Si={name:"prall",description:"\u4E0A\u6CE2\u97F3\uFF1A\u672C\u97F3\u3001\u8C03\u5185\u4E0A\u65B9\u4E8C\u5EA6\u3001\u672C\u97F3",weight:.55,shapes:[{path:[{op:"M",x:3.12541,y:.06003},{op:"C",cx1:3.18541,cy1:.03003,cx2:3.30541,cy2:3e-5,x:3.36541,y:3e-5},{op:"C",cx1:3.66541,cy1:3e-5,cx2:3.63541,cy2:-.02997,x:5.25541,y:1.95003},{op:"L",x:6.78541,y:3.78003},{op:"C",cx1:6.81541,cy1:3.78003,cx2:7.35541,cy2:2.94003,x:8.01541,y:1.95003},{op:"C",cx1:9.15541,cy1:.27003,cx2:9.24541,cy2:.12003,x:9.36541,y:.06003},{op:"C",cx1:9.42541,cy1:.03003,cx2:9.54541,cy2:3e-5,x:9.60541,y:3e-5},{op:"C",cx1:9.90541,cy1:3e-5,cx2:9.87541,cy2:-.02997,x:11.49541,y:1.95003},{op:"L",x:13.02541,y:3.78003},{op:"L",x:13.50541,y:3.09003},{op:"C",cx1:14.01541,cy1:2.31003,cx2:14.04541,cy2:2.25003,x:14.19541,y:2.19003},{op:"C",cx1:14.61541,cy1:2.01003,cx2:15.06541,cy2:2.34003,x:15.00541,y:2.79003},{op:"C",cx1:14.97541,cy1:2.91003,cx2:14.70541,cy2:3.30003,x:13.50541,y:5.16003},{op:"C",cx1:12.12541,cy1:7.23003,cx2:12.00541,cy2:7.38003,x:11.88541,y:7.44003},{op:"C",cx1:11.82541,cy1:7.47003,cx2:11.70541,cy2:7.50003,x:11.64541,y:7.50003},{op:"C",cx1:11.34541,cy1:7.50003,cx2:11.37541,cy2:7.53003,x:9.75541,y:5.55003},{op:"L",x:8.22541,y:3.72003},{op:"C",cx1:8.19541,cy1:3.72003,cx2:7.65541,cy2:4.56003,x:6.99541,y:5.55003},{op:"C",cx1:5.85541,cy1:7.23003,cx2:5.76541,cy2:7.38003,x:5.64541,y:7.44003},{op:"C",cx1:5.58541,cy1:7.47003,cx2:5.46541,cy2:7.50003,x:5.40541,y:7.50003},{op:"C",cx1:5.10541,cy1:7.50003,cx2:5.13541,cy2:7.53003,x:3.51541,y:5.55003},{op:"L",x:1.98541,y:3.72003},{op:"L",x:1.50541,y:4.41003},{op:"C",cx1:.99541,cy1:5.19003,cx2:.96541,cy2:5.25003,x:.81541,y:5.31003},{op:"C",cx1:.39541,cy1:5.49003,cx2:-.05459,cy2:5.16003,x:.00541,y:4.71004},{op:"C",cx1:.03541,cy1:4.59004,cx2:.30541,cy2:4.20004,x:1.50541,y:2.34004},{op:"C",cx1:2.88541,cy1:.27004,cx2:3.00541,cy2:.12004,x:3.12541,y:.06004},{op:"Z"}],style:{fill:"#000"}}],emitPlayback:r=>r.affectFollowing(te({body:[0,1,0]}))};var Ci={name:"tr",description:"\u98A4\u97F3\uFF1A\u672C\u97F3\u4E0E\u8C03\u5185\u4E0A\u65B9\u4E8C\u5EA6\u4EA4\u66FF",shapes:[{path:[{op:"M",x:3.17992,y:5.46383},{op:"L",x:3.61827,y:3.91711},{op:"C",cx1:3.10024,cy1:3.49862,cx2:2.52947,cy2:3.29304,x:1.90541,y:3.29304},{op:"C",cx1:1.50051,cy1:3.29304,cx2:1.18833,cy2:3.40589,x:.95611,y:3.63812},{op:"C",cx1:.72361,cy1:3.87061,cx2:.59743,cy2:4.14281,x:.57105,y:4.46152},{op:"C",cx1:.57105,cy1:4.91944,cx2:.71707,cy2:5.25147,x:1.00913,y:5.47036},{op:"C",cx1:1.30118,cy1:5.68954,cx2:1.61988,cy2:5.79586,x:1.95843,y:5.79586},{op:"C",cx1:1.9916,cy1:5.79586,cx2:2.03157,cy2:5.8157,x:2.06475,y:5.84888},{op:"C",cx1:2.24394,cy1:5.82904,cx2:2.61568,cy2:5.69632,x:3.17992,y:5.46383},{op:"Z"},{op:"M",x:6.579,y:9.87204},{op:"L",x:8.40472,y:3.75096},{op:"C",cx1:8.40472,cy1:3.59162,cx2:8.35167,cy2:3.51193,x:8.23884,y:3.51193},{op:"C",cx1:7.98647,cy1:3.51193,cx2:7.4554,cy2:3.77761,x:6.63883,y:4.3152},{op:"C",cx1:5.82223,cy1:4.84655,cx2:5.37735,cy2:5.15845,x:5.30448,y:5.25145},{op:"C",cx1:5.33764,cy1:5.21147,cx2:5.39068,cy2:5.15845,x:5.46383,y:5.0853},{op:"C",cx1:6.13441,cy1:6.06127,cx2:6.47294,cy2:6.98417,x:6.47294,y:7.86061},{op:"C",cx1:6.41313,cy1:8.53088,cx2:6.18062,cy2:9.12181,x:5.7692,y:9.61968},{op:"C",cx1:5.3643,cy1:10.11758,cx2:4.85308,cy2:10.3634,x:4.24233,y:10.3634},{op:"C",cx1:3.71778,cy1:10.3634,cx2:3.25306,cy2:10.23719,x:2.83483,y:9.99138},{op:"C",cx1:2.42314,cy1:9.74586,cx2:2.20396,cy2:9.39396,x:2.17759,y:8.92271},{op:"C",cx1:2.21077,cy1:8.80986,cx2:2.23061,cy2:8.66384,x:2.23061,y:8.48436},{op:"L",x:2.85469,y:6.0944},{op:"C",cx1:2.58903,cy1:6.2339,cx2:2.21729,cy2:6.30702,x:1.73924,y:6.30702},{op:"C",cx1:1.22829,cy1:6.2804,cx2:.81007,cy2:6.1012,x:.48458,y:5.76917},{op:"C",cx1:.15935,cy1:5.43065,cx2:0,cy2:4.97926,x:0,y:4.4082},{op:"C",cx1:.03318,cy1:3.89045,cx2:.20586,cy2:3.46543,x:.53107,y:3.13369},{op:"C",cx1:.8563,cy1:2.80166,cx2:1.32782,cy2:2.63579,x:1.95843,y:2.63579},{op:"C",cx1:2.55585,cy1:2.63579,cx2:3.17992,cy2:2.87481,x:3.83716,y:3.34606},{op:"L",x:4.89277,y:0},{op:"L",x:6.85119,y:0},{op:"L",x:5.41053,y:4.51453},{op:"C",cx1:6.28694,cy1:3.83064,cx2:7.02389,cy2:3.34606,x:7.62128,y:3.06054},{op:"C",cx1:8.21899,cy1:2.77502,cx2:8.86943,cy2:2.63579,x:9.57321,y:2.63579},{op:"C",cx1:10.05773,cy1:2.63579,cx2:10.30358,cy2:2.83484,x:10.30358,y:3.23974},{op:"C",cx1:10.30358,cy1:3.44559,cx2:10.17738,cy2:3.89046,x:10.09093,y:4.18931},{op:"C",cx1:10.7283,cy1:3.15354,cx2:11.45195,cy2:2.63579,x:12.26199,y:2.63579},{op:"C",cx1:12.6272,cy1:2.63579,cx2:12.91925,cy2:2.76849,x:13.14497,y:3.03417},{op:"C",cx1:13.37717,cy1:3.29957,cx2:13.49001,cy2:3.61175,x:13.49001,y:3.97014},{op:"C",cx1:13.49001,cy1:4.62739,cx2:13.09844,cy2:5.03228,x:12.53419,y:5.03228},{op:"C",cx1:12.16899,cy1:5.03228,cx2:11.85709,cy2:4.79327,x:11.80382,y:4.29536},{op:"C",cx1:11.89029,cy1:3.91031,cx2:11.98982,cy2:3.55191,x:11.98982,y:3.34606},{op:"C",cx1:11.98982,cy1:3.27291,cx2:11.94329,cy2:3.23973,x:11.85709,y:3.23973},{op:"C",cx1:11.74403,cy1:3.23973,cx2:11.53162,cy2:3.34606,x:11.20637,y:3.56522},{op:"C",cx1:10.90752,cy1:3.7708,cx2:10.61547,cy2:4.11615,x:10.31666,y:4.61405},{op:"C",cx1:10.01808,cy1:5.11195,cx2:9.77253,cy2:5.69632,x:9.57321,y:6.36662},{op:"L",x:8.45798,y:9.87203},{op:"L",x:6.57899,y:9.87203},{op:"L",x:6.579,y:9.87204},{op:"Z"},{op:"M",x:5.05893,y:5.62971},{op:"L",x:3.94348,y:8.92274},{op:"C",cx1:3.94348,cy1:9.0288,cx2:3.92364,cy2:9.12179,x:3.89045,y:9.19495},{op:"C",cx1:3.89045,cy1:9.48047,cx2:4.06285,cy2:9.65287,x:4.40821,y:9.70617},{op:"C",cx1:5.404,cy1:9.22134,cx2:5.9019,cy2:8.51787,x:5.9019,y:7.58841},{op:"C",cx1:5.9019,cy1:6.99751,cx2:5.62318,cy2:6.34681,x:5.05893,y:5.62972},{op:"L",x:5.05893,y:5.62971},{op:"Z"}],style:{fill:"#000"}}],emitPlayback:r=>r.affectFollowing(te({body:[0,1],repeat:!0}))};var Ai=new Map([Ci,gi,Si,wi,ui,...yi,di,mi,xi,bi].map(r=>[r.name.toLowerCase(),r])),Ao=class extends _{static def={name:["symbol","$"],description:"\u521B\u5EFA\u4E00\u4E2A\u4E50\u8C31\u7B26\u53F7",details:`~~~jpfun
|
|
68
72
|
1 ^ @symbol(p, size=0.5em)
|
|
69
73
|
~~~
|
|
70
74
|
**\u7B80\u5199**\uFF1A\`$name\`\uFF0C\u5982 \`1 ^ $p\`
|
|
71
75
|
|
|
72
76
|
**\u5185\u7F6E\u8BB0\u53F7**
|
|
73
|
-
${[...
|
|
74
|
-
`)}`,allowExtraArgs:!1,args:[{name:"name",description:"\u5185\u7F6E\u8BB0\u53F7\u540D\u79F0\uFF0C\u89C1\u51FD\u6570\u8BF4\u660E\u4E2D\u7684\u8BB0\u53F7\u5217\u8868",type:"string",default:null},{name:"size",description:"\u8BB0\u53F7\u5C3A\u5BF8",type:"length",default:{value:.5,unit:"em"}}]};static deSugarAtom(t,e,n){if(t[e]!=="$"||!/[A-Za-z]/.test(t[e+1]??""))return null;let o=e+2;for(;o<n&&/[A-Za-z0-9_-]/.test(t[o]);)o++;let s=t.slice(e+1,o);return{next:o,node:{kind:"call",typed:!0,name:"symbol",args:new Map([[0,s]]),span:{start:e,end:o},syntaxKind:"atom"}}}size;definition;constructor(t,e,n,o=null){super(t,o);let[s,r]=this.getArgValue(e,n);this.size=n.length2px(r);let c=ii.get(s.toLowerCase());if(!c){let a=`@symbol: \u672A\u77E5\u7B26\u53F7: $${s}`;if(n.variables.strict)throw new S("E_UNKNOWN_SYMBOL",a,t);n.diagnostics.push(new O("W_UNKNOWN_SYMBOL",a,t));return}this.definition=c}loweringEnter(){return[this.definition?new lo(this):new W]}toString(t){return this.definition?`@symbol(${this.definition.name})`:super.toString(t)}},ri=ao,lo=class extends W{bounds;height;label;scale=1;baseline=0;constructor(t){super(),this.ast=t,this.mergeKey=ht,this.onTimeState=t.definition.onTimeState,this.emitPlayback=t.definition.emitPlayback,this.playbackMarks=t.definition.playbackMarks,this.bounds=Us(t.definition.shapes??[]),this.height=t.size*(t.definition.weight??1);let e=t.definition.text;this.label=e&&{content:e.content,style:{fontSize:this.height,fontFamily:e.fontFamily}},this.initLayoutBox()}prepareLayout(t){if(this.label){let e=t.textMeasurer.measureText(this.label.content,this.label.style);this.box.w=e.w,this.box.h=e.h,this.baseline=e.baseline}else this.scale=this.height/this.bounds.h,this.box.w=this.bounds.w*this.scale,this.box.h=this.height+(this.ast.definition.paddingBottom??0)*this.scale;this.box.anchor=this.box.w/2,this.box.visualAxis=this.box.h/2}paint(t){this.label?t.drawText(this.label.content,this.box.x,this.box.y+this.baseline,this.label.style):js(t,this.ast.definition.shapes??[],this.bounds,this.box,this.scale)}playbackFlow(t){let e=this.ast.definition.onVisit;if(!e)return;let n=t(this);return n===void 0?void 0:{range:[n,n],run:o=>e(o,n)}}};var ho=class i extends v{static def={name:["set"],description:"\u8BBE\u7F6E\u5C40\u90E8\u9ED8\u8BA4\u503C",details:"~~~jpfun\n@set(fontsize=20, strict=true)\n{ @set(note.octave=5, note.color=#f00) C D E }\n~~~\n\u63A5\u53D7\u547D\u540D\u53C2\u6570\uFF0C\u53EF\u4E00\u6B21\u8BBE\u7F6E\u591A\u9879\uFF1A\n- **\u7CFB\u7EDF\u9009\u9879**\uFF1A\u5982 `fontsize=20` \u5C06\u5B57\u53F7\u8BBE\u4E3A 20px\uFF0C`strict=true` \u5F00\u542F\u4E25\u683C\u6A21\u5F0F\n- **\u51FD\u6570\u9ED8\u8BA4\u53C2\u6570**\uFF1A\u6309 `\u51FD\u6570\u4E3B\u540D.\u53C2\u6570\u540D=\u503C` \u4E66\u5199\uFF0C\u4F8B\u5982 `note.octave=5`\u3001`note.color=#f00`\uFF1B\u663E\u5F0F\u4F20\u53C2\u4F18\u5148\n\n\u8BBE\u7F6E\u4ECE\u5F53\u524D\u4F4D\u7F6E\u8D77\u751F\u6548\uFF0C\u9650\u4E8E\u5F53\u524D\u4F5C\u7528\u57DF\u53CA\u5176\u5B50\u4F5C\u7528\u57DF\uFF1B\u79BB\u5F00\u5185\u5BB9\u5757\u540E\u6062\u590D\u5916\u5C42\u8BBE\u7F6E\u3002\u5B83\u6309\u6E90\u7801\u4F5C\u7528\u57DF\u89E3\u6790\uFF0C\u4E0E\u6F14\u594F\u65F6\u95F4\u65E0\u5173\u3002",allowExtraArgs:!0,args:[]};static resolveTarget(t,e,n){let o=e.lastIndexOf(".");if(o<0)return[e,Object.hasOwn(ct.systemVariables,e)?ct.systemVariables[e].type:"string"];let s=e.slice(o+1),r=t.functions.get(e.slice(0,o))?.prototype.def,c=r&&$t(r,s,-1);return!r||!c?(t.diagnostics.push(new O("W_SET_UNKNOWN_TARGET",`@set \u7684\u53C2\u6570 [${e}] \u6CA1\u6709\u5BF9\u5E94\u7684\u51FD\u6570\u6216\u5176\u53C2\u6570\uFF0C\u5C06\u88AB\u5FFD\u7565`,n)),null):c==="content"||c==="label"?(t.diagnostics.push(new O("W_SET_INVALID_VALUE_TYPE",`@set \u7684\u53C2\u6570 [${e}] \u5185\u5BB9\u548C\u6807\u7B7E\u4E0D\u80FD\u4F5C\u4E3A\u9ED8\u8BA4\u503C\uFF0C\u5C06\u88AB\u5FFD\u7565`,n)),null):[`${ne(r)}.${s}`.toLowerCase(),c]}args=new Map;constructor(t,e,n,o=null){super(t,o);for(let[s,r]of e){let c=r;if(typeof s!="string"){n.diagnostics.push(new O("W_SET_POSITIONAL_ARG",`\u51FD\u6570 @set \u4E0D\u63A5\u6536\u4F4D\u7F6E\u53C2\u6570, \u4F4D\u7F6E\u53C2\u6570[${s}]\u5C06\u88AB\u5FFD\u7565`,c.span));continue}let a=i.resolveTarget(n,s.toLowerCase(),c.nameSpan??c.span);if(a===null)continue;let[l,h]=a,p=n.parseArgWithType(c.valueSpan,h,t.start);if(p===null){n.diagnostics.push(new O("W_SET_INVALID_VALUE",`\u51FD\u6570 @set \u7684\u53C2\u6570\u503C\u89E3\u6790\u5931\u8D25, \u53C2\u6570[${s}]\u5C06\u88AB\u5FFD\u7565`,c.valueSpan));continue}n.setVariable(l,p),this.args.set(l,p)}}toString(){return`@set(${Array.from(this.args,([t,e])=>{let n=typeof e=="string"?rt(e):e&&typeof e=="object"&&"unit"in e?`${e.value}${e.unit}`:e;return`${t}=${n}`}).join(", ")})`}},ci=ho;var po=class extends v{static def={name:["volta"],description:"\u53CD\u590D\u7684\u8DF3\u623F\u5B50",details:"~~~jpfun\n|: 1 2 | 3@a 4@b :| 5@c 6@d | 7\n@volta(a, b, 1) @volta(c, d, 2)\n~~~\n- **\u989D\u5916\u4F4D\u7F6E\u53C2\u6570**\uFF1A\u66F4\u591A\u904D\u6570\uFF1B\u4F8B\u5982 `@volta(a, b, 1, 2)` \u8BA9\u524D\u4E24\u904D\u5171\u7528\u4E00\u4E2A\u623F\u5B50\u3002\u904D\u6570\u987A\u5E8F\u4E0D\u9650\uFF0C\u8C31\u9762\u6309\u5347\u5E8F\u663E\u793A\u3002\n\n\u672C\u4F8B\u7B2C\u4E00\u904D\u6F14\u594F `a` \u5230 `b`\uFF0C\u7B2C\u4E8C\u904D\u6F14\u594F `c` \u5230 `d`\u3002",allowExtraArgs:!0,extraArgType:"number",args:[{name:"from",description:"\u533A\u95F4\u8D77\u70B9\u7684\u6807\u7B7E\uFF0C\u533A\u95F4\u5141\u8BB8\u8DE8\u8C31\u9762\u884C",type:"label",default:null},{name:"to",description:"\u533A\u95F4\u7EC8\u70B9\u7684\u6807\u7B7E",type:"label",default:null},{name:"pass",description:"\u8FDB\u5165\u6B64\u533A\u95F4\u7684\u6F14\u594F\u904D\u6570\uFF0C\u987B\u4E3A\u6B63\u6574\u6570",type:"number",default:null}]};from;to;passes;size;font;loweringEnter(t){let e=t.getTemporalNodes(this.from).at(0),n=t.getTemporalNodes(this.to).at(-1);for(;e?.foldedInto;)e=e.foldedInto;for(;n?.foldedInto;)n=n.foldedInto;return!e||!n?(t.diagnostics.push(N.warning.UnresolvedEndpoint("volta",this.sourceSpan)),[]):(t.addAttachment(new fo(this,e,n)),[])}constructor(t,e,n,o=null){super(t,o);let[s,r,c]=this.getArgValue(e,n);this.font=n.variables.numberfont;let a=new Set([c]);for(let l=3;e.has(l);l++)a.add(e.get(l));if(this.from=s,this.to=r,this.passes=[...a].sort((l,h)=>l-h),this.size=n.variables.fontsize,this.passes.some(l=>!Number.isSafeInteger(l)||l<=0))throw new S("E_VOLTA_INVALID_PASS","@volta \u7684\u904D\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570",t)}toString(t){let e=n=>n.label??n.toString(t);return`@volta(${e(this.from)}, ${e(this.to)}, ${this.passes.join(", ")})`}},li=po;function ai(i){if(i?.[0]?.mergeKey===U)return i[0]}var fo=class{ast;from;to;layer="foreground";constructor(t,e,n){this.ast=t,this.from=e,this.to=n}get sourceSpan(){return this.ast.sourceSpan}get endPoints(){return[this.from,this.to]}playbackFlow(t){let e=t(this.from),n=t(this.to);if(e===void 0||n===void 0)return;let o=Math.min(e,n),s=Math.max(e,n);return{range:[o,s],run:r=>this.ast.passes.includes(Xo(r,o))?void 0:{kind:"jump",column:s+1}}}createGeometry(t){if(!F(this.from)||!F(this.to))return{regions:[],paint(){}};let e=A=>{let k=t.lines[A.layoutLine];return{line:A.layoutLine,view:k,column:k.columnOf(A)}},[n,o]=[e(this.from),e(this.to)];if((n.line>o.line||n.line===o.line&&n.column>o.column)&&([n,o]=[o,n]),n.column<0||o.column<0)return{regions:[],paint(){}};let s=n.view.columns[n.column][0],r=o.view.columns[o.column][0],c=ai(n.view.columns[n.column-1]),a=ai(o.view.columns[o.column+1]),l=0;for(let A=n.line;A<=o.line;A++)for(let k of t.getRangeColumns(A,[s,r]))l=Math.max(l,k[0].ast.size);let h=s.layoutLine,p=r.layoutLine,f=l||this.ast.size,d={fontSize:f*.6,fontFamily:this.ast.font,textAlign:"left",fill:"#000"},u=this.ast.passes.map(A=>`${A}.`).join(""),g=t.textMeasurer.measureText(u,d),y=Math.max(1,f*.055),x=y/2,m=g.h*1.2,b=(m-g.h)/2+g.baseline,w=Array.from({length:p-h+1},(A,k)=>{let M=h+k,T=s.track,E=1/0,C=M!==h&&M!==p?t.getRangeExtents(M):t.getRangeExtents(M,[s,r]);for(let[Y,D]of C){let $=t.getVisualAxis(M,Y)+D.top;$<E&&(T=Y,E=$)}E===1/0&&(E=t.getVisualAxis(M,T));let _=M!==h?this.lineEntryX(t,M,T):c?.layoutLine===M?c.box.x+c.box.anchor+5:s.box.x+(s.ports["body.left"]?.x??0),P=M!==p?this.lineRightX(t,M):a?.layoutLine===M?a.box.x+a.box.anchor:r.box.x+(r.ports["body.right"]?.x??r.box.w),j=Math.min(_,P),X=Math.max(_,P);return{left:j,right:X,lineY:E-f*.2-m,line:M,track:T}});return{regions:w.map(({left:A,right:k,lineY:M,line:T,track:E})=>({x:A-x,y:M-x,w:k-A+y,h:m+y,line:T,track:E})),paint(A){let k={stroke:"#000",strokeWidth:y};for(let{left:M,right:T,lineY:E,line:C}of w)A.drawLine(M,E,T,E,k),C===h&&(A.drawLine(M,E,M,E+m,k),A.drawText(u,M+f*.15,E+b+2,d)),C===p&&A.drawLine(T,E,T,E+m,k)}}}lineEntryX(t,e,n){return t.lines[e].trackRuns.get(n)?.find(s=>!s.T.isZero())?.box.x??t.originX}lineRightX(t,e){let n=t.lines[e].trackRuns;if(n.size===0)return t.originX+t.width;let o=t.originX;for(let s of n.values())for(let r of s)o=Math.max(o,r.box.x+r.box.w);return o}};var hi=4/3,Qr=.09,uo=class extends v{static def={name:["tie"],description:"\u8FDE\u97F3\u7EBF",details:`~~~jpfun
|
|
75
|
-
1@a 2 3@b @tie(a, b, height=0.5em)
|
|
76
|
-
~~~
|
|
77
|
-
- **\u4F4D\u7F6E\u53C2\u6570**\uFF1A\u7AEF\u70B9\u6807\u7B7E\uFF0C\u53EF\u4F20\u591A\u4E2A\uFF0C\u6309\u987A\u5E8F\u8FDE\u63A5\uFF1B\u7701\u7565\u65F6\u67E5\u627E\u6700\u8FD1\u7684\u53EF\u6807\u8BB0\u5BF9\u8C61\uFF0C\u5305\u62EC\u589E\u65F6\u7EBF
|
|
78
|
-
- **height**\uFF1A\u5F27\u7EBF\u9AD8\u5EA6\uFF0C\u9ED8\u8BA4 \`0.5em\`
|
|
79
|
-
|
|
80
|
-
\u540C\u884C\u7AEF\u70B9\u7528\u4E00\u6761\u5F27\u7EBF\u8FDE\u63A5\uFF0C\u8DE8\u884C\u65F6\u81EA\u52A8\u62C6\u6210\u591A\u6BB5\u3002\u540C\u8F68\u540C\u97F3\u4E14\u65F6\u95F4\u8FDE\u7EED\u7684\u97F3\u6BB5\u5EFA\u7ACB\u64AD\u653E\u8FDE\u63A5\uFF0C\u5404\u6BB5\u4FDD\u7559\u81EA\u5DF1\u7684\u88C5\u9970\uFF0C\u4F8B\u5982 \`1 ^ $tr 1 @tie()\` \u7684\u540E\u4E00\u97F3\u6BB5\u4E0D\u7EE7\u627F\u98A4\u97F3\u3002\u6D89\u53CA\u589E\u65F6\u7EBF\u7684\u8FDE\u63A5\u4EC5\u7ED8\u5236\uFF0C\u4E0D\u5408\u5E76\u64AD\u653E\u97F3\u7B26\u3002`,allowExtraArgs:!0,extraArgType:"label",args:[]};endPoints=[];height;constructor(t,e,n,o=null){super(t,o);let s=n.variables.fontsize*.5;for(let[c,a]of e){if(c==="height"){let h=n.parseArgWithType(a.valueSpan,"length",t.start);h&&(s=Math.max(0,n.length2px(h)));continue}let l=a instanceof v?a:n.parseArgWithType(a.valueSpan,"label",t.start);l!==null&&this.endPoints.push(l)}let r=n.labelableNodes.length-1;for(;this.endPoints.length<2&&r>=0;){let c=n.labelableNodes[r--];!c||this.endPoints.includes(c)||this.endPoints.unshift(c)}if(this.endPoints.length<2)throw new S("E_NOT_ENOUGH_ARGS","@tie \u8FDE\u97F3\u7EBF\u9700\u8981\u81F3\u5C11\u4E24\u4E2A\u7AEF\u70B9",t);this.height=s}loweringEnter(t){let e=[];for(let n of this.endPoints){let o=t.getTemporalNodes(n).at(-1);!o||!F(o)||e.push(o)}return e.length<2?(t.diagnostics.push(N.warning.UnresolvedEndpoint("tie",this.sourceSpan)),[]):(t.addAttachment(new xo(e,this.height,this.sourceSpan)),[])}toString(t){let e=this.endPoints.map(n=>n.label);return e.some(n=>n===void 0)?t.slice(this.sourceSpan.start,this.sourceSpan.end):`@tie(${e.join(", ")}, height=${this.height}px)`}},pi=uo,xo=class{layer="foreground";sourceSpan;endPoints;height;thickness;constructor(t,e,n){this.endPoints=t,this.height=e,this.sourceSpan=n;let o=t.reduce((s,r)=>Math.max(s,r.ast.size),0);this.thickness=Math.max(1.2,o*Qr)}applyPlayback(t){for(let e of t.notes.filter(n=>n.origins.some(o=>o.node===this.endPoints[0]))){let n=e;for(let o=1;o<this.endPoints.length;o++){let s=t.notes.find(r=>r!==n&&r.origins.some(c=>c.node===this.endPoints[o])&&r.track===n.track&&r.midi===n.midi&&r.percussion===n.percussion&&n.end.equals(r.start)&&t.connect(n,r));if(!s)break;n=s}}}createGeometry(t){let e=this.createSegments(t),n=e.map(({commands:s,...r})=>r),o=e.map(s=>{let r=t.getHostExtent(s.line,s.track),c=r?Math.max(s.y,t.getVisualAxis(s.line,s.track)+r.top):s.y+s.h;return{x:s.x,y:s.y,w:s.w,h:c-s.y,line:s.line,track:s.track}});return{regions:n,occupancy:o,paint(s){for(let r of e)s.drawPath(r.commands,{fill:"#000"})}}}tiePort(t){let e=t.ports["tie.top"];return e?{x:t.box.x+e.x,y:t.box.y+e.y}:{x:t.box.x+t.box.anchor,y:t.box.y}}createSegments(t){let e=[];for(let n=1;n<this.endPoints.length;n++){let o=this.endPoints[n-1],s=this.endPoints[n];o.layoutLine>s.layoutLine&&([o,s]=[s,o]);let r=this.tiePort(o),c=this.tiePort(s);if(o.layoutLine===s.layoutLine){let a=t.getVisualAxis(o.layoutLine,o.track)+(t.getHostExtent(o.layoutLine,o.track)?.top??0),l=t.getVisualAxis(s.layoutLine,s.track)+(t.getHostExtent(s.layoutLine,s.track)?.top??0);e.push(this.arcSegment(r,c,o.layoutLine,a<=l?o.track:s.track));continue}e.push(this.openingSegment(r,this.lineRightX(t,o.layoutLine),this.plateauY(t,o.layoutLine,o.track,r.y),o.layoutLine,o.track));for(let a=o.layoutLine+1;a<s.layoutLine;a++)e.push(this.horizontalSegment(this.lineEntryX(t,a,o.track),this.lineRightX(t,a),this.plateauY(t,a,o.track),a,o.track));e.push(this.closingSegment(this.lineEntryX(t,s.layoutLine,s.track),c,this.plateauY(t,s.layoutLine,s.track,c.y),s.layoutLine,s.track))}return e}lineEntryX(t,e,n){return t.lines[e].trackRuns.get(n)?.find(r=>!r.T.isZero())?.box.x??t.originX}lineRightX(t,e){let n=t.lines[e].trackRuns;if(n.size===0)return t.originX+t.width;let o=t.originX;for(let s of n.values())for(let r of s)o=Math.max(o,r.box.x+r.box.w);return o}plateauY(t,e,n,o=1/0){if(Number.isFinite(o))return o-this.height;let s=t.getVisualAxis(e,n),r=t.getHostExtent(e,n)?.top??0;return s+r-this.height}arcSegment(t,e,n,o){let s=t,r=e;s.x>r.x&&([s,r]=[r,s]);let c=(r.x-s.x)*.25,a=s.x+c,l=r.x-c,h=this.height*hi,p=Math.max(0,h-this.thickness*hi),f=[{op:"M",x:s.x,y:s.y},{op:"C",cx1:a,cy1:s.y-h,cx2:l,cy2:r.y-h,x:r.x,y:r.y},{op:"C",cx1:l,cy1:r.y-p,cx2:a,cy2:s.y-p,x:s.x,y:s.y},{op:"Z"}];return Ue(f,n,o)}openingSegment(t,e,n,o,s){let r=this.height*1.2;e=Math.max(e,t.x+r);let c=t.x+r,a=t.x+r*.45,l=n+this.thickness;return Ue([{op:"M",x:t.x,y:t.y},{op:"Q",cx:a,cy:n,x:c,y:n},{op:"L",x:e,y:n},{op:"L",x:e,y:l},{op:"L",x:c,y:l},{op:"Q",cx:a,cy:l,x:t.x,y:t.y},{op:"Z"}],o,s)}closingSegment(t,e,n,o,s){let r=this.height*1.2;t=Math.min(t,e.x-r);let c=e.x-r,a=e.x-r*.45,l=n+this.thickness;return Ue([{op:"M",x:t,y:n},{op:"L",x:c,y:n},{op:"Q",cx:a,cy:n,x:e.x,y:e.y},{op:"Q",cx:a,cy:l,x:c,y:l},{op:"L",x:t,y:l},{op:"Z"}],o,s)}horizontalSegment(t,e,n,o,s){return Ue([{op:"M",x:t,y:n},{op:"L",x:e,y:n},{op:"L",x:e,y:n+this.thickness},{op:"L",x:t,y:n+this.thickness},{op:"Z"}],o,s)}};function Ue(i,t,e){return{commands:i,line:t,track:e,...Vt(i)}}var mo=class extends v{static def={name:["tuplet"],description:"\u591A\u8FDE\u97F3",details:`~~~jpfun
|
|
77
|
+
${[...Ai.values()].map(t=>`- \`$${t.name}\`\uFF1A${t.description}`).join(`
|
|
78
|
+
`)}`,allowExtraArgs:!1,args:[{name:"name",description:"\u5185\u7F6E\u8BB0\u53F7\u540D\u79F0\uFF0C\u89C1\u51FD\u6570\u8BF4\u660E\u4E2D\u7684\u8BB0\u53F7\u5217\u8868",type:"string",default:null},{name:"size",description:"\u8BB0\u53F7\u5C3A\u5BF8",type:"length",default:{value:.5,unit:"em"}}]};static deSugarAtom(t,e,n){if(t[e]!=="$"||!/[A-Za-z]/.test(t[e+1]??""))return null;let o=e+2;for(;o<n&&/[A-Za-z0-9_-]/.test(t[o]);)o++;let s=t.slice(e+1,o);return{next:o,node:{kind:"call",typed:!0,name:"symbol",args:new Map([[0,s]]),span:{start:e,end:o},syntaxKind:"atom"}}}size;definition;constructor(t,e,n,o=null){super(t,o);let[s,i]=this.getArgValue(e,n);this.size=n.length2px(i);let c=Ai.get(s.toLowerCase());if(!c){let a=`@symbol: \u672A\u77E5\u7B26\u53F7: $${s}`;if(n.variables.strict)throw new C("E_UNKNOWN_SYMBOL",a,t);n.diagnostics.push(new P("W_UNKNOWN_SYMBOL",a,t));return}this.definition=c}loweringEnter(){return[this.definition?new To(this):new D]}toString(t){return this.definition?`@symbol(${this.definition.name})`:super.toString(t)}},Ti=Ao,To=class extends D{bounds;height;label;scale=1;baseline=0;constructor(t){super(),this.ast=t,this.mergeKey=ht,this.onTimeState=t.definition.onTimeState,this.emitPlayback=t.definition.emitPlayback,this.playbackMarks=t.definition.playbackMarks,this.bounds=Ge(t.definition.shapes??[]),this.height=t.size*(t.definition.weight??1);let e=t.definition.text;this.label=e&&{content:e.content,style:{fontSize:this.height,fontFamily:e.fontFamily}},this.initLayoutBox()}prepareLayout(t){if(this.label){let e=t.textMeasurer.measureText(this.label.content,this.label.style);this.box.w=e.w,this.box.h=e.h,this.baseline=e.baseline}else this.scale=this.height/this.bounds.h,this.box.w=this.bounds.w*this.scale,this.box.h=this.height+(this.ast.definition.paddingBottom??0)*this.scale;this.box.anchor=this.box.w/2,this.box.visualAxis=this.box.h/2}paint(t){this.label?t.drawText(this.label.content,this.box.x,this.box.y+this.baseline,this.label.style):Ve(t,this.ast.definition.shapes??[],this.bounds,this.box,this.scale)}playbackFlow(t){let e=this.ast.definition.onVisit;if(!e)return;let n=t(this);return n===void 0?void 0:{range:[n,n],run:o=>e(o,n)}}};var Eo=class r extends _{static def={name:["set"],description:"\u8BBE\u7F6E\u5C40\u90E8\u9ED8\u8BA4\u503C",details:"~~~jpfun\n@set(fontsize=20, strict=true)\n{ @set(note.octave=5, note.color=#f00) C D E }\n~~~\n\u63A5\u53D7\u547D\u540D\u53C2\u6570\uFF0C\u53EF\u4E00\u6B21\u8BBE\u7F6E\u591A\u9879\uFF1A\n- **\u7CFB\u7EDF\u9009\u9879**\uFF1A\u5982 `fontsize=20` \u5C06\u5B57\u53F7\u8BBE\u4E3A 20px\uFF0C`strict=true` \u5F00\u542F\u4E25\u683C\u6A21\u5F0F\n- **\u51FD\u6570\u9ED8\u8BA4\u53C2\u6570**\uFF1A\u6309 `\u51FD\u6570\u4E3B\u540D.\u53C2\u6570\u540D=\u503C` \u4E66\u5199\uFF0C\u4F8B\u5982 `note.octave=5`\u3001`note.color=#f00`\uFF1B\u663E\u5F0F\u4F20\u53C2\u4F18\u5148\n\n\u8BBE\u7F6E\u4ECE\u5F53\u524D\u4F4D\u7F6E\u8D77\u751F\u6548\uFF0C\u9650\u4E8E\u5F53\u524D\u4F5C\u7528\u57DF\u53CA\u5176\u5B50\u4F5C\u7528\u57DF\uFF1B\u79BB\u5F00\u5185\u5BB9\u5757\u540E\u6062\u590D\u5916\u5C42\u8BBE\u7F6E\u3002\u5B83\u6309\u6E90\u7801\u4F5C\u7528\u57DF\u89E3\u6790\uFF0C\u4E0E\u6F14\u594F\u65F6\u95F4\u65E0\u5173\u3002",allowExtraArgs:!0,args:[]};static resolveTarget(t,e,n){let o=e.lastIndexOf(".");if(o<0)return[e,Object.hasOwn(at.systemVariables,e)?at.systemVariables[e].type:"string"];let s=e.slice(o+1),i=t.functions.get(e.slice(0,o))?.prototype.def,c=i&&Ht(i,s,-1);return!i||!c?(t.diagnostics.push(new P("W_SET_UNKNOWN_TARGET",`@set \u7684\u53C2\u6570 [${e}] \u6CA1\u6709\u5BF9\u5E94\u7684\u51FD\u6570\u6216\u5176\u53C2\u6570\uFF0C\u5C06\u88AB\u5FFD\u7565`,n)),null):c==="content"||c==="label"?(t.diagnostics.push(new P("W_SET_INVALID_VALUE_TYPE",`@set \u7684\u53C2\u6570 [${e}] \u5185\u5BB9\u548C\u6807\u7B7E\u4E0D\u80FD\u4F5C\u4E3A\u9ED8\u8BA4\u503C\uFF0C\u5C06\u88AB\u5FFD\u7565`,n)),null):[`${re(i)}.${s}`.toLowerCase(),c]}args=new Map;constructor(t,e,n,o=null){super(t,o);for(let[s,i]of e){let c=i;if(typeof s!="string"){n.diagnostics.push(new P("W_SET_POSITIONAL_ARG",`\u51FD\u6570 @set \u4E0D\u63A5\u6536\u4F4D\u7F6E\u53C2\u6570, \u4F4D\u7F6E\u53C2\u6570[${s}]\u5C06\u88AB\u5FFD\u7565`,c.span));continue}let a=r.resolveTarget(n,s.toLowerCase(),c.nameSpan??c.span);if(a===null)continue;let[l,h]=a,p=n.parseArgWithType(c.valueSpan,h,t.start);if(p===null){n.diagnostics.push(new P("W_SET_INVALID_VALUE",`\u51FD\u6570 @set \u7684\u53C2\u6570\u503C\u89E3\u6790\u5931\u8D25, \u53C2\u6570[${s}]\u5C06\u88AB\u5FFD\u7565`,c.valueSpan));continue}n.setVariable(l,p),this.args.set(l,p)}}toString(){return`@set(${Array.from(this.args,([t,e])=>{let n=typeof e=="string"?ct(e):e&&typeof e=="object"&&"unit"in e?`${e.value}${e.unit}`:e;return`${t}=${n}`}).join(", ")})`}},Ei=Eo;var Lo=class extends _{static def={name:["volta"],description:"\u53CD\u590D\u7684\u8DF3\u623F\u5B50",details:"~~~jpfun\n|: 1 2 | 3@a 4@b :| 5@c 6@d | 7\n@volta(a, b, 1) @volta(c, d, 2)\n~~~\n- **\u989D\u5916\u4F4D\u7F6E\u53C2\u6570**\uFF1A\u66F4\u591A\u904D\u6570\uFF1B\u4F8B\u5982 `@volta(a, b, 1, 2)` \u8BA9\u524D\u4E24\u904D\u5171\u7528\u4E00\u4E2A\u623F\u5B50\u3002\u904D\u6570\u987A\u5E8F\u4E0D\u9650\uFF0C\u8C31\u9762\u6309\u5347\u5E8F\u663E\u793A\u3002\n\n\u672C\u4F8B\u7B2C\u4E00\u904D\u6F14\u594F `a` \u5230 `b`\uFF0C\u7B2C\u4E8C\u904D\u6F14\u594F `c` \u5230 `d`\u3002",allowExtraArgs:!0,extraArgType:"number",args:[{name:"from",description:"\u533A\u95F4\u8D77\u70B9\u7684\u6807\u7B7E\uFF0C\u533A\u95F4\u5141\u8BB8\u8DE8\u8C31\u9762\u884C",type:"label",default:null},{name:"to",description:"\u533A\u95F4\u7EC8\u70B9\u7684\u6807\u7B7E",type:"label",default:null},{name:"pass",description:"\u8FDB\u5165\u6B64\u533A\u95F4\u7684\u6F14\u594F\u904D\u6570\uFF0C\u987B\u4E3A\u6B63\u6574\u6570",type:"number",default:null}]};from;to;passes;size;font;loweringEnter(t){let e=t.getTemporalNodes(this.from).at(0),n=t.getTemporalNodes(this.to).at(-1);for(;e?.foldedInto;)e=e.foldedInto;for(;n?.foldedInto;)n=n.foldedInto;return!e||!n?(t.diagnostics.push(k.warning.UnresolvedEndpoint("volta",this.sourceSpan)),[]):(t.addAttachment(new _o(this,e,n)),[])}constructor(t,e,n,o=null){super(t,o);let[s,i,c]=this.getArgValue(e,n);this.font=n.variables.numberfont;let a=new Set([c]);for(let l=3;e.has(l);l++)a.add(e.get(l));if(this.from=s,this.to=i,this.passes=[...a].sort((l,h)=>l-h),this.size=n.variables.fontsize,this.passes.some(l=>!Number.isSafeInteger(l)||l<=0))throw new C("E_VOLTA_INVALID_PASS","@volta \u7684\u904D\u6570\u5FC5\u987B\u662F\u6B63\u6574\u6570",t)}toString(t){let e=n=>n.label??n.toString(t);return`@volta(${e(this.from)}, ${e(this.to)}, ${this.passes.join(", ")})`}},_i=Lo;function Li(r){if(r?.[0]?.mergeKey===K)return r[0]}var _o=class{ast;from;to;layer="foreground";constructor(t,e,n){this.ast=t,this.from=e,this.to=n}get sourceSpan(){return this.ast.sourceSpan}get endPoints(){return[this.from,this.to]}playbackFlow(t){let e=t(this.from),n=t(this.to);if(e===void 0||n===void 0)return;let o=Math.min(e,n),s=Math.max(e,n);return{range:[o,s],run:i=>this.ast.passes.includes(ds(i,o))?void 0:{kind:"jump",column:s+1}}}createGeometry(t){if(!F(this.from)||!F(this.to))return{regions:[],paint(){}};let e=S=>{let A=t.lines[S.layoutLine];return{line:S.layoutLine,view:A,column:A.columnOf(S)}},[n,o]=[e(this.from),e(this.to)];if((n.line>o.line||n.line===o.line&&n.column>o.column)&&([n,o]=[o,n]),n.column<0||o.column<0)return{regions:[],paint(){}};let s=n.view.columns[n.column][0],i=o.view.columns[o.column][0],c=Li(n.view.columns[n.column-1]),a=Li(o.view.columns[o.column+1]),l=0;for(let S=n.line;S<=o.line;S++)for(let A of t.getRangeColumns(S,[s,i]))l=Math.max(l,A[0].ast.size);let h=s.layoutLine,p=i.layoutLine,f=l||this.ast.size,d={fontSize:f*.6,fontFamily:this.ast.font,textAlign:"left",fill:"#000"},u=this.ast.passes.map(S=>`${S}.`).join(""),g=t.textMeasurer.measureText(u,d),x=Math.max(1,f*.055),m=x/2,y=g.h*1.2,b=(y-g.h)/2+g.baseline,w=Array.from({length:p-h+1},(S,A)=>{let T=h+A,v=s.track,N=1/0,M=T!==h&&T!==p?t.getRangeExtents(T):t.getRangeExtents(T,[s,i]);for(let[tt,lt]of M){let z=t.getVisualAxis(T,tt)+lt.top;z<N&&(v=tt,N=z)}N===1/0&&(N=t.getVisualAxis(T,v));let L=T!==h?this.lineEntryX(t,T,v):c?.layoutLine===T?c.box.x+c.box.anchor+5:s.box.x+(s.ports["body.left"]?.x??0),I=T!==p?this.lineRightX(t,T):a?.layoutLine===T?a.box.x+a.box.anchor:i.box.x+(i.ports["body.right"]?.x??i.box.w),V=Math.min(L,I),J=Math.max(L,I);return{left:V,right:J,lineY:N-f*.2-y,line:T,track:v}});return{regions:w.map(({left:S,right:A,lineY:T,line:v,track:N})=>({x:S-m,y:T-m,w:A-S+x,h:y+x,line:v,track:N})),paint(S){let A={stroke:"#000",strokeWidth:x};for(let{left:T,right:v,lineY:N,line:M}of w)S.drawLine(T,N,v,N,A),M===h&&(S.drawLine(T,N,T,N+y,A),S.drawText(u,T+f*.15,N+b+2,d)),M===p&&S.drawLine(v,N,v,N+y,A)}}}lineEntryX(t,e,n){return t.lines[e].trackRuns.get(n)?.find(s=>!s.T.isZero())?.box.x??t.originX}lineRightX(t,e){let n=t.lines[e].trackRuns;if(n.size===0)return t.originX+t.width;let o=t.originX;for(let s of n.values())for(let i of s)o=Math.max(o,i.box.x+i.box.w);return o}};var Ni=4/3,wc=.09,No=class extends _{static def={name:["tie"],description:"\u8FDE\u97F3\u7EBF",details:"~~~jpfun\n1@a 2 3@b @tie(a, b, height=0.5em)\n~~~\n- **\u4F4D\u7F6E\u53C2\u6570**\uFF1A\u7AEF\u70B9\u6807\u7B7E\uFF0C\u53EF\u4F20\u591A\u4E2A\uFF0C\u6309\u987A\u5E8F\u8FDE\u63A5\uFF1B\u7701\u7565\u65F6\u67E5\u627E\u6700\u8FD1\u7684\u53EF\u6807\u8BB0\u5BF9\u8C61\uFF0C\u5305\u62EC\u589E\u65F6\u7EBF\n- **height**\uFF1A\u4EC5\u547D\u540D\u7684\u5F27\u7EBF\u9AD8\u5EA6\u53C2\u6570\uFF0C\u9ED8\u8BA4 `0.5em`\uFF1B\u53EF\u7528 `@set(tie.height=0.8em)` \u8BBE\u7F6E\u5C40\u90E8\u9ED8\u8BA4\u503C\uFF0C\u663E\u5F0F\u4F20\u53C2\u4F18\u5148\n\n\u540C\u884C\u7AEF\u70B9\u7528\u4E00\u6761\u5F27\u7EBF\u8FDE\u63A5\uFF0C\u8DE8\u884C\u65F6\u81EA\u52A8\u62C6\u6210\u591A\u6BB5\u3002\u540C\u8F68\u540C\u97F3\u4E14\u65F6\u95F4\u8FDE\u7EED\u7684\u97F3\u6BB5\u5EFA\u7ACB\u64AD\u653E\u8FDE\u63A5\uFF0C\u5404\u6BB5\u4FDD\u7559\u81EA\u5DF1\u7684\u88C5\u9970\uFF0C\u4F8B\u5982 `1 ^ $tr 1 @tie()` \u7684\u540E\u4E00\u97F3\u6BB5\u4E0D\u7EE7\u627F\u98A4\u97F3\u3002\u6D89\u53CA\u589E\u65F6\u7EBF\u7684\u8FDE\u63A5\u4EC5\u7ED8\u5236\uFF0C\u4E0D\u5408\u5E76\u64AD\u653E\u97F3\u7B26\u3002",allowExtraArgs:!0,extraArgType:"label",args:[{name:"height",namedOnly:!0,description:"\u5F27\u7EBF\u9AD8\u5EA6\uFF0C\u652F\u6301 px/em\uFF1Bem \u76F8\u5BF9\u8C03\u7528\u5904\u5B57\u53F7\uFF0C\u8D1F\u503C\u6309 0 \u5904\u7406",type:"length",default:{value:.5,unit:"em"}}]};endPoints=[];height;constructor(t,e,n,o=null){super(t,o);let[s]=this.getArgValue(e,n);for(let[c,a]of e){if(c==="height")continue;let l=a instanceof _?a:n.parseArgWithType(a.valueSpan,"label",t.start);l!==null&&this.endPoints.push(l)}let i=n.labelableNodes.length-1;for(;this.endPoints.length<2&&i>=0;){let c=n.labelableNodes[i--];!c||this.endPoints.includes(c)||this.endPoints.unshift(c)}if(this.endPoints.length<2)throw new C("E_NOT_ENOUGH_ARGS","@tie \u8FDE\u97F3\u7EBF\u9700\u8981\u81F3\u5C11\u4E24\u4E2A\u7AEF\u70B9",t);this.height=Math.max(0,n.length2px(s))}loweringEnter(t){let e=[];for(let n of this.endPoints){let o=t.getTemporalNodes(n).at(-1);!o||!F(o)||e.push(o)}return e.length<2?(t.diagnostics.push(k.warning.UnresolvedEndpoint("tie",this.sourceSpan)),[]):(t.addAttachment(new ko(e,this.height,this.sourceSpan)),[])}toString(t){let e=this.endPoints.map(n=>n.label);return e.some(n=>n===void 0)?t.slice(this.sourceSpan.start,this.sourceSpan.end):`@tie(${e.join(", ")}, height=${this.height}px)`}},ki=No,ko=class{layer="foreground";sourceSpan;endPoints;height;thickness;constructor(t,e,n){this.endPoints=t,this.height=e,this.sourceSpan=n;let o=t.reduce((s,i)=>Math.max(s,i.ast.size),0);this.thickness=Math.max(1.2,o*wc)}applyPlayback(t){for(let e of t.notes.filter(n=>n.origins.some(o=>o.node===this.endPoints[0]))){let n=e;for(let o=1;o<this.endPoints.length;o++){let s=t.notes.find(i=>i!==n&&i.origins.some(c=>c.node===this.endPoints[o])&&i.track===n.track&&i.midi===n.midi&&i.percussion===n.percussion&&n.end.equals(i.start)&&t.connect(n,i));if(!s)break;n=s}}}createGeometry(t){let e=this.createSegments(t),n=e.map(({commands:s,...i})=>i),o=e.map(s=>{let i=t.getHostExtent(s.line,s.track),c=i?Math.max(s.y,t.getVisualAxis(s.line,s.track)+i.top):s.y+s.h;return{x:s.x,y:s.y,w:s.w,h:c-s.y,line:s.line,track:s.track}});return{regions:n,occupancy:o,paint(s){for(let i of e)s.drawPath(i.commands,{fill:"#000"})}}}tiePort(t){let e=t.ports["tie.top"];return e?{x:t.box.x+e.x,y:t.box.y+e.y}:{x:t.box.x+t.box.anchor,y:Q(t,!0).y}}createSegments(t){let e=[];for(let n=1;n<this.endPoints.length;n++){let o=this.endPoints[n-1],s=this.endPoints[n];o.layoutLine>s.layoutLine&&([o,s]=[s,o]);let i=this.tiePort(o),c=this.tiePort(s);if(o.layoutLine===s.layoutLine){let a=t.getVisualAxis(o.layoutLine,o.track)+(t.getHostExtent(o.layoutLine,o.track)?.top??0),l=t.getVisualAxis(s.layoutLine,s.track)+(t.getHostExtent(s.layoutLine,s.track)?.top??0);e.push(this.arcSegment(i,c,o.layoutLine,a<=l?o.track:s.track));continue}e.push(this.openingSegment(i,this.lineRightX(t,o.layoutLine),this.plateauY(t,o.layoutLine,o.track,i.y),o.layoutLine,o.track));for(let a=o.layoutLine+1;a<s.layoutLine;a++)e.push(this.horizontalSegment(this.lineEntryX(t,a,o.track),this.lineRightX(t,a),this.plateauY(t,a,o.track),a,o.track));e.push(this.closingSegment(this.lineEntryX(t,s.layoutLine,s.track),c,this.plateauY(t,s.layoutLine,s.track,c.y),s.layoutLine,s.track))}return e}lineEntryX(t,e,n){return t.lines[e].trackRuns.get(n)?.find(i=>!i.T.isZero())?.box.x??t.originX}lineRightX(t,e){let n=t.lines[e].trackRuns;if(n.size===0)return t.originX+t.width;let o=t.originX;for(let s of n.values())for(let i of s)o=Math.max(o,i.box.x+i.box.w);return o}plateauY(t,e,n,o=1/0){if(Number.isFinite(o))return o-this.height;let s=t.getVisualAxis(e,n),i=t.getHostExtent(e,n)?.top??0;return s+i-this.height}arcSegment(t,e,n,o){let s=t,i=e;s.x>i.x&&([s,i]=[i,s]);let c=(i.x-s.x)*.25,a=s.x+c,l=i.x-c,h=this.height*Ni,p=Math.max(0,h-this.thickness*Ni),f=[{op:"M",x:s.x,y:s.y},{op:"C",cx1:a,cy1:s.y-h,cx2:l,cy2:i.y-h,x:i.x,y:i.y},{op:"C",cx1:l,cy1:i.y-p,cx2:a,cy2:s.y-p,x:s.x,y:s.y},{op:"Z"}];return en(f,n,o)}openingSegment(t,e,n,o,s){let i=this.height*1.2;e=Math.max(e,t.x+i);let c=t.x+i,a=t.x+i*.45,l=n+this.thickness;return en([{op:"M",x:t.x,y:t.y},{op:"Q",cx:a,cy:n,x:c,y:n},{op:"L",x:e,y:n},{op:"L",x:e,y:l},{op:"L",x:c,y:l},{op:"Q",cx:a,cy:l,x:t.x,y:t.y},{op:"Z"}],o,s)}closingSegment(t,e,n,o,s){let i=this.height*1.2;t=Math.min(t,e.x-i);let c=e.x-i,a=e.x-i*.45,l=n+this.thickness;return en([{op:"M",x:t,y:n},{op:"L",x:c,y:n},{op:"Q",cx:a,cy:n,x:e.x,y:e.y},{op:"Q",cx:a,cy:l,x:c,y:l},{op:"L",x:t,y:l},{op:"Z"}],o,s)}horizontalSegment(t,e,n,o,s){return en([{op:"M",x:t,y:n},{op:"L",x:e,y:n},{op:"L",x:e,y:n+this.thickness},{op:"L",x:t,y:n+this.thickness},{op:"Z"}],o,s)}};function en(r,t,e){return{commands:r,line:t,track:e,...Ct(r)}}var vo=class extends _{static def={name:["tuplet"],description:"\u591A\u8FDE\u97F3",details:`~~~jpfun
|
|
81
79
|
@tuplet({1/ 2 3}, normal=4)
|
|
82
80
|
~~~
|
|
83
|
-
\u672C\u4F8B\u6700\u77ED\u5355\u4F4D\u4E3A\u516B\u5206\u97F3\u7B26\uFF0C\u539F\u5185\u5BB9\u5360 5 \u4E2A\u5355\u4F4D\uFF0C\u7F29\u653E\u540E\u5360 4 \u4E2A\u5355\u4F4D\uFF1A\u5F62\u6210\u4E94\u8FDE\u97F3\uFF0C\u603B\u65F6\u957F\u4E3A\u4E00\u4E2A\u4E8C\u5206\u97F3\u7B26`,allowExtraArgs:!1,args:[{type:"content",description:"\u8FDE\u97F3\u5185\u5BB9\uFF0C\u5404\u5143\u7D20\u6309\u540C\u4E00\u6BD4\u4F8B\u7F29\u653E\u65F6\u503C",default:null},{name:"normal",description:"\u76EE\u6807\u603B\u65F6\u957F\uFF0C\u4EE5\u5185\u5BB9\u4E2D\u7684\u6700\u77ED\u65F6\u503C\u4E3A\u5355\u4F4D",type:"number",default:null}]};static loweringFinalize=t=>{for(let e of t.attachments)e instanceof
|
|
81
|
+
\u672C\u4F8B\u6700\u77ED\u5355\u4F4D\u4E3A\u516B\u5206\u97F3\u7B26\uFF0C\u539F\u5185\u5BB9\u5360 5 \u4E2A\u5355\u4F4D\uFF0C\u7F29\u653E\u540E\u5360 4 \u4E2A\u5355\u4F4D\uFF1A\u5F62\u6210\u4E94\u8FDE\u97F3\uFF0C\u603B\u65F6\u957F\u4E3A\u4E00\u4E2A\u4E8C\u5206\u97F3\u7B26`,allowExtraArgs:!1,args:[{type:"content",description:"\u8FDE\u97F3\u5185\u5BB9\uFF0C\u5404\u5143\u7D20\u6309\u540C\u4E00\u6BD4\u4F8B\u7F29\u653E\u65F6\u503C",default:null},{name:"normal",description:"\u76EE\u6807\u603B\u65F6\u957F\uFF0C\u4EE5\u5185\u5BB9\u4E2D\u7684\u6700\u77ED\u65F6\u503C\u4E3A\u5355\u4F4D",type:"number",default:null}]};static loweringFinalize=t=>{for(let e of t.attachments)e instanceof nn&&e.validate()};content;normal;font;get children(){return[this.content]}timeFlowModel(){return{mode:"sequence",children:[this.content]}}loweringEnter(t){let e={nodes:[],attachments:[],onTemporal(n){e.nodes.push(n)},onAttachment(n){e.attachments.push(n)}};return t.beginLoweringGroup(this,e),[]}loweringExit(t,e,n){let o=t.endLoweringGroup(this),s=o.nodes.filter(u=>u.T.compare(0)>0);if(s.length===0)throw new C("E_TUPLET_EMPTY","@tuplet \u7684\u5185\u5BB9\u5FC5\u987B\u4EA7\u751F\u81F3\u5C11\u4E00\u4E2A\u6B63\u65F6\u503C\u4E8B\u4EF6",this.sourceSpan);let i=s[0].track;if(s.some(u=>u.track!==i))throw new C("E_TUPLET_PARALLEL_CONTENT","@tuplet \u7684\u5185\u5BB9\u4E0D\u80FD\u5305\u542B\u5E76\u884C\u97F3\u8F68",this.sourceSpan);let c=s[0].T.clone(),a=new O;for(let u of s)u.T.compare(c)<0&&c.copyFrom(u.T),a.add(u.T);let l=a.div(c),h=l.numerator;if(l.denominator!==1||h<2||!Number.isSafeInteger(h))throw new C("E_TUPLET_NON_INTEGRAL_UNITS","@tuplet \u7684\u603B\u65F6\u503C\u5FC5\u987B\u662F\u6700\u77ED\u6B63\u65F6\u503C\u7684\u6574\u6570\u500D\uFF0C\u4E14\u81F3\u5C11\u5305\u542B2\u4E2A\u5355\u4F4D",this.sourceSpan);if(this.normal===h)throw new C("E_TUPLET_INVALID_RATIO",`@tuplet \u7684 normal \u4E0D\u80FD\u7B49\u4E8E\u63A8\u5BFC\u51FA\u7684 actual (${h})`,this.sourceSpan);let p=o.nodes[0].t;for(let u=1;u<o.nodes.length;u++)o.nodes[u].t.compare(p)<0&&(p=o.nodes[u].t);p=p.clone();let f=new O;for(let u of o.nodes)f.copyFrom(u.t).sub(p).mul(this.normal,h),u.t.copyFrom(p).add(f),u.T.mul(this.normal,h);n.copyFrom(p).add(c.mul(this.normal));let d=s.filter(F);return d.length>=2&&t.addAttachment(new nn(d,h,this.sourceSpan,this.font,o)),[]}constructor(t,e,n,o=null){super(t,o);let[s,i]=this.getArgValue(e,n);if(this.font=n.variables.numberfont,!Number.isSafeInteger(i)||i<=0)throw new C("E_TUPLET_INVALID_NORMAL","@tuplet \u7684 normal \u5FC5\u987B\u662F\u6B63\u7684\u5B89\u5168\u6574\u6570",t);this.content=s,this.normal=i,s.parent=this}toString(t){return`@tuplet(${this.content.toString(t)}, ${this.normal})`}},vi=vo,nn=class{content;layer="foreground";endPoints;actual;sourceSpan;style;size;constructor(t,e,n,o,s){this.content=s,this.endPoints=t,this.actual=e,this.sourceSpan=n,this.size=t.reduce((i,c)=>Math.max(i,c.ast.size),0),this.style={fontSize:this.size*.72,fontFamily:o,textAlign:"center",fill:"#000"}}validate(){let t=this.endPoints[0];if(this.endPoints.some(e=>e.layoutLine!==t.layoutLine))throw new C("E_TUPLET_CROSS_LINE","@tuplet \u7684\u5185\u5BB9\u4E0D\u80FD\u8DE8\u8D8A\u8C31\u9762\u884C",this.sourceSpan)}createGeometry(t){let e=this.endPoints[0],n=this.endPoints[this.endPoints.length-1],o=e.ports["body.left"]?.x??0,s=n.ports["body.right"]?.x??n.box.w,i=e.box.x+o,c=n.box.x+s;i>c&&([i,c]=[c,i]);let a=t.textMeasurer.measureText(String(this.actual),this.style),l=(i+c)/2,h=this.size*.12,p=this.size*.18,f=this.size*.14,d=t.getVisualAxis(e.layoutLine,e.track),u=t.getRangeExtents(e.layoutLine,[e,n],e.track),g=t.getContentBounds(this.content),x=Math.min(d+(u?.top??0),g?.y??1/0),m=Math.max(1,this.size*.055),y=x-f-Math.max(p,a.h/2),b=y+p,w=y-a.h/2+a.baseline,S=l-a.w/2-h,A=l+a.w/2+h,T=[];S>i&&T.push([i,y,S,y]),A<c&&T.push([A,y,c,y]),T.push([i,y,i,b],[c,y,c,b]);let v=m/2,N=Math.min(y-a.h/2,y-v),M=Math.max(y+a.h/2,b+v),L=[{x:i-v,y:N,w:c-i+m,h:M-N,line:e.layoutLine,track:e.track}],I=String(this.actual),V=this.style;return{regions:L,paint(J){let tt={stroke:"#000",strokeWidth:m};for(let[lt,z,X,Z]of T)J.drawLine(lt,z,X,Z,tt);J.drawText(I,l,w,V)}}}};var Mo=[{op:"M",x:2.98438,y:-165.5},{op:"C",cx1:8.9375,cy1:-171.781,cx2:20.5156,cy2:-184.688,x:20.5156,y:-208.531},{op:"C",cx1:20.5156,cy1:-238.641,cx2:7.60938,cy2:-269.094,x:7.60938,y:-287.969},{op:"C",cx1:7.60938,cy1:-308.156,cx2:19.2031,cy2:-327.016,x:19.8594,y:-327.688},{op:"C",cx1:19.8594,cy1:-328.016,cx2:19.8594,cy2:-328.016,x:19.8594,y:-328.344},{op:"C",cx1:19.8594,cy1:-328.672,cx2:19.8594,cy2:-329,x:19.5313,y:-329.344},{op:"C",cx1:19.2031,cy1:-329.344,cx2:18.5313,cy2:-329.344,x:18.2031,y:-328.672},{op:"C",cx1:17.875,cy1:-328.344,cx2:0,cy2:-310.469,x:0,y:-283.328},{op:"C",cx1:0,cy1:-254.203,cx2:11.5781,cy2:-233.688,x:11.5781,y:-195.625},{op:"C",cx1:11.5781,cy1:-188.328,cx2:8.60938,cy2:-176.75,x:.328125,y:-166.484},{op:"C",cx1:0,cy1:-166.484,cx2:0,cy2:-165.828,x:0,y:-165.5},{op:"C",cx1:-.328125,cy1:-165.172,cx2:0,cy2:-164.828,x:.328125,y:-164.5},{op:"C",cx1:8.60938,cy1:-154.25,cx2:11.5781,cy2:-142.656,x:11.5781,y:-135.375},{op:"C",cx1:11.5781,cy1:-97.3125,cx2:0,cy2:-76.7969,x:0,y:-47.6563},{op:"C",cx1:0,cy1:-20.8594,cx2:17.875,cy2:-2.64063,x:18.2031,y:-2.3125},{op:"C",cx1:18.5313,cy1:-1.65625,cx2:19.2031,cy2:-1.32813,x:19.5313,y:-1.65625},{op:"C",cx1:19.8594,cy1:-1.98438,cx2:20.1875,cy2:-2.3125,x:19.8594,y:-2.64063},{op:"C",cx1:19.8594,cy1:-2.64063,cx2:19.8594,cy2:-2.98438,x:19.8594,y:-3.3125},{op:"C",cx1:19.2031,cy1:-3.96875,cx2:7.60938,cy2:-22.8438,x:7.60938,y:-43.0313},{op:"C",cx1:7.60938,cy1:-61.8906,cx2:20.5156,cy2:-92.3438,x:20.5156,y:-122.469},{op:"C",cx1:20.5156,cy1:-146.625,cx2:8.9375,cy2:-159.203,x:2.98438,y:-165.5},{op:"Z"}],Se=Ct(Mo),gt=2.33,Lt=1.17,Dt=.34,Ro=[{op:"M",x:0,y:0},{op:"L",x:0,y:-Dt},{op:"C",cx1:gt*.421,cy1:-Dt+Lt*.077,cx2:gt*.733,cy2:-Dt+Lt*.346,x:gt,y:-Dt+Lt},{op:"L",x:gt*.929,y:-Dt+Lt},{op:"C",cx1:gt*.696,cy1:-Dt+Lt*.535,cx2:gt*.328,cy2:-Dt+Lt*.352,x:0,y:0},{op:"Z"}];function on(r){return new C("E_VOICES_CONNECT","@voices \u7684 connect \u5FC5\u987B\u662F [\u8D77\u70B9-\u7EC8\u70B9] \u6216 {\u8D77\u70B9-\u7EC8\u70B9} \u7684\u7EC4\u5408\uFF1B\u7AEF\u70B9\u53EF\u7701\u7565\uFF0C\u5426\u5219\u987B\u4E3A\u6709\u6548\u58F0\u90E8\u7F16\u53F7\u3002\u7A7A\u5B57\u7B26\u4E32\u8868\u793A\u53EA\u6709\u8FDE\u8C31\u7EBF\u3002",r)}function Mi(r,t){let e=r.trim(),n=/\s*([\[{])\s*(?:(\d+)\s*)?-\s*(?:(\d+)\s*)?([\]}])\s*/y,o=[];for(;n.lastIndex<e.length;){let s=n.exec(e);if(!s||s[4]!==(s[1]==="["?"]":"}"))throw on(t);let i=s[2]?Number(s[2]):void 0,c=s[3]?Number(s[3]):void 0;for(let a of[i,c])if(a!==void 0&&(!Number.isSafeInteger(a)||a<1))throw on(t);if(i!==void 0&&c!==void 0&&i>c)throw on(t);o.push({kind:s[1]==="["?"bracket":"brace",from:i,to:c})}return o}function Ri(r,t,e){return r.map(({kind:n,from:o=1,to:s=t})=>{if(o>s||s>t)throw on(e);return{kind:n,from:o,to:s}})}function Oo(r){return r.map(({kind:t,from:e,to:n})=>{let o=`${e??""}-${n??""}`;return t==="brace"?`{${o}}`:`[${o}]`}).join("")}var Sc=/\s/,Ii=2.5,Pi=.3,Fi=new Set("\uFF08([\uFF3B\uFF5B\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\u2018\u201C"),Io=new Set([...Fi,...`\uFF0C\u3002\uFF01\uFF1F\uFF1B\uFF1A\u3001,.!?;:\uFF09)]\uFF3D\uFF5D\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u2019\u201D"'\u2026\u2014\u2013`]);function Oi(r){let t=0,e=r.length;for(;t<e&&Io.has(r[t]);)t++;for(;e>t&&Io.has(r[e-1]);)e--;return{prefix:r.slice(0,t),body:r.slice(t,e)}}function Cc(r){let t=r/2;return(e,n)=>{let o=e.map(a=>a&&a.bottom-a.top>1e-6?a:{top:-t,bottom:t}),s=[],i=0;for(let a=0;a<o.length;a++)a>0&&(i+=o[a-1].bottom+n-o[a].top),s.push(i);let c=(s[0]+s[s.length-1])/2;return s.map((a,l)=>({offset:a-c,extent:o[l]}))}}var Bt=class r extends _{static def={name:["voice","v"],description:"\u58F0\u90E8",details:`~~~jpfun
|
|
84
82
|
@voice({1 2 3}, \u94A2\u7434, \u7537=ha ha ha, \u5973=la la la)
|
|
85
83
|
~~~
|
|
86
84
|
- **\u989D\u5916\u53C2\u6570**\uFF1A\u6BCF\u9879\u4E3A\u4E00\u884C\u6B4C\u8BCD\uFF1B\u547D\u540D\u53C2\u6570\u540C\u65F6\u7ED9\u51FA\u6B4C\u8BCD\u884C\u540D\uFF0C\u4F4D\u7F6E\u53C2\u6570\u8868\u793A\u65E0\u884C\u540D\u3002\u7701\u7565\u58F0\u90E8\u540D\u4F46\u4ECD\u9700\u6B4C\u8BCD\u65F6\uFF0C\u4FDD\u7559\u7A7A\u4F4D\uFF0C\u5982 \`@voice({1 2 3}, , ha ha ha)\`\u3002
|
|
@@ -93,14 +91,14 @@ N(\u94A2\u7434): 1 2 3
|
|
|
93
91
|
L(\u7537): ha ha ha
|
|
94
92
|
L: la la la
|
|
95
93
|
~~~
|
|
96
|
-
\u884C\u9996\u5141\u8BB8\u7A7A\u767D\uFF0C\u6362\u884C\u7ED3\u675F\u5F53\u524D\u58F0\u660E\uFF1B\u5728\u884C\u672B\u52A0 \`\\\` \u53EF\u7EED\u884C\u3002\u8FD9\u79CD\u5199\u6CD5\u4E2D\u7684\u6B4C\u8BCD\u5141\u8BB8\u76F4\u63A5\u4F7F\u7528\u9017\u53F7\u3002`,allowExtraArgs:!0,extraArgType:"string",args:[{type:"content",description:"\u58F0\u90E8\u7684\u97F3\u7B26\u5185\u5BB9",default:null},{name:"name",description:"\u663E\u793A\u5728\u5DE6\u4FA7\u7684\u58F0\u90E8\u540D\u79F0\uFF0C\u7A7A\u503C\u9690\u85CF\u540D\u79F0",type:"string",default:""}]};static deSugarAtom(t,e,n){if(t[e]!=="N"&&t[e]!=="L")return null;let o=e+1,s="";if(t[o]==="("){let
|
|
97
|
-
`;)o++;
|
|
98
|
-
`&&n++,n}let
|
|
99
|
-
`){
|
|
100
|
-
`)break t;
|
|
94
|
+
\u884C\u9996\u5141\u8BB8\u7A7A\u767D\uFF0C\u6362\u884C\u7ED3\u675F\u5F53\u524D\u58F0\u660E\uFF1B\u5728\u884C\u672B\u52A0 \`\\\` \u53EF\u7EED\u884C\u3002\u8FD9\u79CD\u5199\u6CD5\u4E2D\u7684\u6B4C\u8BCD\u5141\u8BB8\u76F4\u63A5\u4F7F\u7528\u9017\u53F7\u3002`,allowExtraArgs:!0,extraArgType:"string",args:[{type:"content",description:"\u58F0\u90E8\u7684\u97F3\u7B26\u5185\u5BB9",default:null},{name:"name",description:"\u663E\u793A\u5728\u5DE6\u4FA7\u7684\u58F0\u90E8\u540D\u79F0\uFF0C\u7A7A\u503C\u9690\u85CF\u540D\u79F0",type:"string",default:""}]};static deSugarAtom(t,e,n){if(t[e]!=="N"&&t[e]!=="L")return null;let o=e+1,s="";if(t[o]==="("){let i=Fs(t,o+1,n);if(i<0)return null;s=Ot(t.slice(o+1,i).trim()),o=i+1}if(t[o++]!==":")return null;if(t[e]==="N")return{next:o,node:{kind:"sugar",data:{class:r,name:s},span:{start:e,end:o}}};{if(o=mt(t,o,n),o>=n)return null;let i;if(t[o]==='"'){let a=At(t,o,n);if(a<0)return null;i=Ot(t.slice(o,a+1)),o=a+1}else{let a=o;for(;o<n&&t[o]!==`
|
|
95
|
+
`;)o++;i=t.slice(a,o).trim()}return{next:o,node:{kind:"sugar",data:{class:r,lyric:i,name:s},span:{start:e,end:o}}}}}static deSugarRelation(t,e,n,o){let s=e[n++];if(s.data?.class!==r)return null;if(s.data?.lyric!==void 0){let x=null,m=t.nodes.length-1;for(;m>=0;m--){let y=t.nodes[m];if(y instanceof U){if(!t.variables.strict)continue;throw new C("E_LYRICS_WITHOUT_VOICE_NOTES","strict \u6A21\u5F0F\u4E0B\uFF0C\u8BED\u6CD5\u7CD6 'L:' \u6216 'L(name)' \u5FC5\u987B\u8DDF\u5728 @voice \u7684\u97F3\u7B26\u4E4B\u540E\uFF0C\u4F46\u5728\u5176\u524D\u9762\u53D1\u73B0\u4E86\u672A\u77E5\u6587\u672C",y.sourceSpan)}y instanceof r?x=y:y instanceof _t&&(x=y.voices.at(-1)??null);break}if(x===null)throw new C("E_LYRICS_WITHOUT_VOICE_NOTES","\u8BED\u6CD5\u7CD6 'L:' \u6216 'L(name):' \u5FC5\u987B\u8DDF\u5728 @voice\uFF08\u6216 N:\uFF09\u4E4B\u540E\uFF0C\u4F46\u6CA1\u6709\u627E\u5230\u7B26\u5408\u8981\u6C42\u7684 voice\uFF1B\u8BF7\u68C0\u67E5\u8BED\u6CD5\u6216\u76F4\u63A5\u4F7F\u7528 @voice \u51FD\u6570",s.span);return x.addLyric(s.data.name,s.data.lyric,s.span,t),t.nodes.length=m+1,n<e.length&&typeof e[n]=="number"&&t.source[e[n]]===`
|
|
96
|
+
`&&n++,n}let i=n,c=0;for(;i<e.length;i++){let x=e[i];if(typeof x=="number"){if(t.source[x]===`
|
|
97
|
+
`){c=1;break}}else if(x.kind==="sugar"&&(x.data?.class===r||x.data?.class===_t))break}let a=new at(t),l=e.slice(n,i);if(i+=c,a.makeNodes(l),a.nodes.length===0)throw k.error.EmptyContent("voice","content",s.span);let h={start:s.span.start,end:a.nodes.at(-1).sourceSpan.end},p=new Map;a.nodes.length===1&&a.nodes[0]instanceof Y?p.set(0,a.nodes[0]):p.set(0,new Y({...h},a.nodes)),p.set("name",s.data.name);let f=new r(h,p,t,null);if(o)return t.pushNode(f),o.push(f),i;let d=null,u=t.nodes.length-1,g=null;t:for(;u>=0;u--){let x=t.nodes[u];if(x instanceof U){if(t.variables.strict)break;for(let m=x.sourceSpan.start;m<x.sourceSpan.end;m++)if(t.source[m]===`
|
|
98
|
+
`)break t;g=x;continue}if(x instanceof _t){if(!x.createdBySugar)break;d=x}else if(x instanceof r){let m=new Map;m.set(0,x),d=new _t({start:x.sourceSpan.start,end:x.sourceSpan.end},m,t,null),d.createdBySugar=!0}break}return d?(t.nodes[u]=d,d.addVoice(f),g&&(t.nodes.length=u+1,t.diagnostics.push(new P("W_VOICES_TEXT_BETWEEN","\u4E24\u4E2A @voice \u4E4B\u95F4\u6709\u672A\u77E5\u6587\u672C\u3002\u5F53\u524D\u5904\u4E8E\u975E strict \u6A21\u5F0F\uFF0C\u4F1A\u5FFD\u7565\u8BE5\u5185\u5BB9\u3001\u5408\u5E76\u4E3A\u4E00\u4E2A @voices",g.sourceSpan)))):t.pushNode(f),i}content;name;size;font;lyrics;get children(){return[this.content]}timeFlowModel(){return{children:this.children,mode:"sequence"}}loweringEnter(t){let e=this.parent,n=e instanceof _t&&e.voices.length>1?e.braceSpace:0,o=new sn(this,n),s=[],i=[];return t.beginLoweringGroup(this,{attachment:new Do(s,o,i),onAttachment(c){ut(c)&&c.layer==="background"&&i.push(c)},onTemporal(c){s.push(c)}}),[o]}loweringExit(t){return t.endLoweringGroup(this),[]}constructor(t,e,n,o=null){super(t,o),this.size=n.variables.fontsize,[this.content,this.name]=this.getArgValue(e,n),this.content.parent=this,this.font=n.variables.font,e.delete(0),e.delete("name"),e.delete(1),this.lyrics=[];for(let[s,i]of e){if(typeof i=="string"){this.addLyric(s,i);continue}let c=i,a=n.parseArgWithType(c.valueSpan,"string",t.start);a===null?n.diagnostics.push(new P("W_VOICE_INVALID_LYRIC",`@voice \u7684\u6B4C\u8BCD\u53C2\u6570\u503C\u89E3\u6790\u5931\u8D25, \u53C2\u6570[${s}]\u5C06\u88AB\u5FFD\u7565`,c.valueSpan)):this.addLyric(s,a)}}addLyric(t,e,n=null,o=null){typeof t=="number"&&(t="");let s=r.parseLyric(e);if(s.length===0&&o&&n&&o.diagnostics.push(new P("W_EMPTY_LYRIC",`@voice\u7684\u6B4C\u8BCD${t}\u662F\u7A7A\u7684`,n)),this.lyrics.push({name:t,tokens:s}),n)for(let i=this;i;i=i.parent)i.sourceSpan.start=Math.min(n.start,i.sourceSpan.start),i.sourceSpan.end=Math.max(n.end,i.sourceSpan.end)}static parseLyric(t){let e=[],n="",o="",s=c=>{e.push(o+c),o=""},i=()=>{n&&s(n),n=""};for(let c=0;c<t.length;c++){let a=String.fromCodePoint(t.codePointAt(c));if(c+=a.length-1,a==="\\"&&c+1<t.length&&/[\\{}@-]/.test(t[c+1]))n+=t[++c];else if(a==="{"){let l=c+1,h="";for(;l<t.length&&t[l]!=="}";l++)t[l]==="\\"&&l+1<t.length&&/[\\{}@-]/.test(t[l+1])?h+=t[++l]:h+=t[l];l<t.length?(i(),s(h),c=l):n+=a}else Sc.test(a)?i():a==="-"?(n+=a,n.length>1&&i()):a==="@"?(n&&(n+=a,i()),e.push("")):Fi.has(a)?(i(),o+=a):Io.has(a)?n?n+=a:o||!e.at(-1)?o+=a:e[e.length-1]+=a:a.charCodeAt(0)>127?(i(),s(a)):n+=a}return i(),o&&(e.at(-1)?e[e.length-1]+=o:e.push(o)),e}toString(t){let e=[`${this.content.toString(t)},${ct(this.name)}`];for(let n of this.lyrics){let o=ct(n.tokens.map(s=>s.length===0?"@":`{${s.replace(/[\\{}@-]/g,"\\$&")}}`).join(" "));e.push(n.name?`${n.name}=${o}`:o)}return`@voice(
|
|
101
99
|
${e.join(`,
|
|
102
100
|
`)}
|
|
103
|
-
)`}},
|
|
101
|
+
)`}},_t=class r extends _{static def={name:["voices","vs"],description:"\u591A\u4E2A\u58F0\u90E8",details:`~~~jpfun
|
|
104
102
|
@voices(
|
|
105
103
|
@voice({1 2 3}, \u94A2\u7434, \u7537=ha ha ha),
|
|
106
104
|
@voice({3 4 5}, , "la la la")
|
|
@@ -109,6 +107,11 @@ L: la la la
|
|
|
109
107
|
|
|
110
108
|
\u63A5\u53D7\u591A\u4E2A\u58F0\u90E8\u4F5C\u4E3A\u4F4D\u7F6E\u53C2\u6570\uFF0C\u5C06\u5B83\u4EEC\u6309\u65F6\u95F4\u5BF9\u9F50\u3001\u5206\u884C\u6392\u5E03\uFF1B\u58F0\u90E8\u540D\u79F0\u548C\u6B4C\u8BCD\u7531\u5404\u81EA\u7684 \`@voice\` \u63D0\u4F9B
|
|
111
109
|
|
|
110
|
+
**\u89C6\u89C9\u8FDE\u63A5**\uFF1A\u4EC5\u547D\u540D\u53C2\u6570 \`connect\` \u4F7F\u7528\u5B57\u7B26\u4E32\uFF0C\u5982 \`connect="[1-4]{5-7}"\`\u3002
|
|
111
|
+
\`[]\` \u662F\u73B0\u6709\u62EC\u7EBF\uFF0C\`{}\` \u662F\u5F2F\u66F2\u5927\u62EC\u53F7\uFF1B\u7F16\u53F7\u4ECE 1 \u5F00\u59CB\uFF0C\u7701\u7565\u8D77\u70B9/\u7EC8\u70B9\u8868\u793A\u9996/\u672B\u58F0\u90E8\u3002
|
|
112
|
+
\u9ED8\u8BA4 \`"[-]"\` \u8FDE\u63A5\u5168\u90E8\u58F0\u90E8\uFF1B\`""\` \u53EA\u4FDD\u7559\u516C\u5171\u7EC6\u8FDE\u8C31\u7EBF\u3002\u672A\u6307\u5B9A\u7684\u58F0\u90E8\u4ECD\u6709\u7EC6\u7EBF\uFF0C\u8303\u56F4\u53EF\u4EE5\u91CD\u53E0\uFF0C\u4E0D\u6539\u53D8\u58F0\u90E8\u6216\u64AD\u653E\u5173\u7CFB\u3002
|
|
113
|
+
\u7528 \`@set(voices.connect="{1-2}[3-]")\` \u8BBE\u7F6E\u540E\u7EED\u591A\u58F0\u90E8\u5757\u7684\u9ED8\u8BA4\u65B9\u6848\uFF0C\u663E\u5F0F\u53C2\u6570\u5199\u5728\u6240\u6709\u58F0\u90E8\u4E4B\u540E\u3002
|
|
114
|
+
|
|
112
115
|
**\u7B80\u5199**\uFF1A\u8FDE\u7EED\u58F0\u660E\u591A\u4E2A \`N:\` \u58F0\u90E8\u53CA\u5176 \`L:\` \u6B4C\u8BCD\uFF0C\u4F1A\u81EA\u52A8\u7EC4\u6210 \`voices\`
|
|
113
116
|
|
|
114
117
|
~~~jpfun
|
|
@@ -116,7 +119,21 @@ N(\u94A2\u7434): 1 2 3
|
|
|
116
119
|
L(\u7537): ha ha ha
|
|
117
120
|
N: 3 4 5
|
|
118
121
|
L: la la la
|
|
119
|
-
|
|
122
|
+
~~~
|
|
123
|
+
|
|
124
|
+
\u8FDE\u63A5\u58F0\u660E \`V{}:\`\u3001\`V[]:\`\u3001\`V|:\` \u5206\u522B\u6307\u5B9A\u540E\u7EED\u58F0\u90E8\u7684\u5F2F\u66F2\u5927\u62EC\u53F7\u3001\u73B0\u6709\u62EC\u7EBF\u548C\u4EC5\u7EC6\u7EBF\uFF0C\u540E\u9762\u7684 \`N:\` \u53EF\u4EE5\u540C\u884C\uFF0C\u4E5F\u53EF\u4EE5\u6362\u884C\u3002
|
|
125
|
+
\u5230\u4E0B\u4E00\u6761 V \u58F0\u660E\u6216\u5F53\u524D\u5757\u672B\u5C3E\u7ED3\u675F\uFF0C\u7EC4\u95F4\u4E0D\u7A7A\u884C\uFF1B\u7A7A\u884C\u7ED3\u675F\u6574\u4E2A\u591A\u58F0\u90E8\u5757\u3002
|
|
126
|
+
\u51FA\u73B0 V \u58F0\u660E\u65F6\uFF0C\u5F53\u524D\u5757\u5B8C\u6574\u66FF\u6362\u9ED8\u8BA4\u8FDE\u63A5\u65B9\u6848\uFF0C\u4E0D\u5F71\u54CD\u540E\u9762\u7684\u5757\u3002V \u4E0D\u521B\u5EFA\u97F3\u8F68\uFF0CL \u4ECD\u5C5E\u4E8E\u524D\u9762\u7684 N\u3002
|
|
127
|
+
|
|
128
|
+
~~~jpfun
|
|
129
|
+
V{}: N(\u53F3\u624B): 1 2 3
|
|
130
|
+
N(\u5DE6\u624B): 5 6 7
|
|
131
|
+
V[]: N(\u5973\u9AD8): 6 6 5
|
|
132
|
+
L: \u554A \u554A \u554A
|
|
133
|
+
N(\u5973\u4F4E): 1 2 3
|
|
134
|
+
~~~`,allowExtraArgs:!0,extraArgType:"content",args:[{name:"connect",namedOnly:!0,type:"string",default:"[-]",description:"\u89C6\u89C9\u8FDE\u63A5\uFF1A[1-4] \u4E3A\u73B0\u6709\u62EC\u7EBF\uFF0C{5-7} \u4E3A\u5F2F\u66F2\u5927\u62EC\u53F7\uFF1B\u7701\u7565\u7AEF\u70B9\u8868\u793A\u9996/\u672B\u58F0\u90E8\uFF0C\u7A7A\u5B57\u7B26\u4E32\u53EA\u4FDD\u7559\u516C\u5171\u8FDE\u8C31\u7EBF\u3002"}]};static deSugarAtom(t,e,n){if(t[e]!=="V")return null;let o=/^V(\{\}|\[\]|\|):/.exec(t.slice(e,n));if(!o)return null;let s=e+o[0].length,i={kind:"sugar",data:{class:r,kind:o[1]==="{}"?"brace":o[1]==="[]"?"bracket":"line"},span:{start:e,end:s}};return{next:s,node:i}}static deSugarRelation(t,e,n){let o=e[n];if(typeof o=="number"||o.kind!=="sugar"||o.data?.class!==r)return null;let s=t.nodes.length-1;for(;s>=0&&t.nodes[s]instanceof U;){let{sourceSpan:d}=t.nodes[s],u=t.source.slice(d.start,d.end);if(u.includes(`
|
|
135
|
+
`)||u.trim())break;s--}let i=t.nodes[s],c=i instanceof Bt?[i]:i instanceof r&&i.createdBySugar?[...i.voices]:[],a=c.length>0,l=[],h=n;for(;h<e.length;){let d=e[h];if(typeof d=="number"||d.kind!=="sugar"||d.data?.class!==r)break;h++;let u=e[h];typeof u=="number"&&t.source[u]==="\r"&&h++;let g=e[h];typeof g=="number"&&t.source[g]===`
|
|
136
|
+
`&&h++;let x=new at(t),m=c.length+1;for(;h<e.length;){let y=e[h];if(typeof y=="number"||y.kind!=="sugar"||y.data?.class!==Bt)break;h=Bt.deSugarRelation(x,e,h,c)}if(c.length<m)throw new C("E_VOICES_GROUP_EMPTY","V \u58F0\u90E8\u5206\u7EC4\u5FC5\u987B\u81F3\u5C11\u5305\u542B\u4E00\u6761 N: \u58F0\u90E8\u58F0\u660E",d.span);(d.data.kind==="brace"||d.data.kind==="bracket")&&l.push({kind:d.data.kind,from:m,to:c.length})}let p=new Map;c.forEach((d,u)=>p.set(u,d)),p.set("connect",Oo(l));let f=new r({start:a?i.sourceSpan.start:o.span.start,end:c.at(-1).sourceSpan.end},p,t);return f.createdBySugar=!0,a&&(t.nodes.length=s),t.pushNode(f),h}voices;createdBySugar=!1;size;braceSpace;connect;get connectionSpecs(){return Mi(this.connect,this.sourceSpan)}measure;get children(){return this.voices}timeFlowModel(){return{children:this.children,mode:"parallel",tracks:{laneKey:`voices/${this.voices.length}`,hostIndex:null,measure:this.measure}}}loweringEnter(t){let e=[];return t.beginLoweringGroup(this,{attachment:new Fo(e,this,Ri(this.connectionSpecs,this.voices.length,this.sourceSpan)),onTemporal:n=>{n instanceof sn&&n.ast.parent===this&&e.push(n)}}),[]}loweringExit(t){return t.endLoweringGroup(this),[]}constructor(t,e,n,o=null){super(t,o),this.voices=[],this.size=n.variables.fontsize,this.braceSpace=Math.max(n.variables.fontsize,(Ii*(gt+.5)+.5)/(1-Pi)),this.measure=Cc(n.variables.fontsize),[this.connect]=this.getArgValue(e,n);for(let[s,i]of e){if(s==="connect")continue;let c=i instanceof q?i.sourceSpan:i.valueSpan,a=i instanceof q?i:n.parseArgWithType(c,"content",t.start);if(!(a instanceof Bt))throw new C("E_VOICES_INVALID_CHILD",`@voices \u7684\u53C2\u6570\u5FC5\u987B\u662F @voice \u51FD\u6570\uFF0C\u4F46\u53D1\u73B0\u4E86\u5176\u4ED6\u7C7B\u578B ${a?.constructor.name}`,c);this.addVoice(a)}if(this.voices.length===0)throw new C("E_VOICES_EMPTY","@voices \u5FC5\u987B\u81F3\u5C11\u5305\u542B\u4E00\u4E2A @voice \u51FD\u6570",t)}addVoice(t){this.voices.push(t),t.parent=this,this.sourceSpan.start=Math.min(t.sourceSpan.start,this.sourceSpan.start),this.sourceSpan.end=Math.max(t.sourceSpan.end,this.sourceSpan.end)}toString(t){let e=this.voices.map(n=>` ${n.toString(t)}`);return e.push(` connect=${ct(Oo(this.connectionSpecs))}`),`@voices(
|
|
120
137
|
${e.join(`,
|
|
121
138
|
`)}
|
|
122
|
-
)`}},xi=de,mi=Pt,go=.82,ec=.6;function yi(i,t){return{fontFamily:t,fontSize:i*go,fill:"#000",fontWeight:600}}var Xe=class extends W{braceSpace;textBaselineY=0;constructor(t,e){super(),this.ast=t,this.braceSpace=e,this.mergeKey=-2,(t.name||e>0||t.lyrics.some(n=>n.name))&&this.initLayoutBox()}prepareLayout(t){let e=this.ast.name?t.textMeasurer.measureText(this.ast.name,this.style):{w:0,h:0,baseline:0},n=e.w;for(let s of this.ast.lyrics){if(!s.name)continue;let r=t.textMeasurer.measureText(s.name,yi(this.ast.size,this.ast.font));n=Math.max(n,r.w)}let o=this.braceSpace>0?this.braceSpace:n>0?this.ast.size*ec:0;this.box.w=n+o,this.box.h=e.h,this.box.anchor=n,this.box.visualAxis=e.h/2,this.textBaselineY=e.baseline,this.springConfig.alpha_R=.45}get style(){return{fontSize:this.ast.size*.85,fontFamily:this.ast.font,fill:"#000",fontWeight:600,textAlign:"right"}}paint(t){this.ast.name&&t.drawText(this.ast.name,this.box.x+this.box.anchor,this.box.y+this.textBaselineY,this.style)}},Ot=2.33,It=1.17,Rt=.34,nc=[{op:"M",x:0,y:0},{op:"L",x:0,y:-Rt},{op:"C",cx1:Ot*.421,cy1:-Rt+It*.077,cx2:Ot*.733,cy2:-Rt+It*.346,x:Ot,y:-Rt+It},{op:"L",x:Ot*.929,y:-Rt+It},{op:"C",cx1:Ot*.696,cy1:-Rt+It*.535,cx2:Ot*.328,cy2:-Rt+It*.352,x:0,y:0},{op:"Z"}],bo=class{layer="background";names;ast;get sourceSpan(){return this.ast.sourceSpan}constructor(t,e){this.names=t,this.ast=e}createGeometry(){if(this.names.length<2)return{regions:[],paint(){}};let t=this.names[0].box,e=this.names[this.names.length-1].box,n=this.ast.size,o=t.y+t.visualAxis-n*.5,s=e.y+e.visualAxis+n*.5;if(s-o<1e-6)return{regions:[],paint(){}};let r=Math.max(2.5,n*.19),c=r*Ot,a=r*It,l=t.x+t.anchor+this.ast.braceSpace*.3+r/2,h=[{x:l-r/2,y:o,w:r,h:s-o},{x:l+r*1.33-r*.165,y:o+r*.67,w:r*.33,h:s-o-r*1.34}],p=[{x:l,y:o,scale:r,dir:-1},{x:l,y:s,scale:r,dir:1}];return{regions:[{x:l-r/2,y:o-a,w:c+r/2,h:s-o+a*2}],paint(d){for(let u of h)d.drawRect(u.x,u.y,u.w,u.h,{fill:"#000"});for(let u of p)d.drawPath(nc,{fill:"#000"},{x:u.x,y:u.y,scaleX:u.scale,scaleY:u.scale*u.dir})}}}},wo=class{layer="foreground";temporalMembers;nameHost;get sourceSpan(){return this.nameHost.ast.sourceSpan}constructor(t,e){this.temporalMembers=t,this.nameHost=e}prepareHorizontal(t,e){let n=this.temporalMembers.filter(F).filter(c=>c.ports?.lyric),{lyrics:o,size:s}=this.nameHost.ast;if(n.length===0||o.length===0)return;let r={fontSize:s*go,fontFamily:this.nameHost.ast.font,fill:"#000"};for(let c=0;c<n.length;c++){let a=n[c],l=0;for(let h of o){let p=h.tokens[c];if(p){let{body:f}=ui(p);f&&(l=Math.max(l,e.textMeasurer.measureText(f,r).w/2))}}l!==0&&t[a.layoutLine]?.registerHorizontalLayoutHook(a,a,({columns:h,start:p})=>{let f=h[p].find(u=>u.time===a);if(!f)return;let d=a.ports.lyric.x-a.box.anchor;f.WL=Math.max(f.WL,l-d),f.WR=Math.max(f.WR,l+d)})}}createGeometry(t){let e=this.prepareGeometry(t);return{regions:e,paint(n){for(let o of e)n.drawText(o.text,o.x,o.y+o.textBaselineY,o.style)}}}prepareGeometry(t){let{lyrics:e,size:n}=this.nameHost.ast,o=[],s=this.temporalMembers.filter(F).filter(m=>m.ports?.lyric);if(s.length===0||e.length===0)return o;let r=new Map;for(let m of s){let b=r.get(m.layoutLine);b||r.set(m.layoutLine,b=new Map);let w=m.box.y+m.box.h;b.set(m.track,Math.max(b.get(m.track)??w,w))}let c=n*go,a=n*.24,l=n*.32,h={fontSize:c,fontFamily:this.nameHost.ast.font,fill:"#000"},p=yi(n,this.nameHost.ast.font),f=t.textMeasurer.measureText("M",h).baseline+l,d=(m,b)=>m+f+b*(c+a),{box:u,layoutLine:g,track:y}=this.nameHost,x=r.get(g)?.get(y);for(let m=0;m<e.length;m++){let b=e[m];for(let A=0;A<b.tokens.length&&A<s.length;A++){let k=b.tokens[A],M=s[A],T=r.get(M.layoutLine)?.get(M.track);if(!k||T===void 0)continue;let E=t.textMeasurer.measureText(k,h),{prefix:C,body:_}=ui(k),P=_?t.textMeasurer.measureText(_,h).w:0,j=C?t.textMeasurer.measureText(C,h).w:0;o.push({text:k,style:h,textBaselineY:E.baseline,x:M.box.x+M.ports.lyric.x-P/2-j,y:d(T,m)-E.baseline,w:E.w,h:E.h,line:M.layoutLine,track:M.track})}if(!b.name||!u||x===void 0)continue;let w=t.textMeasurer.measureText(b.name,p);o.push({text:b.name,style:p,textBaselineY:w.baseline,x:u.x+u.anchor-w.w,y:d(x,m)-w.baseline,w:w.w,h:w.h,line:g,track:y})}return o}};var Ze=[zs,rs,jo,Yt,hs,fi,xi,mi,Ps,Gs,Is,Ks,Hs,Ws,Uo,xs,pi,ss,ps,is,li,Ro,ci,Fe,$e,Be,Vs,ze,ri];function So(i,t={}){let e=new Map,n=new Set(i);for(let o of n){let s=o.layoutDecorationHandler;if(!s)continue;let r=o.def?.name;if(!r)continue;let c=Array.isArray(r)?r[0]:r;e.set(Lt(c),s)}return{textMeasurer:t.textMeasurer??On,decorationHandlers:e}}var xe=class i{loweringAugmenters=[];loweringFinalizers=[];cnt=0;usedTracks=new Set;attachments=[];page;astToTemporal=new Map;activeLoweringGroups=[];diagnostics;constructor(t=[]){this.diagnostics=t}registerFunctions(t){let e=this.loweringAugmenters=[],n=this.loweringFinalizers=[];for(let o of t)o.loweringAugment&&e.push(o.loweringAugment),o.loweringFinalize&&n.push(o.loweringFinalize)}setPageConfig(t){this.page=t}lowerDocument(t){this.cnt=0,this.usedTracks.clear(),this.attachments=[],this.page=void 0,this.astToTemporal=new Map,this.activeLoweringGroups=[];let e=new _t,n=new I,o=this.trackedEvents(t,n,e);return this.solidifyColumns(o),this.postprocessResult({diagnostics:this.diagnostics,columns:o,attachments:this.attachments,astToTemporal:this.astToTemporal,duration:n,rootTrack:e,tracks:[...this.usedTracks],page:this.page})}solidifyColumns(t){let e=0;for(let a of t){let l=0;for(let h of a)h.breakBefore>l&&(l=h.breakBefore);e+=l,a.layoutLine=e}let n={bpm:yt,velocity:Bt,keySignature:oe,program:be},o=new Map,s=new Map,r=a=>o.get(a)??(a.parent?r(a.parent):Bt),c=a=>s.get(a)??(a.parent?c(a.parent):be);for(let a of t)for(let l of a)n.velocity=r(l.track),n.program=c(l.track),l.onTimeState?.(n),o.set(l.track,n.velocity),s.set(l.track,n.program)}beginLoweringGroup(t,e){this.activeLoweringGroups.push({owner:t,group:e})}endLoweringGroup(t){let e=this.activeLoweringGroups.pop();if(!e)throw new Error("No active lowering group to end");if(e.owner!==t)throw new Error("Lowering groups must end in reverse order");return e.group.attachment&&this.addAttachment(e.group.attachment),e.group}postprocessResult(t){if(this.activeLoweringGroups.length>0)throw new Error("Lowering groups must be closed before post-processing");let e=[];for(let n of this.loweringAugmenters)for(let o of n(t))e.push(o);for(let n of e)this.addAttachment(n);for(let n of this.loweringFinalizers)n(t);return t}addAttachment(t){this.attachments.push(t);for(let e=this.activeLoweringGroups.length-1;e>=0;e--)this.activeLoweringGroups[e].group.onAttachment?.(t)}getTemporalNodes(t){return this.astToTemporal.get(t)??[]}isolateFromLoweringGroups(t){let e=this.activeLoweringGroups;this.activeLoweringGroups=[];try{return t()}finally{this.activeLoweringGroups=e}}initEvent(t,e,n,o){t.t.add(n),this.usedTracks.add(o),t.track=o,t.ast??=e,t.order=this.cnt++,t.mergeKey??=t.order}trackedEvents(t,e,n){let o=[];this.appendEvents(t.loweringEnter(this,n),t,e,n,o);let s=t.timeFlowModel(this);if(s)switch(s.mode){case"sequence":for(let r of s.children)for(let c of this.trackedEvents(r,e,n))o.push(c);break;case"parallel":{let r=s.tracks,c=s.children,a=r.hostIndex===void 0?0:r.hostIndex,l=n.group(r,a===null?c.length:c.length-1),h=[];for(let d=0;d<c.length;d++){let u=c[d],g=d===a?n:l.members[a===null||d<a?d:d-1],y=e.clone(),x=this.trackedEvents(u,y,g);x.length===0&&this.diagnostics.push(N.warning.ZeroTimeTrack(u.sourceSpan,d+1)),h.push(x)}let p=o.length;for(let d of i.anchorAlign(h))o.push(d);let f=new I;for(let d=p;d<o.length;d++)for(let u of o[d])f.copyFrom(u.t).add(u.T),f.compare(e)>0&&e.copyFrom(f)}break}return this.appendEvents(t.loweringExit(this,n,e),t,e,n,o),o}appendEvents(t,e,n,o,s){let r;for(let c of t){this.initEvent(c,e,n,o),this.indexTemporal(c);for(let l=this.activeLoweringGroups.length-1;l>=0;l--)this.activeLoweringGroups[l].group.onTemporal?.(c);let a=(r??=new I).copyFrom(c.t).add(c.T);a.compare(n)>0&&n.copyFrom(a),s.push(new Ao(c))}}indexTemporal(t){let e=this.astToTemporal.get(t.ast);e?e.push(t):this.astToTemporal.set(t.ast,[t])}static anchorAlign(t){for(let l=t.length-1;l>=0;l--)t[l].length===0&&t.splice(l,1);let e=t.length;if(e===0)return[];if(e===1)return t[0];let n=[];if(e===2){let l=t[0],h=t[1],p=l.length,f=h.length,d=0,u=0,g=new I,y=new I,x=l[0],m=h[0],b=x.t.clone(),w=m.t.clone();for(;;){if(x.mergeKey===U){if(m.mergeKey!==U){for(n.push(m),m=h[++u];u<f&&m.mergeKey!==U;)y.isZero()||m.shiftTime(y),n.push(m),m=h[++u];m&&(m.shiftTime(y),w.copyFrom(m.t))}if(u<f){let A=b.compare(w)>=0?b:w;g.add(A).sub(b),y.add(A).sub(w),x.push(...m),x.t=A,m=h[++u]}if(n.push(x),x=l[++d],x&&(x.shiftTime(g),b.copyFrom(x.t)),m&&(m.shiftTime(y),w.copyFrom(m.t)),!x||!m)break}if(m.mergeKey===U){if(x.mergeKey!==U){for(n.push(x),x=l[++d];d<p&&x.mergeKey!==U;)g.isZero()||x.shiftTime(g),n.push(x),x=l[++d];x&&(x.shiftTime(g),b.copyFrom(x.t))}if(d<p){let A=b.compare(w)>=0?b:w;g.add(A).sub(b),y.add(A).sub(w),m.push(...x),m.t=A,x=l[++d]}if(n.push(m),m=h[++u],x&&(x.shiftTime(g),b.copyFrom(x.t)),m&&(m.shiftTime(y),w.copyFrom(m.t)),!x||!m)break}if(b.equals(w)){if(x.mergeKey===m.mergeKey){if(x.push(...m),n.push(x),x=l[++d],m=h[++u],x&&(x.shiftTime(g),b.copyFrom(x.t)),m&&(m.shiftTime(y),w.copyFrom(m.t)),!x||!m)break}else if(x.mergeKey<m.mergeKey)if(n.push(x),x=l[++d],x)x.shiftTime(g),b.copyFrom(x.t);else break;else if(n.push(m),m=h[++u],m)m.shiftTime(y),w.copyFrom(m.t);else break;continue}if(b.compare(w)<0)if(n.push(x),x=l[++d],x){x.shiftTime(g),b.copyFrom(x.t);continue}else break;if(w.compare(b)<0)if(n.push(m),m=h[++u],m){m.shiftTime(y),w.copyFrom(m.t);continue}else break}for(x&&n.push(x);++d<p;)x=l[d],g.isZero()||x.shiftTime(g),n.push(x);for(m&&n.push(m);++u<f;)m=h[u],y.isZero()||m.shiftTime(y),n.push(m);return n}let o=new Uint16Array(e),s=Array.from({length:e},()=>new I),r=[],c=new Lo(e);for(let l=0;l<e;l++)c.push({e:t[l][0],i:l});let a=l=>{let h=t[l][++o[l]];h&&(s[l].isZero()||h.shiftTime(s[l]),c.push({e:h,i:l}))};for(;;){let l=c.pop();if(l===void 0){if(r.length===0)break;let p=r[0],f=p.e,d=f.t;for(let u=1;u<r.length;u++)r[u].e.t.compare(d)>0&&(d=r[u].e.t);s[p.i].add(d).sub(f.t),a(p.i);for(let u=1;u<r.length;u++){let g=r[u];f.push(...g.e),s[g.i].add(d).sub(g.e.t),a(g.i)}r.length=0,f.t=d,f.sort((u,g)=>u.order-g.order),n.push(f);continue}if(l.e.mergeKey===U){r.push(l);continue}let h=[l.i];for(;;){let p=c.front();if(!p||!p.e.t.equals(l.e.t)||p.e.mergeKey!==l.e.mergeKey)break;c.pop(),l.e.push(...p.e),h.push(p.i)}n.push(l.e);for(let p of h)a(p)}return n}},Ao=class extends Array{static get[Symbol.species](){return Array}mergeKey;constructor(t){super(1),this.mergeKey=t.mergeKey,this[0]=t}get t(){return this[0].t}set t(t){for(let e of this)e.t.copyFrom(t)}shiftTime(t){for(let e of this)e.t.add(t)}set layoutLine(t){for(let e of this)e.layoutLine=t}};function Co(i,t){let e=i.e.t.compare(t.e.t);return e!==0?e:i.e.mergeKey!==t.e.mergeKey?i.e.mergeKey<t.e.mergeKey?-1:1:i.i-t.i}var Lo=class extends Array{validLen=0;constructor(t){super(t)}front(){if(this.validLen!==0)return this[0]}push(t){return this[this.validLen]=t,this.up(this.validLen++),this.validLen}pop(){if(this.validLen===0)return;let t=this[0];return this[0]=this[--this.validLen],this[this.validLen]=void 0,this.down(0),t}up(t){let e=this[t];for(;t>0;){let n=t-1>>1;if(Co(e,this[n])>=0)break;this[t]=this[n],t=n}this[t]=e}down(t){let e=this[t];for(;;){let n=(t<<1)+1,o=n+1;if(n>=this.validLen)break;let s=n;if(o<this.validLen&&Co(this[o],this[n])<0&&(s=o),Co(this[s],e)>=0)break;this[t]=this[s],t=s}this[t]=e}};function oc(i,t={}){let{functions:e=Ze,textMeasurer:n,variables:o,...s}=t,{maskedSource:r,lineStarts:c}=Xt(i),a=new ct({source:r,variables:o});a.registerFunctions(e);let l=new K({start:0,end:i.length},a.parse()),h=new xe(a.diagnostics);h.registerFunctions(e);let p=h.lowerDocument(l),f=So(e,{textMeasurer:n}),d=fn(p,f,s);return{lineStarts:c,maskedSource:r,diagnostics:a.diagnostics,ast:l,lowering:p,layout:d}}function sc(i,t=Ze){let{maskedSource:e,commentSpans:n}=Xt(i),o=new ct({source:e,commentSpans:n});return o.registerFunctions(t),{syntax:o.parseSyntax(),diagnostics:o.diagnostics}}function To(i){return typeof i.applyPlayback=="function"}function qe(i,t){let e=Math.max(0,t),n=0,o=0,s=yt;for(let r of i){if(r.kind!=="tempo")continue;let c=r.at.toNumber();if(c>e)break;c>o&&(n+=(c-o)*60/s),o=c,s=r.bpm}return n+(e-o)*60/s}function gi(i,t){let e=Math.max(0,t),n=0,o=yt;for(let s of i){if(s.kind!=="tempo")continue;let r=s.at.toNumber(),c=(r-n)*60/o;if(e<c)return n+e*o/60;e-=c,n=r,o=s.bpm}return n+e*o/60}function bi(i,t){let e=Math.max(0,t),n=e;for(let o of i){let s=o.performance.toNumber();if(s>e)break;n=o.score.toNumber()+e-s}return n}function wi(i,t){let e=Math.max(0,t),n;for(let o=0;o<i.length;o++){let s=i[o],r=s.score.toNumber();if(r>e){(!n||r<n.score.toNumber())&&(n=s);continue}let c=i[o+1],a=c?c.performance.toNumber()-s.performance.toNumber():1/0;if(!(e-r>=a))return s.performance.toNumber()+(e-r)}return n?.performance.toNumber()??e}function ic(i,t){let e=Math.min(gi(i.events,t),i.performanceDuration.toNumber());return bi(i.scoreMap,e)}function rc(i,t){let e=Math.min(wi(i.scoreMap,t),i.performanceDuration.toNumber());return qe(i.events,e)}var Si={tempo:0,"time-signature":1,"program-change":2,"note-off":3,"note-on":4};function Ci(i,t){return i.at.compare(t.at)||Si[i.kind]-Si[t.kind]||i.order-t.order}function Ai(i,t){let e=new Map,n=new Map;for(let c of i)if(c.kind==="note-on"){if(e.has(c.noteId))throw new Error(`Duplicate NoteOn ${c.noteId}`);e.set(c.noteId,c)}else if(c.kind==="note-off"){if(n.has(c.noteId))throw new Error(`Duplicate NoteOff ${c.noteId}`);n.set(c.noteId,c)}for(let[c,a]of e){let l=n.get(c);if(!l)throw new Error(`Note ${c} has no NoteOff`);if(l.at.compare(a.at)<=0)throw new Error(`Note ${c} has a non-positive duration`);if(a.origins.length===0||l.origins.length===0)throw new Error(`Note ${c} has no origin`)}for(let c of n.keys())if(!e.has(c))throw new Error(`NoteOff ${c} has no NoteOn`);let o=new Set;for(let c of e.values())o.add(c.track);let s=new Map;for(let c of t)o.has(c)&&s.set(c,s.size);for(let c of o)s.has(c)||s.set(c,s.size);let r=[];for(let c of i){if(c.kind==="tempo"){r.push({kind:"tempo",at:c.at,bpm:c.bpm});continue}if(c.kind==="time-signature"){r.push({kind:"time-signature",at:c.at,numerator:c.numerator,denominator:c.denominator});continue}if(c.kind==="program-change"){let h=s.get(c.track);h!==void 0&&r.push({kind:"program-change",at:c.at,track:h,program:c.program});continue}let a=c.kind==="note-on"?c:e.get(c.noteId),l=s.get(a.track);if(c.kind==="note-on"){r.push({kind:"note-on",at:c.at,noteId:c.noteId,track:l,midi:c.midi,velocity:c.velocity,...c.percussion?{percussion:!0}:{},sourceSpans:c.sourceSpans});continue}r.push({kind:"note-off",at:c.at,noteId:c.noteId,track:l,midi:a.midi})}return{events:r,tracks:[...s.keys()]}}function cc(i,t,e){let n=i.columns,o=new Map;for(let y=0;y<n.length;y++)for(let x of n[y])o.set(x,y);let s=y=>{for(let x=y;x;x=x.foldedInto){let m=o.get(x);if(m!==void 0)return m}},r=new Map,c=new Map,a=(y,x)=>{let m=y.playbackFlow?.(s);if(!m)return;let[b,w]=m.range??[0,n.length-1];if(m.range&&(!Number.isSafeInteger(b)||!Number.isSafeInteger(w)||b<0||w<b||w>=n.length))throw new S("E_PLAYBACK_FLOW_RANGE",`\u64AD\u653E\u63A7\u5236\u6D41\u8303\u56F4 [${b}, ${w}] \u8D85\u51FA\u65F6\u95F4\u5217\u8FB9\u754C`,x);let A={hook:m,sourceSpan:x};for(let k=b;k<=w;k++){let M=c.get(k);M?M.push(A):c.set(k,[A])}};for(let y of i.astToTemporal.values())for(let x of y){a(x,x.ast.sourceSpan);let m=x.playbackMarks?.();if(!m)continue;let b=s(x);if(b!==void 0)for(let w of m){let A=r.get(w);A?A.push(b):r.set(w,[b])}}for(let y of i.attachments)a(y,y.sourceSpan??{start:0,end:0});if(c.size===0)return n.map((y,x)=>x);for(let y of r.values())y.sort((x,m)=>x-m);let l=new Array(n.length).fill(0),h=0,p={get column(){return h},visits:y=>l[y]??0,seek(y,x,m){let b=r.get(y);if(b){if(m>0)return b.find(w=>w>x);for(let w=b.length-1;w>=0;w--)if(b[w]<x)return b[w]}}},f=[],d=0;for(;h<n.length;){if(++d>e)throw new S("E_PLAYBACK_FLOW_LIMIT",`\u64AD\u653E\u63A7\u5236\u6D41\u8BBF\u95EE\u8D85\u8FC7 ${e} \u6B65\uFF1B\u53EF\u901A\u8FC7 maxFlowSteps \u63D0\u9AD8\u5C55\u5F00\u9884\u7B97`,n[h][0].ast.sourceSpan);l[h]++;let y;for(let x of c.get(h)??[]){let b=x.hook.run(p);if(b){if(b.kind==="stop")return f;if(!Number.isSafeInteger(b.column)||b.column<0||b.column>n.length)throw new S("E_PLAYBACK_FLOW_JUMP",`\u64AD\u653E\u63A7\u5236\u6D41\u8DF3\u8F6C\u76EE\u6807 ${b.column} \u8D85\u51FA\u65F6\u95F4\u5217\u8FB9\u754C`,x.sourceSpan);y=Math.min(y??1/0,b.column)}}y!==void 0?h=y:(f.push(h),h++)}let u=new Set(f),g=!1;for(let y=0;y<n.length;y++){let x=!u.has(y);x&&!g&&t.push(new O("W_PLAYBACK_COLUMN_NEVER_PLAYED","\u8FD9\u91CC\u5728\u4EFB\u4F55\u4E00\u904D\u91CC\u90FD\u4E0D\u4F1A\u6F14\u594F",n[y][0].ast.sourceSpan)),g=x}return f}function ac(i,t){let e=t?.maxFlowSteps??65536;if(!Number.isSafeInteger(e)||e<=0)throw new S("E_PLAYBACK_FLOW_LIMIT","maxFlowSteps \u5FC5\u987B\u662F\u6B63\u5B89\u5168\u6574\u6570",i.columns[0]?.[0]?.ast.sourceSpan??{start:0,end:0});let n=[],o=[],s=[],r=[],c=new Map,a=new Map,l=0,h=0,p=[{kind:"initial",at:new I,origins:[]}],f=new Map,d=new Map,u={spans:s,notes:r,diagnostics:n},g=(L,R,B)=>{if(!Number.isFinite(L.toNumber())||L.compare(0)<0)throw new S("E_PLAYBACK_CONTROL_TIME","\u7CFB\u7EDF\u63A7\u5236\u65F6\u523B\u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u503C",R.at(-1).node.ast.sourceSpan);p.push({kind:"control",at:L.clone(),origins:R,apply:B})};function y(L,R,B,G,z,st=[],it=L.track){let nt=[...st,{node:L}],Ct=[...R],xt=[...R],nn=[...B],Dt=[...B],ge=[];function Jt(H){let J={...H,start:H.start.clone(),end:H.end.clone(),track:it,origins:nt,sourceSpans:[{...L.ast.sourceSpan}]};return s.push(J),Dt.length&&d.set(J,Dt),J}let At=L.playbackState?.program;At!==void 0&&a.get(it)!==At&&(a.set(it,At),o.push({kind:"program-change",at:G.clone(),order:l++,origins:nt,track:it,program:At}));let te=L.playbackState?.bpm;te!==void 0&&g(G,nt,H=>{H.bpm=te}),L.emitPlayback?.({start:G,end:G.clone().add(z),track:it,span(H){Jt(H)},note(H){let J=Jt(H);r.push(J),xt.length&&c.set(J,xt)},extend(H){if(!s.includes(H)||!H.end.equals(G)||z.compare(0)<=0)throw new S("E_PLAYBACK_EXTEND_RANGE","\u6269\u5C55\u5FC5\u987B\u63A5\u7EED\u5F53\u524D\u8BA1\u5212\u5185\u7684\u533A\u95F4\u4E14\u65F6\u503C\u4E3A\u6B63",L.ast.sourceSpan);let J=H.end.clone().sub(H.start),mt=J.clone().add(z),ee=(d.get(H)??[]).map(pt=>pt.startRatio?{...pt,startRatio:pt.startRatio.clone().mul(J).div(mt)}:pt);for(let pt of Dt)ee.push({...pt,startRatio:J.clone().div(mt)});ee.length&&d.set(H,ee),H.end.add(z)},emit:H=>o.push({...H,at:H.at.clone(),order:l++,origins:nt}),control:(H,J)=>g(H,nt,J),scaleFollowingBpm(H,J,mt=1,ee){if(!Number.isSafeInteger(J)||!Number.isSafeInteger(mt)||J<=0||mt<=0)throw new S("E_PLAYBACK_BPM_SCALE","\u901F\u5EA6\u6BD4\u4F8B\u5FC5\u987B\u662F\u6B63\u6709\u7406\u6570",L.ast.sourceSpan);let pt=new I(J,mt),Mo=f.get(H);if(Mo&&!Mo.equals(pt))throw new S("E_PLAYBACK_BPM_SCALE","\u540C\u4E00\u901F\u5EA6\u6548\u679C key \u5FC5\u987B\u4F7F\u7528\u56FA\u5B9A\u6BD4\u4F8B",L.ast.sourceSpan);f.set(H,pt),B.push({key:H,factor:pt,followConnections:ee?.followConnections??!1,origins:nt})},affectFollowing:H=>R.push(H),defer:H=>ge.push(H),play:(H,J,mt)=>y(H,Ct,nn,J??G,mt??z,nt,it)});for(let H of ge)H(u)}let x=cc(i,n,e),m=i.columns[x[0]]?.[0]?.t.clone()??new I,b=[{performance:new I,score:m}],w=new I().sub(m),A=new I;for(let L=0;L<x.length;L++){let R=x[L];for(let nt of i.columns[R])y(nt,[],[],nt.t.clone().add(w),nt.T.clone());let B=i.columns[R+1]?.[0]?.t??i.duration;A.copyFrom(B).add(w);let G=x[L+1];if(G===void 0||G===R+1)continue;let z=i.columns[G][0]?.t.clone()??new I;w.add(B).sub(z);let st={performance:A.clone(),score:z};b[b.length-1].performance.equals(st.performance)?b[b.length-1]=st:b.push(st)}for(let L of s){if(!Number.isFinite(L.start.toNumber())||!Number.isFinite(L.end.toNumber())||L.start.compare(0)<0||L.end.compare(L.start)<=0)throw new S("E_PLAYBACK_NOTE_RANGE","\u97F3\u6BB5\u5FC5\u987B\u5177\u6709\u975E\u8D1F\u8D77\u70B9\u548C\u6B63\u65F6\u503C",L.sourceSpans[0]);L.end.compare(A)>0&&A.copyFrom(L.end),Object.freeze(L.start),Object.freeze(L.end);for(let R of L.origins)Object.freeze(R);for(let R of L.sourceSpans)Object.freeze(R);Object.freeze(L.origins),Object.freeze(L.sourceSpans),Object.freeze(L)}let k=new Set(r),M=new Map,T=new Map,E={notes:r,diagnostics:n,connect(L,R){if(!k.has(L)||!k.has(R)||!L.end.equals(R.start))throw new S("E_PLAYBACK_CONNECTION","\u97F3\u6BB5\u8FDE\u63A5\u5FC5\u987B\u5C5E\u4E8E\u5F53\u524D\u8BA1\u5212\u4E14\u65F6\u95F4\u76F8\u63A5",L.sourceSpans[0]);return M.has(L)&&M.get(L)!==R||T.has(R)&&T.get(R)!==L?!1:(M.set(L,R),T.set(R,L),!0)}};for(let L of i.attachments)To(L)&&L.applyPlayback(E);let C=[...r].sort((L,R)=>R.start.compare(L.start)),_=new Map;for(let L of C){let R=M.get(L),B=R?_.get(R):L.end;_.set(L,B)}for(let L of s){let R=_.get(L)??L.end;for(let B of d.get(L)??[]){let G=B.startRatio?L.start.clone().add(L.end.clone().sub(L.start).mul(B.startRatio)):L.start;p.push({kind:"scale",at:G,origins:B.origins,scale:B,delta:1},{kind:"scale",at:B.followConnections?R:L.end,origins:B.origins,scale:B,delta:-1})}}let P={bpm:yt,bpmScale:new I(1)},j=new Map,X=new I(1),Y=[];p.sort((L,R)=>L.at.compare(R.at));let D=0,$;for(;D<p.length;){let L=p[D].at,R=new Set;for(;D<p.length&&p[D].at.equals(L);){let st=p[D++];for(let it of st.origins)R.add(it);if(st.kind==="control")st.apply(P);else if(st.kind==="scale"){let{key:it,factor:nt}=st.scale,Ct=j.get(it)??0,xt=Ct+st.delta;j.set(it,xt),Ct===0&&xt>0?X.mul(nt):Ct>0&&xt===0&&X.div(nt)}}let B=P.bpmScale.clone().mul(X),G={bpm:P.bpm,bpmScale:B,effectiveBpm:P.bpm*B.toNumber()};if(!Number.isFinite(G.effectiveBpm)||G.effectiveBpm<=0)throw new S("E_PLAYBACK_BPM","\u7CFB\u7EDF\u63A7\u5236\u4EA7\u751F\u4E86\u65E0\u6548\u901F\u5EA6",[...R].at(-1)?.node.ast.sourceSpan??{start:0,end:0});let z=Y.at(-1)?.state;(!z||z.bpm!==G.bpm||!z.bpmScale.equals(B))&&Y.push({at:L.clone(),state:G}),$!==G.effectiveBpm&&($=G.effectiveBpm,o.push({kind:"tempo",at:L.clone(),bpm:G.effectiveBpm,order:l++,origins:[...R]}))}let q={diagnostics:n,stateAt(L){let R=0,B=Y.length;for(;R<B;){let z=R+B>>>1;Y[z].at.compare(L)<=0?R=z+1:B=z}let G=Y[Math.max(0,R-1)].state;return{...G,bpmScale:G.bpmScale.clone()}}},Q=new Map;for(let L of r){let R=[{...L,start:L.start.clone(),end:L.end.clone()}];for(let z of c.get(L)??[])R=z(q,R)??R;let B,G;for(let z of R){if(!Number.isFinite(z.start.toNumber())||!Number.isFinite(z.end.toNumber())||z.start.compare(L.start)<0||z.end.compare(L.end)>0||z.end.compare(z.start)<=0)throw new S("E_PLAYBACK_TRANSFORM_RANGE","\u58F0\u97F3\u5C55\u5F00\u5FC5\u987B\u4F4D\u4E8E\u539F\u97F3\u6BB5\u533A\u95F4\u5185\u4E14\u65F6\u503C\u4E3A\u6B63",L.sourceSpans[0]);(!B||z.start.compare(B)<0)&&(B=z.start),(!G||z.end.compare(G)>0)&&(G=z.end)}if(!B?.equals(L.start)||!G?.equals(L.end))throw new S("E_PLAYBACK_TRANSFORM_RANGE","\u58F0\u97F3\u5C55\u5F00\u5FC5\u987B\u4FDD\u6301\u539F\u97F3\u6BB5\u7684\u8D77\u6B62\u8FB9\u754C",L.sourceSpans[0]);Q.set(L,R.map(z=>{let{start:st,end:it,track:nt,midi:Ct,velocity:xt,percussion:nn,origins:Dt,sourceSpans:ge}=z,Jt=h++,At={kind:"note-on",at:st.clone(),noteId:Jt,order:l++,track:nt,midi:Ct,velocity:xt,percussion:nn,origins:[...Dt],sourceSpans:ge.map(H=>({...H}))},te={kind:"note-off",at:it.clone(),noteId:Jt,order:l++,origins:[...Dt]};return o.push(At,te),{on:At,off:te}}))}let tt=new Set,St=new Map;for(let L of C){let R=M.get(L);if(R)for(let B of Q.get(L)){if(!B.off.at.equals(L.end))continue;let G=Q.get(R).find(z=>!tt.has(z.on)&&z.on.at.equals(R.start)&&z.on.track===B.on.track&&z.on.midi===B.on.midi&&z.on.percussion===B.on.percussion);G&&(B.off.at.copyFrom(G.off.at),St.set(B.on,G.on),tt.add(G.on),tt.add(G.off))}}for(let L of St.keys())if(!tt.has(L))for(let R=St.get(L);R;R=St.get(R))L.sourceSpans.push(...R.sourceSpans);let ko=o.filter(L=>!tt.has(L)).sort(Ci),tn=Ai(ko,i.tracks),en=ko.at(-1)?.at;return en&&en.compare(A)>0&&A.copyFrom(en),{events:tn.events,scoreMap:b,tracks:tn.tracks,performanceDuration:A,durationSeconds:qe(tn.events,A.toNumber()),diagnostics:n}}function Ft(i){return i.pages.length>0?i.pages.map(t=>t.bounds):[i.bounds]}function _o(i,t){for(let e of i.attachments)e.layer==="background"&&e.paint(t);for(let e of i.objects){e.paint(t);for(let n of e.decorations)n.paint(t)}for(let e of i.attachments)e.layer==="foreground"&&e.paint(t)}var Eo=class{pages;painters;constructor(t,e){this.pages=t,this.painters=e}route(t,e,n){let o=0,s=this.pages.length;for(;o<s;){let r=o+s>>>1,c=this.pages[r];c.y+c.h<t?o=r+1:s=r}for(let r=o;r<this.pages.length&&this.pages[r].y<=e;r++)n(this.painters[r])}drawText(t,e,n,o){this.route(n,n,s=>s.drawText(t,e,n,o))}drawLine(t,e,n,o,s){let r=(s?.strokeWidth??1)/2;this.route(Math.min(e,o)-r,Math.max(e,o)+r,c=>c.drawLine(t,e,n,o,s))}drawRect(t,e,n,o,s){let r=s?.stroke?(s.strokeWidth??1)/2:0;this.route(e-r,e+Math.max(0,o)+r,c=>{c.drawRect(t,e,n,o,s)})}drawCircle(t,e,n,o){let s=o?.stroke?(o.strokeWidth??1)/2:0,r=Math.max(0,n)+s;this.route(e-r,e+r,c=>c.drawCircle(t,e,n,o))}drawPath(t,e,n){if(t.length===0)return;let o=n?l=>n.y+l*n.scaleY:l=>l,s=1/0,r=-1/0,c=l=>{let h=o(l);s=Math.min(s,h),r=Math.max(r,h)};for(let l of t)l.op!=="Z"&&(l.op==="Q"&&c(l.cy),l.op==="C"&&(c(l.cy1),c(l.cy2)),c(l.y));if(!Number.isFinite(s))return;let a=e?.stroke?(e.strokeWidth??1)/2:0;this.route(s-a,r+a,l=>{l.drawPath(t,e,n)})}};function Qt(i,t){let e=Ft(i);if(t.length!==e.length)throw new Error(`Expected ${e.length} page painters, got ${t.length}`);_o(i,new Eo(e,t))}var vo=class{commands=[];replay(t){for(let e of this.commands)switch(e.kind){case"text":t.drawText(e.text,e.x,e.y,e.style);break;case"line":t.drawLine(e.x1,e.y1,e.x2,e.y2,e.style);break;case"rect":t.drawRect(e.x,e.y,e.w,e.h,e.style);break;case"circle":t.drawCircle(e.cx,e.cy,e.r,e.style);break;case"path":t.drawPath(e.commands,e.style);break}}drawText(t,e,n,o){this.commands.push({kind:"text",text:t,x:e,y:n,style:o})}drawLine(t,e,n,o,s){this.commands.push({kind:"line",x1:t,y1:e,x2:n,y2:o,style:s})}drawRect(t,e,n,o,s){this.commands.push({kind:"rect",x:t,y:e,w:n,h:o,style:s})}drawCircle(t,e,n,o){this.commands.push({kind:"circle",cx:t,cy:e,r:n,style:o})}drawPath(t,e,n){this.commands.push({kind:"path",commands:t.map(o=>lc(o,n)),style:e})}};function lc(i,t){if(!t||i.op==="Z")return{...i};let e=o=>t.x+o*t.scaleX,n=o=>t.y+o*t.scaleY;return i.op==="M"||i.op==="L"?{op:i.op,x:e(i.x),y:n(i.y)}:i.op==="Q"?{op:"Q",cx:e(i.cx),cy:n(i.cy),x:e(i.x),y:n(i.y)}:i.op==="C"?{op:"C",cx1:e(i.cx1),cy1:n(i.cy1),cx2:e(i.cx2),cy2:n(i.cy2),x:e(i.x),y:n(i.y)}:{...i}}function V(i){return Number.isFinite(i)?String(Math.round(i*1e3)/1e3):"0"}function at(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function hc(i,t){let e=[],n=t?s=>V(t.x+s*t.scaleX):V,o=t?s=>V(t.y+s*t.scaleY):V;for(let s of i){if(s.op==="Z"){e.push("Z");continue}if(s.op==="M"||s.op==="L"){e.push(`${s.op}${n(s.x)} ${o(s.y)}`);continue}if(s.op==="Q"){e.push(`Q${n(s.cx)} ${o(s.cy)} ${n(s.x)} ${o(s.y)}`);continue}"cx1"in s&&e.push(`C${n(s.cx1)} ${o(s.cy1)} ${n(s.cx2)} ${o(s.cy2)} ${n(s.x)} ${o(s.y)}`)}return e.join(" ")}function me(i){return i?.opacity===void 0?"":` opacity="${V(i.opacity)}"`}var Qe=class{body=[];drawText(t,e,n,o){let s=o.fontFamily??jt,r=o.fontWeight??"normal",c=o.fill??"#000",a=o.textAlign==="center"?"middle":o.textAlign==="right"?"end":"start";this.body.push(`<text x="${V(e)}" y="${V(n)}" font-family="${at(s)}" font-size="${V(o.fontSize)}" font-weight="${at(String(r))}" text-anchor="${a}" fill="${at(c)}" xml:space="preserve"${me(o)}>${at(t)}</text>`)}drawLine(t,e,n,o,s){let r=s?.stroke??s?.fill??"#000",c=s?.strokeWidth??1;this.body.push(`<line x1="${V(t)}" y1="${V(e)}" x2="${V(n)}" y2="${V(o)}" stroke="${at(r)}" stroke-width="${V(c)}" stroke-linecap="round"${me(s)} />`)}drawRect(t,e,n,o,s){let r=s?.fill??"none",c=s?.stroke??"none",a=s?.strokeWidth??1;this.body.push(`<rect x="${V(t)}" y="${V(e)}" width="${V(Math.max(0,n))}" height="${V(Math.max(0,o))}" fill="${at(r)}" stroke="${at(c)}" stroke-width="${V(a)}"${me(s)} />`)}drawCircle(t,e,n,o){let s=o?.fill??"#000",r=o?.stroke??"none",c=o?.strokeWidth??1;this.body.push(`<circle cx="${V(t)}" cy="${V(e)}" r="${V(Math.max(0,n))}" fill="${at(s)}" stroke="${at(r)}" stroke-width="${V(c)}"${me(o)} />`)}drawPath(t,e,n){if(t.length===0)return;let o=hc(t,n),s=e?.fill??"none",r=e?.stroke??"none",c=e?.strokeWidth??1;this.body.push(`<path d="${o}" fill="${at(s)}" stroke="${at(r)}" stroke-width="${V(c)}" stroke-linecap="round" stroke-linejoin="round"${me(e)} />`)}toSvg(t,e={}){let n=Math.max(0,e.padding??0),o=t.x-n,s=t.y-n,r=Math.max(1,t.w+n*2),c=Math.max(1,t.h+n*2),a=e.background?`<rect x="${V(o)}" y="${V(s)}" width="${V(r)}" height="${V(c)}" fill="${at(e.background)}" />`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${V(r)}" height="${V(c)}" viewBox="${V(o)} ${V(s)} ${V(r)} ${V(c)}">${a}${this.body.join("")}</svg>`}};function pc(i,t={}){let e=Ft(i),n=e.map(()=>new Qe);return Qt(i,n),n.map((o,s)=>o.toSvg(e[s],t))}function fc(i,t,e=0,n=0,o=1,s=1){i.beginPath();for(let r of t){if(r.op==="Z"){i.closePath();continue}if(r.op==="M"){i.moveTo(e+r.x*o,n+r.y*s);continue}if(r.op==="L"){i.lineTo(e+r.x*o,n+r.y*s);continue}if(r.op==="Q"){i.quadraticCurveTo(e+r.cx*o,n+r.cy*s,e+r.x*o,n+r.y*s);continue}"cx1"in r&&i.bezierCurveTo(e+r.cx1*o,n+r.cy1*s,e+r.cx2*o,n+r.cy2*s,e+r.x*o,n+r.y*s)}}function ye(i,t){t?.opacity!==void 0&&(i.globalAlpha*=t.opacity)}var Je=class{context;constructor(t){this.context=t}drawText(t,e,n,o){this.context.save(),ye(this.context,o),this.context.fillStyle=o.fill??"#000",this.context.font=Ne(o),this.context.textAlign=o.textAlign??"left",this.context.textBaseline="alphabetic",this.context.fillText(t,e,n),this.context.restore()}drawLine(t,e,n,o,s){this.context.save(),ye(this.context,s),this.context.beginPath(),this.context.moveTo(t,e),this.context.lineTo(n,o),this.context.strokeStyle=s?.stroke??s?.fill??"#000",this.context.lineWidth=s?.strokeWidth??1,this.context.lineCap="round",this.context.stroke(),this.context.restore()}drawRect(t,e,n,o,s){n<0||o<0||(this.context.save(),ye(this.context,s),s?.fill&&(this.context.fillStyle=s.fill,this.context.fillRect(t,e,n,o)),s?.stroke&&(this.context.strokeStyle=s.stroke,this.context.lineWidth=s.strokeWidth??1,this.context.strokeRect(t,e,n,o)),this.context.restore())}drawCircle(t,e,n,o){n<0||(this.context.save(),ye(this.context,o),this.context.beginPath(),this.context.arc(t,e,n,0,Math.PI*2),(o?.fill??!0)&&(this.context.fillStyle=o?.fill??"#000",this.context.fill()),o?.stroke&&(this.context.strokeStyle=o.stroke,this.context.lineWidth=o.strokeWidth??1,this.context.stroke()),this.context.restore())}drawPath(t,e,n){t.length!==0&&(this.context.save(),ye(this.context,e),fc(this.context,t,n?.x,n?.y,n?.scaleX,n?.scaleY),e?.fill&&(this.context.fillStyle=e.fill,this.context.fill()),e?.stroke&&(this.context.strokeStyle=e.stroke,this.context.lineWidth=e.strokeWidth??1,this.context.lineCap="round",this.context.lineJoin="round",this.context.stroke()),this.context.restore())}};function uc(i,t){let e=Ft(i);if(t.length!==e.length)throw new Error(`Expected ${e.length} page contexts, got ${t.length}`);for(let[n,o]of t.entries())o.save(),o.translate(-e[n].x,-e[n].y);try{Qt(i,t.map(n=>new Je(n)))}finally{for(let n of t)n.restore()}}var dc=globalThis;Object.assign(dc.jpfun??={},No);})();
|
|
139
|
+
)`}},Di=Bt,Bi=_t,Po=.82,Ac=.6;function $i(r,t){return{fontFamily:t,fontSize:r*Po,fill:"#000",fontWeight:600}}var sn=class extends D{braceSpace;textBaselineY=0;constructor(t,e){super(),this.ast=t,this.braceSpace=e,this.mergeKey=-2,(t.name||e>0||t.lyrics.some(n=>n.name))&&this.initLayoutBox()}prepareLayout(t){let e=this.ast.name?t.textMeasurer.measureText(this.ast.name,this.style):{w:0,h:0,baseline:0},n=e.w;for(let s of this.ast.lyrics){if(!s.name)continue;let i=t.textMeasurer.measureText(s.name,$i(this.ast.size,this.ast.font));n=Math.max(n,i.w)}let o=this.braceSpace>0?this.braceSpace:n>0?this.ast.size*Ac:0;this.box.w=n+o,this.box.h=e.h,this.box.anchor=n,this.box.visualAxis=e.h/2,this.textBaselineY=e.baseline,this.springConfig.alpha_R=.45}get style(){return{fontSize:this.ast.size*.85,fontFamily:this.ast.font,fill:"#000",fontWeight:600,textAlign:"right"}}paint(t){this.ast.name&&t.drawText(this.ast.name,this.box.x+this.box.anchor,this.box.y+this.textBaselineY,this.style)}},Fo=class{connections;layer="background";names;ast;get sourceSpan(){return this.ast.sourceSpan}constructor(t,e,n){this.connections=n,this.names=t,this.ast=e}createGeometry(){if(this.names.length<2)return{regions:[],paint(){}};let t=this.names[0].box,e=this.names[this.names.length-1].box,n=this.ast.size,o=t.y+t.visualAxis-n*.5,s=e.y+e.visualAxis+n*.5;if(s-o<1e-6)return{regions:[],paint(){}};let i=Math.max(Ii,n*.19),c=i*gt,a=i*Lt,l=t.x+t.anchor+this.ast.braceSpace*Pi+i/2,h=Math.min(i*.67,n*.25),p={x:l+i*1.33-i*.165,y:o+h,w:i*.33,h:s-o-h*2},f=[],d=[],u=[p];for(let g of this.connections){let x=this.names[g.from-1].box,m=this.names[g.to-1].box,y=x.y+x.visualAxis-n*.5,b=m.y+m.visualAxis+n*.5;if(g.kind==="bracket")f.push({x:l-i/2,y,w:i,h:b-y}),d.push({commands:Ro,transform:{x:l,y,scaleX:i,scaleY:-i}},{commands:Ro,transform:{x:l,y:b,scaleX:i,scaleY:i}}),u.push({x:l-i/2,y:y-a,w:c+i/2,h:b-y+a*2});else{let w=n*.35,S=p.x-n*.12-w,A=w/Se.w,T=(b-y)/Se.h;d.push({commands:Mo,transform:{x:S-Se.x*A,y:y-Se.y*T,scaleX:A,scaleY:T}}),u.push({x:S,y,w,h:b-y})}}return f.push(p),{regions:u,paint(g){for(let x of f)g.drawRect(x.x,x.y,x.w,x.h,{fill:"#000"});for(let x of d)g.drawPath(x.commands,{fill:"#000"},x.transform)}}}},Do=class{temporalMembers;nameHost;frames;layer="foreground";get sourceSpan(){return this.nameHost.ast.sourceSpan}constructor(t,e,n){this.temporalMembers=t,this.nameHost=e,this.frames=n}prepareHorizontal(t,e){let n=this.temporalMembers.filter(F).filter(c=>c.ports?.lyric),{lyrics:o,size:s}=this.nameHost.ast;if(n.length===0||o.length===0)return;let i={fontSize:s*Po,fontFamily:this.nameHost.ast.font,fill:"#000"};for(let c=0;c<n.length;c++){let a=n[c],l=0;for(let h of o){let p=h.tokens[c];if(p){let{body:f}=Oi(p);f&&(l=Math.max(l,e.textMeasurer.measureText(f,i).w/2))}}l!==0&&t[a.layoutLine]?.registerHorizontalLayoutHook(a,a,({columns:h,start:p})=>{let f=h[p].find(u=>u.time===a);if(!f)return;let d=a.ports.lyric.x-a.box.anchor;f.WL=Math.max(f.WL,l-d),f.WR=Math.max(f.WR,l+d)})}}createGeometry(t){let e=this.prepareGeometry(t);return{regions:e,paint(n){for(let o of e)n.drawText(o.text,o.x,o.y+o.textBaselineY,o.style)}}}prepareGeometry(t){let{lyrics:e,size:n}=this.nameHost.ast,o=[],s=this.temporalMembers.filter(F).filter(y=>y.ports?.lyric);if(s.length===0||e.length===0)return o;let i=new Map;for(let y of s){let b=i.get(y.layoutLine);b||i.set(y.layoutLine,b=new Map);let w=b.get(y.track)??{bottom:-1/0,owner:y.track},S=Q(y),A=S.y+S.h,T=y.track;for(let v of this.frames){let N=t.getAttachmentBox(v);if(N.x+N.w<S.x||N.x>S.x+S.w||N.y+N.h<=A)continue;let M=t.getAttachmentOccupancy(v);if(!M)throw new Error("Layout attachment dependency has not been measured");let L=M.filter(I=>I.line===y.layoutLine);if(!(M.some(I=>I.line!==void 0)&&L.length===0)){A=N.y+N.h;for(let I of L)I.line!==void 0&&t.getVisualAxis(I.line,I.track)>t.getVisualAxis(y.layoutLine,T)&&(T=I.track)}}A>=w.bottom&&(w.owner=T),w.bottom=Math.max(w.bottom,A),b.set(y.track,w)}let c=n*Po,a=n*.24,l=n*.32,h={fontSize:c,fontFamily:this.nameHost.ast.font,fill:"#000"},p=$i(n,this.nameHost.ast.font),f=t.textMeasurer.measureText("M",h).baseline+l,d=(y,b)=>y+f+b*(c+a);if(this.frames.length)for(let[y,b]of i){if(b.size<2)continue;let w=new Map;for(let[,S]of[...b].sort(([A],[T])=>t.getVisualAxis(y,A)-t.getVisualAxis(y,T))){let A=w.get(S.owner)??0;S.bottom+=A*e.length*(c+a),w.set(S.owner,A+1)}}let{box:u,layoutLine:g,track:x}=this.nameHost,m=i.get(g)?.get(x);for(let y=0;y<e.length;y++){let b=e[y];for(let S=0;S<b.tokens.length&&S<s.length;S++){let A=b.tokens[S],T=s[S],v=i.get(T.layoutLine)?.get(T.track);if(!A||!v)continue;let N=t.textMeasurer.measureText(A,h),{prefix:M,body:L}=Oi(A),I=L?t.textMeasurer.measureText(L,h).w:0,V=M?t.textMeasurer.measureText(M,h).w:0;o.push({text:A,style:h,textBaselineY:N.baseline,x:T.box.x+T.ports.lyric.x-I/2-V,y:d(v.bottom,y)-N.baseline,w:N.w,h:N.h,line:T.layoutLine,track:v.owner})}if(!b.name||!u||!m)continue;let w=t.textMeasurer.measureText(b.name,p);o.push({text:b.name,style:p,textBaselineY:w.baseline,x:u.x+u.anchor-w.w,y:d(m.bottom,y)-w.baseline,w:w.w,h:w.h,line:g,track:m.owner})}return o}};var rn=[ii,Es,ri,us,Ut,ks,vi,Di,Bi,ti,li,Js,fi,ci,ai,fs,Is,ki,As,vs,Ts,_i,Xo,Ei,We,Ye,Ue,hi,je,Ti];function Bo(r,t={}){let e=new Map,n=new Set(r);for(let o of n){let s=o.layoutDecorationHandler;if(!s)continue;let i=o.def?.name;if(!i)continue;let c=Array.isArray(i)?i[0]:i;e.set(vt(c),s)}return{textMeasurer:t.textMeasurer??Vn,decorationHandlers:e}}var Ce=class r{loweringAugmenters=[];loweringFinalizers=[];cnt=0;usedTracks=new Set;attachments=[];page;astToTemporal=new Map;activeLoweringGroups=[];diagnostics;constructor(t=[]){this.diagnostics=t}registerFunctions(t){let e=this.loweringAugmenters=[],n=this.loweringFinalizers=[];for(let o of t)o.loweringAugment&&e.push(o.loweringAugment),o.loweringFinalize&&n.push(o.loweringFinalize)}setPageConfig(t){this.page=t}lowerDocument(t){this.cnt=0,this.usedTracks.clear(),this.attachments=[],this.page=void 0,this.astToTemporal=new Map,this.activeLoweringGroups=[];let e=new Rt,n=new O,o=this.trackedEvents(t,n,e);return this.solidifyColumns(o,n),this.postprocessResult({diagnostics:this.diagnostics,columns:o,attachments:this.attachments,astToTemporal:this.astToTemporal,duration:n,rootTrack:e,tracks:[...this.usedTracks],page:this.page})}solidifyColumns(t,e){let n=0;for(let f of t){let d=0;for(let u of f)u.breakBefore>d&&(d=u.breakBefore);n+=d,f.layoutLine=n}let o={bpm:St,velocity:Wt,keySignature:ce,program:Le},s=new Map,i=new Map,c=f=>s.get(f)??(f.parent?c(f.parent):Wt),a=f=>i.get(f)??(f.parent?a(f.parent):Le),l=new O;for(let f of t){l.isZero()||f.shiftTime(l);let d;for(let u of f){o.velocity=c(u.track),o.program=a(u.track);let g=u.onTimeState?.(o);g&&!g.isZero()&&(!d||g.compare(d)>0)&&(d??=new O).copyFrom(g),s.set(u.track,o.velocity),i.set(u.track,o.program)}d&&l.add(d)}if(l.isZero())return;let h=new Set(i.keys()),p=new O;e.set(0);for(let f=t.length-1;f>=0&&h.size>0;f--){let d=t[f];for(let u=d.length-1;u>=0;u--){let g=d[u];if(!h.delete(g.track))continue;let x=g.T;p.copyFrom(g.t),x.isZero()||p.add(x),p.compare(e)>0&&e.copyFrom(p)}}}beginLoweringGroup(t,e){this.activeLoweringGroups.push({owner:t,group:e})}endLoweringGroup(t){let e=this.activeLoweringGroups.pop();if(!e)throw new Error("No active lowering group to end");if(e.owner!==t)throw new Error("Lowering groups must end in reverse order");return e.group.attachment&&this.addAttachment(e.group.attachment),e.group}postprocessResult(t){if(this.activeLoweringGroups.length>0)throw new Error("Lowering groups must be closed before post-processing");let e=[];for(let n of this.loweringAugmenters)for(let o of n(t))e.push(o);for(let n of e)this.addAttachment(n);for(let n of this.loweringFinalizers)n(t);return t}addAttachment(t){this.attachments.push(t);for(let e=this.activeLoweringGroups.length-1;e>=0;e--)this.activeLoweringGroups[e].group.onAttachment?.(t)}getTemporalNodes(t){return this.astToTemporal.get(t)??[]}isolateFromLoweringGroups(t){let e=this.activeLoweringGroups;this.activeLoweringGroups=[];try{return t()}finally{this.activeLoweringGroups=e}}initEvent(t,e,n,o){t.t.add(n),this.usedTracks.add(o),t.track=o,t.ast??=e,t.order=this.cnt++,t.mergeKey??=t.order}trackedEvents(t,e,n){let o=[];this.appendEvents(t.loweringEnter(this,n),t,e,n,o);let s=t.timeFlowModel(this);if(s)switch(s.mode){case"sequence":for(let i of s.children)for(let c of this.trackedEvents(i,e,n))o.push(c);break;case"parallel":{let i=s.tracks,c=s.children,a=i.hostIndex===void 0?0:i.hostIndex,l=n.group(i,a===null?c.length:c.length-1),h=[];for(let d=0;d<c.length;d++){let u=c[d],g=d===a?n:l.members[a===null||d<a?d:d-1],x=e.clone(),m=this.trackedEvents(u,x,g);m.length===0&&this.diagnostics.push(k.warning.ZeroTimeTrack(u.sourceSpan,d+1)),h.push(m)}let p=o.length;for(let d of r.anchorAlign(h))o.push(d);let f=new O;for(let d=p;d<o.length;d++)for(let u of o[d])f.copyFrom(u.t).add(u.T),f.compare(e)>0&&e.copyFrom(f)}break}return this.appendEvents(t.loweringExit(this,n,e),t,e,n,o),o}appendEvents(t,e,n,o,s){let i;for(let c of t){this.initEvent(c,e,n,o),this.indexTemporal(c);for(let l=this.activeLoweringGroups.length-1;l>=0;l--)this.activeLoweringGroups[l].group.onTemporal?.(c);let a=(i??=new O).copyFrom(c.t).add(c.T);a.compare(n)>0&&n.copyFrom(a),s.push(new zo(c))}}indexTemporal(t){let e=this.astToTemporal.get(t.ast);e?e.push(t):this.astToTemporal.set(t.ast,[t])}static anchorAlign(t){for(let l=t.length-1;l>=0;l--)t[l].length===0&&t.splice(l,1);let e=t.length;if(e===0)return[];if(e===1)return t[0];let n=[];if(e===2){let l=t[0],h=t[1],p=l.length,f=h.length,d=0,u=0,g=new O,x=new O,m=l[0],y=h[0],b=m.t.clone(),w=y.t.clone();for(;;){if(m.mergeKey===K){if(y.mergeKey!==K){for(n.push(y),y=h[++u];u<f&&y.mergeKey!==K;)x.isZero()||y.shiftTime(x),n.push(y),y=h[++u];y&&(y.shiftTime(x),w.copyFrom(y.t))}if(u<f){let S=b.compare(w)>=0?b:w;g.add(S).sub(b),x.add(S).sub(w),m.push(...y),m.t=S,y=h[++u]}if(n.push(m),m=l[++d],m&&(m.shiftTime(g),b.copyFrom(m.t)),y&&(y.shiftTime(x),w.copyFrom(y.t)),!m||!y)break}if(y.mergeKey===K){if(m.mergeKey!==K){for(n.push(m),m=l[++d];d<p&&m.mergeKey!==K;)g.isZero()||m.shiftTime(g),n.push(m),m=l[++d];m&&(m.shiftTime(g),b.copyFrom(m.t))}if(d<p){let S=b.compare(w)>=0?b:w;g.add(S).sub(b),x.add(S).sub(w),y.push(...m),y.t=S,m=l[++d]}if(n.push(y),y=h[++u],m&&(m.shiftTime(g),b.copyFrom(m.t)),y&&(y.shiftTime(x),w.copyFrom(y.t)),!m||!y)break}if(b.equals(w)){if(m.mergeKey===y.mergeKey){if(m.push(...y),n.push(m),m=l[++d],y=h[++u],m&&(m.shiftTime(g),b.copyFrom(m.t)),y&&(y.shiftTime(x),w.copyFrom(y.t)),!m||!y)break}else if(m.mergeKey<y.mergeKey)if(n.push(m),m=l[++d],m)m.shiftTime(g),b.copyFrom(m.t);else break;else if(n.push(y),y=h[++u],y)y.shiftTime(x),w.copyFrom(y.t);else break;continue}if(b.compare(w)<0)if(n.push(m),m=l[++d],m){m.shiftTime(g),b.copyFrom(m.t);continue}else break;if(w.compare(b)<0)if(n.push(y),y=h[++u],y){y.shiftTime(x),w.copyFrom(y.t);continue}else break}for(m&&n.push(m);++d<p;)m=l[d],g.isZero()||m.shiftTime(g),n.push(m);for(y&&n.push(y);++u<f;)y=h[u],x.isZero()||y.shiftTime(x),n.push(y);return n}let o=new Uint16Array(e),s=Array.from({length:e},()=>new O),i=[],c=new Ho(e);for(let l=0;l<e;l++)c.push({e:t[l][0],i:l});let a=l=>{let h=t[l][++o[l]];h&&(s[l].isZero()||h.shiftTime(s[l]),c.push({e:h,i:l}))};for(;;){let l=c.pop();if(l===void 0){if(i.length===0)break;let p=i[0],f=p.e,d=f.t;for(let u=1;u<i.length;u++)i[u].e.t.compare(d)>0&&(d=i[u].e.t);s[p.i].add(d).sub(f.t),a(p.i);for(let u=1;u<i.length;u++){let g=i[u];f.push(...g.e),s[g.i].add(d).sub(g.e.t),a(g.i)}i.length=0,f.t=d,f.sort((u,g)=>u.order-g.order),n.push(f);continue}if(l.e.mergeKey===K){i.push(l);continue}let h=[l.i];for(;;){let p=c.front();if(!p||!p.e.t.equals(l.e.t)||p.e.mergeKey!==l.e.mergeKey)break;c.pop(),l.e.push(...p.e),h.push(p.i)}n.push(l.e);for(let p of h)a(p)}return n}},zo=class extends Array{static get[Symbol.species](){return Array}mergeKey;constructor(t){super(1),this.mergeKey=t.mergeKey,this[0]=t}get t(){return this[0].t}set t(t){for(let e of this)e.t.copyFrom(t)}shiftTime(t){for(let e of this)e.t.add(t)}set layoutLine(t){for(let e of this)e.layoutLine=t}};function $o(r,t){let e=r.e.t.compare(t.e.t);return e!==0?e:r.e.mergeKey!==t.e.mergeKey?r.e.mergeKey<t.e.mergeKey?-1:1:r.i-t.i}var Ho=class extends Array{validLen=0;constructor(t){super(t)}front(){if(this.validLen!==0)return this[0]}push(t){return this[this.validLen]=t,this.up(this.validLen++),this.validLen}pop(){if(this.validLen===0)return;let t=this[0];return this[0]=this[--this.validLen],this[this.validLen]=void 0,this.down(0),t}up(t){let e=this[t];for(;t>0;){let n=t-1>>1;if($o(e,this[n])>=0)break;this[t]=this[n],t=n}this[t]=e}down(t){let e=this[t];for(;;){let n=(t<<1)+1,o=n+1;if(n>=this.validLen)break;let s=n;if(o<this.validLen&&$o(this[o],this[n])<0&&(s=o),$o(this[s],e)>=0)break;this[t]=this[s],t=s}this[t]=e}};function Tc(r,t={}){let{functions:e=rn,textMeasurer:n,variables:o,...s}=t,{maskedSource:i,lineStarts:c}=qt(r),a=new at({source:i,variables:o});a.registerFunctions(e);let l=new Y({start:0,end:r.length},a.parse()),h=new Ce(a.diagnostics);h.registerFunctions(e);let p=h.lowerDocument(l),f=Bo(e,{textMeasurer:n}),d=An(p,f,s);return{lineStarts:c,maskedSource:i,diagnostics:a.diagnostics,ast:l,lowering:p,layout:d}}function Ec(r,t=rn){let{maskedSource:e,commentSpans:n}=qt(r),o=new at({source:e,commentSpans:n});return o.registerFunctions(t),{syntax:o.parseSyntax(),diagnostics:o.diagnostics}}function Wo(r){return typeof r.applyPlayback=="function"}function cn(r,t){let e=Math.max(0,t),n=0,o=0,s=St;for(let i of r){if(i.kind!=="tempo")continue;let c=i.at.toNumber();if(c>e)break;c>o&&(n+=(c-o)*60/s),o=c,s=i.bpm}return n+(e-o)*60/s}function zi(r,t){let e=Math.max(0,t),n=0,o=St;for(let s of r){if(s.kind!=="tempo")continue;let i=s.at.toNumber(),c=(i-n)*60/o;if(e<c)return n+e*o/60;e-=c,n=i,o=s.bpm}return n+e*o/60}function Hi(r,t){let e=Math.max(0,t),n=e;for(let o of r){let s=o.performance.toNumber();if(s>e)break;n=o.score.toNumber()+e-s}return n}function Wi(r,t){let e=Math.max(0,t),n;for(let o=0;o<r.length;o++){let s=r[o],i=s.score.toNumber();if(i>e){(!n||i<n.score.toNumber())&&(n=s);continue}let c=r[o+1],a=c?c.performance.toNumber()-s.performance.toNumber():1/0;if(!(e-i>=a))return s.performance.toNumber()+(e-i)}return n?.performance.toNumber()??e}function Lc(r,t){let e=Math.min(zi(r.events,t),r.performanceDuration.toNumber());return Hi(r.scoreMap,e)}function _c(r,t){let e=Math.min(Wi(r.scoreMap,t),r.performanceDuration.toNumber());return cn(r.events,e)}var Gi={tempo:0,"time-signature":1,"program-change":2,"note-off":3,"note-on":4};function Vi(r,t){return r.at.compare(t.at)||Gi[r.kind]-Gi[t.kind]||r.order-t.order}function Ki(r,t){let e=new Map,n=new Map;for(let c of r)if(c.kind==="note-on"){if(e.has(c.noteId))throw new Error(`Duplicate NoteOn ${c.noteId}`);e.set(c.noteId,c)}else if(c.kind==="note-off"){if(n.has(c.noteId))throw new Error(`Duplicate NoteOff ${c.noteId}`);n.set(c.noteId,c)}for(let[c,a]of e){let l=n.get(c);if(!l)throw new Error(`Note ${c} has no NoteOff`);if(l.at.compare(a.at)<=0)throw new Error(`Note ${c} has a non-positive duration`);if(a.origins.length===0||l.origins.length===0)throw new Error(`Note ${c} has no origin`)}for(let c of n.keys())if(!e.has(c))throw new Error(`NoteOff ${c} has no NoteOn`);let o=new Set;for(let c of e.values())o.add(c.track);let s=new Map;for(let c of t)o.has(c)&&s.set(c,s.size);for(let c of o)s.has(c)||s.set(c,s.size);let i=[];for(let c of r){if(c.kind==="tempo"){i.push({kind:"tempo",at:c.at,bpm:c.bpm});continue}if(c.kind==="time-signature"){i.push({kind:"time-signature",at:c.at,numerator:c.numerator,denominator:c.denominator});continue}if(c.kind==="program-change"){let h=s.get(c.track);h!==void 0&&i.push({kind:"program-change",at:c.at,track:h,program:c.program});continue}let a=c.kind==="note-on"?c:e.get(c.noteId),l=s.get(a.track);if(c.kind==="note-on"){i.push({kind:"note-on",at:c.at,noteId:c.noteId,track:l,midi:c.midi,velocity:c.velocity,...c.percussion?{percussion:!0}:{},sourceSpans:c.sourceSpans});continue}i.push({kind:"note-off",at:c.at,noteId:c.noteId,track:l,midi:a.midi})}return{events:i,tracks:[...s.keys()]}}function Nc(r,t,e){let n=r.columns,o=new Map;for(let x=0;x<n.length;x++)for(let m of n[x])o.set(m,x);let s=x=>{for(let m=x;m;m=m.foldedInto){let y=o.get(m);if(y!==void 0)return y}},i=new Map,c=new Map,a=(x,m)=>{let y=x.playbackFlow?.(s);if(!y)return;let[b,w]=y.range??[0,n.length-1];if(y.range&&(!Number.isSafeInteger(b)||!Number.isSafeInteger(w)||b<0||w<b||w>=n.length))throw new C("E_PLAYBACK_FLOW_RANGE",`\u64AD\u653E\u63A7\u5236\u6D41\u8303\u56F4 [${b}, ${w}] \u8D85\u51FA\u65F6\u95F4\u5217\u8FB9\u754C`,m);let S={hook:y,sourceSpan:m};for(let A=b;A<=w;A++){let T=c.get(A);T?T.push(S):c.set(A,[S])}};for(let x of r.astToTemporal.values())for(let m of x){a(m,m.ast.sourceSpan);let y=m.playbackMarks?.();if(!y)continue;let b=s(m);if(b!==void 0)for(let w of y){let S=i.get(w);S?S.push(b):i.set(w,[b])}}for(let x of r.attachments)a(x,x.sourceSpan??{start:0,end:0});if(c.size===0)return n.map((x,m)=>m);for(let x of i.values())x.sort((m,y)=>m-y);let l=new Array(n.length).fill(0),h=0,p={get column(){return h},visits:x=>l[x]??0,seek(x,m,y){let b=i.get(x);if(b){if(y>0)return b.find(w=>w>m);for(let w=b.length-1;w>=0;w--)if(b[w]<m)return b[w]}}},f=[],d=0;for(;h<n.length;){if(++d>e)throw new C("E_PLAYBACK_FLOW_LIMIT",`\u64AD\u653E\u63A7\u5236\u6D41\u8BBF\u95EE\u8D85\u8FC7 ${e} \u6B65\uFF1B\u53EF\u901A\u8FC7 maxFlowSteps \u63D0\u9AD8\u5C55\u5F00\u9884\u7B97`,n[h][0].ast.sourceSpan);l[h]++;let x;for(let m of c.get(h)??[]){let b=m.hook.run(p);if(b){if(b.kind==="stop")return f;if(!Number.isSafeInteger(b.column)||b.column<0||b.column>n.length)throw new C("E_PLAYBACK_FLOW_JUMP",`\u64AD\u653E\u63A7\u5236\u6D41\u8DF3\u8F6C\u76EE\u6807 ${b.column} \u8D85\u51FA\u65F6\u95F4\u5217\u8FB9\u754C`,m.sourceSpan);x=Math.min(x??1/0,b.column)}}x!==void 0?h=x:(f.push(h),h++)}let u=new Set(f),g=!1;for(let x=0;x<n.length;x++){let m=!u.has(x);m&&!g&&t.push(new P("W_PLAYBACK_COLUMN_NEVER_PLAYED","\u8FD9\u91CC\u5728\u4EFB\u4F55\u4E00\u904D\u91CC\u90FD\u4E0D\u4F1A\u6F14\u594F",n[x][0].ast.sourceSpan)),g=m}return f}function kc(r,t){let e=t?.maxFlowSteps??65536;if(!Number.isSafeInteger(e)||e<=0)throw new C("E_PLAYBACK_FLOW_LIMIT","maxFlowSteps \u5FC5\u987B\u662F\u6B63\u5B89\u5168\u6574\u6570",r.columns[0]?.[0]?.ast.sourceSpan??{start:0,end:0});let n=[],o=[],s=[],i=[],c=new Map,a=new Map,l=0,h=0,p=[{kind:"initial",at:new O,origins:[]}],f=new Map,d=new Map,u={spans:s,notes:i,diagnostics:n},g=(E,R,B)=>{if(!Number.isFinite(E.toNumber())||E.compare(0)<0)throw new C("E_PLAYBACK_CONTROL_TIME","\u7CFB\u7EDF\u63A7\u5236\u65F6\u523B\u5FC5\u987B\u662F\u975E\u8D1F\u6709\u9650\u503C",R.at(-1).node.ast.sourceSpan);p.push({kind:"control",at:E.clone(),origins:R,apply:B})};function x(E,R,B,W,$,it=[],rt=E.track){let ot=[...it,{node:E}],Nt=[...R],bt=[...R],fn=[...B],zt=[...B],Ee=[];function oe(H){let et={...H,start:H.start.clone(),end:H.end.clone(),track:rt,origins:ot,sourceSpans:[{...E.ast.sourceSpan}]};return s.push(et),zt.length&&d.set(et,zt),et}let kt=E.playbackState?.program;kt!==void 0&&a.get(rt)!==kt&&(a.set(rt,kt),o.push({kind:"program-change",at:W.clone(),order:l++,origins:ot,track:rt,program:kt}));let se=E.playbackState?.bpm;se!==void 0&&g(W,ot,H=>{H.bpm=se}),E.emitPlayback?.({start:W,end:W.clone().add($),track:rt,span(H){oe(H)},note(H){let et=oe(H);i.push(et),bt.length&&c.set(et,bt)},extend(H){if(!s.includes(H)||!H.end.equals(W)||$.compare(0)<=0)throw new C("E_PLAYBACK_EXTEND_RANGE","\u6269\u5C55\u5FC5\u987B\u63A5\u7EED\u5F53\u524D\u8BA1\u5212\u5185\u7684\u533A\u95F4\u4E14\u65F6\u503C\u4E3A\u6B63",E.ast.sourceSpan);let et=H.end.clone().sub(H.start),wt=et.clone().add($),ie=(d.get(H)??[]).map(dt=>dt.startRatio?{...dt,startRatio:dt.startRatio.clone().mul(et).div(wt)}:dt);for(let dt of zt)ie.push({...dt,startRatio:et.clone().div(wt)});ie.length&&d.set(H,ie),H.end.add($)},emit:H=>o.push({...H,at:H.at.clone(),order:l++,origins:ot}),control:(H,et)=>g(H,ot,et),scaleFollowingBpm(H,et,wt=1,ie){if(!Number.isSafeInteger(et)||!Number.isSafeInteger(wt)||et<=0||wt<=0)throw new C("E_PLAYBACK_BPM_SCALE","\u901F\u5EA6\u6BD4\u4F8B\u5FC5\u987B\u662F\u6B63\u6709\u7406\u6570",E.ast.sourceSpan);let dt=new O(et,wt),Uo=f.get(H);if(Uo&&!Uo.equals(dt))throw new C("E_PLAYBACK_BPM_SCALE","\u540C\u4E00\u901F\u5EA6\u6548\u679C key \u5FC5\u987B\u4F7F\u7528\u56FA\u5B9A\u6BD4\u4F8B",E.ast.sourceSpan);f.set(H,dt),B.push({key:H,factor:dt,followConnections:ie?.followConnections??!1,origins:ot})},affectFollowing:H=>R.push(H),defer:H=>Ee.push(H),play:(H,et,wt)=>x(H,Nt,fn,et??W,wt??$,ot,rt)});for(let H of Ee)H(u)}let m=Nc(r,n,e),y=r.columns[m[0]]?.[0]?.t.clone()??new O,b=[{performance:new O,score:y}],w=new O().sub(y),S=new O;for(let E=0;E<m.length;E++){let R=m[E];for(let ot of r.columns[R])x(ot,[],[],ot.t.clone().add(w),ot.T.clone());let B=r.columns[R+1]?.[0]?.t??r.duration;S.copyFrom(B).add(w);let W=m[E+1];if(W===void 0||W===R+1)continue;let $=r.columns[W][0]?.t.clone()??new O;w.add(B).sub($);let it={performance:S.clone(),score:$};b[b.length-1].performance.equals(it.performance)?b[b.length-1]=it:b.push(it)}for(let E of s){if(!Number.isFinite(E.start.toNumber())||!Number.isFinite(E.end.toNumber())||E.start.compare(0)<0||E.end.compare(E.start)<=0)throw new C("E_PLAYBACK_NOTE_RANGE","\u97F3\u6BB5\u5FC5\u987B\u5177\u6709\u975E\u8D1F\u8D77\u70B9\u548C\u6B63\u65F6\u503C",E.sourceSpans[0]);E.end.compare(S)>0&&S.copyFrom(E.end),Object.freeze(E.start),Object.freeze(E.end);for(let R of E.origins)Object.freeze(R);for(let R of E.sourceSpans)Object.freeze(R);Object.freeze(E.origins),Object.freeze(E.sourceSpans),Object.freeze(E)}let A=new Set(i),T=new Map,v=new Map,N={notes:i,diagnostics:n,connect(E,R){if(!A.has(E)||!A.has(R)||!E.end.equals(R.start))throw new C("E_PLAYBACK_CONNECTION","\u97F3\u6BB5\u8FDE\u63A5\u5FC5\u987B\u5C5E\u4E8E\u5F53\u524D\u8BA1\u5212\u4E14\u65F6\u95F4\u76F8\u63A5",E.sourceSpans[0]);return T.has(E)&&T.get(E)!==R||v.has(R)&&v.get(R)!==E?!1:(T.set(E,R),v.set(R,E),!0)}};for(let E of r.attachments)Wo(E)&&E.applyPlayback(N);let M=[...i].sort((E,R)=>R.start.compare(E.start)),L=new Map;for(let E of M){let R=T.get(E),B=R?L.get(R):E.end;L.set(E,B)}for(let E of s){let R=L.get(E)??E.end;for(let B of d.get(E)??[]){let W=B.startRatio?E.start.clone().add(E.end.clone().sub(E.start).mul(B.startRatio)):E.start;p.push({kind:"scale",at:W,origins:B.origins,scale:B,delta:1},{kind:"scale",at:B.followConnections?R:E.end,origins:B.origins,scale:B,delta:-1})}}let I={bpm:St,bpmScale:new O(1)},V=new Map,J=new O(1),tt=[];p.sort((E,R)=>E.at.compare(R.at));let lt=0,z;for(;lt<p.length;){let E=p[lt].at,R=new Set;for(;lt<p.length&&p[lt].at.equals(E);){let it=p[lt++];for(let rt of it.origins)R.add(rt);if(it.kind==="control")it.apply(I);else if(it.kind==="scale"){let{key:rt,factor:ot}=it.scale,Nt=V.get(rt)??0,bt=Nt+it.delta;V.set(rt,bt),Nt===0&&bt>0?J.mul(ot):Nt>0&&bt===0&&J.div(ot)}}let B=I.bpmScale.clone().mul(J),W={bpm:I.bpm,bpmScale:B,effectiveBpm:I.bpm*B.toNumber()};if(!Number.isFinite(W.effectiveBpm)||W.effectiveBpm<=0)throw new C("E_PLAYBACK_BPM","\u7CFB\u7EDF\u63A7\u5236\u4EA7\u751F\u4E86\u65E0\u6548\u901F\u5EA6",[...R].at(-1)?.node.ast.sourceSpan??{start:0,end:0});let $=tt.at(-1)?.state;(!$||$.bpm!==W.bpm||!$.bpmScale.equals(B))&&tt.push({at:E.clone(),state:W}),z!==W.effectiveBpm&&(z=W.effectiveBpm,o.push({kind:"tempo",at:E.clone(),bpm:W.effectiveBpm,order:l++,origins:[...R]}))}let X={diagnostics:n,stateAt(E){let R=0,B=tt.length;for(;R<B;){let $=R+B>>>1;tt[$].at.compare(E)<=0?R=$+1:B=$}let W=tt[Math.max(0,R-1)].state;return{...W,bpmScale:W.bpmScale.clone()}}},Z=new Map;for(let E of i){let R=[{...E,start:E.start.clone(),end:E.end.clone()}];for(let $ of c.get(E)??[])R=$(X,R)??R;let B,W;for(let $ of R){if(!Number.isFinite($.start.toNumber())||!Number.isFinite($.end.toNumber())||$.start.compare(E.start)<0||$.end.compare(E.end)>0||$.end.compare($.start)<=0)throw new C("E_PLAYBACK_TRANSFORM_RANGE","\u58F0\u97F3\u5C55\u5F00\u5FC5\u987B\u4F4D\u4E8E\u539F\u97F3\u6BB5\u533A\u95F4\u5185\u4E14\u65F6\u503C\u4E3A\u6B63",E.sourceSpans[0]);(!B||$.start.compare(B)<0)&&(B=$.start),(!W||$.end.compare(W)>0)&&(W=$.end)}if(!B?.equals(E.start)||!W?.equals(E.end))throw new C("E_PLAYBACK_TRANSFORM_RANGE","\u58F0\u97F3\u5C55\u5F00\u5FC5\u987B\u4FDD\u6301\u539F\u97F3\u6BB5\u7684\u8D77\u6B62\u8FB9\u754C",E.sourceSpans[0]);Z.set(E,R.map($=>{let{start:it,end:rt,track:ot,midi:Nt,velocity:bt,percussion:fn,origins:zt,sourceSpans:Ee}=$,oe=h++,kt={kind:"note-on",at:it.clone(),noteId:oe,order:l++,track:ot,midi:Nt,velocity:bt,percussion:fn,origins:[...zt],sourceSpans:Ee.map(H=>({...H}))},se={kind:"note-off",at:rt.clone(),noteId:oe,order:l++,origins:[...zt]};return o.push(kt,se),{on:kt,off:se}}))}let j=new Set,nt=new Map;for(let E of M){let R=T.get(E);if(R)for(let B of Z.get(E)){if(!B.off.at.equals(E.end))continue;let W=Z.get(R).find($=>!j.has($.on)&&$.on.at.equals(R.start)&&$.on.track===B.on.track&&$.on.midi===B.on.midi&&$.on.percussion===B.on.percussion);W&&(B.off.at.copyFrom(W.off.at),nt.set(B.on,W.on),j.add(W.on),j.add(W.off))}}for(let E of nt.keys())if(!j.has(E))for(let R=nt.get(E);R;R=nt.get(R))E.sourceSpans.push(...R.sourceSpans);let ne=(j.size?o.filter(E=>!j.has(E)):o).sort(Vi),hn=Ki(ne,r.tracks),pn=ne.at(-1)?.at;return pn&&pn.compare(S)>0&&S.copyFrom(pn),{events:hn.events,scoreMap:b,tracks:hn.tracks,performanceDuration:S,durationSeconds:cn(hn.events,S.toNumber()),diagnostics:n}}function $t(r){return r.pages.length>0?r.pages.map(t=>t.bounds):[r.bounds]}function Vo(r,t){for(let e of r.attachments)e.layer==="background"&&e.paint(t);for(let e of r.objects){e.paint(t);for(let n of e.decorations)n.paint?.(t)}for(let e of r.attachments)e.layer==="foreground"&&e.paint(t)}var Go=class{pages;painters;constructor(t,e){this.pages=t,this.painters=e}route(t,e,n){let o=0,s=this.pages.length;for(;o<s;){let i=o+s>>>1,c=this.pages[i];c.y+c.h<t?o=i+1:s=i}for(let i=o;i<this.pages.length&&this.pages[i].y<=e;i++)n(this.painters[i])}drawText(t,e,n,o){this.route(n,n,s=>s.drawText(t,e,n,o))}drawLine(t,e,n,o,s){let i=(s?.strokeWidth??1)/2;this.route(Math.min(e,o)-i,Math.max(e,o)+i,c=>c.drawLine(t,e,n,o,s))}drawRect(t,e,n,o,s){let i=s?.stroke?(s.strokeWidth??1)/2:0;this.route(e-i,e+Math.max(0,o)+i,c=>{c.drawRect(t,e,n,o,s)})}drawCircle(t,e,n,o){let s=o?.stroke?(o.strokeWidth??1)/2:0,i=Math.max(0,n)+s;this.route(e-i,e+i,c=>c.drawCircle(t,e,n,o))}drawPath(t,e,n){if(t.length===0)return;let o=n?l=>n.y+l*n.scaleY:l=>l,s=1/0,i=-1/0,c=l=>{let h=o(l);s=Math.min(s,h),i=Math.max(i,h)};for(let l of t)l.op!=="Z"&&(l.op==="Q"&&c(l.cy),l.op==="C"&&(c(l.cy1),c(l.cy2)),c(l.y));if(!Number.isFinite(s))return;let a=e?.stroke?(e.strokeWidth??1)/2:0;this.route(s-a,i+a,l=>{l.drawPath(t,e,n)})}};function ee(r,t){let e=$t(r);if(t.length!==e.length)throw new Error(`Expected ${e.length} page painters, got ${t.length}`);Vo(r,new Go(e,t))}var Ko=class{commands=[];replay(t){for(let e of this.commands)switch(e.kind){case"text":t.drawText(e.text,e.x,e.y,e.style);break;case"line":t.drawLine(e.x1,e.y1,e.x2,e.y2,e.style);break;case"rect":t.drawRect(e.x,e.y,e.w,e.h,e.style);break;case"circle":t.drawCircle(e.cx,e.cy,e.r,e.style);break;case"path":t.drawPath(e.commands,e.style);break}}drawText(t,e,n,o){this.commands.push({kind:"text",text:t,x:e,y:n,style:o})}drawLine(t,e,n,o,s){this.commands.push({kind:"line",x1:t,y1:e,x2:n,y2:o,style:s})}drawRect(t,e,n,o,s){this.commands.push({kind:"rect",x:t,y:e,w:n,h:o,style:s})}drawCircle(t,e,n,o){this.commands.push({kind:"circle",cx:t,cy:e,r:n,style:o})}drawPath(t,e,n){this.commands.push({kind:"path",commands:t.map(o=>vc(o,n)),style:e})}};function vc(r,t){if(!t||r.op==="Z")return{...r};let e=o=>t.x+o*t.scaleX,n=o=>t.y+o*t.scaleY;return r.op==="M"||r.op==="L"?{op:r.op,x:e(r.x),y:n(r.y)}:r.op==="Q"?{op:"Q",cx:e(r.cx),cy:n(r.cy),x:e(r.x),y:n(r.y)}:r.op==="C"?{op:"C",cx1:e(r.cx1),cy1:n(r.cy1),cx2:e(r.cx2),cy2:n(r.cy2),x:e(r.x),y:n(r.y)}:{...r}}function G(r){return Number.isFinite(r)?String(Math.round(r*1e3)/1e3):"0"}function pt(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Mc(r,t){let e=[],n=t?s=>G(t.x+s*t.scaleX):G,o=t?s=>G(t.y+s*t.scaleY):G;for(let s of r){if(s.op==="Z"){e.push("Z");continue}if(s.op==="M"||s.op==="L"){e.push(`${s.op}${n(s.x)} ${o(s.y)}`);continue}if(s.op==="Q"){e.push(`Q${n(s.cx)} ${o(s.cy)} ${n(s.x)} ${o(s.y)}`);continue}"cx1"in s&&e.push(`C${n(s.cx1)} ${o(s.cy1)} ${n(s.cx2)} ${o(s.cy2)} ${n(s.x)} ${o(s.y)}`)}return e.join(" ")}function Ae(r){return r?.opacity===void 0?"":` opacity="${G(r.opacity)}"`}var an=class{body=[];drawText(t,e,n,o){let s=o.fontFamily??Zt,i=o.fontWeight??"normal",c=o.fill??"#000",a=o.textAlign==="center"?"middle":o.textAlign==="right"?"end":"start";this.body.push(`<text x="${G(e)}" y="${G(n)}" font-family="${pt(s)}" font-size="${G(o.fontSize)}" font-weight="${pt(String(i))}" text-anchor="${a}" fill="${pt(c)}" xml:space="preserve"${Ae(o)}>${pt(t)}</text>`)}drawLine(t,e,n,o,s){let i=s?.stroke??s?.fill??"#000",c=s?.strokeWidth??1;this.body.push(`<line x1="${G(t)}" y1="${G(e)}" x2="${G(n)}" y2="${G(o)}" stroke="${pt(i)}" stroke-width="${G(c)}" stroke-linecap="round"${Ae(s)} />`)}drawRect(t,e,n,o,s){let i=s?.fill??"none",c=s?.stroke??"none",a=s?.strokeWidth??1;this.body.push(`<rect x="${G(t)}" y="${G(e)}" width="${G(Math.max(0,n))}" height="${G(Math.max(0,o))}" fill="${pt(i)}" stroke="${pt(c)}" stroke-width="${G(a)}"${Ae(s)} />`)}drawCircle(t,e,n,o){let s=o?.fill??"#000",i=o?.stroke??"none",c=o?.strokeWidth??1;this.body.push(`<circle cx="${G(t)}" cy="${G(e)}" r="${G(Math.max(0,n))}" fill="${pt(s)}" stroke="${pt(i)}" stroke-width="${G(c)}"${Ae(o)} />`)}drawPath(t,e,n){if(t.length===0)return;let o=Mc(t,n),s=e?.fill??"none",i=e?.stroke??"none",c=e?.strokeWidth??1;this.body.push(`<path d="${o}" fill="${pt(s)}" stroke="${pt(i)}" stroke-width="${G(c)}" stroke-linecap="round" stroke-linejoin="round"${Ae(e)} />`)}toSvg(t,e={}){let n=Math.max(0,e.padding??0),o=t.x-n,s=t.y-n,i=Math.max(1,t.w+n*2),c=Math.max(1,t.h+n*2),a=e.background?`<rect x="${G(o)}" y="${G(s)}" width="${G(i)}" height="${G(c)}" fill="${pt(e.background)}" />`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G(i)}" height="${G(c)}" viewBox="${G(o)} ${G(s)} ${G(i)} ${G(c)}">${a}${this.body.join("")}</svg>`}};function Rc(r,t={}){let e=$t(r),n=e.map(()=>new an);return ee(r,n),n.map((o,s)=>o.toSvg(e[s],t))}function Oc(r,t,e=0,n=0,o=1,s=1){r.beginPath();for(let i of t){if(i.op==="Z"){r.closePath();continue}if(i.op==="M"){r.moveTo(e+i.x*o,n+i.y*s);continue}if(i.op==="L"){r.lineTo(e+i.x*o,n+i.y*s);continue}if(i.op==="Q"){r.quadraticCurveTo(e+i.cx*o,n+i.cy*s,e+i.x*o,n+i.y*s);continue}"cx1"in i&&r.bezierCurveTo(e+i.cx1*o,n+i.cy1*s,e+i.cx2*o,n+i.cy2*s,e+i.x*o,n+i.y*s)}}function Te(r,t){t?.opacity!==void 0&&(r.globalAlpha*=t.opacity)}var ln=class{context;constructor(t){this.context=t}drawText(t,e,n,o){this.context.save(),Te(this.context,o),this.context.fillStyle=o.fill??"#000",this.context.font=Pe(o),this.context.textAlign=o.textAlign??"left",this.context.textBaseline="alphabetic",this.context.fillText(t,e,n),this.context.restore()}drawLine(t,e,n,o,s){this.context.save(),Te(this.context,s),this.context.beginPath(),this.context.moveTo(t,e),this.context.lineTo(n,o),this.context.strokeStyle=s?.stroke??s?.fill??"#000",this.context.lineWidth=s?.strokeWidth??1,this.context.lineCap="round",this.context.stroke(),this.context.restore()}drawRect(t,e,n,o,s){n<0||o<0||(this.context.save(),Te(this.context,s),s?.fill&&(this.context.fillStyle=s.fill,this.context.fillRect(t,e,n,o)),s?.stroke&&(this.context.strokeStyle=s.stroke,this.context.lineWidth=s.strokeWidth??1,this.context.strokeRect(t,e,n,o)),this.context.restore())}drawCircle(t,e,n,o){n<0||(this.context.save(),Te(this.context,o),this.context.beginPath(),this.context.arc(t,e,n,0,Math.PI*2),(o?.fill??!0)&&(this.context.fillStyle=o?.fill??"#000",this.context.fill()),o?.stroke&&(this.context.strokeStyle=o.stroke,this.context.lineWidth=o.strokeWidth??1,this.context.stroke()),this.context.restore())}drawPath(t,e,n){t.length!==0&&(this.context.save(),Te(this.context,e),Oc(this.context,t,n?.x,n?.y,n?.scaleX,n?.scaleY),e?.fill&&(this.context.fillStyle=e.fill,this.context.fill()),e?.stroke&&(this.context.strokeStyle=e.stroke,this.context.lineWidth=e.strokeWidth??1,this.context.lineCap="round",this.context.lineJoin="round",this.context.stroke()),this.context.restore())}};function Ic(r,t){let e=$t(r);if(t.length!==e.length)throw new Error(`Expected ${e.length} page contexts, got ${t.length}`);for(let[n,o]of t.entries())o.save(),o.translate(-e[n].x,-e[n].y);try{ee(r,t.map(n=>new ln(n)))}finally{for(let n of t)n.restore()}}var Pc=globalThis;Object.assign(Pc.jpfun??={},Yo);})();
|