{
  "version": 3,
  "sources": ["../../src/misc/TLScribble.ts"],
  "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { SetValue } from '../util-types'\nimport { TLCanvasUiColor, canvasUiColorTypeValidator } from './TLColor'\nimport { VecModel, vecModelValidator } from './geometry-types'\n\n/**\n * All available scribble states used by the tldraw drawing system.\n *\n * Scribble states represent the different phases of a drawing stroke:\n *\n * - `starting`: The scribble is being initiated\n * - `paused`: The scribble is temporarily paused\n * - `active`: The scribble is actively being drawn\n * - `complete`: The scribble is done being drawn but not yet fading\n * - `stopping`: The scribble is being finished\n *\n * These states help manage the drawing lifecycle and apply appropriate\n * visual effects during different phases of the stroke.\n *\n * @example\n * ```ts\n * // Check if a scribble state is valid\n * if (TL_SCRIBBLE_STATES.has('active')) {\n *   console.log('Valid scribble state')\n * }\n *\n * // Get all available scribble states\n * const allStates = Array.from(TL_SCRIBBLE_STATES)\n * ```\n *\n * @public\n */\nexport const TL_SCRIBBLE_STATES = new Set([\n\t'starting',\n\t'paused',\n\t'active',\n\t'complete',\n\t'stopping',\n] as const)\n\n/**\n * A scribble object representing a drawing stroke in tldraw.\n *\n * Scribbles are temporary drawing strokes that appear during freehand drawing\n * operations. They provide visual feedback as the user draws and can be styled\n * with various properties like size, color, and effects.\n *\n * @example\n * ```ts\n * // A basic scribble stroke\n * const scribble: TLScribble = {\n *   id: 'scribble-123',\n *   points: [\n *     { x: 0, y: 0, z: 0.5 },\n *     { x: 10, y: 5, z: 0.7 },\n *     { x: 20, y: 10, z: 0.6 }\n *   ],\n *   size: 4,\n *   color: 'black',\n *   opacity: 0.8,\n *   state: 'active',\n *   delay: 0,\n *   shrink: 0.1,\n *   taper: true\n * }\n *\n * // A laser pointer scribble\n * const laserScribble: TLScribble = {\n *   id: 'laser-pointer',\n *   points: [{ x: 50, y: 50, z: 1.0 }],\n *   size: 8,\n *   color: 'laser',\n *   opacity: 1.0,\n *   state: 'active',\n *   delay: 100,\n *   shrink: 0,\n *   taper: false\n * }\n * ```\n *\n * @public\n */\nexport interface TLScribble {\n\t/** Unique identifier for the scribble */\n\tid: string\n\t/** Array of points that make up the scribble path */\n\tpoints: VecModel[]\n\t/** The brush size/width of the scribble stroke */\n\tsize: number\n\t/** The color of the scribble using canvas UI color types */\n\tcolor: TLCanvasUiColor\n\t/** The opacity of the scribble (0-1) */\n\topacity: number\n\t/** The current state of the scribble drawing */\n\tstate: SetValue<typeof TL_SCRIBBLE_STATES>\n\t/** Time delay in milliseconds for animation effects */\n\tdelay: number\n\t/** Amount the stroke should shrink over time (0-1) */\n\tshrink: number\n\t/** Whether the stroke should taper at the ends */\n\ttaper: boolean\n}\n\n/**\n * A validator for TLScribble objects.\n *\n * This validator ensures that scribble objects have all required properties\n * with valid types and values. It validates the points array, size constraints,\n * color types, and state values according to the scribble system requirements.\n *\n * @example\n * ```ts\n * import { scribbleValidator } from '@tldraw/tlschema'\n *\n * // Validate a scribble object\n * try {\n *   const validScribble = scribbleValidator.validate({\n *     id: 'scribble-1',\n *     points: [{ x: 0, y: 0, z: 1 }, { x: 10, y: 10, z: 1 }],\n *     size: 3,\n *     color: 'black',\n *     opacity: 0.8,\n *     state: 'active',\n *     delay: 0,\n *     shrink: 0.05,\n *     taper: true\n *   })\n *   console.log('Valid scribble:', validScribble)\n * } catch (error) {\n *   console.error('Invalid scribble:', error.message)\n * }\n * ```\n *\n * @public\n */\nexport const scribbleValidator: T.ObjectValidator<TLScribble> = T.object({\n\tid: T.string,\n\tpoints: T.arrayOf(vecModelValidator),\n\tsize: T.positiveNumber,\n\tcolor: canvasUiColorTypeValidator,\n\topacity: T.number,\n\tstate: T.setEnum(TL_SCRIBBLE_STATES),\n\tdelay: T.number,\n\tshrink: T.number,\n\ttaper: T.boolean,\n})\n"],
  "mappings": "AAAA,SAAS,SAAS;AAElB,SAA0B,kCAAkC;AAC5D,SAAmB,yBAAyB;AA6BrC,MAAM,qBAAqB,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAU;AAiGH,MAAM,oBAAmD,EAAE,OAAO;AAAA,EACxE,IAAI,EAAE;AAAA,EACN,QAAQ,EAAE,QAAQ,iBAAiB;AAAA,EACnC,MAAM,EAAE;AAAA,EACR,OAAO;AAAA,EACP,SAAS,EAAE;AAAA,EACX,OAAO,EAAE,QAAQ,kBAAkB;AAAA,EACnC,OAAO,EAAE;AAAA,EACT,QAAQ,EAAE;AAAA,EACV,OAAO,EAAE;AACV,CAAC;",
  "names": []
}
