@pixerate/editor 0.125.0 → 0.126.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 (42) hide show
  1. package/dist/animation-editor/index.cjs +9 -11
  2. package/dist/animation-editor/index.cjs.map +1 -1
  3. package/dist/animation-editor/index.js +2 -4
  4. package/dist/animation-editor/index.js.map +1 -1
  5. package/dist/{chunk-G6WXWS4Y.js → chunk-FICSDDDF.js} +2 -2
  6. package/dist/{chunk-QDJKUBWE.cjs → chunk-JODTP4DP.cjs} +176 -5
  7. package/dist/chunk-JODTP4DP.cjs.map +1 -0
  8. package/dist/{chunk-XZWOLXWA.js → chunk-QFSTQHZY.js} +174 -3
  9. package/dist/chunk-QFSTQHZY.js.map +1 -0
  10. package/dist/{chunk-UXFI3CDZ.cjs → chunk-SFCPGMCT.cjs} +8 -8
  11. package/dist/{chunk-UXFI3CDZ.cjs.map → chunk-SFCPGMCT.cjs.map} +1 -1
  12. package/dist/effects/index.cjs +32 -34
  13. package/dist/effects/index.cjs.map +1 -1
  14. package/dist/effects/index.js +3 -5
  15. package/dist/effects/index.js.map +1 -1
  16. package/dist/image-editor/index.cjs +13 -15
  17. package/dist/image-editor/index.cjs.map +1 -1
  18. package/dist/image-editor/index.js +2 -4
  19. package/dist/image-editor/index.js.map +1 -1
  20. package/dist/paint-editor/index.cjs +728 -108
  21. package/dist/paint-editor/index.cjs.map +1 -1
  22. package/dist/paint-editor/index.d.cts +246 -9
  23. package/dist/paint-editor/index.d.ts +246 -9
  24. package/dist/paint-editor/index.js +631 -11
  25. package/dist/paint-editor/index.js.map +1 -1
  26. package/dist/vector/index.cjs +6 -8
  27. package/dist/vector/index.cjs.map +1 -1
  28. package/dist/vector/index.js +2 -4
  29. package/dist/vector/index.js.map +1 -1
  30. package/dist/video-editor/index.cjs +269 -271
  31. package/dist/video-editor/index.cjs.map +1 -1
  32. package/dist/video-editor/index.js +3 -5
  33. package/dist/video-editor/index.js.map +1 -1
  34. package/package.json +1 -1
  35. package/skills/pixerate-paint-editor/SKILL.md +40 -1
  36. package/dist/chunk-IOXKXQNW.cjs +0 -178
  37. package/dist/chunk-IOXKXQNW.cjs.map +0 -1
  38. package/dist/chunk-QDJKUBWE.cjs.map +0 -1
  39. package/dist/chunk-TGKT5QAB.js +0 -178
  40. package/dist/chunk-TGKT5QAB.js.map +0 -1
  41. package/dist/chunk-XZWOLXWA.js.map +0 -1
  42. /package/dist/{chunk-G6WXWS4Y.js.map → chunk-FICSDDDF.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/effects/conformance.ts","../../src/effects/fake.ts","../../src/effects/ui.ts"],"sourcesContent":["/**\n * `checkEffectProvider`: a conformance check any provider can run in its own tests, so editors\n * can rely on the contract (strict control schemas, valid defaults, typed errors, renderers that\n * return the size they were asked for).\n */\n\nimport { isEffectError } from './errors.js';\nimport { createEffectPixels, effectValueErrors, isEffectPixels } from './helpers.js';\nimport { EFFECT_KINDS, EFFECT_USES, type EffectDescription, type EffectPixels, type EffectProvider, type EffectSummary } from './types.js';\n\nexport interface EffectConformanceIssue {\n\teffectId?: string;\n\tmessage: string;\n}\n\nexport interface EffectConformanceOptions {\n\t/** Effects to check in depth (default: every listed effect). */\n\tids?: readonly string[];\n\t/** Also create renderers and render one small frame of each pixel effect (default true). */\n\trender?: boolean;\n\t/** Renderer size for the render check (default 8). */\n\tsize?: number;\n}\n\nconst codeOf = (e: unknown) => (isEffectError(e) ? e.code : e instanceof Error ? `untyped ${e.name}: ${e.message}` : String(e));\n\nasync function rejectsWith(code: string, run: () => unknown): Promise<string | null> {\n\ttry {\n\t\tawait run();\n\t\treturn `did not fail (expected ${code})`;\n\t} catch (e) {\n\t\tconst got = codeOf(e);\n\t\treturn got === code ? null : `failed with ${got} (expected ${code})`;\n\t}\n}\n\nfunction checkSummary(e: EffectSummary, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: e.id, message });\n\tif (!e.id || typeof e.id !== 'string') at('summary has no id');\n\tif (!e.name) at('summary has no name');\n\tif (!EFFECT_KINDS.includes(e.kind)) at(`kind \"${e.kind}\" is not one of ${EFFECT_KINDS.join(', ')}`);\n\tif (!e.category) at('summary has no category');\n\tif (!Array.isArray(e.uses) || !e.uses.length) at('summary has no uses');\n\tfor (const u of e.uses ?? []) if (!EFFECT_USES.includes(u)) at(`use \"${u}\" is not one of ${EFFECT_USES.join(', ')}`);\n\tif (typeof e.transparent !== 'boolean') at('transparent is not a boolean');\n\tif (typeof e.loop !== 'boolean') at('loop is not a boolean');\n\tif (e.duration !== undefined && !(e.duration > 0)) at('duration must be a positive number of ms when present');\n}\n\nfunction checkDescription(id: string, d: EffectDescription, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: id, message });\n\tif (d.id !== id) at(`describe(\"${id}\") returned id \"${d.id}\"`);\n\tconst c = d.controls;\n\tif (!c || c.type !== 'object') at('controls is not an object schema');\n\tif (c?.additionalProperties !== false) at('controls must set additionalProperties: false');\n\tfor (const [name, schema] of Object.entries(c?.properties ?? {})) {\n\t\tif (!schema.description || !String(schema.description).trim()) at(`control \"${name}\" has no description`);\n\t\tif (!(name in (d.defaults ?? {}))) at(`control \"${name}\" has no default`);\n\t}\n\tfor (const name of Object.keys(d.defaults ?? {})) if (!(name in (c?.properties ?? {}))) at(`default \"${name}\" is not a control`);\n\tfor (const e of effectValueErrors(d, d.defaults)) at(`default ${e.path}: ${e.message}`);\n\tfor (const p of d.presets ?? []) for (const e of effectValueErrors(d, p.values)) at(`preset \"${p.name}\" ${e.path}: ${e.message}`);\n\tfor (const input of d.inputs ?? []) {\n\t\tif (!input.name || !input.description) at('every input needs a name and a description');\n\t\tif (input.kind !== 'image' && input.kind !== 'audio') at(`input \"${input.name}\" has kind \"${input.kind}\"`);\n\t}\n\tif (d.uses.includes('filter') && !d.inputs.some((i) => i.name === 'source')) at('a filter must read an input named \"source\"');\n\tif (d.uses.includes('transition') && !(d.inputs.some((i) => i.name === 'from') && d.inputs.some((i) => i.name === 'to'))) {\n\t\tat('a transition must read inputs named \"from\" and \"to\"');\n\t}\n}\n\nfunction grey(size: number): EffectPixels {\n\tconst p = createEffectPixels(size, size);\n\tp.data.fill(128);\n\treturn p;\n}\n\nasync function checkRender(provider: EffectProvider, d: EffectDescription, size: number, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: d.id, message });\n\tconst inputs = Object.fromEntries(d.inputs.filter((i) => i.kind === 'image').map((i) => [i.name, grey(size)]));\n\tlet renderer;\n\ttry {\n\t\trenderer = await provider.createRenderer(d.id, { width: size, height: size });\n\t} catch (e) {\n\t\t// A vector effect may need the host's help to become pixels (a Worker has no DOM to lay out SVG).\n\t\tif (!(d.kind === 'vector' && codeOf(e) === 'unsupported')) at(`createRenderer failed: ${codeOf(e)}`);\n\t\treturn;\n\t}\n\ttry {\n\t\tconst out = await renderer.render({ time: 0, inputs });\n\t\tif (!isEffectPixels(out)) at('render did not return EffectPixels');\n\t\telse if (out.width !== size || out.height !== size || out.data.length !== size * size * 4) at(`render returned ${out.width}×${out.height}, not ${size}×${size}`);\n\t} catch (e) {\n\t\tat(`render failed: ${codeOf(e)}`);\n\t}\n\tconst bad = await rejectsWith('invalid_values', () => renderer.render({ time: 0, inputs, values: { __not_a_control__: 1 } }));\n\tif (bad) at(`render with an unknown control ${bad}`);\n\trenderer.dispose();\n\tconst after = await rejectsWith('disposed', () => renderer.render({ time: 0, inputs }));\n\tif (after) at(`render after dispose ${after}`);\n}\n\n/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */\nexport async function checkEffectProvider(provider: EffectProvider, options: EffectConformanceOptions = {}): Promise<EffectConformanceIssue[]> {\n\tconst issues: EffectConformanceIssue[] = [];\n\tconst top = (message: string) => issues.push({ message });\n\tif (!provider.id) top('provider has no id');\n\tconst caps = provider.capabilities;\n\tfor (const k of ['supportsWorker', 'supportsFloat', 'supportsMask', 'supportsHostImages', 'supportsVector'] as const) {\n\t\tif (typeof caps?.[k] !== 'boolean') top(`capabilities.${k} is not a boolean`);\n\t}\n\tif (caps?.supportsVector && typeof provider.applyVectorEffect !== 'function') top('supportsVector is set but applyVectorEffect is missing');\n\n\tconst list = await provider.list();\n\tconst ids = new Set<string>();\n\tfor (const e of list) {\n\t\tif (ids.has(e.id)) top(`duplicate id \"${e.id}\"`);\n\t\tids.add(e.id);\n\t\tcheckSummary(e, issues);\n\t}\n\tconst all = await provider.search('');\n\tif (all.length !== list.length) top(`search(\"\") returned ${all.length} effects, list() ${list.length}`);\n\tconst firstUse = list[0]?.uses[0];\n\tif (firstUse) {\n\t\tconst filtered = await provider.search('', { use: firstUse });\n\t\tif (filtered.some((e) => !e.uses.includes(firstUse))) top(`search(\"\", { use: \"${firstUse}\" }) returned effects without that use`);\n\t}\n\tconst unknown = await rejectsWith('unknown_effect', () => provider.describe('__no_such_effect__'));\n\tif (unknown) top(`describe of an unknown id ${unknown}`);\n\tconst unknownRenderer = await rejectsWith('unknown_effect', () => provider.createRenderer('__no_such_effect__', { width: 4, height: 4 }));\n\tif (unknownRenderer) top(`createRenderer of an unknown id ${unknownRenderer}`);\n\n\tconst size = options.size ?? 8;\n\tfor (const id of options.ids ?? [...ids]) {\n\t\tlet d: EffectDescription;\n\t\ttry {\n\t\t\td = await provider.describe(id);\n\t\t} catch (e) {\n\t\t\tissues.push({ effectId: id, message: `describe failed: ${codeOf(e)}` });\n\t\t\tcontinue;\n\t\t}\n\t\tcheckDescription(id, d, issues);\n\t\tif (options.render !== false && d.kind !== 'motion') await checkRender(provider, d, size, issues);\n\t\tif ((d.kind === 'vector' || d.kind === 'motion') && caps.supportsVector && provider.applyVectorEffect) {\n\t\t\ttry {\n\t\t\t\tconst m = await provider.applyVectorEffect(id, '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 10\"><rect id=\"r\" width=\"10\" height=\"10\"/></svg>');\n\t\t\t\tif (typeof m.svg !== 'string' || !m.svg.includes('<svg')) issues.push({ effectId: id, message: 'applyVectorEffect returned no SVG' });\n\t\t\t\tif (!(m.duration >= 0)) issues.push({ effectId: id, message: 'applyVectorEffect returned no duration' });\n\t\t\t} catch (e) {\n\t\t\t\t// The probe target is a bare <rect>; an effect that needs more (a path to follow, a fill colour) may refuse it.\n\t\t\t\tif (codeOf(e) !== 'unsupported') issues.push({ effectId: id, message: `applyVectorEffect failed: ${codeOf(e)}` });\n\t\t\t}\n\t\t\tconst bad = await rejectsWith('invalid_values', () => provider.applyVectorEffect!(id, '<svg xmlns=\"http://www.w3.org/2000/svg\"/>', { __not_a_control__: 1 }));\n\t\t\tif (bad) issues.push({ effectId: id, message: `applyVectorEffect with an unknown control ${bad}` });\n\t\t}\n\t}\n\treturn issues;\n}\n","/**\n * `createFakeEffectProvider`: a small, deterministic, CPU-only provider implementing the whole\n * contract. Tests and the demo use it; it is also a reference for real providers.\n *\n * Effects (ids prefixed `fake.`):\n * - `invert` (filter), `tint` (filter)\n * - `gradient` (generator, loops)\n * - `bar` (title / overlay: a lower-third bar that slides in, transparent)\n * - `crossfade` (transition)\n * - `fade-in` (motion, vector only)\n * - `badge` (a vector effect with its own picture: a disc that fades in; vector only)\n */\n\nimport { EffectDisposedError, EffectUnsupportedError, UnknownEffectError } from './errors.js';\nimport { createEffectPixels, encodeEffectFloat, isEffectPixels, resolveEffectValues, searchEffectSummaries, srgbToLinear } from './helpers.js';\nimport type {\n\tEffectDescription,\n\tEffectImageSource,\n\tEffectPixels,\n\tEffectProvider,\n\tEffectProviderCapabilities,\n\tEffectRenderer,\n\tEffectRendererOptions,\n\tEffectRenderRequest,\n\tEffectSummary,\n\tEffectValues,\n\tEffectVectorMotion,\n\tEffectVectorTarget\n} from './types.js';\n\nconst HEX = '^#[0-9a-fA-F]{6}$';\nconst colour = (description: string) => ({ type: 'string' as const, pattern: HEX, description });\nconst amount = (description: string) => ({ type: 'number' as const, minimum: 0, maximum: 1, description });\n\nconst DESCRIPTIONS: readonly EffectDescription[] = [\n\t{\n\t\tid: 'fake.invert',\n\t\tname: 'Invert',\n\t\tkind: 'shader',\n\t\tcategory: 'image',\n\t\tuses: ['filter'],\n\t\tdescription: 'Inverts the colours of the source.',\n\t\ttags: ['negative', 'colour'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: { amount: amount('How far to invert, 0 (unchanged) to 1 (fully inverted). Default 1.') }\n\t\t},\n\t\tdefaults: { amount: 1 },\n\t\tpresets: [{ name: 'Half', values: { amount: 0.5 } }],\n\t\tinputs: [{ name: 'source', kind: 'image', description: 'The picture to invert.', required: true }]\n\t},\n\t{\n\t\tid: 'fake.tint',\n\t\tname: 'Tint',\n\t\tkind: 'shader',\n\t\tcategory: 'image',\n\t\tuses: ['filter'],\n\t\tdescription: 'Mixes the source towards a colour.',\n\t\ttags: ['colour', 'wash'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Tint colour as #rrggbb. Default #ff8800.'),\n\t\t\t\tamount: amount('How far to mix towards the colour, 0–1. Default 0.5.')\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#ff8800', amount: 0.5 },\n\t\tpresets: [\n\t\t\t{ name: 'Sepia', values: { color: '#704214', amount: 0.4 } },\n\t\t\t{ name: 'Cool', values: { color: '#2060ff', amount: 0.25 } }\n\t\t],\n\t\tinputs: [{ name: 'source', kind: 'image', description: 'The picture to tint.', required: true }]\n\t},\n\t{\n\t\tid: 'fake.gradient',\n\t\tname: 'Gradient',\n\t\tkind: 'shader',\n\t\tcategory: 'gradient',\n\t\tuses: ['generator'],\n\t\tdescription: 'A linear gradient between two colours that can turn over time.',\n\t\ttags: ['background'],\n\t\ttransparent: false,\n\t\tloop: true,\n\t\tduration: 4000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tfrom: colour('Start colour as #rrggbb. Default #1e3a8a.'),\n\t\t\t\tto: colour('End colour as #rrggbb. Default #f472b6.'),\n\t\t\t\tangle: { type: 'number', minimum: 0, maximum: 360, description: 'Direction in degrees, 0 = left to right, 90 = top to bottom. Default 90.' },\n\t\t\t\tspin: { type: 'number', minimum: -360, maximum: 360, description: 'Turn per loop (4 s) in degrees. Default 0.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { from: '#1e3a8a', to: '#f472b6', angle: 90, spin: 0 },\n\t\tpresets: [{ name: 'Sunset', values: { from: '#f97316', to: '#7c3aed' } }],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.bar',\n\t\tname: 'Lower-third bar',\n\t\tkind: 'shader',\n\t\tcategory: 'broadcast',\n\t\tuses: ['title', 'overlay'],\n\t\tdescription: 'A coloured bar that slides in from the left in the lower third. Transparent elsewhere.',\n\t\ttags: ['lower third', 'title'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 2000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Bar colour as #rrggbb. Default #0ea5e9.'),\n\t\t\t\theight: { type: 'number', minimum: 0.02, maximum: 0.5, description: 'Bar height as a fraction of the picture height. Default 0.12.' },\n\t\t\t\tslide: { type: 'number', minimum: 0, maximum: 5000, description: 'Slide-in time (ms). Default 500.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#0ea5e9', height: 0.12, slide: 500 },\n\t\tpresets: [],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.crossfade',\n\t\tname: 'Crossfade',\n\t\tkind: 'shader',\n\t\tcategory: 'transition',\n\t\tuses: ['transition'],\n\t\tdescription: 'Dissolves from one picture to the next.',\n\t\ttags: ['dissolve', 'mix'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tduration: 1000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: { curve: { type: 'string', enum: ['linear', 'smooth'], description: 'Mix curve: linear, or smooth (ease in and out). Default smooth.' } }\n\t\t},\n\t\tdefaults: { curve: 'smooth' },\n\t\tpresets: [],\n\t\tinputs: [\n\t\t\t{ name: 'from', kind: 'image', description: 'The outgoing picture.', required: true },\n\t\t\t{ name: 'to', kind: 'image', description: 'The incoming picture.', required: true }\n\t\t]\n\t},\n\t{\n\t\tid: 'fake.fade-in',\n\t\tname: 'Fade in',\n\t\tkind: 'motion',\n\t\tcategory: 'morph',\n\t\tuses: ['motion'],\n\t\tdescription: 'Fades vector elements in from transparent, one after another.',\n\t\ttags: ['appear', 'entrance'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 600,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tms: { type: 'number', minimum: 0, maximum: 10000, description: 'Fade time per element (ms). Default 600.' },\n\t\t\t\tstagger: { type: 'number', minimum: 0, maximum: 5000, description: 'Delay between elements (ms). Default 0.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { ms: 600, stagger: 0 },\n\t\tpresets: [{ name: 'Cascade', values: { ms: 400, stagger: 120 } }],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.badge',\n\t\tname: 'Badge',\n\t\tkind: 'vector',\n\t\tcategory: 'sticker',\n\t\tuses: ['title'],\n\t\tdescription: 'A coloured disc that fades in: a vector effect that brings its own picture.',\n\t\ttags: ['sticker', 'disc'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 500,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Disc colour as #rrggbb. Default #f43f5e.'),\n\t\t\t\tms: { type: 'number', minimum: 0, maximum: 10000, description: 'Fade-in time (ms). Default 500.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#f43f5e', ms: 500 },\n\t\tpresets: [],\n\t\tinputs: []\n\t}\n];\n\nconst summaryOf = ({ controls: _c, defaults: _d, presets: _p, inputs: _i, ...summary }: EffectDescription): EffectSummary => summary;\n\nconst hexToRgb = (hex: string): [number, number, number] => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16)) as [number, number, number];\nconst smooth = (t: number) => t * t * (3 - 2 * t);\nconst clamp01 = (v: number) => (v < 0 ? 0 : v > 1 ? 1 : v);\n\nfunction input(request: EffectRenderRequest, name: string, id: string, width: number, height: number): EffectPixels {\n\tconst src: EffectImageSource | undefined = request.inputs?.[name];\n\tif (!src) throw new EffectUnsupportedError(`Effect \"${id}\" needs an input named \"${name}\".`, id);\n\tif (!isEffectPixels(src)) throw new EffectUnsupportedError(`The fake provider only takes EffectPixels inputs (\"${name}\").`, id);\n\tif (src.width !== width || src.height !== height) {\n\t\tthrow new EffectUnsupportedError(`Input \"${name}\" is ${src.width}×${src.height}; the renderer is ${width}×${height}.`, id);\n\t}\n\treturn src;\n}\n\n/** Per-pixel colour work in 8-bit sRGB; float output (when asked) is derived from it. */\nfunction renderPixels(d: EffectDescription, v: Record<string, EffectValues[string]>, request: EffectRenderRequest, width: number, height: number): EffectPixels {\n\tconst out = createEffectPixels(width, height);\n\tconst o = out.data;\n\tswitch (d.id) {\n\t\tcase 'fake.invert': {\n\t\t\tconst s = input(request, 'source', d.id, width, height).data;\n\t\t\tconst k = v.amount as number;\n\t\t\tfor (let i = 0; i < o.length; i += 4) {\n\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = s[i + c] + (255 - 2 * s[i + c]) * k;\n\t\t\t\to[i + 3] = s[i + 3];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.tint': {\n\t\t\tconst s = input(request, 'source', d.id, width, height).data;\n\t\t\tconst rgb = hexToRgb(v.color as string);\n\t\t\tconst k = v.amount as number;\n\t\t\tfor (let i = 0; i < o.length; i += 4) {\n\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = s[i + c] + (rgb[c] - s[i + c]) * k;\n\t\t\t\to[i + 3] = s[i + 3];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.gradient': {\n\t\t\tconst a = hexToRgb(v.from as string);\n\t\t\tconst b = hexToRgb(v.to as string);\n\t\t\tconst turn = ((request.time % (d.duration ?? 4000)) / (d.duration ?? 4000)) * (v.spin as number);\n\t\t\tconst rad = (((v.angle as number) + turn) * Math.PI) / 180;\n\t\t\tconst dx = Math.cos(rad);\n\t\t\tconst dy = Math.sin(rad);\n\t\t\tconst half = (Math.abs(dx) * width + Math.abs(dy) * height) / 2 || 1;\n\t\t\tfor (let y = 0, i = 0; y < height; y++) {\n\t\t\t\tfor (let x = 0; x < width; x++, i += 4) {\n\t\t\t\t\tconst t = clamp01(((x + 0.5 - width / 2) * dx + (y + 0.5 - height / 2) * dy) / (2 * half) + 0.5);\n\t\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = a[c] + (b[c] - a[c]) * t;\n\t\t\t\t\to[i + 3] = 255;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.bar': {\n\t\t\tconst rgb = hexToRgb(v.color as string);\n\t\t\tconst slide = v.slide as number;\n\t\t\tconst shown = slide > 0 ? smooth(clamp01(request.time / slide)) : 1;\n\t\t\tconst top = Math.round(height * (0.75 - (v.height as number) / 2));\n\t\t\tconst bottom = Math.round(height * (0.75 + (v.height as number) / 2));\n\t\t\tconst right = Math.round(width * 0.7 * shown);\n\t\t\tfor (let y = Math.max(0, top); y < Math.min(height, bottom); y++) {\n\t\t\t\tfor (let x = 0; x < right; x++) {\n\t\t\t\t\tconst i = (y * width + x) * 4;\n\t\t\t\t\to[i] = rgb[0];\n\t\t\t\t\to[i + 1] = rgb[1];\n\t\t\t\t\to[i + 2] = rgb[2];\n\t\t\t\t\to[i + 3] = 255;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.crossfade': {\n\t\t\tconst from = input(request, 'from', d.id, width, height).data;\n\t\t\tconst to = input(request, 'to', d.id, width, height).data;\n\t\t\tconst p = clamp01(request.progress ?? request.time / (d.duration ?? 1000));\n\t\t\tconst k = v.curve === 'smooth' ? smooth(p) : p;\n\t\t\tfor (let i = 0; i < o.length; i++) o[i] = from[i] + (to[i] - from[i]) * k;\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tthrow new EffectUnsupportedError(`\"${d.id}\" is a ${d.kind} effect; use applyVectorEffect.`, d.id);\n\t}\n\treturn out;\n}\n\nfunction toFloat(p: EffectPixels): EffectPixels {\n\tconst f = new Float32Array(p.data.length);\n\tfor (let i = 0; i < f.length; i += 4) {\n\t\tf[i] = srgbToLinear(p.data[i] / 255);\n\t\tf[i + 1] = srgbToLinear(p.data[i + 1] / 255);\n\t\tf[i + 2] = srgbToLinear(p.data[i + 2] / 255);\n\t\tf[i + 3] = p.data[i + 3] / 255;\n\t}\n\treturn encodeEffectFloat({ ...p, float: f });\n}\n\nfunction maskResult(out: EffectPixels, mask: EffectImageSource, source: EffectPixels | undefined, id: string): void {\n\tif (!isEffectPixels(mask) || mask.width !== out.width || mask.height !== out.height) {\n\t\tthrow new EffectUnsupportedError('The mask must be EffectPixels the size of the renderer.', id);\n\t}\n\tconst o = out.data;\n\tfor (let i = 0; i < o.length; i += 4) {\n\t\tconst k = mask.data[i + 3] / 255;\n\t\tif (source) for (let c = 0; c < 4; c++) o[i + c] = source.data[i + c] + (o[i + c] - source.data[i + c]) * k;\n\t\telse o[i + 3] *= k;\n\t}\n}\n\nexport interface FakeEffectProviderOptions {\n\t/** Overrides of the capability flags, to test how editors degrade. */\n\tcapabilities?: Partial<EffectProviderCapabilities>;\n\t/** Called on every render (tests count frames with it). */\n\tonRender?: (effectId: string, request: EffectRenderRequest) => void;\n}\n\n/** A deterministic CPU effects provider with six effects (see the module comment). */\nexport function createFakeEffectProvider(options: FakeEffectProviderOptions = {}): EffectProvider {\n\tconst capabilities: EffectProviderCapabilities = {\n\t\tsupportsWorker: false,\n\t\tsupportsFloat: true,\n\t\tsupportsMask: true,\n\t\tsupportsHostImages: false,\n\t\tsupportsVector: true,\n\t\tmaxSize: 8192,\n\t\t...options.capabilities\n\t};\n\tconst byId = new Map(DESCRIPTIONS.map((d) => [d.id, d]));\n\tconst get = (id: string) => {\n\t\tconst d = byId.get(id);\n\t\tif (!d) throw new UnknownEffectError(id, 'the fake provider');\n\t\treturn d;\n\t};\n\tconst summaries = DESCRIPTIONS.map(summaryOf);\n\n\tconst provider: EffectProvider = {\n\t\tid: 'fake',\n\t\tname: 'Fake effects',\n\t\tversion: '1',\n\t\tcapabilities,\n\t\tlist: (o) => searchEffectSummaries(summaries, '', o),\n\t\tsearch: (q, o) => searchEffectSummaries(summaries, q, o),\n\t\tdescribe: (id) => structuredClone(get(id)),\n\t\tcreateRenderer(id: string, ro: EffectRendererOptions): EffectRenderer {\n\t\t\tconst d = get(id);\n\t\t\tif (d.kind !== 'shader') throw new EffectUnsupportedError(`\"${id}\" is a ${d.kind} effect; use applyVectorEffect.`, id);\n\t\t\tconst { width, height } = ro;\n\t\t\tconst depth = ro.depth ?? 8;\n\t\t\tif (!(width > 0 && height > 0) || width > capabilities.maxSize! || height > capabilities.maxSize!) {\n\t\t\t\tthrow new EffectUnsupportedError(`Renderer size ${width}×${height} is outside 1–${capabilities.maxSize}.`, id);\n\t\t\t}\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\teffectId: id,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tdepth,\n\t\t\t\tasync render(request) {\n\t\t\t\t\tif (disposed) throw new EffectDisposedError(id);\n\t\t\t\t\tif (!Number.isFinite(request.time) || request.time < 0) {\n\t\t\t\t\t\tthrow new EffectUnsupportedError(`time must be a finite number of ms ≥ 0, got ${request.time}.`, id);\n\t\t\t\t\t}\n\t\t\t\t\tconst values = resolveEffectValues(d, request.values);\n\t\t\t\t\toptions.onRender?.(id, request);\n\t\t\t\t\tconst out = renderPixels(d, values, request, width, height);\n\t\t\t\t\tif (request.mask) {\n\t\t\t\t\t\tif (!capabilities.supportsMask) throw new EffectUnsupportedError('This provider does not take masks.', id);\n\t\t\t\t\t\tconst source = d.uses.includes('filter') ? (request.inputs?.source as EffectPixels) : undefined;\n\t\t\t\t\t\tmaskResult(out, request.mask, source, id);\n\t\t\t\t\t}\n\t\t\t\t\treturn depth > 8 && capabilities.supportsFloat ? toFloat(out) : out;\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tapplyVectorEffect(id: string, target: EffectVectorTarget, values?: EffectValues): EffectVectorMotion {\n\t\t\tconst d = get(id);\n\t\t\tif (d.kind !== 'motion' && d.kind !== 'vector') throw new EffectUnsupportedError(`\"${id}\" is a ${d.kind} effect, not a vector one.`, id);\n\t\t\tconst v = resolveEffectValues(d, values);\n\t\t\tif (d.kind === 'vector') {\n\t\t\t\t// Its own picture: the target is not used.\n\t\t\t\treturn { svg: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" width=\"100\" height=\"100\"><circle id=\"badge\" cx=\"50\" cy=\"50\" r=\"40\" fill=\"${v.color}\"/></svg>`, animate: [{ id: 'badge', ms: v.ms as number, attrs: { opacity: [0, 1] as const } }], duration: v.ms as number, loop: false };\n\t\t\t}\n\t\t\tconst svg = typeof target === 'string' ? target : target.svg;\n\t\t\tconst ids = typeof target === 'string' || !target.nodeIds ? [...svg.matchAll(/\\sid=\"([^\"]+)\"/g)].map((m) => m[1]) : [...target.nodeIds];\n\t\t\tconst ms = v.ms as number;\n\t\t\tconst stagger = v.stagger as number;\n\t\t\treturn {\n\t\t\t\tsvg,\n\t\t\t\tanimate: ids.map((elementId, i) => ({ id: elementId, delay: i * stagger, ms, attrs: { opacity: [0, 1] as const } })),\n\t\t\t\tduration: ms + Math.max(0, ids.length - 1) * stagger,\n\t\t\t\tloop: false\n\t\t\t};\n\t\t}\n\t};\n\treturn provider;\n}\n","/**\n * Framework-free helpers for effects UIs (the React and Svelte effects browser and parameter\n * panel): control schemas as parameter fields, preview thumbnails from a provider's renderer,\n * and labels.\n */\n\nimport type { JsonSchema } from '../tools/schema.js';\nimport type { ParameterField, ParameterValue } from '../parameters/types.js';\nimport { createEffectPixels } from './helpers.js';\nimport type { EffectDescription, EffectPixels, EffectProvider, EffectSummary, EffectUse, EffectValue } from './types.js';\n\n/** Names for the uses, for filters and badges. */\nexport const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>> = {\n\tfilter: 'Filter',\n\ttransition: 'Transition',\n\tgenerator: 'Generator',\n\toverlay: 'Overlay',\n\ttitle: 'Title',\n\tmotion: 'Motion',\n\tinteractive: 'Interactive'\n};\n\nconst HEX = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;\nconst typeOf = (s: JsonSchema) => (Array.isArray(s.type) ? s.type.find((t) => t !== 'null') : s.type);\n\n/**\n * One control as a parameter field: numbers and integers (sliders when bounded), switches,\n * choices (`enum`), colours (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.\n * `null` for a control no field can edit (objects, long lists).\n */\nexport function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null {\n\tconst base = { id: name, ...(schema.title ? { label: schema.title } : {}), ...(schema.description ? { description: schema.description } : {}) };\n\tconst def = (schema.default ?? fallback) as EffectValue | undefined;\n\tconst type = typeOf(schema);\n\tif (Array.isArray(schema.enum) && schema.enum.length) {\n\t\tconst options = schema.enum.filter((v): v is string | number => typeof v === 'string' || typeof v === 'number');\n\t\treturn { ...base, type: 'choice', options, default: (typeof def === 'string' || typeof def === 'number' ? def : options[0]) as string | number, control: options.length <= 4 ? 'segmented' : 'select' };\n\t}\n\tif (type === 'number' || type === 'integer') {\n\t\tconst min = schema.minimum ?? schema.exclusiveMinimum;\n\t\tconst max = schema.maximum ?? schema.exclusiveMaximum;\n\t\treturn { ...base, type: type === 'integer' ? 'int' : 'number', default: typeof def === 'number' ? def : (min ?? 0), ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), ...(schema.multipleOf ? { step: schema.multipleOf } : {}) };\n\t}\n\tif (type === 'boolean') return { ...base, type: 'boolean', default: def === true };\n\tif (type === 'string') {\n\t\tif (typeof def === 'string' && HEX.test(def)) return { ...base, type: 'color', alpha: def.length === 9, default: def };\n\t\treturn { ...base, type: 'text', default: typeof def === 'string' ? def : '', ...(schema.maxLength ? { maxLength: schema.maxLength } : {}) };\n\t}\n\tif (type === 'array' && Array.isArray(def) && def.length >= 2 && def.length <= 4 && def.every((n) => typeof n === 'number')) {\n\t\tconst items = schema.items ?? {};\n\t\treturn { ...base, type: 'vector', size: def.length as 2 | 3 | 4, default: [...def], ...(items.minimum !== undefined ? { min: items.minimum } : {}), ...(items.maximum !== undefined ? { max: items.maximum } : {}) };\n\t}\n\treturn null;\n}\n\n/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */\nexport function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>): ParameterField[] {\n\treturn Object.entries(description.controls.properties)\n\t\t.map(([name, schema]) => effectControlField(name, schema, description.defaults[name]))\n\t\t.filter((f): f is ParameterField => !!f);\n}\n\n/** A saved value as a field shows it (`ParameterValue`), or the field's default. */\nexport const effectFieldValue = (field: ParameterField, value: unknown): ParameterValue =>\n\tvalue === undefined || value === null || (typeof value === 'object' && !Array.isArray(value)) ? field.default : (value as ParameterValue);\n\n/**\n * A colourful, deterministic picture for previews of filters and transitions (`variant` 0 and 1\n * differ, for a transition's two sides).\n */\nexport function effectSamplePicture(width: number, height: number, variant = 0): EffectPixels {\n\tconst p = createEffectPixels(width, height);\n\tfor (let y = 0, i = 0; y < height; y++) {\n\t\tfor (let x = 0; x < width; x++, i += 4) {\n\t\t\tconst u = x / Math.max(1, width - 1);\n\t\t\tconst v = y / Math.max(1, height - 1);\n\t\t\tconst check = (Math.floor(u * 4) + Math.floor(v * 4)) % 2;\n\t\t\tif (variant === 0) p.data.set([Math.round(40 + 200 * u), Math.round(80 + 120 * v), Math.round(200 - 120 * u) + check * 30, 255], i);\n\t\t\telse p.data.set([Math.round(230 - 60 * v), Math.round(190 - 100 * u), 60 + check * 40, 255], i);\n\t\t}\n\t}\n\treturn p;\n}\n\n/**\n * A small preview of an effect from the provider's own renderer: filters run on a sample picture,\n * transitions go half way between two, generators and overlays draw at `time` (default half\n * their length, or 1 s). Thumbnails render one at a time (each renderer is disposed before the\n * next is made) and are kept per provider. Rejects like the provider does (motion effects have\n * no pixels).\n */\nexport function renderEffectThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size: { width: number; height: number } = { width: 96, height: 54 }): Promise<EffectPixels> {\n\tlet cache = thumbnails.get(provider);\n\tif (!cache) thumbnails.set(provider, (cache = new Map()));\n\tconst key = `${effect.id}@${size.width}x${size.height}`;\n\tlet out = cache.get(key);\n\tif (!out) {\n\t\t// One at a time: a browser full of previews would otherwise open a graphics context each.\n\t\tout = thumbnailQueue.then(() => renderThumbnail(provider, effect, size));\n\t\tthumbnailQueue = out.catch(() => undefined);\n\t\tout.catch(() => cache!.delete(key));\n\t\tcache.set(key, out);\n\t}\n\treturn out;\n}\n\nconst thumbnails = new WeakMap<EffectProvider, Map<string, Promise<EffectPixels>>>();\nlet thumbnailQueue: Promise<unknown> = Promise.resolve();\n\nasync function renderThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size: { width: number; height: number }): Promise<EffectPixels> {\n\tconst d = 'inputs' in effect ? effect : await provider.describe(effect.id);\n\tconst renderer = await provider.createRenderer(d.id, size);\n\ttry {\n\t\tconst time = d.duration ? d.duration / 2 : 1000;\n\t\tconst inputs: Record<string, EffectPixels> = {};\n\t\tfor (const input of d.inputs) if (input.kind === 'image') inputs[input.name] = effectSamplePicture(size.width, size.height, input.name === 'to' ? 1 : 0);\n\t\treturn await renderer.render({ time, inputs, ...(d.uses.includes('transition') ? { progress: 0.5 } : {}) });\n\t} finally {\n\t\trenderer.dispose();\n\t}\n}\n\n/** Effects grouped by category, categories in first-seen order. */\nexport function groupEffectsByCategory<T extends EffectSummary>(effects: readonly T[]): { category: string; effects: T[] }[] {\n\tconst groups = new Map<string, T[]>();\n\tfor (const e of effects) {\n\t\tconst g = groups.get(e.category);\n\t\tif (g) g.push(e);\n\t\telse groups.set(e.category, [e]);\n\t}\n\treturn [...groups].map(([category, list]) => ({ category, effects: list }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,SAAS,CAAC,MAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,aAAa,QAAQ,WAAW,EAAE,IAAI,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAE7H,eAAe,YAAY,MAAc,KAA4C;AACpF,MAAI;AACH,UAAM,IAAI;AACV,WAAO,0BAA0B,IAAI;AAAA,EACtC,SAAS,GAAG;AACX,UAAM,MAAM,OAAO,CAAC;AACpB,WAAO,QAAQ,OAAO,OAAO,eAAe,GAAG,cAAc,IAAI;AAAA,EAClE;AACD;AAEA,SAAS,aAAa,GAAkB,QAAkC;AACzE,QAAM,KAAK,CAAC,YAAoB,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,QAAQ,CAAC;AACvE,MAAI,CAAC,EAAE,MAAM,OAAO,EAAE,OAAO,SAAU,IAAG,mBAAmB;AAC7D,MAAI,CAAC,EAAE,KAAM,IAAG,qBAAqB;AACrC,MAAI,CAAC,aAAa,SAAS,EAAE,IAAI,EAAG,IAAG,SAAS,EAAE,IAAI,mBAAmB,aAAa,KAAK,IAAI,CAAC,EAAE;AAClG,MAAI,CAAC,EAAE,SAAU,IAAG,yBAAyB;AAC7C,MAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,KAAK,CAAC,EAAE,KAAK,OAAQ,IAAG,qBAAqB;AACtE,aAAW,KAAK,EAAE,QAAQ,CAAC,EAAG,KAAI,CAAC,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C,aAAW,KAAK,SAAS;AACxB,UAAM,IAAI,OAAO,IAAI,EAAE,QAAQ;AAC/B,QAAI,EAAG,GAAE,KAAK,CAAC;AAAA,QACV,QAAO,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;AAAA,EAChC;AACA,SAAO,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,UAAU,IAAI,OAAO,EAAE,UAAU,SAAS,KAAK,EAAE;AAC3E;","names":["input","HEX","input"]}
1
+ {"version":3,"sources":["../../src/effects/conformance.ts","../../src/effects/fake.ts","../../src/effects/ui.ts"],"sourcesContent":["/**\n * `checkEffectProvider`: a conformance check any provider can run in its own tests, so editors\n * can rely on the contract (strict control schemas, valid defaults, typed errors, renderers that\n * return the size they were asked for).\n */\n\nimport { isEffectError } from './errors.js';\nimport { createEffectPixels, effectValueErrors, isEffectPixels } from './helpers.js';\nimport { EFFECT_KINDS, EFFECT_USES, type EffectDescription, type EffectPixels, type EffectProvider, type EffectSummary } from './types.js';\n\nexport interface EffectConformanceIssue {\n\teffectId?: string;\n\tmessage: string;\n}\n\nexport interface EffectConformanceOptions {\n\t/** Effects to check in depth (default: every listed effect). */\n\tids?: readonly string[];\n\t/** Also create renderers and render one small frame of each pixel effect (default true). */\n\trender?: boolean;\n\t/** Renderer size for the render check (default 8). */\n\tsize?: number;\n}\n\nconst codeOf = (e: unknown) => (isEffectError(e) ? e.code : e instanceof Error ? `untyped ${e.name}: ${e.message}` : String(e));\n\nasync function rejectsWith(code: string, run: () => unknown): Promise<string | null> {\n\ttry {\n\t\tawait run();\n\t\treturn `did not fail (expected ${code})`;\n\t} catch (e) {\n\t\tconst got = codeOf(e);\n\t\treturn got === code ? null : `failed with ${got} (expected ${code})`;\n\t}\n}\n\nfunction checkSummary(e: EffectSummary, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: e.id, message });\n\tif (!e.id || typeof e.id !== 'string') at('summary has no id');\n\tif (!e.name) at('summary has no name');\n\tif (!EFFECT_KINDS.includes(e.kind)) at(`kind \"${e.kind}\" is not one of ${EFFECT_KINDS.join(', ')}`);\n\tif (!e.category) at('summary has no category');\n\tif (!Array.isArray(e.uses) || !e.uses.length) at('summary has no uses');\n\tfor (const u of e.uses ?? []) if (!EFFECT_USES.includes(u)) at(`use \"${u}\" is not one of ${EFFECT_USES.join(', ')}`);\n\tif (typeof e.transparent !== 'boolean') at('transparent is not a boolean');\n\tif (typeof e.loop !== 'boolean') at('loop is not a boolean');\n\tif (e.duration !== undefined && !(e.duration > 0)) at('duration must be a positive number of ms when present');\n}\n\nfunction checkDescription(id: string, d: EffectDescription, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: id, message });\n\tif (d.id !== id) at(`describe(\"${id}\") returned id \"${d.id}\"`);\n\tconst c = d.controls;\n\tif (!c || c.type !== 'object') at('controls is not an object schema');\n\tif (c?.additionalProperties !== false) at('controls must set additionalProperties: false');\n\tfor (const [name, schema] of Object.entries(c?.properties ?? {})) {\n\t\tif (!schema.description || !String(schema.description).trim()) at(`control \"${name}\" has no description`);\n\t\tif (!(name in (d.defaults ?? {}))) at(`control \"${name}\" has no default`);\n\t}\n\tfor (const name of Object.keys(d.defaults ?? {})) if (!(name in (c?.properties ?? {}))) at(`default \"${name}\" is not a control`);\n\tfor (const e of effectValueErrors(d, d.defaults)) at(`default ${e.path}: ${e.message}`);\n\tfor (const p of d.presets ?? []) for (const e of effectValueErrors(d, p.values)) at(`preset \"${p.name}\" ${e.path}: ${e.message}`);\n\tfor (const input of d.inputs ?? []) {\n\t\tif (!input.name || !input.description) at('every input needs a name and a description');\n\t\tif (input.kind !== 'image' && input.kind !== 'audio') at(`input \"${input.name}\" has kind \"${input.kind}\"`);\n\t}\n\tif (d.uses.includes('filter') && !d.inputs.some((i) => i.name === 'source')) at('a filter must read an input named \"source\"');\n\tif (d.uses.includes('transition') && !(d.inputs.some((i) => i.name === 'from') && d.inputs.some((i) => i.name === 'to'))) {\n\t\tat('a transition must read inputs named \"from\" and \"to\"');\n\t}\n}\n\nfunction grey(size: number): EffectPixels {\n\tconst p = createEffectPixels(size, size);\n\tp.data.fill(128);\n\treturn p;\n}\n\nasync function checkRender(provider: EffectProvider, d: EffectDescription, size: number, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: d.id, message });\n\tconst inputs = Object.fromEntries(d.inputs.filter((i) => i.kind === 'image').map((i) => [i.name, grey(size)]));\n\tlet renderer;\n\ttry {\n\t\trenderer = await provider.createRenderer(d.id, { width: size, height: size });\n\t} catch (e) {\n\t\t// A vector effect may need the host's help to become pixels (a Worker has no DOM to lay out SVG).\n\t\tif (!(d.kind === 'vector' && codeOf(e) === 'unsupported')) at(`createRenderer failed: ${codeOf(e)}`);\n\t\treturn;\n\t}\n\ttry {\n\t\tconst out = await renderer.render({ time: 0, inputs });\n\t\tif (!isEffectPixels(out)) at('render did not return EffectPixels');\n\t\telse if (out.width !== size || out.height !== size || out.data.length !== size * size * 4) at(`render returned ${out.width}×${out.height}, not ${size}×${size}`);\n\t} catch (e) {\n\t\tat(`render failed: ${codeOf(e)}`);\n\t}\n\tconst bad = await rejectsWith('invalid_values', () => renderer.render({ time: 0, inputs, values: { __not_a_control__: 1 } }));\n\tif (bad) at(`render with an unknown control ${bad}`);\n\trenderer.dispose();\n\tconst after = await rejectsWith('disposed', () => renderer.render({ time: 0, inputs }));\n\tif (after) at(`render after dispose ${after}`);\n}\n\n/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */\nexport async function checkEffectProvider(provider: EffectProvider, options: EffectConformanceOptions = {}): Promise<EffectConformanceIssue[]> {\n\tconst issues: EffectConformanceIssue[] = [];\n\tconst top = (message: string) => issues.push({ message });\n\tif (!provider.id) top('provider has no id');\n\tconst caps = provider.capabilities;\n\tfor (const k of ['supportsWorker', 'supportsFloat', 'supportsMask', 'supportsHostImages', 'supportsVector'] as const) {\n\t\tif (typeof caps?.[k] !== 'boolean') top(`capabilities.${k} is not a boolean`);\n\t}\n\tif (caps?.supportsVector && typeof provider.applyVectorEffect !== 'function') top('supportsVector is set but applyVectorEffect is missing');\n\n\tconst list = await provider.list();\n\tconst ids = new Set<string>();\n\tfor (const e of list) {\n\t\tif (ids.has(e.id)) top(`duplicate id \"${e.id}\"`);\n\t\tids.add(e.id);\n\t\tcheckSummary(e, issues);\n\t}\n\tconst all = await provider.search('');\n\tif (all.length !== list.length) top(`search(\"\") returned ${all.length} effects, list() ${list.length}`);\n\tconst firstUse = list[0]?.uses[0];\n\tif (firstUse) {\n\t\tconst filtered = await provider.search('', { use: firstUse });\n\t\tif (filtered.some((e) => !e.uses.includes(firstUse))) top(`search(\"\", { use: \"${firstUse}\" }) returned effects without that use`);\n\t}\n\tconst unknown = await rejectsWith('unknown_effect', () => provider.describe('__no_such_effect__'));\n\tif (unknown) top(`describe of an unknown id ${unknown}`);\n\tconst unknownRenderer = await rejectsWith('unknown_effect', () => provider.createRenderer('__no_such_effect__', { width: 4, height: 4 }));\n\tif (unknownRenderer) top(`createRenderer of an unknown id ${unknownRenderer}`);\n\n\tconst size = options.size ?? 8;\n\tfor (const id of options.ids ?? [...ids]) {\n\t\tlet d: EffectDescription;\n\t\ttry {\n\t\t\td = await provider.describe(id);\n\t\t} catch (e) {\n\t\t\tissues.push({ effectId: id, message: `describe failed: ${codeOf(e)}` });\n\t\t\tcontinue;\n\t\t}\n\t\tcheckDescription(id, d, issues);\n\t\tif (options.render !== false && d.kind !== 'motion') await checkRender(provider, d, size, issues);\n\t\tif ((d.kind === 'vector' || d.kind === 'motion') && caps.supportsVector && provider.applyVectorEffect) {\n\t\t\ttry {\n\t\t\t\tconst m = await provider.applyVectorEffect(id, '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 10\"><rect id=\"r\" width=\"10\" height=\"10\"/></svg>');\n\t\t\t\tif (typeof m.svg !== 'string' || !m.svg.includes('<svg')) issues.push({ effectId: id, message: 'applyVectorEffect returned no SVG' });\n\t\t\t\tif (!(m.duration >= 0)) issues.push({ effectId: id, message: 'applyVectorEffect returned no duration' });\n\t\t\t} catch (e) {\n\t\t\t\t// The probe target is a bare <rect>; an effect that needs more (a path to follow, a fill colour) may refuse it.\n\t\t\t\tif (codeOf(e) !== 'unsupported') issues.push({ effectId: id, message: `applyVectorEffect failed: ${codeOf(e)}` });\n\t\t\t}\n\t\t\tconst bad = await rejectsWith('invalid_values', () => provider.applyVectorEffect!(id, '<svg xmlns=\"http://www.w3.org/2000/svg\"/>', { __not_a_control__: 1 }));\n\t\t\tif (bad) issues.push({ effectId: id, message: `applyVectorEffect with an unknown control ${bad}` });\n\t\t}\n\t}\n\treturn issues;\n}\n","/**\n * `createFakeEffectProvider`: a small, deterministic, CPU-only provider implementing the whole\n * contract. Tests and the demo use it; it is also a reference for real providers.\n *\n * Effects (ids prefixed `fake.`):\n * - `invert` (filter), `tint` (filter)\n * - `gradient` (generator, loops)\n * - `bar` (title / overlay: a lower-third bar that slides in, transparent)\n * - `crossfade` (transition)\n * - `fade-in` (motion, vector only)\n * - `badge` (a vector effect with its own picture: a disc that fades in; vector only)\n */\n\nimport { EffectDisposedError, EffectUnsupportedError, UnknownEffectError } from './errors.js';\nimport { createEffectPixels, encodeEffectFloat, isEffectPixels, resolveEffectValues, searchEffectSummaries, srgbToLinear } from './helpers.js';\nimport type {\n\tEffectDescription,\n\tEffectImageSource,\n\tEffectPixels,\n\tEffectProvider,\n\tEffectProviderCapabilities,\n\tEffectRenderer,\n\tEffectRendererOptions,\n\tEffectRenderRequest,\n\tEffectSummary,\n\tEffectValues,\n\tEffectVectorMotion,\n\tEffectVectorTarget\n} from './types.js';\n\nconst HEX = '^#[0-9a-fA-F]{6}$';\nconst colour = (description: string) => ({ type: 'string' as const, pattern: HEX, description });\nconst amount = (description: string) => ({ type: 'number' as const, minimum: 0, maximum: 1, description });\n\nconst DESCRIPTIONS: readonly EffectDescription[] = [\n\t{\n\t\tid: 'fake.invert',\n\t\tname: 'Invert',\n\t\tkind: 'shader',\n\t\tcategory: 'image',\n\t\tuses: ['filter'],\n\t\tdescription: 'Inverts the colours of the source.',\n\t\ttags: ['negative', 'colour'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: { amount: amount('How far to invert, 0 (unchanged) to 1 (fully inverted). Default 1.') }\n\t\t},\n\t\tdefaults: { amount: 1 },\n\t\tpresets: [{ name: 'Half', values: { amount: 0.5 } }],\n\t\tinputs: [{ name: 'source', kind: 'image', description: 'The picture to invert.', required: true }]\n\t},\n\t{\n\t\tid: 'fake.tint',\n\t\tname: 'Tint',\n\t\tkind: 'shader',\n\t\tcategory: 'image',\n\t\tuses: ['filter'],\n\t\tdescription: 'Mixes the source towards a colour.',\n\t\ttags: ['colour', 'wash'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Tint colour as #rrggbb. Default #ff8800.'),\n\t\t\t\tamount: amount('How far to mix towards the colour, 0–1. Default 0.5.')\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#ff8800', amount: 0.5 },\n\t\tpresets: [\n\t\t\t{ name: 'Sepia', values: { color: '#704214', amount: 0.4 } },\n\t\t\t{ name: 'Cool', values: { color: '#2060ff', amount: 0.25 } }\n\t\t],\n\t\tinputs: [{ name: 'source', kind: 'image', description: 'The picture to tint.', required: true }]\n\t},\n\t{\n\t\tid: 'fake.gradient',\n\t\tname: 'Gradient',\n\t\tkind: 'shader',\n\t\tcategory: 'gradient',\n\t\tuses: ['generator'],\n\t\tdescription: 'A linear gradient between two colours that can turn over time.',\n\t\ttags: ['background'],\n\t\ttransparent: false,\n\t\tloop: true,\n\t\tduration: 4000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tfrom: colour('Start colour as #rrggbb. Default #1e3a8a.'),\n\t\t\t\tto: colour('End colour as #rrggbb. Default #f472b6.'),\n\t\t\t\tangle: { type: 'number', minimum: 0, maximum: 360, description: 'Direction in degrees, 0 = left to right, 90 = top to bottom. Default 90.' },\n\t\t\t\tspin: { type: 'number', minimum: -360, maximum: 360, description: 'Turn per loop (4 s) in degrees. Default 0.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { from: '#1e3a8a', to: '#f472b6', angle: 90, spin: 0 },\n\t\tpresets: [{ name: 'Sunset', values: { from: '#f97316', to: '#7c3aed' } }],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.bar',\n\t\tname: 'Lower-third bar',\n\t\tkind: 'shader',\n\t\tcategory: 'broadcast',\n\t\tuses: ['title', 'overlay'],\n\t\tdescription: 'A coloured bar that slides in from the left in the lower third. Transparent elsewhere.',\n\t\ttags: ['lower third', 'title'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 2000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Bar colour as #rrggbb. Default #0ea5e9.'),\n\t\t\t\theight: { type: 'number', minimum: 0.02, maximum: 0.5, description: 'Bar height as a fraction of the picture height. Default 0.12.' },\n\t\t\t\tslide: { type: 'number', minimum: 0, maximum: 5000, description: 'Slide-in time (ms). Default 500.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#0ea5e9', height: 0.12, slide: 500 },\n\t\tpresets: [],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.crossfade',\n\t\tname: 'Crossfade',\n\t\tkind: 'shader',\n\t\tcategory: 'transition',\n\t\tuses: ['transition'],\n\t\tdescription: 'Dissolves from one picture to the next.',\n\t\ttags: ['dissolve', 'mix'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tduration: 1000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: { curve: { type: 'string', enum: ['linear', 'smooth'], description: 'Mix curve: linear, or smooth (ease in and out). Default smooth.' } }\n\t\t},\n\t\tdefaults: { curve: 'smooth' },\n\t\tpresets: [],\n\t\tinputs: [\n\t\t\t{ name: 'from', kind: 'image', description: 'The outgoing picture.', required: true },\n\t\t\t{ name: 'to', kind: 'image', description: 'The incoming picture.', required: true }\n\t\t]\n\t},\n\t{\n\t\tid: 'fake.fade-in',\n\t\tname: 'Fade in',\n\t\tkind: 'motion',\n\t\tcategory: 'morph',\n\t\tuses: ['motion'],\n\t\tdescription: 'Fades vector elements in from transparent, one after another.',\n\t\ttags: ['appear', 'entrance'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 600,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tms: { type: 'number', minimum: 0, maximum: 10000, description: 'Fade time per element (ms). Default 600.' },\n\t\t\t\tstagger: { type: 'number', minimum: 0, maximum: 5000, description: 'Delay between elements (ms). Default 0.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { ms: 600, stagger: 0 },\n\t\tpresets: [{ name: 'Cascade', values: { ms: 400, stagger: 120 } }],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.badge',\n\t\tname: 'Badge',\n\t\tkind: 'vector',\n\t\tcategory: 'sticker',\n\t\tuses: ['title'],\n\t\tdescription: 'A coloured disc that fades in: a vector effect that brings its own picture.',\n\t\ttags: ['sticker', 'disc'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 500,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Disc colour as #rrggbb. Default #f43f5e.'),\n\t\t\t\tms: { type: 'number', minimum: 0, maximum: 10000, description: 'Fade-in time (ms). Default 500.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#f43f5e', ms: 500 },\n\t\tpresets: [],\n\t\tinputs: []\n\t}\n];\n\nconst summaryOf = ({ controls: _c, defaults: _d, presets: _p, inputs: _i, ...summary }: EffectDescription): EffectSummary => summary;\n\nconst hexToRgb = (hex: string): [number, number, number] => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16)) as [number, number, number];\nconst smooth = (t: number) => t * t * (3 - 2 * t);\nconst clamp01 = (v: number) => (v < 0 ? 0 : v > 1 ? 1 : v);\n\nfunction input(request: EffectRenderRequest, name: string, id: string, width: number, height: number): EffectPixels {\n\tconst src: EffectImageSource | undefined = request.inputs?.[name];\n\tif (!src) throw new EffectUnsupportedError(`Effect \"${id}\" needs an input named \"${name}\".`, id);\n\tif (!isEffectPixels(src)) throw new EffectUnsupportedError(`The fake provider only takes EffectPixels inputs (\"${name}\").`, id);\n\tif (src.width !== width || src.height !== height) {\n\t\tthrow new EffectUnsupportedError(`Input \"${name}\" is ${src.width}×${src.height}; the renderer is ${width}×${height}.`, id);\n\t}\n\treturn src;\n}\n\n/** Per-pixel colour work in 8-bit sRGB; float output (when asked) is derived from it. */\nfunction renderPixels(d: EffectDescription, v: Record<string, EffectValues[string]>, request: EffectRenderRequest, width: number, height: number): EffectPixels {\n\tconst out = createEffectPixels(width, height);\n\tconst o = out.data;\n\tswitch (d.id) {\n\t\tcase 'fake.invert': {\n\t\t\tconst s = input(request, 'source', d.id, width, height).data;\n\t\t\tconst k = v.amount as number;\n\t\t\tfor (let i = 0; i < o.length; i += 4) {\n\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = s[i + c] + (255 - 2 * s[i + c]) * k;\n\t\t\t\to[i + 3] = s[i + 3];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.tint': {\n\t\t\tconst s = input(request, 'source', d.id, width, height).data;\n\t\t\tconst rgb = hexToRgb(v.color as string);\n\t\t\tconst k = v.amount as number;\n\t\t\tfor (let i = 0; i < o.length; i += 4) {\n\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = s[i + c] + (rgb[c] - s[i + c]) * k;\n\t\t\t\to[i + 3] = s[i + 3];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.gradient': {\n\t\t\tconst a = hexToRgb(v.from as string);\n\t\t\tconst b = hexToRgb(v.to as string);\n\t\t\tconst turn = ((request.time % (d.duration ?? 4000)) / (d.duration ?? 4000)) * (v.spin as number);\n\t\t\tconst rad = (((v.angle as number) + turn) * Math.PI) / 180;\n\t\t\tconst dx = Math.cos(rad);\n\t\t\tconst dy = Math.sin(rad);\n\t\t\tconst half = (Math.abs(dx) * width + Math.abs(dy) * height) / 2 || 1;\n\t\t\tfor (let y = 0, i = 0; y < height; y++) {\n\t\t\t\tfor (let x = 0; x < width; x++, i += 4) {\n\t\t\t\t\tconst t = clamp01(((x + 0.5 - width / 2) * dx + (y + 0.5 - height / 2) * dy) / (2 * half) + 0.5);\n\t\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = a[c] + (b[c] - a[c]) * t;\n\t\t\t\t\to[i + 3] = 255;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.bar': {\n\t\t\tconst rgb = hexToRgb(v.color as string);\n\t\t\tconst slide = v.slide as number;\n\t\t\tconst shown = slide > 0 ? smooth(clamp01(request.time / slide)) : 1;\n\t\t\tconst top = Math.round(height * (0.75 - (v.height as number) / 2));\n\t\t\tconst bottom = Math.round(height * (0.75 + (v.height as number) / 2));\n\t\t\tconst right = Math.round(width * 0.7 * shown);\n\t\t\tfor (let y = Math.max(0, top); y < Math.min(height, bottom); y++) {\n\t\t\t\tfor (let x = 0; x < right; x++) {\n\t\t\t\t\tconst i = (y * width + x) * 4;\n\t\t\t\t\to[i] = rgb[0];\n\t\t\t\t\to[i + 1] = rgb[1];\n\t\t\t\t\to[i + 2] = rgb[2];\n\t\t\t\t\to[i + 3] = 255;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.crossfade': {\n\t\t\tconst from = input(request, 'from', d.id, width, height).data;\n\t\t\tconst to = input(request, 'to', d.id, width, height).data;\n\t\t\tconst p = clamp01(request.progress ?? request.time / (d.duration ?? 1000));\n\t\t\tconst k = v.curve === 'smooth' ? smooth(p) : p;\n\t\t\tfor (let i = 0; i < o.length; i++) o[i] = from[i] + (to[i] - from[i]) * k;\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tthrow new EffectUnsupportedError(`\"${d.id}\" is a ${d.kind} effect; use applyVectorEffect.`, d.id);\n\t}\n\treturn out;\n}\n\nfunction toFloat(p: EffectPixels): EffectPixels {\n\tconst f = new Float32Array(p.data.length);\n\tfor (let i = 0; i < f.length; i += 4) {\n\t\tf[i] = srgbToLinear(p.data[i] / 255);\n\t\tf[i + 1] = srgbToLinear(p.data[i + 1] / 255);\n\t\tf[i + 2] = srgbToLinear(p.data[i + 2] / 255);\n\t\tf[i + 3] = p.data[i + 3] / 255;\n\t}\n\treturn encodeEffectFloat({ ...p, float: f });\n}\n\nfunction maskResult(out: EffectPixels, mask: EffectImageSource, source: EffectPixels | undefined, id: string): void {\n\tif (!isEffectPixels(mask) || mask.width !== out.width || mask.height !== out.height) {\n\t\tthrow new EffectUnsupportedError('The mask must be EffectPixels the size of the renderer.', id);\n\t}\n\tconst o = out.data;\n\tfor (let i = 0; i < o.length; i += 4) {\n\t\tconst k = mask.data[i + 3] / 255;\n\t\tif (source) for (let c = 0; c < 4; c++) o[i + c] = source.data[i + c] + (o[i + c] - source.data[i + c]) * k;\n\t\telse o[i + 3] *= k;\n\t}\n}\n\nexport interface FakeEffectProviderOptions {\n\t/** Overrides of the capability flags, to test how editors degrade. */\n\tcapabilities?: Partial<EffectProviderCapabilities>;\n\t/** Called on every render (tests count frames with it). */\n\tonRender?: (effectId: string, request: EffectRenderRequest) => void;\n}\n\n/** A deterministic CPU effects provider with six effects (see the module comment). */\nexport function createFakeEffectProvider(options: FakeEffectProviderOptions = {}): EffectProvider {\n\tconst capabilities: EffectProviderCapabilities = {\n\t\tsupportsWorker: false,\n\t\tsupportsFloat: true,\n\t\tsupportsMask: true,\n\t\tsupportsHostImages: false,\n\t\tsupportsVector: true,\n\t\tmaxSize: 8192,\n\t\t...options.capabilities\n\t};\n\tconst byId = new Map(DESCRIPTIONS.map((d) => [d.id, d]));\n\tconst get = (id: string) => {\n\t\tconst d = byId.get(id);\n\t\tif (!d) throw new UnknownEffectError(id, 'the fake provider');\n\t\treturn d;\n\t};\n\tconst summaries = DESCRIPTIONS.map(summaryOf);\n\n\tconst provider: EffectProvider = {\n\t\tid: 'fake',\n\t\tname: 'Fake effects',\n\t\tversion: '1',\n\t\tcapabilities,\n\t\tlist: (o) => searchEffectSummaries(summaries, '', o),\n\t\tsearch: (q, o) => searchEffectSummaries(summaries, q, o),\n\t\tdescribe: (id) => structuredClone(get(id)),\n\t\tcreateRenderer(id: string, ro: EffectRendererOptions): EffectRenderer {\n\t\t\tconst d = get(id);\n\t\t\tif (d.kind !== 'shader') throw new EffectUnsupportedError(`\"${id}\" is a ${d.kind} effect; use applyVectorEffect.`, id);\n\t\t\tconst { width, height } = ro;\n\t\t\tconst depth = ro.depth ?? 8;\n\t\t\tif (!(width > 0 && height > 0) || width > capabilities.maxSize! || height > capabilities.maxSize!) {\n\t\t\t\tthrow new EffectUnsupportedError(`Renderer size ${width}×${height} is outside 1–${capabilities.maxSize}.`, id);\n\t\t\t}\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\teffectId: id,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tdepth,\n\t\t\t\tasync render(request) {\n\t\t\t\t\tif (disposed) throw new EffectDisposedError(id);\n\t\t\t\t\tif (!Number.isFinite(request.time) || request.time < 0) {\n\t\t\t\t\t\tthrow new EffectUnsupportedError(`time must be a finite number of ms ≥ 0, got ${request.time}.`, id);\n\t\t\t\t\t}\n\t\t\t\t\tconst values = resolveEffectValues(d, request.values);\n\t\t\t\t\toptions.onRender?.(id, request);\n\t\t\t\t\tconst out = renderPixels(d, values, request, width, height);\n\t\t\t\t\tif (request.mask) {\n\t\t\t\t\t\tif (!capabilities.supportsMask) throw new EffectUnsupportedError('This provider does not take masks.', id);\n\t\t\t\t\t\tconst source = d.uses.includes('filter') ? (request.inputs?.source as EffectPixels) : undefined;\n\t\t\t\t\t\tmaskResult(out, request.mask, source, id);\n\t\t\t\t\t}\n\t\t\t\t\treturn depth > 8 && capabilities.supportsFloat ? toFloat(out) : out;\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tapplyVectorEffect(id: string, target: EffectVectorTarget, values?: EffectValues): EffectVectorMotion {\n\t\t\tconst d = get(id);\n\t\t\tif (d.kind !== 'motion' && d.kind !== 'vector') throw new EffectUnsupportedError(`\"${id}\" is a ${d.kind} effect, not a vector one.`, id);\n\t\t\tconst v = resolveEffectValues(d, values);\n\t\t\tif (d.kind === 'vector') {\n\t\t\t\t// Its own picture: the target is not used.\n\t\t\t\treturn { svg: `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" width=\"100\" height=\"100\"><circle id=\"badge\" cx=\"50\" cy=\"50\" r=\"40\" fill=\"${v.color}\"/></svg>`, animate: [{ id: 'badge', ms: v.ms as number, attrs: { opacity: [0, 1] as const } }], duration: v.ms as number, loop: false };\n\t\t\t}\n\t\t\tconst svg = typeof target === 'string' ? target : target.svg;\n\t\t\tconst ids = typeof target === 'string' || !target.nodeIds ? [...svg.matchAll(/\\sid=\"([^\"]+)\"/g)].map((m) => m[1]) : [...target.nodeIds];\n\t\t\tconst ms = v.ms as number;\n\t\t\tconst stagger = v.stagger as number;\n\t\t\treturn {\n\t\t\t\tsvg,\n\t\t\t\tanimate: ids.map((elementId, i) => ({ id: elementId, delay: i * stagger, ms, attrs: { opacity: [0, 1] as const } })),\n\t\t\t\tduration: ms + Math.max(0, ids.length - 1) * stagger,\n\t\t\t\tloop: false\n\t\t\t};\n\t\t}\n\t};\n\treturn provider;\n}\n","/**\n * Framework-free helpers for effects UIs (the React and Svelte effects browser and parameter\n * panel): control schemas as parameter fields, preview thumbnails from a provider's renderer,\n * and labels.\n */\n\nimport type { JsonSchema } from '../tools/schema.js';\nimport type { ParameterField, ParameterValue } from '../parameters/types.js';\nimport { createEffectPixels } from './helpers.js';\nimport type { EffectDescription, EffectPixels, EffectProvider, EffectSummary, EffectUse, EffectValue } from './types.js';\n\n/** Names for the uses, for filters and badges. */\nexport const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>> = {\n\tfilter: 'Filter',\n\ttransition: 'Transition',\n\tgenerator: 'Generator',\n\toverlay: 'Overlay',\n\ttitle: 'Title',\n\tmotion: 'Motion',\n\tinteractive: 'Interactive'\n};\n\nconst HEX = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;\nconst typeOf = (s: JsonSchema) => (Array.isArray(s.type) ? s.type.find((t) => t !== 'null') : s.type);\n\n/**\n * One control as a parameter field: numbers and integers (sliders when bounded), switches,\n * choices (`enum`), colours (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.\n * `null` for a control no field can edit (objects, long lists).\n */\nexport function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null {\n\tconst base = { id: name, ...(schema.title ? { label: schema.title } : {}), ...(schema.description ? { description: schema.description } : {}) };\n\tconst def = (schema.default ?? fallback) as EffectValue | undefined;\n\tconst type = typeOf(schema);\n\tif (Array.isArray(schema.enum) && schema.enum.length) {\n\t\tconst options = schema.enum.filter((v): v is string | number => typeof v === 'string' || typeof v === 'number');\n\t\treturn { ...base, type: 'choice', options, default: (typeof def === 'string' || typeof def === 'number' ? def : options[0]) as string | number, control: options.length <= 4 ? 'segmented' : 'select' };\n\t}\n\tif (type === 'number' || type === 'integer') {\n\t\tconst min = schema.minimum ?? schema.exclusiveMinimum;\n\t\tconst max = schema.maximum ?? schema.exclusiveMaximum;\n\t\treturn { ...base, type: type === 'integer' ? 'int' : 'number', default: typeof def === 'number' ? def : (min ?? 0), ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), ...(schema.multipleOf ? { step: schema.multipleOf } : {}) };\n\t}\n\tif (type === 'boolean') return { ...base, type: 'boolean', default: def === true };\n\tif (type === 'string') {\n\t\tif (typeof def === 'string' && HEX.test(def)) return { ...base, type: 'color', alpha: def.length === 9, default: def };\n\t\treturn { ...base, type: 'text', default: typeof def === 'string' ? def : '', ...(schema.maxLength ? { maxLength: schema.maxLength } : {}) };\n\t}\n\tif (type === 'array' && Array.isArray(def) && def.length >= 2 && def.length <= 4 && def.every((n) => typeof n === 'number')) {\n\t\tconst items = schema.items ?? {};\n\t\treturn { ...base, type: 'vector', size: def.length as 2 | 3 | 4, default: [...def], ...(items.minimum !== undefined ? { min: items.minimum } : {}), ...(items.maximum !== undefined ? { max: items.maximum } : {}) };\n\t}\n\treturn null;\n}\n\n/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */\nexport function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>): ParameterField[] {\n\treturn Object.entries(description.controls.properties)\n\t\t.map(([name, schema]) => effectControlField(name, schema, description.defaults[name]))\n\t\t.filter((f): f is ParameterField => !!f);\n}\n\n/** A saved value as a field shows it (`ParameterValue`), or the field's default. */\nexport const effectFieldValue = (field: ParameterField, value: unknown): ParameterValue =>\n\tvalue === undefined || value === null || (typeof value === 'object' && !Array.isArray(value)) ? field.default : (value as ParameterValue);\n\n/**\n * A colourful, deterministic picture for previews of filters and transitions (`variant` 0 and 1\n * differ, for a transition's two sides).\n */\nexport function effectSamplePicture(width: number, height: number, variant = 0): EffectPixels {\n\tconst p = createEffectPixels(width, height);\n\tfor (let y = 0, i = 0; y < height; y++) {\n\t\tfor (let x = 0; x < width; x++, i += 4) {\n\t\t\tconst u = x / Math.max(1, width - 1);\n\t\t\tconst v = y / Math.max(1, height - 1);\n\t\t\tconst check = (Math.floor(u * 4) + Math.floor(v * 4)) % 2;\n\t\t\tif (variant === 0) p.data.set([Math.round(40 + 200 * u), Math.round(80 + 120 * v), Math.round(200 - 120 * u) + check * 30, 255], i);\n\t\t\telse p.data.set([Math.round(230 - 60 * v), Math.round(190 - 100 * u), 60 + check * 40, 255], i);\n\t\t}\n\t}\n\treturn p;\n}\n\n/**\n * A small preview of an effect from the provider's own renderer: filters run on a sample picture,\n * transitions go half way between two, generators and overlays draw at `time` (default half\n * their length, or 1 s). Thumbnails render one at a time (each renderer is disposed before the\n * next is made) and are kept per provider. Rejects like the provider does (motion effects have\n * no pixels).\n */\nexport function renderEffectThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size: { width: number; height: number } = { width: 96, height: 54 }): Promise<EffectPixels> {\n\tlet cache = thumbnails.get(provider);\n\tif (!cache) thumbnails.set(provider, (cache = new Map()));\n\tconst key = `${effect.id}@${size.width}x${size.height}`;\n\tlet out = cache.get(key);\n\tif (!out) {\n\t\t// One at a time: a browser full of previews would otherwise open a graphics context each.\n\t\tout = thumbnailQueue.then(() => renderThumbnail(provider, effect, size));\n\t\tthumbnailQueue = out.catch(() => undefined);\n\t\tout.catch(() => cache!.delete(key));\n\t\tcache.set(key, out);\n\t}\n\treturn out;\n}\n\nconst thumbnails = new WeakMap<EffectProvider, Map<string, Promise<EffectPixels>>>();\nlet thumbnailQueue: Promise<unknown> = Promise.resolve();\n\nasync function renderThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size: { width: number; height: number }): Promise<EffectPixels> {\n\tconst d = 'inputs' in effect ? effect : await provider.describe(effect.id);\n\tconst renderer = await provider.createRenderer(d.id, size);\n\ttry {\n\t\tconst time = d.duration ? d.duration / 2 : 1000;\n\t\tconst inputs: Record<string, EffectPixels> = {};\n\t\tfor (const input of d.inputs) if (input.kind === 'image') inputs[input.name] = effectSamplePicture(size.width, size.height, input.name === 'to' ? 1 : 0);\n\t\treturn await renderer.render({ time, inputs, ...(d.uses.includes('transition') ? { progress: 0.5 } : {}) });\n\t} finally {\n\t\trenderer.dispose();\n\t}\n}\n\n/** Effects grouped by category, categories in first-seen order. */\nexport function groupEffectsByCategory<T extends EffectSummary>(effects: readonly T[]): { category: string; effects: T[] }[] {\n\tconst groups = new Map<string, T[]>();\n\tfor (const e of effects) {\n\t\tconst g = groups.get(e.category);\n\t\tif (g) g.push(e);\n\t\telse groups.set(e.category, [e]);\n\t}\n\treturn [...groups].map(([category, list]) => ({ category, effects: list }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,SAAS,CAAC,MAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,aAAa,QAAQ,WAAW,EAAE,IAAI,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAE7H,eAAe,YAAY,MAAc,KAA4C;AACpF,MAAI;AACH,UAAM,IAAI;AACV,WAAO,0BAA0B,IAAI;AAAA,EACtC,SAAS,GAAG;AACX,UAAM,MAAM,OAAO,CAAC;AACpB,WAAO,QAAQ,OAAO,OAAO,eAAe,GAAG,cAAc,IAAI;AAAA,EAClE;AACD;AAEA,SAAS,aAAa,GAAkB,QAAkC;AACzE,QAAM,KAAK,CAAC,YAAoB,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,QAAQ,CAAC;AACvE,MAAI,CAAC,EAAE,MAAM,OAAO,EAAE,OAAO,SAAU,IAAG,mBAAmB;AAC7D,MAAI,CAAC,EAAE,KAAM,IAAG,qBAAqB;AACrC,MAAI,CAAC,aAAa,SAAS,EAAE,IAAI,EAAG,IAAG,SAAS,EAAE,IAAI,mBAAmB,aAAa,KAAK,IAAI,CAAC,EAAE;AAClG,MAAI,CAAC,EAAE,SAAU,IAAG,yBAAyB;AAC7C,MAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,KAAK,CAAC,EAAE,KAAK,OAAQ,IAAG,qBAAqB;AACtE,aAAW,KAAK,EAAE,QAAQ,CAAC,EAAG,KAAI,CAAC,YAAY,SAAS,CAAC,EAAG,IAAG,QAAQ,CAAC,mBAAmB,YAAY,K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AQ;AAC/B,QAAI,EAAG,GAAE,KAAK,CAAC;AAAA,QACV,QAAO,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;AAAA,EAChC;AACA,SAAO,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC,CAAC,UAAU,IAAI,OAAO,EAAE,UAAU,SAAS,KAAK,EAAE;AAC3E;","names":["input","HEX","input"]}
@@ -805,14 +805,12 @@ var _chunk643B2HKCcjs = require('../chunk-643B2HKC.cjs');
805
805
  var _chunkQQKTOA4Ucjs = require('../chunk-QQKTOA4U.cjs');
806
806
 
807
807
 
808
- var _chunkQDJKUBWEcjs = require('../chunk-QDJKUBWE.cjs');
809
808
 
810
809
 
811
810
 
812
811
 
813
812
 
814
-
815
- var _chunkIOXKXQNWcjs = require('../chunk-IOXKXQNW.cjs');
813
+ var _chunkJODTP4DPcjs = require('../chunk-JODTP4DP.cjs');
816
814
  require('../chunk-N3FVUOZD.cjs');
817
815
  require('../chunk-GUZ47CJM.cjs');
818
816
  require('../chunk-RIWPYSKU.cjs');
@@ -2799,7 +2797,7 @@ function checkImageEffectPlace(d, place) {
2799
2797
  const allowed = IMAGE_EFFECT_PLACES[place];
2800
2798
  if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
2801
2799
  const instead = place === "filter" && d.uses.some((u) => IMAGE_EFFECT_PLACES.layer.includes(u)) ? "; add it as an effect layer with add_effect_layer instead" : place === "layer" && d.uses.includes("filter") ? "; apply it to a layer as a smart filter with apply_effect instead" : "";
2802
- throw new (0, _chunkIOXKXQNWcjs.EffectUnsupportedError)(
2800
+ throw new (0, _chunkJODTP4DPcjs.EffectUnsupportedError)(
2803
2801
  `"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect, and ${place === "filter" ? "a smart filter takes filter effects" : "an effect layer takes generator, overlay or title effects"}${instead}.`,
2804
2802
  d.id
2805
2803
  );
@@ -2823,9 +2821,9 @@ function effectPixelsToSurface(p, depth) {
2823
2821
  const d = new Uint16Array(f.length);
2824
2822
  const code = (v) => v > 0 ? v < 1 ? Math.round(v * 65535) : 65535 : 0;
2825
2823
  for (let i = 0; i < f.length; i += 4) {
2826
- d[i] = code(_chunkIOXKXQNWcjs.linearToSrgb.call(void 0, f[i]));
2827
- d[i + 1] = code(_chunkIOXKXQNWcjs.linearToSrgb.call(void 0, f[i + 1]));
2828
- d[i + 2] = code(_chunkIOXKXQNWcjs.linearToSrgb.call(void 0, f[i + 2]));
2824
+ d[i] = code(_chunkJODTP4DPcjs.linearToSrgb.call(void 0, f[i]));
2825
+ d[i + 1] = code(_chunkJODTP4DPcjs.linearToSrgb.call(void 0, f[i + 1]));
2826
+ d[i + 2] = code(_chunkJODTP4DPcjs.linearToSrgb.call(void 0, f[i + 2]));
2829
2827
  d[i + 3] = code(f[i + 3]);
2830
2828
  }
2831
2829
  return _chunkJ5BA3BQ6cjs.surfaceFromDeepPixels.call(void 0, { width: p.width, height: p.height, data: d }, 4);
@@ -2842,7 +2840,7 @@ var ImageEffectsEngine = (_class4 = class {
2842
2840
  __init31() {this.generation = 0}
2843
2841
 
2844
2842
  constructor(options = {}) {;_class4.prototype.__init26.call(this);_class4.prototype.__init27.call(this);_class4.prototype.__init28.call(this);_class4.prototype.__init29.call(this);_class4.prototype.__init30.call(this);_class4.prototype.__init31.call(this);
2845
- this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkIOXKXQNWcjs.EffectsSlot)()));
2843
+ this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkJODTP4DPcjs.EffectsSlot)()));
2846
2844
  this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 24));
2847
2845
  this.pool = new (0, _chunkW6QTLHZ3cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
2848
2846
  this.detach = this.slot.subscribe(() => {
@@ -2902,7 +2900,7 @@ var ImageEffectsEngine = (_class4 = class {
2902
2900
  const provider = this.slot.require();
2903
2901
  const depth = _nullishCoalesce(size.depth, () => ( 8));
2904
2902
  const out = await this.render(provider, effect, size.width, size.height, depth, { time: _nullishCoalesce(size.time, () => ( 0)), values });
2905
- return out.width === size.width && out.height === size.height ? out : _chunkIOXKXQNWcjs.createEffectPixels.call(void 0, size.width, size.height);
2903
+ return out.width === size.width && out.height === size.height ? out : _chunkJODTP4DPcjs.createEffectPixels.call(void 0, size.width, size.height);
2906
2904
  }
2907
2905
  /** Why the result for `key` failed, if it did. */
2908
2906
  failure(key) {
@@ -4066,7 +4064,7 @@ var ImageEditorController = (_class7 = class {
4066
4064
  /** For `compositePixels` and mask evaluation (the renderer keeps its own for the viewport). */
4067
4065
  __init64() {this.compositor = new (0, _chunkO5RVCDECcjs.LayerCompositor)()}
4068
4066
  /** The effects provider slot (see `setEffectsProvider`). */
4069
- __init65() {this.effects = new (0, _chunkIOXKXQNWcjs.EffectsSlot)()}
4067
+ __init65() {this.effects = new (0, _chunkJODTP4DPcjs.EffectsSlot)()}
4070
4068
  /** Renders provider effects: effect smart filter results and effect layers. */
4071
4069
  __init66() {this.effectsEngine = new ImageEffectsEngine({ slot: this.effects })}
4072
4070
  __init67() {this.effectRefresh = "none"}
@@ -4291,7 +4289,7 @@ var ImageEditorController = (_class7 = class {
4291
4289
  */
4292
4290
  async applyEffectFilter(layerId, effect, options = {}) {
4293
4291
  const d = await this.describeEffect(effect, "filter");
4294
- const values = _chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, d, options.values);
4292
+ const values = _chunkJODTP4DPcjs.resolveEffectValues.call(void 0, d, options.values);
4295
4293
  const found = _chunkMZXQTKUMcjs.findLayer.call(void 0, this.state.layers, layerId);
4296
4294
  if (!found) throw new (0, _chunkO5RVCDECcjs.LayerOperationError)(`There is no layer "${layerId}"; call list_layers for the layer ids.`);
4297
4295
  let layers = this.state.layers;
@@ -4329,7 +4327,7 @@ var ImageEditorController = (_class7 = class {
4329
4327
  else if (k in d.controls.properties) base[k] = d.defaults[k];
4330
4328
  else throw new (0, _chunkO5RVCDECcjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
4331
4329
  }
4332
- update.values = { ...base, ..._chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4330
+ update.values = { ...base, ..._chunkJODTP4DPcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4333
4331
  }
4334
4332
  for (const k of ["enabled", "blend", "opacity"]) if (changes[k] !== void 0) update[k] = changes[k];
4335
4333
  let res = _chunkO5RVCDECcjs.updateSmartFilter.call(void 0, this.state.layers, layerId, filterId, update, this.canvasSize);
@@ -4344,7 +4342,7 @@ var ImageEditorController = (_class7 = class {
4344
4342
  */
4345
4343
  async addEffectLayer(effect, options = {}) {
4346
4344
  const d = await this.describeEffect(effect, "layer");
4347
- const values = _chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, d, options.values);
4345
+ const values = _chunkJODTP4DPcjs.resolveEffectValues.call(void 0, d, options.values);
4348
4346
  const { width, height } = this.naturalSize;
4349
4347
  const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time: options.time });
4350
4348
  const blend = _chunkO5RVCDECcjs.parseBlend.call(void 0, options.blend);
@@ -4387,7 +4385,7 @@ var ImageEditorController = (_class7 = class {
4387
4385
  else if (k in d.controls.properties) base[k] = d.defaults[k];
4388
4386
  else throw new (0, _chunkO5RVCDECcjs.LayerOperationError)(`"${k}" is not a control of "${d.id}"; its controls are ${Object.keys(d.controls.properties).join(", ")}.`);
4389
4387
  }
4390
- const values = { ...base, ..._chunkIOXKXQNWcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4388
+ const values = { ...base, ..._chunkJODTP4DPcjs.resolveEffectValues.call(void 0, { ...d, defaults: base }, given) };
4391
4389
  const time = _nullishCoalesce(_nullishCoalesce(changes.time, () => ( g.time)), () => ( 0));
4392
4390
  const { width, height } = this.naturalSize;
4393
4391
  const pixels = await this.effectsEngine.renderLayer(d.id, values, { width, height, depth: this.bitDepth, time });
@@ -14713,7 +14711,7 @@ function createImageEffectsToolProvider(controller, options = {}) {
14713
14711
  return { target, effect: _nullishCoalesce(effects.find((e) => e.id === instance), () => ( effects[effects.length - 1])), effects, ...extra };
14714
14712
  };
14715
14713
  const plainValues = (v) => v;
14716
- return _chunkQDJKUBWEcjs.createEffectToolProvider.call(void 0, {
14714
+ return _chunkJODTP4DPcjs.createEffectToolProvider.call(void 0, {
14717
14715
  id: _nullishCoalesce(options.id, () => ( "image-effects")),
14718
14716
  namespace: options.namespace,
14719
14717
  target: { noun: "layer", id: "A layer id from list_layers." },