@motionscript/math 0.2.0 → 0.4.0-alpha.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +3 -2
  3. package/dist/annotate/curly-brace.d.ts +3 -3
  4. package/dist/annotate/emphasis-mark.d.ts +3 -3
  5. package/dist/browser/chunks/chunk-347RSDIW.js +2 -0
  6. package/dist/browser/chunks/chunk-347RSDIW.js.map +7 -0
  7. package/dist/browser/chunks/chunk-BIUAHFF7.js +2 -0
  8. package/dist/browser/chunks/chunk-BIUAHFF7.js.map +7 -0
  9. package/dist/browser/index.js +1 -1
  10. package/dist/browser/index.js.map +4 -4
  11. package/dist/browser/kit.js +1 -1
  12. package/dist/browser/manifest.json +2 -1
  13. package/dist/browser/v1.js +2 -0
  14. package/dist/browser/v1.js.map +7 -0
  15. package/dist/engine.d.ts +1 -1
  16. package/dist/engine.js +1 -1
  17. package/dist/engine.js.map +1 -1
  18. package/dist/index.d.ts +28 -28
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +29 -28
  21. package/dist/index.js.map +1 -1
  22. package/dist/marks/curve-area.d.ts +3 -3
  23. package/dist/marks/drop-lines.d.ts +3 -3
  24. package/dist/marks/riemann-sum.d.ts +3 -3
  25. package/dist/marks/tangent-line.d.ts +3 -3
  26. package/dist/marks/vector-arrow.d.ts +3 -3
  27. package/dist/plots/function-plot.d.ts +4 -4
  28. package/dist/plots/points-plot.d.ts +3 -3
  29. package/dist/plots/stream-lines.d.ts +6 -6
  30. package/dist/plots/traced-path.d.ts +6 -6
  31. package/dist/plots/vector-field.d.ts +6 -6
  32. package/dist/systems/number-line.d.ts +3 -3
  33. package/dist/systems/number-plane.d.ts +6 -6
  34. package/dist/tex/matrix.d.ts +3 -3
  35. package/dist/tex/node.d.ts +3 -3
  36. package/dist/three/curve-plot3d.d.ts +3 -3
  37. package/dist/three/surface-plot3d.d.ts +8 -8
  38. package/dist/unstable.d.ts +29 -0
  39. package/dist/unstable.d.ts.map +1 -0
  40. package/dist/unstable.js +31 -0
  41. package/dist/unstable.js.map +1 -0
  42. package/dist/v1.d.ts +2 -0
  43. package/dist/v1.d.ts.map +1 -0
  44. package/dist/v1.js +3 -0
  45. package/dist/v1.js.map +1 -0
  46. package/package.json +10 -6
  47. package/registry.json +1 -1
  48. package/src/engine.ts +1 -1
  49. package/src/index.ts +29 -28
  50. package/src/unstable.ts +30 -0
  51. package/src/v1.ts +2 -0
  52. package/dist/browser/chunks/chunk-FZ2YBTPL.js +0 -2
  53. package/dist/browser/chunks/chunk-FZ2YBTPL.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/systems/number-line.ts", "../../src/systems/number-plane.ts", "../../src/plots/points-plot.ts", "../../src/marks/plot-point.ts", "../../src/marks/vector-arrow.ts", "../../src/marks/curve-area.ts", "../../src/marks/riemann-sum.ts", "../../src/marks/tangent-line.ts", "../../src/marks/drop-lines.ts", "../../src/annotate/curly-brace.ts", "../../src/annotate/angle-mark.ts", "../../src/annotate/emphasis-mark.ts", "../../src/three/axes3d.ts", "../../src/three/surface-plot3d.ts", "../../src/three/curve-plot3d.ts", "../../src/three/plot-point3d.ts", "../../src/three/vector-arrow3d.ts", "../../src/systems/polar-plane.ts", "../../src/plots/vector-field.ts", "../../src/plots/stream-lines.ts", "../../src/plots/traced-path.ts", "../../src/structures/network-graph.ts", "../../src/structures/sample-space.ts", "../../src/nodes.ts"],
4
- "sourcesContent": ["import {\n component2d,\n Graphics2D,\n Types,\n type Extents,\n type NodeOf,\n type Color as _Color,\n type NormalizedColor,\n type StrokeResolved,\n type Values,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n} from \"@motionscript/sdk\";\nimport { listed, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport { cartesianMap, resolveInterval, type CoordinateMap } from \"../kit/coords\";\nimport { along, AXIS_COLOR, drawLabels, drawn, intervalEntry, withoutTips, type Label } from \"../kit/furniture\";\nimport { drawSystem, systemLayout, systemMap, systemOpenPlane, systemProvides, systemSize } from \"../kit/system\";\nimport { formatTick, ticksFor } from \"../kit/ticks\";\n\nconst state = {\n ...PAINT,\n range: intervalEntry([-5, 5]),\n /** The spacing of the ticks; zero picks a tidy one for the line's length. */\n step: Types.number(0, { min: 0 }),\n scaling: listed([\"linear\", \"log\"], \"linear\", { animatable: false }),\n ticks: Types.boolean(true, { animatable: false }),\n tickSize: Types.number(12, { min: 0, unit: \"px\" }),\n /** Values whose ticks are drawn twice as long. */\n longTicks: Types.custom<number[]>([], { animatable: false }),\n labels: Types.boolean(true, { animatable: false }),\n labelExclude: Types.custom<number[]>([], { animatable: false }),\n labelSide: listed([\"below\", \"above\"], \"below\", { animatable: false }),\n labelSize: Types.number(18, { min: 1, unit: \"px\" }),\n labelColor: Types.color(AXIS_COLOR),\n fontFamily: Types.text(\"\", { animatable: false }),\n};\n\ntype LineValues = Values<typeof state>;\n\n/**\n * One axis with ticks and numbers. A child's `x` is a value on the line and its\n * `y` is pixels above it, so a dot or a label sits on a number.\n */\nexport const NumberLine = component2d({\n key: \"numberLine\",\n state,\n defaults: { stroke: { weight: 2, fill: AXIS_COLOR, align: \"center\" } },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n commands: {\n ...PAINT_COMMANDS,\n /** Animate the span of values the line shows: a pan when both ends move alike, a zoom when they do not. */\n rangeTo: { args: [\"range\"] },\n },\n provide: (s) => systemProvides(s),\n measure: (_measurer, s) => systemSize(s),\n layout: (box, s, children) => systemLayout(box, s, children, lineMap),\n plane: (box, s) => systemOpenPlane(box, s, lineMap),\n render: (ctx, s) => drawSystem(ctx, s, systemMap(ctx.size, s, lineMap), (map) => lineFurniture(map, s)),\n});\n\nexport type NumberLine = NodeOf<typeof NumberLine>;\n\nfunction lineMap(area: Extents, s: LineValues): CoordinateMap {\n return cartesianMap({\n xRange: resolveInterval(s.range, s.scaling),\n yRange: [area.minY, area.maxY],\n area,\n xScaling: s.scaling,\n });\n}\n\nfunction lineFurniture(map: CoordinateMap, s: LineValues): Graphics2D[] {\n const stroke = s.stroke as StrokeResolved[];\n const { start, end } = s;\n const [min, max] = map.xRange;\n const from = map.toPoint(min, 0);\n const to = map.toPoint(max, 0);\n const parts: Graphics2D[] = [];\n if (stroke.length > 0) parts.push(new Graphics2D().line({ points: [from, to], radius: 0, start, end }).stroke(stroke));\n\n const marks = ticksFor(map.xRange, s.step, to.x - from.x, s.scaling);\n const sign = s.labelSide === \"below\" ? -1 : 1;\n const tickMarks = new Graphics2D();\n const labels: Label[] = [];\n let ticked = false;\n for (const value of marks.values) {\n const at: Vector2 = map.toPoint(value, 0);\n if (!drawn(along(at, from, to), start, end)) continue;\n const half = s.longTicks.includes(value) ? s.tickSize : s.tickSize / 2;\n if (s.ticks && half > 0) {\n tickMarks.line({ points: [{ x: at.x, y: at.y - half }, { x: at.x, y: at.y + half }], radius: 0 });\n ticked = true;\n }\n if (s.labels && !s.labelExclude.includes(value)) {\n labels.push({\n text: formatTick(value, marks.step),\n at: { x: at.x, y: at.y + sign * (s.tickSize / 2 + s.labelSize * 0.9) },\n align: \"center\",\n });\n }\n }\n if (ticked && stroke.length > 0) parts.push(tickMarks.stroke(withoutTips(stroke)));\n parts.push(...drawLabels(labels, { fontSize: s.labelSize, fontFamily: s.fontFamily, color: s.labelColor as NormalizedColor }));\n return parts;\n}\n", "import {\n component2d,\n Graphics2D,\n Types,\n type Extents,\n type NodeOf,\n type Stroke as _Stroke,\n\n type StrokeResolved,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Color as _Color,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type NormalizedColor as _NormalizedColor,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n} from \"@motionscript/sdk\";\nimport {\n isIdentityMatrix,\n lerpMatrix,\n lineThrough,\n readMatrix,\n transformedMap,\n warpedMap,\n type CoordinateMap,\n type Matrix2,\n type Warp,\n} from \"../kit/coords\";\nimport { fieldParams, parseField } from \"../kit/field\";\nimport { AXIS_COLOR } from \"../kit/furniture\";\nimport { lerpSource, readSource, type PlotSource } from \"../kit/source\";\nimport { drawSystem, plotArea, systemLayout, systemOpenPlane, systemProvides, systemSize } from \"../kit/system\";\nimport { AXES, AXES_COMMANDS, axesFurniture, axesMap, axesOf, loadAxes, type AxesValues, type AxisLayout } from \"./axes2d\";\n\nconst state = {\n ...AXES,\n grid: Types.boolean(true, { animatable: false }),\n /** The line at every tick. */\n gridStroke: Types.stroke({ weight: 1.5, fill: \"#3b4658\", align: \"center\" }),\n /** The lines between ticks. */\n minorStroke: Types.stroke({ weight: 1, fill: \"#232b38\", align: \"center\" }),\n /** How many parts the space between two ticks is cut into; one draws no line between them. */\n minorDivisions: Types.number(2, { min: 1, max: 10, step: 1 }),\n /** A linear map of the plane, row by row: `[a, b, c, d]` sends `(x, y)` to `(ax + by, cx + dy)`. */\n matrix: Types.custom<Matrix2 | readonly (readonly number[])[], Matrix2>([1, 0, 0, 1], { resolve: readMatrix, lerp: lerpMatrix }),\n /**\n * Where each point of the plane is sent, two parts in x and y:\n * `(x + sin(y), y + sin(x))`. Empty leaves the plane flat.\n */\n warp: Types.custom<string | PlotSource, PlotSource>(\"\", { resolve: readSource, lerp: lerpSource, kind: \"fieldEquation\" }),\n /** Leave the plane as it was, faintly, behind one that has been transformed or warped. */\n ghost: Types.boolean(true, { animatable: false }),\n};\n\ntype PlaneValues = AxesValues & {\n readonly grid: boolean;\n readonly gridStroke: StrokeResolved[];\n readonly minorStroke: StrokeResolved[];\n readonly minorDivisions: number;\n readonly matrix: Matrix2;\n readonly warp: PlotSource;\n readonly ghost: boolean;\n};\n\n/** Axes over a full grid with square units: the plane vectors and transformations are drawn on. `matrix` and `warp` move the grid, the axes and everything on the plane. */\nexport const NumberPlane = component2d({\n key: \"numberPlane\",\n state,\n defaults: {\n squareUnits: true,\n stroke: { weight: 2, fill: AXIS_COLOR, align: \"center\" },\n // A transformed plane reaches past its box, and so does what is on it: both are kept in unless told otherwise.\n clip: (s) => spills(s),\n },\n load: (loader, s) => loadAxes(loader, s),\n commands: {\n ...AXES_COMMANDS,\n /** Send the plane through a matrix: a shear, a turn, a squeeze, a flip. */\n transformTo: { args: [\"matrix\"] },\n /** Bend the plane, each point travelling to where the warp sends it; an empty one flattens it again. */\n warpTo: { args: [\"warp\"] },\n },\n provide: (s) => systemProvides(s),\n measure: (_measurer, s) => systemSize(s),\n layout: (box, s, children) => systemLayout(box, s, children, planeMap),\n plane: (box, s) => systemOpenPlane(box, s, planeMap),\n render: (ctx, s) => {\n const { flat, map } = planeMaps(plotArea(ctx.size, s.padding), s);\n drawSystem(ctx, s, map, (on) => axesFurniture(on, s, (x, y) => grid(s, flat, on, x, y)));\n },\n});\n\nexport type NumberPlane = NodeOf<typeof NumberPlane>;\n\n/** The plane's map on a plot area: the flat one, sent through its matrix and its warp. */\nexport function planeMap(area: Extents, s: PlaneValues): CoordinateMap {\n return planeMaps(area, s).map;\n}\n\n/** The flat plane on a plot area, and the plane as its matrix and its warp have it. */\nfunction planeMaps(area: Extents, s: PlaneValues): { flat: CoordinateMap; map: CoordinateMap } {\n const flat = axesMap(area, s);\n const map = isIdentityMatrix(s.matrix) ? flat : transformedMap(flat, s.matrix);\n const { source, blend } = s.warp;\n const to = warpOf(source);\n if (!blend) return { flat, map: to ? warpedMap(map, to, source) : map };\n // Mid-warp each point is part of the way from where the old warp had it to where the new one sends it.\n const from = warpOf(blend.from);\n if (!from && !to) return { flat, map };\n const start = { x: 0, y: 0 };\n return {\n flat,\n map: warpedMap(\n map,\n (x, y, out) => {\n if (!(from ?? STAY)(x, y, start) || !(to ?? STAY)(x, y, out)) return false;\n out.x = start.x + (out.x - start.x) * blend.t;\n out.y = start.y + (out.y - start.y) * blend.t;\n return true;\n },\n `${blend.from}>${source}@${blend.t}`,\n ),\n };\n}\n\n/** Whether the plane reaches past its box: it is transformed or warped. */\nfunction spills(s: PlaneValues): boolean {\n if (!isIdentityMatrix(s.matrix)) return true;\n const { source, blend } = s.warp;\n return warpOf(source) !== null || (blend !== undefined && warpOf(blend.from) !== null);\n}\n\n/** The grid behind the axes, with the flat plane faintly behind a transformed one. */\nfunction grid(s: PlaneValues, flat: CoordinateMap, map: CoordinateMap, x: AxisLayout, y: AxisLayout): Graphics2D[] {\n if (!s.grid) return [];\n const parts: Graphics2D[] = [];\n if (s.ghost && flat.revision !== map.revision) {\n const [gx, gy] = axesOf(flat, s);\n parts.push(...ruled(s, flat, gx, gy, true));\n }\n parts.push(...ruled(s, map, x, y, false));\n return parts;\n}\n\n/** The grid of `map`: every line, or only the ones at a tick, in the fainter stroke, for a ghost. */\nfunction ruled(s: PlaneValues, map: CoordinateMap, x: AxisLayout, y: AxisLayout, ghost: boolean): Graphics2D[] {\n const { start, end } = s;\n const [xMin, xMax] = map.xRange;\n const [yMin, yMax] = map.yRange;\n const lines = (values: readonly number[], vertical: boolean): Graphics2D => {\n const g = new Graphics2D();\n for (const value of values) {\n g.line({\n points: vertical ? lineThrough(map, value, yMin, value, yMax) : lineThrough(map, xMin, value, xMax, value),\n radius: 0,\n start,\n end,\n });\n }\n return g;\n };\n const parts: Graphics2D[] = [];\n const minor = s.minorStroke;\n if (ghost) {\n if (minor.length === 0) return parts;\n if (x.marks.values.length > 0) parts.push(lines(x.marks.values, true).stroke(minor));\n if (y.marks.values.length > 0) parts.push(lines(y.marks.values, false).stroke(minor));\n return parts;\n }\n const divisions = Math.round(s.minorDivisions);\n if (minor.length > 0 && divisions > 1) {\n const between = (axis: AxisLayout, [min, max]: readonly [number, number]): number[] => {\n const { step, values } = axis.marks;\n if (!(step > 0) || values.length === 0) return [];\n const out: number[] = [];\n for (let base = values[0] - step; base < max; base += step) {\n for (let i = 1; i < divisions; i++) {\n const value = base + (step * i) / divisions;\n if (value > min && value < max) out.push(value);\n }\n }\n return out;\n };\n const xs = between(x, map.xRange);\n const ys = between(y, map.yRange);\n if (xs.length > 0) parts.push(lines(xs, true).stroke(minor));\n if (ys.length > 0) parts.push(lines(ys, false).stroke(minor));\n }\n const major = s.gridStroke;\n if (major.length > 0) {\n if (x.marks.values.length > 0) parts.push(lines(x.marks.values, true).stroke(major));\n if (y.marks.values.length > 0) parts.push(lines(y.marks.values, false).stroke(major));\n }\n return parts;\n}\n\nconst STAY: Warp = (x, y, out) => {\n out.x = x;\n out.y = y;\n return true;\n};\n\n/** `source` as a warp, or `null` for text that is empty or not a field: the plane is then left as it is. */\nfunction warpOf(source: string): Warp | null {\n const field = source.trim() === \"\" ? null : parseField(source, fieldParams(source));\n if (!field || field instanceof Error) return null;\n const { x, y } = field;\n return (gx, gy, out) => {\n const wx = x(gx, gy);\n const wy = y(gx, gy);\n out.x = wx;\n out.y = wy;\n return Number.isFinite(wx) && Number.isFinite(wy);\n };\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { PLANE_ENTRY } from \"../kit/graph\";\nimport { drawMark, inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\n// A shorter list is padded with its own last point, so a line grows new points out of its end.\nfunction lerpPoints(from: Vector2[], to: Vector2[], t: number): Vector2[] {\n const count = Math.max(from.length, to.length);\n if (from.length === 0 || to.length === 0) return t < 1 ? from : to;\n const out = new Array<Vector2>(count);\n for (let i = 0; i < count; i++) {\n const a = from[Math.min(i, from.length - 1)];\n const b = to[Math.min(i, to.length - 1)];\n out[i] = { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };\n }\n return out;\n}\n\n/** Points on the curve between each pair of a smooth line's points. */\nconst SMOOTH_STEPS = 16;\n\nconst state = {\n ...PAINT,\n points: Types.custom<Vector2[]>([], { lerp: lerpPoints }),\n /** Join the last point to the first. */\n closed: Types.boolean(false, { animatable: false }),\n /** Curve through the points instead of turning a corner at each. */\n smooth: Types.boolean(false, { animatable: false }),\n graph: PLANE_ENTRY,\n};\n\ninterface PointsValues {\n readonly points: Vector2[];\n readonly closed: boolean;\n readonly smooth: boolean;\n}\n\n/** A line through listed graph points: data, or a shape drawn in graph coordinates when closed, which is when it is filled. */\nexport const PointsPlot = traced(component2d({\n key: \"pointsPlot\",\n state,\n defaults: { stroke: { weight: 3, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\" },\n commands: {\n ...PAINT_COMMANDS,\n /** Move the points to new places; extra ones grow from the line's end. */\n pointsTo: { args: [\"points\"] },\n },\n measure: (_measurer, s) => inkSize(tracePoints(s, reading(s))),\n // An open line has no inside, so its fill waits until it is closed.\n render: (ctx, s) => drawMark(ctx, s, tracePoints(s, reading(s)), { closed: s.closed, fills: s.closed }),\n}), tracePoints);\n\nexport type PointsPlot = NodeOf<typeof PointsPlot>;\n\nfunction tracePoints(s: PointsValues, { map, shift }: MarkReading): Vector2[][] {\n const pixels = s.points.map((p) => map.toPoint(p.x + shift.x, p.y + shift.y));\n if (pixels.length < 2) return [];\n return [s.smooth && pixels.length > 2 ? spline(pixels, s.closed) : pixels];\n}\n\n// Catmull–Rom, so the curve passes through every point it was given.\nfunction spline(points: readonly Vector2[], closed: boolean): Vector2[] {\n const n = points.length;\n const at = (i: number): Vector2 => (closed ? points[((i % n) + n) % n] : points[Math.max(0, Math.min(n - 1, i))]);\n const out: Vector2[] = [];\n const spans = closed ? n : n - 1;\n for (let i = 0; i < spans; i++) {\n const p0 = at(i - 1), p1 = at(i), p2 = at(i + 1), p3 = at(i + 2);\n for (let s = 0; s < SMOOTH_STEPS; s++) {\n const t = s / SMOOTH_STEPS;\n const t2 = t * t;\n const t3 = t2 * t;\n out.push({\n x: 0.5 * (2 * p1.x + (p2.x - p0.x) * t + (2 * p0.x - 5 * p1.x + 4 * p2.x - p3.x) * t2 + (3 * p1.x - p0.x - 3 * p2.x + p3.x) * t3),\n y: 0.5 * (2 * p1.y + (p2.y - p0.y) * t + (2 * p0.y - 5 * p1.y + 4 * p2.y - p3.y) * t2 + (3 * p1.y - p0.y - 3 * p2.y + p3.y) * t3),\n });\n }\n }\n if (!closed) out.push(points[n - 1]);\n return out;\n}\n", "import {\n component2d,\n Graphics2D,\n Types,\n type NodeOf,\n type Color as _Color,\n\n type NormalizedColor,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { listed, omit, PAINT, PAINT_COMMANDS, painted } from \"../kit/component\";\nimport { curveValue } from \"../kit/curve\";\nimport { drawLabels, loadFormulas, type Label } from \"../kit/furniture\";\nimport { curveFor, PLANE_ENTRY, PLOT_REF, type GraphPlane } from \"../kit/graph\";\nimport { strokeShape } from \"../kit/mark\";\nimport { anchored } from \"../kit/place\";\n\nconst state = {\n // A dot has no outline worth trimming.\n ...omit(PAINT, \"start\", \"end\"),\n /** The plot this point rides, by id; empty for a point that sits at its own `x`/`y`. */\n on: PLOT_REF,\n radius: Types.number(7, { min: 0, unit: \"px\" }),\n label: Types.text(\"\", { animatable: false }),\n labelSide: listed([\"above\", \"below\", \"left\", \"right\"], \"above\", { animatable: false }),\n labelSize: Types.number(18, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n graph: PLANE_ENTRY,\n /** The graph height the point is at: the curve's when it rides one. A formula reads it back as `[key.value]`. */\n value: Types.number(0, { private: true }),\n};\n\n/**\n * A dot at graph coordinates, with an optional label. Named a plot in `on`, it\n * rides that curve: its `x` is where along it, and its height is the curve's.\n */\nexport const PlotPoint = anchored(component2d({\n key: \"plotPoint\",\n state,\n defaults: { fill: \"#e5e7eb\", width: \"hug\", height: \"hug\", value: (s) => heightOf(s.graph, s.on, s.x, s.y) },\n load: (loader, s) => {\n if (s.label !== \"\" && s.fontFamily !== \"\") loader.font(s.fontFamily);\n loadFormulas(loader, [s.label]);\n },\n commands: omit(PAINT_COMMANDS, \"progressTo\", \"flash\"),\n measure: (_measurer, s) => ({ width: s.radius * 2, height: s.radius * 2 }),\n render: (ctx, s) => {\n const size = s.radius * 2;\n const shape = size > 0 ? () => new Graphics2D().ellipse({ x: 0, y: 0, width: size, height: size }) : null;\n painted(\n ctx,\n () => {\n if (shape) ctx.draw(shape().shadow(s.shadow).fill(s.fill));\n if (s.label === \"\") return;\n const gap = s.radius + s.labelSize * 0.45;\n const side = s.labelSide;\n const horizontal = side === \"left\" || side === \"right\";\n const label: Label = {\n text: s.label,\n align: side === \"left\" ? \"right\" : side === \"right\" ? \"left\" : \"center\",\n at: {\n x: horizontal ? (side === \"left\" ? -1 : 1) * gap : 0,\n y: horizontal ? 0 : (side === \"below\" ? -1 : 1) * (gap + s.labelSize / 2),\n },\n };\n ctx.draw(drawLabels([label], { fontSize: s.labelSize, fontFamily: s.fontFamily, color: s.labelColor as NormalizedColor }));\n },\n () => {\n if (shape) strokeShape(ctx, shape, s);\n },\n );\n },\n}), (s: { readonly on: unknown }, plane) => (x, y) => ({ x, y: heightOf(plane, s.on, x, y) }));\n\nexport type PlotPoint = NodeOf<typeof PlotPoint>;\n\n/** The height a point at `x`/`y` sits at: the curve's, when it rides one that has a value there. */\nfunction heightOf(plane: GraphPlane | null, on: unknown, x: number, y: number): number {\n const curve = curveFor(plane, on);\n const height = curve ? curveValue(curve, x) : NaN;\n // Off the end of its curve a point stays where its own `y` puts it rather than vanishing.\n return Number.isFinite(height) ? height : y;\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { omit, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport { radians } from \"../kit/geometry\";\nimport { PLANE_ENTRY } from \"../kit/graph\";\nimport { drawMark, graphPoint, inkSize, ownPoint, reading, traced, type MarkReading, type MarkState } from \"../kit/mark\";\n\n/** Degrees of arc per drawn segment of a bent arrow. */\nconst BEND_STEP = 4;\n\nconst state = {\n ...omit(PAINT, \"fill\"),\n tail: Types.vector2(),\n head: Types.vector2({ x: 1, y: 1 }),\n /** The arc the arrow sweeps, in degrees: zero is straight, positive bows to its left. */\n bend: Types.number(0, { min: -180, max: 180, unit: \"°\" }),\n graph: PLANE_ENTRY,\n};\n\ninterface ArrowValues {\n readonly tail: Vector2;\n readonly head: Vector2;\n readonly bend: number;\n}\n\n/** A handle on one end of the arrow: where the end is in its own frame, and the graph point a drop there gives. */\nconst end = (which: \"tail\" | \"head\") => ({\n at: (s: ArrowValues & MarkState) => {\n const read = reading(s);\n return ownPoint(read, traceArrow(s, read), s[which]);\n },\n value: (at: Vector2, s: ArrowValues & MarkState) => {\n const read = reading(s);\n return graphPoint(read, traceArrow(s, read), at);\n },\n});\n\n/** An arrow from `tail` to `head`, two graph points; its arrowhead is the stroke's `endCap`. (Not `from`/`to`: every node has a `to`.) */\nexport const VectorArrow = traced(component2d({\n key: \"vectorArrow\",\n state,\n defaults: { stroke: { weight: 4, fill: \"#e5e7eb\", align: \"center\", endCap: \"triangle\" }, width: \"hug\", height: \"hug\" },\n commands: {\n ...omit(PAINT_COMMANDS, \"fillTo\"),\n /** Move either end, in graph coordinates. */\n endpointsTo: { args: [\"tail\", \"head\"] },\n },\n handles: { tail: end(\"tail\"), head: end(\"head\") },\n measure: (_measurer, s) => inkSize(traceArrow(s, reading(s))),\n render: (ctx, s) => drawMark(ctx, s, traceArrow(s, reading(s))),\n}), traceArrow);\n\nexport type VectorArrow = NodeOf<typeof VectorArrow>;\n\nfunction traceArrow(s: ArrowValues, { map, shift }: MarkReading): Vector2[][] {\n const a = map.toPoint(s.tail.x + shift.x, s.tail.y + shift.y);\n const b = map.toPoint(s.head.x + shift.x, s.head.y + shift.y);\n const sweep = radians(s.bend);\n const chord = Math.hypot(b.x - a.x, b.y - a.y);\n if (Math.abs(sweep) < 1e-3 || chord === 0) return [[a, b]];\n\n // The circle through both ends that subtends `sweep` at its centre.\n const radius = chord / (2 * Math.sin(Math.abs(sweep) / 2));\n const side = Math.sign(sweep);\n const reach = radius * Math.cos(sweep / 2);\n // The centre sits to the arrow's right for a positive sweep, so the arc bows to its left.\n const cx = (a.x + b.x) / 2 + (side * (b.y - a.y) * reach) / chord;\n const cy = (a.y + b.y) / 2 - (side * (b.x - a.x) * reach) / chord;\n const from = Math.atan2(a.y - cy, a.x - cx);\n const steps = Math.max(8, Math.ceil(Math.abs(s.bend) / BEND_STEP));\n const run: Vector2[] = [];\n for (let i = 0; i <= steps; i++) {\n const angle = from - (sweep * i) / steps;\n run.push({ x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) });\n }\n return [run];\n}\n", "import {\n component2d,\n type NodeOf,\n type NodeView,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n} from \"@motionscript/sdk\";\nimport { omit, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport type { Interval } from \"../kit/coords\";\nimport { curveValue } from \"../kit/curve\";\nimport { intervalEntry, PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { curveFor, PLANE_ENTRY, PLOT_REF } from \"../kit/graph\";\nimport { drawMark, inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\nconst state = {\n // An area is only its fill, and has no outline to trim.\n ...omit(PAINT, \"stroke\", \"start\", \"end\"),\n /** The plot that bounds the area, by id. */\n on: PLOT_REF,\n /** A second plot to fill down to, in place of the x axis. */\n under: PLOT_REF,\n domain: intervalEntry([0, 1]),\n graph: PLANE_ENTRY,\n};\n\ninterface AreaValues {\n readonly on: NodeView | null;\n readonly under: NodeView | null;\n readonly domain: Interval;\n}\n\n/** The region between a plot and the x axis, or between two plots, over a span of x. It sits beside the plots it reads, since it may read two. */\nexport const CurveArea = traced(component2d({\n key: \"curveArea\",\n state,\n defaults: { fill: { type: \"solid\", color: PLOT_COLOR, opacity: 0.35 }, width: \"hug\", height: \"hug\" },\n commands: {\n ...omit(PAINT_COMMANDS, \"strokeTo\", \"progressTo\", \"flash\"),\n /** Animate the span of x that is filled: sweep an area open, or slide it along. */\n domainTo: { args: [\"domain\"] },\n },\n measure: (_measurer, s) => inkSize(traceArea(s, reading(s))),\n render: (ctx, s) => drawMark(ctx, s, traceArea(s, reading(s)), { closed: true }),\n}), traceArea);\n\nexport type CurveArea = NodeOf<typeof CurveArea>;\n\nfunction traceArea(s: AreaValues, { map, plane }: MarkReading): Vector2[][] {\n const top = curveFor(plane, s.on);\n if (!top) return [];\n const floor = curveFor(plane, s.under, false);\n const [yMin, yMax] = map.yRange;\n const a = Math.max(s.domain[0], map.xRange[0]);\n const b = Math.min(s.domain[1], map.xRange[1]);\n if (!(b > a)) return [];\n\n const width = Math.abs(map.toPoint(b, 0).x - map.toPoint(a, 0).x);\n const steps = Math.max(8, Math.min(600, Math.round(width / 2)));\n // Held inside the system's range, and at the axis where a curve has no value.\n const height = (value: number) => (Number.isFinite(value) ? clamp(value, yMin, yMax) : clamp(0, yMin, yMax));\n const upper: Vector2[] = [];\n const lower: Vector2[] = [];\n for (let i = 0; i <= steps; i++) {\n const x = a + ((b - a) * i) / steps;\n upper.push(map.toPoint(x, height(curveValue(top, x))));\n lower.push(map.toPoint(x, height(floor ? curveValue(floor, x) : 0)));\n }\n return [[...upper, ...lower.reverse()]];\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n type NodeView,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { listed, omit, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport type { Interval } from \"../kit/coords\";\nimport { curveValue } from \"../kit/curve\";\nimport { intervalEntry, PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { curveFor, PLANE_ENTRY, PLOT_REF } from \"../kit/graph\";\nimport { drawMark, inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\nexport type RiemannSample = \"left\" | \"right\" | \"center\";\n\n/** More rectangles than this is a filled area with extra steps. */\nconst MAX_RECTANGLES = 2000;\n\nconst state = {\n // Its rectangles are revealed by `dx`, not by trimming their outlines.\n ...omit(PAINT, \"start\", \"end\"),\n on: PLOT_REF,\n domain: intervalEntry([0, 1]),\n /** Each rectangle's width, in graph units. */\n dx: Types.number(0.25, { min: 0.001 }),\n /** Where in its width a rectangle reads the curve's height. */\n sample: listed([\"left\", \"right\", \"center\"], \"left\", { animatable: false }),\n graph: PLANE_ENTRY,\n};\n\ninterface SumValues {\n readonly on: NodeView | null;\n readonly domain: Interval;\n readonly dx: number;\n readonly sample: RiemannSample;\n}\n\n/** Rectangles under a plot, each `dx` wide and as tall as the curve where it is sampled. */\nexport const RiemannSum = traced(component2d({\n key: \"riemannSum\",\n state,\n defaults: {\n fill: { type: \"solid\", color: PLOT_COLOR, opacity: 0.35 },\n stroke: { weight: 1.5, fill: PLOT_COLOR, align: \"center\", join: \"round\" },\n width: \"hug\",\n height: \"hug\",\n },\n commands: {\n ...omit(PAINT_COMMANDS, \"progressTo\", \"flash\"),\n /** Animate the rectangles' width: narrower is the sum closing in on the area. */\n refineTo: { args: [\"dx\"] },\n /** Animate the span of x the rectangles cover. */\n domainTo: { args: [\"domain\"] },\n },\n measure: (_measurer, s) => inkSize(traceSum(s, reading(s))),\n render: (ctx, s) => drawMark(ctx, s, traceSum(s, reading(s)), { closed: true }),\n}), traceSum);\n\nexport type RiemannSum = NodeOf<typeof RiemannSum>;\n\nfunction traceSum(s: SumValues, { map, plane }: MarkReading): Vector2[][] {\n const plot = curveFor(plane, s.on);\n const [a, b] = s.domain;\n const dx = s.dx;\n if (!plot || !(b > a) || !(dx > 0)) return [];\n const [yMin, yMax] = map.yRange;\n const base = clamp(0, yMin, yMax);\n const at = s.sample === \"left\" ? 0 : s.sample === \"right\" ? 1 : 0.5;\n const count = Math.min(MAX_RECTANGLES, Math.ceil((b - a) / dx - 1e-9));\n const runs: Vector2[][] = [];\n for (let i = 0; i < count; i++) {\n const left = a + i * dx;\n const right = Math.min(b, left + dx);\n const value = curveValue(plot, left + (right - left) * at);\n if (!Number.isFinite(value)) continue;\n const height = clamp(value, yMin, yMax);\n runs.push([map.toPoint(left, base), map.toPoint(left, height), map.toPoint(right, height), map.toPoint(right, base)]);\n }\n return runs;\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n type NodeView,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { omit, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport { curveValue, type CurveValues } from \"../kit/curve\";\nimport { curveFor, PLANE_ENTRY, PLOT_REF } from \"../kit/graph\";\nimport { drawMark, inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\n/** The step a slope is measured over, as a share of the system's width. */\nconst SLOPE_STEP = 1e-4;\n\nconst state = {\n ...omit(PAINT, \"fill\"),\n on: PLOT_REF,\n length: Types.number(260, { min: 0, unit: \"px\" }),\n /** The second point's distance along x; zero is the tangent itself. */\n dx: Types.number(0, { min: 0 }),\n legs: Types.boolean(false, { animatable: false }),\n graph: PLANE_ENTRY,\n /** The slope drawn, in graph units: the curve's at `x`, or the secant's when there is a `dx`. A formula reads it back as `[key.slope]`. */\n slope: Types.number(NaN, { private: true }),\n};\n\ninterface TangentValues {\n readonly x: number;\n readonly on: NodeView | null;\n readonly length: number;\n readonly dx: number;\n readonly legs: boolean;\n}\n\n/** The tangent to a plot at this node's `x`, a fixed length on screen; with a `dx`, the secant through `x` and `x + dx`. */\nexport const TangentLine = traced(component2d({\n key: \"tangentLine\",\n state,\n defaults: {\n stroke: { weight: 3, fill: \"#f59e0b\", align: \"center\", cap: \"round\", join: \"round\" },\n width: \"hug\",\n height: \"hug\",\n slope: (s) => {\n const plot = curveFor(s.graph, s.on);\n return plot ? tangentSlope(plot, s.x, s.dx) : NaN;\n },\n },\n commands: omit(PAINT_COMMANDS, \"fillTo\"),\n measure: (_measurer, s) => inkSize(traceTangent(s, reading(s))),\n render: (ctx, s) => drawMark(ctx, s, traceTangent(s, reading(s))),\n}), traceTangent);\n\nexport type TangentLine = NodeOf<typeof TangentLine>;\n\n/** The slope a tangent at `x` draws on `curve`, in graph units: the curve's at `x`, or the secant's to `x + dx`. */\nexport function tangentSlope(curve: CurveValues, x: number, dx = 0): number {\n if (dx > 0) return (curveValue(curve, x + dx) - curveValue(curve, x)) / dx;\n const h = 1e-6 * Math.max(1, Math.abs(x));\n return (curveValue(curve, x + h) - curveValue(curve, x - h)) / (2 * h);\n}\n\nfunction traceTangent(s: TangentValues, { map, plane }: MarkReading): Vector2[][] {\n const plot = curveFor(plane, s.on);\n if (!plot) return [];\n const x = s.x;\n const y = curveValue(plot, x);\n if (!Number.isFinite(y)) return [];\n const half = s.length / 2;\n\n if (s.dx > 0) {\n const y2 = curveValue(plot, x + s.dx);\n if (!Number.isFinite(y2)) return [];\n const a = map.toPoint(x, y);\n const b = map.toPoint(x + s.dx, y2);\n const span = Math.hypot(b.x - a.x, b.y - a.y);\n if (span === 0) return [];\n const reach = Math.max(half, span / 2 + 16);\n const ux = (b.x - a.x) / span;\n const uy = (b.y - a.y) / span;\n const mx = (a.x + b.x) / 2;\n const my = (a.y + b.y) / 2;\n const secant = [{ x: mx - ux * reach, y: my - uy * reach }, { x: mx + ux * reach, y: my + uy * reach }];\n return s.legs ? [secant, [a, map.toPoint(x + s.dx, y), b]] : [secant];\n }\n\n const [xMin, xMax] = map.xRange;\n const h = Number.isFinite(xMax - xMin) ? (xMax - xMin) * SLOPE_STEP : 1e-4;\n const before = curveValue(plot, x - h);\n const after = curveValue(plot, x + h);\n if (!Number.isFinite(before) || !Number.isFinite(after)) return [];\n const p = map.toPoint(x, y);\n const a = map.toPoint(x - h, before);\n const b = map.toPoint(x + h, after);\n const span = Math.hypot(b.x - a.x, b.y - a.y);\n if (span === 0) return [];\n const ux = (b.x - a.x) / span;\n const uy = (b.y - a.y) / span;\n return [[{ x: p.x - ux * half, y: p.y - uy * half }, { x: p.x + ux * half, y: p.y + uy * half }]];\n}\n", "import {\n component2d,\n type NodeOf,\n type NodeView,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { listed, omit, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport { curveValue } from \"../kit/curve\";\nimport { AXIS_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { curveFor, PLANE_ENTRY, PLOT_REF } from \"../kit/graph\";\nimport { drawMark, inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\nexport type DropAxis = \"x\" | \"y\" | \"both\";\n\nconst state = {\n ...omit(PAINT, \"fill\"),\n /** A plot to take the point's height from, by id. */\n on: PLOT_REF,\n /** Which axis to drop to: `x` draws the vertical line, `y` the horizontal one. */\n axis: listed([\"x\", \"y\", \"both\"], \"both\", { animatable: false }),\n graph: PLANE_ENTRY,\n};\n\ninterface DropValues {\n readonly x: number;\n readonly y: number;\n readonly on: NodeView | null;\n readonly axis: DropAxis;\n}\n\n/**\n * Guide lines from a graph point to the axes, reading its coordinates off them.\n * The point is this node's `x`/`y`, or the point of a plot above its `x`.\n */\nexport const DropLines = traced(component2d({\n key: \"dropLines\",\n state,\n defaults: { stroke: { weight: 2, fill: AXIS_COLOR, align: \"center\", dash: [8, 6] }, width: \"hug\", height: \"hug\" },\n commands: omit(PAINT_COMMANDS, \"fillTo\"),\n measure: (_measurer, s) => inkSize(traceDrops(s, reading(s))),\n render: (ctx, s) => drawMark(ctx, s, traceDrops(s, reading(s))),\n}), traceDrops);\n\nexport type DropLines = NodeOf<typeof DropLines>;\n\nfunction traceDrops(s: DropValues, { map, plane }: MarkReading): Vector2[][] {\n const x = s.x;\n const plot = curveFor(plane, s.on);\n const y = plot ? curveValue(plot, x) : s.y;\n if (!Number.isFinite(y)) return [];\n const at = map.toPoint(x, y);\n const runs: Vector2[][] = [];\n // Each line starts on its axis, so drawing it on grows it towards the point.\n if (s.axis !== \"y\") runs.push([map.toPoint(x, clamp(0, map.yRange[0], map.yRange[1])), at]);\n if (s.axis !== \"x\") runs.push([map.toPoint(clamp(0, map.xRange[0], map.xRange[1]), y), at]);\n return runs;\n}\n", "import {\n component2d,\n Graphics2D,\n Types,\n type NodeOf,\n type NodeView,\n type Color as _Color,\n type NormalizedColor,\n type PathCommand,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { braceOutline } from \"../kit/brace\";\nimport { listed, painted } from \"../kit/component\";\nimport {\n add, between, container, FOLLOW_COMMANDS, FOLLOW_STATE, followedQuad, heading, outlineBounds, OWN_FRAME, resting,\n type FollowValues, type Quad,\n} from \"../kit/follow\";\nimport { drawLabels, loadFormulas } from \"../kit/furniture\";\nimport { strokeShape } from \"../kit/mark\";\n\nexport type BraceSide = \"below\" | \"above\" | \"left\" | \"right\";\n\n/** The edge of a target a brace runs along, as two corner indexes of its quad, read with the brace's bulge to the left. */\nconst EDGE: Record<BraceSide, [number, number]> = {\n below: [2, 3],\n above: [0, 1],\n left: [3, 0],\n right: [1, 2],\n};\n\nconst state = {\n ...FOLLOW_STATE,\n side: listed([\"below\", \"above\", \"left\", \"right\"], \"below\", { animatable: false }),\n /** The two ends of a brace that follows nothing, from the brace's own position. It bulges to the left of tail to head. */\n tail: Types.vector2({ x: -80, y: 0 }),\n head: Types.vector2({ x: 80, y: 0 }),\n /** The room between the target and the brace. (`gap` is a layout's.) */\n clearance: Types.number(8, { min: 0, unit: \"px\" }),\n /** How far the brace reaches from its ends to its tip. (`depth` is a node's place in 3D.) */\n reach: Types.number(18, { min: 2, unit: \"px\" }),\n label: Types.text(\"\", { animatable: false }),\n labelSize: Types.number(28, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n};\n\ninterface BraceValues extends FollowValues {\n readonly side: BraceSide;\n readonly tail: Vector2;\n readonly head: Vector2;\n readonly clearance: number;\n readonly reach: number;\n}\n\n/** Whether the brace follows nothing, and so spans its own two points. */\nfunction spans(s: BraceValues, parted: NodeView | null): boolean {\n return !s.retarget && resting(s, parted) === null;\n}\n\n/** No target: the span itself, as an edge with nothing above it. */\nfunction quadOf(s: BraceValues, parted: NodeView | null): Quad | null {\n return spans(s, parted) ? [s.head, s.tail, s.tail, s.head] : followedQuad(s, parted);\n}\n\n/** The edge the brace runs along, pushed out by the gap, and the way it bulges. */\nfunction edgeOf(s: BraceValues, parted: NodeView | null, quad: Quad): { from: Vector2; to: Vector2; out: Vector2 } {\n const [i, j] = spans(s, parted) ? [1, 0] : EDGE[s.side];\n const { unit } = heading(quad[i], quad[j]);\n // Left of the edge's own direction, in a y-up frame.\n const out = { x: -unit.y, y: unit.x };\n return { from: add(quad[i], out, s.clearance), to: add(quad[j], out, s.clearance), out };\n}\n\nfunction outline(s: BraceValues, parted: NodeView | null): PathCommand[] {\n const quad = quadOf(s, parted);\n if (!quad) return [];\n const { from, to, out } = edgeOf(s, parted, quad);\n return braceOutline(from, to, out, s.reach);\n}\n\n/** One of the two ends to drag, while the brace spans them. */\nconst end = (which: \"tail\" | \"head\") => ({\n at: (s: BraceValues) => (spans(s, container(null, s)) ? s[which] : null),\n value: (at: Vector2) => ({ x: at.x, y: at.y }),\n});\n\n/**\n * A curly brace along one side of a node or of a part of a formula, or between\n * two points when it names neither, with an optional label at its tip. A label\n * written between dollar signs is typeset.\n */\nexport const CurlyBrace = component2d({\n key: \"curlyBrace\",\n state,\n defaults: { stroke: { weight: 3, fill: \"#e5e7eb\", align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\" },\n load: (loader, s) => {\n if (s.label !== \"\" && s.fontFamily !== \"\") loader.font(s.fontFamily);\n loadFormulas(loader, [s.label]);\n },\n commands: FOLLOW_COMMANDS,\n handles: { tail: end(\"tail\"), head: end(\"head\") },\n measure: () => ({ width: 0, height: 0 }),\n bounds: (_size, s) => outlineBounds(outline(s, container(null, s))),\n render: (ctx, s) => {\n const parted = container(ctx, s);\n const data = outline(s, parted);\n const shape = data.length > 0 ? () => new Graphics2D().path({ data, centerBounds: OWN_FRAME, start: s.start, end: s.end }) : null;\n painted(\n ctx,\n () => {\n if (shape) ctx.draw(shape().shadow(s.shadow).fill([]));\n if (s.label === \"\") return;\n const quad = quadOf(s, parted);\n if (!quad) return;\n const { from, to, out } = edgeOf(s, parted, quad);\n const reach = Math.min(s.reach, heading(from, to).length / 2) + s.labelSize * 0.75;\n const at = add(between(from, to), out, reach);\n const align = out.x > 0.5 ? \"left\" : out.x < -0.5 ? \"right\" : \"center\";\n const style = { fontSize: s.labelSize, fontFamily: s.fontFamily, color: s.labelColor as NormalizedColor };\n ctx.draw(drawLabels([{ text: s.label, at, align }], style));\n },\n () => {\n if (shape) strokeShape(ctx, shape, s);\n },\n );\n },\n});\n\nexport type CurlyBrace = NodeOf<typeof CurlyBrace>;\n", "import {\n component2d,\n Graphics2D,\n Types,\n type NodeOf,\n type Color as _Color,\n\n type NormalizedColor,\n type PathCommand,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { listed, omit, PAINT, PAINT_COMMANDS, painted } from \"../kit/component\";\nimport { outlineBounds, OWN_FRAME } from \"../kit/follow\";\nimport { drawLabels, loadFormulas } from \"../kit/furniture\";\nimport { radians } from \"../kit/geometry\";\nimport { strokeShape } from \"../kit/mark\";\n\n/** Degrees of arc per drawn segment. */\nconst ARC_STEP = 4;\n/** How close to a right angle `auto` draws the square. */\nconst RIGHT_SLOP = 0.5;\n\nconst point = (radius: number, degrees: number) => {\n const turn = radians(degrees);\n return { x: radius * Math.cos(turn), y: radius * Math.sin(turn) };\n};\n\nconst state = {\n // It is only an outline.\n ...omit(PAINT, \"fill\"),\n fromAngle: Types.number(0, { unit: \"°\" }),\n toAngle: Types.number(60, { unit: \"°\" }),\n radius: Types.number(48, { min: 0, unit: \"px\" }),\n /** `auto` draws the square where the angle is a right one. */\n corner: listed([\"auto\", \"arc\", \"square\"], \"auto\", { animatable: false }),\n /** Text, a formula between dollar signs, or `°` for the angle's own size. */\n label: Types.text(\"\", { animatable: false }),\n labelSize: Types.number(24, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** The angle marked, in degrees: positive counter-clockwise. A formula reads it back as `[key.value]`. */\n value: Types.number(0, { private: true }),\n};\n\ninterface AngleValues {\n readonly fromAngle: number;\n readonly toAngle: number;\n readonly radius: number;\n readonly corner: \"arc\" | \"square\" | \"auto\";\n}\n\n/**\n * The mark of an angle at the node's own position: an arc from one direction\n * to another, or the small square of a right angle, with an optional label.\n * Directions are degrees counter-clockwise from the right, so binding one to a\n * variable opens and closes the angle. A label of `°` shows the angle's size.\n */\nexport const AngleMark = component2d({\n key: \"angleMark\",\n state,\n defaults: { stroke: { weight: 3, fill: \"#e5e7eb\", align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\", value: (s) => angleOf(s) },\n load: (loader, s) => {\n if (s.label !== \"\" && s.fontFamily !== \"\") loader.font(s.fontFamily);\n loadFormulas(loader, [s.label]);\n },\n commands: {\n ...omit(PAINT_COMMANDS, \"fillTo\"),\n /** Grow or shrink the mark. */\n radiusTo: { args: [\"radius\"] },\n },\n measure: () => ({ width: 0, height: 0 }),\n bounds: (_size, s) => outlineBounds(outline(s)),\n render: (ctx, s) => {\n const data = outline(s);\n const shape = data.length > 0 ? () => new Graphics2D().path({ data, centerBounds: OWN_FRAME, start: s.start, end: s.end }) : null;\n painted(\n ctx,\n () => {\n if (shape) ctx.draw(shape().shadow(s.shadow).fill([]));\n if (s.label === \"\" || s.radius <= 0) return;\n const text = s.label === \"°\" ? `${Math.round(Math.abs(s.value) * 10) / 10}°` : s.label;\n const at = point(s.radius + s.labelSize * 0.9, (s.fromAngle + s.toAngle) / 2);\n const style = { fontSize: s.labelSize, fontFamily: s.fontFamily, color: s.labelColor as NormalizedColor };\n ctx.draw(drawLabels([{ text, at, align: \"center\" }], style));\n },\n () => {\n if (shape) strokeShape(ctx, shape, s);\n },\n );\n },\n});\n\nexport type AngleMark = NodeOf<typeof AngleMark>;\n\n/** The angle a mark marks, in degrees: positive counter-clockwise. */\nexport function angleOf(s: Pick<AngleValues, \"fromAngle\" | \"toAngle\">): number {\n return s.toAngle - s.fromAngle;\n}\n\nfunction outline({ fromAngle, toAngle, radius, corner }: AngleValues): PathCommand[] {\n const sweep = toAngle - fromAngle;\n if (radius <= 0 || sweep === 0) return [];\n const square = corner === \"square\" || (corner === \"auto\" && Math.abs(Math.abs(sweep) - 90) < RIGHT_SLOP);\n if (square) {\n const side = radius * 0.6;\n const a = point(side, fromAngle);\n const b = point(side, toAngle);\n return [\n { type: \"M\", x: a.x, y: a.y },\n { type: \"L\", x: a.x + b.x, y: a.y + b.y },\n { type: \"L\", x: b.x, y: b.y },\n ];\n }\n const steps = Math.max(2, Math.ceil(Math.abs(sweep) / ARC_STEP));\n const out: PathCommand[] = [];\n for (let i = 0; i <= steps; i++) {\n const p = point(radius, fromAngle + (sweep * i) / steps);\n out.push({ type: i === 0 ? \"M\" : \"L\", x: p.x, y: p.y });\n }\n return out;\n}\n", "import {\n component2d,\n Graphics2D,\n Types,\n type NodeOf,\n type NodeView,\n type PathCommand,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { listed, painted } from \"../kit/component\";\nimport {\n add, between, container, FOLLOW_COMMANDS, FOLLOW_STATE, followedQuad, grown, heading, outlineBounds, OWN_FRAME, type FollowValues, type Quad,\n} from \"../kit/follow\";\nimport { strokeShape } from \"../kit/mark\";\n\nexport type EmphasisShape = \"box\" | \"circle\" | \"underline\" | \"cross\";\n\n/** How far a cubic's handle reaches to draw a quarter of an ellipse. */\nconst QUARTER = 0.5523;\n\nconst line = (a: Vector2, b: Vector2): PathCommand[] => [\n { type: \"M\", x: a.x, y: a.y },\n { type: \"L\", x: b.x, y: b.y },\n];\n\nconst SHAPES: Record<EmphasisShape, (quad: Quad, gap: number) => PathCommand[]> = {\n box: (quad, gap) => {\n const [tl, tr, br, bl] = grown(quad, gap);\n return [{ type: \"M\", x: tl.x, y: tl.y }, ...[tr, br, bl].map((p): PathCommand => ({ type: \"L\", x: p.x, y: p.y })), { type: \"Z\" }];\n },\n // The ellipse through the grown box's corners.\n circle: (quad, gap) => {\n const [tl, tr, br, bl] = grown(quad, gap);\n const centre = between(tl, br);\n const across = { x: ((tr.x - tl.x) / 2) * Math.SQRT2, y: ((tr.y - tl.y) / 2) * Math.SQRT2 };\n const up = { x: ((tl.x - bl.x) / 2) * Math.SQRT2, y: ((tl.y - bl.y) / 2) * Math.SQRT2 };\n const at = (a: number, u: number) => add(add(centre, across, a), up, u);\n const arc = (c1: Vector2, c2: Vector2, end: Vector2): PathCommand => ({\n type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y,\n });\n const k = QUARTER;\n const start = at(0, 1);\n return [\n { type: \"M\", x: start.x, y: start.y },\n arc(at(k, 1), at(1, k), at(1, 0)),\n arc(at(1, -k), at(k, -1), at(0, -1)),\n arc(at(-k, -1), at(-1, -k), at(-1, 0)),\n arc(at(-1, k), at(-k, 1), start),\n { type: \"Z\" },\n ];\n },\n underline: (quad, gap) => {\n const [, , br, bl] = quad;\n const down = heading(quad[0], bl).unit;\n return line(add(bl, down, gap), add(br, down, gap));\n },\n cross: (quad, gap) => {\n const [tl, tr, br, bl] = grown(quad, gap);\n return [...line(tl, br), ...line(bl, tr)];\n },\n};\n\nconst state = {\n ...FOLLOW_STATE,\n shape: listed([\"box\", \"circle\", \"underline\", \"cross\"], \"box\", { animatable: false }),\n /** The room between the target and the mark. (`gap` is a layout's.) */\n clearance: Types.number(10, { unit: \"px\" }),\n};\n\ninterface EmphasisValues extends FollowValues {\n readonly shape: EmphasisShape;\n readonly clearance: number;\n}\n\nfunction outline(s: EmphasisValues, parted: NodeView | null): PathCommand[] {\n const quad = followedQuad(s, parted);\n return quad ? SHAPES[s.shape](quad, s.clearance) : [];\n}\n\n/**\n * A box, a circle, an underline or a cross drawn on a node, or on one part of\n * a formula. `progressTo` draws it on, and `retargetTo` slides it to another.\n */\nexport const EmphasisMark = component2d({\n key: \"emphasisMark\",\n state,\n defaults: { stroke: { weight: 3, fill: \"#facc15\", align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\" },\n commands: FOLLOW_COMMANDS,\n measure: () => ({ width: 0, height: 0 }),\n bounds: (_size, s) => outlineBounds(outline(s, container(null, s))),\n render: (ctx, s) => {\n const data = outline(s, container(ctx, s));\n const shape = data.length > 0 ? () => new Graphics2D().path({ data, centerBounds: OWN_FRAME, start: s.start, end: s.end }) : null;\n painted(\n ctx,\n () => {\n if (shape) ctx.draw(shape().shadow(s.shadow).fill([]));\n },\n () => {\n if (shape) strokeShape(ctx, shape, s);\n },\n );\n },\n});\n\nexport type EmphasisMark = NodeOf<typeof EmphasisMark>;\n", "import {\n component2d,\n Flow,\n Geo,\n Graphics3D,\n Mat,\n Paint,\n provides,\n Shapes,\n Types,\n View3D,\n type NodeOf,\n type Scene3D,\n type Transform3D,\n type Values,\n type Vector3,\n type Vector3Input,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type CornerRadiusResolved as _CornerRadiusResolved,\n type CornerStyleResolved as _CornerStyleResolved,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Color as _Color,\n\n type NormalizedColor as _NormalizedColor,\n type PostEffect3D as _PostEffect3D,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Shadows3D as _Shadows3D,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type ToneMapping3D as _ToneMapping3D,\n type Vector2 as _Vector2,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { AXIS_COLOR, intervalEntry } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { formatTick, ticksFor } from \"../kit/ticks\";\nimport { drawLabel3D, type LabelStyle3D } from \"./label3d\";\nimport { GRAPH_3D, graphSpace, type Graph3D, type GraphSpace } from \"./space\";\n\n/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */\nconst UNIT_AS_PIXELS = 64;\n\ntype AxisName = \"x\" | \"y\" | \"z\";\n\n/** The turn that lays a shape built along the scene's +y along each graph axis. */\nconst ALONG: Record<AxisName, Vector3Input> = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };\n\n/** The graph axis each axis's tick marks lie along. */\nconst TICK_ALONG: Record<AxisName, AxisName> = { x: \"y\", y: \"x\", z: \"y\" };\n\n/** The axes' own entries, beside a 3D canvas's. */\nconst own = {\n xRange: intervalEntry([-3, 3]),\n yRange: intervalEntry([-3, 3]),\n zRange: intervalEntry([-2, 2]),\n /** How long each axis is drawn, in scene units. */\n xLength: Types.number(6, { min: 0.01, step: 0.1 }),\n yLength: Types.number(6, { min: 0.01, step: 0.1 }),\n zLength: Types.number(4, { min: 0.01, step: 0.1 }),\n /** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */\n xStep: Types.number(0, { min: 0 }),\n yStep: Types.number(0, { min: 0 }),\n zStep: Types.number(0, { min: 0 }),\n color: Types.color(AXIS_COLOR),\n /** The radius of an axis line, in scene units. */\n thickness: Types.number(0.02, { min: 0, step: 0.005 }),\n tips: Types.boolean(true, { animatable: false }),\n ticks: Types.boolean(true, { animatable: false }),\n tickSize: Types.number(0.16, { min: 0, step: 0.01 }),\n /** Lines across the plane the x and y axes lie in, at each of their ticks. */\n grid: Types.boolean(false, { animatable: false }),\n /** (`gridColor` is the viewport's own reference grid.) */\n gridLineColor: Types.color(\"#374151\"),\n /** A number at each tick. */\n labels: Types.boolean(false, { animatable: false }),\n /** The height of a label's text, in scene units. */\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\n labelColor: Types.color(AXIS_COLOR),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** A title at the positive end of each axis. */\n xLabel: Types.text(\"x\", { animatable: false }),\n yLabel: Types.text(\"y\", { animatable: false }),\n zLabel: Types.text(\"z\", { animatable: false }),\n};\n\ntype AxesValues = Values<typeof own>;\n\n/** A 3D graph: three axes through a box of graph coordinates, z up, seen through its own camera. Its 3D children sit in graph coordinates. */\nexport const Axes3d = component2d({\n key: \"axes3d\",\n state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },\n defaults: { width: \"fill\", height: \"fill\" },\n commands: {\n ...Paint.commands,\n ...View3D.commands,\n /** Animate the window of values the axes show; everything drawn in them follows. */\n rangeTo: { args: [\"xRange\", \"yRange\", \"zRange\"] },\n },\n allowedChildren: [\"2d\", \"3d\"],\n load: (loader, s) => {\n View3D.load(loader, furnish(s));\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n provide: (s) => [provides(GRAPH_3D, graphOfAxes(s))],\n space: (s) => axesSpace(s),\n measure: (measurer, s, children) => Flow.measure(measurer, s, children, Paint.inset(s)),\n layout: (box, s, children) => Flow.layout(box, s, children, Paint.inset(s)),\n render: (ctx, s) => View3D.draw(ctx, s, furnish(s)),\n});\n\nexport type Axes3d = NodeOf<typeof Axes3d>;\n\n/** The axes' own drawing, added to the scene: what `render` draws and `load` declares. */\nfunction furnish(s: AxesValues): (scene: Scene3D) => void {\n return (scene) => scene.draw(furniture(s));\n}\n\n/** The last space worked out for each axes, kept while its ranges and lengths are unchanged. */\nconst spaces = new WeakMap<object, { readonly key: string; readonly space: GraphSpace }>();\n\n/** The coordinates of a 3D graph: what its children's `x`, `y` and `z` are in. */\nfunction axesSpace(s: AxesValues): GraphSpace {\n const { xRange, yRange, zRange, xLength, yLength, zLength } = s;\n const key = [xRange, yRange, zRange, xLength, yLength, zLength].join(\"|\");\n let kept = spaces.get(s);\n if (kept?.key !== key) spaces.set(s, (kept = { key, space: graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength }) }));\n return kept.space;\n}\n\n// One per axes, so the context its subtree holds is the same from frame to frame.\nconst graphs = new WeakMap<object, Graph3D>();\n\nfunction graphOfAxes(s: AxesValues): Graph3D {\n let graph = graphs.get(s);\n if (!graph) graphs.set(s, (graph = { space: () => axesSpace(s) }));\n return graph;\n}\n\n/** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */\nfunction furniture(s: AxesValues): Graphics3D {\n const space = axesSpace(s);\n const g3 = new Graphics3D();\n const ranges: Record<AxisName, Interval> = { x: space.xRange, y: space.yRange, z: space.zRange };\n const lengths: Record<AxisName, number> = { x: s.xLength, y: s.yLength, z: s.zLength };\n const steps: Record<AxisName, number> = { x: s.xStep, y: s.yStep, z: s.zStep };\n const titles: Record<AxisName, string> = { x: s.xLabel, y: s.yLabel, z: s.zLabel };\n // Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.\n const cross: Record<AxisName, number> = {\n x: clamp(0, ranges.x[0], ranges.x[1]),\n y: clamp(0, ranges.y[0], ranges.y[1]),\n z: clamp(0, ranges.z[0], ranges.z[1]),\n };\n const at = (axis: AxisName, value: number, shift: Partial<Record<AxisName, number>> = {}): Vector3 => {\n const point = { ...cross, [axis]: value };\n const local = space.toLocal(point.x, point.y, point.z);\n const moved = space.offset(0, 0, 0);\n for (const key of [\"x\", \"y\", \"z\"] as const) {\n const by = shift[key];\n if (by === undefined) continue;\n // A shift is in scene units, along the graph axis it names.\n if (key === \"x\") moved.z += by;\n else if (key === \"y\") moved.x += by;\n else moved.y += by;\n }\n return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };\n };\n\n const { thickness, tickSize } = s;\n const paint = Mat.basic({ color: s.color });\n const style: LabelStyle3D = { size: s.labelSize, color: s.labelColor, fontFamily: s.fontFamily };\n const tipLength = s.tips ? thickness * 9 : 0;\n const marks: Transform3D[] = [];\n const plane: Vector3[] = [];\n\n for (const axis of [\"x\", \"y\", \"z\"] as const) {\n const [min, max] = ranges[axis];\n const length = lengths[axis];\n if (!(max > min) || !(length > 0)) continue;\n\n if (thickness > 0) {\n const from = at(axis, min);\n const to = at(axis, max);\n g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {\n position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },\n rotation: ALONG[axis],\n });\n if (s.tips) {\n g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {\n position: at(axis, max, { [axis]: tipLength / 2 }),\n rotation: ALONG[axis],\n });\n }\n }\n\n const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);\n const side = TICK_ALONG[axis];\n for (const value of ticks.values) {\n // The crossing is marked by the other axes, and the far end by the tip.\n if (Math.abs(value - cross[axis]) < 1e-9 || (s.tips && Math.abs(value - max) < 1e-9)) continue;\n if (s.ticks && tickSize > 0) marks.push({ position: at(axis, value), rotation: ALONG[side] });\n if (s.labels) {\n drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);\n }\n }\n drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);\n\n if (s.grid && axis !== \"z\") {\n const other = axis === \"x\" ? \"y\" : \"x\";\n for (const value of ticks.values) {\n const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };\n const b = { ...a, [other]: ranges[other][1] };\n plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));\n }\n }\n }\n\n if (marks.length > 0) {\n g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);\n }\n if (plane.length > 0) g3.line({ points: plane, segments: true, stroke: { fill: s.gridLineColor } });\n return g3;\n}\n", "import {\n colorOps,\n component3d,\n Geo,\n Graphics3D,\n Mat,\n Material,\n Types,\n type ChildSpace3D,\n type Color,\n type Geometry3D,\n type Material3D,\n type NodeOf,\n type NormalizedColor,\n type Values,\n type Vector3,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport { parseSurface, surfaceParams, type SurfaceEquation } from \"../kit/equation3d\";\nimport type { ExpressionScope } from \"../kit/expression\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { colorAt, lerpScale, readScale } from \"../kit/scale\";\nimport { lerpParams, lerpSource, readSource, revisionOf, scopeFor, type PlotSource } from \"../kit/source\";\nimport { domainEntry, meshEntries } from \"./entries\";\nimport { graphEntry, graphOf, type GraphSpace } from \"./space\";\n\n/** A graph point for grid coordinate `(u, v)`, both 0 to 1, written into `out`. */\ntype SurfaceSampler = (u: number, v: number, out: Vector3) => void;\n\nconst state = {\n ...meshEntries,\n expression: Types.custom<string | PlotSource, PlotSource>(\"\", {\n resolve: readSource,\n lerp: lerpSource,\n kind: \"surfaceEquation\",\n }),\n /**\n * The span of each variable that is drawn: x and y for a height, which run\n * the width of the axes when left out, u and v for a parametric surface,\n * which run from 0 to 1.\n */\n uDomain: domainEntry(-3, 3),\n vDomain: domainEntry(-3, 3),\n /** The equation's named values: any name in it that is not a variable, a function or a constant. */\n params: Types.custom<ExpressionScope>({}, { lerp: lerpParams }),\n /** How finely the surface is sampled, each way. */\n segments: Types.number(48, { min: 2, max: 256, step: 1, animatable: false }),\n /** Colours by height, lowest first, over the axes' z range. Empty paints the surface in its fill. */\n colorScale: Types.custom<Color[], NormalizedColor[]>([], { resolve: readScale, lerp: lerpScale, kind: \"vector\" }),\n /** How many lines are drawn across the surface each way; zero leaves it bare. */\n meshLines: Types.number(12, { min: 0, max: 64, step: 1, animatable: false }),\n meshColor: Types.custom<Color, Color>(\"#0b1220\", { kind: \"color\" }),\n /** The opacity of the surface's shadow, laid flat on the floor of the axes and coloured by height; zero draws none. */\n floorShadow: Types.number(0, { min: 0, max: 1, step: 0.01 }),\n graph: graphEntry(),\n};\n\nexport type SurfaceValues = Values<typeof state> & { readonly x: number; readonly y: number; readonly z: number };\n\n/**\n * A surface in a 3D graph: a height over x and y (`sin(x) * cos(y)`), or three\n * parts in u and v. A point put inside it rides it.\n */\nexport const SurfacePlot3d = component3d({\n key: \"surfacePlot3d\",\n state,\n defaults: { fill: PLOT_COLOR },\n commands: {\n /** Change the equation, the surface bending from the one into the other. */\n morphTo: { args: [\"expression\"] },\n /** Animate the equation's named values. */\n paramsTo: { args: [\"params\"] },\n /** Animate the spans that are drawn. */\n domainTo: { args: [\"uDomain\", \"vDomain\"] },\n },\n space: (s) => surfaceSpace(s),\n render: (ctx, s) => ctx.draw(ctx.declaring ? declaredSurface(s) : drawSurface(s)),\n});\n\nexport type SurfacePlot3d = NodeOf<typeof SurfacePlot3d>;\n\n/**\n * The surface's height above its own origin at graph `(x, y)`, or `NaN`\n * where it has none or is not a height. What a point riding it reads.\n */\nexport function surfaceValueAt(surface: Pick<SurfaceValues, \"expression\" | \"params\">, x: number, y: number): number {\n const { source, blend } = surface.expression;\n const value = heightOf(surface, source, x, y);\n if (!blend) return value;\n const from = heightOf(surface, blend.from, x, y);\n return from + (value - from) * blend.t;\n}\n\n/** A point inside a surface stands on it: its `x` and `y` say where, and its height is the surface's. */\nfunction surfaceSpace(s: SurfaceValues): ChildSpace3D | null {\n const space = graphOf(s);\n if (!space) return null;\n return {\n toLocal: (x, y, z) => {\n const height = surfaceValueAt(s, x, y);\n return space.offset(x, y, Number.isFinite(height) ? height : z);\n },\n };\n}\n\n/** Its paint on a stand-in: only a material loads, and reading no equation keeps a morph from re-declaring. */\nfunction declaredSurface(s: SurfaceValues): Graphics3D {\n const paint = Material.shorthand(s);\n return new Graphics3D().plane(s.colorScale.length > 0 ? { ...paint, fill: \"white\" } : paint);\n}\n\nfunction drawSurface(s: SurfaceValues): Graphics3D {\n const g3 = new Graphics3D();\n const space = graphOf(s);\n const lines = space ? meshLines(s, space) : [];\n const scaled = s.colorScale.length > 0;\n // A surface is seen from both sides; a vertex colour multiplies the fill, so a scale is shown on white.\n const surface = { ...s, faces: s.faces ?? \"both\", ...(scaled ? { vertexColors: true, fill: \"white\" } : {}) };\n for (const op of Material.mesh(surface, space ? surfaceGeometry(s, space) : undefined).ops()) {\n if (op.kind !== \"mesh\") continue;\n g3.mesh(op.geometry, mapMaterials(op.material, (material) => ({\n ...material,\n // Pushed back a hair so the lines drawn on it are not fought for, and blended rather than a hole when faded.\n ...(lines.length > 0 ? { polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 1 } : {}),\n ...((s.opacity ?? 1) < 1 ? { depthWrite: false } : {}),\n } as Material3D)), op.transform);\n }\n if (lines.length > 0) {\n const color = colorOps.resolve(s.meshColor);\n g3.line({ points: lines, segments: true, stroke: { fill: color }, opacity: color[3] * (s.opacity ?? 1) });\n }\n const shadow = space && s.floorShadow > 0 ? floorShadow(s, space) : undefined;\n if (shadow) {\n g3.mesh(shadow, Mat.basic({\n color: scaled ? \"white\" : PLOT_COLOR,\n vertexColors: scaled,\n opacity: s.floorShadow * (s.opacity ?? 1),\n transparent: true,\n // Translucent and under everything: writing depth would hide the floor's grid lines behind it.\n depthWrite: false,\n faces: \"both\",\n }));\n }\n return g3;\n}\n\nfunction surfaceGeometry(s: SurfaceValues, space: GraphSpace): Geometry3D | undefined {\n const sample = sampler(s, space);\n if (!sample) return undefined;\n const scale = s.colorScale;\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n const low = space.offset(0, 0, space.zRange[0] - s.z).y;\n const high = space.offset(0, 0, space.zRange[1] - s.z).y;\n return Geo.parametric({\n segments: Math.max(2, Math.round(s.segments)),\n vertex: (u, v) => {\n sample(u, v, point);\n return space.offset(point.x, point.y, point.z);\n },\n ...(scale.length > 0\n ? { color: (_u, _v, position) => colorAt(scale, high > low ? (position.y - low) / (high - low) : 0) }\n : {}),\n computeNormals: true,\n revision: revisionOf(`${keyOf(s, space)}|${JSON.stringify(scale)}`),\n });\n}\n\nfunction heightOf(surface: Pick<SurfaceValues, \"params\">, source: string, x: number, y: number): number {\n const equation = equationOf(source);\n if (equation?.kind !== \"height\") return NaN;\n return equation.f(x, y, scopeFor(surfaceParams(source), surface.params));\n}\n\nfunction keyOf(s: SurfaceValues, space: GraphSpace): string {\n const { source, blend } = s.expression;\n return [source, blend?.from, blend?.t, space.revision, s.uDomain, s.vDomain, JSON.stringify(s.params), s.x, s.y, s.z].join(\"|\");\n}\n\nfunction sampler(s: SurfaceValues, space: GraphSpace): SurfaceSampler | null {\n const { source, blend } = s.expression;\n const to = surfaceOf(s, source, space);\n if (!to || !blend) return to;\n const from = surfaceOf(s, blend.from, space);\n if (!from) return to;\n const start: Vector3 = { x: 0, y: 0, z: 0 };\n return (u, v, out) => {\n from(u, v, start);\n to(u, v, out);\n out.x = start.x + (out.x - start.x) * blend.t;\n out.y = start.y + (out.y - start.y) * blend.t;\n out.z = start.z + (out.z - start.z) * blend.t;\n };\n}\n\n/** `source` as graph points, measured from the surface's own position. */\nfunction surfaceOf(s: SurfaceValues, source: string, space: GraphSpace): SurfaceSampler | null {\n const equation = equationOf(source);\n if (!equation) return null;\n const params = scopeFor(surfaceParams(source), s.params);\n if (equation.kind === \"parametric\") {\n const [u0, u1] = s.uDomain ?? [0, 1];\n const [v0, v1] = s.vDomain ?? [0, 1];\n const { x, y, z } = equation;\n return (u, v, out) => {\n const a = u0 + (u1 - u0) * u;\n const b = v0 + (v1 - v0) * v;\n out.x = finite(x(a, b, params));\n out.y = finite(y(a, b, params));\n out.z = finite(z(a, b, params));\n };\n }\n const [x0, x1] = s.uDomain ?? [space.xRange[0] - s.x, space.xRange[1] - s.x];\n const [y0, y1] = s.vDomain ?? [space.yRange[0] - s.y, space.yRange[1] - s.y];\n // Held inside the axes: a pole would otherwise stretch one triangle across the scene.\n const low = space.zRange[0] - s.z;\n const high = space.zRange[1] - s.z;\n const { f } = equation;\n return (u, v, out) => {\n out.x = x0 + (x1 - x0) * u;\n out.y = y0 + (y1 - y0) * v;\n out.z = clamp(finite(f(out.x, out.y, params)), low, high);\n };\n}\n\nfunction floorShadow(s: SurfaceValues, space: GraphSpace): Geometry3D | undefined {\n const sample = sampler(s, space);\n if (!sample) return undefined;\n const scale = s.colorScale;\n const [low, high] = space.zRange;\n const floor = low - s.z;\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n return Geo.parametric({\n segments: Math.max(2, Math.round(s.segments)),\n vertex: (u, v) => {\n sample(u, v, point);\n return space.offset(point.x, point.y, floor);\n },\n ...(scale.length > 0\n ? {\n color: (u: number, v: number) => {\n sample(u, v, point);\n return colorAt(scale, high > low ? (point.z + s.z - low) / (high - low) : 0);\n },\n }\n : {}),\n revision: revisionOf(`${keyOf(s, space)}|${JSON.stringify(scale)}|floor`),\n });\n}\n\n/** The last lines drawn for each surface, kept while what they are drawn from is unchanged. */\nconst linesDrawn = new WeakMap<object, { readonly key: string; readonly lines: Vector3[] }>();\n\nfunction meshLines(s: SurfaceValues, space: GraphSpace): Vector3[] {\n const count = Math.round(s.meshLines);\n const sample = count > 0 ? sampler(s, space) : null;\n if (!sample) return [];\n const steps = Math.max(2, Math.round(s.segments));\n const key = `${keyOf(s, space)}|${count}|${steps}`;\n const kept = linesDrawn.get(s);\n if (kept?.key === key) return kept.lines;\n const lines: Vector3[] = [];\n const point: Vector3 = { x: 0, y: 0, z: 0 };\n const at = (u: number, v: number): Vector3 => {\n sample(u, v, point);\n return space.offset(point.x, point.y, point.z);\n };\n for (let i = 0; i <= count; i++) {\n const fixed = i / count;\n for (let j = 0; j < steps; j++) {\n lines.push(at(fixed, j / steps), at(fixed, (j + 1) / steps));\n lines.push(at(j / steps, fixed), at((j + 1) / steps, fixed));\n }\n }\n linesDrawn.set(s, { key, lines });\n return lines;\n}\n\nfunction equationOf(source: string): SurfaceEquation | null {\n const equation = parseSurface(source, surfaceParams(source));\n return equation instanceof Error ? null : equation;\n}\n\n// A hole in the data is drawn flat rather than as a hole in the mesh.\nfunction finite(value: number): number {\n return Number.isFinite(value) ? value : 0;\n}\n\nfunction mapMaterials(\n material: Material3D | readonly Material3D[],\n change: (material: Material3D) => Material3D,\n): Material3D | readonly Material3D[] {\n return Array.isArray(material) ? (material as readonly Material3D[]).map(change) : change(material as Material3D);\n}\n", "import {\n component3d,\n Geo,\n Graphics3D,\n Material,\n Types,\n type Geometry3D,\n type NodeOf,\n type Values,\n type Vector3,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Material3D as _Material3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport { parseSpaceCurve, spaceCurveParams, type SpaceCurveEquation } from \"../kit/equation3d\";\nimport type { ExpressionScope } from \"../kit/expression\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { lerpParams, lerpSource, readSource, scopeFor, type PlotSource } from \"../kit/source\";\nimport { domainEntry, meshEntries } from \"./entries\";\nimport { graphEntry, graphOf, type GraphSpace } from \"./space\";\n\nconst state = {\n ...meshEntries,\n expression: Types.custom<string | PlotSource, PlotSource>(\"\", {\n resolve: readSource,\n lerp: lerpSource,\n kind: \"spaceCurveEquation\",\n }),\n /** The span of `t` that is drawn; 0 to 1 when left out. */\n domain: domainEntry(0, 1),\n params: Types.custom<ExpressionScope>({}, { lerp: lerpParams }),\n /** How many points the curve is drawn through. */\n samples: Types.number(160, { min: 2, max: 2000, step: 1, animatable: false }),\n /** The radius of the line, in scene units. */\n thickness: Types.number(0.04, { min: 0.001, step: 0.005 }),\n /** The part of the curve that is drawn, as shares of its length in `t`. */\n start: Types.number(0, { min: 0, max: 1, step: 0.01 }),\n end: Types.number(1, { min: 0, max: 1, step: 0.01 }),\n graph: graphEntry(),\n};\n\ntype CurveValues = Values<typeof state>;\n\n/** A curve through a 3D graph, three parts in `t`: `(cos(t), sin(t), t / 4)`. */\nexport const CurvePlot3d = component3d({\n key: \"curvePlot3d\",\n state,\n defaults: { fill: PLOT_COLOR },\n commands: {\n /** Change the equation, the curve bending from the one into the other. */\n morphTo: { args: [\"expression\"] },\n /** Animate the equation's named values. */\n paramsTo: { args: [\"params\"] },\n /** Animate the span of `t` that is drawn. */\n domainTo: { args: [\"domain\"] },\n /** Draw the curve on, or wipe it off: animates `start` and `end`. */\n progressTo: { args: [\"start\", \"end\"] },\n },\n // Declaring, its paint on a stand-in: only a material loads, and the curve's points are not sampled.\n render: (ctx, s) => ctx.draw(ctx.declaring ? new Graphics3D().plane(Material.shorthand(s)) : Material.mesh(s, curveGeometry(s))),\n});\n\nexport type CurvePlot3d = NodeOf<typeof CurvePlot3d>;\n\nfunction curveGeometry(s: CurveValues): Geometry3D | undefined {\n const space = graphOf(s);\n if (!space) return undefined;\n const points = pointsOf(s, space);\n if (points.length < 2) return undefined;\n return Geo.tube({ points, radius: s.thickness, segments: [points.length - 1, 8] });\n}\n\n/** The last run drawn for each curve, kept while what it is drawn from is unchanged. */\nconst runs = new WeakMap<object, { readonly key: string; readonly run: Vector3[] }>();\n\nfunction pointsOf(s: CurveValues, space: GraphSpace): Vector3[] {\n const { source, blend } = s.expression;\n const start = clamp(s.start, 0, 1);\n const end = clamp(s.end, 0, 1);\n const samples = Math.max(2, Math.round(s.samples));\n const key = [source, blend?.from, blend?.t, space.revision, s.domain, JSON.stringify(s.params), start, end, samples].join(\"|\");\n const kept = runs.get(s);\n if (kept?.key === key) return kept.run;\n const run: Vector3[] = [];\n runs.set(s, { key, run });\n const to = curveOf(s, source);\n if (!to || !(end > start)) return run;\n const from = blend ? curveOf(s, blend.from) : null;\n const steps = Math.max(1, Math.round(samples * (end - start)));\n const a: Vector3 = { x: 0, y: 0, z: 0 };\n const b: Vector3 = { x: 0, y: 0, z: 0 };\n for (let i = 0; i <= steps; i++) {\n const u = start + ((end - start) * i) / steps;\n if (!to(u, b)) continue;\n if (from && blend) {\n if (!from(u, a)) continue;\n b.x = a.x + (b.x - a.x) * blend.t;\n b.y = a.y + (b.y - a.y) * blend.t;\n b.z = a.z + (b.z - a.z) * blend.t;\n }\n run.push(space.offset(b.x, b.y, b.z));\n }\n return run;\n}\n\n/** `source` as a graph point for a share `u` of its span, or `false` where it has none. */\nfunction curveOf(s: CurveValues, source: string): ((u: number, out: Vector3) => boolean) | null {\n const equation = equationOf(source);\n if (!equation) return null;\n const params = scopeFor(spaceCurveParams(source), s.params);\n const [t0, t1] = s.domain ?? [0, 1];\n const { x, y, z } = equation;\n return (u, out) => {\n const t = t0 + (t1 - t0) * u;\n out.x = x(t, 0, params);\n out.y = y(t, 0, params);\n out.z = z(t, 0, params);\n return Number.isFinite(out.x) && Number.isFinite(out.y) && Number.isFinite(out.z);\n };\n}\n\nfunction equationOf(source: string): SpaceCurveEquation | null {\n const equation = parseSpaceCurve(source, spaceCurveParams(source));\n return equation instanceof Error ? null : equation;\n}\n", "import {\n component3d,\n Geo,\n Material,\n Types,\n type NodeOf,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Geometry3D as _Geometry3D,\n type Material3D as _Material3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport { meshEntries } from \"./entries\";\nimport { drawLabel3D } from \"./label3d\";\n\n/**\n * A dot at graph coordinates in a 3D graph, with an optional label. Put inside\n * a surface it rides it: its `x` and `y` say where, and its height is the surface's.\n */\nexport const PlotPoint3d = component3d({\n key: \"plotPoint3d\",\n state: {\n ...meshEntries,\n /** In scene units, so a point is the same size whatever the axes show. */\n radius: Types.number(0.1, { min: 0, step: 0.01 }),\n label: Types.text(\"\", { animatable: false }),\n /** The height of the label's text, in scene units. */\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n render: (ctx, s) => {\n const g3 = Material.mesh(s, s.radius > 0 ? Geo.sphere({ radius: s.radius, segments: [24, 16] }) : undefined);\n drawLabel3D(g3, s.label, { x: 0, y: s.radius + s.labelSize * 0.85, z: 0 }, {\n size: s.labelSize,\n color: s.labelColor,\n fontFamily: s.fontFamily,\n });\n ctx.draw(g3);\n },\n});\n\nexport type PlotPoint3d = NodeOf<typeof PlotPoint3d>;\n", "import {\n component3d,\n Graphics3D,\n lerpVector3,\n Material,\n resolveVector3,\n Types,\n type NodeOf,\n type Values,\n type Vector3,\n type Vector3Input,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Blend3D as _Blend3D,\n type Color as _Color,\n type Faces3D as _Faces3D,\n type Fill3D as _Fill3D,\n type Geometry3D as _Geometry3D,\n type Material3D as _Material3D,\n type Node3D as _Node3D,\n type Node3DProps as _Node3DProps,\n type NormalizedColor as _NormalizedColor,\n type Shading3D as _Shading3D,\n type Texture3D as _Texture3D,\n} from \"@motionscript/sdk\";\nimport { meshEntries } from \"./entries\";\nimport { aim, graphEntry, graphOf } from \"./space\";\n\nfunction point(initial: Vector3) {\n return Types.custom<Vector3Input, Vector3>(initial, { resolve: resolveVector3, lerp: lerpVector3, kind: \"vector3\" });\n}\n\nconst state = {\n ...meshEntries,\n tail: point({ x: 0, y: 0, z: 0 }),\n head: point({ x: 1, y: 1, z: 1 }),\n /** The radius of the shaft, in scene units; the tip is sized from it. */\n thickness: Types.number(0.035, { min: 0.001, step: 0.005 }),\n tip: Types.boolean(true, { animatable: false }),\n graph: graphEntry(),\n};\n\n/** An arrow between two points of a 3D graph: a vector from the origin by default. */\nexport const VectorArrow3d = component3d({\n key: \"vectorArrow3d\",\n state,\n commands: {\n /** Animate either end, or both. */\n endpointsTo: { args: [\"tail\", \"head\"] },\n },\n render: (ctx, s) => ctx.draw(drawArrow(s)),\n});\n\nexport type VectorArrow3d = NodeOf<typeof VectorArrow3d>;\n\nfunction drawArrow(s: Values<typeof state>): Graphics3D {\n const g3 = new Graphics3D();\n const space = graphOf(s);\n const { tail, head, thickness } = s;\n // Outside a graph an arrow is drawn in the scene's own units.\n const from = space ? space.offset(tail.x, tail.y, tail.z) : tail;\n const to = space ? space.offset(head.x, head.y, head.z) : head;\n const along: Vector3 = { x: to.x - from.x, y: to.y - from.y, z: to.z - from.z };\n const length = Math.hypot(along.x, along.y, along.z);\n if (!(length > 0)) return g3;\n\n const paint = Material.shorthand(s);\n const quaternion = aim(along);\n const tipLength = s.tip ? Math.min(thickness * 8, length) : 0;\n const shaft = length - tipLength;\n const at = (distance: number): Vector3 => ({\n x: from.x + (along.x * distance) / length,\n y: from.y + (along.y * distance) / length,\n z: from.z + (along.z * distance) / length,\n });\n if (shaft > 0) g3.cylinder({ ...paint, radius: thickness, height: shaft, segments: [12, 1], position: at(shaft / 2), quaternion });\n if (tipLength > 0) {\n g3.cone({ ...paint, radius: thickness * 2.8, height: tipLength, segments: [20, 1], position: at(shaft + tipLength / 2), quaternion });\n }\n return g3;\n}\n", "import {\n component2d,\n Graphics2D,\n Types,\n type Extents,\n type NodeOf,\n type Color as _Color,\n\n type NormalizedColor,\n type Stroke as _Stroke,\n\n type StrokeResolved,\n type Values,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n} from \"@motionscript/sdk\";\nimport { listed, PAINT, PAINT_COMMANDS } from \"../kit/component\";\nimport { cartesianMap, type CoordinateMap } from \"../kit/coords\";\nimport { AXIS_COLOR, drawLabels, type Label } from \"../kit/furniture\";\nimport { radians } from \"../kit/geometry\";\nimport { drawSystem, systemLayout, systemMap, systemOpenPlane, systemProvides, systemSize } from \"../kit/system\";\nimport { formatTick, ticksFor } from \"../kit/ticks\";\n\n/** How much room, in label sizes, the angles written round the outer ring take from the plane. */\nconst LABEL_ROOM = 2.2;\n\nconst state = {\n ...PAINT,\n /** The radius of the outermost ring, in graph units. */\n radius: Types.number(4, { min: 0.0001, step: 0.5 }),\n /** The spacing of the rings; zero picks a tidy one for the plane's size. */\n ringStep: Types.number(0, { min: 0 }),\n /** How many spokes divide the turn; zero draws none. */\n spokes: Types.number(12, { min: 0, max: 72, step: 1, animatable: false }),\n angleUnit: listed([\"degrees\", \"radians\"], \"degrees\", { animatable: false }),\n /** The inner rings and the spokes. */\n gridStroke: Types.stroke({ weight: 1.25, fill: \"#3b4658\", align: \"center\" }),\n /** A number at each ring, and an angle at each spoke. */\n labels: Types.boolean(true, { animatable: false }),\n labelSize: Types.number(16, { min: 1, unit: \"px\" }),\n labelColor: Types.color(AXIS_COLOR),\n fontFamily: Types.text(\"\", { animatable: false }),\n};\n\ntype PolarValues = Values<typeof state>;\n\n/** Rings and spokes about an origin: the plane a polar curve is read on. Children sit in its graph coordinates, as on axes. */\nexport const PolarPlane = component2d({\n key: \"polarPlane\",\n state,\n /** The outer ring and the two lines through the origin. */\n defaults: { stroke: { weight: 2, fill: AXIS_COLOR, align: \"center\" } },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n commands: {\n ...PAINT_COMMANDS,\n /** Animate how far out the plane reaches: a zoom about its origin. */\n rangeTo: { args: [\"radius\"] },\n },\n provide: (s) => systemProvides(s),\n measure: (_measurer, s) => systemSize(s),\n layout: (box, s, children) => systemLayout(box, s, children, polarMap),\n plane: (box, s) => systemOpenPlane(box, s, polarMap),\n render: (ctx, s) => drawSystem(ctx, s, systemMap(ctx.size, s, polarMap), (map) => polarFurniture(map, s)),\n});\n\nexport type PolarPlane = NodeOf<typeof PolarPlane>;\n\nfunction polarMap(area: Extents, s: PolarValues): CoordinateMap {\n const width = area.maxX - area.minX;\n const height = area.maxY - area.minY;\n // The outer ring fits the shorter side, less the room its angles are written in; units are square.\n const reach = Math.max(1, Math.min(width, height) / 2 - (s.labels ? s.labelSize * LABEL_ROOM : 0));\n const unit = reach / Math.max(s.radius, 1e-9);\n return cartesianMap({\n xRange: [-width / 2 / unit, width / 2 / unit],\n yRange: [-height / 2 / unit, height / 2 / unit],\n area,\n });\n}\n\nfunction polarFurniture(map: CoordinateMap, s: PolarValues): Graphics2D[] {\n const stroke = s.stroke as StrokeResolved[];\n const grid = s.gridStroke as StrokeResolved[];\n const { start, end, radius } = s;\n const centre = map.toPoint(0, 0);\n const reach = map.toPoint(radius, 0).x - centre.x;\n if (!(reach > 0)) return [];\n const at = (r: number, degrees: number) => {\n const angle = radians(degrees);\n return map.toPoint(r * Math.cos(angle), r * Math.sin(angle));\n };\n const ring = (g: Graphics2D, r: number): Graphics2D => {\n const size = (map.toPoint(r, 0).x - centre.x) * 2;\n return g.ellipse({ x: centre.x, y: centre.y, width: size, height: size, start, end });\n };\n\n const parts: Graphics2D[] = [];\n const marks = ticksFor([0, radius], s.ringStep, reach);\n const rings = marks.values.filter((r) => r > 0 && r < radius * (1 - 1e-9));\n const count = Math.round(s.spokes);\n const turns = Array.from({ length: count }, (_, i) => (360 * i) / count);\n\n if (grid.length > 0) {\n const inner = new Graphics2D();\n for (const r of rings) ring(inner, r);\n // The four along the axes are drawn with them.\n for (const degrees of turns) {\n if (degrees % 90 !== 0) inner.line({ points: [centre, at(radius, degrees)], radius: 0, start, end });\n }\n if (rings.length > 0 || turns.some((degrees) => degrees % 90 !== 0)) parts.push(inner.stroke(grid));\n }\n if (stroke.length > 0) {\n parts.push(\n ring(new Graphics2D(), radius)\n .line({ points: [at(radius, 180), at(radius, 0)], radius: 0, start, end })\n .line({ points: [at(radius, 270), at(radius, 90)], radius: 0, start, end })\n .stroke(stroke),\n );\n }\n if (!s.labels) return parts;\n\n const size = s.labelSize;\n const labels: Label[] = [];\n for (const r of [...rings, radius]) {\n const p = map.toPoint(r, 0);\n labels.push({ text: formatTick(r, marks.step), at: { x: p.x - size * 0.2, y: p.y - size * 0.95 }, align: \"right\" });\n }\n for (const degrees of turns) {\n const p = at(radius, degrees);\n const cos = Math.cos(radians(degrees));\n const sin = Math.sin(radians(degrees));\n labels.push({\n text: s.angleUnit === \"degrees\" ? `${formatTick(degrees, 1)}°` : radiansLabel(degrees),\n at: { x: p.x + cos * size * 0.6, y: p.y + sin * size * 1.05 },\n align: cos > 0.3 ? \"left\" : cos < -0.3 ? \"right\" : \"center\",\n });\n }\n parts.push(...drawLabels(labels, { fontSize: size, fontFamily: s.fontFamily, color: s.labelColor as NormalizedColor }));\n return parts;\n}\n\n/** An angle in degrees as a fraction of π: 90 is `π/2`, 240 is `4π/3`. */\nfunction radiansLabel(degrees: number): string {\n if (degrees === 0) return \"0\";\n let numerator = Math.round(degrees);\n let denominator = 180;\n for (let a = numerator, b = denominator; ; [a, b] = [b, a % b]) {\n if (b === 0) {\n numerator /= a;\n denominator /= a;\n break;\n }\n }\n const top = numerator === 1 ? \"π\" : `${numerator}π`;\n return denominator === 1 ? top : `${top}/${denominator}`;\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport type { CoordinateMap } from \"../kit/coords\";\nimport { drawField, FIELD_COMMANDS, FIELD_STATE, traceField, type FieldDrawing, type FieldValues, type FieldSampler, type FieldStroke } from \"../kit/field-mark\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { radians } from \"../kit/geometry\";\nimport { inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\n/** Past this many arrows the spacing is widened, so a field over a huge range is still a field and not a wash. */\nconst MAX_ARROWS = 2400;\n/** An arrow's head, as a share of its length and in pixels at most, and the half-angle it opens to. */\nconst HEAD_SHARE = 0.38;\nconst HEAD_MAX = 11;\nconst HEAD_ANGLE = radians(26);\n\nconst state = {\n ...FIELD_STATE,\n /** How far apart the arrows stand, in graph units. */\n spacing: Types.number(1, { min: 0.01, step: 0.1 }),\n /** How long an arrow is drawn for a vector of length one, in graph units. */\n arrowScale: Types.number(0.4, { min: 0, step: 0.05 }),\n};\n\ninterface ArrowsValues extends FieldValues {\n readonly spacing: number;\n readonly arrowScale: number;\n}\n\nconst ARROWS: FieldDrawing<ArrowsValues> = {\n own: (s) => `${s.spacing}|${s.arrowScale}`,\n strokes: (s, map, field) => arrows(s, map, field),\n};\n\nconst traceArrows = (s: ArrowsValues, read: MarkReading) => traceField(\"vectorField\", ARROWS, s, read);\n\n/** A grid of arrows showing a vector field, `(-y, x)`: each is centred on its point and as long as the field is strong there, up to the spacing. */\nexport const VectorField = traced(component2d({\n key: \"vectorField\",\n state,\n defaults: { stroke: { weight: 2.5, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\" },\n commands: FIELD_COMMANDS,\n measure: (_measurer, s) => inkSize(traceArrows(s, reading(s)).runs),\n render: (ctx, s) => drawField(ctx, s, traceArrows(s, reading(s))),\n}), (s: ArrowsValues, read: MarkReading) => traceArrows(s, read).runs);\n\nexport type VectorField = NodeOf<typeof VectorField>;\n\nfunction arrows(s: ArrowsValues, map: CoordinateMap, field: FieldSampler): FieldStroke[] {\n const [x0, x1] = map.xRange;\n const [y0, y1] = map.yRange;\n let spacing = Math.max(s.spacing, 1e-6);\n const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);\n while (count() > MAX_ARROWS) spacing *= 2;\n\n const drawn: FieldStroke[] = [];\n const v: Vector2 = { x: 0, y: 0 };\n const longest = spacing * 0.9;\n for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {\n for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {\n const gx = i * spacing;\n const gy = j * spacing;\n if (!field(gx, gy, v)) continue;\n const magnitude = Math.hypot(v.x, v.y);\n const length = Math.min(magnitude * s.arrowScale, longest);\n if (!(length > 0)) continue;\n const hx = ((v.x / magnitude) * length) / 2;\n const hy = ((v.y / magnitude) * length) / 2;\n const tail = map.toPoint(gx - hx, gy - hy);\n const head = map.toPoint(gx + hx, gy + hy);\n drawn.push({ runs: arrow(tail, head), magnitude });\n }\n }\n return drawn;\n}\n\n/** A shaft and the two barbs of its head, in pixels. */\nfunction arrow(tail: Vector2, head: Vector2): Vector2[][] {\n const dx = head.x - tail.x;\n const dy = head.y - tail.y;\n const length = Math.hypot(dx, dy);\n if (!(length > 0)) return [];\n const barb = Math.min(length * HEAD_SHARE, HEAD_MAX);\n const back = Math.atan2(dy, dx) + Math.PI;\n const at = (angle: number): Vector2 => ({ x: head.x + Math.cos(angle) * barb, y: head.y + Math.sin(angle) * barb });\n return [[tail, head], [at(back - HEAD_ANGLE), head, at(back + HEAD_ANGLE)]];\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport type { CoordinateMap } from \"../kit/coords\";\nimport { drawField, FIELD_COMMANDS, FIELD_STATE, traceField, type FieldDrawing, type FieldSampler, type FieldStroke, type FieldValues } from \"../kit/field-mark\";\nimport { PLOT_COLOR } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\n\nconst MAX_LINES = 1600;\n/** Steps a line takes across one spacing: what keeps a tight swirl round. */\nconst STEPS_PER_SPACING = 8;\nconst MAX_STEPS = 600;\n\nconst state = {\n ...FIELD_STATE,\n /** How far apart the lines start, in graph units. */\n spacing: Types.number(1, { min: 0.01, step: 0.1 }),\n /** How far each line runs from where it starts, in graph units along itself. */\n length: Types.number(3, { min: 0, step: 0.1 }),\n /** The share of each line that is shown at once; one shows all of it. */\n window: Types.number(1, { min: 0.01, max: 1, step: 0.01 }),\n /** Where along its line each shown stretch is: one turn of it runs every line from end to end. */\n phase: Types.number(0, { step: 0.01 }),\n};\n\ninterface LinesValues extends FieldValues {\n readonly spacing: number;\n readonly length: number;\n readonly window: number;\n readonly phase: number;\n}\n\nconst LINES: FieldDrawing<LinesValues> = {\n own: (s) => `${s.spacing}|${s.length}|${s.window}|${s.phase}`,\n strokes: (s, map, field) => lines(s, map, field),\n};\n\nconst traceLines = (s: LinesValues, read: MarkReading) => traceField(\"streamLines\", LINES, s, read);\n\n/**\n * The lines a vector field carries a point along, one from each point of a\n * grid: `(-y, x)` draws circles. With a `window` below one, each line shows\n * only a stretch of itself, and `flowTo` sends those stretches along.\n */\nexport const StreamLines = traced(component2d({\n key: \"streamLines\",\n state,\n defaults: { stroke: { weight: 2, fill: PLOT_COLOR, align: \"center\", cap: \"round\", join: \"round\" }, width: \"hug\", height: \"hug\" },\n commands: {\n ...FIELD_COMMANDS,\n /** Send the shown stretches along their lines: a whole number runs each line that many times over. */\n flowTo: { args: [\"phase\"] },\n },\n measure: (_measurer, s) => inkSize(traceLines(s, reading(s)).runs),\n render: (ctx, s) => drawField(ctx, s, traceLines(s, reading(s))),\n}), (s: LinesValues, read: MarkReading) => traceLines(s, read).runs);\n\nexport type StreamLines = NodeOf<typeof StreamLines>;\n\nfunction lines(s: LinesValues, map: CoordinateMap, field: FieldSampler): FieldStroke[] {\n const [x0, x1] = map.xRange;\n const [y0, y1] = map.yRange;\n let spacing = Math.max(s.spacing, 1e-6);\n const count = () => (Math.floor((x1 - x0) / spacing) + 1) * (Math.floor((y1 - y0) / spacing) + 1);\n while (count() > MAX_LINES) spacing *= 2;\n const step = spacing / STEPS_PER_SPACING;\n const steps = Math.min(MAX_STEPS, Math.round(s.length / step));\n if (steps < 1) return [];\n // A line is followed a little past what is shown, so it leaves the box rather than stopping at its edge.\n const inside = (x: number, y: number) => x >= x0 - spacing && x <= x1 + spacing && y >= y0 - spacing && y <= y1 + spacing;\n const window = clamp(s.window, 0, 1);\n\n const drawn: FieldStroke[] = [];\n let index = 0;\n for (let i = Math.ceil(x0 / spacing - 1e-9); i * spacing <= x1 + 1e-9; i++) {\n for (let j = Math.ceil(y0 / spacing - 1e-9); j * spacing <= y1 + 1e-9; j++) {\n const line = follow(field, i * spacing, j * spacing, step, steps, inside);\n index++;\n if (line.points.length < 2) continue;\n const shown = window >= 1 ? line.points : stretch(line.points, window, s.phase + stagger(index));\n if (shown.length < 2) continue;\n drawn.push({ runs: [shown.map((p) => map.toPoint(p.x, p.y))], magnitude: line.magnitude });\n }\n }\n return drawn;\n}\n\n/** The graph points a field carries a point through from `(x, y)`, at an even pace, and how strong it was on the way. */\nfunction follow(\n field: FieldSampler,\n x: number,\n y: number,\n step: number,\n steps: number,\n inside: (x: number, y: number) => boolean,\n): { points: Vector2[]; magnitude: number } {\n const points: Vector2[] = [{ x, y }];\n const v: Vector2 = { x: 0, y: 0 };\n let strength = 0;\n let read = 0;\n // The field's direction at a point, as a unit step; `false` where it has none or is at rest.\n const heading = (px: number, py: number, out: Vector2): boolean => {\n if (!field(px, py, v)) return false;\n const magnitude = Math.hypot(v.x, v.y);\n if (!(magnitude > 1e-9)) return false;\n out.x = v.x / magnitude;\n out.y = v.y / magnitude;\n strength += magnitude;\n read++;\n return true;\n };\n const a: Vector2 = { x: 0, y: 0 };\n const b: Vector2 = { x: 0, y: 0 };\n for (let i = 0; i < steps; i++) {\n // Midpoint rule: the direction half a step on is the one the whole step takes.\n if (!heading(x, y, a) || !heading(x + (a.x * step) / 2, y + (a.y * step) / 2, b)) break;\n x += b.x * step;\n y += b.y * step;\n if (!inside(x, y)) break;\n points.push({ x, y });\n }\n return { points, magnitude: read > 0 ? strength / read : 0 };\n}\n\n/** The part of `points` a window `share` long shows at `phase`: it enters at one end and leaves by the other. */\nfunction stretch(points: Vector2[], share: number, phase: number): Vector2[] {\n const turn = phase - Math.floor(phase);\n const end = turn * (1 + share);\n const from = Math.max(0, end - share);\n const to = Math.min(1, end);\n if (!(to > from)) return [];\n const last = points.length - 1;\n return points.slice(Math.floor(from * last), Math.ceil(to * last) + 1);\n}\n\n/** A share of a turn that differs from line to line and never from frame to frame, so the stretches do not march in step. */\nfunction stagger(index: number): number {\n const mixed = Math.sin(index * 12.9898) * 43758.5453;\n return mixed - Math.floor(mixed);\n}\n", "import {\n component2d,\n Types,\n type NodeOf,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n} from \"@motionscript/sdk\";\nimport { omit } from \"../kit/component\";\nimport type { Interval } from \"../kit/coords\";\nimport { drawMark, inkSize, reading, traced, type MarkReading } from \"../kit/mark\";\nimport { PLOT_COMMANDS, PLOT_STATE, PLOT_STROKE, tracePlot, type PlotValues } from \"./function-plot\";\n\nconst state = {\n // It reveals itself by its value, so it trims no outline of its own.\n ...omit(PLOT_STATE, \"start\", \"end\"),\n /** The value the trail starts at. */\n from: Types.number(0, { step: 0.1 }),\n /** The value the point is at now: where the trail ends. */\n value: Types.number(0, { step: 0.1 }),\n /** How much of the trail is kept, in the value's own units; zero keeps all of it. */\n tail: Types.number(0, { min: 0, step: 0.1 }),\n};\n\ninterface TrailValues extends PlotValues {\n readonly from: number;\n readonly value: number;\n readonly tail: number;\n}\n\n/** The trail a point leaves as a value changes: the curve of its equation from where the value began to where it is. */\nexport const TracedPath = traced(component2d({\n key: \"tracedPath\",\n state,\n defaults: { stroke: PLOT_STROKE, width: \"hug\", height: \"hug\" },\n commands: {\n ...omit(PLOT_COMMANDS, \"progressTo\", \"flash\"),\n /** Carry the point on to another value, the trail following it. */\n traceTo: { args: [\"value\"] },\n },\n measure: (_measurer, s) => inkSize(traceTrail(s, reading(s))),\n render: (ctx, s) => drawMark(ctx, s, traceTrail(s, reading(s))),\n}), traceTrail);\n\nexport type TracedPath = NodeOf<typeof TracedPath>;\n\nfunction traceTrail(s: TrailValues, read: MarkReading) {\n return tracePlot(s, read, span(s));\n}\n\n/** The span of the free variable the trail covers: from where the value began, or its tail, to where it is. */\nfunction span({ from, value, tail }: TrailValues): Interval {\n const kept = tail > 0 ? Math.min(Math.abs(value - from), tail) : Math.abs(value - from);\n return value >= from ? [value - kept, value] : [value, value + kept];\n}\n", "import {\n component2d,\n Graphics2D,\n Types,\n type Fill,\n type FillResolved,\n type NodeOf,\n type Color as _Color,\n\n type NormalizedColor,\n type RenderContext,\n type ShadowResolved,\n type Size2D,\n type Stroke as _Stroke,\n\n type StrokeResolved,\n type Values,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n} from \"@motionscript/sdk\";\nimport { createBoundedCache } from \"../kit/cache\";\nimport { listed, PAINT, PAINT_COMMANDS, painted } from \"../kit/component\";\nimport { drawLabels, loadFormulas, type Label } from \"../kit/furniture\";\nimport { lerpPartFills, partPaint, readPartFills, withPartFill, type PartFill, type PartFillResolved } from \"../kit/part-fills\";\nimport { GRAPH_LAYOUTS, layOut, type GraphEdge, type GraphLayout } from \"./graph-layout\";\n\n/** A vertex placed by hand, in the graph's box from -1 to 1 each way, y up. */\nexport interface GraphPosition {\n vertex: string;\n x: number;\n y: number;\n}\n\n// Every list keeps each entry as it was written, a blank or a repeat included, so\n// an editor showing the list shows the row it just added. What is drawn skips\n// what is not complete yet (`names`, `links`).\n\nfunction readVertices(value: readonly unknown[] | undefined): string[] {\n return (Array.isArray(value) ? value : []).map((name) => String(name ?? \"\"));\n}\n\n// An edge reads from `{ from, to }` or a pair, so a list written by hand is as good as one from a table.\nfunction readEdges(value: readonly unknown[] | undefined): GraphEdge[] {\n return (Array.isArray(value) ? value : []).map((edge) => {\n const [from, to] = Array.isArray(edge) ? edge : [(edge as GraphEdge)?.from, (edge as GraphEdge)?.to];\n return { from: String(from ?? \"\"), to: String(to ?? \"\") };\n });\n}\n\nfunction readPositions(value: readonly GraphPosition[] | undefined): GraphPosition[] {\n const at = (n: unknown) => (typeof n === \"number\" && Number.isFinite(n) ? n : 0);\n return (Array.isArray(value) ? value : []).map((entry) => ({ vertex: String(entry?.vertex ?? \"\"), x: at(entry?.x), y: at(entry?.y) }));\n}\n\n/** How far a directed edge and the one back between the same two vertices bow apart, as a share of their length. */\nconst BOW = 0.12;\n\nconst NUL = String.fromCharCode(0);\n\nconst state = {\n ...PAINT,\n vertices: Types.custom<string[]>([], { resolve: readVertices, animatable: false, kind: \"vector\" }),\n edges: Types.custom<GraphEdge[]>([], { resolve: readEdges, animatable: false, kind: \"vector\" }),\n /** Draw each edge as an arrow from its `from` to its `to`. */\n directed: Types.boolean(false, { animatable: false }),\n arrangement: listed(GRAPH_LAYOUTS, \"circular\", { animatable: false }),\n /** The vertex a tree hangs from; left empty, the first. */\n root: Types.text(\"\", { animatable: false }),\n /** Vertices placed by hand, whatever the layout says, in the box from -1 to 1 each way. */\n positions: Types.custom<GraphPosition[]>([], { resolve: readPositions, animatable: false, kind: \"vector\" }),\n vertexRadius: Types.number(18, { min: 0, unit: \"px\" }),\n vertexStroke: Types.stroke([]),\n labels: Types.boolean(true, { animatable: false }),\n labelSize: Types.number(18, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#111827\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** Paints for a vertex by its name, or an edge written `a-b`, over the graph's own. */\n partFills: Types.custom<PartFill[], PartFillResolved[]>([], { resolve: readPartFills, lerp: lerpPartFills, kind: \"vector\" }),\n /** The arrangement an `arrangeTo` is leaving, and how far it is towards the new one. */\n layoutFrom: Types.text(\"\", { private: true }),\n layoutMix: Types.number(1, { private: true }),\n};\n\nexport type GraphValues = Values<typeof state>;\n\n/**\n * Vertices and the edges between them, arranged by a rule (circle, springs, tree,\n * grid). Its `fill` is the vertices and its `stroke` the edges. (`layout` is every node's own box.)\n */\nexport const NetworkGraph = component2d({\n key: \"networkGraph\",\n state,\n defaults: {\n fill: \"#e5e7eb\",\n stroke: { weight: 3, fill: \"#9ca3af\", align: \"center\", cap: \"round\" },\n },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n if (s.labels) loadFormulas(loader, names(s));\n },\n commands: {\n ...PAINT_COMMANDS,\n /** Move every vertex to where another arrangement places it. */\n arrangeTo: {\n // No default: one left out keeps the arrangement the graph has.\n args: { arrangement: listed(GRAPH_LAYOUTS, undefined) },\n run: (timeline, s) => {\n const from = s.arrangement;\n const to = timeline.args.arrangement ?? from;\n return timeline.animate((t) => ({ arrangement: to, layoutFrom: from, layoutMix: t }));\n },\n },\n /** Paint one part of the graph: a vertex by its name, or an edge written `a-b`. */\n partFillTo: {\n args: { part: Types.text(\"\"), fill: Types.custom<Fill>(\"#facc15\", { kind: \"fills\" }) },\n run: (timeline, s) => {\n const { part, fill } = timeline.args;\n if (!part || fill == null) return timeline.tween({});\n return timeline.tween({ partFills: withPartFill(s.partFills, { part, fill }) });\n },\n },\n },\n render: (ctx, s) => painted(ctx, () => drawGraph(ctx, s)),\n});\n\nexport type NetworkGraph = NodeOf<typeof NetworkGraph>;\n\n/** Where each vertex is drawn in a graph of `size`, in pixels from its centre, y up. */\nexport function vertexPoints(graph: GraphValues, size: Size2D): Map<string, Vector2> {\n const room = graph.vertexRadius + Math.max(2, graph.labelSize * 0.2);\n const halfX = Math.max(0, size.width / 2 - room);\n const halfY = Math.max(0, size.height / 2 - room);\n const to = placed(graph, graph.arrangement);\n const from = graph.layoutMix < 1 && graph.layoutFrom !== \"\" ? placed(graph, graph.layoutFrom as GraphLayout) : null;\n const t = graph.layoutMix;\n const out = new Map<string, Vector2>();\n for (const [name, p] of to) {\n const q = from?.get(name) ?? p;\n out.set(name, { x: (q.x + (p.x - q.x) * t) * halfX, y: (q.y + (p.y - q.y) * t) * halfY });\n }\n return out;\n}\n\nfunction drawGraph(ctx: RenderContext, graph: GraphValues): void {\n const points = vertexPoints(graph, ctx.size);\n if (points.size === 0) return;\n const parts = new Map((graph.partFills as PartFillResolved[]).map((entry) => [entry.part, entry]));\n drawEdges(ctx, graph, points, parts);\n drawVertices(ctx, graph, points, parts);\n}\n\n// Two layouts are held at once while one becomes the other, and a scene may hold several graphs.\nconst layouts = createBoundedCache<Map<string, Vector2>>(32);\n\n/** Each vertex's place under `layout`, from -1 to 1, a hand-placed one where it is. */\nfunction placed(graph: GraphValues, layout: GraphLayout): Map<string, Vector2> {\n const vertices = names(graph);\n const edges = links(graph);\n const key = [layout, graph.root, vertices.join(NUL), JSON.stringify(edges), JSON.stringify(graph.positions)].join(\"|\");\n let at = layouts.get(key);\n if (!at) {\n at = layOut(layout, vertices, edges, graph.root.trim());\n for (const { vertex, x, y } of graph.positions) {\n const name = vertex.trim();\n if (at.has(name)) at.set(name, { x, y });\n }\n layouts.set(key, at);\n }\n return at;\n}\n\nfunction drawEdges(ctx: RenderContext, graph: GraphValues, points: Map<string, Vector2>, parts: Map<string, PartFillResolved>): void {\n const stroke = graph.stroke as StrokeResolved[];\n if (stroke.length === 0) return;\n const r = graph.vertexRadius;\n const all = links(graph);\n const pairs = new Set(all.map(({ from, to }) => `${from}${NUL}${to}`));\n const plain = new Graphics2D();\n let drawnPlain = false;\n for (const { from, to } of all) {\n const a = points.get(from);\n const b = points.get(to);\n if (!a || !b) continue;\n const run = from === to ? loop(a, r) : edge(a, b, r, graph.directed && pairs.has(`${to}${NUL}${from}`) ? BOW : 0);\n if (run.length < 2) continue;\n const paint = parts.get(`${from}-${to}`) ?? (graph.directed ? undefined : parts.get(`${to}-${from}`));\n const own = graph.directed || paint !== undefined;\n const g = own ? new Graphics2D() : plain;\n g.line({ points: run, radius: 0, start: graph.start, end: graph.end });\n if (!own) {\n drawnPlain = true;\n continue;\n }\n let layers = stroke;\n if (paint) layers = layers.map((layer) => ({ ...layer, fill: partPaint(layer.fill, paint) }));\n if (graph.directed && from !== to) layers = layers.map((layer) => ({ ...layer, endCap: layer.endCap ?? \"triangle\" }));\n ctx.draw(g.stroke(layers));\n }\n if (drawnPlain) ctx.draw(plain.stroke(stroke));\n}\n\nfunction drawVertices(ctx: RenderContext, graph: GraphValues, points: Map<string, Vector2>, parts: Map<string, PartFillResolved>): void {\n const r = graph.vertexRadius;\n const fill = graph.fill as FillResolved[];\n const outline = graph.vertexStroke as StrokeResolved[];\n const labels: Label[] = [];\n for (const [name, p] of points) {\n if (r > 0) {\n const paint = partPaint(fill, parts.get(name));\n const disc = new Graphics2D().ellipse({ x: p.x, y: p.y, width: r * 2, height: r * 2 });\n ctx.draw(disc.shadow(graph.shadow as ShadowResolved[]).fill(paint));\n if (outline.length > 0) ctx.draw(new Graphics2D().ellipse({ x: p.x, y: p.y, width: r * 2, height: r * 2 }).stroke(outline));\n }\n if (graph.labels) labels.push({ text: name, at: { x: p.x, y: p.y }, align: \"center\" });\n }\n for (const part of drawLabels(labels, { fontSize: graph.labelSize, fontFamily: graph.fontFamily, color: graph.labelColor as NormalizedColor })) {\n ctx.draw(part);\n }\n}\n\n/** The vertices drawn: each name once, trimmed, the blank ones left out. */\nfunction names(graph: Pick<GraphValues, \"vertices\">): string[] {\n return [...new Set(graph.vertices.map((name) => name.trim()).filter((name) => name !== \"\"))];\n}\n\n/** The edges drawn: both ends named. */\nfunction links(graph: Pick<GraphValues, \"edges\">): GraphEdge[] {\n return graph.edges.flatMap(({ from, to }) => {\n const a = from.trim();\n const b = to.trim();\n return a === \"\" || b === \"\" ? [] : [{ from: a, to: b }];\n });\n}\n\n/** An edge from one vertex's rim to the other's, straight or bowed to its left. */\nfunction edge(a: Vector2, b: Vector2, r: number, bow: number): Vector2[] {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const length = Math.hypot(dx, dy);\n if (!(length > 2 * r)) return [];\n if (bow === 0) {\n const ux = dx / length;\n const uy = dy / length;\n return [{ x: a.x + ux * r, y: a.y + uy * r }, { x: b.x - ux * r, y: b.y - uy * r }];\n }\n const mid = { x: (a.x + b.x) / 2 - (dy / length) * bow * length, y: (a.y + b.y) / 2 + (dx / length) * bow * length };\n const run: Vector2[] = [];\n for (let i = 0; i <= 16; i++) {\n const t = i / 16;\n const u = 1 - t;\n run.push({ x: u * u * a.x + 2 * u * t * mid.x + t * t * b.x, y: u * u * a.y + 2 * u * t * mid.y + t * t * b.y });\n }\n // Trimmed back to the rims along the curve.\n const outside = (p: Vector2, c: Vector2) => Math.hypot(p.x - c.x, p.y - c.y) >= r;\n return run.filter((p) => outside(p, a) && outside(p, b));\n}\n\n/** An edge from a vertex to itself: a small loop above it. */\nfunction loop(c: Vector2, r: number): Vector2[] {\n const run: Vector2[] = [];\n const radius = Math.max(r * 0.8, 6);\n const cy = c.y + r + radius * 0.6;\n for (let i = 0; i <= 24; i++) {\n const angle = -Math.PI / 2 + (2 * Math.PI * i) / 24;\n const p = { x: c.x + Math.cos(angle) * radius, y: cy + Math.sin(angle) * radius };\n if (Math.hypot(p.x - c.x, p.y - c.y) >= r) run.push(p);\n }\n return run;\n}\n", "import {\n component2d,\n fillOps,\n Graphics2D,\n Types,\n type Fill,\n type FillResolved,\n type NodeOf,\n type Color as _Color,\n\n type NormalizedColor,\n type RenderContext,\n type ShadowResolved,\n type Size2D,\n type StrokeResolved,\n type Values,\n type Vector2,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type Shadow as _Shadow,\n type Stroke as _Stroke,\n} from \"@motionscript/sdk\";\nimport { braceOutline } from \"../kit/brace\";\nimport { omit, PAINT, PAINT_COMMANDS, painted } from \"../kit/component\";\nimport { drawLabels, loadFormulas, type Label } from \"../kit/furniture\";\nimport { lerpFillScale, readFillScale } from \"../kit/scale\";\nimport { formatTick } from \"../kit/ticks\";\n\n/** The parts' paints until told otherwise, a column each, round again past the last. */\nconst PALETTE = [\"#58a6ff\", \"#f59e0b\", \"#4ade80\", \"#f472b6\", \"#a78bfa\", \"#2dd4bf\"];\n\n/** How strongly the lower part of a split column shows its paint. */\nconst LOWER = 0.45;\n\nfunction readShares(value: readonly number[] | undefined): number[] {\n return (Array.isArray(value) ? value : []).map((share) => (Number.isFinite(share) && share > 0 ? share : 0));\n}\n\n// Shares tween one by one; a different count has nothing to pair with, and changes at the end.\nfunction lerpShares(from: number[], to: number[], t: number): number[] {\n if (from.length !== to.length) return t < 1 ? from : to;\n return to.map((share, i) => from[i] + (share - from[i]) * t);\n}\n\nconst state = {\n // Its parts are painted from `columnFills`, and it trims no outline of its own.\n ...omit(PAINT, \"fill\", \"start\", \"end\"),\n /** How the whole is shared across, left to right; any numbers, read as shares of their sum. */\n columnShares: Types.custom<number[]>([1], { resolve: readShares, lerp: lerpShares, kind: \"vector\" }),\n /** Each column's upper share, 0 to 1; a column without one is not cut across. */\n rowShares: Types.custom<number[]>([], { resolve: readShares, lerp: lerpShares, kind: \"vector\" }),\n /** Each column's paint, left to right, round again past the last; its lower part shows it fainter. */\n columnFills: Types.custom<Fill[], FillResolved[][]>([], { resolve: readFillScale, lerp: lerpFillScale, kind: \"vector\" }),\n columnLabels: Types.custom<string[]>([], { animatable: false, kind: \"vector\" }),\n /** The upper part's name and the lower's, written on the left. */\n rowLabels: Types.custom<string[]>([], { animatable: false, kind: \"vector\" }),\n /** Write each part's probability in it. */\n values: Types.boolean(false, { animatable: false }),\n labelSize: Types.number(20, { min: 1, unit: \"px\" }),\n labelColor: Types.color(\"#e5e7eb\"),\n fontFamily: Types.text(\"\", { animatable: false }),\n};\n\nexport type SampleSpaceValues = Values<typeof state>;\n\n/** One part of a sample space: its box in pixels from the node's centre, y up, and its probability. */\nexport interface SamplePart {\n x: number;\n y: number;\n width: number;\n height: number;\n probability: number;\n column: number;\n upper: boolean;\n}\n\n/**\n * A probability's whole as a box cut into columns by `columnShares`, each cut\n * again by its `rowShares` entry (P(B | A) above, the rest below): each part's\n * area is its probability.\n */\nexport const SampleSpace = component2d({\n key: \"sampleSpace\",\n state,\n defaults: { stroke: { weight: 2, fill: \"#0b0d12\", align: \"center\" } },\n load: (loader, s) => {\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n loadFormulas(loader, [...s.columnLabels, ...s.rowLabels]);\n },\n commands: {\n ...omit(PAINT_COMMANDS, \"fillTo\", \"progressTo\", \"flash\"),\n /** Move the cuts: the columns' shares, each column's upper share, or both. */\n divideTo: { args: [\"columnShares\", \"rowShares\"] },\n },\n render: (ctx, s) => painted(ctx, () => drawSpace(ctx, s)),\n});\n\nexport type SampleSpace = NodeOf<typeof SampleSpace>;\n\n/** Each part of a sample space of `size`: columns left to right, upper part first. */\nexport function sampleParts(space: SampleSpaceValues, size: Size2D): SamplePart[] {\n const box = boxOf(space, size);\n const shares = space.columnShares;\n const total = shares.reduce((sum, share) => sum + share, 0);\n if (!(total > 0) || box.width <= 0 || box.height <= 0) return [];\n const out: SamplePart[] = [];\n let left = box.x - box.width / 2;\n shares.forEach((share, column) => {\n const width = (box.width * share) / total;\n const p = share / total;\n const cut = space.rowShares[column];\n const top = box.y + box.height / 2;\n if (cut === undefined) {\n out.push({ x: left + width / 2, y: box.y, width, height: box.height, probability: p, column, upper: true });\n } else {\n const upper = Math.min(1, Math.max(0, cut));\n const h = box.height * upper;\n out.push({ x: left + width / 2, y: top - h / 2, width, height: h, probability: p * upper, column, upper: true });\n out.push({ x: left + width / 2, y: top - h - (box.height - h) / 2, width, height: box.height - h, probability: p * (1 - upper), column, upper: false });\n }\n left += width;\n });\n return out;\n}\n\nfunction drawSpace(ctx: RenderContext, space: SampleSpaceValues): void {\n const parts = sampleParts(space, ctx.size);\n if (parts.length === 0) return;\n const fills = space.columnFills;\n const stroke = space.stroke as StrokeResolved[];\n const labels: Label[] = [];\n for (const part of parts) {\n if (!(part.width > 0) || !(part.height > 0)) continue;\n const base = fills.length > 0 ? fills[part.column % fills.length] : fillOps.resolve(PALETTE[part.column % PALETTE.length]);\n const paint = part.upper ? base : base.map((layer) => ({ ...layer, opacity: (layer.opacity ?? 1) * LOWER }));\n const g = new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height });\n ctx.draw(g.shadow(space.shadow as ShadowResolved[]).fill(paint));\n if (stroke.length > 0) ctx.draw(new Graphics2D().rect({ x: part.x, y: part.y, width: part.width, height: part.height }).stroke(stroke));\n if (space.values && part.height > space.labelSize && part.width > space.labelSize) {\n labels.push({ text: formatTick(Math.round(part.probability * 1000) / 1000, 0.001), at: { x: part.x, y: part.y }, align: \"center\" });\n }\n }\n labels.push(...braces(ctx, space, parts));\n const style = { fontSize: space.labelSize, fontFamily: space.fontFamily, color: space.labelColor as NormalizedColor };\n for (const part of drawLabels(labels, style)) ctx.draw(part);\n}\n\n/** Room for the braces and their names, below and on the left, taken from the box. */\nfunction boxOf(space: SampleSpaceValues, size: Size2D): { x: number; y: number; width: number; height: number } {\n const { width, height } = size;\n const room = space.labelSize * 2.6;\n const below = space.columnLabels.some((label) => label !== \"\") ? room : 0;\n const left = space.rowLabels.some((label) => label !== \"\") ? room * 1.6 : 0;\n return { x: left / 2, y: below / 2, width: Math.max(0, width - left), height: Math.max(0, height - below) };\n}\n\n/** Braces under each column and beside the first column's parts, and the labels that name them. */\nfunction braces(ctx: RenderContext, space: SampleSpaceValues, parts: readonly SamplePart[]): Label[] {\n const box = boxOf(space, ctx.size);\n const reach = space.labelSize * 0.8;\n const gap = 6;\n const runs = new Graphics2D();\n const labels: Label[] = [];\n let drawn = false;\n const brace = (from: Vector2, to: Vector2, out: Vector2, text: string, align: Label[\"align\"]) => {\n if (text === \"\") return;\n // A frame centred on the node's own centre, so the path is drawn where it is and not moved onto it.\n runs.path({ data: braceOutline(from, to, out, reach), centerBounds: [-1, -1, 1, 1] });\n drawn = true;\n const mid = { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2 };\n const far = reach + space.labelSize * 0.75;\n labels.push({ text, at: { x: mid.x + out.x * far, y: mid.y + out.y * far }, align });\n };\n const bottom = box.y - box.height / 2 - gap;\n for (const part of parts) {\n if (!part.upper && space.rowShares[part.column] !== undefined) continue;\n const text = space.columnLabels[part.column] ?? \"\";\n // Left to right along the bottom, so the bulge, to the edge's right, points down.\n brace({ x: part.x + part.width / 2, y: bottom }, { x: part.x - part.width / 2, y: bottom }, { x: 0, y: -1 }, text, \"center\");\n }\n const first = parts.filter((part) => part.column === 0);\n const left = box.x - box.width / 2 - gap;\n if (space.rowShares[0] !== undefined) {\n first.forEach((part) => {\n const text = space.rowLabels[part.upper ? 0 : 1] ?? \"\";\n brace({ x: left, y: part.y - part.height / 2 }, { x: left, y: part.y + part.height / 2 }, { x: -1, y: 0 }, text, \"right\");\n });\n }\n if (drawn) {\n const fill = fillOps.resolve({ type: \"solid\", color: space.labelColor as NormalizedColor });\n ctx.draw(runs.stroke({ weight: 2, fill, align: \"center\", cap: \"round\", join: \"round\" }));\n }\n return labels;\n}\n", "import { AngleMark } from \"./annotate/angle-mark\";\nimport { CurlyBrace } from \"./annotate/curly-brace\";\nimport { EmphasisMark } from \"./annotate/emphasis-mark\";\nimport { CurveArea } from \"./marks/curve-area\";\nimport { DropLines } from \"./marks/drop-lines\";\nimport { PlotPoint } from \"./marks/plot-point\";\nimport { RiemannSum } from \"./marks/riemann-sum\";\nimport { TangentLine } from \"./marks/tangent-line\";\nimport { VectorArrow } from \"./marks/vector-arrow\";\nimport { FunctionPlot } from \"./plots/function-plot\";\nimport { PointsPlot } from \"./plots/points-plot\";\nimport { StreamLines } from \"./plots/stream-lines\";\nimport { TracedPath } from \"./plots/traced-path\";\nimport { VectorField } from \"./plots/vector-field\";\nimport { Axes2d } from \"./systems/axes2d\";\nimport { NumberLine } from \"./systems/number-line\";\nimport { NumberPlane } from \"./systems/number-plane\";\nimport { PolarPlane } from \"./systems/polar-plane\";\nimport { NetworkGraph } from \"./structures/network-graph\";\nimport { SampleSpace } from \"./structures/sample-space\";\nimport { LatexMatrix } from \"./tex/matrix\";\nimport { Latex } from \"./tex/node\";\nimport { Axes3d } from \"./three/axes3d\";\nimport { CurvePlot3d } from \"./three/curve-plot3d\";\nimport { PlotPoint3d } from \"./three/plot-point3d\";\nimport { SurfacePlot3d } from \"./three/surface-plot3d\";\nimport { VectorArrow3d } from \"./three/vector-arrow3d\";\n\n/** Every node type this package publishes, for `new Engine(platform, { nodes: NODES })`. Listing the values survives `sideEffects: false` bundling. */\n// Typed by name, so the declaration names each component rather than spelling out its type through core.\ntype KitNode =\n | typeof Latex\n | typeof LatexMatrix\n | typeof NumberLine\n | typeof Axes2d\n | typeof NumberPlane\n | typeof FunctionPlot\n | typeof PointsPlot\n | typeof PlotPoint\n | typeof VectorArrow\n | typeof CurveArea\n | typeof RiemannSum\n | typeof TangentLine\n | typeof DropLines\n | typeof CurlyBrace\n | typeof AngleMark\n | typeof EmphasisMark\n | typeof Axes3d\n | typeof SurfacePlot3d\n | typeof CurvePlot3d\n | typeof PlotPoint3d\n | typeof VectorArrow3d\n | typeof PolarPlane\n | typeof VectorField\n | typeof StreamLines\n | typeof TracedPath\n | typeof NetworkGraph\n | typeof SampleSpace;\n\nexport const NODES: KitNode[] = [\n Latex,\n LatexMatrix,\n NumberLine,\n Axes2d,\n NumberPlane,\n FunctionPlot,\n PointsPlot,\n PlotPoint,\n VectorArrow,\n CurveArea,\n RiemannSum,\n TangentLine,\n DropLines,\n CurlyBrace,\n AngleMark,\n EmphasisMark,\n Axes3d,\n SurfacePlot3d,\n CurvePlot3d,\n PlotPoint3d,\n VectorArrow3d,\n PolarPlane,\n VectorField,\n StreamLines,\n TracedPath,\n NetworkGraph,\n SampleSpace,\n];\n"],
5
- "mappings": "2gDAAA,OACI,eAAAA,GACA,cAAAC,GACA,SAAAC,MAgBG,oBAOP,IAAMC,GAAQ,CACV,GAAGC,EACH,MAAOC,EAAc,CAAC,GAAI,CAAC,CAAC,EAE5B,KAAMC,EAAM,OAAO,EAAG,CAAE,IAAK,CAAC,CAAE,EAChC,QAASC,EAAO,CAAC,SAAU,KAAK,EAAG,SAAU,CAAE,WAAY,EAAK,CAAE,EAClE,MAAOD,EAAM,QAAQ,GAAM,CAAE,WAAY,EAAK,CAAE,EAChD,SAAUA,EAAM,OAAO,GAAI,CAAE,IAAK,EAAG,KAAM,IAAI,CAAE,EAEjD,UAAWA,EAAM,OAAiB,CAAA,EAAI,CAAE,WAAY,EAAK,CAAE,EAC3D,OAAQA,EAAM,QAAQ,GAAM,CAAE,WAAY,EAAK,CAAE,EACjD,aAAcA,EAAM,OAAiB,CAAA,EAAI,CAAE,WAAY,EAAK,CAAE,EAC9D,UAAWC,EAAO,CAAC,QAAS,OAAO,EAAG,QAAS,CAAE,WAAY,EAAK,CAAE,EACpE,UAAWD,EAAM,OAAO,GAAI,CAAE,IAAK,EAAG,KAAM,IAAI,CAAE,EAClD,WAAYA,EAAM,MAAME,CAAU,EAClC,WAAYF,EAAM,KAAK,GAAI,CAAE,WAAY,EAAK,CAAE,GASvCG,GAAaC,GAAY,CAClC,IAAK,aACL,MAAAP,GACA,SAAU,CAAE,OAAQ,CAAE,OAAQ,EAAG,KAAM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AK,MAAQ,EAAG,EAAGyB,CAAM,EAAI,CAAE,EAAG,EAAG,EAAG,EAAE,EAAIL,EAAM,QAAQ,CAC/H,CACA,IAAMM,EAAQ9B,EAAM,OAAQI,GAASA,EAAK,SAAW,CAAC,EAChDZ,EAAON,EAAI,EAAIA,EAAI,MAAQ,EAAIkC,EAOrC,GANIpC,EAAM,UAAU,CAAC,IAAM,QACvB8C,EAAM,QAAS1B,GAAQ,CACnB,IAAMoB,EAAOxC,EAAM,UAAUoB,EAAK,MAAQ,EAAI,CAAC,GAAK,GACpDmB,EAAM,CAAE,EAAG/B,EAAM,EAAGY,EAAK,EAAIA,EAAK,OAAS,CAAC,EAAI,CAAE,EAAGZ,EAAM,EAAGY,EAAK,EAAIA,EAAK,OAAS,CAAC,EAAI,CAAE,EAAG,GAAI,EAAG,CAAC,EAAIoB,EAAM,OAAO,CAC5H,CAAC,EAEDF,EAAO,CACP,IAAMS,EAAOzB,GAAQ,QAAQ,CAAE,KAAM,QAAS,MAAOtB,EAAM,UAA6B,CAAE,EAC1FJ,EAAI,KAAKyC,EAAK,OAAO,CAAE,OAAQ,EAAG,KAAAU,EAAM,MAAO,SAAU,IAAK,QAAS,KAAM,OAAO,CAAE,CAAC,CAC3F,CACA,OAAO5B,CACX,CCvIO,IAAM6B,GAAmB,CAC5BC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC",
6
- "names": ["component2d", "Graphics2D", "Types", "state", "PAINT", "intervalEntry", "Types", "listed", "AXIS_COLOR", "NumberLine", "component2d", "loader", "s", "PAINT_COMMANDS", "systemProvides", "_measurer", "systemSize", "box", "children", "systemLayout", "lineMap", "systemOpenPlane", "ctx", "drawSystem", "systemMap", "map", "lineFurniture", "area", "cartesianMap", "resolveInterval", "stroke", "start", "end", "min", "max", "from", "to", "parts", "Graphics2D", "marks", "ticksFor", "sign", "tickMarks", "labels", "ticked", "value", "at", "drawn", "along", "half", "formatTick", "withoutTips", "drawLabels", "component2d", "Graphics2D", "Types", "state", "AXES", "Types", "readMatrix", "lerpMatrix", "readSource", "lerpSource", "NumberPlane", "component2d", "AXIS_COLOR", "s", "spills", "loader", "loadAxes", "AXES_COMMANDS", "systemProvides", "_measurer", "systemSize", "box", "children", "systemLayout", "planeMap", "systemOpenPlane", "ctx", "flat", "map", "planeMaps", "plotArea", "drawSystem", "on", "axesFurniture", "x", "y", "grid", "area", "axesMap", "isIdentityMatrix", "transformedMap", "source", "blend", "to", "warpOf", "warpedMap", "from", "start", "out", "STAY", "parts", "gx", "gy", "axesOf", "ruled", "ghost", "end", "xMin", "xMax", "yMin", "yMax", "lines", "values", "vertical", "Graphics2D", "value", "lineThrough", "minor", "divisions", "between", "axis", "min", "max", "step", "base", "i", "xs", "ys", "major", "field", "parseField", "fieldParams", "wx", "wy", "component2d", "Types", "lerpPoints", "from", "to", "t", "count", "out", "i", "a", "b", "SMOOTH_STEPS", "state", "PAINT", "Types", "PLANE_ENTRY", "PointsPlot", "traced", "component2d", "PLOT_COLOR", "PAINT_COMMANDS", "_measurer", "s", "inkSize", "tracePoints", "reading", "ctx", "drawMark", "map", "shift", "pixels", "p", "spline", "points", "closed", "n", "at", "spans", "p0", "p1", "p2", "p3", "t2", "t3", "component2d", "Graphics2D", "Types", "state", "omit", "PAINT", "PLOT_REF", "Types", "listed", "PLANE_ENTRY", "PlotPoint", "anchored", "component2d", "s", "heightOf", "loader", "loadFormulas", "PAINT_COMMANDS", "_measurer", "ctx", "size", "shape", "Graphics2D", "painted", "gap", "side", "horizontal", "label", "drawLabels", "strokeShape", "plane", "x", "y", "on", "curve", "curveFor", "height", "curveValue", "component2d", "Types", "BEND_STEP", "state", "omit", "PAINT", "Types", "PLANE_ENTRY", "end", "which", "s", "read", "reading", "ownPoint", "traceArrow", "at", "graphPoint", "VectorArrow", "traced", "component2d", "PAINT_COMMANDS", "_measurer", "inkSize", "ctx", "drawMark", "map", "shift", "a", "b", "sweep", "radians", "chord", "radius", "side", "reach", "cx", "cy", "from", "steps", "run", "i", "angle", "component2d", "state", "omit", "PAINT", "PLOT_REF", "intervalEntry", "PLANE_ENTRY", "CurveArea", "traced", "component2d", "PLOT_COLOR", "PAINT_COMMANDS", "_measurer", "s", "inkSize", "traceArea", "reading", "ctx", "drawMark", "map", "plane", "top", "curveFor", "floor", "yMin", "yMax", "a", "b", "width", "steps", "height", "value", "clamp", "upper", "lower", "i", "x", "curveValue", "component2d", "Types", "MAX_RECTANGLES", "state", "omit", "PAINT", "PLOT_REF", "intervalEntry", "Types", "listed", "PLANE_ENTRY", "RiemannSum", "traced", "component2d", "PLOT_COLOR", "PAINT_COMMANDS", "_measurer", "s", "inkSize", "traceSum", "reading", "ctx", "drawMark", "map", "plane", "plot", "curveFor", "a", "b", "dx", "yMin", "yMax", "base", "clamp", "at", "count", "runs", "i", "left", "right", "value", "curveValue", "height", "component2d", "Types", "SLOPE_STEP", "state", "omit", "PAINT", "PLOT_REF", "Types", "PLANE_ENTRY", "TangentLine", "traced", "component2d", "s", "plot", "curveFor", "tangentSlope", "PAINT_COMMANDS", "_measurer", "inkSize", "traceTangent", "reading", "ctx", "drawMark", "curve", "x", "dx", "curveValue", "h", "map", "plane", "y", "half", "y2", "a", "b", "span", "reach", "ux", "uy", "mx", "my", "secant", "xMin", "xMax", "before", "after", "component2d", "state", "omit", "PAINT", "PLOT_REF", "listed", "PLANE_ENTRY", "DropLines", "traced", "component2d", "AXIS_COLOR", "PAINT_COMMANDS", "_measurer", "s", "inkSize", "traceDrops", "reading", "ctx", "drawMark", "map", "plane", "x", "plot", "curveFor", "y", "curveValue", "at", "runs", "clamp", "component2d", "Graphics2D", "Types", "EDGE", "state", "FOLLOW_STATE", "listed", "Types", "spans", "s", "parted", "resting", "quadOf", "followedQuad", "edgeOf", "quad", "i", "j", "unit", "heading", "out", "add", "outline", "from", "to", "braceOutline", "end", "which", "container", "at", "CurlyBrace", "component2d", "loader", "loadFormulas", "FOLLOW_COMMANDS", "_size", "outlineBounds", "ctx", "data", "shape", "Graphics2D", "OWN_FRAME", "painted", "reach", "between", "align", "style", "drawLabels", "strokeShape", "component2d", "Graphics2D", "Types", "ARC_STEP", "RIGHT_SLOP", "point", "radius", "degrees", "turn", "radians", "state", "omit", "PAINT", "Types", "listed", "AngleMark", "component2d", "s", "angleOf", "loader", "loadFormulas", "PAINT_COMMANDS", "_size", "outlineBounds", "outline", "ctx", "data", "shape", "Graphics2D", "OWN_FRAME", "painted", "text", "at", "style", "drawLabels", "strokeShape", "fromAngle", "toAngle", "corner", "sweep", "side", "a", "b", "steps", "out", "i", "p", "component2d", "Graphics2D", "Types", "QUARTER", "line", "a", "b", "SHAPES", "quad", "gap", "tl", "tr", "br", "bl", "grown", "p", "centre", "between", "across", "up", "at", "u", "add", "arc", "c1", "c2", "end", "k", "start", "down", "heading", "state", "FOLLOW_STATE", "listed", "Types", "outline", "s", "parted", "followedQuad", "EmphasisMark", "component2d", "FOLLOW_COMMANDS", "_size", "outlineBounds", "container", "ctx", "data", "shape", "Graphics2D", "OWN_FRAME", "painted", "strokeShape", "component2d", "Flow", "Geo", "Graphics3D", "Mat", "Paint", "provides", "Shapes", "Types", "View3D", "UNIT_AS_PIXELS", "ALONG", "TICK_ALONG", "own", "intervalEntry", "Types", "AXIS_COLOR", "Axes3d", "component2d", "Paint", "Flow", "Shapes", "View3D", "loader", "s", "furnish", "provides", "GRAPH_3D", "graphOfAxes", "axesSpace", "measurer", "children", "box", "ctx", "scene", "furniture", "spaces", "xRange", "yRange", "zRange", "xLength", "yLength", "zLength", "key", "kept", "graphSpace", "graphs", "graph", "space", "g3", "Graphics3D", "ranges", "lengths", "steps", "titles", "cross", "clamp", "at", "axis", "value", "shift", "point", "local", "moved", "by", "thickness", "tickSize", "paint", "Mat", "style", "tipLength", "marks", "plane", "min", "max", "length", "from", "to", "Geo", "ticks", "ticksFor", "side", "drawLabel3D", "formatTick", "other", "a", "b", "colorOps", "component3d", "Geo", "Graphics3D", "Mat", "Material", "Types", "state", "meshEntries", "Types", "readSource", "lerpSource", "domainEntry", "lerpParams", "readScale", "lerpScale", "graphEntry", "SurfacePlot3d", "component3d", "PLOT_COLOR", "s", "surfaceSpace", "ctx", "declaredSurface", "drawSurface", "surfaceValueAt", "surface", "x", "y", "source", "blend", "value", "heightOf", "from", "space", "graphOf", "z", "height", "paint", "Material", "Graphics3D", "g3", "lines", "meshLines", "scaled", "op", "surfaceGeometry", "mapMaterials", "material", "color", "colorOps", "shadow", "floorShadow", "Mat", "sample", "sampler", "scale", "point", "low", "high", "Geo", "u", "v", "_u", "_v", "position", "colorAt", "revisionOf", "keyOf", "equation", "equationOf", "scopeFor", "surfaceParams", "to", "surfaceOf", "start", "out", "params", "u0", "u1", "v0", "v1", "a", "b", "finite", "x0", "x1", "y0", "y1", "f", "clamp", "floor", "linesDrawn", "count", "steps", "key", "kept", "at", "i", "fixed", "j", "parseSurface", "change", "component3d", "Geo", "Graphics3D", "Material", "Types", "state", "meshEntries", "Types", "readSource", "lerpSource", "domainEntry", "lerpParams", "graphEntry", "CurvePlot3d", "component3d", "PLOT_COLOR", "ctx", "s", "Graphics3D", "Material", "curveGeometry", "space", "graphOf", "points", "pointsOf", "Geo", "runs", "source", "blend", "start", "clamp", "end", "samples", "key", "kept", "run", "to", "curveOf", "from", "steps", "a", "b", "i", "u", "equation", "equationOf", "params", "scopeFor", "spaceCurveParams", "t0", "t1", "x", "y", "z", "out", "t", "parseSpaceCurve", "component3d", "Geo", "Material", "Types", "PlotPoint3d", "component3d", "meshEntries", "Types", "loader", "s", "ctx", "g3", "Material", "Geo", "drawLabel3D", "component3d", "Graphics3D", "lerpVector3", "Material", "resolveVector3", "Types", "point", "initial", "Types", "resolveVector3", "lerpVector3", "state", "meshEntries", "graphEntry", "VectorArrow3d", "component3d", "ctx", "s", "drawArrow", "g3", "Graphics3D", "space", "graphOf", "tail", "head", "thickness", "from", "to", "along", "length", "paint", "Material", "quaternion", "aim", "tipLength", "shaft", "at", "distance", "component2d", "Graphics2D", "Types", "LABEL_ROOM", "state", "PAINT", "Types", "listed", "AXIS_COLOR", "PolarPlane", "component2d", "loader", "s", "PAINT_COMMANDS", "systemProvides", "_measurer", "systemSize", "box", "children", "systemLayout", "polarMap", "systemOpenPlane", "ctx", "drawSystem", "systemMap", "map", "polarFurniture", "area", "width", "height", "unit", "cartesianMap", "stroke", "grid", "start", "end", "radius", "centre", "reach", "at", "r", "degrees", "angle", "radians", "ring", "size", "parts", "marks", "ticksFor", "rings", "count", "turns", "_", "i", "inner", "Graphics2D", "labels", "p", "formatTick", "cos", "sin", "radiansLabel", "drawLabels", "numerator", "denominator", "a", "b", "top", "component2d", "Types", "MAX_ARROWS", "HEAD_SHARE", "HEAD_MAX", "HEAD_ANGLE", "radians", "state", "FIELD_STATE", "Types", "ARROWS", "s", "map", "field", "arrows", "traceArrows", "read", "traceField", "VectorField", "traced", "component2d", "PLOT_COLOR", "FIELD_COMMANDS", "_measurer", "inkSize", "reading", "ctx", "drawField", "x0", "x1", "y0", "y1", "spacing", "count", "drawn", "v", "longest", "i", "j", "gx", "gy", "magnitude", "length", "hx", "hy", "tail", "head", "arrow", "dx", "dy", "barb", "back", "at", "angle", "component2d", "Types", "MAX_LINES", "STEPS_PER_SPACING", "MAX_STEPS", "state", "FIELD_STATE", "Types", "LINES", "s", "map", "field", "lines", "traceLines", "read", "traceField", "StreamLines", "traced", "component2d", "PLOT_COLOR", "FIELD_COMMANDS", "_measurer", "inkSize", "reading", "ctx", "drawField", "x0", "x1", "y0", "y1", "spacing", "count", "step", "steps", "inside", "x", "y", "window", "clamp", "drawn", "index", "i", "j", "line", "follow", "shown", "stretch", "stagger", "p", "points", "v", "strength", "heading", "px", "py", "out", "magnitude", "a", "b", "share", "phase", "end", "from", "to", "last", "mixed", "component2d", "Types", "state", "omit", "PLOT_STATE", "Types", "TracedPath", "traced", "component2d", "PLOT_STROKE", "PLOT_COMMANDS", "_measurer", "s", "inkSize", "traceTrail", "reading", "ctx", "drawMark", "read", "tracePlot", "span", "from", "value", "tail", "kept", "component2d", "Graphics2D", "Types", "readVertices", "value", "name", "readEdges", "edge", "from", "to", "readPositions", "at", "n", "entry", "BOW", "NUL", "state", "PAINT", "Types", "listed", "GRAPH_LAYOUTS", "readPartFills", "lerpPartFills", "NetworkGraph", "component2d", "loader", "s", "loadFormulas", "names", "PAINT_COMMANDS", "timeline", "t", "part", "fill", "withPartFill", "ctx", "painted", "drawGraph", "vertexPoints", "graph", "size", "room", "halfX", "halfY", "placed", "out", "p", "q", "points", "parts", "drawEdges", "drawVertices", "layouts", "createBoundedCache", "layout", "vertices", "edges", "links", "key", "layOut", "vertex", "x", "y", "stroke", "r", "all", "pairs", "plain", "Graphics2D", "drawnPlain", "a", "b", "run", "loop", "paint", "own", "g", "layers", "layer", "partPaint", "outline", "labels", "disc", "drawLabels", "bow", "dx", "dy", "length", "ux", "uy", "mid", "i", "u", "outside", "c", "radius", "cy", "angle", "component2d", "fillOps", "Graphics2D", "Types", "PALETTE", "LOWER", "readShares", "value", "share", "lerpShares", "from", "to", "t", "i", "state", "omit", "PAINT", "Types", "readFillScale", "lerpFillScale", "SampleSpace", "component2d", "loader", "s", "loadFormulas", "PAINT_COMMANDS", "ctx", "painted", "drawSpace", "sampleParts", "space", "size", "box", "boxOf", "shares", "total", "sum", "out", "left", "column", "width", "p", "cut", "top", "upper", "h", "parts", "fills", "stroke", "labels", "part", "base", "fillOps", "paint", "layer", "g", "Graphics2D", "formatTick", "braces", "style", "drawLabels", "height", "room", "below", "label", "reach", "gap", "runs", "drawn", "brace", "text", "align", "braceOutline", "mid", "far", "bottom", "first", "fill", "NODES", "Latex", "LatexMatrix", "NumberLine", "Axes2d", "NumberPlane", "FunctionPlot", "PointsPlot", "PlotPoint", "VectorArrow", "CurveArea", "RiemannSum", "TangentLine", "DropLines", "CurlyBrace", "AngleMark", "EmphasisMark", "Axes3d", "SurfacePlot3d", "CurvePlot3d", "PlotPoint3d", "VectorArrow3d", "PolarPlane", "VectorField", "StreamLines", "TracedPath", "NetworkGraph", "SampleSpace"]
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
7
  }