@pixerate/editor 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/dist/HistoryManager-DWSLd6Tf.d.ts +150 -0
- package/dist/HistoryManager-DeQQMBCj.d.cts +150 -0
- package/dist/agent/index.cjs +20 -427
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +4 -342
- package/dist/agent/index.d.ts +4 -342
- package/dist/agent/index.js +14 -421
- package/dist/agent/index.js.map +1 -1
- package/dist/animation/index.d.cts +3 -73
- package/dist/animation/index.d.ts +3 -73
- package/dist/{builtins-nMXh9sT3.d.cts → builtins-DxC3aUR2.d.cts} +2 -2
- package/dist/{builtins-haN82vjT.d.ts → builtins-NGxNxQfJ.d.ts} +2 -2
- package/dist/canvas/index.d.cts +5 -3
- package/dist/canvas/index.d.ts +5 -3
- package/dist/chunk-36BLROHV.js +438 -0
- package/dist/chunk-36BLROHV.js.map +1 -0
- package/dist/{chunk-OYEFRO3D.cjs → chunk-6MDQKHRH.cjs} +4 -4
- package/dist/{chunk-OYEFRO3D.cjs.map → chunk-6MDQKHRH.cjs.map} +1 -1
- package/dist/{chunk-ARRTP33I.js → chunk-D6S5M7HV.js} +2 -2
- package/dist/{chunk-ARRTP33I.js.map → chunk-D6S5M7HV.js.map} +1 -1
- package/dist/{chunk-MXZJ4PKN.js → chunk-DDADOHJW.js} +8 -8
- package/dist/{chunk-CPOKFNBG.cjs → chunk-I6BZB5ZH.cjs} +2 -2
- package/dist/{chunk-CPOKFNBG.cjs.map → chunk-I6BZB5ZH.cjs.map} +1 -1
- package/dist/chunk-PIIAZV3L.cjs +244 -0
- package/dist/chunk-PIIAZV3L.cjs.map +1 -0
- package/dist/{chunk-G2I4QJOT.cjs → chunk-QKLRAA4T.cjs} +3 -244
- package/dist/chunk-QKLRAA4T.cjs.map +1 -0
- package/dist/{chunk-2H7ZHPEJ.js → chunk-QVZZGT4X.js} +1 -242
- package/dist/chunk-QVZZGT4X.js.map +1 -0
- package/dist/chunk-V7CC7RZ6.cjs +438 -0
- package/dist/chunk-V7CC7RZ6.cjs.map +1 -0
- package/dist/chunk-YK57D7PW.js +244 -0
- package/dist/chunk-YK57D7PW.js.map +1 -0
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +2 -2
- package/dist/commands/index.d.ts +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/easing-B6iAnJHk.d.cts +74 -0
- package/dist/easing-B6iAnJHk.d.ts +74 -0
- package/dist/extensions/index.cjs +5 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +9 -9
- package/dist/generation/index.cjs +2 -2
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.js +1 -1
- package/dist/generation/index.js.map +1 -1
- package/dist/history/index.cjs +4 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +3 -149
- package/dist/history/index.d.ts +3 -149
- package/dist/history/index.js +5 -3
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +15 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +22 -20
- package/dist/index.js.map +1 -1
- package/dist/parameters/index.cjs +1283 -0
- package/dist/parameters/index.cjs.map +1 -0
- package/dist/parameters/index.d.cts +595 -0
- package/dist/parameters/index.d.ts +595 -0
- package/dist/parameters/index.js +1283 -0
- package/dist/parameters/index.js.map +1 -0
- package/dist/tools/index.cjs +31 -0
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +343 -0
- package/dist/tools/index.d.ts +343 -0
- package/dist/tools/index.js +31 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/{types-GT5a5YAX.d.cts → types-DsiXGmjo.d.cts} +1 -1
- package/dist/{types-GT5a5YAX.d.ts → types-DsiXGmjo.d.ts} +1 -1
- package/package.json +11 -1
- package/dist/chunk-2H7ZHPEJ.js.map +0 -1
- package/dist/chunk-G2I4QJOT.cjs.map +0 -1
- /package/dist/{chunk-MXZJ4PKN.js.map → chunk-DDADOHJW.js.map} +0 -0
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as CommandRegistry, P as Platform, b as CommandResult, c as CommandEntry, K as KeyboardEventLike, C as CommandSpec } from '../registry-DhVUZioj.js';
|
|
2
2
|
export { d as Chord, e as CommandErrorCode, f as CommandHistoryTarget, g as CommandListOptions, h as CommandParamsSchema, i as CommandRegistryError, j as CommandRegistryOptions, E as EffectiveChord, k as PLATFORMS, S as ShortcutBinding, l as ShortcutConflict, m as ShortcutInput, n as ShortcutMap, o as ShortcutMapOptions, p as ShortcutMatch, q as ShortcutResolveOptions, r as chordToString, s as codeFromKey, t as codeToKeyText, u as createCommandRegistry, v as defineCommand, w as detectPlatform, x as effectiveChord, y as effectiveChordKey, z as eventCode, A as formatShortcut, B as isEditableEventTarget, D as keyToCode, F as normalizeChord, G as parseChord, H as shortcutCode, I as toShortcutBindings } from '../registry-DhVUZioj.js';
|
|
3
3
|
import { A as AgentToolProvider } from '../registry-BDe-vlv3.js';
|
|
4
|
-
export { A as ArrangeCommandOptions, a as ArrangeCommandTarget,
|
|
4
|
+
export { A as ArrangeCommandOptions, a as ArrangeCommandTarget, b as ComponentCommandOptions, C as ComponentCommandTarget, D as DEFAULT_HISTORY_SHORTCUTS, H as HistoryCommandOptions, c as HistoryCommandTarget, S as ShapeCommandOptions, d as ShapeCommandTarget, e as SpreadsheetCommandOptions, f as SpreadsheetCommandTarget, g as createArrangeCommands, h as createComponentCommands, i as createHistoryCommands, j as createShapeCommands, k as createSpreadsheetCommands, l as hasVariantCommands, m as matchHistoryShortcut } from '../builtins-NGxNxQfJ.js';
|
|
5
5
|
import '../schema-DYDGdYL9.js';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-DsiXGmjo.js';
|
|
7
7
|
import '../arrange-BICutYPk.js';
|
|
8
8
|
|
|
9
9
|
/** The fields `rankCommands` searches (a `CommandEntry` satisfies it). */
|
package/dist/commands/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/registry.ts","../../src/commands/palette.ts","../../src/commands/paletteController.ts","../../src/commands/agentTools.ts","../../src/commands/animation.ts"],"sourcesContent":["// Portions ported from filmcraft-main/crates/engine/src/commands.rs and crates/engine/src/lib.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\nimport { validateJsonSchema, type JsonSchema, type SchemaValidationError } from '../agent/schema.js';\nimport type { KeyboardEventLike, Platform } from './chords.js';\nimport {\n\tShortcutMap,\n\ttoShortcutBindings,\n\ttype ShortcutInput,\n\ttype ShortcutMapOptions,\n\ttype ShortcutResolveOptions\n} from './shortcuts.js';\n\n/** Object JSON Schema describing a command's parameters. */\nexport type CommandParamsSchema = JsonSchema & { type: 'object' };\n\n/**\n * Metadata and implementation of one command. Menus, shortcuts, the palette and agent\n * tools all run commands by id, so every entry point shares enablement and validation.\n */\nexport interface CommandSpec<TContext = any, TParams = any, TResult = unknown> {\n\t/** Unique id, e.g. `history.undo` or `canvas.alignLeft`. */\n\tid: string;\n\tlabel: string;\n\t/** Group / menu name shown next to the label, e.g. `Edit` or `Arrange`. */\n\tgroup?: string;\n\t/** Extra search terms for the palette. */\n\tkeywords?: readonly string[];\n\tdescription?: string;\n\t/** Object JSON Schema for `params`. Unknown keys are rejected unless `additionalProperties` allows them. */\n\tparams?: CommandParamsSchema;\n\t/** Default shortcut(s): platform-neutral chord text such as `Mod+Shift+Z`. */\n\tshortcut?: ShortcutInput;\n\t/** Scope the command (and its shortcuts) belong to, e.g. `canvas`. Omit for global commands. */\n\tscope?: string;\n\t/**\n\t * Whether the command can run: `true` (or `undefined`), `false`, or a reason string\n\t * (\"Nothing to undo\"). Receives the params a caller named, so a command acting on the\n\t * selection can still run on targets passed explicitly (`params` is `undefined` for menus).\n\t */\n\tenabled?: (context: TContext, params: TParams | undefined) => boolean | string | undefined;\n\trun: (context: TContext, params: TParams) => TResult;\n\t/**\n\t * Runs inside the registry's `history.batch(label, …)`, so all history entries the\n\t * command records become one undo step and a throw rolls back its partial changes.\n\t */\n\tundoable?: boolean;\n\t/** The command only reads state (agent tools mark it read-only). */\n\treadOnly?: boolean;\n\t/** Hide from the palette and `list()` unless `includeHidden` (still runnable by id). */\n\thidden?: boolean;\n}\n\nexport type CommandErrorCode = 'unknown_command' | 'disabled' | 'invalid_params' | 'failed';\n\nexport type CommandResult<T = unknown> =\n\t| { ok: true; id: string; result: T }\n\t| { ok: false; id: string; code: CommandErrorCode; message: string; details?: SchemaValidationError[] };\n\n/** A command as listed for menus, palettes and agents. */\nexport interface CommandEntry {\n\tid: string;\n\tlabel: string;\n\tgroup?: string;\n\tkeywords?: readonly string[];\n\tdescription?: string;\n\tparams?: CommandParamsSchema;\n\tscope?: string;\n\t/** Canonical chord text bound on the registry's platform (first = primary). */\n\tshortcuts: string[];\n\tenabled: boolean;\n\t/** Why the command is disabled (only when `enabled` is false). */\n\tdisabledReason?: string;\n\tundoable: boolean;\n\treadOnly: boolean;\n}\n\nexport interface CommandListOptions<TContext = any> {\n\t/** Only global commands plus commands of these scopes. */\n\tscope?: string | readonly string[];\n\tenabledOnly?: boolean;\n\tincludeHidden?: boolean;\n\t/** Context for the enablement check (default: the registry's context). */\n\tcontext?: TContext;\n}\n\n/** Minimal history surface (`HistoryManager` satisfies it). */\nexport interface CommandHistoryTarget {\n\tbatch(name: string, fn: () => void): void;\n}\n\nexport interface CommandRegistryOptions<TContext = any> {\n\t/** Default context passed to `enabled` / `run` (a value or a getter). */\n\tcontext?: TContext | (() => TContext);\n\t/** Wraps `undoable` commands in one history step (see `CommandSpec.undoable`). */\n\thistory?: CommandHistoryTarget;\n\t/** Options for the registry's `ShortcutMap`. */\n\tshortcuts?: ShortcutMapOptions;\n}\n\nexport class CommandRegistryError extends Error {\n\treadonly code: 'duplicate_command' | 'invalid_command';\n\n\tconstructor(code: CommandRegistryError['code'], message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'CommandRegistryError';\n\t\tthis.code = code;\n\t}\n}\n\nconst COMMAND_ID_REGEX = /^[A-Za-z0-9_.:-]{1,128}$/;\n\ninterface Registered {\n\tspec: CommandSpec;\n\tunbind: () => void;\n}\n\nfunction enablement(result: boolean | string | undefined): { enabled: boolean; reason?: string } {\n\tif (result === undefined || result === true) return { enabled: true };\n\tif (result === false) return { enabled: false, reason: 'This command is not available right now.' };\n\treturn { enabled: false, reason: String(result) };\n}\n\n/** Errors for params the command does not accept, naming the accepted keys. */\nfunction unknownParams(spec: CommandSpec, params: Record<string, unknown>): string | null {\n\tconst keys = Object.keys(params).filter((k) => params[k] !== undefined);\n\tif (keys.length === 0) return null;\n\tconst schema = spec.params;\n\tif (schema && schema.additionalProperties !== undefined && schema.additionalProperties !== false) return null;\n\tconst accepted = Object.keys(schema?.properties ?? {});\n\tconst bad = keys.find((k) => !accepted.includes(k));\n\tif (!bad) return null;\n\treturn `Unknown parameter \"${bad}\" for command \"${spec.id}\"; expected ${\n\t\taccepted.length ? accepted.map((k) => `\"${k}\"`).join(', ') : 'no parameters'\n\t}.`;\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n\t!!value && (typeof value === 'object' || typeof value === 'function') && typeof (value as any).then === 'function';\n\n/**\n * Registry of commands: one id per action, shared by shortcuts (`shortcuts`), the\n * command palette (`list` + `rankCommands`) and agent tools (`createCommandToolProvider`).\n */\nexport class CommandRegistry<TContext = any> {\n\t/** Shortcut bindings of the registered commands (plus any user overrides). */\n\treadonly shortcuts: ShortcutMap;\n\n\tprivate readonly commands = new Map<string, Registered>();\n\tprivate readonly listeners = new Set<() => void>();\n\tprivate readonly options: CommandRegistryOptions<TContext>;\n\tprivate version = 0;\n\t// Set while register/unregister change the shortcut map, so they notify once.\n\tprivate muted = false;\n\n\tconstructor(options: CommandRegistryOptions<TContext> = {}) {\n\t\tthis.options = options;\n\t\tthis.shortcuts = new ShortcutMap([], options.shortcuts);\n\t\tthis.shortcuts.subscribe(() => {\n\t\t\tif (!this.muted) this.notify();\n\t\t});\n\t}\n\n\t/** Monotonic counter bumped on every change (useful as a snapshot key). */\n\tgetVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/** The default context. */\n\tget context(): TContext {\n\t\tconst ctx = this.options.context;\n\t\treturn (typeof ctx === 'function' ? (ctx as () => TContext)() : ctx) as TContext;\n\t}\n\n\t/**\n\t * Registers a command (or several) and returns a function that unregisters it.\n\t * Throws a `CommandRegistryError` for a duplicate or invalid id, or invalid chord text.\n\t */\n\tregister(spec: CommandSpec<TContext> | readonly CommandSpec<TContext>[]): () => void {\n\t\tconst specs = (Array.isArray(spec) ? spec : [spec]) as CommandSpec<TContext>[];\n\t\tconst seen = new Set<string>();\n\t\tfor (const s of specs) {\n\t\t\tif (!s || typeof s.id !== 'string' || !COMMAND_ID_REGEX.test(s.id)) {\n\t\t\t\tthrow new CommandRegistryError('invalid_command', `Invalid command id \"${s?.id}\".`);\n\t\t\t}\n\t\t\tif (typeof s.run !== 'function') {\n\t\t\t\tthrow new CommandRegistryError('invalid_command', `Command \"${s.id}\" has no run function.`);\n\t\t\t}\n\t\t\tif (this.commands.has(s.id) || seen.has(s.id)) {\n\t\t\t\tthrow new CommandRegistryError('duplicate_command', `Command \"${s.id}\" is already registered.`);\n\t\t\t}\n\t\t\tseen.add(s.id);\n\t\t}\n\t\t// Parse every chord before registering anything, so a bad shortcut registers nothing.\n\t\tconst bindings = specs.map((s) => toShortcutBindings(s.id, s.shortcut, s.scope));\n\t\tconst unbinds: Array<() => void> = [];\n\t\tthis.muted = true;\n\t\ttry {\n\t\t\tfor (const b of bindings) unbinds.push(this.shortcuts.bind(b));\n\t\t} catch (error) {\n\t\t\tunbinds.forEach((u) => u());\n\t\t\tthrow new CommandRegistryError('invalid_command', error instanceof Error ? error.message : String(error));\n\t\t} finally {\n\t\t\tthis.muted = false;\n\t\t}\n\t\tspecs.forEach((s, i) => this.commands.set(s.id, { spec: s, unbind: unbinds[i] }));\n\t\tthis.notify();\n\t\tlet registered = true;\n\t\treturn () => {\n\t\t\tif (!registered) return;\n\t\t\tregistered = false;\n\t\t\tlet changed = false;\n\t\t\tfor (const s of specs) {\n\t\t\t\tconst entry = this.commands.get(s.id);\n\t\t\t\tif (entry && entry.spec === s) {\n\t\t\t\t\tthis.commands.delete(s.id);\n\t\t\t\t\tthis.unbindQuietly(entry);\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (changed) this.notify();\n\t\t};\n\t}\n\n\t/** Removes a command by id. Returns whether it was registered. */\n\tunregister(id: string): boolean {\n\t\tconst entry = this.commands.get(id);\n\t\tif (!entry) return false;\n\t\tthis.commands.delete(id);\n\t\tthis.unbindQuietly(entry);\n\t\tthis.notify();\n\t\treturn true;\n\t}\n\n\tprivate unbindQuietly(entry: Registered) {\n\t\tthis.muted = true;\n\t\ttry {\n\t\t\tentry.unbind();\n\t\t} finally {\n\t\t\tthis.muted = false;\n\t\t}\n\t}\n\n\thas(id: string): boolean {\n\t\treturn this.commands.has(id);\n\t}\n\n\tget(id: string): CommandSpec<TContext> | undefined {\n\t\treturn this.commands.get(id)?.spec;\n\t}\n\n\t/** Registered ids in registration order. */\n\tids(): string[] {\n\t\treturn [...this.commands.keys()];\n\t}\n\n\t/** Whether `id` can run now (`{ enabled, reason }`); `params` are the targets a caller named. */\n\tisEnabled(id: string, params?: unknown, context: TContext = this.context): { enabled: boolean; reason?: string } {\n\t\tconst spec = this.get(id);\n\t\tif (!spec) return { enabled: false, reason: `Unknown command \"${id}\".` };\n\t\tif (!spec.enabled) return { enabled: true };\n\t\ttry {\n\t\t\treturn enablement(spec.enabled(context, params as any));\n\t\t} catch (error) {\n\t\t\treturn { enabled: false, reason: error instanceof Error ? error.message : String(error) };\n\t\t}\n\t}\n\n\t/** Commands for menus, palettes and agents, with their current enablement. */\n\tlist(options: CommandListOptions<TContext> = {}): CommandEntry[] {\n\t\tconst scopes = options.scope === undefined ? null : typeof options.scope === 'string' ? [options.scope] : options.scope;\n\t\tconst context = 'context' in options ? (options.context as TContext) : this.context;\n\t\tconst platform = this.shortcuts.platform;\n\t\tconst out: CommandEntry[] = [];\n\t\tfor (const { spec } of this.commands.values()) {\n\t\t\tif (spec.hidden && !options.includeHidden) continue;\n\t\t\tif (scopes && spec.scope !== undefined && !scopes.includes(spec.scope)) continue;\n\t\t\tconst { enabled, reason } = this.isEnabled(spec.id, undefined, context);\n\t\t\tif (options.enabledOnly && !enabled) continue;\n\t\t\tout.push({\n\t\t\t\tid: spec.id,\n\t\t\t\tlabel: spec.label,\n\t\t\t\t...(spec.group !== undefined ? { group: spec.group } : {}),\n\t\t\t\t...(spec.keywords ? { keywords: spec.keywords } : {}),\n\t\t\t\t...(spec.description !== undefined ? { description: spec.description } : {}),\n\t\t\t\t...(spec.params ? { params: spec.params } : {}),\n\t\t\t\t...(spec.scope !== undefined ? { scope: spec.scope } : {}),\n\t\t\t\tshortcuts: this.shortcuts.forCommand(spec.id, platform),\n\t\t\t\tenabled,\n\t\t\t\t...(enabled ? {} : { disabledReason: reason }),\n\t\t\t\tundoable: !!spec.undoable,\n\t\t\t\treadOnly: !!spec.readOnly\n\t\t\t});\n\t\t}\n\t\treturn out;\n\t}\n\n\tprivate check(id: string, params: unknown, context: TContext): CommandResult<never> | { spec: CommandSpec<TContext>; params: any } {\n\t\tconst spec = this.get(id);\n\t\tif (!spec) return { ok: false, id, code: 'unknown_command', message: `Unknown command \"${id}\".` };\n\t\tconst input = params ?? {};\n\t\tif (typeof input !== 'object' || Array.isArray(input)) {\n\t\t\treturn { ok: false, id, code: 'invalid_params', message: `Parameters for command \"${id}\" must be an object.` };\n\t\t}\n\t\tconst unknown = unknownParams(spec, input as Record<string, unknown>);\n\t\tif (unknown) return { ok: false, id, code: 'invalid_params', message: unknown };\n\t\tif (spec.params) {\n\t\t\tconst details = validateJsonSchema(input, spec.params);\n\t\t\tif (details.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tid,\n\t\t\t\t\tcode: 'invalid_params',\n\t\t\t\t\tmessage: `Invalid parameters for command \"${id}\": ${details.map((d) => `${d.path} ${d.message}`).join('; ')}`,\n\t\t\t\t\tdetails\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconst { enabled, reason } = this.isEnabled(id, params === undefined ? undefined : input, context);\n\t\tif (!enabled) return { ok: false, id, code: 'disabled', message: reason ?? 'Disabled.' };\n\t\treturn { spec, params: input };\n\t}\n\n\tprivate invoke(spec: CommandSpec<TContext>, params: any, context: TContext): unknown {\n\t\tconst history = this.options.history;\n\t\tif (!spec.undoable || !history) return spec.run(context, params);\n\t\tlet value: unknown;\n\t\t// `batch` rolls back already-recorded steps and rethrows when `run` throws.\n\t\thistory.batch(spec.label, () => {\n\t\t\tvalue = spec.run(context, params);\n\t\t});\n\t\treturn value;\n\t}\n\n\t/**\n\t * Runs a command synchronously and returns a structured result; never throws.\n\t * A command whose `run` returns a promise yields `{ ok: true, result: promise }`\n\t * (use `executeAsync` to await it and catch its rejection).\n\t */\n\texecute<T = unknown>(id: string, params?: unknown, context: TContext = this.context): CommandResult<T> {\n\t\tconst checked = this.check(id, params, context);\n\t\tif ('ok' in checked) return checked;\n\t\ttry {\n\t\t\tconst result = this.invoke(checked.spec, checked.params, context);\n\t\t\tthis.notify();\n\t\t\treturn { ok: true, id, result: result as T };\n\t\t} catch (error) {\n\t\t\tthis.notify();\n\t\t\treturn { ok: false, id, code: 'failed', message: error instanceof Error ? error.message : String(error) };\n\t\t}\n\t}\n\n\t/** Like `execute`, but awaits async commands (rejections become `failed` results). */\n\tasync executeAsync<T = unknown>(id: string, params?: unknown, context: TContext = this.context): Promise<CommandResult<T>> {\n\t\tconst outcome = this.execute<T>(id, params, context);\n\t\tif (!outcome.ok || !isThenable(outcome.result)) return outcome;\n\t\ttry {\n\t\t\tconst result = await outcome.result;\n\t\t\tthis.notify();\n\t\t\treturn { ok: true, id, result: result as T };\n\t\t} catch (error) {\n\t\t\tthis.notify();\n\t\t\treturn { ok: false, id, code: 'failed', message: error instanceof Error ? error.message : String(error) };\n\t\t}\n\t}\n\n\t/**\n\t * Resolves a keydown event to a command (see `ShortcutMap.resolve`) and runs it when\n\t * enabled, calling `preventDefault()`. Disabled commands leave the event alone, so the\n\t * browser or a focused editor can still handle it. Returns the result, or `null`.\n\t */\n\thandleKeyDown(\n\t\tevent: KeyboardEventLike,\n\t\toptions: ShortcutResolveOptions & { context?: TContext } = {}\n\t): CommandResult | null {\n\t\tif (event.defaultPrevented) return null;\n\t\tconst match = this.shortcuts.resolve(event, options);\n\t\tif (!match) return null;\n\t\tconst context = 'context' in options ? (options.context as TContext) : this.context;\n\t\tif (!this.isEnabled(match.command, undefined, context).enabled) return null;\n\t\tevent.preventDefault?.();\n\t\treturn this.execute(match.command, undefined, context);\n\t}\n\n\t/** Display-ready primary shortcut of a command (`⇧⌘Z` / `Ctrl+Shift+Z`), or `undefined`. */\n\tshortcutFor(id: string, platform: Platform = this.shortcuts.platform): string | undefined {\n\t\treturn this.shortcuts.forCommand(id, platform)[0];\n\t}\n\n\t/**\n\t * Subscribes to changes: commands registered or removed, shortcut overrides, executed\n\t * commands and `invalidate()` calls (e.g. when enablement inputs change).\n\t */\n\tsubscribe(listener: () => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\t/** Tells subscribers that enablement may have changed (e.g. the selection changed). */\n\tinvalidate(): void {\n\t\tthis.notify();\n\t}\n\n\tprivate notify(): void {\n\t\tthis.version++;\n\t\tfor (const listener of Array.from(this.listeners)) {\n\t\t\ttry {\n\t\t\t\tlistener();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('[CommandRegistry] Error in listener:', error);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function createCommandRegistry<TContext = any>(options?: CommandRegistryOptions<TContext>): CommandRegistry<TContext> {\n\treturn new CommandRegistry<TContext>(options);\n}\n\n/** Identity helper that types a command spec. */\nexport function defineCommand<TContext = any, TParams = any, TResult = unknown>(\n\tspec: CommandSpec<TContext, TParams, TResult>\n): CommandSpec<TContext, TParams, TResult> {\n\treturn spec;\n}\n","// Portions ported from photocraft-main/crates/ui-egui/src/palette.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/** The fields `rankCommands` searches (a `CommandEntry` satisfies it). */\nexport interface RankableCommand {\n\tid: string;\n\tlabel: string;\n\tgroup?: string;\n\tkeywords?: readonly string[];\n\tenabled?: boolean;\n}\n\nexport interface FuzzyMatch {\n\tscore: number;\n\t/** Indices of the matched characters in the text (for highlighting). */\n\tindices: number[];\n}\n\nconst WORD_SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '›', '(']);\n\n/**\n * Subsequence fuzzy match: every query character must appear in order. Consecutive\n * matches score 8, others 1; a match at a word start adds 5; longer texts lose\n * `length / 8`. Case-insensitive. Returns `null` when the query does not match.\n */\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch | null {\n\tconst q = query.trim().toLowerCase();\n\tif (!q) return { score: 0, indices: [] };\n\tconst t = text.toLowerCase();\n\tlet score = 0;\n\tlet ti = 0;\n\tlet last = -2;\n\tconst indices: number[] = [];\n\tfor (const qc of q) {\n\t\tif (qc === ' ') continue;\n\t\tlet found = false;\n\t\twhile (ti < t.length) {\n\t\t\tif (t[ti] === qc) {\n\t\t\t\tscore += last === ti - 1 ? 8 : 1;\n\t\t\t\tif (ti === 0 || WORD_SEPARATORS.has(t[ti - 1])) score += 5;\n\t\t\t\tlast = ti;\n\t\t\t\tindices.push(ti);\n\t\t\t\tti++;\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tti++;\n\t\t}\n\t\tif (!found) return null;\n\t}\n\treturn { score: score - Math.floor(t.length / 8), indices };\n}\n\n/** `fuzzyMatch(query, text)?.score ?? null`. */\nexport function fuzzyScore(query: string, text: string): number | null {\n\treturn fuzzyMatch(query, text)?.score ?? null;\n}\n\n/**\n * Bonus that puts a command whose name is exactly the query ahead of every fuzzy match\n * (\"undo\" finds Undo before \"Undo Selection Change\"). Trailing ellipses are ignored.\n */\nexport function exactBonus(query: string, names: readonly string[]): number {\n\tconst q = query.trim().toLowerCase();\n\tif (!q) return 0;\n\treturn names.some((n) => n.replace(/(…|\\.\\.\\.)$/, '').trim().toLowerCase() === q) ? 1000 : 0;\n}\n\n/** Default number of recently run commands a palette remembers. */\nexport const DEFAULT_RECENT_LIMIT = 8;\n\n/** Moves `id` to the front of `list` (deduplicated, newest first, at most `cap`). Returns a new array. */\nexport function pushRecent(list: readonly string[], id: string, cap: number = DEFAULT_RECENT_LIMIT): string[] {\n\treturn [id, ...list.filter((x) => x !== id)].slice(0, Math.max(0, cap));\n}\n\nexport interface RankedCommand<T extends RankableCommand = RankableCommand> {\n\tentry: T;\n\tscore: number;\n\t/** Matched character indices in `entry.label` (empty when another field matched). */\n\tlabelIndices: number[];\n\t/** The entry was shown because it was run recently (empty query). */\n\trecent: boolean;\n}\n\nexport interface RankCommandsOptions {\n\t/** Recently run ids, newest first. Shown first for an empty query and boosted slightly otherwise. */\n\trecents?: readonly string[];\n\t/** Maximum number of recents shown for an empty query (default 8). */\n\trecentLimit?: number;\n\t/** Maximum number of results. */\n\tlimit?: number;\n\t/** Sort disabled commands after enabled ones (default `true`). */\n\tdisabledLast?: boolean;\n\t/** With an empty query: `all` (default) lists recents then every other command; `recents` lists only recents. */\n\temptyQuery?: 'all' | 'recents';\n}\n\n/**\n * Ranks commands for a palette query. Searches the label, `group label`, keywords and id;\n * an exact label or keyword match always wins. An empty query lists recent commands\n * first (deduplicated and capped), then the rest in their original order.\n */\nexport function rankCommands<T extends RankableCommand>(\n\tquery: string,\n\tentries: readonly T[],\n\toptions: RankCommandsOptions = {}\n): RankedCommand<T>[] {\n\tconst recents = options.recents ?? [];\n\tconst disabledLast = options.disabledLast ?? true;\n\tconst q = query.trim();\n\tlet ranked: Array<RankedCommand<T> & { order: number }>;\n\n\tif (!q) {\n\t\tconst byId = new Map(entries.map((e) => [e.id, e]));\n\t\tconst recentIds = [...new Set(recents)].filter((id) => byId.has(id)).slice(0, options.recentLimit ?? DEFAULT_RECENT_LIMIT);\n\t\tconst recentSet = new Set(recentIds);\n\t\tranked = recentIds.map((id, i) => ({ entry: byId.get(id)!, score: 1000 - i, labelIndices: [], recent: true, order: i }));\n\t\tif ((options.emptyQuery ?? 'all') === 'all') {\n\t\t\tentries.forEach((entry, i) => {\n\t\t\t\tif (!recentSet.has(entry.id)) ranked.push({ entry, score: 0, labelIndices: [], recent: false, order: recentIds.length + i });\n\t\t\t});\n\t\t}\n\t} else {\n\t\tranked = [];\n\t\tentries.forEach((entry, order) => {\n\t\t\tconst label = fuzzyMatch(q, entry.label);\n\t\t\tconst candidates: number[] = [];\n\t\t\tif (label) candidates.push(label.score);\n\t\t\tif (entry.group) {\n\t\t\t\tconst grouped = fuzzyScore(q, `${entry.group} ${entry.label}`);\n\t\t\t\tif (grouped !== null) candidates.push(grouped - 1);\n\t\t\t}\n\t\t\tfor (const keyword of entry.keywords ?? []) {\n\t\t\t\tconst s = fuzzyScore(q, keyword);\n\t\t\t\tif (s !== null) candidates.push(s - 2);\n\t\t\t}\n\t\t\tconst byId = fuzzyScore(q, entry.id);\n\t\t\tif (byId !== null) candidates.push(byId - 3);\n\t\t\tif (candidates.length === 0) return;\n\t\t\tconst recentIndex = recents.indexOf(entry.id);\n\t\t\tconst score =\n\t\t\t\tMath.max(...candidates) +\n\t\t\t\texactBonus(q, [entry.label, ...(entry.keywords ?? [])]) +\n\t\t\t\t(recentIndex >= 0 ? Math.max(1, 4 - recentIndex) : 0);\n\t\t\tranked.push({ entry, score, labelIndices: label?.indices ?? [], recent: false, order });\n\t\t});\n\t\tranked.sort((a, b) => b.score - a.score || a.entry.label.length - b.entry.label.length || a.order - b.order);\n\t}\n\n\tif (disabledLast) {\n\t\t// Stable partition: enabled first, keeping the ranking within each half.\n\t\tranked = [...ranked.filter((r) => r.entry.enabled !== false), ...ranked.filter((r) => r.entry.enabled === false)];\n\t}\n\tconst out = ranked.map(({ order: _order, ...rest }) => rest);\n\treturn options.limit !== undefined ? out.slice(0, options.limit) : out;\n}\n","import { formatShortcut, type KeyboardEventLike, type Platform } from './chords.js';\nimport { DEFAULT_RECENT_LIMIT, pushRecent, rankCommands, type RankedCommand } from './palette.js';\nimport type { CommandEntry, CommandRegistry, CommandResult } from './registry.js';\nimport { ShortcutMap } from './shortcuts.js';\n\n/** One palette row. */\nexport interface CommandPaletteItem extends RankedCommand<CommandEntry> {\n\tid: string;\n\tlabel: string;\n\tgroup?: string;\n\t/** Display-ready primary shortcut (`⇧⌘Z` / `Ctrl+Shift+Z`). */\n\tshortcut?: string;\n\tenabled: boolean;\n\tdisabledReason?: string;\n}\n\nexport interface CommandPaletteState {\n\topen: boolean;\n\tquery: string;\n\tactiveIndex: number;\n\titems: CommandPaletteItem[];\n\trecents: string[];\n\t/** Result of the last command the palette ran. */\n\tlastResult: CommandResult | null;\n}\n\nexport interface CommandPaletteOptions<TContext = any> {\n\t/** Context for enablement and runs (default: the registry's). */\n\tcontext?: TContext | (() => TContext);\n\t/** Only global commands plus these scopes. */\n\tscope?: string | readonly string[] | (() => string | readonly string[] | undefined);\n\t/** Initial recently run ids (newest first), e.g. restored from storage. */\n\trecents?: readonly string[];\n\t/** Called whenever the recents change, e.g. to persist them. */\n\tonRecentsChange?: (recents: string[]) => void;\n\trecentLimit?: number;\n\t/** Maximum rows (default 50). */\n\tlimit?: number;\n\t/** Platform for shortcut display (default: detected). */\n\tplatform?: Platform;\n\t/** Called after a command ran from the palette. */\n\tonRun?: (result: CommandResult) => void;\n}\n\n/**\n * Framework-agnostic command palette state (open, query, ranked rows, active row and\n * recents) over a `CommandRegistry`. The React hook and Svelte rune wrap it.\n */\nexport function createCommandPaletteController<TContext = any>(\n\tregistry: CommandRegistry<TContext>,\n\toptions: CommandPaletteOptions<TContext> = {}\n) {\n\tconst listeners = new Set<(state: CommandPaletteState) => void>();\n\tlet open = false;\n\tlet query = '';\n\tlet activeIndex = 0;\n\tlet recents = [...(options.recents ?? [])];\n\tlet lastResult: CommandResult | null = null;\n\tlet state: CommandPaletteState;\n\n\tconst context = (): TContext => {\n\t\tconst c = options.context;\n\t\tif (c === undefined) return registry.context;\n\t\treturn (typeof c === 'function' ? (c as () => TContext)() : c) as TContext;\n\t};\n\tconst scope = () => (typeof options.scope === 'function' ? options.scope() : options.scope);\n\n\tfunction computeItems(): CommandPaletteItem[] {\n\t\tif (!open) return [];\n\t\tconst entries = registry.list({ scope: scope(), context: context() });\n\t\tconst platform = options.platform ?? registry.shortcuts.platform;\n\t\treturn rankCommands(query, entries, {\n\t\t\trecents,\n\t\t\trecentLimit: options.recentLimit,\n\t\t\tlimit: options.limit ?? 50\n\t\t}).map((ranked) => ({\n\t\t\t...ranked,\n\t\t\tid: ranked.entry.id,\n\t\t\tlabel: ranked.entry.label,\n\t\t\t...(ranked.entry.group !== undefined ? { group: ranked.entry.group } : {}),\n\t\t\t...(ranked.entry.shortcuts[0] ? { shortcut: formatShortcut(ranked.entry.shortcuts[0], platform) } : {}),\n\t\t\tenabled: ranked.entry.enabled,\n\t\t\t...(ranked.entry.disabledReason ? { disabledReason: ranked.entry.disabledReason } : {})\n\t\t}));\n\t}\n\n\tfunction update() {\n\t\tconst items = computeItems();\n\t\tactiveIndex = items.length === 0 ? 0 : Math.min(Math.max(activeIndex, 0), items.length - 1);\n\t\tstate = { open, query, activeIndex, items, recents, lastResult };\n\t\tfor (const listener of Array.from(listeners)) listener(state);\n\t}\n\n\tstate = { open, query, activeIndex, items: [], recents, lastResult };\n\t// Follow registry changes only while someone listens (safe with React StrictMode remounts).\n\tlet unsubscribeRegistry: (() => void) | null = null;\n\tconst onRegistryChange = () => {\n\t\tif (open) update();\n\t};\n\n\tconst controller = {\n\t\tgetState: () => state,\n\t\tsubscribe(listener: (state: CommandPaletteState) => void): () => void {\n\t\t\tlisteners.add(listener);\n\t\t\tunsubscribeRegistry ??= registry.subscribe(onRegistryChange);\n\t\t\tif (open) update(); // catch up with changes made while nobody listened\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener);\n\t\t\t\tif (listeners.size === 0) {\n\t\t\t\t\tunsubscribeRegistry?.();\n\t\t\t\t\tunsubscribeRegistry = null;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tsetOpen(next: boolean) {\n\t\t\tif (next === open) return;\n\t\t\topen = next;\n\t\t\tquery = '';\n\t\t\tactiveIndex = 0;\n\t\t\tupdate();\n\t\t},\n\t\ttoggle() {\n\t\t\tcontroller.setOpen(!open);\n\t\t},\n\t\tsetQuery(next: string) {\n\t\t\tif (next === query) return;\n\t\t\tquery = next;\n\t\t\tactiveIndex = 0;\n\t\t\tupdate();\n\t\t},\n\t\tsetActiveIndex(index: number) {\n\t\t\tactiveIndex = index;\n\t\t\tupdate();\n\t\t},\n\t\t/** Moves the active row by `delta`, wrapping around. */\n\t\tmove(delta: number) {\n\t\t\tconst n = state.items.length;\n\t\t\tif (n === 0) return;\n\t\t\tactiveIndex = (((activeIndex + delta) % n) + n) % n;\n\t\t\tupdate();\n\t\t},\n\t\t/** Runs a command by id, closes the palette and records it as recent. Disabled commands do nothing. */\n\t\trun(id: string): CommandResult | null {\n\t\t\tif (!registry.isEnabled(id, undefined, context()).enabled) return null;\n\t\t\topen = false;\n\t\t\tquery = '';\n\t\t\tactiveIndex = 0;\n\t\t\trecents = pushRecent(recents, id, options.recentLimit ?? DEFAULT_RECENT_LIMIT);\n\t\t\toptions.onRecentsChange?.(recents);\n\t\t\tconst result = registry.execute(id, undefined, context());\n\t\t\tlastResult = result;\n\t\t\tupdate();\n\t\t\toptions.onRun?.(result);\n\t\t\treturn result;\n\t\t},\n\t\trunActive(): CommandResult | null {\n\t\t\tconst item = state.items[state.activeIndex];\n\t\t\treturn item ? controller.run(item.id) : null;\n\t\t},\n\t\t/**\n\t\t * Keyboard handling for the palette input: ArrowUp/ArrowDown (wrap), Home/End,\n\t\t * Enter (run the active row) and Escape (close). Returns whether it handled the key.\n\t\t */\n\t\thandleKeyDown(event: KeyboardEventLike): boolean {\n\t\t\tif (!open) return false;\n\t\t\tswitch (event.key) {\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tcontroller.move(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tcontroller.move(-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Home':\n\t\t\t\t\tcontroller.setActiveIndex(0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'End':\n\t\t\t\t\tcontroller.setActiveIndex(state.items.length - 1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tcontroller.runActive();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tcontroller.setOpen(false);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\tevent.preventDefault?.();\n\t\t\treturn true;\n\t\t},\n\t\t/** Re-reads commands and enablement. */\n\t\trefresh() {\n\t\t\tupdate();\n\t\t},\n\t\tdestroy() {\n\t\t\tunsubscribeRegistry?.();\n\t\t\tunsubscribeRegistry = null;\n\t\t\tlisteners.clear();\n\t\t}\n\t};\n\treturn controller;\n}\n\nexport type CommandPaletteController = ReturnType<typeof createCommandPaletteController>;\n\n/**\n * Matches a global \"open palette\" hotkey (e.g. `Mod+K`), also while typing in inputs.\n * Returns `true` when `event` is the hotkey.\n */\nexport function matchPaletteHotkey(event: KeyboardEventLike, hotkey: string, platform?: Platform): boolean {\n\tconst map = new ShortcutMap([{ command: 'palette', chord: hotkey, allowInEditable: true }], platform ? { platform } : {});\n\treturn map.resolve(event) !== null;\n}\n","// Portions ported from filmcraft-main/crates/automation/src/server.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\nimport type { AgentTool, AgentToolProvider, McpToolResult } from '../agent/registry.js';\nimport { rankCommands } from './palette.js';\nimport type { CommandRegistry, CommandResult } from './registry.js';\n\nexport interface CommandToolProviderOptions<TContext = any> {\n\t/** Provider id (default `commands`). */\n\tid?: string;\n\t/** Always prefix the tool names with `<namespace>__`. */\n\tnamespace?: string;\n\t/** Context for enablement and runs (default: the registry's). */\n\tcontext?: TContext | (() => TContext);\n\t/** Only expose global commands plus these scopes. */\n\tscope?: string | readonly string[];\n\t/** Commands agents may not see or run (e.g. ones that open dialogs). */\n\texclude?: (id: string) => boolean;\n}\n\nconst toJson = (value: unknown): unknown => {\n\tif (value === undefined) return null;\n\ttry {\n\t\treturn JSON.parse(JSON.stringify(value));\n\t} catch {\n\t\treturn String(value);\n\t}\n};\n\nfunction errorResult(result: Extract<CommandResult, { ok: false }>): McpToolResult {\n\treturn {\n\t\tisError: true,\n\t\tcontent: [{ type: 'text', text: `${result.code}: ${result.message}` }],\n\t\tstructuredContent: {\n\t\t\terror: { code: result.code, message: result.message, command: result.id, ...(result.details ? { details: result.details } : {}) }\n\t\t}\n\t};\n}\n\n/**\n * Exposes a `CommandRegistry` to agents through a `ToolRegistry`:\n *\n * - `list_commands {query?, enabledOnly?}`: ids, labels, params schemas, shortcuts and\n * enablement (with the reason a command is disabled).\n * - `run_command {id, params?}`: runs one command; disabled commands, unknown params and\n * failures come back as `isError` results with a `{code, message}` error.\n * - `run_commands {steps: [{id, params?}], stopOnError?}`: runs steps **in order**, each as\n * its own command (and undo step). It is not atomic: steps that succeeded before a failure\n * stay applied. For all-or-nothing behaviour, register a command that runs the steps\n * inside `HistoryManager.batch` (or mark it `undoable` on a registry with `history`).\n *\n * The id enum in `run_command`'s schema follows the registered commands, so the\n * `ToolRegistry` announces `listChanged` when commands are added or removed.\n */\nexport function createCommandToolProvider<TContext = any>(\n\tregistry: CommandRegistry<TContext>,\n\toptions: CommandToolProviderOptions<TContext> = {}\n): AgentToolProvider {\n\tconst context = (): TContext => {\n\t\tconst c = options.context;\n\t\tif (c === undefined) return registry.context;\n\t\treturn (typeof c === 'function' ? (c as () => TContext)() : c) as TContext;\n\t};\n\tconst visible = () =>\n\t\tregistry.list({ scope: options.scope, context: context() }).filter((e) => !options.exclude?.(e.id));\n\tconst allowed = (id: string) => registry.has(id) && !options.exclude?.(id) && visible().some((e) => e.id === id);\n\n\tasync function runOne(id: string, params: unknown): Promise<CommandResult> {\n\t\tif (!allowed(id)) return { ok: false, id, code: 'unknown_command', message: `Unknown command \"${id}\".` };\n\t\treturn registry.executeAsync(id, params ?? {}, context());\n\t}\n\n\tconst listCommands: AgentTool = {\n\t\tname: 'list_commands',\n\t\ttitle: 'List commands',\n\t\tdescription:\n\t\t\t'Lists the commands you can run with run_command: id, label, group, params (JSON Schema), shortcuts, and whether each is enabled now (with the reason when it is not).',\n\t\tinputSchema: {\n\t\t\ttype: 'object',\n\t\t\tproperties: {\n\t\t\t\tquery: { type: 'string', description: 'Fuzzy filter on label, keywords, group and id.' },\n\t\t\t\tenabledOnly: { type: 'boolean', description: 'Only commands that can run now (default false).' }\n\t\t\t},\n\t\t\tadditionalProperties: false\n\t\t},\n\t\tannotations: { title: 'List commands', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n\t\thandler: ({ query = '', enabledOnly = false }) => {\n\t\t\tlet entries = visible();\n\t\t\tif (enabledOnly) entries = entries.filter((e) => e.enabled);\n\t\t\tif (String(query).trim()) entries = rankCommands(String(query), entries, { disabledLast: false }).map((r) => r.entry);\n\t\t\treturn {\n\t\t\t\tcommands: entries.map((e) => ({\n\t\t\t\t\tid: e.id,\n\t\t\t\t\tlabel: e.label,\n\t\t\t\t\t...(e.group ? { group: e.group } : {}),\n\t\t\t\t\t...(e.description ? { description: e.description } : {}),\n\t\t\t\t\t...(e.params ? { params: e.params } : {}),\n\t\t\t\t\t...(e.shortcuts.length ? { shortcuts: e.shortcuts } : {}),\n\t\t\t\t\tenabled: e.enabled,\n\t\t\t\t\t...(e.disabledReason ? { disabledReason: e.disabledReason } : {}),\n\t\t\t\t\treadOnly: e.readOnly\n\t\t\t\t}))\n\t\t\t};\n\t\t}\n\t};\n\n\tconst runCommandTool = (): AgentTool => {\n\t\tconst ids = visible().map((e) => e.id);\n\t\treturn {\n\t\t\tname: 'run_command',\n\t\t\ttitle: 'Run a command',\n\t\t\tdescription:\n\t\t\t\t'Runs one command by id with optional params (see list_commands for each command\\'s params schema). Unknown params are rejected.',\n\t\t\tinputSchema: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tid: { type: 'string', description: 'Command id from list_commands.', ...(ids.length ? { enum: ids } : {}) },\n\t\t\t\t\tparams: { type: 'object', description: 'Command parameters.' }\n\t\t\t\t},\n\t\t\t\trequired: ['id'],\n\t\t\t\tadditionalProperties: false\n\t\t\t},\n\t\t\tannotations: { title: 'Run a command', readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },\n\t\t\thandler: async ({ id, params }) => {\n\t\t\t\tconst result = await runOne(String(id), params);\n\t\t\t\treturn result.ok ? { id: result.id, ok: true, result: toJson(result.result) } : errorResult(result);\n\t\t\t}\n\t\t};\n\t};\n\n\tconst runCommands: AgentTool = {\n\t\tname: 'run_commands',\n\t\ttitle: 'Run several commands',\n\t\tdescription:\n\t\t\t'Runs several commands in order: {steps: [{id, params?}], stopOnError?: true}. Each step is its own command and undo step; the batch is NOT atomic (steps before a failure stay applied). Returns {completed, failed, results: [{id, ok, result | code, message}]}.',\n\t\tinputSchema: {\n\t\t\ttype: 'object',\n\t\t\tproperties: {\n\t\t\t\tsteps: {\n\t\t\t\t\ttype: 'array',\n\t\t\t\t\tminItems: 1,\n\t\t\t\t\titems: {\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tid: { type: 'string', description: 'Command id.' },\n\t\t\t\t\t\t\tparams: { type: 'object', description: 'Command parameters.' }\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequired: ['id'],\n\t\t\t\t\t\tadditionalProperties: false\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tstopOnError: { type: 'boolean', description: 'Stop at the first failing step (default true).' }\n\t\t\t},\n\t\t\trequired: ['steps'],\n\t\t\tadditionalProperties: false\n\t\t},\n\t\tannotations: {\n\t\t\ttitle: 'Run several commands',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: true,\n\t\t\tidempotentHint: false,\n\t\t\topenWorldHint: false\n\t\t},\n\t\thandler: async ({ steps, stopOnError = true }) => {\n\t\t\tlet completed = 0;\n\t\t\tlet failed = 0;\n\t\t\tconst results: Array<Record<string, unknown>> = [];\n\t\t\tfor (const step of steps as Array<{ id: string; params?: unknown }>) {\n\t\t\t\tconst result = await runOne(step.id, step.params);\n\t\t\t\tif (result.ok) {\n\t\t\t\t\tcompleted++;\n\t\t\t\t\tresults.push({ id: result.id, ok: true, result: toJson(result.result) });\n\t\t\t\t} else {\n\t\t\t\t\tfailed++;\n\t\t\t\t\tresults.push({ id: result.id, ok: false, code: result.code, message: result.message });\n\t\t\t\t\tif (stopOnError) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst summary = { completed, failed, skipped: steps.length - completed - failed, results };\n\t\t\treturn failed > 0\n\t\t\t\t? { isError: true, content: [{ type: 'text', text: JSON.stringify(summary) }], structuredContent: summary }\n\t\t\t\t: summary;\n\t\t}\n\t};\n\n\treturn {\n\t\tid: options.id ?? 'commands',\n\t\tnamespace: options.namespace,\n\t\ttools: () => [listCommands, runCommandTool(), runCommands],\n\t\tsubscribe: (notify) => registry.subscribe(notify)\n\t};\n}\n","import type { CommandSpec } from './registry.js';\n\n/**\n * Animation controller surface used by `createCanvasAnimationCommands`\n * (`createCanvasAnimationController`, `useCanvasAnimation` and `createCanvasAnimation` satisfy it).\n */\nexport interface AnimationCommandTarget {\n\tgetState(): { playing: boolean; recording: boolean; time: number; duration: number; selection: readonly unknown[] };\n\tplay(): void;\n\tpause(): void;\n\ttoggle(): void;\n\tstop(): void;\n\tseek(time: number): void;\n\ttoggleRecording(): void;\n\taddKeyframe(ids?: Iterable<string>, keys?: readonly string[], time?: number): unknown;\n\tdeleteKeyframes(): unknown;\n\tsetEasing(easing: any, refs?: readonly any[]): unknown;\n\tnextKeyframe(): unknown;\n\tpreviousKeyframe(): unknown;\n\tanimateNode(nodeId: string, options: any): unknown;\n\texportCss(nodeId: string, options?: any): { css: string; exact: boolean };\n}\n\nexport interface AnimationCommandOptions {\n\t/** Id prefix (default `canvas.animation.`). */\n\tprefix?: string;\n\tgroup?: string;\n\t/** Scope (default `canvas`). Pass `null` for global. */\n\tscope?: string | null;\n}\n\nconst EASING_DESCRIPTION =\n\t'Easing preset (linear, ease, ease-in, ease-out, ease-in-out, ease-in-back, ease-out-back, spring, hold) or a CSS cubic-bezier(x1, y1, x2, y2).';\n\nconst VALUES = {\n\ttype: 'object',\n\tdescription: 'Property → value, e.g. {\"x\": 200, \"opacity\": 0.5, \"fill\": \"#ff0000\"}. Properties: x, y, width, height, rotation (degrees), scale, opacity (0–1), fill, stroke, strokeWidth, cornerRadius, motionPath (0–1).',\n\tadditionalProperties: { type: ['number', 'string'] }\n} as const;\n\n/**\n * Palette / shortcut / agent commands for canvas animation: play / pause, seek, add keyframe at\n * the playhead, delete keyframes, set easing, record toggle, keyframe navigation, \"animate\n * node from A to B over T\" and CSS export. Edits are undoable when the controller has a history.\n */\nexport function createCanvasAnimationCommands(controller: AnimationCommandTarget, options: AnimationCommandOptions = {}): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'canvas.animation.';\n\tconst group = options.group ?? 'Animation';\n\tconst scope = options.scope === null ? undefined : options.scope ?? 'canvas';\n\tconst base = { group, ...(scope ? { scope } : {}) };\n\tconst hasSelection = () => (controller.getState().selection.length > 0 ? true : 'Select keyframes first.');\n\treturn [\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}togglePlay`,\n\t\t\tlabel: 'Play / Pause Animation',\n\t\t\tkeywords: ['play', 'pause', 'preview', 'timeline'],\n\t\t\tdescription: 'Plays or pauses the canvas animation from the playhead.',\n\t\t\trun: () => {\n\t\t\t\tcontroller.toggle();\n\t\t\t\treturn { playing: controller.getState().playing, time: controller.getState().time };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}play`,\n\t\t\tlabel: 'Play Animation',\n\t\t\tkeywords: ['preview', 'timeline'],\n\t\t\tenabled: () => (controller.getState().playing ? 'Already playing.' : true),\n\t\t\trun: () => controller.play()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}pause`,\n\t\t\tlabel: 'Pause Animation',\n\t\t\tenabled: () => (controller.getState().playing ? true : 'Not playing.'),\n\t\t\trun: () => controller.pause()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}stop`,\n\t\t\tlabel: 'Stop Animation',\n\t\t\tkeywords: ['rewind', 'reset'],\n\t\t\tdescription: 'Stops playback and returns to the start.',\n\t\t\trun: () => controller.stop()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}seek`,\n\t\t\tlabel: 'Go to Time…',\n\t\t\tkeywords: ['playhead', 'scrub', 'time'],\n\t\t\tdescription: 'Moves the playhead.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { time: { type: 'number', minimum: 0, description: 'Time in milliseconds.' } },\n\t\t\t\trequired: ['time']\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { time: number }) => {\n\t\t\t\tcontroller.seek(params.time);\n\t\t\t\treturn { time: controller.getState().time };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}addKeyframe`,\n\t\t\tlabel: 'Add Keyframe at Playhead',\n\t\t\tkeywords: ['key', 'animate', 'record'],\n\t\t\tdescription: 'Keys the selected nodes (or `ids`) at the playhead (or `time`): their animated properties, `properties`, or position.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tids: { type: 'array', items: { type: 'string' }, description: 'Node ids (default: selected nodes).' },\n\t\t\t\t\tproperties: { type: 'array', items: { type: 'string' }, description: 'Properties to key (default: animated ones, or x and y).' },\n\t\t\t\t\ttime: { type: 'number', minimum: 0, description: 'Time in ms (default: the playhead).' }\n\t\t\t\t}\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { ids?: string[]; properties?: string[]; time?: number }) =>\n\t\t\t\tcontroller.addKeyframe(params?.ids, params?.properties, params?.time)\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}deleteKeyframes`,\n\t\t\tlabel: 'Delete Keyframes',\n\t\t\tkeywords: ['remove', 'clear'],\n\t\t\tenabled: hasSelection,\n\t\t\trun: () => controller.deleteKeyframes()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}setEasing`,\n\t\t\tlabel: 'Set Keyframe Easing…',\n\t\t\tkeywords: ['interpolation', 'ease', 'bezier', 'spring', 'hold', 'curve'],\n\t\t\tdescription: 'Sets the easing of the segments leaving the selected keyframes.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { easing: { type: 'string', description: EASING_DESCRIPTION } },\n\t\t\t\trequired: ['easing']\n\t\t\t},\n\t\t\tenabled: hasSelection,\n\t\t\trun: (_ctx: unknown, params: { easing: string }) => controller.setEasing(params.easing)\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}toggleRecord`,\n\t\t\tlabel: 'Toggle Record Mode',\n\t\t\tkeywords: ['auto key', 'record', 'keyframe'],\n\t\t\tdescription: 'In record mode, changing a property at the playhead keys it.',\n\t\t\trun: () => {\n\t\t\t\tcontroller.toggleRecording();\n\t\t\t\treturn { recording: controller.getState().recording };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}nextKeyframe`,\n\t\t\tlabel: 'Next Keyframe',\n\t\t\tkeywords: ['jump', 'navigate'],\n\t\t\trun: () => controller.nextKeyframe()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}previousKeyframe`,\n\t\t\tlabel: 'Previous Keyframe',\n\t\t\tkeywords: ['jump', 'navigate'],\n\t\t\trun: () => controller.previousKeyframe()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}animateNode`,\n\t\t\tlabel: 'Animate Node…',\n\t\t\tkeywords: ['tween', 'transition', 'move', 'fade'],\n\t\t\tdescription: 'Animates a node from `from` (default: its current values) to `to` over `duration` ms, starting at `delay` ms.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tnodeId: { type: 'string', description: 'Node to animate.' },\n\t\t\t\t\tto: VALUES,\n\t\t\t\t\tfrom: VALUES,\n\t\t\t\t\tduration: { type: 'number', exclusiveMinimum: 0, description: 'Duration in ms (default 1000).' },\n\t\t\t\t\tdelay: { type: 'number', minimum: 0, description: 'Start time in ms (default 0).' },\n\t\t\t\t\teasing: { type: 'string', description: EASING_DESCRIPTION }\n\t\t\t\t},\n\t\t\t\trequired: ['nodeId', 'to']\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { nodeId: string; to: Record<string, number | string>; from?: Record<string, number | string>; duration?: number; delay?: number; easing?: string }) =>\n\t\t\t\tcontroller.animateNode(params.nodeId, {\n\t\t\t\t\tto: params.to,\n\t\t\t\t\t...(params.from ? { from: params.from } : {}),\n\t\t\t\t\t...(params.duration !== undefined ? { duration: params.duration } : {}),\n\t\t\t\t\t...(params.delay !== undefined ? { delay: params.delay } : {}),\n\t\t\t\t\t...(params.easing !== undefined ? { easing: params.easing } : {})\n\t\t\t\t})\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}exportCss`,\n\t\t\tlabel: 'Export Animation as CSS',\n\t\t\tkeywords: ['keyframes', 'css', 'web animations'],\n\t\t\tdescription: 'Returns CSS @keyframes for a node\\'s animation.',\n\t\t\treadOnly: true,\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { nodeId: { type: 'string' } },\n\t\t\t\trequired: ['nodeId']\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { nodeId: string }) => controller.exportCss(params.nodeId)\n\t\t}\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkGO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACtC;AAAA,EAET,YAAY,MAAoC,SAAiB;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACb;AACD;AAEA,IAAM,mBAAmB;AAOzB,SAAS,WAAW,QAA6E;AAChG,MAAI,WAAW,UAAa,WAAW,KAAM,QAAO,EAAE,SAAS,KAAK;AACpE,MAAI,WAAW,MAAO,QAAO,EAAE,SAAS,OAAO,QAAQ,2CAA2C;AAClG,SAAO,EAAE,SAAS,OAAO,QAAQ,OAAO,MAAM,EAAE;AACjD;AAGA,SAAS,cAAc,MAAmB,QAAgD;AACzF,QAAM,OAAO,OAAO,KAAK,MAAM,EAAE,OAAO,CAAC,MAAM,OAAO,CAAC,MAAM,MAAS;AACtE,MAAI,KAAK,WAAW,EAAG,QAAO;AAC9B,QAAM,SAAS,KAAK;AACpB,MAAI,UAAU,OAAO,yBAAyB,UAAa,OAAO,yBAAyB,MAAO,QAAO;AACzG,QAAM,WAAW,OAAO,KAAK,QAAQ,cAAc,CAAC,CAAC;AACrD,QAAM,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,SAAS,SAAS,CAAC,CAAC;AAClD,MAAI,CAAC,IAAK,QAAO;AACjB,SAAO,sBAAsB,GAAG,kBAAkB,KAAK,EAAE,eACxD,SAAS,SAAS,SAAS,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,EA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AAgC;AAAA,UAClF,QAAQ,EAAE,MAAM,UAAU,aAAa,mBAAmB;AAAA,QAC3D;AAAA,QACA,UAAU,CAAC,UAAU,IAAI;AAAA,MAC1B;AAAA,MACA,KAAK,CAAC,MAAe,WACpB,WAAW,YAAY,OAAO,QAAQ;AAAA,QACrC,IAAI,OAAO;AAAA,QACX,GAAI,OAAO,OAAO,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC;AAAA,QAC3C,GAAI,OAAO,aAAa,SAAY,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;AAAA,QACrE,GAAI,OAAO,UAAU,SAAY,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;AAAA,QAC5D,GAAI,OAAO,WAAW,SAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,CAAC;AAAA,MAChE,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACC,GAAG;AAAA,MACH,IAAI,GAAG,MAAM;AAAA,MACb,OAAO;AAAA,MACP,UAAU,CAAC,aAAa,OAAO,gBAAgB;AAAA,MAC/C,aAAa;AAAA,MACb,UAAU;AAAA,MACV,QAAQ;AAAA,QACP,MAAM;AAAA,QACN,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,EAAE;AAAA,QACzC,UAAU,CAAC,QAAQ;AAAA,MACpB;AAAA,MACA,KAAK,CAAC,MAAe,WAA+B,WAAW,UAAU,OAAO,MAAM;AAAA,IACvF;AAAA,EACD;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/registry.ts","../../src/commands/palette.ts","../../src/commands/paletteController.ts","../../src/commands/agentTools.ts","../../src/commands/animation.ts"],"sourcesContent":["// Portions ported from filmcraft-main/crates/engine/src/commands.rs and crates/engine/src/lib.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\nimport { validateJsonSchema, type JsonSchema, type SchemaValidationError } from '../tools/schema.js';\nimport type { KeyboardEventLike, Platform } from './chords.js';\nimport {\n\tShortcutMap,\n\ttoShortcutBindings,\n\ttype ShortcutInput,\n\ttype ShortcutMapOptions,\n\ttype ShortcutResolveOptions\n} from './shortcuts.js';\n\n/** Object JSON Schema describing a command's parameters. */\nexport type CommandParamsSchema = JsonSchema & { type: 'object' };\n\n/**\n * Metadata and implementation of one command. Menus, shortcuts, the palette and agent\n * tools all run commands by id, so every entry point shares enablement and validation.\n */\nexport interface CommandSpec<TContext = any, TParams = any, TResult = unknown> {\n\t/** Unique id, e.g. `history.undo` or `canvas.alignLeft`. */\n\tid: string;\n\tlabel: string;\n\t/** Group / menu name shown next to the label, e.g. `Edit` or `Arrange`. */\n\tgroup?: string;\n\t/** Extra search terms for the palette. */\n\tkeywords?: readonly string[];\n\tdescription?: string;\n\t/** Object JSON Schema for `params`. Unknown keys are rejected unless `additionalProperties` allows them. */\n\tparams?: CommandParamsSchema;\n\t/** Default shortcut(s): platform-neutral chord text such as `Mod+Shift+Z`. */\n\tshortcut?: ShortcutInput;\n\t/** Scope the command (and its shortcuts) belong to, e.g. `canvas`. Omit for global commands. */\n\tscope?: string;\n\t/**\n\t * Whether the command can run: `true` (or `undefined`), `false`, or a reason string\n\t * (\"Nothing to undo\"). Receives the params a caller named, so a command acting on the\n\t * selection can still run on targets passed explicitly (`params` is `undefined` for menus).\n\t */\n\tenabled?: (context: TContext, params: TParams | undefined) => boolean | string | undefined;\n\trun: (context: TContext, params: TParams) => TResult;\n\t/**\n\t * Runs inside the registry's `history.batch(label, …)`, so all history entries the\n\t * command records become one undo step and a throw rolls back its partial changes.\n\t */\n\tundoable?: boolean;\n\t/** The command only reads state (agent tools mark it read-only). */\n\treadOnly?: boolean;\n\t/** Hide from the palette and `list()` unless `includeHidden` (still runnable by id). */\n\thidden?: boolean;\n}\n\nexport type CommandErrorCode = 'unknown_command' | 'disabled' | 'invalid_params' | 'failed';\n\nexport type CommandResult<T = unknown> =\n\t| { ok: true; id: string; result: T }\n\t| { ok: false; id: string; code: CommandErrorCode; message: string; details?: SchemaValidationError[] };\n\n/** A command as listed for menus, palettes and agents. */\nexport interface CommandEntry {\n\tid: string;\n\tlabel: string;\n\tgroup?: string;\n\tkeywords?: readonly string[];\n\tdescription?: string;\n\tparams?: CommandParamsSchema;\n\tscope?: string;\n\t/** Canonical chord text bound on the registry's platform (first = primary). */\n\tshortcuts: string[];\n\tenabled: boolean;\n\t/** Why the command is disabled (only when `enabled` is false). */\n\tdisabledReason?: string;\n\tundoable: boolean;\n\treadOnly: boolean;\n}\n\nexport interface CommandListOptions<TContext = any> {\n\t/** Only global commands plus commands of these scopes. */\n\tscope?: string | readonly string[];\n\tenabledOnly?: boolean;\n\tincludeHidden?: boolean;\n\t/** Context for the enablement check (default: the registry's context). */\n\tcontext?: TContext;\n}\n\n/** Minimal history surface (`HistoryManager` satisfies it). */\nexport interface CommandHistoryTarget {\n\tbatch(name: string, fn: () => void): void;\n}\n\nexport interface CommandRegistryOptions<TContext = any> {\n\t/** Default context passed to `enabled` / `run` (a value or a getter). */\n\tcontext?: TContext | (() => TContext);\n\t/** Wraps `undoable` commands in one history step (see `CommandSpec.undoable`). */\n\thistory?: CommandHistoryTarget;\n\t/** Options for the registry's `ShortcutMap`. */\n\tshortcuts?: ShortcutMapOptions;\n}\n\nexport class CommandRegistryError extends Error {\n\treadonly code: 'duplicate_command' | 'invalid_command';\n\n\tconstructor(code: CommandRegistryError['code'], message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'CommandRegistryError';\n\t\tthis.code = code;\n\t}\n}\n\nconst COMMAND_ID_REGEX = /^[A-Za-z0-9_.:-]{1,128}$/;\n\ninterface Registered {\n\tspec: CommandSpec;\n\tunbind: () => void;\n}\n\nfunction enablement(result: boolean | string | undefined): { enabled: boolean; reason?: string } {\n\tif (result === undefined || result === true) return { enabled: true };\n\tif (result === false) return { enabled: false, reason: 'This command is not available right now.' };\n\treturn { enabled: false, reason: String(result) };\n}\n\n/** Errors for params the command does not accept, naming the accepted keys. */\nfunction unknownParams(spec: CommandSpec, params: Record<string, unknown>): string | null {\n\tconst keys = Object.keys(params).filter((k) => params[k] !== undefined);\n\tif (keys.length === 0) return null;\n\tconst schema = spec.params;\n\tif (schema && schema.additionalProperties !== undefined && schema.additionalProperties !== false) return null;\n\tconst accepted = Object.keys(schema?.properties ?? {});\n\tconst bad = keys.find((k) => !accepted.includes(k));\n\tif (!bad) return null;\n\treturn `Unknown parameter \"${bad}\" for command \"${spec.id}\"; expected ${\n\t\taccepted.length ? accepted.map((k) => `\"${k}\"`).join(', ') : 'no parameters'\n\t}.`;\n}\n\nconst isThenable = (value: unknown): value is PromiseLike<unknown> =>\n\t!!value && (typeof value === 'object' || typeof value === 'function') && typeof (value as any).then === 'function';\n\n/**\n * Registry of commands: one id per action, shared by shortcuts (`shortcuts`), the\n * command palette (`list` + `rankCommands`) and agent tools (`createCommandToolProvider`).\n */\nexport class CommandRegistry<TContext = any> {\n\t/** Shortcut bindings of the registered commands (plus any user overrides). */\n\treadonly shortcuts: ShortcutMap;\n\n\tprivate readonly commands = new Map<string, Registered>();\n\tprivate readonly listeners = new Set<() => void>();\n\tprivate readonly options: CommandRegistryOptions<TContext>;\n\tprivate version = 0;\n\t// Set while register/unregister change the shortcut map, so they notify once.\n\tprivate muted = false;\n\n\tconstructor(options: CommandRegistryOptions<TContext> = {}) {\n\t\tthis.options = options;\n\t\tthis.shortcuts = new ShortcutMap([], options.shortcuts);\n\t\tthis.shortcuts.subscribe(() => {\n\t\t\tif (!this.muted) this.notify();\n\t\t});\n\t}\n\n\t/** Monotonic counter bumped on every change (useful as a snapshot key). */\n\tgetVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/** The default context. */\n\tget context(): TContext {\n\t\tconst ctx = this.options.context;\n\t\treturn (typeof ctx === 'function' ? (ctx as () => TContext)() : ctx) as TContext;\n\t}\n\n\t/**\n\t * Registers a command (or several) and returns a function that unregisters it.\n\t * Throws a `CommandRegistryError` for a duplicate or invalid id, or invalid chord text.\n\t */\n\tregister(spec: CommandSpec<TContext> | readonly CommandSpec<TContext>[]): () => void {\n\t\tconst specs = (Array.isArray(spec) ? spec : [spec]) as CommandSpec<TContext>[];\n\t\tconst seen = new Set<string>();\n\t\tfor (const s of specs) {\n\t\t\tif (!s || typeof s.id !== 'string' || !COMMAND_ID_REGEX.test(s.id)) {\n\t\t\t\tthrow new CommandRegistryError('invalid_command', `Invalid command id \"${s?.id}\".`);\n\t\t\t}\n\t\t\tif (typeof s.run !== 'function') {\n\t\t\t\tthrow new CommandRegistryError('invalid_command', `Command \"${s.id}\" has no run function.`);\n\t\t\t}\n\t\t\tif (this.commands.has(s.id) || seen.has(s.id)) {\n\t\t\t\tthrow new CommandRegistryError('duplicate_command', `Command \"${s.id}\" is already registered.`);\n\t\t\t}\n\t\t\tseen.add(s.id);\n\t\t}\n\t\t// Parse every chord before registering anything, so a bad shortcut registers nothing.\n\t\tconst bindings = specs.map((s) => toShortcutBindings(s.id, s.shortcut, s.scope));\n\t\tconst unbinds: Array<() => void> = [];\n\t\tthis.muted = true;\n\t\ttry {\n\t\t\tfor (const b of bindings) unbinds.push(this.shortcuts.bind(b));\n\t\t} catch (error) {\n\t\t\tunbinds.forEach((u) => u());\n\t\t\tthrow new CommandRegistryError('invalid_command', error instanceof Error ? error.message : String(error));\n\t\t} finally {\n\t\t\tthis.muted = false;\n\t\t}\n\t\tspecs.forEach((s, i) => this.commands.set(s.id, { spec: s, unbind: unbinds[i] }));\n\t\tthis.notify();\n\t\tlet registered = true;\n\t\treturn () => {\n\t\t\tif (!registered) return;\n\t\t\tregistered = false;\n\t\t\tlet changed = false;\n\t\t\tfor (const s of specs) {\n\t\t\t\tconst entry = this.commands.get(s.id);\n\t\t\t\tif (entry && entry.spec === s) {\n\t\t\t\t\tthis.commands.delete(s.id);\n\t\t\t\t\tthis.unbindQuietly(entry);\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (changed) this.notify();\n\t\t};\n\t}\n\n\t/** Removes a command by id. Returns whether it was registered. */\n\tunregister(id: string): boolean {\n\t\tconst entry = this.commands.get(id);\n\t\tif (!entry) return false;\n\t\tthis.commands.delete(id);\n\t\tthis.unbindQuietly(entry);\n\t\tthis.notify();\n\t\treturn true;\n\t}\n\n\tprivate unbindQuietly(entry: Registered) {\n\t\tthis.muted = true;\n\t\ttry {\n\t\t\tentry.unbind();\n\t\t} finally {\n\t\t\tthis.muted = false;\n\t\t}\n\t}\n\n\thas(id: string): boolean {\n\t\treturn this.commands.has(id);\n\t}\n\n\tget(id: string): CommandSpec<TContext> | undefined {\n\t\treturn this.commands.get(id)?.spec;\n\t}\n\n\t/** Registered ids in registration order. */\n\tids(): string[] {\n\t\treturn [...this.commands.keys()];\n\t}\n\n\t/** Whether `id` can run now (`{ enabled, reason }`); `params` are the targets a caller named. */\n\tisEnabled(id: string, params?: unknown, context: TContext = this.context): { enabled: boolean; reason?: string } {\n\t\tconst spec = this.get(id);\n\t\tif (!spec) return { enabled: false, reason: `Unknown command \"${id}\".` };\n\t\tif (!spec.enabled) return { enabled: true };\n\t\ttry {\n\t\t\treturn enablement(spec.enabled(context, params as any));\n\t\t} catch (error) {\n\t\t\treturn { enabled: false, reason: error instanceof Error ? error.message : String(error) };\n\t\t}\n\t}\n\n\t/** Commands for menus, palettes and agents, with their current enablement. */\n\tlist(options: CommandListOptions<TContext> = {}): CommandEntry[] {\n\t\tconst scopes = options.scope === undefined ? null : typeof options.scope === 'string' ? [options.scope] : options.scope;\n\t\tconst context = 'context' in options ? (options.context as TContext) : this.context;\n\t\tconst platform = this.shortcuts.platform;\n\t\tconst out: CommandEntry[] = [];\n\t\tfor (const { spec } of this.commands.values()) {\n\t\t\tif (spec.hidden && !options.includeHidden) continue;\n\t\t\tif (scopes && spec.scope !== undefined && !scopes.includes(spec.scope)) continue;\n\t\t\tconst { enabled, reason } = this.isEnabled(spec.id, undefined, context);\n\t\t\tif (options.enabledOnly && !enabled) continue;\n\t\t\tout.push({\n\t\t\t\tid: spec.id,\n\t\t\t\tlabel: spec.label,\n\t\t\t\t...(spec.group !== undefined ? { group: spec.group } : {}),\n\t\t\t\t...(spec.keywords ? { keywords: spec.keywords } : {}),\n\t\t\t\t...(spec.description !== undefined ? { description: spec.description } : {}),\n\t\t\t\t...(spec.params ? { params: spec.params } : {}),\n\t\t\t\t...(spec.scope !== undefined ? { scope: spec.scope } : {}),\n\t\t\t\tshortcuts: this.shortcuts.forCommand(spec.id, platform),\n\t\t\t\tenabled,\n\t\t\t\t...(enabled ? {} : { disabledReason: reason }),\n\t\t\t\tundoable: !!spec.undoable,\n\t\t\t\treadOnly: !!spec.readOnly\n\t\t\t});\n\t\t}\n\t\treturn out;\n\t}\n\n\tprivate check(id: string, params: unknown, context: TContext): CommandResult<never> | { spec: CommandSpec<TContext>; params: any } {\n\t\tconst spec = this.get(id);\n\t\tif (!spec) return { ok: false, id, code: 'unknown_command', message: `Unknown command \"${id}\".` };\n\t\tconst input = params ?? {};\n\t\tif (typeof input !== 'object' || Array.isArray(input)) {\n\t\t\treturn { ok: false, id, code: 'invalid_params', message: `Parameters for command \"${id}\" must be an object.` };\n\t\t}\n\t\tconst unknown = unknownParams(spec, input as Record<string, unknown>);\n\t\tif (unknown) return { ok: false, id, code: 'invalid_params', message: unknown };\n\t\tif (spec.params) {\n\t\t\tconst details = validateJsonSchema(input, spec.params);\n\t\t\tif (details.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tid,\n\t\t\t\t\tcode: 'invalid_params',\n\t\t\t\t\tmessage: `Invalid parameters for command \"${id}\": ${details.map((d) => `${d.path} ${d.message}`).join('; ')}`,\n\t\t\t\t\tdetails\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconst { enabled, reason } = this.isEnabled(id, params === undefined ? undefined : input, context);\n\t\tif (!enabled) return { ok: false, id, code: 'disabled', message: reason ?? 'Disabled.' };\n\t\treturn { spec, params: input };\n\t}\n\n\tprivate invoke(spec: CommandSpec<TContext>, params: any, context: TContext): unknown {\n\t\tconst history = this.options.history;\n\t\tif (!spec.undoable || !history) return spec.run(context, params);\n\t\tlet value: unknown;\n\t\t// `batch` rolls back already-recorded steps and rethrows when `run` throws.\n\t\thistory.batch(spec.label, () => {\n\t\t\tvalue = spec.run(context, params);\n\t\t});\n\t\treturn value;\n\t}\n\n\t/**\n\t * Runs a command synchronously and returns a structured result; never throws.\n\t * A command whose `run` returns a promise yields `{ ok: true, result: promise }`\n\t * (use `executeAsync` to await it and catch its rejection).\n\t */\n\texecute<T = unknown>(id: string, params?: unknown, context: TContext = this.context): CommandResult<T> {\n\t\tconst checked = this.check(id, params, context);\n\t\tif ('ok' in checked) return checked;\n\t\ttry {\n\t\t\tconst result = this.invoke(checked.spec, checked.params, context);\n\t\t\tthis.notify();\n\t\t\treturn { ok: true, id, result: result as T };\n\t\t} catch (error) {\n\t\t\tthis.notify();\n\t\t\treturn { ok: false, id, code: 'failed', message: error instanceof Error ? error.message : String(error) };\n\t\t}\n\t}\n\n\t/** Like `execute`, but awaits async commands (rejections become `failed` results). */\n\tasync executeAsync<T = unknown>(id: string, params?: unknown, context: TContext = this.context): Promise<CommandResult<T>> {\n\t\tconst outcome = this.execute<T>(id, params, context);\n\t\tif (!outcome.ok || !isThenable(outcome.result)) return outcome;\n\t\ttry {\n\t\t\tconst result = await outcome.result;\n\t\t\tthis.notify();\n\t\t\treturn { ok: true, id, result: result as T };\n\t\t} catch (error) {\n\t\t\tthis.notify();\n\t\t\treturn { ok: false, id, code: 'failed', message: error instanceof Error ? error.message : String(error) };\n\t\t}\n\t}\n\n\t/**\n\t * Resolves a keydown event to a command (see `ShortcutMap.resolve`) and runs it when\n\t * enabled, calling `preventDefault()`. Disabled commands leave the event alone, so the\n\t * browser or a focused editor can still handle it. Returns the result, or `null`.\n\t */\n\thandleKeyDown(\n\t\tevent: KeyboardEventLike,\n\t\toptions: ShortcutResolveOptions & { context?: TContext } = {}\n\t): CommandResult | null {\n\t\tif (event.defaultPrevented) return null;\n\t\tconst match = this.shortcuts.resolve(event, options);\n\t\tif (!match) return null;\n\t\tconst context = 'context' in options ? (options.context as TContext) : this.context;\n\t\tif (!this.isEnabled(match.command, undefined, context).enabled) return null;\n\t\tevent.preventDefault?.();\n\t\treturn this.execute(match.command, undefined, context);\n\t}\n\n\t/** Display-ready primary shortcut of a command (`⇧⌘Z` / `Ctrl+Shift+Z`), or `undefined`. */\n\tshortcutFor(id: string, platform: Platform = this.shortcuts.platform): string | undefined {\n\t\treturn this.shortcuts.forCommand(id, platform)[0];\n\t}\n\n\t/**\n\t * Subscribes to changes: commands registered or removed, shortcut overrides, executed\n\t * commands and `invalidate()` calls (e.g. when enablement inputs change).\n\t */\n\tsubscribe(listener: () => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\t/** Tells subscribers that enablement may have changed (e.g. the selection changed). */\n\tinvalidate(): void {\n\t\tthis.notify();\n\t}\n\n\tprivate notify(): void {\n\t\tthis.version++;\n\t\tfor (const listener of Array.from(this.listeners)) {\n\t\t\ttry {\n\t\t\t\tlistener();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('[CommandRegistry] Error in listener:', error);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function createCommandRegistry<TContext = any>(options?: CommandRegistryOptions<TContext>): CommandRegistry<TContext> {\n\treturn new CommandRegistry<TContext>(options);\n}\n\n/** Identity helper that types a command spec. */\nexport function defineCommand<TContext = any, TParams = any, TResult = unknown>(\n\tspec: CommandSpec<TContext, TParams, TResult>\n): CommandSpec<TContext, TParams, TResult> {\n\treturn spec;\n}\n","// Portions ported from photocraft-main/crates/ui-egui/src/palette.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\n\n/** The fields `rankCommands` searches (a `CommandEntry` satisfies it). */\nexport interface RankableCommand {\n\tid: string;\n\tlabel: string;\n\tgroup?: string;\n\tkeywords?: readonly string[];\n\tenabled?: boolean;\n}\n\nexport interface FuzzyMatch {\n\tscore: number;\n\t/** Indices of the matched characters in the text (for highlighting). */\n\tindices: number[];\n}\n\nconst WORD_SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '›', '(']);\n\n/**\n * Subsequence fuzzy match: every query character must appear in order. Consecutive\n * matches score 8, others 1; a match at a word start adds 5; longer texts lose\n * `length / 8`. Case-insensitive. Returns `null` when the query does not match.\n */\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch | null {\n\tconst q = query.trim().toLowerCase();\n\tif (!q) return { score: 0, indices: [] };\n\tconst t = text.toLowerCase();\n\tlet score = 0;\n\tlet ti = 0;\n\tlet last = -2;\n\tconst indices: number[] = [];\n\tfor (const qc of q) {\n\t\tif (qc === ' ') continue;\n\t\tlet found = false;\n\t\twhile (ti < t.length) {\n\t\t\tif (t[ti] === qc) {\n\t\t\t\tscore += last === ti - 1 ? 8 : 1;\n\t\t\t\tif (ti === 0 || WORD_SEPARATORS.has(t[ti - 1])) score += 5;\n\t\t\t\tlast = ti;\n\t\t\t\tindices.push(ti);\n\t\t\t\tti++;\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tti++;\n\t\t}\n\t\tif (!found) return null;\n\t}\n\treturn { score: score - Math.floor(t.length / 8), indices };\n}\n\n/** `fuzzyMatch(query, text)?.score ?? null`. */\nexport function fuzzyScore(query: string, text: string): number | null {\n\treturn fuzzyMatch(query, text)?.score ?? null;\n}\n\n/**\n * Bonus that puts a command whose name is exactly the query ahead of every fuzzy match\n * (\"undo\" finds Undo before \"Undo Selection Change\"). Trailing ellipses are ignored.\n */\nexport function exactBonus(query: string, names: readonly string[]): number {\n\tconst q = query.trim().toLowerCase();\n\tif (!q) return 0;\n\treturn names.some((n) => n.replace(/(…|\\.\\.\\.)$/, '').trim().toLowerCase() === q) ? 1000 : 0;\n}\n\n/** Default number of recently run commands a palette remembers. */\nexport const DEFAULT_RECENT_LIMIT = 8;\n\n/** Moves `id` to the front of `list` (deduplicated, newest first, at most `cap`). Returns a new array. */\nexport function pushRecent(list: readonly string[], id: string, cap: number = DEFAULT_RECENT_LIMIT): string[] {\n\treturn [id, ...list.filter((x) => x !== id)].slice(0, Math.max(0, cap));\n}\n\nexport interface RankedCommand<T extends RankableCommand = RankableCommand> {\n\tentry: T;\n\tscore: number;\n\t/** Matched character indices in `entry.label` (empty when another field matched). */\n\tlabelIndices: number[];\n\t/** The entry was shown because it was run recently (empty query). */\n\trecent: boolean;\n}\n\nexport interface RankCommandsOptions {\n\t/** Recently run ids, newest first. Shown first for an empty query and boosted slightly otherwise. */\n\trecents?: readonly string[];\n\t/** Maximum number of recents shown for an empty query (default 8). */\n\trecentLimit?: number;\n\t/** Maximum number of results. */\n\tlimit?: number;\n\t/** Sort disabled commands after enabled ones (default `true`). */\n\tdisabledLast?: boolean;\n\t/** With an empty query: `all` (default) lists recents then every other command; `recents` lists only recents. */\n\temptyQuery?: 'all' | 'recents';\n}\n\n/**\n * Ranks commands for a palette query. Searches the label, `group label`, keywords and id;\n * an exact label or keyword match always wins. An empty query lists recent commands\n * first (deduplicated and capped), then the rest in their original order.\n */\nexport function rankCommands<T extends RankableCommand>(\n\tquery: string,\n\tentries: readonly T[],\n\toptions: RankCommandsOptions = {}\n): RankedCommand<T>[] {\n\tconst recents = options.recents ?? [];\n\tconst disabledLast = options.disabledLast ?? true;\n\tconst q = query.trim();\n\tlet ranked: Array<RankedCommand<T> & { order: number }>;\n\n\tif (!q) {\n\t\tconst byId = new Map(entries.map((e) => [e.id, e]));\n\t\tconst recentIds = [...new Set(recents)].filter((id) => byId.has(id)).slice(0, options.recentLimit ?? DEFAULT_RECENT_LIMIT);\n\t\tconst recentSet = new Set(recentIds);\n\t\tranked = recentIds.map((id, i) => ({ entry: byId.get(id)!, score: 1000 - i, labelIndices: [], recent: true, order: i }));\n\t\tif ((options.emptyQuery ?? 'all') === 'all') {\n\t\t\tentries.forEach((entry, i) => {\n\t\t\t\tif (!recentSet.has(entry.id)) ranked.push({ entry, score: 0, labelIndices: [], recent: false, order: recentIds.length + i });\n\t\t\t});\n\t\t}\n\t} else {\n\t\tranked = [];\n\t\tentries.forEach((entry, order) => {\n\t\t\tconst label = fuzzyMatch(q, entry.label);\n\t\t\tconst candidates: number[] = [];\n\t\t\tif (label) candidates.push(label.score);\n\t\t\tif (entry.group) {\n\t\t\t\tconst grouped = fuzzyScore(q, `${entry.group} ${entry.label}`);\n\t\t\t\tif (grouped !== null) candidates.push(grouped - 1);\n\t\t\t}\n\t\t\tfor (const keyword of entry.keywords ?? []) {\n\t\t\t\tconst s = fuzzyScore(q, keyword);\n\t\t\t\tif (s !== null) candidates.push(s - 2);\n\t\t\t}\n\t\t\tconst byId = fuzzyScore(q, entry.id);\n\t\t\tif (byId !== null) candidates.push(byId - 3);\n\t\t\tif (candidates.length === 0) return;\n\t\t\tconst recentIndex = recents.indexOf(entry.id);\n\t\t\tconst score =\n\t\t\t\tMath.max(...candidates) +\n\t\t\t\texactBonus(q, [entry.label, ...(entry.keywords ?? [])]) +\n\t\t\t\t(recentIndex >= 0 ? Math.max(1, 4 - recentIndex) : 0);\n\t\t\tranked.push({ entry, score, labelIndices: label?.indices ?? [], recent: false, order });\n\t\t});\n\t\tranked.sort((a, b) => b.score - a.score || a.entry.label.length - b.entry.label.length || a.order - b.order);\n\t}\n\n\tif (disabledLast) {\n\t\t// Stable partition: enabled first, keeping the ranking within each half.\n\t\tranked = [...ranked.filter((r) => r.entry.enabled !== false), ...ranked.filter((r) => r.entry.enabled === false)];\n\t}\n\tconst out = ranked.map(({ order: _order, ...rest }) => rest);\n\treturn options.limit !== undefined ? out.slice(0, options.limit) : out;\n}\n","import { formatShortcut, type KeyboardEventLike, type Platform } from './chords.js';\nimport { DEFAULT_RECENT_LIMIT, pushRecent, rankCommands, type RankedCommand } from './palette.js';\nimport type { CommandEntry, CommandRegistry, CommandResult } from './registry.js';\nimport { ShortcutMap } from './shortcuts.js';\n\n/** One palette row. */\nexport interface CommandPaletteItem extends RankedCommand<CommandEntry> {\n\tid: string;\n\tlabel: string;\n\tgroup?: string;\n\t/** Display-ready primary shortcut (`⇧⌘Z` / `Ctrl+Shift+Z`). */\n\tshortcut?: string;\n\tenabled: boolean;\n\tdisabledReason?: string;\n}\n\nexport interface CommandPaletteState {\n\topen: boolean;\n\tquery: string;\n\tactiveIndex: number;\n\titems: CommandPaletteItem[];\n\trecents: string[];\n\t/** Result of the last command the palette ran. */\n\tlastResult: CommandResult | null;\n}\n\nexport interface CommandPaletteOptions<TContext = any> {\n\t/** Context for enablement and runs (default: the registry's). */\n\tcontext?: TContext | (() => TContext);\n\t/** Only global commands plus these scopes. */\n\tscope?: string | readonly string[] | (() => string | readonly string[] | undefined);\n\t/** Initial recently run ids (newest first), e.g. restored from storage. */\n\trecents?: readonly string[];\n\t/** Called whenever the recents change, e.g. to persist them. */\n\tonRecentsChange?: (recents: string[]) => void;\n\trecentLimit?: number;\n\t/** Maximum rows (default 50). */\n\tlimit?: number;\n\t/** Platform for shortcut display (default: detected). */\n\tplatform?: Platform;\n\t/** Called after a command ran from the palette. */\n\tonRun?: (result: CommandResult) => void;\n}\n\n/**\n * Framework-agnostic command palette state (open, query, ranked rows, active row and\n * recents) over a `CommandRegistry`. The React hook and Svelte rune wrap it.\n */\nexport function createCommandPaletteController<TContext = any>(\n\tregistry: CommandRegistry<TContext>,\n\toptions: CommandPaletteOptions<TContext> = {}\n) {\n\tconst listeners = new Set<(state: CommandPaletteState) => void>();\n\tlet open = false;\n\tlet query = '';\n\tlet activeIndex = 0;\n\tlet recents = [...(options.recents ?? [])];\n\tlet lastResult: CommandResult | null = null;\n\tlet state: CommandPaletteState;\n\n\tconst context = (): TContext => {\n\t\tconst c = options.context;\n\t\tif (c === undefined) return registry.context;\n\t\treturn (typeof c === 'function' ? (c as () => TContext)() : c) as TContext;\n\t};\n\tconst scope = () => (typeof options.scope === 'function' ? options.scope() : options.scope);\n\n\tfunction computeItems(): CommandPaletteItem[] {\n\t\tif (!open) return [];\n\t\tconst entries = registry.list({ scope: scope(), context: context() });\n\t\tconst platform = options.platform ?? registry.shortcuts.platform;\n\t\treturn rankCommands(query, entries, {\n\t\t\trecents,\n\t\t\trecentLimit: options.recentLimit,\n\t\t\tlimit: options.limit ?? 50\n\t\t}).map((ranked) => ({\n\t\t\t...ranked,\n\t\t\tid: ranked.entry.id,\n\t\t\tlabel: ranked.entry.label,\n\t\t\t...(ranked.entry.group !== undefined ? { group: ranked.entry.group } : {}),\n\t\t\t...(ranked.entry.shortcuts[0] ? { shortcut: formatShortcut(ranked.entry.shortcuts[0], platform) } : {}),\n\t\t\tenabled: ranked.entry.enabled,\n\t\t\t...(ranked.entry.disabledReason ? { disabledReason: ranked.entry.disabledReason } : {})\n\t\t}));\n\t}\n\n\tfunction update() {\n\t\tconst items = computeItems();\n\t\tactiveIndex = items.length === 0 ? 0 : Math.min(Math.max(activeIndex, 0), items.length - 1);\n\t\tstate = { open, query, activeIndex, items, recents, lastResult };\n\t\tfor (const listener of Array.from(listeners)) listener(state);\n\t}\n\n\tstate = { open, query, activeIndex, items: [], recents, lastResult };\n\t// Follow registry changes only while someone listens (safe with React StrictMode remounts).\n\tlet unsubscribeRegistry: (() => void) | null = null;\n\tconst onRegistryChange = () => {\n\t\tif (open) update();\n\t};\n\n\tconst controller = {\n\t\tgetState: () => state,\n\t\tsubscribe(listener: (state: CommandPaletteState) => void): () => void {\n\t\t\tlisteners.add(listener);\n\t\t\tunsubscribeRegistry ??= registry.subscribe(onRegistryChange);\n\t\t\tif (open) update(); // catch up with changes made while nobody listened\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener);\n\t\t\t\tif (listeners.size === 0) {\n\t\t\t\t\tunsubscribeRegistry?.();\n\t\t\t\t\tunsubscribeRegistry = null;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tsetOpen(next: boolean) {\n\t\t\tif (next === open) return;\n\t\t\topen = next;\n\t\t\tquery = '';\n\t\t\tactiveIndex = 0;\n\t\t\tupdate();\n\t\t},\n\t\ttoggle() {\n\t\t\tcontroller.setOpen(!open);\n\t\t},\n\t\tsetQuery(next: string) {\n\t\t\tif (next === query) return;\n\t\t\tquery = next;\n\t\t\tactiveIndex = 0;\n\t\t\tupdate();\n\t\t},\n\t\tsetActiveIndex(index: number) {\n\t\t\tactiveIndex = index;\n\t\t\tupdate();\n\t\t},\n\t\t/** Moves the active row by `delta`, wrapping around. */\n\t\tmove(delta: number) {\n\t\t\tconst n = state.items.length;\n\t\t\tif (n === 0) return;\n\t\t\tactiveIndex = (((activeIndex + delta) % n) + n) % n;\n\t\t\tupdate();\n\t\t},\n\t\t/** Runs a command by id, closes the palette and records it as recent. Disabled commands do nothing. */\n\t\trun(id: string): CommandResult | null {\n\t\t\tif (!registry.isEnabled(id, undefined, context()).enabled) return null;\n\t\t\topen = false;\n\t\t\tquery = '';\n\t\t\tactiveIndex = 0;\n\t\t\trecents = pushRecent(recents, id, options.recentLimit ?? DEFAULT_RECENT_LIMIT);\n\t\t\toptions.onRecentsChange?.(recents);\n\t\t\tconst result = registry.execute(id, undefined, context());\n\t\t\tlastResult = result;\n\t\t\tupdate();\n\t\t\toptions.onRun?.(result);\n\t\t\treturn result;\n\t\t},\n\t\trunActive(): CommandResult | null {\n\t\t\tconst item = state.items[state.activeIndex];\n\t\t\treturn item ? controller.run(item.id) : null;\n\t\t},\n\t\t/**\n\t\t * Keyboard handling for the palette input: ArrowUp/ArrowDown (wrap), Home/End,\n\t\t * Enter (run the active row) and Escape (close). Returns whether it handled the key.\n\t\t */\n\t\thandleKeyDown(event: KeyboardEventLike): boolean {\n\t\t\tif (!open) return false;\n\t\t\tswitch (event.key) {\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tcontroller.move(1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tcontroller.move(-1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Home':\n\t\t\t\t\tcontroller.setActiveIndex(0);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'End':\n\t\t\t\t\tcontroller.setActiveIndex(state.items.length - 1);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tcontroller.runActive();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tcontroller.setOpen(false);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\tevent.preventDefault?.();\n\t\t\treturn true;\n\t\t},\n\t\t/** Re-reads commands and enablement. */\n\t\trefresh() {\n\t\t\tupdate();\n\t\t},\n\t\tdestroy() {\n\t\t\tunsubscribeRegistry?.();\n\t\t\tunsubscribeRegistry = null;\n\t\t\tlisteners.clear();\n\t\t}\n\t};\n\treturn controller;\n}\n\nexport type CommandPaletteController = ReturnType<typeof createCommandPaletteController>;\n\n/**\n * Matches a global \"open palette\" hotkey (e.g. `Mod+K`), also while typing in inputs.\n * Returns `true` when `event` is the hotkey.\n */\nexport function matchPaletteHotkey(event: KeyboardEventLike, hotkey: string, platform?: Platform): boolean {\n\tconst map = new ShortcutMap([{ command: 'palette', chord: hotkey, allowInEditable: true }], platform ? { platform } : {});\n\treturn map.resolve(event) !== null;\n}\n","// Portions ported from filmcraft-main/crates/automation/src/server.rs (MIT OR Apache-2.0, © ArtCraft Team and contributors). See THIRD_PARTY_NOTICES.md.\nimport type { AgentTool, AgentToolProvider, McpToolResult } from '../tools/registry.js';\nimport { rankCommands } from './palette.js';\nimport type { CommandRegistry, CommandResult } from './registry.js';\n\nexport interface CommandToolProviderOptions<TContext = any> {\n\t/** Provider id (default `commands`). */\n\tid?: string;\n\t/** Always prefix the tool names with `<namespace>__`. */\n\tnamespace?: string;\n\t/** Context for enablement and runs (default: the registry's). */\n\tcontext?: TContext | (() => TContext);\n\t/** Only expose global commands plus these scopes. */\n\tscope?: string | readonly string[];\n\t/** Commands agents may not see or run (e.g. ones that open dialogs). */\n\texclude?: (id: string) => boolean;\n}\n\nconst toJson = (value: unknown): unknown => {\n\tif (value === undefined) return null;\n\ttry {\n\t\treturn JSON.parse(JSON.stringify(value));\n\t} catch {\n\t\treturn String(value);\n\t}\n};\n\nfunction errorResult(result: Extract<CommandResult, { ok: false }>): McpToolResult {\n\treturn {\n\t\tisError: true,\n\t\tcontent: [{ type: 'text', text: `${result.code}: ${result.message}` }],\n\t\tstructuredContent: {\n\t\t\terror: { code: result.code, message: result.message, command: result.id, ...(result.details ? { details: result.details } : {}) }\n\t\t}\n\t};\n}\n\n/**\n * Exposes a `CommandRegistry` to agents through a `ToolRegistry`:\n *\n * - `list_commands {query?, enabledOnly?}`: ids, labels, params schemas, shortcuts and\n * enablement (with the reason a command is disabled).\n * - `run_command {id, params?}`: runs one command; disabled commands, unknown params and\n * failures come back as `isError` results with a `{code, message}` error.\n * - `run_commands {steps: [{id, params?}], stopOnError?}`: runs steps **in order**, each as\n * its own command (and undo step). It is not atomic: steps that succeeded before a failure\n * stay applied. For all-or-nothing behaviour, register a command that runs the steps\n * inside `HistoryManager.batch` (or mark it `undoable` on a registry with `history`).\n *\n * The id enum in `run_command`'s schema follows the registered commands, so the\n * `ToolRegistry` announces `listChanged` when commands are added or removed.\n */\nexport function createCommandToolProvider<TContext = any>(\n\tregistry: CommandRegistry<TContext>,\n\toptions: CommandToolProviderOptions<TContext> = {}\n): AgentToolProvider {\n\tconst context = (): TContext => {\n\t\tconst c = options.context;\n\t\tif (c === undefined) return registry.context;\n\t\treturn (typeof c === 'function' ? (c as () => TContext)() : c) as TContext;\n\t};\n\tconst visible = () =>\n\t\tregistry.list({ scope: options.scope, context: context() }).filter((e) => !options.exclude?.(e.id));\n\tconst allowed = (id: string) => registry.has(id) && !options.exclude?.(id) && visible().some((e) => e.id === id);\n\n\tasync function runOne(id: string, params: unknown): Promise<CommandResult> {\n\t\tif (!allowed(id)) return { ok: false, id, code: 'unknown_command', message: `Unknown command \"${id}\".` };\n\t\treturn registry.executeAsync(id, params ?? {}, context());\n\t}\n\n\tconst listCommands: AgentTool = {\n\t\tname: 'list_commands',\n\t\ttitle: 'List commands',\n\t\tdescription:\n\t\t\t'Lists the commands you can run with run_command: id, label, group, params (JSON Schema), shortcuts, and whether each is enabled now (with the reason when it is not).',\n\t\tinputSchema: {\n\t\t\ttype: 'object',\n\t\t\tproperties: {\n\t\t\t\tquery: { type: 'string', description: 'Fuzzy filter on label, keywords, group and id.' },\n\t\t\t\tenabledOnly: { type: 'boolean', description: 'Only commands that can run now (default false).' }\n\t\t\t},\n\t\t\tadditionalProperties: false\n\t\t},\n\t\tannotations: { title: 'List commands', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },\n\t\thandler: ({ query = '', enabledOnly = false }) => {\n\t\t\tlet entries = visible();\n\t\t\tif (enabledOnly) entries = entries.filter((e) => e.enabled);\n\t\t\tif (String(query).trim()) entries = rankCommands(String(query), entries, { disabledLast: false }).map((r) => r.entry);\n\t\t\treturn {\n\t\t\t\tcommands: entries.map((e) => ({\n\t\t\t\t\tid: e.id,\n\t\t\t\t\tlabel: e.label,\n\t\t\t\t\t...(e.group ? { group: e.group } : {}),\n\t\t\t\t\t...(e.description ? { description: e.description } : {}),\n\t\t\t\t\t...(e.params ? { params: e.params } : {}),\n\t\t\t\t\t...(e.shortcuts.length ? { shortcuts: e.shortcuts } : {}),\n\t\t\t\t\tenabled: e.enabled,\n\t\t\t\t\t...(e.disabledReason ? { disabledReason: e.disabledReason } : {}),\n\t\t\t\t\treadOnly: e.readOnly\n\t\t\t\t}))\n\t\t\t};\n\t\t}\n\t};\n\n\tconst runCommandTool = (): AgentTool => {\n\t\tconst ids = visible().map((e) => e.id);\n\t\treturn {\n\t\t\tname: 'run_command',\n\t\t\ttitle: 'Run a command',\n\t\t\tdescription:\n\t\t\t\t'Runs one command by id with optional params (see list_commands for each command\\'s params schema). Unknown params are rejected.',\n\t\t\tinputSchema: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tid: { type: 'string', description: 'Command id from list_commands.', ...(ids.length ? { enum: ids } : {}) },\n\t\t\t\t\tparams: { type: 'object', description: 'Command parameters.' }\n\t\t\t\t},\n\t\t\t\trequired: ['id'],\n\t\t\t\tadditionalProperties: false\n\t\t\t},\n\t\t\tannotations: { title: 'Run a command', readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },\n\t\t\thandler: async ({ id, params }) => {\n\t\t\t\tconst result = await runOne(String(id), params);\n\t\t\t\treturn result.ok ? { id: result.id, ok: true, result: toJson(result.result) } : errorResult(result);\n\t\t\t}\n\t\t};\n\t};\n\n\tconst runCommands: AgentTool = {\n\t\tname: 'run_commands',\n\t\ttitle: 'Run several commands',\n\t\tdescription:\n\t\t\t'Runs several commands in order: {steps: [{id, params?}], stopOnError?: true}. Each step is its own command and undo step; the batch is NOT atomic (steps before a failure stay applied). Returns {completed, failed, results: [{id, ok, result | code, message}]}.',\n\t\tinputSchema: {\n\t\t\ttype: 'object',\n\t\t\tproperties: {\n\t\t\t\tsteps: {\n\t\t\t\t\ttype: 'array',\n\t\t\t\t\tminItems: 1,\n\t\t\t\t\titems: {\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tid: { type: 'string', description: 'Command id.' },\n\t\t\t\t\t\t\tparams: { type: 'object', description: 'Command parameters.' }\n\t\t\t\t\t\t},\n\t\t\t\t\t\trequired: ['id'],\n\t\t\t\t\t\tadditionalProperties: false\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tstopOnError: { type: 'boolean', description: 'Stop at the first failing step (default true).' }\n\t\t\t},\n\t\t\trequired: ['steps'],\n\t\t\tadditionalProperties: false\n\t\t},\n\t\tannotations: {\n\t\t\ttitle: 'Run several commands',\n\t\t\treadOnlyHint: false,\n\t\t\tdestructiveHint: true,\n\t\t\tidempotentHint: false,\n\t\t\topenWorldHint: false\n\t\t},\n\t\thandler: async ({ steps, stopOnError = true }) => {\n\t\t\tlet completed = 0;\n\t\t\tlet failed = 0;\n\t\t\tconst results: Array<Record<string, unknown>> = [];\n\t\t\tfor (const step of steps as Array<{ id: string; params?: unknown }>) {\n\t\t\t\tconst result = await runOne(step.id, step.params);\n\t\t\t\tif (result.ok) {\n\t\t\t\t\tcompleted++;\n\t\t\t\t\tresults.push({ id: result.id, ok: true, result: toJson(result.result) });\n\t\t\t\t} else {\n\t\t\t\t\tfailed++;\n\t\t\t\t\tresults.push({ id: result.id, ok: false, code: result.code, message: result.message });\n\t\t\t\t\tif (stopOnError) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst summary = { completed, failed, skipped: steps.length - completed - failed, results };\n\t\t\treturn failed > 0\n\t\t\t\t? { isError: true, content: [{ type: 'text', text: JSON.stringify(summary) }], structuredContent: summary }\n\t\t\t\t: summary;\n\t\t}\n\t};\n\n\treturn {\n\t\tid: options.id ?? 'commands',\n\t\tnamespace: options.namespace,\n\t\ttools: () => [listCommands, runCommandTool(), runCommands],\n\t\tsubscribe: (notify) => registry.subscribe(notify)\n\t};\n}\n","import type { CommandSpec } from './registry.js';\n\n/**\n * Animation controller surface used by `createCanvasAnimationCommands`\n * (`createCanvasAnimationController`, `useCanvasAnimation` and `createCanvasAnimation` satisfy it).\n */\nexport interface AnimationCommandTarget {\n\tgetState(): { playing: boolean; recording: boolean; time: number; duration: number; selection: readonly unknown[] };\n\tplay(): void;\n\tpause(): void;\n\ttoggle(): void;\n\tstop(): void;\n\tseek(time: number): void;\n\ttoggleRecording(): void;\n\taddKeyframe(ids?: Iterable<string>, keys?: readonly string[], time?: number): unknown;\n\tdeleteKeyframes(): unknown;\n\tsetEasing(easing: any, refs?: readonly any[]): unknown;\n\tnextKeyframe(): unknown;\n\tpreviousKeyframe(): unknown;\n\tanimateNode(nodeId: string, options: any): unknown;\n\texportCss(nodeId: string, options?: any): { css: string; exact: boolean };\n}\n\nexport interface AnimationCommandOptions {\n\t/** Id prefix (default `canvas.animation.`). */\n\tprefix?: string;\n\tgroup?: string;\n\t/** Scope (default `canvas`). Pass `null` for global. */\n\tscope?: string | null;\n}\n\nconst EASING_DESCRIPTION =\n\t'Easing preset (linear, ease, ease-in, ease-out, ease-in-out, ease-in-back, ease-out-back, spring, hold) or a CSS cubic-bezier(x1, y1, x2, y2).';\n\nconst VALUES = {\n\ttype: 'object',\n\tdescription: 'Property → value, e.g. {\"x\": 200, \"opacity\": 0.5, \"fill\": \"#ff0000\"}. Properties: x, y, width, height, rotation (degrees), scale, opacity (0–1), fill, stroke, strokeWidth, cornerRadius, motionPath (0–1).',\n\tadditionalProperties: { type: ['number', 'string'] }\n} as const;\n\n/**\n * Palette / shortcut / agent commands for canvas animation: play / pause, seek, add keyframe at\n * the playhead, delete keyframes, set easing, record toggle, keyframe navigation, \"animate\n * node from A to B over T\" and CSS export. Edits are undoable when the controller has a history.\n */\nexport function createCanvasAnimationCommands(controller: AnimationCommandTarget, options: AnimationCommandOptions = {}): CommandSpec[] {\n\tconst prefix = options.prefix ?? 'canvas.animation.';\n\tconst group = options.group ?? 'Animation';\n\tconst scope = options.scope === null ? undefined : options.scope ?? 'canvas';\n\tconst base = { group, ...(scope ? { scope } : {}) };\n\tconst hasSelection = () => (controller.getState().selection.length > 0 ? true : 'Select keyframes first.');\n\treturn [\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}togglePlay`,\n\t\t\tlabel: 'Play / Pause Animation',\n\t\t\tkeywords: ['play', 'pause', 'preview', 'timeline'],\n\t\t\tdescription: 'Plays or pauses the canvas animation from the playhead.',\n\t\t\trun: () => {\n\t\t\t\tcontroller.toggle();\n\t\t\t\treturn { playing: controller.getState().playing, time: controller.getState().time };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}play`,\n\t\t\tlabel: 'Play Animation',\n\t\t\tkeywords: ['preview', 'timeline'],\n\t\t\tenabled: () => (controller.getState().playing ? 'Already playing.' : true),\n\t\t\trun: () => controller.play()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}pause`,\n\t\t\tlabel: 'Pause Animation',\n\t\t\tenabled: () => (controller.getState().playing ? true : 'Not playing.'),\n\t\t\trun: () => controller.pause()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}stop`,\n\t\t\tlabel: 'Stop Animation',\n\t\t\tkeywords: ['rewind', 'reset'],\n\t\t\tdescription: 'Stops playback and returns to the start.',\n\t\t\trun: () => controller.stop()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}seek`,\n\t\t\tlabel: 'Go to Time…',\n\t\t\tkeywords: ['playhead', 'scrub', 'time'],\n\t\t\tdescription: 'Moves the playhead.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { time: { type: 'number', minimum: 0, description: 'Time in milliseconds.' } },\n\t\t\t\trequired: ['time']\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { time: number }) => {\n\t\t\t\tcontroller.seek(params.time);\n\t\t\t\treturn { time: controller.getState().time };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}addKeyframe`,\n\t\t\tlabel: 'Add Keyframe at Playhead',\n\t\t\tkeywords: ['key', 'animate', 'record'],\n\t\t\tdescription: 'Keys the selected nodes (or `ids`) at the playhead (or `time`): their animated properties, `properties`, or position.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tids: { type: 'array', items: { type: 'string' }, description: 'Node ids (default: selected nodes).' },\n\t\t\t\t\tproperties: { type: 'array', items: { type: 'string' }, description: 'Properties to key (default: animated ones, or x and y).' },\n\t\t\t\t\ttime: { type: 'number', minimum: 0, description: 'Time in ms (default: the playhead).' }\n\t\t\t\t}\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { ids?: string[]; properties?: string[]; time?: number }) =>\n\t\t\t\tcontroller.addKeyframe(params?.ids, params?.properties, params?.time)\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}deleteKeyframes`,\n\t\t\tlabel: 'Delete Keyframes',\n\t\t\tkeywords: ['remove', 'clear'],\n\t\t\tenabled: hasSelection,\n\t\t\trun: () => controller.deleteKeyframes()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}setEasing`,\n\t\t\tlabel: 'Set Keyframe Easing…',\n\t\t\tkeywords: ['interpolation', 'ease', 'bezier', 'spring', 'hold', 'curve'],\n\t\t\tdescription: 'Sets the easing of the segments leaving the selected keyframes.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { easing: { type: 'string', description: EASING_DESCRIPTION } },\n\t\t\t\trequired: ['easing']\n\t\t\t},\n\t\t\tenabled: hasSelection,\n\t\t\trun: (_ctx: unknown, params: { easing: string }) => controller.setEasing(params.easing)\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}toggleRecord`,\n\t\t\tlabel: 'Toggle Record Mode',\n\t\t\tkeywords: ['auto key', 'record', 'keyframe'],\n\t\t\tdescription: 'In record mode, changing a property at the playhead keys it.',\n\t\t\trun: () => {\n\t\t\t\tcontroller.toggleRecording();\n\t\t\t\treturn { recording: controller.getState().recording };\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}nextKeyframe`,\n\t\t\tlabel: 'Next Keyframe',\n\t\t\tkeywords: ['jump', 'navigate'],\n\t\t\trun: () => controller.nextKeyframe()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}previousKeyframe`,\n\t\t\tlabel: 'Previous Keyframe',\n\t\t\tkeywords: ['jump', 'navigate'],\n\t\t\trun: () => controller.previousKeyframe()\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}animateNode`,\n\t\t\tlabel: 'Animate Node…',\n\t\t\tkeywords: ['tween', 'transition', 'move', 'fade'],\n\t\t\tdescription: 'Animates a node from `from` (default: its current values) to `to` over `duration` ms, starting at `delay` ms.',\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {\n\t\t\t\t\tnodeId: { type: 'string', description: 'Node to animate.' },\n\t\t\t\t\tto: VALUES,\n\t\t\t\t\tfrom: VALUES,\n\t\t\t\t\tduration: { type: 'number', exclusiveMinimum: 0, description: 'Duration in ms (default 1000).' },\n\t\t\t\t\tdelay: { type: 'number', minimum: 0, description: 'Start time in ms (default 0).' },\n\t\t\t\t\teasing: { type: 'string', description: EASING_DESCRIPTION }\n\t\t\t\t},\n\t\t\t\trequired: ['nodeId', 'to']\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { nodeId: string; to: Record<string, number | string>; from?: Record<string, number | string>; duration?: number; delay?: number; easing?: string }) =>\n\t\t\t\tcontroller.animateNode(params.nodeId, {\n\t\t\t\t\tto: params.to,\n\t\t\t\t\t...(params.from ? { from: params.from } : {}),\n\t\t\t\t\t...(params.duration !== undefined ? { duration: params.duration } : {}),\n\t\t\t\t\t...(params.delay !== undefined ? { delay: params.delay } : {}),\n\t\t\t\t\t...(params.easing !== undefined ? { easing: params.easing } : {})\n\t\t\t\t})\n\t\t},\n\t\t{\n\t\t\t...base,\n\t\t\tid: `${prefix}exportCss`,\n\t\t\tlabel: 'Export Animation as CSS',\n\t\t\tkeywords: ['keyframes', 'css', 'web animations'],\n\t\t\tdescription: 'Returns CSS @keyframes for a node\\'s animation.',\n\t\t\treadOnly: true,\n\t\t\tparams: {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: { nodeId: { type: 'string' } },\n\t\t\t\trequired: ['nodeId']\n\t\t\t},\n\t\t\trun: (_ctx: unknown, params: { nodeId: string }) => controller.exportCss(params.nodeId)\n\t\t}\n\t];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkGO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EACtC;AAAA,EAET,YAAY,MAAoC,SAAiB;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACb;AACD;AAEA,IAAM,mBAAmB;A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,IACH;AAAA,IACA;AAAA,MACC,GAAG;AAAA,MACH,IAAI,GAAG,MAAM;AAAA,MACb,OAAO;AAAA,MACP,UAAU,CAAC,aAAa,OAAO,gBAAgB;AAAA,MAC/C,aAAa;AAAA,MACb,UAAU;AAAA,MACV,QAAQ;AAAA,QACP,MAAM;AAAA,QACN,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,EAAE;AAAA,QACzC,UAAU,CAAC,QAAQ;AAAA,MACpB;AAAA,MACA,KAAK,CAAC,MAAe,WAA+B,WAAW,UAAU,OAAO,MAAM;AAAA,IACvF;AAAA,EACD;AACD;","names":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyframe easing: the curve a segment follows from one keyframe to the next.
|
|
3
|
+
*
|
|
4
|
+
* - `hold` keeps the first keyframe's value until the next one (a step).
|
|
5
|
+
* - `linear` and the CSS presets (`ease`, `ease-in`, `ease-out`, `ease-in-out`) are
|
|
6
|
+
* CSS-compatible `cubic-bezier()` curves; `{ type: 'cubic-bezier', x1, y1, x2, y2 }` is any
|
|
7
|
+
* such curve (x1 / y1 is the leaving keyframe's out handle, x2 / y2 the next one's in handle).
|
|
8
|
+
* - `spring` is a damped spring settling on the next value (it may overshoot).
|
|
9
|
+
*/
|
|
10
|
+
/** Named easing presets. */
|
|
11
|
+
type AnimationEasingPreset = 'linear' | 'hold' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-in-back' | 'ease-out-back' | 'spring';
|
|
12
|
+
interface CubicBezierEasing {
|
|
13
|
+
type: 'cubic-bezier';
|
|
14
|
+
x1: number;
|
|
15
|
+
y1: number;
|
|
16
|
+
x2: number;
|
|
17
|
+
y2: number;
|
|
18
|
+
}
|
|
19
|
+
interface SpringEasing {
|
|
20
|
+
type: 'spring';
|
|
21
|
+
/** Spring stiffness (default 170). */
|
|
22
|
+
stiffness?: number;
|
|
23
|
+
/** Damping (default 26). */
|
|
24
|
+
damping?: number;
|
|
25
|
+
/** Mass (default 1). */
|
|
26
|
+
mass?: number;
|
|
27
|
+
/** Initial velocity in units of the segment's value change per second (default 0). */
|
|
28
|
+
velocity?: number;
|
|
29
|
+
}
|
|
30
|
+
type AnimationEasing = AnimationEasingPreset | CubicBezierEasing | SpringEasing;
|
|
31
|
+
/** Preset names, in picker order. */
|
|
32
|
+
declare const ANIMATION_EASING_PRESETS: readonly AnimationEasingPreset[];
|
|
33
|
+
/** Picker labels for the presets. */
|
|
34
|
+
declare const ANIMATION_EASING_LABELS: Readonly<Record<AnimationEasingPreset, string>>;
|
|
35
|
+
/** The CSS control points of the bezier presets (CSS Easing Functions Level 1 values for the CSS keywords). */
|
|
36
|
+
declare const CUBIC_BEZIER_PRESETS: Readonly<Record<string, readonly [number, number, number, number]>>;
|
|
37
|
+
/**
|
|
38
|
+
* Solves a CSS `cubic-bezier(x1, y1, x2, y2)` for y at progress x (Newton steps with a
|
|
39
|
+
* bisection fallback). x1 / x2 are clamped to 0–1 as CSS requires.
|
|
40
|
+
*/
|
|
41
|
+
declare function cubicBezierAt(x1: number, y1: number, x2: number, y2: number, x: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* Normalised position of a damped spring released from 0 towards 1, `seconds` after release.
|
|
44
|
+
* Closed form for under-, critically and over-damped springs.
|
|
45
|
+
*/
|
|
46
|
+
declare function springAt(spring: Omit<SpringEasing, 'type'>, seconds: number): number;
|
|
47
|
+
/** Resolves an easing to a cubic-bezier, spring or hold descriptor (unknown input → linear). */
|
|
48
|
+
declare function resolveEasing(easing: AnimationEasing | string | undefined | null): CubicBezierEasing | Required<SpringEasing> | 'hold';
|
|
49
|
+
/**
|
|
50
|
+
* Eased progress for linear progress `u` (0–1) through a segment lasting `durationMs`
|
|
51
|
+
* (springs depend on real time; other curves ignore it). `hold` returns 0 until `u` reaches 1.
|
|
52
|
+
*/
|
|
53
|
+
declare function evaluateEasing(easing: AnimationEasing | string | undefined | null, u: number, durationMs?: number): number;
|
|
54
|
+
/**
|
|
55
|
+
* The easing filmcraft (and Premiere) derive from temporal "influence" handles: flat handles of
|
|
56
|
+
* the given influences (0.01–1, default 1/3) on the leaving and arriving keyframe.
|
|
57
|
+
*/
|
|
58
|
+
declare function easingFromInfluence(outInfluence?: number, inInfluence?: number): CubicBezierEasing;
|
|
59
|
+
/**
|
|
60
|
+
* Parses a CSS easing (`linear`, `ease…`, `cubic-bezier(…)`, `steps(1, end)` / `step-end` →
|
|
61
|
+
* hold) or a preset name. Returns `null` for anything else.
|
|
62
|
+
*/
|
|
63
|
+
declare function parseCssEasing(text: string): AnimationEasing | null;
|
|
64
|
+
/** Whether a value is a usable easing (preset name, CSS easing string or descriptor). */
|
|
65
|
+
declare function isAnimationEasing(value: unknown): value is AnimationEasing;
|
|
66
|
+
/**
|
|
67
|
+
* The CSS `animation-timing-function` for an easing: a keyword or `cubic-bezier()`,
|
|
68
|
+
* `steps(1, end)` for hold, and a sampled `linear(…)` for springs over `durationMs`.
|
|
69
|
+
*/
|
|
70
|
+
declare function easingToCss(easing: AnimationEasing | string | undefined | null, durationMs?: number, samples?: number): string;
|
|
71
|
+
/** Short label for an easing (a preset's label, or `Custom` / `Spring`). */
|
|
72
|
+
declare function easingLabel(easing: AnimationEasing | undefined | null): string;
|
|
73
|
+
|
|
74
|
+
export { type AnimationEasing as A, CUBIC_BEZIER_PRESETS as C, type SpringEasing as S, ANIMATION_EASING_LABELS as a, ANIMATION_EASING_PRESETS as b, type AnimationEasingPreset as c, type CubicBezierEasing as d, cubicBezierAt as e, easingFromInfluence as f, easingLabel as g, easingToCss as h, evaluateEasing as i, isAnimationEasing as j, parseCssEasing as p, resolveEasing as r, springAt as s };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyframe easing: the curve a segment follows from one keyframe to the next.
|
|
3
|
+
*
|
|
4
|
+
* - `hold` keeps the first keyframe's value until the next one (a step).
|
|
5
|
+
* - `linear` and the CSS presets (`ease`, `ease-in`, `ease-out`, `ease-in-out`) are
|
|
6
|
+
* CSS-compatible `cubic-bezier()` curves; `{ type: 'cubic-bezier', x1, y1, x2, y2 }` is any
|
|
7
|
+
* such curve (x1 / y1 is the leaving keyframe's out handle, x2 / y2 the next one's in handle).
|
|
8
|
+
* - `spring` is a damped spring settling on the next value (it may overshoot).
|
|
9
|
+
*/
|
|
10
|
+
/** Named easing presets. */
|
|
11
|
+
type AnimationEasingPreset = 'linear' | 'hold' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-in-back' | 'ease-out-back' | 'spring';
|
|
12
|
+
interface CubicBezierEasing {
|
|
13
|
+
type: 'cubic-bezier';
|
|
14
|
+
x1: number;
|
|
15
|
+
y1: number;
|
|
16
|
+
x2: number;
|
|
17
|
+
y2: number;
|
|
18
|
+
}
|
|
19
|
+
interface SpringEasing {
|
|
20
|
+
type: 'spring';
|
|
21
|
+
/** Spring stiffness (default 170). */
|
|
22
|
+
stiffness?: number;
|
|
23
|
+
/** Damping (default 26). */
|
|
24
|
+
damping?: number;
|
|
25
|
+
/** Mass (default 1). */
|
|
26
|
+
mass?: number;
|
|
27
|
+
/** Initial velocity in units of the segment's value change per second (default 0). */
|
|
28
|
+
velocity?: number;
|
|
29
|
+
}
|
|
30
|
+
type AnimationEasing = AnimationEasingPreset | CubicBezierEasing | SpringEasing;
|
|
31
|
+
/** Preset names, in picker order. */
|
|
32
|
+
declare const ANIMATION_EASING_PRESETS: readonly AnimationEasingPreset[];
|
|
33
|
+
/** Picker labels for the presets. */
|
|
34
|
+
declare const ANIMATION_EASING_LABELS: Readonly<Record<AnimationEasingPreset, string>>;
|
|
35
|
+
/** The CSS control points of the bezier presets (CSS Easing Functions Level 1 values for the CSS keywords). */
|
|
36
|
+
declare const CUBIC_BEZIER_PRESETS: Readonly<Record<string, readonly [number, number, number, number]>>;
|
|
37
|
+
/**
|
|
38
|
+
* Solves a CSS `cubic-bezier(x1, y1, x2, y2)` for y at progress x (Newton steps with a
|
|
39
|
+
* bisection fallback). x1 / x2 are clamped to 0–1 as CSS requires.
|
|
40
|
+
*/
|
|
41
|
+
declare function cubicBezierAt(x1: number, y1: number, x2: number, y2: number, x: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* Normalised position of a damped spring released from 0 towards 1, `seconds` after release.
|
|
44
|
+
* Closed form for under-, critically and over-damped springs.
|
|
45
|
+
*/
|
|
46
|
+
declare function springAt(spring: Omit<SpringEasing, 'type'>, seconds: number): number;
|
|
47
|
+
/** Resolves an easing to a cubic-bezier, spring or hold descriptor (unknown input → linear). */
|
|
48
|
+
declare function resolveEasing(easing: AnimationEasing | string | undefined | null): CubicBezierEasing | Required<SpringEasing> | 'hold';
|
|
49
|
+
/**
|
|
50
|
+
* Eased progress for linear progress `u` (0–1) through a segment lasting `durationMs`
|
|
51
|
+
* (springs depend on real time; other curves ignore it). `hold` returns 0 until `u` reaches 1.
|
|
52
|
+
*/
|
|
53
|
+
declare function evaluateEasing(easing: AnimationEasing | string | undefined | null, u: number, durationMs?: number): number;
|
|
54
|
+
/**
|
|
55
|
+
* The easing filmcraft (and Premiere) derive from temporal "influence" handles: flat handles of
|
|
56
|
+
* the given influences (0.01–1, default 1/3) on the leaving and arriving keyframe.
|
|
57
|
+
*/
|
|
58
|
+
declare function easingFromInfluence(outInfluence?: number, inInfluence?: number): CubicBezierEasing;
|
|
59
|
+
/**
|
|
60
|
+
* Parses a CSS easing (`linear`, `ease…`, `cubic-bezier(…)`, `steps(1, end)` / `step-end` →
|
|
61
|
+
* hold) or a preset name. Returns `null` for anything else.
|
|
62
|
+
*/
|
|
63
|
+
declare function parseCssEasing(text: string): AnimationEasing | null;
|
|
64
|
+
/** Whether a value is a usable easing (preset name, CSS easing string or descriptor). */
|
|
65
|
+
declare function isAnimationEasing(value: unknown): value is AnimationEasing;
|
|
66
|
+
/**
|
|
67
|
+
* The CSS `animation-timing-function` for an easing: a keyword or `cubic-bezier()`,
|
|
68
|
+
* `steps(1, end)` for hold, and a sampled `linear(…)` for springs over `durationMs`.
|
|
69
|
+
*/
|
|
70
|
+
declare function easingToCss(easing: AnimationEasing | string | undefined | null, durationMs?: number, samples?: number): string;
|
|
71
|
+
/** Short label for an easing (a preset's label, or `Custom` / `Spring`). */
|
|
72
|
+
declare function easingLabel(easing: AnimationEasing | undefined | null): string;
|
|
73
|
+
|
|
74
|
+
export { type AnimationEasing as A, CUBIC_BEZIER_PRESETS as C, type SpringEasing as S, ANIMATION_EASING_LABELS as a, ANIMATION_EASING_PRESETS as b, type AnimationEasingPreset as c, type CubicBezierEasing as d, cubicBezierAt as e, easingFromInfluence as f, easingLabel as g, easingToCss as h, evaluateEasing as i, isAnimationEasing as j, parseCssEasing as p, resolveEasing as r, springAt as s };
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
var
|
|
108
|
+
var _chunk6MDQKHRHcjs = require('../chunk-6MDQKHRH.cjs');
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
|
|
@@ -113,6 +113,7 @@ var _chunkOYEFRO3Dcjs = require('../chunk-OYEFRO3D.cjs');
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
|
|
116
|
+
var _chunk3CC7OPUQcjs = require('../chunk-3CC7OPUQ.cjs');
|
|
116
117
|
|
|
117
118
|
|
|
118
119
|
|
|
@@ -137,8 +138,6 @@ var _chunkOYEFRO3Dcjs = require('../chunk-OYEFRO3D.cjs');
|
|
|
137
138
|
|
|
138
139
|
|
|
139
140
|
|
|
140
|
-
var _chunkMC2LQN5Scjs = require('../chunk-MC2LQN5S.cjs');
|
|
141
|
-
require('../chunk-CS6NZWWA.cjs');
|
|
142
141
|
|
|
143
142
|
|
|
144
143
|
|
|
@@ -146,7 +145,8 @@ require('../chunk-CS6NZWWA.cjs');
|
|
|
146
145
|
|
|
147
146
|
|
|
148
147
|
|
|
149
|
-
var
|
|
148
|
+
var _chunkMC2LQN5Scjs = require('../chunk-MC2LQN5S.cjs');
|
|
149
|
+
require('../chunk-CS6NZWWA.cjs');
|
|
150
150
|
require('../chunk-MKA3AHLV.cjs');
|
|
151
151
|
require('../chunk-HNDSPZ5T.cjs');
|
|
152
152
|
require('../chunk-66IMF6OD.cjs');
|
|
@@ -350,5 +350,5 @@ var _chunkIFHKKVXHcjs = require('../chunk-IFHKKVXH.cjs');
|
|
|
350
350
|
|
|
351
351
|
|
|
352
352
|
|
|
353
|
-
exports.ALLOW_NESTED_TABLES_META = _chunkMC2LQN5Scjs.ALLOW_NESTED_TABLES_META; exports.Autocorrect = _chunkOYEFRO3Dcjs.Autocorrect; exports.BLOCK_CHANGE_ATTRIBUTE = _chunkIFHKKVXHcjs.BLOCK_CHANGE_ATTRIBUTE; exports.Bookmark = _chunkOYEFRO3Dcjs.Bookmark; exports.CHARACTER_STYLE_MARK_NAME = _chunkOYEFRO3Dcjs.CHARACTER_STYLE_MARK_NAME; exports.COMMENT_MARK_NAME = _chunkOYEFRO3Dcjs.COMMENT_MARK_NAME; exports.CharacterStyle = _chunkOYEFRO3Dcjs.CharacterStyle; exports.ColorHighlighter = _chunkOYEFRO3Dcjs.ColorHighlighter; exports.CommentStore = _chunkIFHKKVXHcjs.CommentStore; exports.Comments = _chunkOYEFRO3Dcjs.Comments; exports.CrossReference = _chunkOYEFRO3Dcjs.CrossReference; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = _chunkOYEFRO3Dcjs.DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.DEFAULT_STYLES = _chunk3CC7OPUQcjs.DEFAULT_STYLES; exports.DEFAULT_TABLE_OPTIONS = _chunkMC2LQN5Scjs.DEFAULT_TABLE_OPTIONS; exports.DEFAULT_TABLE_TOOLBAR = _chunkMC2LQN5Scjs.DEFAULT_TABLE_TOOLBAR; exports.DELETION_MARK_NAME = _chunkIFHKKVXHcjs.DELETION_MARK_NAME; exports.DocumentCompare = _chunkOYEFRO3Dcjs.DocumentCompare; exports.EMPTY_FIND_REPLACE_SNAPSHOT = _chunkOYEFRO3Dcjs.EMPTY_FIND_REPLACE_SNAPSHOT; exports.EMPTY_TABLE_STATE = _chunkMC2LQN5Scjs.EMPTY_TABLE_STATE; exports.FIND_OPTION_TOGGLES = _chunkOYEFRO3Dcjs.FIND_OPTION_TOGGLES; exports.FIND_PARAGRAPH_MARK = _chunkOYEFRO3Dcjs.FIND_PARAGRAPH_MARK; exports.FORMAT_CHANGE_MARK_NAME = _chunkIFHKKVXHcjs.FORMAT_CHANGE_MARK_NAME; exports.FileImport = _chunkOYEFRO3Dcjs.FileImport; exports.FindReplace = _chunkOYEFRO3Dcjs.FindReplace; exports.FindReplaceStore = _chunkOYEFRO3Dcjs.FindReplaceStore; exports.FontSize = _chunkOYEFRO3Dcjs.FontSize; exports.Footnote = _chunkOYEFRO3Dcjs.Footnote; exports.FootnoteReference = _chunkOYEFRO3Dcjs.FootnoteReference; exports.Footnotes = _chunkOYEFRO3Dcjs.Footnotes; exports.GradientText = _chunkOYEFRO3Dcjs.GradientText; exports.INSERTION_MARK_NAME = _chunkIFHKKVXHcjs.INSERTION_MARK_NAME; exports.Image = _chunkOYEFRO3Dcjs.Image; exports.LoadingNode = _chunkOYEFRO3Dcjs.LoadingNode; exports.MAX_FIND_PATTERN_LENGTH = _chunkOYEFRO3Dcjs.MAX_FIND_PATTERN_LENGTH; exports.MAX_TABLE_COLUMNS = _chunkMC2LQN5Scjs.MAX_TABLE_COLUMNS; exports.MAX_TABLE_ROWS = _chunkMC2LQN5Scjs.MAX_TABLE_ROWS; exports.MOVE_FROM_CLASS = _chunkIFHKKVXHcjs.MOVE_FROM_CLASS; exports.MOVE_ID_ATTRIBUTE = _chunkIFHKKVXHcjs.MOVE_ID_ATTRIBUTE; exports.MOVE_TO_CLASS = _chunkIFHKKVXHcjs.MOVE_TO_CLASS; exports.Markdown = _chunkOYEFRO3Dcjs.Markdown; exports.Mention = _chunkOYEFRO3Dcjs.Mention; exports.NORMAL_STYLE_ID = _chunk3CC7OPUQcjs.NORMAL_STYLE_ID; exports.Outline = _chunkOYEFRO3Dcjs.Outline; exports.ParagraphStyles = _chunkOYEFRO3Dcjs.ParagraphStyles; exports.RichClipboard = _chunkOYEFRO3Dcjs.RichClipboard; exports.SMILIE_REPLACEMENTS = _chunkOYEFRO3Dcjs.SMILIE_REPLACEMENTS; exports.STYLE_ID_ATTRIBUTE = _chunkOYEFRO3Dcjs.STYLE_ID_ATTRIBUTE; exports.SlashCommands = _chunkOYEFRO3Dcjs.SlashCommands; exports.SmilieReplacer = _chunkOYEFRO3Dcjs.SmilieReplacer; exports.StyleRegistry = _chunk3CC7OPUQcjs.StyleRegistry; exports.TABLE_ACTIONS = _chunkMC2LQN5Scjs.TABLE_ACTIONS; exports.TRACK_CHANGES_SKIP_META = _chunkIFHKKVXHcjs.TRACK_CHANGES_SKIP_META; exports.Table = _chunkMC2LQN5Scjs.Table; exports.TableCell = _chunkMC2LQN5Scjs.TableCell; exports.TableHeader = _chunkMC2LQN5Scjs.TableHeader; exports.TableOfContents = _chunkOYEFRO3Dcjs.TableOfContents; exports.TableRow = _chunkMC2LQN5Scjs.TableRow; exports.TemplateSuggestions = _chunkOYEFRO3Dcjs.TemplateSuggestions; exports.TrackChanges = _chunkIFHKKVXHcjs.TrackChanges; exports.TrackChangesStore = _chunkIFHKKVXHcjs.TrackChangesStore; exports.TrackedDeletion = _chunkIFHKKVXHcjs.TrackedDeletion; exports.TrackedFormatChange = _chunkIFHKKVXHcjs.TrackedFormatChange; exports.TrackedInsertion = _chunkIFHKKVXHcjs.TrackedInsertion; exports.applyDocumentComparison = _chunkOYEFRO3Dcjs.applyDocumentComparison; exports.applyReplacements = _chunkOYEFRO3Dcjs.applyReplacements; exports.autocorrectPluginKey = _chunkOYEFRO3Dcjs.autocorrectPluginKey; exports.buildOutlineTree = _chunkOYEFRO3Dcjs.buildOutlineTree; exports.capitalizeSentenceRules = _chunkOYEFRO3Dcjs.capitalizeSentenceRules; exports.captureSelectionFormat = _chunkOYEFRO3Dcjs.captureSelectionFormat; exports.commentsPluginKey = _chunkOYEFRO3Dcjs.commentsPluginKey; exports.compareInEditor = _chunkOYEFRO3Dcjs.compareInEditor; exports.compileFindPattern = _chunkOYEFRO3Dcjs.compileFindPattern; exports.computeOutline = _chunkOYEFRO3Dcjs.computeOutline; exports.createCommentStore = _chunkIFHKKVXHcjs.createCommentStore; exports.createFindReplaceCommands = _chunkOYEFRO3Dcjs.createFindReplaceCommands; exports.createMentionExtension = _chunkOYEFRO3Dcjs.createMentionExtension; exports.createOutlineStore = _chunkOYEFRO3Dcjs.createOutlineStore; exports.createParagraphStylesStore = _chunkOYEFRO3Dcjs.createParagraphStylesStore; exports.createReviewId = _chunkIFHKKVXHcjs.createReviewId; exports.createRichTextPreset = _chunkOYEFRO3Dcjs.createRichTextPreset; exports.createSearchBudget = _chunkOYEFRO3Dcjs.createSearchBudget; exports.createStyleRegistry = _chunk3CC7OPUQcjs.createStyleRegistry; exports.createTableCommands = _chunkOYEFRO3Dcjs.createTableCommands; exports.createTableExtensions = _chunkMC2LQN5Scjs.createTableExtensions; exports.createTableNestingPlugin = _chunkMC2LQN5Scjs.createTableNestingPlugin; exports.createTableStore = _chunkMC2LQN5Scjs.createTableStore; exports.crossReferencePluginKey = _chunkOYEFRO3Dcjs.crossReferencePluginKey; exports.defaultAutocorrectRules = _chunkOYEFRO3Dcjs.defaultAutocorrectRules; exports.describeBlockChange = _chunkIFHKKVXHcjs.describeBlockChange; exports.describeFormatChange = _chunkIFHKKVXHcjs.describeFormatChange; exports.documentStructureCommandItems = _chunkOYEFRO3Dcjs.documentStructureCommandItems; exports.expandReplacement = _chunkOYEFRO3Dcjs.expandReplacement; exports.fileImportPluginKey = _chunkOYEFRO3Dcjs.fileImportPluginKey; exports.findAllMatches = _chunkOYEFRO3Dcjs.findAllMatches; exports.findAutocorrection = _chunkOYEFRO3Dcjs.findAutocorrection; exports.findCommentRanges = _chunkOYEFRO3Dcjs.findCommentRanges; exports.findHexColors = _chunkOYEFRO3Dcjs.findHexColors; exports.findReplacePluginKey = _chunkOYEFRO3Dcjs.findReplacePluginKey; exports.foldCodePoint = _chunkOYEFRO3Dcjs.foldCodePoint; exports.footnotesMarkdownIt = _chunkOYEFRO3Dcjs.footnotesMarkdownIt; exports.footnotesPluginKey = _chunkOYEFRO3Dcjs.footnotesPluginKey; exports.formatFindStatus = _chunkOYEFRO3Dcjs.formatFindStatus; exports.formatReviewTime = _chunkIFHKKVXHcjs.formatReviewTime; exports.fractionRules = _chunkOYEFRO3Dcjs.fractionRules; exports.getActiveHeading = _chunkOYEFRO3Dcjs.getActiveHeading; exports.getBookmarks = _chunkOYEFRO3Dcjs.getBookmarks; exports.getCommentAnchors = _chunkOYEFRO3Dcjs.getCommentAnchors; exports.getCommentAuthor = _chunkOYEFRO3Dcjs.getCommentAuthor; exports.getCommentIdsAt = _chunkOYEFRO3Dcjs.getCommentIdsAt; exports.getCommentStore = _chunkOYEFRO3Dcjs.getCommentStore; exports.getCrossReferenceTargets = _chunkOYEFRO3Dcjs.getCrossReferenceTargets; exports.getDocumentStructureCommandItems = _chunkOYEFRO3Dcjs.getDocumentStructureCommandItems; exports.getFindReplaceState = _chunkOYEFRO3Dcjs.getFindReplaceState; exports.getFindReplaceStore = _chunkOYEFRO3Dcjs.getFindReplaceStore; exports.getFootnotes = _chunkOYEFRO3Dcjs.getFootnotes; exports.getMentionNodes = _chunkOYEFRO3Dcjs.getMentionNodes; exports.getOutline = _chunkOYEFRO3Dcjs.getOutline; exports.getParagraphStyleAt = _chunkOYEFRO3Dcjs.getParagraphStyleAt; exports.getStyleRegistry = _chunkOYEFRO3Dcjs.getStyleRegistry; exports.getTableActionState = _chunkMC2LQN5Scjs.getTableActionState; exports.getTableOfContentsEntries = _chunkOYEFRO3Dcjs.getTableOfContentsEntries; exports.getTableState = _chunkMC2LQN5Scjs.getTableState; exports.getTrackChangesStore = _chunkIFHKKVXHcjs.getTrackChangesStore; exports.getTrackedChangeAt = _chunkIFHKKVXHcjs.getTrackedChangeAt; exports.getTrackedChanges = _chunkIFHKKVXHcjs.getTrackedChanges; exports.handleImageInsertion = _chunkOYEFRO3Dcjs.handleImageInsertion; exports.handleTablePasteWithoutNesting = _chunkMC2LQN5Scjs.handleTablePasteWithoutNesting; exports.imagePastePluginKey = _chunkOYEFRO3Dcjs.imagePastePluginKey; exports.insertImageNode = _chunkOYEFRO3Dcjs.insertImageNode; exports.insertSliceAfterTable = _chunkMC2LQN5Scjs.insertSliceAfterTable; exports.isGfmTable = _chunkMC2LQN5Scjs.isGfmTable; exports.isInTableCell = _chunkMC2LQN5Scjs.isInTableCell; exports.isInsidePromptToken = _chunkOYEFRO3Dcjs.isInsidePromptToken; exports.isMoveSized = _chunkIFHKKVXHcjs.isMoveSized; exports.isParagraphStyleAvailable = _chunkOYEFRO3Dcjs.isParagraphStyleAvailable; exports.isSelectionInTable = _chunkMC2LQN5Scjs.isSelectionInTable; exports.isTableEnabled = _chunkMC2LQN5Scjs.isTableEnabled; exports.isTrackChangesEnabled = _chunkIFHKKVXHcjs.isTrackChangesEnabled; exports.isValidStyleId = _chunk3CC7OPUQcjs.isValidStyleId; exports.navigateToHeading = _chunkOYEFRO3Dcjs.navigateToHeading; exports.normalizeTableCellAlignment = _chunkMC2LQN5Scjs.normalizeTableCellAlignment; exports.normalizeTableCellColor = _chunkMC2LQN5Scjs.normalizeTableCellColor; exports.outermostTableDepth = _chunkMC2LQN5Scjs.outermostTableDepth; exports.outlinePluginKey = _chunkOYEFRO3Dcjs.outlinePluginKey; exports.paragraphStylesPluginKey = _chunkOYEFRO3Dcjs.paragraphStylesPluginKey; exports.parseReplacement = _chunkOYEFRO3Dcjs.parseReplacement; exports.removeImageNode = _chunkOYEFRO3Dcjs.removeImageNode; exports.resolveTrackedChanges = _chunkIFHKKVXHcjs.resolveTrackedChanges; exports.richClipboardPluginKey = _chunkOYEFRO3Dcjs.richClipboardPluginKey; exports.runTableAction = _chunkMC2LQN5Scjs.runTableAction; exports.safeCSSValue = _chunk3CC7OPUQcjs.safeCSSValue; exports.searchDocument = _chunkOYEFRO3Dcjs.searchDocument; exports.setMentionRoleAt = _chunkOYEFRO3Dcjs.setMentionRoleAt; exports.shouldShowTableBubbleMenu = _chunkMC2LQN5Scjs.shouldShowTableBubbleMenu; exports.sliceContainsTable = _chunkMC2LQN5Scjs.sliceContainsTable; exports.smartQuoteRules = _chunkOYEFRO3Dcjs.smartQuoteRules; exports.smilieAutocorrectRules = _chunkOYEFRO3Dcjs.smilieAutocorrectRules; exports.symbolRules = _chunkOYEFRO3Dcjs.symbolRules; exports.syncFootnotes = _chunkOYEFRO3Dcjs.syncFootnotes; exports.tableNestingPluginKey = _chunkMC2LQN5Scjs.tableNestingPluginKey; exports.tableOfContentsMarkdownIt = _chunkOYEFRO3Dcjs.tableOfContentsMarkdownIt; exports.tableOfContentsPluginKey = _chunkOYEFRO3Dcjs.tableOfContentsPluginKey; exports.trackChangesPluginKey = _chunkIFHKKVXHcjs.trackChangesPluginKey; exports.trackedChangeLabel = _chunkIFHKKVXHcjs.trackedChangeLabel; exports.twoInitialCapitalsRules = _chunkOYEFRO3Dcjs.twoInitialCapitalsRules; exports.unnestTables = _chunkMC2LQN5Scjs.unnestTables; exports.updateImageSrc = _chunkOYEFRO3Dcjs.updateImageSrc; exports.validateFindPattern = _chunkOYEFRO3Dcjs.validateFindPattern; exports.writeRichClipboard = _chunkOYEFRO3Dcjs.writeRichClipboard;
|
|
353
|
+
exports.ALLOW_NESTED_TABLES_META = _chunkMC2LQN5Scjs.ALLOW_NESTED_TABLES_META; exports.Autocorrect = _chunk6MDQKHRHcjs.Autocorrect; exports.BLOCK_CHANGE_ATTRIBUTE = _chunkIFHKKVXHcjs.BLOCK_CHANGE_ATTRIBUTE; exports.Bookmark = _chunk6MDQKHRHcjs.Bookmark; exports.CHARACTER_STYLE_MARK_NAME = _chunk6MDQKHRHcjs.CHARACTER_STYLE_MARK_NAME; exports.COMMENT_MARK_NAME = _chunk6MDQKHRHcjs.COMMENT_MARK_NAME; exports.CharacterStyle = _chunk6MDQKHRHcjs.CharacterStyle; exports.ColorHighlighter = _chunk6MDQKHRHcjs.ColorHighlighter; exports.CommentStore = _chunkIFHKKVXHcjs.CommentStore; exports.Comments = _chunk6MDQKHRHcjs.Comments; exports.CrossReference = _chunk6MDQKHRHcjs.CrossReference; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = _chunk6MDQKHRHcjs.DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.DEFAULT_STYLES = _chunk3CC7OPUQcjs.DEFAULT_STYLES; exports.DEFAULT_TABLE_OPTIONS = _chunkMC2LQN5Scjs.DEFAULT_TABLE_OPTIONS; exports.DEFAULT_TABLE_TOOLBAR = _chunkMC2LQN5Scjs.DEFAULT_TABLE_TOOLBAR; exports.DELETION_MARK_NAME = _chunkIFHKKVXHcjs.DELETION_MARK_NAME; exports.DocumentCompare = _chunk6MDQKHRHcjs.DocumentCompare; exports.EMPTY_FIND_REPLACE_SNAPSHOT = _chunk6MDQKHRHcjs.EMPTY_FIND_REPLACE_SNAPSHOT; exports.EMPTY_TABLE_STATE = _chunkMC2LQN5Scjs.EMPTY_TABLE_STATE; exports.FIND_OPTION_TOGGLES = _chunk6MDQKHRHcjs.FIND_OPTION_TOGGLES; exports.FIND_PARAGRAPH_MARK = _chunk6MDQKHRHcjs.FIND_PARAGRAPH_MARK; exports.FORMAT_CHANGE_MARK_NAME = _chunkIFHKKVXHcjs.FORMAT_CHANGE_MARK_NAME; exports.FileImport = _chunk6MDQKHRHcjs.FileImport; exports.FindReplace = _chunk6MDQKHRHcjs.FindReplace; exports.FindReplaceStore = _chunk6MDQKHRHcjs.FindReplaceStore; exports.FontSize = _chunk6MDQKHRHcjs.FontSize; exports.Footnote = _chunk6MDQKHRHcjs.Footnote; exports.FootnoteReference = _chunk6MDQKHRHcjs.FootnoteReference; exports.Footnotes = _chunk6MDQKHRHcjs.Footnotes; exports.GradientText = _chunk6MDQKHRHcjs.GradientText; exports.INSERTION_MARK_NAME = _chunkIFHKKVXHcjs.INSERTION_MARK_NAME; exports.Image = _chunk6MDQKHRHcjs.Image; exports.LoadingNode = _chunk6MDQKHRHcjs.LoadingNode; exports.MAX_FIND_PATTERN_LENGTH = _chunk6MDQKHRHcjs.MAX_FIND_PATTERN_LENGTH; exports.MAX_TABLE_COLUMNS = _chunkMC2LQN5Scjs.MAX_TABLE_COLUMNS; exports.MAX_TABLE_ROWS = _chunkMC2LQN5Scjs.MAX_TABLE_ROWS; exports.MOVE_FROM_CLASS = _chunkIFHKKVXHcjs.MOVE_FROM_CLASS; exports.MOVE_ID_ATTRIBUTE = _chunkIFHKKVXHcjs.MOVE_ID_ATTRIBUTE; exports.MOVE_TO_CLASS = _chunkIFHKKVXHcjs.MOVE_TO_CLASS; exports.Markdown = _chunk6MDQKHRHcjs.Markdown; exports.Mention = _chunk6MDQKHRHcjs.Mention; exports.NORMAL_STYLE_ID = _chunk3CC7OPUQcjs.NORMAL_STYLE_ID; exports.Outline = _chunk6MDQKHRHcjs.Outline; exports.ParagraphStyles = _chunk6MDQKHRHcjs.ParagraphStyles; exports.RichClipboard = _chunk6MDQKHRHcjs.RichClipboard; exports.SMILIE_REPLACEMENTS = _chunk6MDQKHRHcjs.SMILIE_REPLACEMENTS; exports.STYLE_ID_ATTRIBUTE = _chunk6MDQKHRHcjs.STYLE_ID_ATTRIBUTE; exports.SlashCommands = _chunk6MDQKHRHcjs.SlashCommands; exports.SmilieReplacer = _chunk6MDQKHRHcjs.SmilieReplacer; exports.StyleRegistry = _chunk3CC7OPUQcjs.StyleRegistry; exports.TABLE_ACTIONS = _chunkMC2LQN5Scjs.TABLE_ACTIONS; exports.TRACK_CHANGES_SKIP_META = _chunkIFHKKVXHcjs.TRACK_CHANGES_SKIP_META; exports.Table = _chunkMC2LQN5Scjs.Table; exports.TableCell = _chunkMC2LQN5Scjs.TableCell; exports.TableHeader = _chunkMC2LQN5Scjs.TableHeader; exports.TableOfContents = _chunk6MDQKHRHcjs.TableOfContents; exports.TableRow = _chunkMC2LQN5Scjs.TableRow; exports.TemplateSuggestions = _chunk6MDQKHRHcjs.TemplateSuggestions; exports.TrackChanges = _chunkIFHKKVXHcjs.TrackChanges; exports.TrackChangesStore = _chunkIFHKKVXHcjs.TrackChangesStore; exports.TrackedDeletion = _chunkIFHKKVXHcjs.TrackedDeletion; exports.TrackedFormatChange = _chunkIFHKKVXHcjs.TrackedFormatChange; exports.TrackedInsertion = _chunkIFHKKVXHcjs.TrackedInsertion; exports.applyDocumentComparison = _chunk6MDQKHRHcjs.applyDocumentComparison; exports.applyReplacements = _chunk6MDQKHRHcjs.applyReplacements; exports.autocorrectPluginKey = _chunk6MDQKHRHcjs.autocorrectPluginKey; exports.buildOutlineTree = _chunk6MDQKHRHcjs.buildOutlineTree; exports.capitalizeSentenceRules = _chunk6MDQKHRHcjs.capitalizeSentenceRules; exports.captureSelectionFormat = _chunk6MDQKHRHcjs.captureSelectionFormat; exports.commentsPluginKey = _chunk6MDQKHRHcjs.commentsPluginKey; exports.compareInEditor = _chunk6MDQKHRHcjs.compareInEditor; exports.compileFindPattern = _chunk6MDQKHRHcjs.compileFindPattern; exports.computeOutline = _chunk6MDQKHRHcjs.computeOutline; exports.createCommentStore = _chunkIFHKKVXHcjs.createCommentStore; exports.createFindReplaceCommands = _chunk6MDQKHRHcjs.createFindReplaceCommands; exports.createMentionExtension = _chunk6MDQKHRHcjs.createMentionExtension; exports.createOutlineStore = _chunk6MDQKHRHcjs.createOutlineStore; exports.createParagraphStylesStore = _chunk6MDQKHRHcjs.createParagraphStylesStore; exports.createReviewId = _chunkIFHKKVXHcjs.createReviewId; exports.createRichTextPreset = _chunk6MDQKHRHcjs.createRichTextPreset; exports.createSearchBudget = _chunk6MDQKHRHcjs.createSearchBudget; exports.createStyleRegistry = _chunk3CC7OPUQcjs.createStyleRegistry; exports.createTableCommands = _chunk6MDQKHRHcjs.createTableCommands; exports.createTableExtensions = _chunkMC2LQN5Scjs.createTableExtensions; exports.createTableNestingPlugin = _chunkMC2LQN5Scjs.createTableNestingPlugin; exports.createTableStore = _chunkMC2LQN5Scjs.createTableStore; exports.crossReferencePluginKey = _chunk6MDQKHRHcjs.crossReferencePluginKey; exports.defaultAutocorrectRules = _chunk6MDQKHRHcjs.defaultAutocorrectRules; exports.describeBlockChange = _chunkIFHKKVXHcjs.describeBlockChange; exports.describeFormatChange = _chunkIFHKKVXHcjs.describeFormatChange; exports.documentStructureCommandItems = _chunk6MDQKHRHcjs.documentStructureCommandItems; exports.expandReplacement = _chunk6MDQKHRHcjs.expandReplacement; exports.fileImportPluginKey = _chunk6MDQKHRHcjs.fileImportPluginKey; exports.findAllMatches = _chunk6MDQKHRHcjs.findAllMatches; exports.findAutocorrection = _chunk6MDQKHRHcjs.findAutocorrection; exports.findCommentRanges = _chunk6MDQKHRHcjs.findCommentRanges; exports.findHexColors = _chunk6MDQKHRHcjs.findHexColors; exports.findReplacePluginKey = _chunk6MDQKHRHcjs.findReplacePluginKey; exports.foldCodePoint = _chunk6MDQKHRHcjs.foldCodePoint; exports.footnotesMarkdownIt = _chunk6MDQKHRHcjs.footnotesMarkdownIt; exports.footnotesPluginKey = _chunk6MDQKHRHcjs.footnotesPluginKey; exports.formatFindStatus = _chunk6MDQKHRHcjs.formatFindStatus; exports.formatReviewTime = _chunkIFHKKVXHcjs.formatReviewTime; exports.fractionRules = _chunk6MDQKHRHcjs.fractionRules; exports.getActiveHeading = _chunk6MDQKHRHcjs.getActiveHeading; exports.getBookmarks = _chunk6MDQKHRHcjs.getBookmarks; exports.getCommentAnchors = _chunk6MDQKHRHcjs.getCommentAnchors; exports.getCommentAuthor = _chunk6MDQKHRHcjs.getCommentAuthor; exports.getCommentIdsAt = _chunk6MDQKHRHcjs.getCommentIdsAt; exports.getCommentStore = _chunk6MDQKHRHcjs.getCommentStore; exports.getCrossReferenceTargets = _chunk6MDQKHRHcjs.getCrossReferenceTargets; exports.getDocumentStructureCommandItems = _chunk6MDQKHRHcjs.getDocumentStructureCommandItems; exports.getFindReplaceState = _chunk6MDQKHRHcjs.getFindReplaceState; exports.getFindReplaceStore = _chunk6MDQKHRHcjs.getFindReplaceStore; exports.getFootnotes = _chunk6MDQKHRHcjs.getFootnotes; exports.getMentionNodes = _chunk6MDQKHRHcjs.getMentionNodes; exports.getOutline = _chunk6MDQKHRHcjs.getOutline; exports.getParagraphStyleAt = _chunk6MDQKHRHcjs.getParagraphStyleAt; exports.getStyleRegistry = _chunk6MDQKHRHcjs.getStyleRegistry; exports.getTableActionState = _chunkMC2LQN5Scjs.getTableActionState; exports.getTableOfContentsEntries = _chunk6MDQKHRHcjs.getTableOfContentsEntries; exports.getTableState = _chunkMC2LQN5Scjs.getTableState; exports.getTrackChangesStore = _chunkIFHKKVXHcjs.getTrackChangesStore; exports.getTrackedChangeAt = _chunkIFHKKVXHcjs.getTrackedChangeAt; exports.getTrackedChanges = _chunkIFHKKVXHcjs.getTrackedChanges; exports.handleImageInsertion = _chunk6MDQKHRHcjs.handleImageInsertion; exports.handleTablePasteWithoutNesting = _chunkMC2LQN5Scjs.handleTablePasteWithoutNesting; exports.imagePastePluginKey = _chunk6MDQKHRHcjs.imagePastePluginKey; exports.insertImageNode = _chunk6MDQKHRHcjs.insertImageNode; exports.insertSliceAfterTable = _chunkMC2LQN5Scjs.insertSliceAfterTable; exports.isGfmTable = _chunkMC2LQN5Scjs.isGfmTable; exports.isInTableCell = _chunkMC2LQN5Scjs.isInTableCell; exports.isInsidePromptToken = _chunk6MDQKHRHcjs.isInsidePromptToken; exports.isMoveSized = _chunkIFHKKVXHcjs.isMoveSized; exports.isParagraphStyleAvailable = _chunk6MDQKHRHcjs.isParagraphStyleAvailable; exports.isSelectionInTable = _chunkMC2LQN5Scjs.isSelectionInTable; exports.isTableEnabled = _chunkMC2LQN5Scjs.isTableEnabled; exports.isTrackChangesEnabled = _chunkIFHKKVXHcjs.isTrackChangesEnabled; exports.isValidStyleId = _chunk3CC7OPUQcjs.isValidStyleId; exports.navigateToHeading = _chunk6MDQKHRHcjs.navigateToHeading; exports.normalizeTableCellAlignment = _chunkMC2LQN5Scjs.normalizeTableCellAlignment; exports.normalizeTableCellColor = _chunkMC2LQN5Scjs.normalizeTableCellColor; exports.outermostTableDepth = _chunkMC2LQN5Scjs.outermostTableDepth; exports.outlinePluginKey = _chunk6MDQKHRHcjs.outlinePluginKey; exports.paragraphStylesPluginKey = _chunk6MDQKHRHcjs.paragraphStylesPluginKey; exports.parseReplacement = _chunk6MDQKHRHcjs.parseReplacement; exports.removeImageNode = _chunk6MDQKHRHcjs.removeImageNode; exports.resolveTrackedChanges = _chunkIFHKKVXHcjs.resolveTrackedChanges; exports.richClipboardPluginKey = _chunk6MDQKHRHcjs.richClipboardPluginKey; exports.runTableAction = _chunkMC2LQN5Scjs.runTableAction; exports.safeCSSValue = _chunk3CC7OPUQcjs.safeCSSValue; exports.searchDocument = _chunk6MDQKHRHcjs.searchDocument; exports.setMentionRoleAt = _chunk6MDQKHRHcjs.setMentionRoleAt; exports.shouldShowTableBubbleMenu = _chunkMC2LQN5Scjs.shouldShowTableBubbleMenu; exports.sliceContainsTable = _chunkMC2LQN5Scjs.sliceContainsTable; exports.smartQuoteRules = _chunk6MDQKHRHcjs.smartQuoteRules; exports.smilieAutocorrectRules = _chunk6MDQKHRHcjs.smilieAutocorrectRules; exports.symbolRules = _chunk6MDQKHRHcjs.symbolRules; exports.syncFootnotes = _chunk6MDQKHRHcjs.syncFootnotes; exports.tableNestingPluginKey = _chunkMC2LQN5Scjs.tableNestingPluginKey; exports.tableOfContentsMarkdownIt = _chunk6MDQKHRHcjs.tableOfContentsMarkdownIt; exports.tableOfContentsPluginKey = _chunk6MDQKHRHcjs.tableOfContentsPluginKey; exports.trackChangesPluginKey = _chunkIFHKKVXHcjs.trackChangesPluginKey; exports.trackedChangeLabel = _chunkIFHKKVXHcjs.trackedChangeLabel; exports.twoInitialCapitalsRules = _chunk6MDQKHRHcjs.twoInitialCapitalsRules; exports.unnestTables = _chunkMC2LQN5Scjs.unnestTables; exports.updateImageSrc = _chunk6MDQKHRHcjs.updateImageSrc; exports.validateFindPattern = _chunk6MDQKHRHcjs.validateFindPattern; exports.writeRichClipboard = _chunk6MDQKHRHcjs.writeRichClipboard;
|
|
354
354
|
//# sourceMappingURL=index.cjs.map
|