{
  "version": 3,
  "sources": ["../../../src/rendering-util/insertLookDefs.ts"],
  "sourcesContent": ["import type { MermaidConfig } from '../config.type.js';\nimport type { SVG } from '../diagram-api/types.js';\n\n/**\n * Append the `<defs>` that the look-specific stylesheet rules point at.\n *\n * `styles.ts` emits, for `look: neo`, declarations of the form\n * `stroke: url(#<svgId>-gradient)` and `filter: url(#<svgId>-drop-shadow)`. An `url(#\u2026)`\n * paint that resolves to nothing is painted as **none**, not as a fallback colour \u2014 so a\n * diagram that carries `data-look=\"neo\"` without these definitions loses its borders\n * entirely rather than degrading to a plain stroke.\n *\n * Every diagram going through `rendering-util/render.ts` gets them from there. Block\n * diagrams run their own render loop and so have to ask for them; extracted here rather\n * than duplicated so the two cannot drift into producing different gradients.\n *\n * Idempotent by id: calling it twice on one svg would append duplicate definitions, so\n * call it once per render.\n *\n * @param svg - The diagram's root `svg` selection. Its `id` scopes every definition, so\n * several diagrams on one page do not collide.\n * @param config - The merged config, read for `theme` and `themeVariables`.\n */\nexport const insertLookDefs = (svg: SVG, config: MermaidConfig): void => {\n  const { theme, themeVariables } = config;\n  const { useGradient, gradientStart, gradientStop } = themeVariables ?? {};\n  const svgId = svg.attr('id');\n  // The shadow is tinted against the background rather than always black: on a dark theme\n  // a black shadow is invisible.\n  const floodColor = theme?.includes('dark') ? '#FFFFFF' : '#000000';\n\n  const dropShadow = (id: string, size: string, offset: string) =>\n    svg\n      .append('defs')\n      .append('filter')\n      .attr('id', id)\n      .attr('height', size)\n      .attr('width', size)\n      .append('feDropShadow')\n      .attr('dx', offset)\n      .attr('dy', offset)\n      .attr('stdDeviation', 0)\n      .attr('flood-opacity', '0.06')\n      .attr('flood-color', floodColor);\n\n  dropShadow(`${svgId}-drop-shadow`, '130%', '4');\n  dropShadow(`${svgId}-drop-shadow-small`, '150%', '2');\n\n  if (!useGradient) {\n    return;\n  }\n\n  const gradient = svg\n    .append('linearGradient')\n    .attr('id', `${svgId}-gradient`)\n    .attr('gradientUnits', 'objectBoundingBox')\n    .attr('x1', '0%')\n    .attr('y1', '0%')\n    .attr('x2', '100%')\n    .attr('y2', '0%');\n\n  gradient\n    .append('svg:stop')\n    .attr('offset', '0%')\n    .attr('stop-color', gradientStart)\n    .attr('stop-opacity', 1);\n\n  gradient\n    .append('svg:stop')\n    .attr('offset', '100%')\n    .attr('stop-color', gradientStop)\n    .attr('stop-opacity', 1);\n};\n"],
  "mappings": ";;;;;AAuBO,IAAM,iBAAiB,wBAAC,KAAU,WAAgC;AACvE,QAAM,EAAE,OAAO,eAAe,IAAI;AAClC,QAAM,EAAE,aAAa,eAAe,aAAa,IAAI,kBAAkB,CAAC;AACxE,QAAM,QAAQ,IAAI,KAAK,IAAI;AAG3B,QAAM,aAAa,OAAO,SAAS,MAAM,IAAI,YAAY;AAEzD,QAAM,aAAa,wBAAC,IAAY,MAAc,WAC5C,IACG,OAAO,MAAM,EACb,OAAO,QAAQ,EACf,KAAK,MAAM,EAAE,EACb,KAAK,UAAU,IAAI,EACnB,KAAK,SAAS,IAAI,EAClB,OAAO,cAAc,EACrB,KAAK,MAAM,MAAM,EACjB,KAAK,MAAM,MAAM,EACjB,KAAK,gBAAgB,CAAC,EACtB,KAAK,iBAAiB,MAAM,EAC5B,KAAK,eAAe,UAAU,GAZhB;AAcnB,aAAW,GAAG,KAAK,gBAAgB,QAAQ,GAAG;AAC9C,aAAW,GAAG,KAAK,sBAAsB,QAAQ,GAAG;AAEpD,MAAI,CAAC,aAAa;AAChB;AAAA,EACF;AAEA,QAAM,WAAW,IACd,OAAO,gBAAgB,EACvB,KAAK,MAAM,GAAG,KAAK,WAAW,EAC9B,KAAK,iBAAiB,mBAAmB,EACzC,KAAK,MAAM,IAAI,EACf,KAAK,MAAM,IAAI,EACf,KAAK,MAAM,MAAM,EACjB,KAAK,MAAM,IAAI;AAElB,WACG,OAAO,UAAU,EACjB,KAAK,UAAU,IAAI,EACnB,KAAK,cAAc,aAAa,EAChC,KAAK,gBAAgB,CAAC;AAEzB,WACG,OAAO,UAAU,EACjB,KAAK,UAAU,MAAM,EACrB,KAAK,cAAc,YAAY,EAC/B,KAAK,gBAAgB,CAAC;AAC3B,GAjD8B;",
  "names": []
}
