{
  "version": 3,
  "sources": ["../../../../src/lib/shapes/shared/getDisplayValues.ts"],
  "sourcesContent": ["import { Editor, TLShape, TLTheme } from '@tldraw/editor'\n\n/** @public */\nexport interface ShapeOptionsWithDisplayValues<\n\tShape extends TLShape,\n\tDisplayValues extends object,\n> {\n\tgetDefaultDisplayValues(\n\t\teditor: Editor,\n\t\tshape: Shape,\n\t\ttheme: TLTheme,\n\t\tcolorMode: 'light' | 'dark'\n\t): DisplayValues\n\tgetCustomDisplayValues(\n\t\teditor: Editor,\n\t\tshape: Shape,\n\t\ttheme: TLTheme,\n\t\tcolorMode: 'light' | 'dark'\n\t): Partial<DisplayValues>\n}\n\nconst dvCache = new WeakMap<\n\tTLShape,\n\t{ theme: TLTheme; colorMode: 'light' | 'dark'; values: object }\n>()\n\n/**\n * Get the resolved display values for a shape, merging the base values with any overrides.\n *\n * @public\n */\nexport function getDisplayValues<Shape extends TLShape, DisplayValues extends object>(\n\tutil: { editor: Editor; options: ShapeOptionsWithDisplayValues<Shape, DisplayValues> },\n\tshape: Shape,\n\tcolorMode?: 'light' | 'dark' // An override, used when exporting images from the non-current color mode\n): DisplayValues {\n\tconst theme = util.editor.getCurrentTheme()\n\tconst resolvedColorMode = colorMode ?? util.editor.getColorMode()\n\tconst cached = dvCache.get(shape)\n\tif (cached && cached.theme === theme && cached.colorMode === resolvedColorMode) {\n\t\treturn cached.values as DisplayValues\n\t}\n\tconst values = {\n\t\t...util.options.getDefaultDisplayValues(util.editor, shape, theme, resolvedColorMode),\n\t\t...util.options.getCustomDisplayValues(util.editor, shape, theme, resolvedColorMode),\n\t}\n\tdvCache.set(shape, { theme, colorMode: resolvedColorMode, values })\n\treturn values\n}\n"],
  "mappings": "AAqBA,MAAM,UAAU,oBAAI,QAGlB;AAOK,SAAS,iBACf,MACA,OACA,WACgB;AAChB,QAAM,QAAQ,KAAK,OAAO,gBAAgB;AAC1C,QAAM,oBAAoB,aAAa,KAAK,OAAO,aAAa;AAChE,QAAM,SAAS,QAAQ,IAAI,KAAK;AAChC,MAAI,UAAU,OAAO,UAAU,SAAS,OAAO,cAAc,mBAAmB;AAC/E,WAAO,OAAO;AAAA,EACf;AACA,QAAM,SAAS;AAAA,IACd,GAAG,KAAK,QAAQ,wBAAwB,KAAK,QAAQ,OAAO,OAAO,iBAAiB;AAAA,IACpF,GAAG,KAAK,QAAQ,uBAAuB,KAAK,QAAQ,OAAO,OAAO,iBAAiB;AAAA,EACpF;AACA,UAAQ,IAAI,OAAO,EAAE,OAAO,WAAW,mBAAmB,OAAO,CAAC;AAClE,SAAO;AACR;",
  "names": []
}
